1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0025467: Visualization - Possibility to remove AIS_LocalContext class

Deprecated functionality related to Local Context has been removed.

The following classes and types have been removed:
AIS_LocalContext, AIS_DataMapOfILC, AIS_LocalStatus, SelectMgr_SequenceOfSelector, SelectMgr_DataMapOfObjectSelectors.
Value AIS_DS_Temporary has been removed from enumeration AIS_DisplayStatus.

The following methods related to Local Context have been removed from AIS_InteractiveContext:
::HasOpenedContext(), ::HighestIndex(), ::LocalContext(),
::LocalSelector(), ::OpenLocalContext(), ::CloseLocalContext(),
::IndexOfCurrentLocal(), ::CloseAllContexts(), ::ResetOriginalState(),
::ClearLocalContext(), ::UseDisplayedObjects(), ::NotUseDisplayedObjects(),
::SetShapeDecomposition(), ::SetTemporaryAttributes(),
::ActivateStandardMode(), ::DeactivateStandardMode(), ::KeepTemporary(),
::SubIntensityOn(), ::SubIntensityOff(),
::ActivatedStandardModes(), ::IsInLocal()
and ::AddOrRemoveSelected() taking TopoDS_Shape.

The methods AIS_InteractiveContext::Display() and ::Load()
taking argument theToAllowDecomposition have been marked as deprecated;
the new methods without this unused argument should be used instead.
AIS_InteractiveContext::DisplayedObjects() - removed argument theOnlyFromNeutral.

SelectMgr_SelectionManager has been simplified so that now it support only single Viewer Selector.

The argument -local has been removed from Draw Harness commands vselmode, vremove, vdisplay, vdisplayall, verase.
This commit is contained in:
kgv
2018-06-20 08:48:40 +03:00
parent d9f79dae49
commit 68dcee028d
58 changed files with 449 additions and 7766 deletions

View File

