void AIS_InteractiveContext::Delete() const
{
// clear the current selection
- mySelection->Select();
+ mySelection->Clear();
// let's remove one reference explicitly. this operation's supposed to
// be performed when mgrSelector will be destroyed but anyway...
Standard_Boolean isFound = Standard_False;
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
- Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
+ Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
Display (anObj, Standard_False);
isFound = Standard_True;
}
mySelection->Init();
while (mySelection->More())
{
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
+ Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Erase (anObj, Standard_False);
}
Standard_Boolean isFound = Standard_False;
- for (mySelection->Init(); mySelection->More(); mySelection->Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
isFound = Standard_True;
- Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (mySelection->Value());
+ Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
anObj->SetAspect (theAspect);
}
//=======================================================================
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
{
- mySelection->Init();
- while (mySelection->More())
+ SelectMgr_SequenceOfOwner aSeq;
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (anOwner->Selectable() == theObject)
+ if (aSelIter.Value()->Selectable() == theObject
+ && aSelIter.Value()->IsSelected())
{
- if (anOwner->IsSelected())
- {
- AddOrRemoveSelected (anOwner, Standard_False);
- mySelection->Init();
- continue;
- }
+ aSeq.Append (aSelIter.Value());
}
- mySelection->Next();
+ }
+ for (SelectMgr_SequenceOfOwner::Iterator aDelIter (aSeq); aDelIter.More(); aDelIter.Next())
+ {
+ AddOrRemoveSelected (aDelIter.Value(), Standard_False);
}
}
AIS_MapOfObjectOwners anObjectOwnerMap;
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
- Handle(AIS_InteractiveObject) anObj (Handle(AIS_InteractiveObject)::DownCast (aSelection->Value()));
- if (!anObj.IsNull())
+ const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value();
+ Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
+ if (anObj->IsInfinite())
{
- if (anObj->IsInfinite())
- continue;
+ continue;
+ }
+ if (anOwner == anObj->GlobalSelOwner())
+ {
Bnd_Box aTmpBnd;
anObj->BoundingBox (aTmpBnd);
aBndSelected.Add (aTmpBnd);
}
else
{
- Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (aSelection->Value()));
- if (anOwner.IsNull())
- continue;
-
Handle(SelectMgr_IndexedMapOfOwner) anOwnerMap;
if (!anObjectOwnerMap.Find (anOwner->Selectable(), anOwnerMap))
{
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
//! Adds object in the selection.
- Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(Standard_Transient)& theObject);
+ Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
+
+ //! Adds object in the selection.
+ AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
+ {
+ return AddSelect (theObject->GlobalSelOwner());
+ }
//! Selects everything found in the bounding rectangle
//! defined by the pixel minima and maxima, XPMin,
if (!theOwner->IsAutoHilight())
{
SelectMgr_SequenceOfOwner aSeq;
- for (mySelection->Init(); mySelection->More(); mySelection->Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- const Handle(SelectMgr_EntityOwner) aSelOwnr =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (aSelOwnr->Selectable() != anObj)
- continue;
- aSeq.Append (aSelOwnr);
+ if (aSelIter.Value()->Selectable() == anObj)
+ {
+ aSeq.Append (aSelIter.Value());
+ }
}
anObj->HilightSelected (myMainPM, aSeq);
}
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
{
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
- for (mySelection->Init(); mySelection->More(); mySelection->Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (anOwner.IsNull() || !anOwner->HasSelectable())
- continue;
-
- const Handle(AIS_InteractiveObject) anInteractive =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
+ const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (anOwner->IsAutoHilight())
{
const Standard_Integer aHiMode = anInteractive->HasHilightMode() ? anInteractive->HilightMode() : 0;
//function : AddSelect
//purpose :
//=======================================================================
-AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(Standard_Transient)& theObject)
+AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
{
if (HasOpenedContext())
{
{
unhighlightSelected (Standard_True);
- mySelection->Select();
+ mySelection->Clear();
if (toUpdateViewer && myWasLastMain)
{
UpdateCurrentViewer();
// In case of selection without using local context
myMainPM->ClearImmediateDraw();
AIS_MapOfObjSelectedOwners anObjOwnerMap;
- for (mySelection->Init(); mySelection->More(); mySelection->Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (!anOwner.IsNull() && anOwner->HasSelectable())
+ const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ if (anOwner == anObj->GlobalSelOwner())
{
- const Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- if (anOwner == anObj->GlobalSelOwner())
- {
- Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
- aState->SetHilightStatus (Standard_True);
- aState->SetHilightColor (mySelectionColor);
- }
- anOwner->State (1);
- if (!anOwner->IsAutoHilight())
+ Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
+ aState->SetHilightStatus (Standard_True);
+ aState->SetHilightColor (mySelectionColor);
+ }
+ anOwner->State (1);
+ if (!anOwner->IsAutoHilight())
+ {
+ NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq;
+ if (anObjOwnerMap.Find (anObj, aSeq))
{
- NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq;
- if (anObjOwnerMap.Find (anObj, aSeq))
- {
- aSeq->Append (anOwner);
- }
- else
- {
- aSeq = new SelectMgr_SequenceOfOwner();
- aSeq->Append (anOwner);
- anObjOwnerMap.Bind (anObj, aSeq);
- }
+ aSeq->Append (anOwner);
}
else
{
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
- anOwner->HilightWithColor (myMainPM, mySelectionColor, aHiMode);
+ aSeq = new SelectMgr_SequenceOfOwner();
+ aSeq->Append (anOwner);
+ anObjOwnerMap.Bind (anObj, aSeq);
}
}
+ else
+ {
+ const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
+ anOwner->HilightWithColor (myMainPM, mySelectionColor, aHiMode);
+ }
}
if (!anObjOwnerMap.IsEmpty())
return myLocalContexts (myCurLocalIndex)->UnhilightPicked (theToUpdateViewer);
}
- for (mySelection->Init(); mySelection->More(); mySelection->Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (!anOwner.IsNull() && anOwner->HasSelectable())
+ const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ if (anOwner == anObj->GlobalSelOwner())
{
- const Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- if (anOwner == anObj->GlobalSelOwner())
- {
- myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
- }
- anOwner->State (0);
- const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
- anOwner->Unhilight (myMainPM, aHiMode);
+ myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
}
+
+ anOwner->State (0);
+ const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
+ anOwner->Unhilight (myMainPM, aHiMode);
}
if (theToUpdateViewer)
unhighlightSelected();
- mySelection->Select();
+ mySelection->Clear();
myMainPM->ClearImmediateDraw();
if (theToUpdateViewer)
for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
+ const Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
+ if (!myFilters->IsOk (anOwner))
+ {
continue;
+ }
Handle(AIS_InteractiveObject) aSelectable =
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if(HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->NextSelected();
- return;
}
mySelection->Next();
return myLocalContexts (myCurLocalIndex)->SelectedShape();
}
- if (mySelection->Extent() == 0)
+ if (!mySelection->More())
return TopoDS_Shape();
const Handle(StdSelect_BRepOwner) anOwner =
return myLocalContexts(myCurLocalIndex)->SelectedInteractive();
}
- const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
- if (anOwner.IsNull() || !anOwner->HasSelectable())
- return NULL;
-
- return Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+ return !mySelection->More()
+ ? Handle(AIS_InteractiveObject)()
+ : Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
}
//=======================================================================
//function : SelectedOwner
return myLocalContexts(myCurLocalIndex)->SelectedOwner();
}
- return mySelection->Extent() > 0 ?
- Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value()) : NULL;
+ return !mySelection->More()
+ ? Handle(SelectMgr_EntityOwner)()
+ : mySelection->Value();
}
//=======================================================================
Standard_Integer DM,HM,SM;
GetDefModes(anIObj,DM,HM,SM);
- if(mySelection->IsSelected(anIObj))
+ if(IsSelected(anIObj))
myMainPM->Highlight(anIObj,HM);
if(updateviewer){
// clear the selector...
myMainVS->Clear();
- Handle(Standard_Transient) Tr;
- for (mySelection->Init(); mySelection->More(); mySelection->Next()){
- Tr = mySelection->Value();
- Handle(SelectMgr_EntityOwner)::DownCast (Tr)->SetSelected (Standard_False);
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ {
+ aSelIter.Value()->SetSelected (Standard_False);
}
-
- mySelection->Select();
+ mySelection->Clear();
Handle(V3d_View) aDummyView;
myMainVS->ClearSensitive (aDummyView);
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& aView);
//! returns the number of selected
- Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(Standard_Transient)& theObject);
+ Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
//function : AddSelect
//purpose :
//=======================================================================
-AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(Standard_Transient)& theObject)
+AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
{
mySelection->AddSelect (theObject);
if (aDetIndex <= 0)
{
ClearSelected (toUpdateViewer);
- return (mySelection->Extent() == 0) ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
+ return mySelection->IsEmpty() ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
}
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
//=======================================================================
//function : HilightPicked
-//purpose :
+//purpose :
//=======================================================================
-void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
+void AIS_LocalContext::HilightPicked (const Standard_Boolean theToUpdateviewer)
{
- if( mySelection.IsNull() ) return;
+ if (mySelection.IsNull())
+ {
+ return;
+ }
- typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > SelectMgr_DataMapOfObjectOwners;
+ typedef NCollection_Shared<SelectMgr_SequenceOfOwner> SelectMgr_HSequenceOfOwner;
+ typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), Handle(SelectMgr_HSequenceOfOwner) > SelectMgr_DataMapOfObjectOwners;
SelectMgr_DataMapOfObjectOwners aMap;
- Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
-
// to avoid problems when there is a loop searching for selected objects...
- const AIS_NListTransient& Obj = mySelection->Objects();
- AIS_NListTransient::Iterator anIter( Obj );
- for(; anIter.More(); anIter.Next())
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- const Handle(Standard_Transient)& Tr = anIter.Value();
- if(!Tr.IsNull()){
- const Handle(SelectMgr_EntityOwner)& Ownr =
- *((const Handle(SelectMgr_EntityOwner)*) &Tr);
- Handle(AIS_InteractiveObject) IO;
- if(Ownr->HasSelectable()){
- Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
- if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
- Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
- IO = Handle(AIS_InteractiveObject)::DownCast (SO);
- }
- }
- Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
- Standard_Integer HM = GetHiMod(Handle(AIS_InteractiveObject)::DownCast (SO));
- if ( Ownr->IsAutoHilight() )
- Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM);
- else if ( aMap.IsBound (SO) )
- aMap(SO)->Append ( Ownr );
- else {
- NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq = new SelectMgr_SequenceOfOwner;
- aSeq->Append ( Ownr );
- aMap.Bind ( SO, aSeq );
- }
+ const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
+ Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
+ if (anOwner->IsAutoHilight())
+ {
+ Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
+ const Standard_Integer aHighMode = GetHiMod (anIO);
+ anOwner->HilightWithColor (myMainPM, myCTX->SelectionColor(), aHighMode);
+ continue;
+ }
+
+ Handle(SelectMgr_HSequenceOfOwner) aSeq;
+ if (aMap.Find (aSelObj, aSeq))
+ {
+ aSeq->Append (anOwner);
+ }
+ else
+ {
+ aSeq = new SelectMgr_HSequenceOfOwner();
+ aSeq->Append (anOwner);
+ aMap.Bind (aSelObj, aSeq);
}
}
- for ( SelectMgr_DataMapOfObjectOwners::Iterator aMapIter(aMap);
- aMapIter.More(); aMapIter.Next() )
+ for (SelectMgr_DataMapOfObjectOwners::Iterator aMapIter (aMap); aMapIter.More(); aMapIter.Next())
{
aMapIter.Key()->HilightSelected (myMainPM, *aMapIter.Value());
}
- if (updateviewer)
+ if (theToUpdateviewer)
{
myCTX->CurrentViewer()->Update();
}
}
//==================================================
-// Function:
+// Function: UnhilightPicked
// Purpose :
//==================================================
-void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
+void AIS_LocalContext::UnhilightPicked (const Standard_Boolean theToUpdateViewer)
{
myMainPM->ClearImmediateDraw();
+ if (mySelection.IsNull())
+ {
+ return;
+ }
- if( mySelection.IsNull() ) return;
- Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
-
- const AIS_NListTransient& Obj = mySelection->Objects();
- AIS_NListTransient::Iterator anIter( Obj );
- for(; anIter.More(); anIter.Next()){
- const Handle(Standard_Transient)& Tr = anIter.Value();
- if(!Tr.IsNull()){
- const Handle(SelectMgr_EntityOwner)& Ownr =
- *((const Handle(SelectMgr_EntityOwner)*) &Tr);
- Standard_Integer HM(0);
- if(Ownr->HasSelectable()){
- Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
- Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (SO);
- anObjMap.Add (IO);
-
- HM = GetHiMod(IO);
- Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
- if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
- }
- }
- Ownr->Unhilight(PM,HM);
- }
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ {
+ const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
+ Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
+ Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (aSelObj);
+ anObjMap.Add (aSelObj);
+ Standard_Integer aHighMode = GetHiMod (anIO);
+ anOwner->Unhilight (myMainPM, aHighMode);
}
-
- for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator anIter1 ( anObjMap );
- anIter1.More(); anIter1.Next() )
+
+ for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator aMapIter (anObjMap);
+ aMapIter.More(); aMapIter.Next())
{
- if ( !anIter1.Key()->IsAutoHilight() )
- anIter1.Key()->ClearSelected();
+ if (!aMapIter.Key()->IsAutoHilight())
+ {
+ aMapIter.Key()->ClearSelected();
+ }
}
- if(updateviewer)
+ if (theToUpdateViewer)
+ {
myCTX->CurrentViewer()->Update();
+ }
}
//=======================================================================
}
//==================================================
-// Function:
+// Function: HasShape
// Purpose :
//==================================================
-Standard_Boolean AIS_LocalContext::
-HasShape() const
+Standard_Boolean AIS_LocalContext::HasShape() const
{
- Handle(Standard_Transient) Tr = mySelection->Value();
- if( Tr.IsNull() ) return Standard_False;
- Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
- Handle(StdSelect_BRepOwner) BRO = Handle(StdSelect_BRepOwner)::DownCast(EO);
- if(BRO.IsNull()) return Standard_False;
- Standard_Boolean hasshape = BRO->HasShape();
- Standard_Boolean comes = BRO->ComesFromDecomposition();
- return (hasshape&&comes);
+ if (!mySelection->More())
+ {
+ return Standard_False;
+ }
+
+ Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast(mySelection->Value());
+ return !aBROwner.IsNull()
+ && aBROwner->HasShape()
+ && aBROwner->ComesFromDecomposition();
}
//================================================================
//================================================================
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
{
- if (mySelection->Extent() == 0)
- return Standard_False;
-
- Handle(Standard_Transient) aCurSelection = mySelection->Value();
- if (aCurSelection.IsNull())
- return Standard_False;
-
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aCurSelection);
- Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
- if (aBrepOwner.IsNull())
+ if (!mySelection->More())
{
return Standard_False;
}
- return aBrepOwner->HasShape();
+
+ Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
+ return !aBrepOwner.IsNull()
+ && aBrepOwner->HasShape();
}
//==================================================
-// Function:
+// Function: SelectedShape
// Purpose :
//==================================================
TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
- Handle(Standard_Transient) aTr = mySelection->Value();
- Handle(SelectMgr_EntityOwner) anEO = Handle(SelectMgr_EntityOwner)::DownCast (aTr);
- Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(anEO);
- if( aBRO.IsNull() )
+ if (!mySelection->More())
+ {
+ return TopoDS_Shape();
+ }
+
+ Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(mySelection->Value());
+ if (aBRO.IsNull())
{
return TopoDS_Shape();
}
}
//==================================================
-// Function:
+// Function: SelectedInteractive
// Purpose :
//==================================================
-Handle(AIS_InteractiveObject) AIS_LocalContext::
-SelectedInteractive() const
+Handle(AIS_InteractiveObject) AIS_LocalContext::SelectedInteractive() const
{
- Handle(AIS_InteractiveObject) IO;
- Handle(Standard_Transient) Tr = mySelection->Value();
- if( !Tr.IsNull() ) {
- Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
- Handle(SelectMgr_SelectableObject) SO;
- if(EO->HasSelectable()){
- SO = EO->Selectable();
- IO = Handle(AIS_InteractiveObject)::DownCast (SO);
- }
- }
- return IO;
+ return !mySelection->More()
+ ? Handle(AIS_InteractiveObject)()
+ : Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
}
+
//==================================================
-// Function:
+// Function: SelectedOwner
// Purpose :
//==================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::
-SelectedOwner() const
+Handle(SelectMgr_EntityOwner) AIS_LocalContext::SelectedOwner() const
{
- Handle(SelectMgr_EntityOwner) EO;
- Handle(Standard_Transient) Tr = mySelection->Value();
- if( !Tr.IsNull() )
- EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
- return EO;
+ return !mySelection->More()
+ ? Handle(SelectMgr_EntityOwner)()
+ : mySelection->Value();
}
//==================================================
// Function:
// Purpose :
//==================================================
-Standard_Boolean AIS_LocalContext::
-HasApplicative() const
+Standard_Boolean AIS_LocalContext::HasApplicative() const
{
- Handle(AIS_InteractiveObject) IO = SelectedInteractive();
- if( IO.IsNull() ) return Standard_False;
- return IO->HasOwner();
+ Handle(AIS_InteractiveObject) anIO = SelectedInteractive();
+ return !anIO.IsNull()
+ && anIO->HasOwner();
}
//==================================================
return;
SelectMgr_SequenceOfOwner aSeq;
- for (mySelection->Init(); mySelection->More(); mySelection->Next() ){
- Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(mySelection->Value());
-
- if ( !aOwner.IsNull() && aOwner->HasSelectable() && aOwner->Selectable() == anobj )
- aSeq.Append( aOwner );
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ {
+ if (aSelIter.Value()->Selectable() == anobj)
+ {
+ aSeq.Append (aSelIter.Value());
+ }
}
if ( aSeq.Length() )
void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
{
UnhilightPicked(updateviewer);
-
- const AIS_NListTransient& Obj = mySelection->Objects();
- AIS_NListTransient::Iterator anIter( Obj );
- for(; anIter.More(); anIter.Next()){
- const Handle(Standard_Transient)& Tr = anIter.Value();
- if(!Tr.IsNull())
- {
- (*((const Handle(SelectMgr_EntityOwner)*)&Tr))->SetSelected (Standard_False);
- }
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ {
+ aSelIter.Value()->SetSelected (Standard_False);
}
- mySelection->Select();
+ mySelection->Clear();
mylastindex = 0;
}
// 3. AIS_Selection : remove entity owners from AIS_Selection
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
- AIS_NListTransient::Iterator anIter (mySelection->Objects());
- AIS_NListTransient aRemoveEntites;
- for (; anIter.More(); anIter.Next())
+ NCollection_List<Handle(SelectMgr_EntityOwner)> aRemoveEntites;
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anIter.Value());
- if (anOwner.IsNull() || anOwner->Selectable() != theIO)
+ Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
+ if (anOwner->Selectable() != theIO)
{
continue;
}
}
}
}
- AIS_NListTransient::Iterator anIterRemove (aRemoveEntites);
- for (; anIterRemove.More(); anIterRemove.Next())
+
+ for (NCollection_List<Handle(SelectMgr_EntityOwner)>::Iterator anIterRemove (aRemoveEntites);
+ anIterRemove.More(); anIterRemove.Next())
{
mySelection->Select (anIterRemove.Value());
}
//1st case, owner already <anIObj> as owner
// and not separated is found...
- Handle(Standard_Transient) Tr;
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
if(EO.IsNull()){
//check if in selection number 0 there is an owner that can be triturated...
//function : FindSelectedOwnerFromIO
//purpose : it is checked if one of the selected owners really presents IObj
//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO
- (const Handle(AIS_InteractiveObject)& anIObj) const
+Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO (const Handle(AIS_InteractiveObject)& theObj) const
{
Handle(SelectMgr_EntityOwner) EO,bid;
- if (anIObj.IsNull()) return EO;
-
- if(mySelection.IsNull()) {
- return EO;
+ if (theObj.IsNull()
+ || mySelection.IsNull())
+ {
+ return Handle(SelectMgr_EntityOwner)();
}
- Standard_Boolean found(Standard_False);
- const AIS_NListTransient& Obj = mySelection->Objects();
- AIS_NListTransient::Iterator anIter( Obj );
- for(; anIter.More(); anIter.Next()){
- const Handle(Standard_Transient)& Tr = anIter.Value();
- if(!Tr.IsNull()){
- EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
- if(EO->HasSelectable()){
- Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
- if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
- if (anIObj == EO->Selectable()){
- found =Standard_True;
- break;
- }
- }
- }
+
+ for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
+ {
+ if (theObj != aSelIter.Value()->Selectable())
+ {
+ continue;
+ }
+
+ Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast(aSelIter.Value());
+ if (aBROwner.IsNull()
+ || !aBROwner->ComesFromDecomposition())
+ {
+ return aSelIter.Value();
}
}
- if(found) return EO;
- return bid;
+ return Handle(SelectMgr_EntityOwner)();
}
//=======================================================================
+++ /dev/null
-// Created on: 2003-05-04
-// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com)
-// Copyright (c) 2003-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _AIS_NDataMapOfTransientIteratorOfListTransient_HeaderFile
-#define _AIS_NDataMapOfTransientIteratorOfListTransient_HeaderFile
-
-#include <AIS_NListIteratorOfListTransient.hxx>
-#include <NCollection_DataMap.hxx>
-
-typedef NCollection_DataMap<Handle(Standard_Transient), AIS_NListIteratorOfListTransient>
- AIS_NDataMapOfTransientIteratorOfListTransient;
-
-#endif
+++ /dev/null
-// Created on: 2003-05-04
-// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com)
-// Copyright (c) 2003-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _AIS_NListIteratorOfListTransient_HeaderFile
-#define _AIS_NListIteratorOfListTransient_HeaderFile
-
-#include <AIS_NListTransient.hxx>
-
-typedef AIS_NListTransient::Iterator AIS_NListIteratorOfListTransient;
-
-#endif
--- /dev/null
+// Created on: 2003-05-04
+// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com)
+// Copyright (c) 2003-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _AIS_NListTransient_HeaderFile
+#define _AIS_NListTransient_HeaderFile
+
+#include <SelectMgr_EntityOwner.hxx>
+#include <NCollection_List.hxx>
+
+typedef NCollection_List<Handle(SelectMgr_EntityOwner)> AIS_NListOfEntityOwner;
+
+#endif
+++ /dev/null
-// Created on: 2003-05-04
-// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com)
-// Copyright (c) 2003-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _AIS_NListTransient_HeaderFile
-#define _AIS_NListTransient_HeaderFile
-
-#include <Standard_Transient.hxx>
-#include <NCollection_List.hxx>
-
-typedef NCollection_List<Handle(Standard_Transient)> AIS_NListTransient;
-
-#endif
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <AIS_Selection.hxx>
#include <AIS_InteractiveObject.hxx>
-#include <AIS_Selection.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <Standard_MultiplyDefined.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_TypeMismatch.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
-#define MaxSizeOfResult 100000
+namespace
+{
+ static const Standard_Integer THE_MaxSizeOfResult = 100000;
+}
//=======================================================================
//function : AIS_Selection
-//purpose :
+//purpose :
//=======================================================================
-AIS_Selection::AIS_Selection() :
-myNb(0)
+AIS_Selection::AIS_Selection()
{
- myResultMap.ReSize( MaxSizeOfResult ); // for maximum performnace on medium selections ( < 100000 objects )
+ // for maximum performance on medium selections (< 100000 objects)
+ myResultMap.ReSize (THE_MaxSizeOfResult);
}
//=======================================================================
-//function : Select
-//purpose :
+//function : Clear
+//purpose :
//=======================================================================
-void AIS_Selection::Select()
+void AIS_Selection::Clear()
{
- myNb=0;
myresult.Clear();
myResultMap.Clear();
}
//=======================================================================
//function : Select
-//purpose :
+//purpose :
//=======================================================================
-AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObject)
+AIS_SelectStatus AIS_Selection::Select (const Handle(SelectMgr_EntityOwner)& theObject)
{
- Handle(AIS_InteractiveObject) anAISObj;
- Handle(SelectMgr_EntityOwner) owner = Handle(SelectMgr_EntityOwner)::DownCast( anObject );
- if ( owner.IsNull() )
- anAISObj = Handle(AIS_InteractiveObject)::DownCast( anObject );
- if ( myResultMap.IsBound( anObject ) ){
- AIS_NListTransient::Iterator aListIter = myResultMap.Find( anObject );
-//skt-----------------------------------------------------------------
- if( myIterator == aListIter ) {
- if( myIterator.More() )
- myIterator.Next();
- else
- myIterator = AIS_NListTransient::Iterator();
- }
-//--------------------------------------------------------------------
- // In the mode of advanced mesh selection only one owner is created
- // for all selection modes. It is necessary to check the current detected
- // entity and remove the owner from map only if the detected entity is
- // the same as previous selected (IsForcedHilight call)
- if( !anAISObj.IsNull() || ( !owner.IsNull() && !owner->IsForcedHilight() ) )
+ if (theObject.IsNull()
+ || !theObject->HasSelectable())
+ {
+ return AIS_SS_NotDone;
+ }
+
+ if (!myResultMap.IsBound (theObject))
+ {
+ AIS_NListOfEntityOwner::Iterator aListIter;
+ myresult.Append (theObject, aListIter);
+ myResultMap.Bind (theObject, aListIter);
+ return AIS_SS_Added;
+ }
+
+ AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theObject);
+ if (myIterator == aListIter)
+ {
+ if (myIterator.More())
{
- myresult.Remove( aListIter );
- myResultMap.UnBind( anObject );
-
- // update list iterator for next object in <myresult> list if any
- if ( aListIter.More() ){
- const Handle(Standard_Transient)& aNextObject = aListIter.Value();
- if ( myResultMap.IsBound( aNextObject ) )
- myResultMap( aNextObject ) = aListIter;
- else
- myResultMap.Bind( aNextObject, aListIter );
- }
- return AIS_SS_Removed;
+ myIterator.Next();
}
else
- return AIS_SS_Added;
+ {
+ myIterator = AIS_NListOfEntityOwner::Iterator();
+ }
}
-
- AIS_NListTransient::Iterator aListIter;
- myresult.Append( anObject, aListIter );
- myResultMap.Bind( anObject, aListIter );
- return AIS_SS_Added;
-}
-
-//=======================================================================
-//function : AddSelect
-//purpose : Always add int the selection
-//=======================================================================
-AIS_SelectStatus AIS_Selection::AddSelect(const Handle(Standard_Transient)& anObject)
-{
- if ( myResultMap.IsBound( anObject ) )
- return AIS_SS_NotDone;
-
- AIS_NListTransient::Iterator aListIter;
- myresult.Append( anObject, aListIter );
- myResultMap.Bind( anObject, aListIter );
- return AIS_SS_Added;
-}
+ // In the mode of advanced mesh selection only one owner is created for all selection modes.
+ // It is necessary to check the current detected entity
+ // and remove the owner from map only if the detected entity is the same as previous selected (IsForcedHilight call)
+ if (theObject->IsForcedHilight())
+ {
+ return AIS_SS_Added;
+ }
-//=======================================================================
-//function : ClearAndSelect
-//purpose :
-//=======================================================================
+ myresult.Remove (aListIter);
+ myResultMap.UnBind (theObject);
-void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject)
-{
- Select();
- Select(anObject);
+ // update list iterator for next object in <myresult> list if any
+ if (aListIter.More())
+ {
+ const Handle(SelectMgr_EntityOwner)& aNextObject = aListIter.Value();
+ if (myResultMap.IsBound (aNextObject))
+ {
+ myResultMap (aNextObject) = aListIter;
+ }
+ else
+ {
+ myResultMap.Bind (aNextObject, aListIter);
+ }
+ }
+ return AIS_SS_Removed;
}
-
//=======================================================================
-//function : Extent
-//purpose :
+//function : AddSelect
+//purpose :
//=======================================================================
-Standard_Integer AIS_Selection::Extent() const
+AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
{
- return myresult.Extent();
-}
+ if (theObject.IsNull()
+ || !theObject->HasSelectable()
+ || myResultMap.IsBound (theObject))
+ {
+ return AIS_SS_NotDone;
+ }
-//=======================================================================
-//function : Single
-//purpose :
-//=======================================================================
-Handle(Standard_Transient) AIS_Selection::Single()
-{
- Init();
- return Value();
-}
-//=======================================================================
-//function : IsSelected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_Selection::IsSelected(const Handle(Standard_Transient)& anObject) const
-{
- return myResultMap.IsBound( anObject );
+ AIS_NListOfEntityOwner::Iterator aListIter;
+ myresult.Append (theObject, aListIter);
+ myResultMap.Bind (theObject, aListIter);
+ return AIS_SS_Added;
}
-
-
#ifndef _AIS_Selection_HeaderFile
#define _AIS_Selection_HeaderFile
+#include <AIS_NListOfEntityOwner.hxx>
+#include <AIS_SelectStatus.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
-#include <AIS_NListTransient.hxx>
-#include <AIS_NListIteratorOfListTransient.hxx>
-#include <AIS_NDataMapOfTransientIteratorOfListTransient.hxx>
-#include <Standard_Integer.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <AIS_SelectStatus.hxx>
-class Standard_NoSuchObject;
-class Standard_MultiplyDefined;
-class Standard_TypeMismatch;
-class Standard_Transient;
-
-
-class AIS_Selection;
-DEFINE_STANDARD_HANDLE(AIS_Selection, MMgt_TShared)
-
-
-class AIS_Selection : public MMgt_TShared
+//! Class holding the list of selected owners.
+class AIS_Selection : public Standard_Transient
{
-
+ DEFINE_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
public:
-
//! creates a new selection.
-
Standard_EXPORT AIS_Selection();
//! removes all the object of the selection.
- Standard_EXPORT void Select();
+ Standard_EXPORT void Clear();
//! if the object is not yet in the selection, it will be added.
//! if the object is already in the selection, it will be removed.
- Standard_EXPORT AIS_SelectStatus Select (const Handle(Standard_Transient)& anObject);
+ Standard_EXPORT AIS_SelectStatus Select (const Handle(SelectMgr_EntityOwner)& theObject);
//! the object is always add int the selection.
//! faster when the number of objects selected is great.
- Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
-
+ Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
+
//! clears the selection and adds the object in the selection.
- Standard_EXPORT void ClearAndSelect (const Handle(Standard_Transient)& anObject);
+ void ClearAndSelect (const Handle(SelectMgr_EntityOwner)& theObject)
+ {
+ Clear();
+ Select (theObject);
+ }
//! checks if the object is in the selection.
- Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject) const;
-
- //! returns the number of objects selected.
- Standard_EXPORT Standard_Integer Extent() const;
-
- //! returns the single object selected.
- //! Warning: raises TypeMismatch from Standard if Extent is not equal to 1.
- Standard_EXPORT Handle(Standard_Transient) Single();
-
- void Init();
-
- Standard_Boolean More() const;
-
- void Next();
-
- const Handle(Standard_Transient)& Value() const;
-
- Standard_Integer NbStored() const;
-
- const AIS_NListTransient& Objects() const;
-
- DEFINE_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
-
-protected:
+ Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theObject) const { return myResultMap.IsBound (theObject); }
+ //! Return the list of selected objects.
+ const AIS_NListOfEntityOwner& Objects() const { return myresult; }
+ //! Return the number of selected objects.
+ Standard_Integer Extent() const { return myresult.Size(); }
+ //! Return true if list of selected objects is empty.
+ Standard_Boolean IsEmpty() const { return myresult.IsEmpty(); }
-private:
-
- AIS_NListTransient myresult;
- AIS_NListIteratorOfListTransient myIterator;
- AIS_NDataMapOfTransientIteratorOfListTransient myResultMap;
- Standard_Integer myNb;
+public:
+ //! Start iteration through selected objects.
+ void Init() { myIterator = AIS_NListOfEntityOwner::Iterator(myresult); }
-};
+ //! Return true if iterator points to selected object.
+ Standard_Boolean More() const { return myIterator.More(); }
+ //! Continue iteration through selected objects.
+ void Next() { myIterator.Next(); }
-#include <AIS_Selection.lxx>
+ //! Return selected object at iterator position.
+ const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
+private:
+ AIS_NListOfEntityOwner myresult;
+ AIS_NListOfEntityOwner::Iterator myIterator;
+ NCollection_DataMap<Handle(SelectMgr_EntityOwner), AIS_NListOfEntityOwner::Iterator> myResultMap;
+};
+DEFINE_STANDARD_HANDLE(AIS_Selection, Standard_Transient)
#endif // _AIS_Selection_HeaderFile
+++ /dev/null
-// Created on: 1998-06-23
-// Created by: Robert COUBLANC
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//SAV: 18/03/02 array was replaced with list.
-//san : 18/04/03 USE_MAP - additional datamap is used to speed up access
-//to certain owners in <myresult> list
-
-#include <TColStd_MapOfTransient.hxx>
-#include <TColStd_MapIteratorOfMapOfTransient.hxx>
-
-inline const AIS_NListTransient& AIS_Selection::Objects() const
-{
- return myresult;
-}
-
-inline void AIS_Selection::Init()
-{
- myIterator = AIS_NListTransient::Iterator ( myresult );
-}
-
-inline Standard_Boolean AIS_Selection::More() const
-{
- return myIterator.More();
-}
-inline void AIS_Selection::Next ()
-{
- myIterator.Next();
-}
-inline const Handle(Standard_Transient)& AIS_Selection::Value() const
-{
- return myIterator.Value();
-}
-
-inline Standard_Integer AIS_Selection::NbStored() const
-{
- return myresult.Extent();
-}
AIS_MultipleConnectedInteractive.cxx
AIS_MultipleConnectedInteractive.hxx
AIS_MultipleConnectedInteractive.lxx
-AIS_NDataMapOfTransientIteratorOfListTransient.hxx
-AIS_NListIteratorOfListTransient.hxx
-AIS_NListTransient.hxx
+AIS_NListOfEntityOwner.hxx
AIS_OffsetDimension.cxx
AIS_OffsetDimension.hxx
AIS_OffsetDimension.lxx
AIS_RubberBand.cxx
AIS_Selection.cxx
AIS_Selection.hxx
-AIS_Selection.lxx
AIS_SelectStatus.hxx
AIS_SequenceOfDimension.hxx
AIS_SequenceOfInteractive.hxx
//=======================================================================
//function : BndBoxOfSelected
-//purpose : Returns a bounding box of sensitive entities with the owners given
-// if they are a part of activated selection
+//purpose :
//=======================================================================
-Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (Handle(SelectMgr_IndexedMapOfOwner)& theOwners)
+Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (const Handle(SelectMgr_IndexedMapOfOwner)& theOwners)
{
- Bnd_Box aBnd;
-
if (theOwners->IsEmpty())
- return aBnd;
+ return Bnd_Box();
+ Bnd_Box aBnd;
for (Init(); More(); Next())
{
const Handle(SelectMgr_Selection)& aSel = CurrentSelection();
if (theOwners->Contains (anOwner))
{
Select3D_BndBox3d aBox = aSel->Sensitive()->BaseSensitive()->BoundingBox();
- Bnd_Box aTmpBnd;
- aTmpBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
- aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
- aBnd.Add (aTmpBnd);
-
- Standard_Integer anOwnerIdx = theOwners->FindIndex (anOwner);
- if (theOwners->Size() != anOwnerIdx)
- {
- theOwners->Swap (anOwnerIdx, theOwners->Size());
- }
- theOwners->RemoveLast();
-
- if (theOwners->IsEmpty())
- return aBnd;
+ aBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
+ aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
}
}
}
//! Returns a bounding box of sensitive entities with the owners given
//! if they are a part of activated selection
- Standard_EXPORT Bnd_Box BndBoxOfSelected (Handle(SelectMgr_IndexedMapOfOwner)& theOwners);
+ Standard_EXPORT Bnd_Box BndBoxOfSelected (const Handle(SelectMgr_IndexedMapOfOwner)& theOwners);
//! Returns the mode for selection of object as a whole
Standard_Integer GlobalSelectionMode() const
--- /dev/null
+puts "============"
+puts "CR27805"
+puts "AIS_InteractiveContext::FitSelected() is broken for global selection"
+puts "============"
+puts ""
+
+set anImgFitAll $imagedir/${casename}_fitall.png
+set anImgFitSel $imagedir/${casename}_fitsel.png
+set anImgDiff $imagedir/${casename}_diff.png
+
+pload MODELING VISUALIZATION
+box b 1 2 3
+vclear
+vinit View1
+vaxo
+vdisplay -dispMode 1 b
+vfit
+vselect 200 200
+vdump $anImgFitAll
+vfit -selected
+vdump $anImgFitSel
+
+set aDiffRes [diffimage $anImgFitSel $anImgFitAll 0.0 0 0 $anImgDiff]
+if {$aDiffRes != 0} {
+ puts "Error: FitSelected() does not match FitAll() for single object"
+}