#define BUC60577 //GG_101099 Enable to compute correctly
// transparency with more than one object in the view.
-//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
-
-#define G003 //EUG_26/01/00 Degenerate support (G003)
-
-//IMP140200 //GG Add SetSelectedAspect() method.
-
#define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode()
// method, compute only authorized presentation.
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
-myIsCollClosed(Standard_True),
myToHilightSelected( Standard_False ),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
InitAttributes();
}
-
-//=======================================================================
-//function : AIS_InteractiveContext
-//purpose :
-//=======================================================================
-
-AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer,
- const Handle(V3d_Viewer)& Collector):
-mgrSelector(new SelectMgr_SelectionManager()),
-myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
-myMainVwr(MainViewer),
-myMainSel(new StdSelect_ViewerSelector3d()),
-myCollectorPM(new PrsMgr_PresentationManager3d(Collector->Viewer())),
-myCollectorVwr(Collector),
-myCollectorSel(new StdSelect_ViewerSelector3d()),
-myIsCollClosed(Standard_False),
-myToHilightSelected( Standard_False ),
-myFilters(new SelectMgr_OrFilter()),
-myDefaultDrawer(new Prs3d_Drawer()),
-myDefaultColor(Quantity_NOC_GOLDENROD),
-myHilightColor(Quantity_NOC_CYAN1),
-mySelectionColor(Quantity_NOC_GRAY80),
-myPreselectionColor(Quantity_NOC_GREEN),
-mySubIntensity(Quantity_NOC_GRAY40),
-myDisplayMode(0),
-myCurLocalIndex(0),
-#ifdef IMP051001
-myZDetectionFlag(0),
-#endif
-myIsAutoActivateSelMode( Standard_True )
-{
- InitAttributes();
- mgrSelector->Add(myCollectorSel);
- SetPixelTolerance();
-}
-
void AIS_InteractiveContext::Delete() const
{
+ //Clear the static current selection. Else the memory
+ //is not release
+ AIS_Selection::ClearCurrentSelection();
#ifdef OCC172
// to avoid an exception
if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
// be performed when mgrSelector will be destroyed but anyway...
mgrSelector->Remove( myMainSel );
#endif
+ AIS_ListOfInteractive aList;
+
+ AIS_DataMapIteratorOfDataMapOfIOStatus anIt(myObjects);
+ Handle(AIS_InteractiveContext) aNullContext;
+ for(; anIt.More() ; anIt.Next())
+ {
+ Handle(AIS_InteractiveObject) anObj = anIt.Key();
+ anObj->SetContext(aNullContext);
+
+ }
MMgt_TShared::Delete();
}
myMainVwr->Update();
}
-void AIS_InteractiveContext::OpenCollector()
-{
- myIsCollClosed = Standard_False;
- // to be completed....
-}
-
-
//=======================================================================
//function : DomainOfMainViewer
ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Displayed, aListOfIO );
}
-//=======================================================================
-//function : UpdateCollector
-//purpose :
-//=======================================================================
-
-void AIS_InteractiveContext::UpdateCollector()
-{
- if (!myCollectorVwr.IsNull())
- myCollectorVwr->Update();
-}
-
-//=======================================================================
-//function : DomainOfCollector
-//purpose :
-//=======================================================================
-
-Standard_CString AIS_InteractiveContext::DomainOfCollector() const
-{
- if(myCollectorVwr.IsNull()) return "";
- return myCollectorVwr->Domain();
-}
-
-//=======================================================================
-//function : ObjectsInCollector
-//purpose :
-//=======================================================================
-
-void AIS_InteractiveContext::ObjectsInCollector(AIS_ListOfInteractive& aListOfIO) const
-{
- ObjectsByDisplayStatus( AIS_DS_Erased, aListOfIO );
-}
-
-//=======================================================================
-//function : ObjectsInCollector
-//purpose :
-//=======================================================================
-
-void AIS_InteractiveContext::ObjectsInCollector(const AIS_KindOfInteractive TheKind,
- const Standard_Integer TheSign,
- AIS_ListOfInteractive& aListOfIO) const
-{
- ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, aListOfIO );
-}
-
//=======================================================================
//function : ErasedObjects
//purpose :
void AIS_InteractiveContext::ErasedObjects(AIS_ListOfInteractive& theListOfIO) const
{
- ObjectsByDisplayStatus( AIS_DS_FullErased, theListOfIO );
+ ObjectsByDisplayStatus( AIS_DS_Erased, theListOfIO );
}
//=======================================================================
const Standard_Integer TheSign,
AIS_ListOfInteractive& theListOfIO) const
{
- ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_FullErased, theListOfIO );
+ ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, theListOfIO );
}
//=======================================================================
// SAN : Do not return here. Perform advanced display mode analysis a bit later...
if(IsDisplayed(anIObj)) return;
#endif
- Standard_Boolean updcol = Standard_False;
-
+
// it did not yet exist
if(!myObjects.IsBound(anIObj)){
// const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
// ENDCLE
- switch (STATUS->GraphicStatus()){
- case AIS_DS_Erased:{
- if(STATUS->IsHilighted())
- myCollectorPM->Unhighlight(anIObj,HiMod);
- myCollectorPM->Erase(anIObj,HiMod);
- mgrSelector->Deactivate(anIObj,myCollectorSel);
- updcol = updateviewer;
- }// attention the break is not set on purpose...
- case AIS_DS_FullErased:{
- TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
- for (;ItL.More();ItL.Next()){
- myMainPM->Display(anIObj,ItL.Value());
- if(STATUS->IsSubIntensityOn())
- myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
- }
- if( myIsAutoActivateSelMode )
- for (ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
- mgrSelector->Activate(anIObj,ItL.Value(),myMainSel);
- STATUS->SetGraphicStatus(AIS_DS_Displayed);
- if(STATUS->IsHilighted())
- myMainPM->Highlight(anIObj,HiMod);
- break;
- }
-#ifdef OCC4373
- // SAN : erase presentations for all display modes different from <DispMode>;
- // then make sure <DispMode> is displayed and maybe highlighted;
- // Finally, activate selection mode <SelMode> if not yet activated.
- case AIS_DS_Displayed:{
+ if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
+ {
+ // SAN : erase presentations for all display modes different from <DispMode>;
+ // then make sure <DispMode> is displayed and maybe highlighted;
+ // Finally, activate selection mode <SelMode> if not yet activated.
TColStd_ListOfInteger aModesToRemove;
TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
for(;ItL.More();ItL.Next()){
STATUS->AddDisplayMode(DispMode);
myMainPM->Display(anIObj,DispMode);
+ if (STATUS->GraphicStatus() == AIS_DS_Erased)
+ {
+ STATUS->SetGraphicStatus(AIS_DS_Displayed);
+ }
if(STATUS->IsHilighted()){
myMainPM->Highlight(anIObj,HiMod);
}
if(!mgrSelector->IsActivated(anIObj,SelMode))
mgrSelector->Activate(anIObj,SelMode,myMainSel);
}
-
- break;
- }
-#endif
- default:
- break;
}
}
if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
myMainVwr->Viewer()->SetTransparency(Standard_True);
if(updateviewer) myMainVwr->Update();
- if(updcol && !myCollectorVwr.IsNull()) myCollectorVwr->Update();
}
// LOCAL CONTEXT OPEN
GetDefModes(anIObj,DispMode,HiMod,SelModeDef);
Handle(AIS_GlobalStatus) STATUS=
- new AIS_GlobalStatus(AIS_DS_FullErased,DispMode,SelModeDef);
+ new AIS_GlobalStatus(AIS_DS_Erased,DispMode,SelModeDef);
myObjects.Bind (anIObj,STATUS);
return;
}
//=======================================================================
void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj,
- const Standard_Boolean updateviewer,
- const Standard_Boolean PutInCollector)
+ const Standard_Boolean updateviewer)
{
if(anIObj.IsNull()) return;
anIObj->ClearSelected();
if(!HasOpenedContext()){
- EraseGlobal(anIObj,updateviewer,PutInCollector);
+ EraseGlobal(anIObj,updateviewer);
}
else
{
}
if(!WasInCtx)
- EraseGlobal(anIObj,updateviewer,PutInCollector);
+ EraseGlobal(anIObj,updateviewer);
else
if(updateviewer) myMainVwr->Update();
}
}
-//=======================================================================
-//function : Erase
-//purpose :
-//=======================================================================
-
-void AIS_InteractiveContext::EraseMode(const Handle(AIS_InteractiveObject)& anIObj,
- const Standard_Integer aMode,
- const Standard_Boolean /*updateviewer*/)
-{
- if(anIObj.IsNull()) return;
-
- if(!myObjects.IsBound(anIObj)) return;
-
- if(anIObj->HasDisplayMode()){
- if(anIObj->DisplayMode()==aMode) return;
- }
- else if(myDisplayMode==aMode) return;
- // CLE
- // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
- Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
- // ENDCLE
- if(STATUS->GraphicStatus()!=AIS_DS_Displayed) return;
-
-
-// if(STATUS->IsDModeIn(aMode)) {}
-}
-
-
//=======================================================================
//function : EraseAll
//purpose :
//=======================================================================
-void AIS_InteractiveContext::EraseAll(const Standard_Boolean PutInCollector,
- const Standard_Boolean updateviewer)
+void AIS_InteractiveContext::EraseAll(const Standard_Boolean updateviewer)
{
- if(!HasOpenedContext()){
- AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects);
-
- for(;ItM.More();ItM.Next()){
+ if(!HasOpenedContext())
+ {
+ for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects); ItM.More(); ItM.Next())
+ {
if(ItM.Value()->GraphicStatus() == AIS_DS_Displayed)
- Erase(ItM.Key(),Standard_False,PutInCollector);
+ Erase(ItM.Key(),Standard_False);
}
- if(updateviewer){
+ if(updateviewer)
+ {
myMainVwr->Update();
- if (PutInCollector && !myCollectorVwr.IsNull())
- myCollectorVwr->Update();
}
}
-
}
//=======================================================================
//purpose :
//=======================================================================
-void AIS_InteractiveContext::DisplayAll(const Standard_Boolean OnlyFromCollector,
- const Standard_Boolean updateviewer)
+void AIS_InteractiveContext::DisplayAll(const Standard_Boolean updateviewer)
{
if(!HasOpenedContext()){
- Standard_Boolean FoundInCollector(Standard_False);
- AIS_DisplayStatus aDStatus = OnlyFromCollector ? AIS_DS_Erased : AIS_DS_FullErased,TheStatus;
- if(!HasOpenedContext()){
- AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects);
-
- for(;ItM.More();ItM.Next()){
- TheStatus = ItM.Value()->GraphicStatus();
- if(TheStatus == aDStatus)
+ AIS_DisplayStatus aStatus;
+
+ if (!HasOpenedContext())
+ {
+ for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM (myObjects); ItM.More(); ItM.Next())
+ {
+ aStatus = ItM.Value()->GraphicStatus();
+ if (aStatus == AIS_DS_Erased)
Display(ItM.Key(),Standard_False);
- if(TheStatus == AIS_DS_Erased)
- FoundInCollector = Standard_True;
}
- if(updateviewer){
+ if(updateviewer)
+ {
myMainVwr->Update();
- if(FoundInCollector && !myCollectorVwr.IsNull())
- myCollectorVwr->Update();
}
}
}
void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer)
{
- if(!HasOpenedContext()){
+ if (!HasOpenedContext())
+ {
Standard_Boolean found = Standard_False;
Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
Handle(AIS_InteractiveObject) iObj;
- for (sel->Init();sel->More();sel->Next()) {
+ for (sel->Init(); sel->More(); sel->Next())
+ {
iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
Display(iObj,Standard_False);
found = Standard_True;
}
- if(found && updateviewer) {
+ if (found && updateviewer)
+ {
myMainVwr->Update();
- if(!(myIsCollClosed && myCollectorVwr.IsNull()))
-
- myCollectorVwr->Update();
}
}
}
//purpose :
//=======================================================================
-void AIS_InteractiveContext::EraseSelected(const Standard_Boolean PutInCollector,
- const Standard_Boolean updateviewer)
+void AIS_InteractiveContext::EraseSelected(const Standard_Boolean updateviewer)
{
-
- if(!HasOpenedContext()){
+ if (!HasOpenedContext())
+ {
Standard_Boolean found = Standard_False;
Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
Handle(AIS_InteractiveObject) iObj;
- for(sel->Init();sel->More();sel->Next()) {
+ for (sel->Init();sel->More();sel->Next())
+ {
iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
- Erase(iObj,Standard_False,PutInCollector);
+ Erase(iObj,Standard_False);
found = Standard_True;
}
- if(found && updateviewer) {
+ if(found && updateviewer)
+ {
myMainVwr->Update();
- if(PutInCollector && !myCollectorVwr.IsNull())
- myCollectorVwr->Update();
}
}
}
if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
if (!HasOpenedContext())
- {
- if(!myObjects.IsBound(anIObj)) return;
+ {
+ if(!myObjects.IsBound(anIObj)) return;
- // CLE
- // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
- // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes();
- Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+ // CLE
+ // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+ // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes();
+ Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
- // ENDCLE
- STATUS->SetHilightStatus (Standard_True);
-
- switch(STATUS->GraphicStatus()){
- case AIS_DS_Displayed:
- {
- Standard_Integer DispMode,HiMode,SelMode;
- GetDefModes(anIObj,DispMode,HiMode,SelMode);
-// if(!STATUS->IsDModeIn(HiMode)){
-// myMainPM->Display(anIObj,HiMode);
-// }
- myMainPM->Highlight(anIObj,HiMode);
- if(updateviewer) myMainVwr->Update();
- break;
- }
- case AIS_DS_Erased:
- {
- Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
- myCollectorPM->Highlight(anIObj,HiMode);
- if(updateviewer) myCollectorVwr->Update();
- break;
- }
- default:
- break;
- }
+ // ENDCLE
+ STATUS->SetHilightStatus (Standard_True);
+
+ if (STATUS->GraphicStatus() == AIS_DS_Displayed)
+ {
+ Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
+ myMainPM->Highlight (anIObj, aHilightMode);
}
+ }
else
+ {
myLocalContexts(myCurLocalIndex)->Hilight(anIObj);
+ }
+
if(updateviewer) myMainVwr->Update();
}
//=======================================================================
if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
if (!HasOpenedContext())
- {
- if(!myObjects.IsBound(anIObj)) return;
+ {
+ if(!myObjects.IsBound(anIObj)) return;
- const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
- STATUS->SetHilightStatus (Standard_True);
-
- switch(STATUS->GraphicStatus()){
- case AIS_DS_Displayed:
- {
- Standard_Integer DispMode,HiMode,SelMode;
- GetDefModes(anIObj,DispMode,HiMode,SelMode);
-// if(!STATUS->IsDModeIn(HiMode)){
-// myMainPM->Display(anIObj,HiMode);
-// }
- myMainPM->Color(anIObj,aCol,HiMode);
- STATUS->SetHilightColor(aCol);
- if(updateviewer) myMainVwr->Update();
- break;
- }
- case AIS_DS_Erased:
- {
- Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
- myCollectorPM->Color(anIObj,aCol,HiMode);
- if(updateviewer) myCollectorVwr->Update();
- break;
- }
- default:
- break;
- }
+ const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+ STATUS->SetHilightStatus (Standard_True);
+
+ if (STATUS->GraphicStatus() == AIS_DS_Displayed)
+ {
+ Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
+ myMainPM->Color (anIObj, aCol, aHilightMode);
+ STATUS->SetHilightColor (aCol);
}
+ }
else
+ {
myLocalContexts(myCurLocalIndex)->Hilight(anIObj,aCol);
+ }
if(updateviewer) myMainVwr->Update();
}
if(anIObj.IsNull()) return;
if (!HasOpenedContext())
- {
- if(!myObjects.IsBound(anIObj)) return;
+ {
+ if(!myObjects.IsBound(anIObj)) return;
- const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
- STATUS->SetHilightStatus (Standard_False);
- STATUS->SetHilightColor(Quantity_NOC_WHITE);
-
- switch(STATUS->GraphicStatus()){
- case AIS_DS_Displayed:
- {
- Standard_Integer DispMode,HiMode,SelMode;
- GetDefModes(anIObj,DispMode,HiMode,SelMode);
- myMainPM->Unhighlight(anIObj,HiMode);
-// if(!STATUS->IsDModeIn(HiMode))
-// myMainPM->Erase(anIObj,HiMode);
- if(updateviewer) myMainVwr->Update();
- break;
- }
- case AIS_DS_Erased:
- {
- Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
- myCollectorPM->Unhighlight(anIObj,HiMode);
- if(updateviewer) myCollectorVwr->Update();
- break;
- }
- default:
- break;
- }
+ const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+ STATUS->SetHilightStatus (Standard_False);
+ STATUS->SetHilightColor(Quantity_NOC_WHITE);
+
+ if (STATUS->GraphicStatus() == AIS_DS_Displayed)
+ {
+ Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
+ myMainPM->Unhighlight (anIObj, aHilightMode);
}
+ }
else
+ {
myLocalContexts(myCurLocalIndex)->Unhilight(anIObj);
+ }
if(updateviewer) myMainVwr->Update();
}
return Standard_False;
}
-//=======================================================================
-//function : IsDisplayed
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_InteractiveContext::IsInCollector(const Handle(AIS_InteractiveObject)& anIObj) const
-{
- if(anIObj.IsNull()) return Standard_False;
-
-
- if(myObjects.IsBound(anIObj))
- return (myObjects(anIObj)->GraphicStatus()==AIS_DS_Erased);
- return Standard_False;
-}
-
//=======================================================================
//function : IsDisplayed
DisplayPriority(const Handle(AIS_InteractiveObject)& anIObj) const
{
if(anIObj.IsNull()) return -1;
- if(myObjects.IsBound(anIObj)){
- // CLE
- // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj);
+
+ if (myObjects.IsBound(anIObj))
+ {
Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
- // ENDCLE
- Standard_Integer DM,HM,SM ;
- GetDefModes(anIObj,DM,HM,SM);
- switch(STATUS->GraphicStatus()){
- case AIS_DS_Displayed:
- {
- return myMainPM->DisplayPriority(anIObj,DM);
- break;
- }
- case AIS_DS_Erased:
- return myCollectorPM->DisplayPriority(anIObj,HM);
- default:
- break;
+ if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
+ {
+ Standard_Integer aDispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() :
+ (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
+ return myMainPM->DisplayPriority (anIObj, aDispMode);
}
- return 0;
}
return 0;
}
return;
if(!anIObj->HasInteractiveContext())
anIObj->SetContext(this);
- if(myObjects.IsBound(anIObj)){
- // CLE
- // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj);
+ if(myObjects.IsBound(anIObj))
+ {
Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
- // ENDCLE
- Standard_Integer DM,HM,SM ;
- GetDefModes(anIObj,DM,HM,SM);
- switch(STATUS->GraphicStatus()){
- case AIS_DS_Displayed:
- {
- myMainPM->SetDisplayPriority(anIObj,DM,aPriority);
- break;
- }
- case AIS_DS_Erased:
- {
- myCollectorPM->SetDisplayPriority(anIObj,HM,aPriority);
- break;
- }
- default:
- break;
+
+ if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
+ {
+ Standard_Integer aDisplayMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() :
+ (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
+ myMainPM->SetDisplayPriority (anIObj, aDisplayMode, aPriority);
}
}
else if (HasOpenedContext())
- {myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);}
+ {
+ myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);
+ }
}
//=======================================================================
const Standard_Integer /*Sign*/,
const Standard_Boolean updateviewer)
{
- Standard_Boolean found_viewer(Standard_False),found_coll(Standard_False);
+ Standard_Boolean found_viewer(Standard_False);
// update
for(AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);It.More();It.Next()){
// CLE
// ((IO->Signature()==Sign)? Standard_True:Standard_False);
#endif
Redisplay(IO,Standard_False);
- switch(It.Value()->GraphicStatus()){
- case AIS_DS_Displayed:
+ if (It.Value()->GraphicStatus() == AIS_DS_Displayed)
+ {
found_viewer = Standard_True;
- break;
- case AIS_DS_Erased:
- found_coll = Standard_True;
- break;
- default:
- break;
}
}
}
// update viewer...
- if(updateviewer){
- if(found_viewer)
- myMainVwr->Update();
- if(found_coll)
- myCollectorVwr->Update();
+ if(updateviewer && found_viewer)
+ {
+ myMainVwr->Update();
}
}
{
if(anIObj.IsNull()) return;
anIObj->Update(allmodes);
-
- if(updateviewer) {
- if(HasOpenedContext())
- myMainVwr->Update();
- else{
- if(myObjects.IsBound(anIObj)){
- switch(myObjects(anIObj)->GraphicStatus()){
- case AIS_DS_Displayed:
- myMainVwr->Update();
- break;
- case AIS_DS_Erased:
- {
- if(!myCollectorVwr.IsNull())
- myCollectorVwr->Update();
- }
- default:
- break;
- }
- }
- }
+
+ if (!updateviewer)
+ {
+ return;
+ }
+
+ if (HasOpenedContext() ||
+ (myObjects.IsBound(anIObj) && myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed))
+ {
+ myMainVwr->Update();
}
}
//=======================================================================
ActivatedModes(anIObj,LI);
if(!HasOpenedContext()){
if(!myObjects.IsBound(anIObj)) return;
- switch(myObjects(anIObj)->GraphicStatus())
+
+ if (myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
+ {
+ for(Lit.Initialize(LI);Lit.More();Lit.Next())
{
- case AIS_DS_Displayed:
- {
- for(Lit.Initialize(LI);Lit.More();Lit.Next())
- mgrSelector->Activate(anIObj,Lit.Value(),myMainSel);
- break;
- }
- case AIS_DS_Erased:
- {
- for(Lit.Initialize(LI);Lit.More();Lit.Next())
- mgrSelector->Activate(anIObj,Lit.Value(),myCollectorSel);
-
- break;
- }
- default:
- break;
+ mgrSelector->Activate(anIObj,Lit.Value(),myMainSel);
}
+ }
}
}
case AIS_DS_Temporary:
myMainVwr->Update();
break;
- case AIS_DS_Erased:
- myCollectorVwr->Update();
- break;
default:
break;
}
STATUS->AddDisplayMode(aMode);
if(STATUS->GraphicStatus()== AIS_DS_Displayed){
- myMainPM->Erase(anObj, myDisplayMode);
+ myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
myMainPM->Display(anObj, aMode);
if(STATUS->IsSubIntensityOn())
myMainPM->Color(anObj,mySubIntensity,aMode);
if(!myObjects.IsBound(anIObj))
anIObj->SetDisplayMode(aMode);
-#ifdef BUC60632
else if( anIObj->AcceptDisplayMode(aMode) )
-#else
- else
-#endif
{
// CLE
// const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
// ENDCLE
-#ifndef OCC4373
- // the interactive object has no mode : OldMode = Mode Session
- // already has a mode : OldMode = old mode Propre
-
- Standard_Integer OldMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode(): myDisplayMode;
-
- if(STATUS->IsDModeIn(OldMode))
- STATUS->RemoveDisplayMode(OldMode);
- STATUS->AddDisplayMode(aMode);
-
- if(STATUS->GraphicStatus()==AIS_DS_Displayed){
- if(aMode!=OldMode ){
- if(myMainPM->IsHighlighted(anIObj,OldMode))
- myMainPM->Unhighlight(anIObj,OldMode);
-
- myMainPM->Erase(anIObj,OldMode);
-#else
// SAN : erase presentations for all display modes different from <aMode>
if(STATUS->GraphicStatus()==AIS_DS_Displayed){
TColStd_ListOfInteger aModesToRemove;
aModesToRemove.Append(OldMode);
if(myMainPM->IsHighlighted(anIObj,OldMode))
myMainPM->Unhighlight(anIObj,OldMode);
- myMainPM->Erase(anIObj,OldMode);
+ myMainPM->SetVisibility (anIObj, OldMode, Standard_False);
}
}
if(!STATUS->IsDModeIn(aMode))
STATUS->AddDisplayMode(aMode);
-#endif
-
+
myMainPM->Display(anIObj,aMode);
Standard_Integer DM,HM,SM;
GetDefModes(anIObj,DM,HM,SM);
myMainVwr->Viewer()->SetTransparency(Standard_True);
if(updateviewer) myMainVwr->Update();
-#ifndef OCC4373
- }
-#endif
}
anIObj->SetDisplayMode(aMode);
}
if(STATUS->GraphicStatus()==AIS_DS_Displayed){
if(myMainPM->IsHighlighted(anIObj,OldMode))
myMainPM->Unhighlight(anIObj,OldMode);
- myMainPM->Erase(anIObj,OldMode);
+ myMainPM->SetVisibility (anIObj, OldMode, Standard_False);
myMainPM->Display(anIObj,myDisplayMode);
Standard_Integer DM,HM,SM;
GetDefModes(anIObj,DM,HM,SM);
UpdateCurrentViewer();
}
-//=======================================================================
-//function : SetDegenerateModel
-//purpose :
-//=======================================================================
-
-#ifdef G003
-void AIS_InteractiveContext :: SetDegenerateModel (
- const Handle( AIS_InteractiveObject )& anObject,
- const Aspect_TypeOfDegenerateModel aModel,
- const Quantity_Ratio aRatio
- ) {
- if ( !anObject.IsNull () ) {
- if ( !anObject -> HasInteractiveContext () )
- anObject -> SetContext ( this );
- anObject->SetDegenerateModel(aModel,aRatio);
-
- } // end if
-} // end AIS_InteractiveContext :: SetDegenerateModel
-
-void AIS_InteractiveContext :: SetDegenerateModel (
- const Aspect_TypeOfDegenerateModel aModel,
- const Quantity_Ratio aRatio
- ) {
-
- AIS_DataMapIteratorOfDataMapOfIOStatus it ( myObjects );
-
- while ( it.More () ) {
-
- Handle( AIS_InteractiveObject ) obj = it.Key ();
-
- obj->SetDegenerateModel(aModel,aRatio);
-
- it.Next ();
-
- } // end while
-
-} // end AIS_InteractiveContext :: SetDegenerateModel
-#endif
-
//=======================================================================
//function : SetSelectedAspect
//purpose :
}
if( found && updateViewer) {
myMainVwr->Update();
- if( !(myIsCollClosed && myCollectorVwr.IsNull()) )
- myCollectorVwr->Update();
}
}
}
astatus +="\t| -->Erased\n";
break;
}
- case AIS_DS_FullErased:
- {
- astatus +="\t| -->Full Erased\n";
- break;
- }
default:
break;
}
//=======================================================================
void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& anIObj,
- const Standard_Boolean updateviewer,
- const Standard_Boolean PutInCollector)
+ const Standard_Boolean updateviewer)
{
if(anIObj.IsNull()) return ;
if(!myObjects.IsBound(anIObj)) return;
for(;ItL.More();ItL.Next()){
if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
myMainPM->Unhighlight(anIObj,ItL.Value());
- myMainPM->Erase(anIObj,ItL.Value());
+ myMainPM->SetVisibility (anIObj, ItL.Value(), Standard_False);
}
if(IsCurrent(anIObj) && !STATUS->IsDModeIn(Dmode))
- myMainPM->Erase(anIObj,Dmode);
+ myMainPM->SetVisibility (anIObj, Dmode, Standard_False);
for(ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
if(updateviewer) myMainVwr->Update();
}
- if(PutInCollector && !myCollectorPM.IsNull()){
- myCollectorPM->Display(anIObj,Dmode);
-#ifdef OCC328
- Standard_Integer SMode = anIObj->SelectionMode();
- mgrSelector->Activate(anIObj,SMode,myCollectorSel);
-#else
- mgrSelector->Activate(anIObj,0,myCollectorSel);
-#endif
- if(STATUS->IsHilighted())
- myCollectorPM->Highlight(anIObj,Dmode);
- STATUS->SetGraphicStatus(AIS_DS_Erased);
- if(updateviewer) myCollectorVwr->Update();
- }
- else
- STATUS->SetGraphicStatus(AIS_DS_FullErased);
+ STATUS->SetGraphicStatus(AIS_DS_Erased);
}
if(myLastinMain == anIObj)
myLastinMain.Nullify();
- if(myLastinColl == anIObj)
- myLastinColl.Nullify();
if(myLastPicked == anIObj)
myLastPicked.Nullify();
// to avoid memory leaks
mgrSelector->Remove(anIObj);
- switch(STATUS->GraphicStatus()){
- case AIS_DS_Erased:
- {
- Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
- if(STATUS->IsHilighted()){
- myCollectorPM->Unhighlight(anIObj,DM);
- }
- myCollectorPM->Erase(anIObj,DM);
- myCollectorPM->Clear(anIObj,DM);
- if(updateviewer) myCollectorVwr->Update();
- break;
- }
- case AIS_DS_Displayed:
- {
- if(updateviewer) myMainVwr->Update();
- break;
- }
- default:
- break;
- }
+ if (updateviewer && (STATUS->GraphicStatus() == AIS_DS_Displayed))
+ {
+ myMainVwr->Update();
+ }
+
myObjects.UnBind(anIObj);
}
myMainPM->Clear(anIObj,aMode);
}
- if(STATUS->GraphicStatus()== AIS_DS_Erased)
- {
- if(DM==aMode){
- if(STATUS->IsHilighted())
- myCollectorPM->Unhighlight(anIObj,aMode);
- myCollectorPM->Erase(anIObj,DM);
- myCollectorPM->Clear(anIObj,DM);
- }
- if(updateviewer) myCollectorVwr->Update();
- }
- else if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer)
+
+ if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer)
myMainVwr->Update();
}
myLocalContexts(myCurLocalIndex)->SetSensitivityMode(aMode);
else {
myMainSel->SetSensitivityMode(aMode);
- if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivityMode(aMode);
}
}
myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
else {
myMainSel->SetSensitivity(aPrecision);
- if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivity(aPrecision);
}
}
myLocalContexts(myCurLocalIndex)->SetPixelTolerance(aPrecision);
else {
myMainSel->SetPixelTolerance(aPrecision);
- if( !myCollectorSel.IsNull() ) myCollectorSel->SetPixelTolerance(aPrecision);
}
}
if (myObjects.IsBound (theIObj))
{
- switch (myObjects (theIObj)->GraphicStatus ())
+ if (myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed || myObjects (theIObj)->GraphicStatus() == AIS_DS_Erased)
{
- case AIS_DS_Displayed:
- {
- theIObj->SetZLayer (myMainPM, theLayerId);
- break;
- }
- case AIS_DS_Erased:
- {
- theIObj->SetZLayer (myCollectorPM, theLayerId);
- break;
- }
- default:
- break;
+ theIObj->SetZLayer (myMainPM, theLayerId);
}
}
else if (HasOpenedContext ())