// - use of optimisation in SelectMgr_ViewerSelector
// -> Best management in detected entities...
-#include <AIS_LocalContext.jxx>
-#include <StdSelect_BRepOwner.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <TColStd_MapIteratorOfMapOfTransient.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_ShadingAspect.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_LocalContext.hxx>
#include <AIS_LocalStatus.hxx>
-#include <StdPrs_WFShape.hxx>
+#include <AIS_Selection.hxx>
+#include <AIS_Shape.hxx>
+#include <Aspect_Grid.hxx>
+#include <Geom_Transformation.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Group.hxx>
+#include <NCollection_Map.hxx>
+#include <OSD_Environment.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_ShadingAspect.hxx>
#include <Select3D_SensitiveTriangulation.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <NCollection_Map.hxx>
-
-#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Filter.hxx>
+#include <SelectMgr_OrFilter.hxx>
+#include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_Selection.hxx>
+#include <SelectMgr_SelectionManager.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
-#include <OSD_Environment.hxx>
-
-#include <Geom_Transformation.hxx>
-#include <AIS_Selection.hxx>
-#include <Aspect_Grid.hxx>
-#include <AIS_Shape.hxx>
+#include <Standard_Transient.hxx>
+#include <StdSelect_BRepOwner.hxx>
+#include <StdSelect_ViewerSelector3d.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfTransient.hxx>
+#include <TColStd_MapOfTransient.hxx>
+#include <TopoDS_Shape.hxx>
+#include <V3d_View.hxx>
+#include <Visual3d_View.hxx>
static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
{
myCurDetected = 0;
myDetectedSeq.Clear();
+ myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
myMainVS->Pick (theXpix, theYpix, theView);
const Standard_Integer aDetectedNb = myMainVS->NbPicked();
// result of courses..
if (aDetectedNb == 0 || myDetectedSeq.IsEmpty())
{
- if (mylastindex != 0 && mylastindex <= myMapOfOwner.Extent())
+ if (mylastindex != 0 && mylastindex <= myMapOfOwner->Extent())
{
myMainPM->ClearImmediateDraw();
- Unhilight (myMapOfOwner (mylastindex), theView);
+ Unhilight (myMapOfOwner->FindKey (mylastindex), theView);
if (theToRedrawImmediate)
{
theView->RedrawImmediate();
return (AIS_Selection::Extent() == 0) ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
}
- const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner (aDetIndex);
+ const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
ClearSelected (Standard_False);
{
AIS_Selection::SetCurrentSelection (mySelName.ToCString());
Standard_Integer aSelNum = AIS_Selection::Extent();
- const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner (aDetIndex);
+ const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
AIS_Selection::Select (anOwner);
anOwner->SetSelected (toSelect);
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
- IO = *((Handle(AIS_InteractiveObject)*)&SO);
+ IO = Handle(AIS_InteractiveObject)::DownCast (SO);
}
}
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
- Standard_Integer HM = GetHiMod(*((Handle(AIS_InteractiveObject)*)&SO));
+ Standard_Integer HM = GetHiMod(Handle(AIS_InteractiveObject)::DownCast (SO));
if ( Ownr->IsAutoHilight() )
Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM);
else if ( aMap.IsBound (SO) )
Standard_Integer HM(0);
if(Ownr->HasSelectable()){
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
- Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO);
+ Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (SO);
anObjMap.Add (IO);
HM = GetHiMod(IO);
{
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
if( Tr.IsNull() ) return Standard_False;
- Handle(SelectMgr_EntityOwner) EO = *((Handle(SelectMgr_EntityOwner)*)&Tr);
+ 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();
TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
Handle(Standard_Transient) aTr = AIS_Selection::CurrentSelection()->Value();
- Handle(SelectMgr_EntityOwner) anEO = *((Handle(SelectMgr_EntityOwner)*)&aTr);
+ Handle(SelectMgr_EntityOwner) anEO = Handle(SelectMgr_EntityOwner)::DownCast (aTr);
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(anEO);
if( aBRO.IsNull() )
{
Handle(AIS_InteractiveObject) IO;
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
if( !Tr.IsNull() ) {
- Handle(SelectMgr_EntityOwner) EO = *((Handle(SelectMgr_EntityOwner)*)&Tr);
+ Handle(SelectMgr_EntityOwner) EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
Handle(SelectMgr_SelectableObject) SO;
if(EO->HasSelectable()){
SO = EO->Selectable();
- IO = *((Handle(AIS_InteractiveObject)*)&SO);
+ IO = Handle(AIS_InteractiveObject)::DownCast (SO);
}
}
return IO;
Handle(SelectMgr_EntityOwner) EO;
Handle(Standard_Transient) Tr = AIS_Selection::CurrentSelection()->Value();
if( !Tr.IsNull() )
- EO = *((Handle(SelectMgr_EntityOwner)*)&Tr);
+ EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
return EO;
}
continue;
}
- if (toClearDeactivated && !mySM->IsActivated (theIO, myMainVS, aMode))
+ if (toClearDeactivated && !mySM->IsActivated(theIO, aMode, myMainVS))
{
continue;
}
Handle(SelectMgr_Selection) aSelection = theIO->Selection(aMode);
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
- Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive();
+ Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
if (anEntity.IsNull())
{
continue;
Standard_Boolean isAISRemainsDetected = Standard_False;
- // 3. Remove entity owners from AIS_Selection
+ // 3. AIS_Selection : remove entity owners from AIS_Selection
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
Handle(AIS_Selection) aSelection = AIS_Selection::Selection (mySelName.ToCString());
AIS_NListTransient::Iterator anIter (aSelection->Objects());
{
isAISRemainsDetected = Standard_True;
}
-
- aRemoveEntites.Append (anOwner);
- anOwner->SetSelected (Standard_False);
- for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+ else
{
- Unhilight (anOwner, aViewer->ActiveView());
+ aRemoveEntites.Append (anOwner);
+ anOwner->SetSelected (Standard_False);
+ for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+ {
+ Unhilight (anOwner, aViewer->ActiveView());
+ }
}
}
-
AIS_NListTransient::Iterator anIterRemove (aRemoveEntites);
for (; anIterRemove.More(); anIterRemove.Next())
{
aSelection->Select (anIterRemove.Value());
}
- // 4. Remove entity owners from myMapOfOwner
+ // 4. AIS_LocalContext - myMapOfOwner : remove entity owners from myMapOfOwner
SelectMgr_IndexedMapOfOwner anOwnersToKeep;
- for (Standard_Integer anIdx = 1; anIdx <= myMapOfOwner.Extent(); anIdx++)
+ for (Standard_Integer anIdx = 1; anIdx <= myMapOfOwner->Extent(); anIdx++)
{
- Handle(SelectMgr_EntityOwner) anOwner = myMapOfOwner (anIdx);
+ Handle(SelectMgr_EntityOwner) anOwner = myMapOfOwner->FindKey (anIdx);
if (anOwner.IsNull())
{
continue;
}
}
}
- myMapOfOwner.Clear();
- myMapOfOwner.Assign (anOwnersToKeep);
- mylastindex = myMapOfOwner.FindIndex (aLastPicked);
+ myMapOfOwner->Clear();
+ myMapOfOwner->Assign (anOwnersToKeep);
+ mylastindex = myMapOfOwner->FindIndex (aLastPicked);
if (!IsValidIndex (mylastindex))
{
myMainPM->ClearImmediateDraw();
const Handle(SelectMgr_Selection)& SIOBJ = anIObj->Selection(0);
SIOBJ->Init();
if(SIOBJ->More()){
- Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->OwnerId();
- EO = *((Handle(SelectMgr_EntityOwner)*)&BO);
+ Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId();
+ EO = Handle(SelectMgr_EntityOwner)::DownCast (BO);
}
}
if(EO.IsNull())
- EO = new SelectMgr_EntityOwner(anIObj);
+ EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
}
ClearSelected(Standard_False);
{
const Handle(SelectMgr_Selection)& SIOBJ = anIObj->Selection(0);
SIOBJ->Init();
- if(SIOBJ->More())
- {
- Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->OwnerId();
- EO = *((Handle(SelectMgr_EntityOwner)*)&BO);
+ if(SIOBJ->More()){
+ Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId();
+ EO = Handle(SelectMgr_EntityOwner)::DownCast (BO);
}
}
if(EO.IsNull())
{
- EO = new SelectMgr_EntityOwner(anIObj);
+ EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
}
}
//
//=======================================================================================================
- const Standard_Integer aNewIndex = myMapOfOwner.Contains (thePickOwner)
- ? myMapOfOwner.FindIndex (thePickOwner)
- : myMapOfOwner.Add (thePickOwner);
+ const Standard_Integer aNewIndex = myMapOfOwner->Contains (thePickOwner)
+ ? myMapOfOwner->FindIndex (thePickOwner)
+ : myMapOfOwner->Add (thePickOwner);
// For the advanced mesh selection mode the owner indices comparison
// is not effective because in that case only one owner manage the
{
myMainPM->ClearImmediateDraw();
if (mylastindex != 0
- && mylastindex <= myMapOfOwner.Extent())
+ && mylastindex <= myMapOfOwner->Extent())
{
- const Handle(SelectMgr_EntityOwner)& aLastOwner = myMapOfOwner (mylastindex);
+ const Handle(SelectMgr_EntityOwner)& aLastOwner = myMapOfOwner->FindKey (mylastindex);
Unhilight (aLastOwner, theView);
}
static TopoDS_Shape bidsh;
if(mylastindex != 0)
{
- Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner(mylastindex));
+ Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey (mylastindex));
if(BROwnr.IsNull()) return bidsh;
return BROwnr->Shape();
}
{
Handle(AIS_InteractiveObject) Iobj;
if(IsValidIndex(mylastindex)){
- Handle(SelectMgr_SelectableObject) SO = myMapOfOwner.FindKey(mylastindex)->Selectable();
- Iobj = *((Handle(AIS_InteractiveObject)*) &SO);
+ Handle(SelectMgr_SelectableObject) SO = myMapOfOwner->FindKey(mylastindex)->Selectable();
+ Iobj = Handle(AIS_InteractiveObject)::DownCast (SO);
}
return Iobj;
}
{
Handle(SelectMgr_EntityOwner) bid;
if(!IsValidIndex(mylastindex)) return bid;
- return myMapOfOwner.FindKey(mylastindex);
+ return myMapOfOwner->FindKey(mylastindex);
}
Standard_Boolean AIS_LocalContext::ComesFromDecomposition(const Standard_Integer PickedIndex) const
{
- const Handle(SelectMgr_EntityOwner)& OWN = myMapOfOwner.FindKey(PickedIndex);
+ const Handle(SelectMgr_EntityOwner)& OWN = myMapOfOwner->FindKey(PickedIndex);
Handle(SelectMgr_SelectableObject) aSel = OWN->Selectable();
if (myActiveObjects.IsBound (aSel)) { // debug of jmi
const Handle(AIS_LocalStatus)& Stat = myActiveObjects(aSel);
return Standard_False;
}
-
-//=======================================================================
-//function : DisplayAreas
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::DisplayAreas(const Handle(V3d_View)& aviou)
-{
- myMainVS->DisplayAreas(aviou);
-}
-
-//=======================================================================
-//function : ClearAreas
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::ClearAreas(const Handle(V3d_View)& aviou)
-{
- myMainVS->ClearAreas(aviou);
-}
-
//=======================================================================
//function : DisplaySensitive
//purpose :
Standard_Boolean AIS_LocalContext::IsShape(const Standard_Integer Index) const
{
- if(Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner.FindKey(Index)).IsNull())
+ if(Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey(Index)).IsNull())
return Standard_False;
return
ComesFromDecomposition(Index);
Handle(AIS_Shape) shape = Handle(AIS_Shape)::DownCast(anIObj);
if( !shape.IsNull() )
return myFilters->IsOk(new StdSelect_BRepOwner(shape->Shape(),shape));
- return myFilters->IsOk(new SelectMgr_EntityOwner(anIObj));
+ return myFilters->IsOk(new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj));
}
}
myMainPM->BeginImmediateDraw();
- const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner (mylastindex);
+ const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (mylastindex);
const Standard_Integer aHilightMode = anOwner->HasSelectable()
? GetHiMod (Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()))
: 0;
- myMapOfOwner (mylastindex)->Unhilight (myMainPM, aHilightMode);
+ myMapOfOwner->FindKey (mylastindex)->Unhilight (myMainPM, aHilightMode);
myMainPM->EndImmediateDraw (theView);
mylastindex = 0;
return Standard_True;
for(; anIter.More(); anIter.Next()){
const Handle(Standard_Transient)& Tr = anIter.Value();
if(!Tr.IsNull()){
- EO = *((Handle(SelectMgr_EntityOwner)*)&Tr);
+ EO = Handle(SelectMgr_EntityOwner)::DownCast (Tr);
if(EO->HasSelectable()){
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
Standard_Boolean found(Standard_False);
if (!found) {
- SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive aSensitiveIt (myMainVS->Primitives());
- for (; aSensitiveIt.More(); aSensitiveIt.Next()) {
- EO = Handle(SelectMgr_EntityOwner)::DownCast (aSensitiveIt.Value()->OwnerId());
+ NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
+ myMainVS->ActiveOwners (anActiveOwners);
+ for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners); anOwnersIt.More(); anOwnersIt.Next())
+ {
+ EO = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
if (!BROwnr.IsNull() && BROwnr->HasShape() && BROwnr->Shape() == sh) {
found = Standard_True;