-// File: AIS_InteractiveContext.cxx
-// Created: Fri Jan 17 13:36:48 1997
-// Author: Robert COUBLANC
+// Created on: 1997-01-17
+// Created by: Robert COUBLANC
+// Copyright (c) 1997-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.
+
// Modified by XAB & Serguei Dec 97 (angle &deviation coeffts)
-// <rob@robox.paris1.matra-dtv.fr>
#define BUC60577 //GG_101099 Enable to compute correctly
// transparency with more than one object in the view.
-#define GER61351 //GG_171199 Enable to set an object RGB color
-// instead a restricted object NameOfColor.
-
-#define G003 //EUG_26/01/00 Degenerate support (G003)
-
-#define IMP140200 //GG Add SetSelectedAspect() method.
-
#define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode()
// method, compute only authorized presentation.
#define OCC172 //SAV clear static map before destroying context.
#define OCC204 //SAV 26/02/02 : pass <updateviewer> flag to
- // AddOrRemoveCurrentObject method from ClearGlobal.
+// AddOrRemoveCurrentObject method from ClearGlobal.
#define OCC4373 //SAN 10/11/03 : improve display mode management in
- // Display( IO, updateviewer ) and
- // SetDisplayMode( IO, mode, updateviewer ) methods
+// Display( IO, updateviewer ) and
+// SetDisplayMode( IO, mode, updateviewer ) methods
#include <AIS_InteractiveContext.ixx>
// in spite of the selection mode of the interactive object in Natural Point.
#define OCC166
-// An interactive Object being erased in the main viewer and put into collector should have the same selection mode.
-// It impacts the performance!
-#define OCC328
-
static Standard_Boolean AISDebugModeOn()
{
// static OSD_Environment aisdb("AISDEBUGMODE");
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);
-#ifdef BUC60688
- SetSensitivity();
-#else
- myCollectorSel->Set(4);
-#endif
-
-}
-
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_True;
- // to be completed....
-}
-
-
//=======================================================================
//function : DomainOfMainViewer
#endif
//parse all local contexts...
+#ifdef DEBUG
Standard_Integer NbDisp;
for(AIS_DataMapIteratorOfDataMapOfILC it1(myLocalContexts);it1.More();it1.Next()){
const Handle(AIS_LocalContext)& LC = it1.Value();
NbDisp = LC->DisplayedObjects(theMap);
-#ifdef DEBUG
cout<<"\tIn Local Context "<<it1.Key()<<" : "<<NbDisp<<endl;
-#endif
-
}
+#endif
Handle(AIS_InteractiveObject) curIO;
Handle(Standard_Transient) Tr;
for(TColStd_MapIteratorOfMapOfTransient it2(theMap);it2.More();it2.Next()){
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();
}
}
}
}
else
{
- Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
+ myLocalContexts(myCurLocalIndex)->Remove(anIObj);
AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
for (;It.More() ;It.Next()){
if(It.Value()->AcceptErase())
- WasInCtx = It.Value()->Remove(anIObj);
+ It.Value()->Remove(anIObj);
}
// if(!WasInCtx)
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);
}
+ }
}
}
//function : Update
//purpose :
//=======================================================================
-
-void AIS_InteractiveContext::Update(const Handle(AIS_InteractiveObject)& anIObj,
- const Standard_Boolean updateviewer)
+void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIObj,
+ const Standard_Boolean theUpdateViewer)
{
- if(anIObj.IsNull()) return;
+ if (theIObj.IsNull())
+ {
+ return;
+ }
-
+ TColStd_ListOfInteger aListOfFlaggedPrsModes;
+ theIObj->ToBeUpdated (aListOfFlaggedPrsModes);
- TColStd_ListOfInteger LL;
- anIObj->ToBeUpdated(LL);
- TColStd_ListIteratorOfListOfInteger ITI(LL);
- Standard_Boolean wasupdated(Standard_False);
-
- for (;ITI.More();ITI.Next()){
- anIObj->Update(ITI.Value(),Standard_False);
- wasupdated = Standard_True;
+ TColStd_ListIteratorOfListOfInteger aPrsModesIt (aListOfFlaggedPrsModes);
+ for ( ; aPrsModesIt.More(); aPrsModesIt.Next())
+ {
+ theIObj->Update (aPrsModesIt.Value(), Standard_False);
}
-
- if(wasupdated)
- mgrSelector->Update(anIObj);
-
- if(updateviewer){
- if(!myObjects.IsBound(anIObj)) return;
- switch(myObjects(anIObj)->GraphicStatus()){
- case AIS_DS_Displayed:
- case AIS_DS_Temporary:
- myMainVwr->Update();
- break;
- case AIS_DS_Erased:
- myCollectorVwr->Update();
- break;
- default:
- break;
+
+ mgrSelector->Update(theIObj);
+
+ if (theUpdateViewer)
+ {
+ if (!myObjects.IsBound (theIObj))
+ {
+ return;
+ }
+
+ switch (myObjects (theIObj)->GraphicStatus())
+ {
+ case AIS_DS_Displayed:
+ case AIS_DS_Temporary:
+ myMainVwr->Update();
+ break;
+ default:
+ break;
}
}
}
-
-
//=======================================================================
//function : SetLocation
//purpose :
Standard_Real AIS_InteractiveContext::DeviationAngle() const
{
- return M_PI/180.0e0 ;
- // return myDefaultDrawer->DeviationAngle();
+ //return M_PI/180.0e0 ;
+ return myDefaultDrawer->DeviationAngle();
}
//=======================================================================
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);
//purpose :
//=======================================================================
-#ifdef GER61351
void AIS_InteractiveContext::SetCurrentFacingModel(
const Handle(AIS_InteractiveObject)& anIObj,
- const Aspect_TypeOfFacingModel aModel) {
- if ( !anIObj.IsNull () ) {
- anIObj->SetCurrentFacingModel(aModel);
- }
+ const Aspect_TypeOfFacingModel aModel)
+{
+ if ( !anIObj.IsNull () )
+ anIObj->SetCurrentFacingModel(aModel);
}
-#endif
//=======================================================================
//function : SetColor
void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
const Quantity_NameOfColor aColor,
const Standard_Boolean updateviewer)
-#ifdef GER61351
{
SetColor(anIObj,Quantity_Color(aColor),updateviewer);
}
void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
const Quantity_Color &aColor,
const Standard_Boolean updateviewer)
-#endif
{
if(anIObj.IsNull()) return ;
return anIObj->Color();
}
-#ifdef GER61351
void AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj,
- Quantity_Color &aColor) const
+ Quantity_Color &aColor) const
{
anIObj->Color(aColor);
}
-#endif
//=======================================================================
//function : Width
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
-
-#ifdef IMP140200
//=======================================================================
//function : SetSelectedAspect
//purpose :
void AIS_InteractiveContext::SetSelectedAspect(
const Handle(Prs3d_BasicAspect)& anAspect,
const Standard_Boolean globalChange,
- const Standard_Boolean updateViewer) {
+ const Standard_Boolean updateViewer)
+{
if( !HasOpenedContext() ) {
Standard_Boolean found = Standard_False;
Handle(AIS_Selection) sel =
}
if( found && updateViewer) {
myMainVwr->Update();
- if( !(myIsCollClosed && myCollectorVwr.IsNull()) )
- myCollectorVwr->Update();
}
}
}
-#endif
//=======================================================================
//function : SetLocalAttributes
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();
}
{
}
-#ifdef BUC60688
+//=======================================================================
+//function : SetSensitivityMode
+//purpose :
+//=======================================================================
+
+void AIS_InteractiveContext::SetSensitivityMode(const StdSelect_SensitivityMode aMode) {
+
+ if( HasOpenedContext() )
+ myLocalContexts(myCurLocalIndex)->SetSensitivityMode(aMode);
+ else {
+ myMainSel->SetSensitivityMode(aMode);
+ }
+}
+
+//=======================================================================
+//function : SensitivityMode
+//purpose :
+//=======================================================================
+
+StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const {
+
+ if( HasOpenedContext() )
+ return myLocalContexts(myCurLocalIndex)->SensitivityMode();
+ return myMainSel->SensitivityMode();
+}
+
//=======================================================================
//function : SetSensitivity
//purpose :
myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
else {
myMainSel->SetSensitivity(aPrecision);
- if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivity(aPrecision);
}
}
//=======================================================================
-//function : SetSensitivity
+//function : Sensitivity
//purpose :
//=======================================================================
-void AIS_InteractiveContext::SetSensitivity(const Standard_Integer aPrecision) {
+Standard_Real AIS_InteractiveContext::Sensitivity() const {
if( HasOpenedContext() )
- myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
+ return myLocalContexts(myCurLocalIndex)->Sensitivity();
+ return myMainSel->Sensitivity();
+}
+
+//=======================================================================
+//function : SetPixelTolerance
+//purpose :
+//=======================================================================
+
+void AIS_InteractiveContext::SetPixelTolerance(const Standard_Integer aPrecision) {
+
+ if( HasOpenedContext() )
+ myLocalContexts(myCurLocalIndex)->SetPixelTolerance(aPrecision);
else {
- myMainSel->Set(aPrecision);
- if( !myCollectorSel.IsNull() ) myCollectorSel->Set(aPrecision);
+ myMainSel->SetPixelTolerance(aPrecision);
}
}
-#endif
+
+//=======================================================================
+//function : PixelTolerance
+//purpose :
+//=======================================================================
+
+Standard_Integer AIS_InteractiveContext::PixelTolerance() const {
+
+ if( HasOpenedContext() )
+ return myLocalContexts(myCurLocalIndex)->PixelTolerance();
+ return myMainSel->PixelTolerance();
+}
//=======================================================================
//function : IsInLocal
HLA->SetTypeOfLine(Aspect_TOL_DASH);
// tolerance to 4 pixels...
-#ifdef BUC60688
- SetSensitivity();
-#else
- myMainSel->Set(4);
-#endif
+ SetPixelTolerance();
// Customizing the drawer for trihedrons and planes...
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 ())
return -1;
if (myObjects.IsBound (theIObj))
+ {
return theIObj->GetZLayer (myMainPM);
+ }
+ else if (HasOpenedContext ())
+ {
+ return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
+ }
- return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
+ return -1;
}