@@ -16,14 +16,11 @@
#include <AIS_InteractiveContext.hxx>
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
#include <AIS_ConnectedInteractive.hxx>
#include <AIS_GlobalStatus.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LocalStatus.hxx>
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <AIS_MultipleConnectedInteractive.hxx>
#include <AIS_Shape.hxx>
@@ -107,7 +104,6 @@ namespace
//=======================================================================
AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer):
mgrSelector(new SelectMgr_SelectionManager()),
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->StructureManager())),
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
@@ -116,13 +112,14 @@ myToHilightSelected(Standard_True),
mySelection(new AIS_Selection()),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
myCurLocalIndex(0),
myCurDetected(0),
myCurHighlighted(0),
myPickingStrategy (SelectMgr_PickingStrategy_FirstAcceptable),
myAutoHilight(Standard_True),
myIsAutoActivateSelMode(Standard_True)
{
mgrSelector->Add (myMainSel);
mgrSelector = new SelectMgr_SelectionManager (myMainSel);
myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
myStyles[Prs3d_TypeOfHighlight_Selected] = new Prs3d_Drawer();
myStyles[Prs3d_TypeOfHighlight_Dynamic] = new Prs3d_Drawer();
@@ -178,11 +175,7 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
{
// clear the current selection
mySelection->Clear();
// let's remove one reference explicitly. this operation's supposed to
// be performed when mgrSelector will be destroyed but anyway...
const Handle(SelectMgr_ViewerSelector)& aSelector = myMainSel; // to avoid ambiguity
mgrSelector->Remove (aSelector);
mgrSelector.Nullify();
Handle(AIS_InteractiveContext) aNullContext;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
@@ -211,46 +204,15 @@ void AIS_InteractiveContext::UpdateCurrentViewer()
//function : DisplayedObjects
//purpose :
//=======================================================================
void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfIO,
const Standard_Boolean theOnlyFromNeutral) const
void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfIO) const
{
if (!HasOpenedContext()
|| theOnlyFromNeutral)
{
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
{
theListOfIO.Append (anObjIter.Key());
}
}
return;
}
// neutral point
TColStd_MapOfTransient aDispMap;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
{
aDispMap.Add (anObjIter.Key());
theListOfIO.Append (anObjIter.Key());
}
}
// parse all local contexts...
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
const Handle(AIS_LocalContext)& aLocCtx = aCtxIter.Value();
aLocCtx->DisplayedObjects (aDispMap);
}
Handle(AIS_InteractiveObject) anObj;
for (TColStd_MapIteratorOfMapOfTransient aDispMapIter (aDispMap); aDispMapIter.More(); aDispMapIter.Next())
{
const Handle(Standard_Transient)& aTransient = aDispMapIter.Key();
anObj = Handle(AIS_InteractiveObject)::DownCast (aTransient);
theListOfIO.Append (anObj);
}
}
//=======================================================================
@@ -259,8 +221,7 @@ void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfI
//=======================================================================
void AIS_InteractiveContext::DisplayedObjects (const AIS_KindOfInteractive theKind,
const Standard_Integer theSign,
AIS_ListOfInteractive& theListOfIO,
const Standard_Boolean /*OnlyFromNeutral*/) const
AIS_ListOfInteractive& theListOfIO) const
{
ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Displayed, theListOfIO);
}
@@ -406,9 +367,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
Standard_Integer aDispMode = 0, aHiMod = -1, aSelMode = -1;
GetDefModes (theIObj, aDispMode, aHiMod, aSelMode);
Display (theIObj, aDispMode, myIsAutoActivateSelMode ? aSelMode : -1,
theToUpdateViewer, theIObj->AcceptShapeDecomposition());
Display (theIObj, aDispMode, myIsAutoActivateSelMode ? aSelMode : -1, theToUpdateViewer);
}
//=======================================================================
@@ -446,7 +405,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus)
{
if (theIObj.IsNull())
@@ -457,7 +415,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
if (theDispStatus == AIS_DS_Erased)
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
Load (theIObj, theSelectionMode);
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theIObj))
{
(*aStatusPtr)->SetDisplayMode (theDispMode);
@@ -466,25 +424,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
}
setContextToObject (theIObj);
if (theDispStatus == AIS_DS_Temporary
&& !HasOpenedContext())
{
return;
}
else if (HasOpenedContext())
{
if (theDispStatus == AIS_DS_None
|| theDispStatus == AIS_DS_Temporary)
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
}
}
if (!myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
@@ -498,16 +437,12 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
mgrSelector->Load (theIObj);
}
mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
mgrSelector->Activate (theIObj, theSelectionMode);
}
}
else
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Temporary)
{
return;
}
// Mark the presentation modes hidden of interactive object different from aDispMode.
// Then make sure aDispMode is displayed and maybe highlighted.
@@ -541,7 +476,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
if (!aStatus->IsSModeIn (theSelectionMode))
aStatus->AddSelectionMode (theSelectionMode);
mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
mgrSelector->Activate (theIObj, theSelectionMode);
}
}
}
@@ -557,8 +492,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
//purpose :
//=======================================================================
void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theSelMode,
const Standard_Boolean theToAllowDecomposition)
const Standard_Integer theSelMode)
{
if (theIObj.IsNull())
{
@@ -566,12 +500,6 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
}
setContextToObject (theIObj);
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
return;
}
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
@@ -606,26 +534,7 @@ void AIS_InteractiveContext::Erase (const Handle(AIS_InteractiveObject)& theIObj
theIObj->ClearSelected();
}
Standard_Boolean wasInCtx = Standard_False;
if (HasOpenedContext())
{
// First it is checked if it is possible to remove in the current local context
// then one tries to remove in other local contexts, if they allow it...
wasInCtx = myLocalContexts (myCurLocalIndex)->Erase (theIObj);
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->AcceptErase())
{
wasInCtx = aCtxIter.Value()->Erase (theIObj) || wasInCtx;
}
}
}
if (!wasInCtx)
{
EraseGlobal (theIObj, Standard_False);
}
EraseGlobal (theIObj, Standard_False);
if (theToUpdateViewer)
{
myMainVwr->Update();
@@ -638,11 +547,6 @@ void AIS_InteractiveContext::Erase (const Handle(AIS_InteractiveObject)& theIObj
//=======================================================================
void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
@@ -663,11 +567,6 @@ void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
//=======================================================================
void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
const AIS_DisplayStatus aStatus = anObjIter.Value()->GraphicStatus();
@@ -689,11 +588,6 @@ void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewe
//=======================================================================
void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
@@ -712,11 +606,6 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
//=======================================================================
void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
{
@@ -731,71 +620,6 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
}
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Integer WhichContext)
{
if(anIObj.IsNull()) return Standard_False;
if(!HasOpenedContext()) return Standard_False;
if(myObjects.IsBound(anIObj)) return Standard_False;
if(WhichContext!=-1 && !myLocalContexts.IsBound(WhichContext)) return Standard_False;
// Protection : if one tries to preserve a temporary object
// which is not in the local active context... rob 11-06-97
Standard_Integer IsItInLocal = myCurLocalIndex;
Standard_Boolean Found(Standard_False);
while(IsItInLocal>0 && !Found){
if(!myLocalContexts.IsBound(IsItInLocal))
IsItInLocal--;
else if(myLocalContexts(IsItInLocal)->IsIn(anIObj))
Found = Standard_True;
else
IsItInLocal--;
}
if(!Found) return Standard_False;
// const Handle(AIS_LocalStatus)& LS = (WhichContext== -1) ?
// myLocalContexts(IsItInLocal)->Status(anIObj):myLocalContexts(WhichContext)->Status(anIObj);
// CLE
// const Handle(AIS_LocalStatus)& LS = myLocalContexts(IsItInLocal)->Status(anIObj);
Handle(AIS_LocalStatus) LS = myLocalContexts(IsItInLocal)->Status(anIObj);
// ENDCLE
if(LS->IsTemporary()){
Standard_Integer DM,HM,SM;
GetDefModes(anIObj,DM,HM,SM);
SM = LS->SelectionModes().IsEmpty() ? SM : LS->SelectionModes().First();
if(LS->DisplayMode()!= DM ){
Standard_Integer LSM = LS->SelectionModes().IsEmpty() ? -1 : LS->SelectionModes().First();
myLocalContexts(IsItInLocal)->Display(anIObj,DM,LS->Decomposed(),LSM);
}
Handle (AIS_GlobalStatus) GS = new AIS_GlobalStatus(AIS_DS_Displayed,
DM,
SM,
Standard_False);
// GS->SubIntensityOn();
myObjects.Bind(anIObj,GS);
myMainVwr->StructureManager()->RegisterObject (anIObj);
mgrSelector->Load(anIObj);
mgrSelector->Activate(anIObj,SM,myMainSel);
LS->SetTemporary(Standard_False);
}
return Standard_True;
}
//=======================================================================
//function : DisplayStatus
//purpose :
@@ -806,19 +630,8 @@ AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus (const Handle(AIS_Intera
{
return AIS_DS_None;
}
else if (myObjects.IsBound (theIObj))
{
return myObjects (theIObj)->GraphicStatus();
}
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->IsIn (theIObj))
{
return AIS_DS_Temporary;
}
}
return AIS_DS_None;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
return aStatus != NULL ? (*aStatus)->GraphicStatus() : AIS_DS_None;
}
//=======================================================================
@@ -841,19 +654,6 @@ void AIS_InteractiveContext::Remove (const Handle(AIS_InteractiveObject)& theIOb
}
theIObj->SetContext (Handle(AIS_InteractiveContext)());
}
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Remove (theIObj);
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->AcceptErase())
{
aCtxIter.Value()->Remove (theIObj);
}
}
}
ClearGlobal (theIObj, theToUpdateViewer);
}
@@ -876,43 +676,6 @@ void AIS_InteractiveContext::RemoveAll (const Standard_Boolean theToUpdateViewer
}
}
//=======================================================================
//function : ClearPrs
//purpose :
//=======================================================================
void AIS_InteractiveContext::ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theMode,
const Standard_Boolean theToUpdateViewer)
{
if (theIObj.IsNull())
{
return;
}
if (!HasOpenedContext())
{
ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
return;
}
Standard_Boolean wasInCtx = myLocalContexts (myCurLocalIndex)->ClearPrs (theIObj, theMode);
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->AcceptErase())
{
wasInCtx = aCtxIter.Value()->ClearPrs (theIObj, theMode) || wasInCtx;
}
}
if (!wasInCtx)
{
ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
}
else if (theToUpdateViewer)
{
myMainVwr->Update();
}
}
//=======================================================================
//function : HilightWithColor
//purpose :
@@ -925,23 +688,16 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
return;
setContextToObject (theObj);
if (!HasOpenedContext())
{
if (!myObjects.IsBound (theObj))
return;
if (!myObjects.IsBound (theObj))
return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
aStatus->SetHilightStatus (Standard_True);
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
aStatus->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
highlightGlobal (theObj, theStyle, aStatus->DisplayMode());
aStatus->SetHilightStyle (theStyle);
}
}
else
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myLocalContexts (myCurLocalIndex)->Hilight (theObj, theStyle);
highlightGlobal (theObj, theStyle, aStatus->DisplayMode());
aStatus->SetHilightStyle (theStyle);
}
if (theIsToUpdate)
@@ -955,24 +711,17 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
{
if(anIObj.IsNull()) return;
if(!myObjects.IsBound(anIObj)) return;
if (!HasOpenedContext())
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
unhighlightGlobal (anIObj);
}
}
else
{
myLocalContexts(myCurLocalIndex)->Unhilight(anIObj);
unhighlightGlobal (anIObj);
}
if(updateviewer) myMainVwr->Update();
}
@@ -982,27 +731,9 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const
{
if (!HasOpenedContext())
{
if (!myObjects.IsBound (theObj))
return Standard_False;
return myObjects (theObj)->IsHilighted();
}
Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer aCtxIdx = HighestIndex();
Standard_ENABLE_DEPRECATION_WARNINGS
for (; aCtxIdx >= 1; aCtxIdx--)
{
if (myLocalContexts.IsBound (aCtxIdx))
{
if (myLocalContexts (aCtxIdx)->IsHilighted (theObj))
return Standard_True;
}
}
return Standard_False;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
return aStatus != NULL
&& (*aStatus)->IsHilighted();
}
//=======================================================================
@@ -1035,19 +766,16 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_Ent
Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
Handle(Prs3d_Drawer)& theStyle) const
{
if (HasOpenedContext())
myLocalContexts (myCurLocalIndex)->HighlightStyle (theObj, theStyle);
if (IsHilighted (theObj))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
if (aStatus != NULL
&& (*aStatus)->IsHilighted())
{
theStyle = myObjects (theObj)->HilightStyle();
theStyle = (*aStatus)->HilightStyle();
return Standard_True;
}
else
{
theStyle.Nullify();
return Standard_False;
}
theStyle.Nullify();
return Standard_False;
}
//=======================================================================
@@ -1090,22 +818,13 @@ Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(SelectMgr_
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj) const
Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_InteractiveObject)& theObj) const
{
if(anIObj.IsNull()) return Standard_False;
if(theObj.IsNull()) return Standard_False;
if(myObjects.IsBound(anIObj))
if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed)
return Standard_True;
AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
for(;ItM.More();ItM.Next()){
if(ItM.Value()->IsDisplayed(anIObj))
return Standard_True;
}
return Standard_False;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
return aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed;
}
//=======================================================================
@@ -1120,24 +839,10 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_Interacti
return Standard_False;
}
if (myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
&& aStatus->DisplayMode() == theMode)
{
return Standard_True;
}
}
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->IsDisplayed (theIObj, theMode))
{
return Standard_True;
}
}
return Standard_False;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
return aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed
&& (*aStatus)->DisplayMode() == theMode;
}
//=======================================================================
@@ -1150,14 +855,11 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter
{
return -1;
}
else if (!myObjects.IsBound (theIObj))
{
return 0;
}
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_Erased)
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& ((*aStatus)->GraphicStatus() == AIS_DS_Displayed
|| (*aStatus)->GraphicStatus() == AIS_DS_Erased))
{
Standard_Integer aDispMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
@@ -1182,23 +884,17 @@ void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObj
}
setContextToObject (theIObj);
if (myObjects.IsBound (theIObj))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& ((*aStatus)->GraphicStatus() == AIS_DS_Displayed
|| (*aStatus)->GraphicStatus() == AIS_DS_Erased))
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_Erased)
{
Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
: (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
? myDefaultDrawer->DisplayMode()
: 0);
myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
}
}
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetDisplayPriority (theIObj, thePriority);
Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
: (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
? myDefaultDrawer->DisplayMode()
: 0);
myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
}
}
@@ -1262,9 +958,9 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
return;
}
if (HasOpenedContext()
|| (myObjects.IsBound (theIObj)
&& myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
{
myMainVwr->Update();
}
@@ -1282,17 +978,9 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
mgrSelector->RecomputeSelection (theIO);
if (HasOpenedContext())
{
for (Standard_Integer aContextIdx = 1; aContextIdx <= myLocalContexts.Extent(); aContextIdx++)
{
myLocalContexts (aContextIdx)->ClearOutdatedSelection (theIO, Standard_False);
}
return;
}
if (!myObjects.IsBound (theIO) ||
myObjects (theIO)->GraphicStatus() != AIS_DS_Displayed)
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
if (aStatus == NULL
|| (*aStatus)->GraphicStatus() != AIS_DS_Displayed)
{
return;
}
@@ -1302,7 +990,7 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
for (; aModesIter.More(); aModesIter.Next())
{
mgrSelector->Activate (theIO, aModesIter.Value(), myMainSel);
mgrSelector->Activate (theIO, aModesIter.Value());
}
}
@@ -1327,26 +1015,13 @@ void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIOb
mgrSelector->Update(theIObj);
for (Standard_Integer aContextIdx = 1; aContextIdx <= myLocalContexts.Extent(); aContextIdx++)
{
myLocalContexts (aContextIdx)->ClearOutdatedSelection (theIObj, Standard_False);
}
if (theUpdateViewer)
{
if (!myObjects.IsBound (theIObj))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
{
return;
}
switch (myObjects (theIObj)->GraphicStatus())
{
case AIS_DS_Displayed:
case AIS_DS_Temporary:
myMainVwr->Update();
break;
default:
break;
myMainVwr->Update();
}
}
}
@@ -1383,15 +1058,7 @@ void AIS_InteractiveContext::SetLocation (const Handle(AIS_InteractiveObject)& t
theIObj->SetLocalTransformation (theLoc.Transformation());
if (!HasOpenedContext())
{
mgrSelector->Update (theIObj, Standard_False);
}
else
{
Handle(StdSelect_ViewerSelector3d) aTempSel = myLocalContexts (myCurLocalIndex)->MainSelector();
mgrSelector->Update (theIObj, aTempSel, Standard_False);
}
mgrSelector->Update (theIObj, Standard_False);
// if the object or its part is highlighted dynamically, it is necessary to apply location transformation
// to its highlight structure immediately
@@ -2155,11 +1822,6 @@ void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObje
void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
@@ -2298,8 +1960,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Temporary
|| aStatus->GraphicStatus() == AIS_DS_Erased)
if (aStatus->GraphicStatus() == AIS_DS_Erased)
{
return;
}
@@ -2343,7 +2004,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
mgrSelector->Deactivate (theIObj, aSelModeIter.Value());
}
aStatus->ClearSelectionModes();
aStatus->SetGraphicStatus (AIS_DS_Erased);
@@ -2644,14 +2305,7 @@ Standard_Boolean AIS_InteractiveContext::IsoOnTriangulation() const
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
{
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetPixelTolerance (thePrecision);
}
else
{
myMainSel->SetPixelTolerance (thePrecision);
}
myMainSel->SetPixelTolerance (thePrecision);
}
//=======================================================================
@@ -2660,9 +2314,7 @@ void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecis
//=======================================================================
Standard_Integer AIS_InteractiveContext::PixelTolerance() const
{
return HasOpenedContext()
? myLocalContexts (myCurLocalIndex)->PixelTolerance()
: myMainSel->PixelTolerance();
return myMainSel->PixelTolerance();
}
//=======================================================================
@@ -2673,56 +2325,15 @@ void AIS_InteractiveContext::SetSelectionSensitivity (const Handle(AIS_Interacti
const Standard_Integer theMode,
const Standard_Integer theNewSensitivity)
{
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetSelectionSensitivity (theObject, theMode, theNewSensitivity);
return;
}
mgrSelector->SetSelectionSensitivity (theObject, theMode, theNewSensitivity);
}
//=======================================================================
//function : IsInLocal
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_InteractiveObject)& theIObj,
Standard_Integer& theIndex) const
{
if (theIObj.IsNull())
{
return Standard_False;
}
// if it exists at neutral point 0 index is returned
if (myObjects.IsBound (theIObj))
{
theIndex = 0;
return Standard_False;
}
for (Standard_Integer aCtxIter = 1; aCtxIter <= myLocalContexts.Extent(); ++aCtxIter)
{
if (myLocalContexts.IsBound (aCtxIter))
{
if(myLocalContexts (aCtxIter)->IsIn (theIObj))
{
theIndex = aCtxIter;
return Standard_True;
}
}
}
theIndex = -1;
return Standard_False;
}
//=======================================================================
//function : InitAttributes
//purpose :
//=======================================================================
void AIS_InteractiveContext::InitAttributes()
{
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);
@@ -2880,12 +2491,9 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin,
const Standard_Boolean theToUpdate)
{
const Handle(AIS_Selection)& aSelection = HasOpenedContext()
? myLocalContexts(myCurLocalIndex)->Selection()
: mySelection;
Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap;
for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());