mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027805: Visualization - AIS_InteractiveContext::FitSelected() is broken for global selection
AIS_Selection class has been cleaned up: - SelectMgr_EntityOwner is now used in interface instead of Standard_Transient. - Method ::Select() has been renamed to ::Clear() for clarity. - Dropped unused class fields. - Owners without Selectable are not added to the list (should never happen). SelectMgr_SelectableObject::BndBoxOfSelected() has been modified to properly compute bounding box of ALL selection Entities for specified Owner (only first Entity has been used before the patch). Methods of AIS_InteractiveContext::DisplaySelected(), ::SetSelectedAspect(), ::FitSelected(), ::SubIntensityOff() have been fixed (wrong DownCast). AIS_InteractiveContext::AddSelect() now handles properly AIS_InteractiveObject as argument.
This commit is contained in:
parent
3065019c99
commit
02974a19c6
@ -104,7 +104,7 @@ myIsAutoActivateSelMode(Standard_True)
|
|||||||
void AIS_InteractiveContext::Delete() const
|
void AIS_InteractiveContext::Delete() const
|
||||||
{
|
{
|
||||||
// clear the current selection
|
// clear the current selection
|
||||||
mySelection->Select();
|
mySelection->Clear();
|
||||||
|
|
||||||
// let's remove one reference explicitly. this operation's supposed to
|
// let's remove one reference explicitly. this operation's supposed to
|
||||||
// be performed when mgrSelector will be destroyed but anyway...
|
// be performed when mgrSelector will be destroyed but anyway...
|
||||||
@ -645,7 +645,7 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
|
|||||||
Standard_Boolean isFound = Standard_False;
|
Standard_Boolean isFound = Standard_False;
|
||||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
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);
|
Display (anObj, Standard_False);
|
||||||
isFound = Standard_True;
|
isFound = Standard_True;
|
||||||
}
|
}
|
||||||
@ -671,7 +671,7 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
|
|||||||
mySelection->Init();
|
mySelection->Init();
|
||||||
while (mySelection->More())
|
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());
|
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
|
|
||||||
Erase (anObj, Standard_False);
|
Erase (anObj, Standard_False);
|
||||||
@ -2198,10 +2198,10 @@ void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)&
|
|||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean isFound = 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;
|
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);
|
anObj->SetAspect (theAspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2399,21 +2399,18 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
|
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
|
||||||
{
|
{
|
||||||
mySelection->Init();
|
SelectMgr_SequenceOfOwner aSeq;
|
||||||
while (mySelection->More())
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
{
|
{
|
||||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
if (aSelIter.Value()->Selectable() == theObject
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
&& aSelIter.Value()->IsSelected())
|
||||||
if (anOwner->Selectable() == theObject)
|
|
||||||
{
|
{
|
||||||
if (anOwner->IsSelected())
|
aSeq.Append (aSelIter.Value());
|
||||||
{
|
|
||||||
AddOrRemoveSelected (anOwner, Standard_False);
|
|
||||||
mySelection->Init();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mySelection->Next();
|
}
|
||||||
|
for (SelectMgr_SequenceOfOwner::Iterator aDelIter (aSeq); aDelIter.More(); aDelIter.Next())
|
||||||
|
{
|
||||||
|
AddOrRemoveSelected (aDelIter.Value(), Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2889,22 +2886,21 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
|
|||||||
AIS_MapOfObjectOwners anObjectOwnerMap;
|
AIS_MapOfObjectOwners anObjectOwnerMap;
|
||||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) anObj (Handle(AIS_InteractiveObject)::DownCast (aSelection->Value()));
|
const Handle(SelectMgr_EntityOwner)& anOwner = aSelection->Value();
|
||||||
if (!anObj.IsNull())
|
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;
|
Bnd_Box aTmpBnd;
|
||||||
anObj->BoundingBox (aTmpBnd);
|
anObj->BoundingBox (aTmpBnd);
|
||||||
aBndSelected.Add (aTmpBnd);
|
aBndSelected.Add (aTmpBnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (aSelection->Value()));
|
|
||||||
if (anOwner.IsNull())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Handle(SelectMgr_IndexedMapOfOwner) anOwnerMap;
|
Handle(SelectMgr_IndexedMapOfOwner) anOwnerMap;
|
||||||
if (!anObjectOwnerMap.Find (anOwner->Selectable(), anOwnerMap))
|
if (!anObjectOwnerMap.Find (anOwner->Selectable(), anOwnerMap))
|
||||||
{
|
{
|
||||||
|
@ -881,7 +881,13 @@ public:
|
|||||||
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
|
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
|
||||||
|
|
||||||
//! Adds object in the selection.
|
//! 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
|
//! Selects everything found in the bounding rectangle
|
||||||
//! defined by the pixel minima and maxima, XPMin,
|
//! defined by the pixel minima and maxima, XPMin,
|
||||||
|
@ -94,13 +94,12 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
|||||||
if (!theOwner->IsAutoHilight())
|
if (!theOwner->IsAutoHilight())
|
||||||
{
|
{
|
||||||
SelectMgr_SequenceOfOwner aSeq;
|
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 =
|
if (aSelIter.Value()->Selectable() == anObj)
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
{
|
||||||
if (aSelOwnr->Selectable() != anObj)
|
aSeq.Append (aSelIter.Value());
|
||||||
continue;
|
}
|
||||||
aSeq.Append (aSelOwnr);
|
|
||||||
}
|
}
|
||||||
anObj->HilightSelected (myMainPM, aSeq);
|
anObj->HilightSelected (myMainPM, aSeq);
|
||||||
}
|
}
|
||||||
@ -117,15 +116,10 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
|||||||
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
|
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
|
||||||
{
|
{
|
||||||
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
|
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 =
|
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const Handle(AIS_InteractiveObject) anInteractive =
|
|
||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
|
||||||
if (anOwner->IsAutoHilight())
|
if (anOwner->IsAutoHilight())
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMode = anInteractive->HasHilightMode() ? anInteractive->HilightMode() : 0;
|
const Standard_Integer aHiMode = anInteractive->HasHilightMode() ? anInteractive->HilightMode() : 0;
|
||||||
@ -313,7 +307,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
|||||||
//function : AddSelect
|
//function : AddSelect
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(Standard_Transient)& theObject)
|
AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||||
{
|
{
|
||||||
if (HasOpenedContext())
|
if (HasOpenedContext())
|
||||||
{
|
{
|
||||||
@ -461,7 +455,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
|||||||
{
|
{
|
||||||
unhighlightSelected (Standard_True);
|
unhighlightSelected (Standard_True);
|
||||||
|
|
||||||
mySelection->Select();
|
mySelection->Clear();
|
||||||
if (toUpdateViewer && myWasLastMain)
|
if (toUpdateViewer && myWasLastMain)
|
||||||
{
|
{
|
||||||
UpdateCurrentViewer();
|
UpdateCurrentViewer();
|
||||||
@ -768,41 +762,36 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
|||||||
// In case of selection without using local context
|
// In case of selection without using local context
|
||||||
myMainPM->ClearImmediateDraw();
|
myMainPM->ClearImmediateDraw();
|
||||||
AIS_MapOfObjSelectedOwners anObjOwnerMap;
|
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 =
|
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (!anOwner.IsNull() && anOwner->HasSelectable())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
const Handle(AIS_InteractiveObject) anObj =
|
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
|
||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
aState->SetHilightStatus (Standard_True);
|
||||||
if (anOwner == anObj->GlobalSelOwner())
|
aState->SetHilightColor (mySelectionColor);
|
||||||
|
}
|
||||||
|
anOwner->State (1);
|
||||||
|
if (!anOwner->IsAutoHilight())
|
||||||
|
{
|
||||||
|
NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq;
|
||||||
|
if (anObjOwnerMap.Find (anObj, aSeq))
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
|
aSeq->Append (anOwner);
|
||||||
aState->SetHilightStatus (Standard_True);
|
|
||||||
aState->SetHilightColor (mySelectionColor);
|
|
||||||
}
|
|
||||||
anOwner->State (1);
|
|
||||||
if (!anOwner->IsAutoHilight())
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
aSeq = new SelectMgr_SequenceOfOwner();
|
||||||
anOwner->HilightWithColor (myMainPM, mySelectionColor, aHiMode);
|
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())
|
if (!anObjOwnerMap.IsEmpty())
|
||||||
@ -829,22 +818,18 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
|
|||||||
return myLocalContexts (myCurLocalIndex)->UnhilightPicked (theToUpdateViewer);
|
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 =
|
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
if (!anOwner.IsNull() && anOwner->HasSelectable())
|
if (anOwner == anObj->GlobalSelOwner())
|
||||||
{
|
{
|
||||||
const Handle(AIS_InteractiveObject) anObj =
|
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anOwner->State (0);
|
||||||
|
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
|
||||||
|
anOwner->Unhilight (myMainPM, aHiMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
@ -866,7 +851,7 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
|||||||
|
|
||||||
unhighlightSelected();
|
unhighlightSelected();
|
||||||
|
|
||||||
mySelection->Select();
|
mySelection->Clear();
|
||||||
myMainPM->ClearImmediateDraw();
|
myMainPM->ClearImmediateDraw();
|
||||||
|
|
||||||
if (theToUpdateViewer)
|
if (theToUpdateViewer)
|
||||||
@ -922,10 +907,11 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
|||||||
|
|
||||||
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
for (mySelection->Init(); mySelection->More(); mySelection->Next())
|
||||||
{
|
{
|
||||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
const Handle(SelectMgr_EntityOwner) anOwner = mySelection->Value();
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
if (!myFilters->IsOk (anOwner))
|
||||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Handle(AIS_InteractiveObject) aSelectable =
|
Handle(AIS_InteractiveObject) aSelectable =
|
||||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||||
@ -1199,7 +1185,6 @@ void AIS_InteractiveContext::NextSelected()
|
|||||||
if(HasOpenedContext())
|
if(HasOpenedContext())
|
||||||
{
|
{
|
||||||
return myLocalContexts (myCurLocalIndex)->NextSelected();
|
return myLocalContexts (myCurLocalIndex)->NextSelected();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mySelection->Next();
|
mySelection->Next();
|
||||||
@ -1231,7 +1216,7 @@ TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
|
|||||||
return myLocalContexts (myCurLocalIndex)->SelectedShape();
|
return myLocalContexts (myCurLocalIndex)->SelectedShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mySelection->Extent() == 0)
|
if (!mySelection->More())
|
||||||
return TopoDS_Shape();
|
return TopoDS_Shape();
|
||||||
|
|
||||||
const Handle(StdSelect_BRepOwner) anOwner =
|
const Handle(StdSelect_BRepOwner) anOwner =
|
||||||
@ -1253,12 +1238,9 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() cons
|
|||||||
return myLocalContexts(myCurLocalIndex)->SelectedInteractive();
|
return myLocalContexts(myCurLocalIndex)->SelectedInteractive();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Handle(SelectMgr_EntityOwner) anOwner =
|
return !mySelection->More()
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
|
? Handle(AIS_InteractiveObject)()
|
||||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
: Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SelectedOwner
|
//function : SelectedOwner
|
||||||
@ -1271,8 +1253,9 @@ Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::SelectedOwner() const
|
|||||||
return myLocalContexts(myCurLocalIndex)->SelectedOwner();
|
return myLocalContexts(myCurLocalIndex)->SelectedOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mySelection->Extent() > 0 ?
|
return !mySelection->More()
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value()) : NULL;
|
? Handle(SelectMgr_EntityOwner)()
|
||||||
|
: mySelection->Value();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -413,7 +413,7 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
|
|||||||
|
|
||||||
Standard_Integer DM,HM,SM;
|
Standard_Integer DM,HM,SM;
|
||||||
GetDefModes(anIObj,DM,HM,SM);
|
GetDefModes(anIObj,DM,HM,SM);
|
||||||
if(mySelection->IsSelected(anIObj))
|
if(IsSelected(anIObj))
|
||||||
myMainPM->Highlight(anIObj,HM);
|
myMainPM->Highlight(anIObj,HM);
|
||||||
|
|
||||||
if(updateviewer){
|
if(updateviewer){
|
||||||
|
@ -612,13 +612,11 @@ void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
|
|||||||
// clear the selector...
|
// clear the selector...
|
||||||
myMainVS->Clear();
|
myMainVS->Clear();
|
||||||
|
|
||||||
Handle(Standard_Transient) Tr;
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
for (mySelection->Init(); mySelection->More(); mySelection->Next()){
|
{
|
||||||
Tr = mySelection->Value();
|
aSelIter.Value()->SetSelected (Standard_False);
|
||||||
Handle(SelectMgr_EntityOwner)::DownCast (Tr)->SetSelected (Standard_False);
|
|
||||||
}
|
}
|
||||||
|
mySelection->Clear();
|
||||||
mySelection->Select();
|
|
||||||
|
|
||||||
Handle(V3d_View) aDummyView;
|
Handle(V3d_View) aDummyView;
|
||||||
myMainVS->ClearSensitive (aDummyView);
|
myMainVS->ClearSensitive (aDummyView);
|
||||||
|
@ -167,7 +167,7 @@ public:
|
|||||||
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& aView);
|
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& aView);
|
||||||
|
|
||||||
//! returns the number of selected
|
//! 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);
|
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
|
|||||||
//function : AddSelect
|
//function : AddSelect
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(Standard_Transient)& theObject)
|
AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||||
{
|
{
|
||||||
mySelection->AddSelect (theObject);
|
mySelection->AddSelect (theObject);
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer
|
|||||||
if (aDetIndex <= 0)
|
if (aDetIndex <= 0)
|
||||||
{
|
{
|
||||||
ClearSelected (toUpdateViewer);
|
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);
|
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
|
||||||
@ -514,103 +514,92 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : HilightPicked
|
//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;
|
SelectMgr_DataMapOfObjectOwners aMap;
|
||||||
|
|
||||||
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
|
|
||||||
|
|
||||||
// to avoid problems when there is a loop searching for selected objects...
|
// to avoid problems when there is a loop searching for selected objects...
|
||||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
AIS_NListTransient::Iterator anIter( Obj );
|
|
||||||
for(; anIter.More(); anIter.Next())
|
|
||||||
{
|
{
|
||||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||||
if(!Tr.IsNull()){
|
Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
|
||||||
const Handle(SelectMgr_EntityOwner)& Ownr =
|
if (anOwner->IsAutoHilight())
|
||||||
*((const Handle(SelectMgr_EntityOwner)*) &Tr);
|
{
|
||||||
Handle(AIS_InteractiveObject) IO;
|
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
|
||||||
if(Ownr->HasSelectable()){
|
const Standard_Integer aHighMode = GetHiMod (anIO);
|
||||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
|
anOwner->HilightWithColor (myMainPM, myCTX->SelectionColor(), aHighMode);
|
||||||
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
|
continue;
|
||||||
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
|
}
|
||||||
IO = Handle(AIS_InteractiveObject)::DownCast (SO);
|
|
||||||
}
|
Handle(SelectMgr_HSequenceOfOwner) aSeq;
|
||||||
}
|
if (aMap.Find (aSelObj, aSeq))
|
||||||
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
|
{
|
||||||
Standard_Integer HM = GetHiMod(Handle(AIS_InteractiveObject)::DownCast (SO));
|
aSeq->Append (anOwner);
|
||||||
if ( Ownr->IsAutoHilight() )
|
}
|
||||||
Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM);
|
else
|
||||||
else if ( aMap.IsBound (SO) )
|
{
|
||||||
aMap(SO)->Append ( Ownr );
|
aSeq = new SelectMgr_HSequenceOfOwner();
|
||||||
else {
|
aSeq->Append (anOwner);
|
||||||
NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq = new SelectMgr_SequenceOfOwner;
|
aMap.Bind (aSelObj, aSeq);
|
||||||
aSeq->Append ( Ownr );
|
|
||||||
aMap.Bind ( SO, aSeq );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( SelectMgr_DataMapOfObjectOwners::Iterator aMapIter(aMap);
|
for (SelectMgr_DataMapOfObjectOwners::Iterator aMapIter (aMap); aMapIter.More(); aMapIter.Next())
|
||||||
aMapIter.More(); aMapIter.Next() )
|
|
||||||
{
|
{
|
||||||
aMapIter.Key()->HilightSelected (myMainPM, *aMapIter.Value());
|
aMapIter.Key()->HilightSelected (myMainPM, *aMapIter.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateviewer)
|
if (theToUpdateviewer)
|
||||||
{
|
{
|
||||||
myCTX->CurrentViewer()->Update();
|
myCTX->CurrentViewer()->Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Function:
|
// Function: UnhilightPicked
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
|
void AIS_LocalContext::UnhilightPicked (const Standard_Boolean theToUpdateViewer)
|
||||||
{
|
{
|
||||||
myMainPM->ClearImmediateDraw();
|
myMainPM->ClearImmediateDraw();
|
||||||
|
if (mySelection.IsNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( mySelection.IsNull() ) return;
|
|
||||||
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
|
|
||||||
NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
|
NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
|
||||||
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
{
|
||||||
AIS_NListTransient::Iterator anIter( Obj );
|
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
|
||||||
for(; anIter.More(); anIter.Next()){
|
Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
|
||||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (aSelObj);
|
||||||
if(!Tr.IsNull()){
|
anObjMap.Add (aSelObj);
|
||||||
const Handle(SelectMgr_EntityOwner)& Ownr =
|
Standard_Integer aHighMode = GetHiMod (anIO);
|
||||||
*((const Handle(SelectMgr_EntityOwner)*) &Tr);
|
anOwner->Unhilight (myMainPM, aHighMode);
|
||||||
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);
|
for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator aMapIter (anObjMap);
|
||||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
|
aMapIter.More(); aMapIter.Next())
|
||||||
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
|
{
|
||||||
}
|
if (!aMapIter.Key()->IsAutoHilight())
|
||||||
}
|
{
|
||||||
Ownr->Unhilight(PM,HM);
|
aMapIter.Key()->ClearSelected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator anIter1 ( anObjMap );
|
|
||||||
anIter1.More(); anIter1.Next() )
|
|
||||||
{
|
|
||||||
if ( !anIter1.Key()->IsAutoHilight() )
|
|
||||||
anIter1.Key()->ClearSelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(updateviewer)
|
if (theToUpdateViewer)
|
||||||
|
{
|
||||||
myCTX->CurrentViewer()->Update();
|
myCTX->CurrentViewer()->Update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -663,20 +652,20 @@ NextSelected()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Function:
|
// Function: HasShape
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
Standard_Boolean AIS_LocalContext::
|
Standard_Boolean AIS_LocalContext::HasShape() const
|
||||||
HasShape() const
|
|
||||||
{
|
{
|
||||||
Handle(Standard_Transient) Tr = mySelection->Value();
|
if (!mySelection->More())
|
||||||
if( Tr.IsNull() ) return Standard_False;
|
{
|
||||||
Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
|
return Standard_False;
|
||||||
Handle(StdSelect_BRepOwner) BRO = Handle(StdSelect_BRepOwner)::DownCast(EO);
|
}
|
||||||
if(BRO.IsNull()) return Standard_False;
|
|
||||||
Standard_Boolean hasshape = BRO->HasShape();
|
Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast(mySelection->Value());
|
||||||
Standard_Boolean comes = BRO->ComesFromDecomposition();
|
return !aBROwner.IsNull()
|
||||||
return (hasshape&&comes);
|
&& aBROwner->HasShape()
|
||||||
|
&& aBROwner->ComesFromDecomposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
@ -685,32 +674,29 @@ HasShape() const
|
|||||||
//================================================================
|
//================================================================
|
||||||
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
|
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
|
||||||
{
|
{
|
||||||
if (mySelection->Extent() == 0)
|
if (!mySelection->More())
|
||||||
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())
|
|
||||||
{
|
{
|
||||||
return Standard_False;
|
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 :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
TopoDS_Shape AIS_LocalContext::SelectedShape() const
|
TopoDS_Shape AIS_LocalContext::SelectedShape() const
|
||||||
{
|
{
|
||||||
Handle(Standard_Transient) aTr = mySelection->Value();
|
if (!mySelection->More())
|
||||||
Handle(SelectMgr_EntityOwner) anEO = Handle(SelectMgr_EntityOwner)::DownCast (aTr);
|
{
|
||||||
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(anEO);
|
return TopoDS_Shape();
|
||||||
if( aBRO.IsNull() )
|
}
|
||||||
|
|
||||||
|
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(mySelection->Value());
|
||||||
|
if (aBRO.IsNull())
|
||||||
{
|
{
|
||||||
return TopoDS_Shape();
|
return TopoDS_Shape();
|
||||||
}
|
}
|
||||||
@ -719,48 +705,36 @@ TopoDS_Shape AIS_LocalContext::SelectedShape() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Function:
|
// Function: SelectedInteractive
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
Handle(AIS_InteractiveObject) AIS_LocalContext::
|
Handle(AIS_InteractiveObject) AIS_LocalContext::SelectedInteractive() const
|
||||||
SelectedInteractive() const
|
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) IO;
|
return !mySelection->More()
|
||||||
Handle(Standard_Transient) Tr = mySelection->Value();
|
? Handle(AIS_InteractiveObject)()
|
||||||
if( !Tr.IsNull() ) {
|
: Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Function:
|
// Function: SelectedOwner
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
Handle(SelectMgr_EntityOwner) AIS_LocalContext::
|
Handle(SelectMgr_EntityOwner) AIS_LocalContext::SelectedOwner() const
|
||||||
SelectedOwner() const
|
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) EO;
|
return !mySelection->More()
|
||||||
Handle(Standard_Transient) Tr = mySelection->Value();
|
? Handle(SelectMgr_EntityOwner)()
|
||||||
if( !Tr.IsNull() )
|
: mySelection->Value();
|
||||||
EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
|
|
||||||
return EO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Function:
|
// Function:
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
Standard_Boolean AIS_LocalContext::
|
Standard_Boolean AIS_LocalContext::HasApplicative() const
|
||||||
HasApplicative() const
|
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) IO = SelectedInteractive();
|
Handle(AIS_InteractiveObject) anIO = SelectedInteractive();
|
||||||
if( IO.IsNull() ) return Standard_False;
|
return !anIO.IsNull()
|
||||||
return IO->HasOwner();
|
&& anIO->HasOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
@ -797,11 +771,12 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SelectMgr_SequenceOfOwner aSeq;
|
SelectMgr_SequenceOfOwner aSeq;
|
||||||
for (mySelection->Init(); mySelection->More(); mySelection->Next() ){
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast(mySelection->Value());
|
{
|
||||||
|
if (aSelIter.Value()->Selectable() == anobj)
|
||||||
if ( !aOwner.IsNull() && aOwner->HasSelectable() && aOwner->Selectable() == anobj )
|
{
|
||||||
aSeq.Append( aOwner );
|
aSeq.Append (aSelIter.Value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( aSeq.Length() )
|
if ( aSeq.Length() )
|
||||||
@ -821,17 +796,11 @@ void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj
|
|||||||
void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
|
void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
|
||||||
{
|
{
|
||||||
UnhilightPicked(updateviewer);
|
UnhilightPicked(updateviewer);
|
||||||
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
{
|
||||||
AIS_NListTransient::Iterator anIter( Obj );
|
aSelIter.Value()->SetSelected (Standard_False);
|
||||||
for(; anIter.More(); anIter.Next()){
|
|
||||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
|
||||||
if(!Tr.IsNull())
|
|
||||||
{
|
|
||||||
(*((const Handle(SelectMgr_EntityOwner)*)&Tr))->SetSelected (Standard_False);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mySelection->Select();
|
mySelection->Clear();
|
||||||
mylastindex = 0;
|
mylastindex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,12 +881,11 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
|||||||
|
|
||||||
// 3. AIS_Selection : remove entity owners from AIS_Selection
|
// 3. AIS_Selection : remove entity owners from AIS_Selection
|
||||||
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
|
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
|
||||||
AIS_NListTransient::Iterator anIter (mySelection->Objects());
|
NCollection_List<Handle(SelectMgr_EntityOwner)> aRemoveEntites;
|
||||||
AIS_NListTransient aRemoveEntites;
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
for (; anIter.More(); anIter.Next())
|
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anIter.Value());
|
Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||||
if (anOwner.IsNull() || anOwner->Selectable() != theIO)
|
if (anOwner->Selectable() != theIO)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -936,8 +904,9 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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());
|
mySelection->Select (anIterRemove.Value());
|
||||||
}
|
}
|
||||||
@ -1038,7 +1007,6 @@ void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
|
|||||||
//1st case, owner already <anIObj> as owner
|
//1st case, owner already <anIObj> as owner
|
||||||
// and not separated is found...
|
// and not separated is found...
|
||||||
|
|
||||||
Handle(Standard_Transient) Tr;
|
|
||||||
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
|
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
|
||||||
if(EO.IsNull()){
|
if(EO.IsNull()){
|
||||||
//check if in selection number 0 there is an owner that can be triturated...
|
//check if in selection number 0 there is an owner that can be triturated...
|
||||||
@ -1427,35 +1395,30 @@ Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)
|
|||||||
//function : FindSelectedOwnerFromIO
|
//function : FindSelectedOwnerFromIO
|
||||||
//purpose : it is checked if one of the selected owners really presents IObj
|
//purpose : it is checked if one of the selected owners really presents IObj
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO
|
Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO (const Handle(AIS_InteractiveObject)& theObj) const
|
||||||
(const Handle(AIS_InteractiveObject)& anIObj) const
|
|
||||||
{
|
{
|
||||||
Handle(SelectMgr_EntityOwner) EO,bid;
|
Handle(SelectMgr_EntityOwner) EO,bid;
|
||||||
if (anIObj.IsNull()) return EO;
|
if (theObj.IsNull()
|
||||||
|
|| mySelection.IsNull())
|
||||||
if(mySelection.IsNull()) {
|
{
|
||||||
return EO;
|
return Handle(SelectMgr_EntityOwner)();
|
||||||
}
|
}
|
||||||
Standard_Boolean found(Standard_False);
|
|
||||||
const AIS_NListTransient& Obj = mySelection->Objects();
|
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
|
||||||
AIS_NListTransient::Iterator anIter( Obj );
|
{
|
||||||
for(; anIter.More(); anIter.Next()){
|
if (theObj != aSelIter.Value()->Selectable())
|
||||||
const Handle(Standard_Transient)& Tr = anIter.Value();
|
{
|
||||||
if(!Tr.IsNull()){
|
continue;
|
||||||
EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
|
}
|
||||||
if(EO->HasSelectable()){
|
|
||||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
|
Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast(aSelIter.Value());
|
||||||
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
|
if (aBROwner.IsNull()
|
||||||
if (anIObj == EO->Selectable()){
|
|| !aBROwner->ComesFromDecomposition())
|
||||||
found =Standard_True;
|
{
|
||||||
break;
|
return aSelIter.Value();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(found) return EO;
|
return Handle(SelectMgr_EntityOwner)();
|
||||||
return bid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
// 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
|
|
@ -1,23 +0,0 @@
|
|||||||
// 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
|
|
@ -16,9 +16,9 @@
|
|||||||
#ifndef _AIS_NListTransient_HeaderFile
|
#ifndef _AIS_NListTransient_HeaderFile
|
||||||
#define _AIS_NListTransient_HeaderFile
|
#define _AIS_NListTransient_HeaderFile
|
||||||
|
|
||||||
#include <Standard_Transient.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
#include <NCollection_List.hxx>
|
#include <NCollection_List.hxx>
|
||||||
|
|
||||||
typedef NCollection_List<Handle(Standard_Transient)> AIS_NListTransient;
|
typedef NCollection_List<Handle(SelectMgr_EntityOwner)> AIS_NListOfEntityOwner;
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -12,143 +12,112 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <AIS_Selection.hxx>
|
||||||
|
|
||||||
#include <AIS_InteractiveObject.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
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : AIS_Selection
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
AIS_Selection::AIS_Selection() :
|
|
||||||
myNb(0)
|
|
||||||
{
|
{
|
||||||
myResultMap.ReSize( MaxSizeOfResult ); // for maximum performnace on medium selections ( < 100000 objects )
|
static const Standard_Integer THE_MaxSizeOfResult = 100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Select
|
//function : AIS_Selection
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_Selection::Select()
|
AIS_Selection::AIS_Selection()
|
||||||
|
{
|
||||||
|
// for maximum performance on medium selections (< 100000 objects)
|
||||||
|
myResultMap.ReSize (THE_MaxSizeOfResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Clear
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_Selection::Clear()
|
||||||
{
|
{
|
||||||
myNb=0;
|
|
||||||
myresult.Clear();
|
myresult.Clear();
|
||||||
myResultMap.Clear();
|
myResultMap.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Select
|
//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;
|
if (theObject.IsNull()
|
||||||
Handle(SelectMgr_EntityOwner) owner = Handle(SelectMgr_EntityOwner)::DownCast( anObject );
|
|| !theObject->HasSelectable())
|
||||||
if ( owner.IsNull() )
|
{
|
||||||
anAISObj = Handle(AIS_InteractiveObject)::DownCast( anObject );
|
return AIS_SS_NotDone;
|
||||||
if ( myResultMap.IsBound( anObject ) ){
|
}
|
||||||
AIS_NListTransient::Iterator aListIter = myResultMap.Find( anObject );
|
|
||||||
//skt-----------------------------------------------------------------
|
if (!myResultMap.IsBound (theObject))
|
||||||
if( myIterator == aListIter ) {
|
{
|
||||||
if( myIterator.More() )
|
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||||
myIterator.Next();
|
myresult.Append (theObject, aListIter);
|
||||||
else
|
myResultMap.Bind (theObject, aListIter);
|
||||||
myIterator = AIS_NListTransient::Iterator();
|
return AIS_SS_Added;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------
|
|
||||||
// In the mode of advanced mesh selection only one owner is created
|
AIS_NListOfEntityOwner::Iterator aListIter = myResultMap.Find (theObject);
|
||||||
// for all selection modes. It is necessary to check the current detected
|
if (myIterator == aListIter)
|
||||||
// entity and remove the owner from map only if the detected entity is
|
{
|
||||||
// the same as previous selected (IsForcedHilight call)
|
if (myIterator.More())
|
||||||
if( !anAISObj.IsNull() || ( !owner.IsNull() && !owner->IsForcedHilight() ) )
|
|
||||||
{
|
{
|
||||||
myresult.Remove( aListIter );
|
myIterator.Next();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return AIS_SS_Added;
|
{
|
||||||
|
myIterator = AIS_NListOfEntityOwner::Iterator();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AIS_NListTransient::Iterator aListIter;
|
// In the mode of advanced mesh selection only one owner is created for all selection modes.
|
||||||
myresult.Append( anObject, aListIter );
|
// It is necessary to check the current detected entity
|
||||||
myResultMap.Bind( anObject, aListIter );
|
// and remove the owner from map only if the detected entity is the same as previous selected (IsForcedHilight call)
|
||||||
return AIS_SS_Added;
|
if (theObject->IsForcedHilight())
|
||||||
|
{
|
||||||
|
return AIS_SS_Added;
|
||||||
|
}
|
||||||
|
|
||||||
|
myresult.Remove (aListIter);
|
||||||
|
myResultMap.UnBind (theObject);
|
||||||
|
|
||||||
|
// 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 : AddSelect
|
//function : AddSelect
|
||||||
//purpose : Always add int the selection
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
AIS_SelectStatus AIS_Selection::AddSelect(const Handle(Standard_Transient)& anObject)
|
AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
|
||||||
{
|
{
|
||||||
if ( myResultMap.IsBound( anObject ) )
|
if (theObject.IsNull()
|
||||||
|
|| !theObject->HasSelectable()
|
||||||
|
|| myResultMap.IsBound (theObject))
|
||||||
|
{
|
||||||
return AIS_SS_NotDone;
|
return AIS_SS_NotDone;
|
||||||
|
}
|
||||||
AIS_NListTransient::Iterator aListIter;
|
|
||||||
myresult.Append( anObject, aListIter );
|
AIS_NListOfEntityOwner::Iterator aListIter;
|
||||||
myResultMap.Bind( anObject, aListIter );
|
myresult.Append (theObject, aListIter);
|
||||||
|
myResultMap.Bind (theObject, aListIter);
|
||||||
return AIS_SS_Added;
|
return AIS_SS_Added;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ClearAndSelect
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject)
|
|
||||||
{
|
|
||||||
Select();
|
|
||||||
Select(anObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Extent
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer AIS_Selection::Extent() const
|
|
||||||
{
|
|
||||||
return myresult.Extent();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,95 +17,72 @@
|
|||||||
#ifndef _AIS_Selection_HeaderFile
|
#ifndef _AIS_Selection_HeaderFile
|
||||||
#define _AIS_Selection_HeaderFile
|
#define _AIS_Selection_HeaderFile
|
||||||
|
|
||||||
|
#include <AIS_NListOfEntityOwner.hxx>
|
||||||
|
#include <AIS_SelectStatus.hxx>
|
||||||
#include <Standard.hxx>
|
#include <Standard.hxx>
|
||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
|
|
||||||
#include <AIS_NListTransient.hxx>
|
//! Class holding the list of selected owners.
|
||||||
#include <AIS_NListIteratorOfListTransient.hxx>
|
class AIS_Selection : public Standard_Transient
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
//! creates a new selection.
|
//! creates a new selection.
|
||||||
|
|
||||||
Standard_EXPORT AIS_Selection();
|
Standard_EXPORT AIS_Selection();
|
||||||
|
|
||||||
//! removes all the object of the 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 not yet in the selection, it will be added.
|
||||||
//! if the object is already in the selection, it will be removed.
|
//! 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.
|
//! the object is always add int the selection.
|
||||||
//! faster when the number of objects selected is great.
|
//! 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.
|
//! 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.
|
//! checks if the object is in the selection.
|
||||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject) const;
|
Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theObject) const { return myResultMap.IsBound (theObject); }
|
||||||
|
|
||||||
//! 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)
|
//! Return the list of selected objects.
|
||||||
|
const AIS_NListOfEntityOwner& Objects() const { return myresult; }
|
||||||
|
|
||||||
protected:
|
//! 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(); }
|
||||||
|
|
||||||
|
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(); }
|
||||||
|
|
||||||
|
//! Return selected object at iterator position.
|
||||||
|
const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
AIS_NListTransient myresult;
|
AIS_NListOfEntityOwner myresult;
|
||||||
AIS_NListIteratorOfListTransient myIterator;
|
AIS_NListOfEntityOwner::Iterator myIterator;
|
||||||
AIS_NDataMapOfTransientIteratorOfListTransient myResultMap;
|
NCollection_DataMap<Handle(SelectMgr_EntityOwner), AIS_NListOfEntityOwner::Iterator> myResultMap;
|
||||||
Standard_Integer myNb;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(AIS_Selection, Standard_Transient)
|
||||||
#include <AIS_Selection.lxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _AIS_Selection_HeaderFile
|
#endif // _AIS_Selection_HeaderFile
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
// 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();
|
|
||||||
}
|
|
@ -117,9 +117,7 @@ AIS_MinRadiusDimension.hxx
|
|||||||
AIS_MultipleConnectedInteractive.cxx
|
AIS_MultipleConnectedInteractive.cxx
|
||||||
AIS_MultipleConnectedInteractive.hxx
|
AIS_MultipleConnectedInteractive.hxx
|
||||||
AIS_MultipleConnectedInteractive.lxx
|
AIS_MultipleConnectedInteractive.lxx
|
||||||
AIS_NDataMapOfTransientIteratorOfListTransient.hxx
|
AIS_NListOfEntityOwner.hxx
|
||||||
AIS_NListIteratorOfListTransient.hxx
|
|
||||||
AIS_NListTransient.hxx
|
|
||||||
AIS_OffsetDimension.cxx
|
AIS_OffsetDimension.cxx
|
||||||
AIS_OffsetDimension.hxx
|
AIS_OffsetDimension.hxx
|
||||||
AIS_OffsetDimension.lxx
|
AIS_OffsetDimension.lxx
|
||||||
@ -149,7 +147,6 @@ AIS_RubberBand.hxx
|
|||||||
AIS_RubberBand.cxx
|
AIS_RubberBand.cxx
|
||||||
AIS_Selection.cxx
|
AIS_Selection.cxx
|
||||||
AIS_Selection.hxx
|
AIS_Selection.hxx
|
||||||
AIS_Selection.lxx
|
|
||||||
AIS_SelectStatus.hxx
|
AIS_SelectStatus.hxx
|
||||||
AIS_SequenceOfDimension.hxx
|
AIS_SequenceOfDimension.hxx
|
||||||
AIS_SequenceOfInteractive.hxx
|
AIS_SequenceOfInteractive.hxx
|
||||||
|
@ -602,16 +602,14 @@ const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwne
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BndBoxOfSelected
|
//function : BndBoxOfSelected
|
||||||
//purpose : Returns a bounding box of sensitive entities with the owners given
|
//purpose :
|
||||||
// if they are a part of activated selection
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
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())
|
if (theOwners->IsEmpty())
|
||||||
return aBnd;
|
return Bnd_Box();
|
||||||
|
|
||||||
|
Bnd_Box aBnd;
|
||||||
for (Init(); More(); Next())
|
for (Init(); More(); Next())
|
||||||
{
|
{
|
||||||
const Handle(SelectMgr_Selection)& aSel = CurrentSelection();
|
const Handle(SelectMgr_Selection)& aSel = CurrentSelection();
|
||||||
@ -625,20 +623,8 @@ Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (Handle(SelectMgr_IndexedMa
|
|||||||
if (theOwners->Contains (anOwner))
|
if (theOwners->Contains (anOwner))
|
||||||
{
|
{
|
||||||
Select3D_BndBox3d aBox = aSel->Sensitive()->BaseSensitive()->BoundingBox();
|
Select3D_BndBox3d aBox = aSel->Sensitive()->BaseSensitive()->BoundingBox();
|
||||||
Bnd_Box aTmpBnd;
|
aBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
|
||||||
aTmpBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
|
aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ public:
|
|||||||
|
|
||||||
//! Returns a bounding box of sensitive entities with the owners given
|
//! Returns a bounding box of sensitive entities with the owners given
|
||||||
//! if they are a part of activated selection
|
//! 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
|
//! Returns the mode for selection of object as a whole
|
||||||
Standard_Integer GlobalSelectionMode() const
|
Standard_Integer GlobalSelectionMode() const
|
||||||
|
26
tests/bugs/vis/bug27805
Normal file
26
tests/bugs/vis/bug27805
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user