- method SelectMgr_SelectableObject::HasSelection became virtual, unnecessary variable was removed;
- redefined HasSelection method for multiple connected interactives;
- AIS_InteractiveContext::AddOrRemoveSelected was corrected to use global selection owner;
- test case for issue #27285
if (!theObject->HasInteractiveContext())
theObject->SetContext (this);
- const Handle(SelectMgr_Selection)& aSel = theObject->Selection (aGlobalSelMode);
-
- if (aSel->IsEmpty())
- return;
-
- aSel->Init();
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
+ const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
if (anOwner.IsNull() || !anOwner->HasSelectable())
return;
{
return myAssemblyOwner;
}
+
+//=======================================================================
+//function : HasSelection
+//purpose :
+//=======================================================================
+Standard_Boolean AIS_MultipleConnectedInteractive::HasSelection (const Standard_Integer theMode) const
+{
+ for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
+ {
+ Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
+ if (aChild.IsNull())
+ continue;
+
+ if (!aChild->HasSelection (theMode))
+ return Standard_False;
+ }
+
+ return Standard_True;
+}
//! Returns the owner of mode for selection of object as a whole
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
+ //! Returns true if a selection corresponding to the selection mode theMode was computed for all
+ //! children of multiple connected interactive object.
+ Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive,AIS_InteractiveObject)
//==================================================
-// Function:
+// Function: HasSelection
// Purpose :
//==================================================
-
-Standard_Boolean SelectMgr_SelectableObject
-::HasSelection(const Standard_Integer aMode) const
+Standard_Boolean SelectMgr_SelectableObject::HasSelection (const Standard_Integer theMode) const
{
- Standard_Boolean Found=Standard_False;
- for (Standard_Integer I=1;I<= myselections.Length() && !Found;I++)
- { if(((myselections.Value(I))->Mode())==aMode)
- return Standard_True;
- }
+ for (Standard_Integer aSelIdx = 1; aSelIdx <= myselections.Length(); ++aSelIdx)
+ {
+ if (((myselections.Value (aSelIdx))->Mode()) == theMode)
+ return Standard_True;
+ }
return Standard_False;
}
Standard_EXPORT const Handle(SelectMgr_Selection)& Selection (const Standard_Integer aMode) const;
//! Returns true if a selection corresponding to the
- //! selection mode aMode is present in this framework.
- Standard_EXPORT Standard_Boolean HasSelection (const Standard_Integer aMode) const;
+ //! selection mode theMode was computed for this object.
+ Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const;
//! Begins the iteration scanning for sensitive primitives.
void Init();
--- /dev/null
+puts "========"
+puts "OCC27285"
+puts "========"
+puts ""
+##################################################################
+puts "Visualization - selection of AIS_MultipleConnectedInteractive is broken"
+##################################################################
+
+pload VISUALIZATION MODELING
+
+vinit
+vsetdispmode 1
+
+box b 100 100 100
+vdisplay b
+
+vconnect bc 0 0 300 b
+
+vfit
+
+vchangeselected b
+vchangeselected bc
+
+if {[vnbselected] != "2"} {
+ puts "ERROR: only one object is selected"
+}
+
+if {[string match *Selected* [vstate bc]] != "1"} {
+ puts "ERROR: multiple connected interactive object is not selected"
+}
+
+set only_screen 1