#include <TCollection_ExtendedString.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopLoc_Location.hxx>
-#include <TopoDS_Shape.hxx>
#include <V3d_AmbientLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_Light.hxx>
typedef NCollection_DataMap<Handle(AIS_InteractiveObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > AIS_MapOfObjSelectedOwners;
+namespace
+{
+ TopoDS_Shape AIS_myDummyShape;
+}
+
//=======================================================================
//function : highlightWithColor
//purpose :
if (!theOwner->IsAutoHilight())
{
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- const Handle(AIS_Selection)& aCurSel = AIS_Selection::CurrentSelection();
SelectMgr_SequenceOfOwner aSeq;
- for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
+ for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) aSelOwnr =
- Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (aSelOwnr->Selectable() != anObj)
continue;
aSeq.Append (aSelOwnr);
//=======================================================================
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
{
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
- for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
+ for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable())
continue;
return aStatus;
}
+//=======================================================================
+//function : AddSelect
+//purpose :
+//=======================================================================
+AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(Standard_Transient)& theObject)
+{
+ if (HasOpenedContext())
+ {
+ return myLocalContexts(myCurLocalIndex)->AddSelect (theObject);
+ }
+ mySelection->AddSelect (theObject);
+
+ Standard_Integer aSelNum = NbSelected();
+ return (aSelNum == 0) ? AIS_SOP_NothingSelected
+ : (aSelNum == 1) ? AIS_SOP_OneSelected
+ : AIS_SOP_SeveralSelected;
+}
+
//=======================================================================
//function : Select
//purpose :
}
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
continue;
- AIS_Selection::Select (aCurOwner);
+ mySelection->Select (aCurOwner);
aCurOwner->State (1);
}
}
aSelector->Pick (thePolyline, theView);
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
- AIS_Selection::Select (anOwner);
+ mySelection->Select (anOwner);
anOwner->State (1);
}
{
unhighlightSelected (Standard_True);
- AIS_Selection::Select();
+ mySelection->Select();
if (toUpdateViewer && myWasLastMain)
{
UpdateCurrentViewer();
}
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
- AIS_SelectStatus aSelStatus = AIS_Selection::Select (anOwner);
+ AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
anOwner->State (aState);
}
aSelector->Pick (thePolyline, theView);
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
for (aSelector->Init(); aSelector->More(); aSelector->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
- AIS_SelectStatus aSelStatus = AIS_Selection::Select (anOwner);
+ AIS_SelectStatus aSelStatus = mySelection->Select (anOwner);
Standard_Integer aState = (aSelStatus == AIS_SS_Added) ? 1 : 0;
anOwner->State (aState);
}
// In case of selection without using local context
myMainPM->ClearImmediateDraw();
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
AIS_MapOfObjSelectedOwners anObjOwnerMap;
- for (aSel->Init(); aSel->More(); aSel->Next())
+ for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (!anOwner.IsNull() && anOwner->HasSelectable())
{
const Handle(AIS_InteractiveObject) anObj =
return myLocalContexts (myCurLocalIndex)->UnhilightPicked (theToUpdateViewer);
}
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aSel = AIS_Selection::Selection (myCurrentName.ToCString());
- for (aSel->Init(); aSel->More(); aSel->Next())
+ for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aSel->Value());
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (!anOwner.IsNull() && anOwner->HasSelectable())
{
const Handle(AIS_InteractiveObject) anObj =
unhighlightSelected();
- AIS_Selection::Select();
+ mySelection->Select();
myMainPM->ClearImmediateDraw();
if (theToUpdateViewer)
return;
}
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
- for (aCurSel->Init(); aCurSel->More(); aCurSel->Next())
+ for (mySelection->Init(); mySelection->More(); mySelection->Next())
{
const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value());
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
aSel->Init();
Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
- AIS_Selection::ClearAndSelect (anOwner);
+ mySelection->ClearAndSelect (anOwner);
anOwner->State (1);
if (anOwner == theObject->GlobalSelOwner())
{
unhighlightSelected();
- AIS_Selection::ClearAndSelect (theOwner);
+ mySelection->ClearAndSelect (theOwner);
theOwner->State (1);
Quantity_NameOfColor aCustomColor;
Standard_Boolean isCustomColorSet;
if (theOwner.IsNull() || !theOwner->HasSelectable())
return;
- AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
- Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
-
- AIS_SelectStatus aSelStat = AIS_Selection::Select (theOwner);
+ AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
Standard_Integer aState = aSelStat == AIS_SS_Added ? 1 : 0;
theOwner->State (aState);
return;
}
- AIS_Selection::Selection (myCurrentName.ToCString())->Init();
+ mySelection->Init();
}
//=======================================================================
if (HasOpenedContext())
return myLocalContexts (myCurLocalIndex)->MoreSelected();
- return AIS_Selection::Selection (myCurrentName.ToCString())->More();
+ return mySelection->More();
}
//=======================================================================
return;
}
- AIS_Selection::Selection (myCurrentName.ToCString())->Next();
+ mySelection->Next();
}
//=======================================================================
return myLocalContexts (myCurLocalIndex)->SelectedShape();
}
- if (AIS_Selection::Selection (myCurrentName.ToCString())->Extent() == 0)
+ if (mySelection->Extent() == 0)
return TopoDS_Shape();
const Handle(StdSelect_BRepOwner) anOwner =
- Handle(StdSelect_BRepOwner)::DownCast (AIS_Selection::Selection (myCurrentName.ToCString())->Value());
+ Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
if (!anOwner->HasSelectable())
return TopoDS_Shape();
}
const Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (AIS_Selection::Selection (myCurrentName.ToCString())->Value());
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable())
return NULL;
return myLocalContexts(myCurLocalIndex)->SelectedOwner();
}
- Handle(AIS_Selection) aCurSel = AIS_Selection::Selection (myCurrentName.ToCString());
-
- return aCurSel->Extent() > 0 ?
- Handle(SelectMgr_EntityOwner)::DownCast (aCurSel->Value()) : NULL;
+ return mySelection->Extent() > 0 ?
+ Handle(SelectMgr_EntityOwner)::DownCast (mySelection->Value()) : NULL;
}
//=======================================================================
return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape();
}
- static TopoDS_Shape aDummyShape;
-
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
if (aCurrentShape.IsNull())
{
- return aDummyShape;
+ return AIS_myDummyShape;
}
return aCurrentShape->Shape();