1 // File: AIS_InteractiveContext.cxx
2 // Created: Fri Jan 17 13:36:48 1997
3 // Author: Robert COUBLANC
4 // Modified by XAB & Serguei Dec 97 (angle &deviation coeffts)
5 // <rob@robox.paris1.matra-dtv.fr>
7 #define BUC60577 //GG_101099 Enable to compute correctly
8 // transparency with more than one object in the view.
10 #define GER61351 //GG_171199 Enable to set an object RGB color
11 // instead a restricted object NameOfColor.
13 #define G003 //EUG_26/01/00 Degenerate support (G003)
15 #define IMP140200 //GG Add SetSelectedAspect() method.
17 #define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode()
18 // method, compute only authorized presentation.
20 #define BUC60688 //GG 25/05/00 Add SetSensitivity() methods.
22 #define BUC60722 //GG 04/09/00 Always enable viewer update when erasing something
24 #define IMP051001 //GG Adds SetZDetected() and ZDetected() methods
26 #define OCC172 //SAV clear static map before destroying context.
28 #define OCC204 //SAV 26/02/02 : pass <updateviewer> flag to
29 // AddOrRemoveCurrentObject method from ClearGlobal.
31 #define OCC4373 //SAN 10/11/03 : improve display mode management in
32 // Display( IO, updateviewer ) and
33 // SetDisplayMode( IO, mode, updateviewer ) methods
35 #include <AIS_InteractiveContext.ixx>
37 //#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
38 #include <TColStd_ListIteratorOfListOfInteger.hxx>
39 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
40 #include <AIS_LocalContext.hxx>
41 #include <AIS_LocalStatus.hxx>
42 #include <Precision.hxx>
43 #include <AIS_Selection.hxx>
44 #include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
45 #include <AIS_ConnectedShape.hxx>
46 #include <AIS_MultipleConnectedShape.hxx>
47 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
48 #include <AIS_GlobalStatus.hxx>
49 #include <AIS_MapIteratorOfMapOfInteractive.hxx>
50 #include <PrsMgr_ModedPresentation.hxx>
51 #include <Visual3d_ViewManager.hxx>
52 #include <Prs3d_ShadingAspect.hxx>
53 #include <AIS_Shape.hxx>
54 #include <Graphic3d_AspectFillArea3d.hxx>
55 #include <HLRBRep.hxx>
56 #include <Prs3d_IsoAspect.hxx>
57 #include <Prs3d_DatumAspect.hxx>
58 #include <Prs3d_PlaneAspect.hxx>
59 #include <PrsMgr_PresentableObject.hxx>
60 #include <Standard_Atomic.hxx>
61 #include <UnitsAPI.hxx>
63 #include <AIS_Trihedron.hxx>
64 #include <Geom_Axis2Placement.hxx>
65 #include <OSD_Environment.hxx>
67 #include <AIS_ListIteratorOfListOfInteractive.hxx>
69 // In the method GetDefModes() the returned value of the selection mode
70 // is always equal to 0 if it is -1.
73 // The local context is closed the method ::ResetOriginalState() sets the selection mode equal to 0
74 // in spite of the selection mode of the interactive object in Natural Point.
77 // An interactive Object being erased in the main viewer and put into collector should have the same selection mode.
78 // It impacts the performance!
81 static Standard_Boolean AISDebugModeOn()
83 // static OSD_Environment aisdb("AISDEBUGMODE");
84 // return !aisdb.Value().IsEmpty();
85 static Standard_Integer isDebugMode(-1);
86 if (isDebugMode < 0) {
88 OSD_Environment aisdb("AISDEBUGMODE");
89 if (aisdb.Value().IsEmpty())
92 return (isDebugMode != 0);
97 static volatile Standard_Integer THE_AIS_INDEX_SEL = 0;
98 static volatile Standard_Integer THE_AIS_INDEX_CUR = 0;
100 static TCollection_AsciiString AIS_Context_NewSelName()
102 return TCollection_AsciiString ("AIS_SelContext_")
103 + TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_SEL));
106 static TCollection_AsciiString AIS_Context_NewCurName()
108 return TCollection_AsciiString ("AIS_CurContext_")
109 + TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_CUR));
113 //=======================================================================
114 //function : AIS_InteractiveContext
116 //=======================================================================
118 AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer):
119 mgrSelector(new SelectMgr_SelectionManager()),
120 myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
121 myMainVwr(MainViewer),
122 myMainSel(new StdSelect_ViewerSelector3d()),
123 myIsCollClosed(Standard_True),
124 myToHilightSelected( Standard_False ),
125 myFilters(new SelectMgr_OrFilter()),
126 myDefaultDrawer(new Prs3d_Drawer()),
127 myDefaultColor(Quantity_NOC_GOLDENROD),
128 myHilightColor(Quantity_NOC_CYAN1),
129 mySelectionColor(Quantity_NOC_GRAY80),
130 myPreselectionColor(Quantity_NOC_GREEN),
131 mySubIntensity(Quantity_NOC_GRAY40),
137 myIsAutoActivateSelMode( Standard_True )
143 //=======================================================================
144 //function : AIS_InteractiveContext
146 //=======================================================================
148 AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer,
149 const Handle(V3d_Viewer)& Collector):
150 mgrSelector(new SelectMgr_SelectionManager()),
151 myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
152 myMainVwr(MainViewer),
153 myMainSel(new StdSelect_ViewerSelector3d()),
154 myCollectorPM(new PrsMgr_PresentationManager3d(Collector->Viewer())),
155 myCollectorVwr(Collector),
156 myCollectorSel(new StdSelect_ViewerSelector3d()),
157 myIsCollClosed(Standard_False),
158 myToHilightSelected( Standard_False ),
159 myFilters(new SelectMgr_OrFilter()),
160 myDefaultDrawer(new Prs3d_Drawer()),
161 myDefaultColor(Quantity_NOC_GOLDENROD),
162 myHilightColor(Quantity_NOC_CYAN1),
163 mySelectionColor(Quantity_NOC_GRAY80),
164 myPreselectionColor(Quantity_NOC_GREEN),
165 mySubIntensity(Quantity_NOC_GRAY40),
171 myIsAutoActivateSelMode( Standard_True )
174 mgrSelector->Add(myCollectorSel);
178 myCollectorSel->Set(4);
183 void AIS_InteractiveContext::Delete() const
186 // to avoid an exception
187 if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
188 AIS_Selection::Remove( mySelectionName.ToCString() );
190 // to avoid an exception
191 if ( AIS_Selection::Find( myCurrentName.ToCString() ) )
192 AIS_Selection::Remove( myCurrentName.ToCString() );
194 // let's remove one reference explicitly. this operation's supposed to
195 // be performed when mgrSelector will be destroyed but anyway...
196 mgrSelector->Remove( myMainSel );
198 MMgt_TShared::Delete();
201 //=======================================================================
202 //function : AIS_SelectionName
204 //=======================================================================
205 const TCollection_AsciiString& AIS_InteractiveContext::SelectionName() const
207 if(!HasOpenedContext())
208 return mySelectionName;
209 return myLocalContexts(myCurLocalIndex)->SelectionName();
215 //=======================================================================
216 //function : UpdateCurrentViewer
218 //=======================================================================
220 void AIS_InteractiveContext::UpdateCurrentViewer()
222 if (!myMainVwr.IsNull())
226 void AIS_InteractiveContext::OpenCollector()
228 myIsCollClosed =Standard_True;
229 // to be completed....
234 //=======================================================================
235 //function : DomainOfMainViewer
237 //=======================================================================
239 Standard_CString AIS_InteractiveContext::DomainOfMainViewer() const
241 return myMainVwr->Domain();
245 //=======================================================================
246 //function : DisplayedObjects
248 //=======================================================================
250 void AIS_InteractiveContext::DisplayedObjects(AIS_ListOfInteractive& aListOfIO,
251 const Standard_Boolean OnlyFromNeutral) const
254 cout<<"AIS_IC::DisplayedObjects"<<endl;
257 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
258 if(!HasOpenedContext() || OnlyFromNeutral){
259 for(;It.More();It.Next()){
260 if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
261 aListOfIO.Append(It.Key());
265 TColStd_MapOfTransient theMap;
267 for(;It.More();It.Next()){
268 if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
269 theMap.Add(It.Key());
272 cout<<"\tFrom Neutral Point : "<<theMap.Extent()<<endl;
275 //parse all local contexts...
276 Standard_Integer NbDisp;
277 for(AIS_DataMapIteratorOfDataMapOfILC it1(myLocalContexts);it1.More();it1.Next()){
278 const Handle(AIS_LocalContext)& LC = it1.Value();
279 NbDisp = LC->DisplayedObjects(theMap);
281 cout<<"\tIn Local Context "<<it1.Key()<<" : "<<NbDisp<<endl;
285 Handle(AIS_InteractiveObject) curIO;
286 Handle(Standard_Transient) Tr;
287 for(TColStd_MapIteratorOfMapOfTransient it2(theMap);it2.More();it2.Next()){
289 curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
290 aListOfIO.Append(curIO);
294 //=======================================================================
295 //function : DisplayedObjects
297 //=======================================================================
299 void AIS_InteractiveContext::DisplayedObjects(const AIS_KindOfInteractive TheKind,
300 const Standard_Integer TheSign,
301 AIS_ListOfInteractive& aListOfIO,
302 const Standard_Boolean /*OnlyFromNeutral*/) const
304 ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Displayed, aListOfIO );
307 //=======================================================================
308 //function : UpdateCollector
310 //=======================================================================
312 void AIS_InteractiveContext::UpdateCollector()
314 if (!myCollectorVwr.IsNull())
315 myCollectorVwr->Update();
318 //=======================================================================
319 //function : DomainOfCollector
321 //=======================================================================
323 Standard_CString AIS_InteractiveContext::DomainOfCollector() const
325 if(myCollectorVwr.IsNull()) return "";
326 return myCollectorVwr->Domain();
329 //=======================================================================
330 //function : ObjectsInCollector
332 //=======================================================================
334 void AIS_InteractiveContext::ObjectsInCollector(AIS_ListOfInteractive& aListOfIO) const
336 ObjectsByDisplayStatus( AIS_DS_Erased, aListOfIO );
339 //=======================================================================
340 //function : ObjectsInCollector
342 //=======================================================================
344 void AIS_InteractiveContext::ObjectsInCollector(const AIS_KindOfInteractive TheKind,
345 const Standard_Integer TheSign,
346 AIS_ListOfInteractive& aListOfIO) const
348 ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, aListOfIO );
351 //=======================================================================
352 //function : ErasedObjects
354 //=======================================================================
356 void AIS_InteractiveContext::ErasedObjects(AIS_ListOfInteractive& theListOfIO) const
358 ObjectsByDisplayStatus( AIS_DS_FullErased, theListOfIO );
361 //=======================================================================
362 //function : ErasedObjects
364 //=======================================================================
366 void AIS_InteractiveContext::ErasedObjects(const AIS_KindOfInteractive TheKind,
367 const Standard_Integer TheSign,
368 AIS_ListOfInteractive& theListOfIO) const
370 ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_FullErased, theListOfIO );
373 //=======================================================================
374 //function : ObjectsByDisplayStatus
376 //=======================================================================
378 void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_DisplayStatus theStatus,
379 AIS_ListOfInteractive& theListOfIO) const
381 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
382 for(;It.More();It.Next()){
383 if(It.Value()->GraphicStatus() == theStatus)
384 theListOfIO.Append(It.Key());
388 //=======================================================================
389 //function : ObjectsByDisplayStatus
391 //=======================================================================
393 void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_KindOfInteractive TheKind,
394 const Standard_Integer TheSign,
395 const AIS_DisplayStatus theStatus,
396 AIS_ListOfInteractive& theListOfIO) const
398 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
399 for(;It.More();It.Next()){
400 if(It.Value()->GraphicStatus()==theStatus){
401 if(It.Key()->Type()==TheKind){
403 theListOfIO.Append(It.Key());
405 if(It.Key()->Signature()==TheSign)
406 theListOfIO.Append(It.Key());
413 //=======================================================================
414 //function : ObjectsInside
416 //=======================================================================
418 void AIS_InteractiveContext::ObjectsInside(AIS_ListOfInteractive& aListOfIO,
419 const AIS_KindOfInteractive TheKind,
420 const Standard_Integer TheSign) const
422 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
423 if(TheKind==AIS_KOI_None && TheSign ==-1){
424 for(;It.More();It.Next()){
425 aListOfIO.Append(It.Key());
429 for(;It.More();It.Next()){
430 if(It.Key()->Type()==TheKind){
432 aListOfIO.Append(It.Key());
434 if(It.Key()->Signature()==TheSign)
435 aListOfIO.Append(It.Key());
442 //=======================================================================
445 //=======================================================================
447 void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
448 const Standard_Boolean updateviewer )
450 if(anIObj.IsNull()) return;
452 Standard_Integer DispMode,HiMod,SelMode;
454 GetDefModes(anIObj,DispMode,HiMod,SelMode);
456 Handle (AIS_InteractiveContext) aThis = this;
457 if(!anIObj->HasInteractiveContext())
458 anIObj->SetContext(aThis);
460 //NO LOCAL CONTEXT OPEN
461 if(!HasOpenedContext()) {
463 // SAN : Do not return here. Perform advanced display mode analysis a bit later...
464 if(IsDisplayed(anIObj)) return;
466 Standard_Boolean updcol = Standard_False;
468 // it did not yet exist
469 if(!myObjects.IsBound(anIObj)){
471 Handle(AIS_GlobalStatus) STATUS=
473 new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,SelMode);
475 new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,0);
477 myObjects.Bind (anIObj,STATUS);
478 myMainPM->Display(anIObj,DispMode);
479 if( myIsAutoActivateSelMode )
481 if(!mgrSelector->Contains(anIObj))
482 mgrSelector->Load(anIObj);
483 mgrSelector->Activate(anIObj,SelMode,myMainSel);
486 if(updateviewer) myMainVwr->Update();
488 // it is somewhere else...
491 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
492 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
494 switch (STATUS->GraphicStatus()){
496 if(STATUS->IsHilighted())
497 myCollectorPM->Unhighlight(anIObj,HiMod);
498 myCollectorPM->Erase(anIObj,HiMod);
499 mgrSelector->Deactivate(anIObj,myCollectorSel);
500 updcol = updateviewer;
501 }// attention the break is not set on purpose...
502 case AIS_DS_FullErased:{
503 TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
504 for (;ItL.More();ItL.Next()){
505 myMainPM->Display(anIObj,ItL.Value());
506 if(STATUS->IsSubIntensityOn())
507 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
509 if( myIsAutoActivateSelMode )
510 for (ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
511 mgrSelector->Activate(anIObj,ItL.Value(),myMainSel);
512 STATUS->SetGraphicStatus(AIS_DS_Displayed);
513 if(STATUS->IsHilighted())
514 myMainPM->Highlight(anIObj,HiMod);
518 // SAN : erase presentations for all display modes different from <DispMode>;
519 // then make sure <DispMode> is displayed and maybe highlighted;
520 // Finally, activate selection mode <SelMode> if not yet activated.
521 case AIS_DS_Displayed:{
522 TColStd_ListOfInteger aModesToRemove;
523 TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
524 for(;ItL.More();ItL.Next()){
526 Standard_Integer OldMode = ItL.Value();
528 if(OldMode!=DispMode){
529 aModesToRemove.Append(OldMode);
530 if(myMainPM->IsHighlighted(anIObj,OldMode))
531 myMainPM->Unhighlight(anIObj,OldMode);
532 myMainPM->Erase(anIObj,OldMode);
536 for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
537 STATUS->RemoveDisplayMode(ItL.Value());
539 if(!STATUS->IsDModeIn(DispMode))
540 STATUS->AddDisplayMode(DispMode);
542 myMainPM->Display(anIObj,DispMode);
543 if(STATUS->IsHilighted()){
544 myMainPM->Highlight(anIObj,HiMod);
546 if( myIsAutoActivateSelMode )
548 if(!mgrSelector->Contains(anIObj))
549 mgrSelector->Load(anIObj);
550 if(!mgrSelector->IsActivated(anIObj,SelMode))
551 mgrSelector->Activate(anIObj,SelMode,myMainSel);
562 if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
563 myMainVwr->Viewer()->SetTransparency(Standard_True);
564 if(updateviewer) myMainVwr->Update();
565 if(updcol && !myCollectorVwr.IsNull()) myCollectorVwr->Update();
568 // LOCAL CONTEXT OPEN
571 myLocalContexts(myCurLocalIndex)->Display(anIObj,DispMode,anIObj->AcceptShapeDecomposition(),SelMode);
573 if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
574 myMainVwr->Viewer()->SetTransparency(Standard_True);
577 if(updateviewer) myMainVwr->Update();
581 //=======================================================================
584 //=======================================================================
586 void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
587 const Standard_Integer aDisplayMode,
588 const Standard_Integer aSelectionMode,
589 const Standard_Boolean updateviewer,
590 const Standard_Boolean allowdecomposition)
592 if(anIObj.IsNull()) return;
594 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
596 // if no local context...
597 if(!HasOpenedContext()) {
598 // if(!anIObj->HasDisplayMode())
599 // anIObj->SetDisplayMode(aDisplayMode);
601 if(!myObjects.IsBound(anIObj)){
602 Handle(AIS_GlobalStatus) STATUS=
603 new AIS_GlobalStatus(AIS_DS_Displayed,aDisplayMode,aSelectionMode);
604 myObjects.Bind (anIObj,STATUS);
605 myMainPM->Display(anIObj,aDisplayMode);
606 if(aSelectionMode!=-1){
607 if(!mgrSelector->Contains(anIObj))
608 mgrSelector->Load(anIObj,aSelectionMode);
609 mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
611 if(updateviewer) myMainVwr->Update();
613 // anIObj->SelectionMode(aSelectionMode);
616 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
617 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
619 if(!STATUS->IsDModeIn(aDisplayMode)){
620 myMainPM->Display(anIObj,aDisplayMode);
621 STATUS->AddDisplayMode(aDisplayMode);
622 if(STATUS->IsSubIntensityOn())
623 myMainPM->Color(anIObj,mySubIntensity,aDisplayMode);
625 if(aSelectionMode!=-1){
626 STATUS->AddSelectionMode(aSelectionMode);
627 mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
629 if(updateviewer) myMainVwr->Update();
635 myLocalContexts(myCurLocalIndex)->Display(anIObj,aDisplayMode,allowdecomposition,aSelectionMode);
636 if(updateviewer) myMainVwr->Update();
641 //=======================================================================
644 //=======================================================================
646 void AIS_InteractiveContext::Load(const Handle(AIS_InteractiveObject)& anIObj,
647 const Standard_Integer SelMode,
648 const Standard_Boolean AllowDecomposition)
650 if(anIObj.IsNull()) return;
651 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
654 if(!HasOpenedContext()) {
655 if(SelMode==-1 && !AllowDecomposition){
656 Standard_Integer DispMode,HiMod,SelModeDef;
658 GetDefModes(anIObj,DispMode,HiMod,SelModeDef);
659 Handle(AIS_GlobalStatus) STATUS=
660 new AIS_GlobalStatus(AIS_DS_FullErased,DispMode,SelModeDef);
661 myObjects.Bind (anIObj,STATUS);
665 myLocalContexts(myCurLocalIndex)->Load(anIObj,AllowDecomposition,SelMode);
669 //=======================================================================
672 //=======================================================================
674 void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj,
675 const Standard_Boolean updateviewer,
676 const Standard_Boolean PutInCollector)
678 if(anIObj.IsNull()) return;
680 if ( !anIObj->IsAutoHilight() )
681 anIObj->ClearSelected();
683 if(!HasOpenedContext()){
684 EraseGlobal(anIObj,updateviewer,PutInCollector);
688 // First it is checked if it is possible to remove in the current local context
689 // then one tries to remove in other local contexts, if they allow it...
691 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Erase(anIObj);
693 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
694 for (;It.More();It.Next()){
695 if(It.Value()->AcceptErase())
697 WasInCtx |= It.Value()->Erase(anIObj);
699 WasInCtx = It.Value()->Erase(anIObj);
704 EraseGlobal(anIObj,updateviewer,PutInCollector);
706 if(updateviewer) myMainVwr->Update();
709 //=======================================================================
712 //=======================================================================
714 void AIS_InteractiveContext::EraseMode(const Handle(AIS_InteractiveObject)& anIObj,
715 const Standard_Integer aMode,
716 const Standard_Boolean /*updateviewer*/)
718 if(anIObj.IsNull()) return;
720 if(!myObjects.IsBound(anIObj)) return;
722 if(anIObj->HasDisplayMode()){
723 if(anIObj->DisplayMode()==aMode) return;
725 else if(myDisplayMode==aMode) return;
727 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
728 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
730 if(STATUS->GraphicStatus()!=AIS_DS_Displayed) return;
733 // if(STATUS->IsDModeIn(aMode)) {}
738 //=======================================================================
739 //function : EraseAll
741 //=======================================================================
743 void AIS_InteractiveContext::EraseAll(const Standard_Boolean PutInCollector,
744 const Standard_Boolean updateviewer)
746 if(!HasOpenedContext()){
747 AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects);
749 for(;ItM.More();ItM.Next()){
750 if(ItM.Value()->GraphicStatus() == AIS_DS_Displayed)
751 Erase(ItM.Key(),Standard_False,PutInCollector);
755 if (PutInCollector && !myCollectorVwr.IsNull())
756 myCollectorVwr->Update();
762 //=======================================================================
763 //function : DisplayAll
765 //=======================================================================
767 void AIS_InteractiveContext::DisplayAll(const Standard_Boolean OnlyFromCollector,
768 const Standard_Boolean updateviewer)
770 if(!HasOpenedContext()){
771 Standard_Boolean FoundInCollector(Standard_False);
772 AIS_DisplayStatus aDStatus = OnlyFromCollector ? AIS_DS_Erased : AIS_DS_FullErased,TheStatus;
774 if(!HasOpenedContext()){
775 AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects);
777 for(;ItM.More();ItM.Next()){
778 TheStatus = ItM.Value()->GraphicStatus();
779 if(TheStatus == aDStatus)
780 Display(ItM.Key(),Standard_False);
781 if(TheStatus == AIS_DS_Erased)
782 FoundInCollector = Standard_True;
786 if(FoundInCollector && !myCollectorVwr.IsNull())
787 myCollectorVwr->Update();
794 //=======================================================================
795 //function : DisplaySelected
797 //=======================================================================
799 void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer)
802 if(!HasOpenedContext()){
803 Standard_Boolean found = Standard_False;
804 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
805 Handle(AIS_InteractiveObject) iObj;
806 for (sel->Init();sel->More();sel->Next()) {
807 iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
808 Display(iObj,Standard_False);
809 found = Standard_True;
811 if(found && updateviewer) {
813 if(!(myIsCollClosed && myCollectorVwr.IsNull()))
815 myCollectorVwr->Update();
821 //=======================================================================
822 //function : EraseSelected
824 //=======================================================================
826 void AIS_InteractiveContext::EraseSelected(const Standard_Boolean PutInCollector,
827 const Standard_Boolean updateviewer)
830 if(!HasOpenedContext()){
831 Standard_Boolean found = Standard_False;
832 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
833 Handle(AIS_InteractiveObject) iObj;
834 for(sel->Init();sel->More();sel->Next()) {
835 iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
836 Erase(iObj,Standard_False,PutInCollector);
837 found = Standard_True;
839 if(found && updateviewer) {
841 if(PutInCollector && !myCollectorVwr.IsNull())
842 myCollectorVwr->Update();
846 //=======================================================================
849 //=======================================================================
851 Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_InteractiveObject)& anIObj,
852 const Standard_Integer WhichContext)
854 if(anIObj.IsNull()) return Standard_False;
856 if(!HasOpenedContext()) return Standard_False;
857 if(myObjects.IsBound(anIObj)) return Standard_False;
858 if(WhichContext!=-1 && !myLocalContexts.IsBound(WhichContext)) return Standard_False;
860 // Protection : if one tries to preserve a temporary object
861 // which is not in the local active context... rob 11-06-97
863 Standard_Integer IsItInLocal = myCurLocalIndex;
864 Standard_Boolean Found(Standard_False);
866 while(IsItInLocal>0 && !Found){
867 if(!myLocalContexts.IsBound(IsItInLocal))
869 else if(myLocalContexts(IsItInLocal)->IsIn(anIObj))
870 Found = Standard_True;
875 if(!Found) return Standard_False;
878 // const Handle(AIS_LocalStatus)& LS = (WhichContext== -1) ?
879 // myLocalContexts(IsItInLocal)->Status(anIObj):myLocalContexts(WhichContext)->Status(anIObj);
881 // const Handle(AIS_LocalStatus)& LS = myLocalContexts(IsItInLocal)->Status(anIObj);
882 Handle(AIS_LocalStatus) LS = myLocalContexts(IsItInLocal)->Status(anIObj);
886 if(LS->IsTemporary()){
887 Standard_Integer DM,HM,SM;
888 GetDefModes(anIObj,DM,HM,SM);
890 SM = LS->SelectionModes().IsEmpty() ? SM : LS->SelectionModes().First();
891 if(LS->DisplayMode()!= DM ){
892 Standard_Integer LSM = LS->SelectionModes().IsEmpty() ? -1 : LS->SelectionModes().First();
893 myLocalContexts(IsItInLocal)->Display(anIObj,DM,LS->Decomposed(),LSM);
896 Handle (AIS_GlobalStatus) GS = new AIS_GlobalStatus(AIS_DS_Displayed,
900 // GS->SubIntensityOn();
901 myObjects.Bind(anIObj,GS);
902 mgrSelector->Load(anIObj);
903 mgrSelector->Activate(anIObj,SM,myMainSel);
905 LS->SetTemporary(Standard_False);
907 return Standard_True;
911 //=======================================================================
913 //=======================================================================
915 AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus(const Handle(AIS_InteractiveObject)& anIObj) const
917 if(anIObj.IsNull()) return AIS_DS_None;
919 if(myObjects.IsBound(anIObj))
920 return myObjects(anIObj)->GraphicStatus();
922 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
923 for(;ItM.More();ItM.Next()){
924 if(ItM.Value()->IsIn(anIObj))
925 return AIS_DS_Temporary;
935 //=======================================================================
936 //function : DisplayedModes
938 //=======================================================================
940 const TColStd_ListOfInteger& AIS_InteractiveContext::
941 DisplayedModes(const Handle(AIS_InteractiveObject)& anIObj) const
943 return myObjects(anIObj)->DisplayedModes();
947 //=======================================================================
950 //=======================================================================
951 void AIS_InteractiveContext::Remove(const Handle(AIS_InteractiveObject)& anIObj,
952 const Standard_Boolean updateviewer)
955 if(anIObj.IsNull()) return;
957 if(!HasOpenedContext()){
958 ClearGlobal(anIObj,updateviewer);
962 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
963 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
964 for (;It.More() ;It.Next()){
965 if(It.Value()->AcceptErase())
966 WasInCtx = It.Value()->Remove(anIObj);
970 ClearGlobal(anIObj,updateviewer);
972 // if(updateviewer) myMainVwr->Update();
976 //=======================================================================
977 //function : RemoveAll
979 //=======================================================================
980 void AIS_InteractiveContext::RemoveAll(const Standard_Boolean updateviewer)
982 AIS_ListOfInteractive aList;
983 ObjectsInside(aList);
984 AIS_ListIteratorOfListOfInteractive aListIterator;
985 for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
986 Remove(aListIterator.Value(), Standard_False);
993 //=======================================================================
996 //=======================================================================
998 void AIS_InteractiveContext::Clear(const Handle(AIS_InteractiveObject)& anIObj,
999 const Standard_Boolean updateviewer)
1001 if(anIObj.IsNull()) return;
1003 if(!HasOpenedContext()){
1004 ClearGlobal(anIObj,updateviewer);
1009 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
1010 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
1011 for (;It.More() ;It.Next()){
1012 if(It.Value()->AcceptErase())
1013 WasInCtx = It.Value()->Remove(anIObj);
1017 ClearGlobal(anIObj,updateviewer);
1019 if(updateviewer) myMainVwr->Update();
1026 //=======================================================================
1027 //function : ClearPrs
1029 //=======================================================================
1031 void AIS_InteractiveContext::ClearPrs(const Handle(AIS_InteractiveObject)& anIObj,
1032 const Standard_Integer aMode,
1033 const Standard_Boolean updateviewer)
1035 if(anIObj.IsNull()) return;
1037 if(!HasOpenedContext()){
1038 ClearGlobalPrs(anIObj,aMode,updateviewer);
1042 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->ClearPrs(anIObj,aMode);
1043 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
1044 for (;It.More() ;It.Next()){
1045 if(It.Value()->AcceptErase())
1046 WasInCtx = It.Value()->ClearPrs(anIObj,aMode);
1049 ClearGlobalPrs(anIObj,aMode,updateviewer);
1051 if(updateviewer) myMainVwr->Update();
1056 //=======================================================================
1057 //function : Hilight
1059 //=======================================================================
1061 void AIS_InteractiveContext::Hilight(const Handle(AIS_InteractiveObject)& anIObj,
1062 const Standard_Boolean updateviewer)
1064 if(anIObj.IsNull()) return;
1066 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
1067 if (!HasOpenedContext())
1069 if(!myObjects.IsBound(anIObj)) return;
1072 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1073 // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes();
1074 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1077 STATUS->SetHilightStatus (Standard_True);
1079 switch(STATUS->GraphicStatus()){
1080 case AIS_DS_Displayed:
1082 Standard_Integer DispMode,HiMode,SelMode;
1083 GetDefModes(anIObj,DispMode,HiMode,SelMode);
1084 // if(!STATUS->IsDModeIn(HiMode)){
1085 // myMainPM->Display(anIObj,HiMode);
1087 myMainPM->Highlight(anIObj,HiMode);
1088 if(updateviewer) myMainVwr->Update();
1093 Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
1094 myCollectorPM->Highlight(anIObj,HiMode);
1095 if(updateviewer) myCollectorVwr->Update();
1103 myLocalContexts(myCurLocalIndex)->Hilight(anIObj);
1104 if(updateviewer) myMainVwr->Update();
1106 //=======================================================================
1107 //function : Hilight
1109 //=======================================================================
1111 void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject)& anIObj,
1112 const Quantity_NameOfColor aCol,
1113 const Standard_Boolean updateviewer)
1115 if(anIObj.IsNull()) return;
1117 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
1119 if (!HasOpenedContext())
1121 if(!myObjects.IsBound(anIObj)) return;
1123 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1124 STATUS->SetHilightStatus (Standard_True);
1126 switch(STATUS->GraphicStatus()){
1127 case AIS_DS_Displayed:
1129 Standard_Integer DispMode,HiMode,SelMode;
1130 GetDefModes(anIObj,DispMode,HiMode,SelMode);
1131 // if(!STATUS->IsDModeIn(HiMode)){
1132 // myMainPM->Display(anIObj,HiMode);
1134 myMainPM->Color(anIObj,aCol,HiMode);
1135 STATUS->SetHilightColor(aCol);
1136 if(updateviewer) myMainVwr->Update();
1141 Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
1142 myCollectorPM->Color(anIObj,aCol,HiMode);
1143 if(updateviewer) myCollectorVwr->Update();
1151 myLocalContexts(myCurLocalIndex)->Hilight(anIObj,aCol);
1152 if(updateviewer) myMainVwr->Update();
1155 //=======================================================================
1156 //function : Unhilight
1158 //=======================================================================
1160 void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
1162 if(anIObj.IsNull()) return;
1164 if (!HasOpenedContext())
1166 if(!myObjects.IsBound(anIObj)) return;
1168 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1169 STATUS->SetHilightStatus (Standard_False);
1170 STATUS->SetHilightColor(Quantity_NOC_WHITE);
1172 switch(STATUS->GraphicStatus()){
1173 case AIS_DS_Displayed:
1175 Standard_Integer DispMode,HiMode,SelMode;
1176 GetDefModes(anIObj,DispMode,HiMode,SelMode);
1177 myMainPM->Unhighlight(anIObj,HiMode);
1178 // if(!STATUS->IsDModeIn(HiMode))
1179 // myMainPM->Erase(anIObj,HiMode);
1180 if(updateviewer) myMainVwr->Update();
1185 Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
1186 myCollectorPM->Unhighlight(anIObj,HiMode);
1187 if(updateviewer) myCollectorVwr->Update();
1195 myLocalContexts(myCurLocalIndex)->Unhilight(anIObj);
1196 if(updateviewer) myMainVwr->Update();
1199 //=======================================================================
1200 //function : IsHilighted
1202 //=======================================================================
1204 Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_InteractiveObject)& anIObj) const
1206 if(anIObj.IsNull()) return Standard_False;
1208 if (!HasOpenedContext()){
1209 if(!myObjects.IsBound(anIObj))
1210 return Standard_False;
1211 return myObjects(anIObj)->IsHilighted();
1213 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
1214 for(;ItM.More();ItM.Next()){
1215 if(ItM.Value()->IsHilighted(anIObj))
1216 return Standard_True;
1218 return Standard_False;
1221 Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_InteractiveObject)& anIObj,
1222 Standard_Boolean& WithColor,
1223 Quantity_NameOfColor& TheHiCol) const
1225 if(!HasOpenedContext()){
1226 if(myObjects.IsBound(anIObj)){
1227 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
1228 if(STAT->IsHilighted()){
1229 if(STAT->HilightColor()!=Quantity_NOC_WHITE){
1230 WithColor=Standard_True;
1231 TheHiCol = STAT->HilightColor();
1234 WithColor = Standard_False;
1235 return Standard_True;
1238 return Standard_False;
1240 Standard_Integer MaxIndex = HighestIndex();
1241 for(Standard_Integer i=MaxIndex;i>=1 ; i--){
1242 if(myLocalContexts.IsBound(i)){
1243 if(myLocalContexts(i)->IsHilighted(anIObj,WithColor,TheHiCol))
1244 return Standard_True;
1248 return Standard_False;
1253 //=======================================================================
1254 //function : IsDisplayed
1256 //=======================================================================
1258 Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj) const
1260 if(anIObj.IsNull()) return Standard_False;
1263 if(myObjects.IsBound(anIObj))
1264 if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed)
1265 return Standard_True;
1267 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
1268 for(;ItM.More();ItM.Next()){
1269 if(ItM.Value()->IsDisplayed(anIObj))
1270 return Standard_True;
1272 return Standard_False;
1275 //=======================================================================
1276 //function : IsDisplayed
1278 //=======================================================================
1280 Standard_Boolean AIS_InteractiveContext::IsInCollector(const Handle(AIS_InteractiveObject)& anIObj) const
1282 if(anIObj.IsNull()) return Standard_False;
1285 if(myObjects.IsBound(anIObj))
1286 return (myObjects(anIObj)->GraphicStatus()==AIS_DS_Erased);
1287 return Standard_False;
1291 //=======================================================================
1292 //function : IsDisplayed
1294 //=======================================================================
1296 Standard_Boolean AIS_InteractiveContext::
1297 IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj,
1298 const Standard_Integer aMode) const
1300 if(anIObj.IsNull()) return Standard_False;
1301 if(myObjects.IsBound(anIObj)) {
1302 if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed &&
1303 myObjects(anIObj)->IsDModeIn(aMode))
1304 return Standard_True;
1307 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
1308 for(;ItM.More();ItM.Next()){
1309 if(ItM.Value()->IsDisplayed(anIObj,aMode))
1310 return Standard_True;
1312 return Standard_False;
1316 //=======================================================================
1317 //function : DisplayPriority
1319 //=======================================================================
1321 Standard_Integer AIS_InteractiveContext::
1322 DisplayPriority(const Handle(AIS_InteractiveObject)& anIObj) const
1324 if(anIObj.IsNull()) return -1;
1325 if(myObjects.IsBound(anIObj)){
1327 // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj);
1328 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1330 Standard_Integer DM,HM,SM ;
1331 GetDefModes(anIObj,DM,HM,SM);
1332 switch(STATUS->GraphicStatus()){
1333 case AIS_DS_Displayed:
1335 return myMainPM->DisplayPriority(anIObj,DM);
1339 return myCollectorPM->DisplayPriority(anIObj,HM);
1347 //=======================================================================
1348 //function : SetDisplayPriority
1350 //=======================================================================
1352 void AIS_InteractiveContext::SetDisplayPriority(const Handle(AIS_InteractiveObject)& anIObj,
1353 const Standard_Integer aPriority)
1357 if(!anIObj->HasInteractiveContext())
1358 anIObj->SetContext(this);
1359 if(myObjects.IsBound(anIObj)){
1361 // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj);
1362 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1364 Standard_Integer DM,HM,SM ;
1365 GetDefModes(anIObj,DM,HM,SM);
1366 switch(STATUS->GraphicStatus()){
1367 case AIS_DS_Displayed:
1369 myMainPM->SetDisplayPriority(anIObj,DM,aPriority);
1374 myCollectorPM->SetDisplayPriority(anIObj,HM,aPriority);
1381 else if (HasOpenedContext())
1382 {myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);}
1385 //=======================================================================
1386 //function : Redisplay
1388 //=======================================================================
1390 void AIS_InteractiveContext::Redisplay(const Handle(AIS_InteractiveObject)& anIObj,
1391 const Standard_Boolean updateviewer,
1392 const Standard_Boolean allmodes)
1394 if(AISDebugModeOn()){
1395 cout<<"===>AIS_InteractiveContext::Redisplay de :";
1396 cout<<anIObj->DynamicType()->Name()<<endl;
1399 RecomputePrsOnly(anIObj,updateviewer,allmodes);
1400 RecomputeSelectionOnly(anIObj);
1403 //=======================================================================
1404 //function : Redisplay
1406 //=======================================================================
1408 void AIS_InteractiveContext::Redisplay(const AIS_KindOfInteractive KOI,
1409 const Standard_Integer /*Sign*/,
1410 const Standard_Boolean updateviewer)
1412 Standard_Boolean found_viewer(Standard_False),found_coll(Standard_False);
1414 for(AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);It.More();It.Next()){
1416 // const Handle(AIS_InteractiveObject)& IO = It.Key();
1417 Handle(AIS_InteractiveObject) IO = It.Key();
1419 if(IO->Type()== KOI){
1421 // Standard_Boolean good = (Sign==-1)? Standard_True :
1422 // ((IO->Signature()==Sign)? Standard_True:Standard_False);
1424 Redisplay(IO,Standard_False);
1425 switch(It.Value()->GraphicStatus()){
1426 case AIS_DS_Displayed:
1427 found_viewer = Standard_True;
1430 found_coll = Standard_True;
1440 myMainVwr->Update();
1442 myCollectorVwr->Update();
1447 //=======================================================================
1448 //function : RecomputePrsOnly
1450 //=======================================================================
1452 void AIS_InteractiveContext::RecomputePrsOnly(const Handle(AIS_InteractiveObject)& anIObj,
1453 const Standard_Boolean updateviewer,
1454 const Standard_Boolean allmodes)
1456 if(anIObj.IsNull()) return;
1457 anIObj->Update(allmodes);
1460 if(HasOpenedContext())
1461 myMainVwr->Update();
1463 if(myObjects.IsBound(anIObj)){
1464 switch(myObjects(anIObj)->GraphicStatus()){
1465 case AIS_DS_Displayed:
1466 myMainVwr->Update();
1470 if(!myCollectorVwr.IsNull())
1471 myCollectorVwr->Update();
1480 //=======================================================================
1481 //function : RecomputeSelectionOnly
1483 //=======================================================================
1484 void AIS_InteractiveContext::RecomputeSelectionOnly(const Handle(AIS_InteractiveObject)& anIObj)
1486 if(anIObj.IsNull()) return;
1487 mgrSelector->RecomputeSelection(anIObj);
1491 TColStd_ListOfInteger LI;
1492 TColStd_ListIteratorOfListOfInteger Lit;
1493 ActivatedModes(anIObj,LI);
1494 if(!HasOpenedContext()){
1495 if(!myObjects.IsBound(anIObj)) return;
1496 switch(myObjects(anIObj)->GraphicStatus())
1498 case AIS_DS_Displayed:
1500 for(Lit.Initialize(LI);Lit.More();Lit.Next())
1501 mgrSelector->Activate(anIObj,Lit.Value(),myMainSel);
1506 for(Lit.Initialize(LI);Lit.More();Lit.Next())
1507 mgrSelector->Activate(anIObj,Lit.Value(),myCollectorSel);
1517 //=======================================================================
1520 //=======================================================================
1522 void AIS_InteractiveContext::Update(const Handle(AIS_InteractiveObject)& anIObj,
1523 const Standard_Boolean updateviewer)
1525 if(anIObj.IsNull()) return;
1529 TColStd_ListOfInteger LL;
1530 anIObj->ToBeUpdated(LL);
1531 TColStd_ListIteratorOfListOfInteger ITI(LL);
1532 Standard_Boolean wasupdated(Standard_False);
1534 for (;ITI.More();ITI.Next()){
1535 anIObj->Update(ITI.Value(),Standard_False);
1536 wasupdated = Standard_True;
1540 mgrSelector->Update(anIObj);
1543 if(!myObjects.IsBound(anIObj)) return;
1544 switch(myObjects(anIObj)->GraphicStatus()){
1545 case AIS_DS_Displayed:
1546 case AIS_DS_Temporary:
1547 myMainVwr->Update();
1550 myCollectorVwr->Update();
1560 //=======================================================================
1561 //function : SetLocation
1563 //=======================================================================
1565 void AIS_InteractiveContext::SetLocation(const Handle(AIS_InteractiveObject)& anIObj,
1566 const TopLoc_Location& aLoc)
1568 if(anIObj.IsNull()) return;
1571 if(anIObj->HasLocation() && aLoc.IsIdentity()){
1572 anIObj->ResetLocation();
1573 mgrSelector->Update(anIObj,Standard_False);
1576 if(aLoc.IsIdentity()) return ;
1578 // first reset the previous location to properly clean everything...
1579 if(anIObj->HasLocation())
1580 anIObj->ResetLocation();
1583 anIObj->SetLocation(aLoc);
1585 if(!HasOpenedContext())
1586 mgrSelector->Update(anIObj,Standard_False);
1590 // const Handle(StdSelect_ViewerSelector3d)& tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
1591 Handle(StdSelect_ViewerSelector3d) tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
1593 mgrSelector->Update(anIObj,tempSel,Standard_False);
1596 //=======================================================================
1597 //function : ResetLocation
1599 //=======================================================================
1600 void AIS_InteractiveContext::ResetLocation(const Handle(AIS_InteractiveObject)& anIObj)
1602 if(anIObj.IsNull()) return;
1604 anIObj->ResetLocation();
1605 mgrSelector->Update(anIObj,Standard_False);
1608 //=======================================================================
1609 //function : HasLocation
1611 //=======================================================================
1613 Standard_Boolean AIS_InteractiveContext::
1614 HasLocation(const Handle(AIS_InteractiveObject)& anIObj) const
1616 if(anIObj.IsNull()) return Standard_False;
1618 return anIObj->HasLocation();
1621 const TopLoc_Location& AIS_InteractiveContext::
1622 Location(const Handle(AIS_InteractiveObject)& anIObj) const
1624 return anIObj->Location();
1627 //=======================================================================
1628 //function : SetDeviationCoefficient
1630 //=======================================================================
1632 void AIS_InteractiveContext::SetDeviationCoefficient(const Standard_Real aCoefficient)
1634 myDefaultDrawer->SetDeviationCoefficient(aCoefficient);
1636 //=======================================================================
1637 //function : SetDeviationAngle
1639 //=======================================================================
1641 void AIS_InteractiveContext::SetDeviationAngle(const Standard_Real anAngle)
1643 myDefaultDrawer->SetDeviationCoefficient(anAngle);
1646 //=======================================================================
1647 //function : DeviationAngle
1648 //purpose : Gets deviationAngle
1649 //=======================================================================
1651 Standard_Real AIS_InteractiveContext::DeviationAngle() const
1654 // return myDefaultDrawer->DeviationAngle();
1657 //=======================================================================
1658 //function : DeviationCoefficient
1660 //=======================================================================
1662 Standard_Real AIS_InteractiveContext::DeviationCoefficient() const
1664 return myDefaultDrawer->DeviationCoefficient();
1666 //=======================================================================
1667 //function : SetHLRDeviationCoefficient
1669 //=======================================================================
1671 void AIS_InteractiveContext::SetHLRDeviationCoefficient(const Standard_Real aCoefficient)
1673 myDefaultDrawer->SetHLRDeviationCoefficient(aCoefficient);
1676 //=======================================================================
1677 //function : HLRDeviationCoefficient
1679 //=======================================================================
1681 Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const
1683 return myDefaultDrawer->HLRDeviationCoefficient();
1686 //=======================================================================
1687 //function : SetHLRAngle
1689 //=======================================================================
1691 void AIS_InteractiveContext::SetHLRAngle(const Standard_Real anAngle)
1693 myDefaultDrawer->SetHLRAngle(anAngle);
1696 //=======================================================================
1697 //function : SetHLRAngleAndDeviation
1698 //purpose : compute with anangle a HLRAngle and a HLRDeviationCoefficient
1699 // and set them in myHLRAngle and in myHLRDeviationCoefficient
1700 // of myDefaultDrawer
1701 //=======================================================================
1703 void AIS_InteractiveContext::SetHLRAngleAndDeviation(const Standard_Real anAngle)
1706 Standard_Real OutAngl,OutDefl;
1707 HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1709 myDefaultDrawer->SetHLRAngle(OutAngl);
1710 myDefaultDrawer->SetHLRDeviationCoefficient(OutDefl);
1714 //=======================================================================
1715 //function : HLRAngle
1717 //=======================================================================
1719 Standard_Real AIS_InteractiveContext::HLRAngle() const
1721 return myDefaultDrawer->HLRAngle();
1724 //=======================================================================
1725 //function : SetDisplayMode
1727 //=======================================================================
1729 void AIS_InteractiveContext::SetDisplayMode(const AIS_DisplayMode aMode,
1730 const Standard_Boolean updateviewer)
1732 if(aMode==myDisplayMode) return;
1733 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
1735 for(;It.More();It.Next()){
1737 // const Handle(AIS_InteractiveObject)& anObj = It.Key();
1738 Handle(AIS_InteractiveObject) anObj = It.Key();
1740 Standard_Boolean Processed = (anObj->IsKind(STANDARD_TYPE(AIS_Shape)) ||
1741 anObj->IsKind(STANDARD_TYPE(AIS_ConnectedShape)) ||
1742 anObj->IsKind(STANDARD_TYPE(AIS_MultipleConnectedShape)) );
1744 if ((!anObj->HasDisplayMode()) && Processed)
1746 if(anObj->AcceptDisplayMode(aMode)){
1748 // const Handle(AIS_GlobalStatus)& STATUS = It.Value();
1749 Handle(AIS_GlobalStatus) STATUS = It.Value();
1751 if(STATUS->IsDModeIn(myDisplayMode))
1752 STATUS->RemoveDisplayMode(myDisplayMode);
1754 STATUS->AddDisplayMode(aMode);
1756 if(STATUS->GraphicStatus()== AIS_DS_Displayed){
1757 myMainPM->Erase(anObj, myDisplayMode);
1758 myMainPM->Display(anObj, aMode);
1759 if(STATUS->IsSubIntensityOn())
1760 myMainPM->Color(anObj,mySubIntensity,aMode);
1762 // myDisplayMode = aMode;
1767 myDisplayMode = aMode;
1768 if(updateviewer) myMainVwr->Update();
1771 //=======================================================================
1772 //function : SetDisplayMode
1774 //=======================================================================
1776 void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
1777 const Standard_Integer aMode,
1778 const Standard_Boolean updateviewer)
1781 if(!anIObj->HasInteractiveContext())
1782 anIObj->SetContext(this);
1783 if(!HasOpenedContext()){
1785 if(!myObjects.IsBound(anIObj))
1786 anIObj->SetDisplayMode(aMode);
1788 else if( anIObj->AcceptDisplayMode(aMode) )
1794 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1795 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1798 // the interactive object has no mode : OldMode = Mode Session
1799 // already has a mode : OldMode = old mode Propre
1801 Standard_Integer OldMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode(): myDisplayMode;
1803 if(STATUS->IsDModeIn(OldMode))
1804 STATUS->RemoveDisplayMode(OldMode);
1805 STATUS->AddDisplayMode(aMode);
1807 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
1808 if(aMode!=OldMode ){
1809 if(myMainPM->IsHighlighted(anIObj,OldMode))
1810 myMainPM->Unhighlight(anIObj,OldMode);
1812 myMainPM->Erase(anIObj,OldMode);
1814 // SAN : erase presentations for all display modes different from <aMode>
1815 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
1816 TColStd_ListOfInteger aModesToRemove;
1817 TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
1818 for(;ItL.More();ItL.Next()){
1820 Standard_Integer OldMode = ItL.Value();
1823 aModesToRemove.Append(OldMode);
1824 if(myMainPM->IsHighlighted(anIObj,OldMode))
1825 myMainPM->Unhighlight(anIObj,OldMode);
1826 myMainPM->Erase(anIObj,OldMode);
1830 for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
1831 STATUS->RemoveDisplayMode(ItL.Value());
1833 if(!STATUS->IsDModeIn(aMode))
1834 STATUS->AddDisplayMode(aMode);
1837 myMainPM->Display(anIObj,aMode);
1838 Standard_Integer DM,HM,SM;
1839 GetDefModes(anIObj,DM,HM,SM);
1840 if(STATUS->IsHilighted()){
1841 myMainPM->Highlight(anIObj,HM);
1843 if(STATUS->IsSubIntensityOn()){
1844 myMainPM->Color(anIObj,mySubIntensity,aMode);
1846 if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
1847 myMainVwr->Viewer()->SetTransparency(Standard_True);
1849 if(updateviewer) myMainVwr->Update();
1854 anIObj->SetDisplayMode(aMode);
1859 //=======================================================================
1860 //function : UnsetDisplayMode
1862 //=======================================================================
1864 void AIS_InteractiveContext::
1865 UnsetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
1866 const Standard_Boolean updateviewer)
1868 if(anIObj.IsNull()) return ;
1869 if(!anIObj->HasDisplayMode()) return;
1871 if(!myObjects.IsBound(anIObj))
1872 anIObj->UnsetDisplayMode();
1875 Standard_Integer OldMode = anIObj->DisplayMode();
1876 if(myDisplayMode==OldMode) return;
1877 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1878 STATUS->RemoveDisplayMode(OldMode);
1879 if(!STATUS->IsDModeIn(myDisplayMode))
1880 STATUS->AddDisplayMode(myDisplayMode);
1881 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
1882 if(myMainPM->IsHighlighted(anIObj,OldMode))
1883 myMainPM->Unhighlight(anIObj,OldMode);
1884 myMainPM->Erase(anIObj,OldMode);
1885 myMainPM->Display(anIObj,myDisplayMode);
1886 Standard_Integer DM,HM,SM;
1887 GetDefModes(anIObj,DM,HM,SM);
1888 if(STATUS->IsHilighted()){
1889 myMainPM->Highlight(anIObj,HM);
1891 if(STATUS->IsSubIntensityOn()){
1892 myMainPM->Color(anIObj,mySubIntensity,myDisplayMode);
1894 if(updateviewer) myMainVwr->Update();
1896 anIObj->UnsetDisplayMode();
1901 //=======================================================================
1902 //function : SetCurrentFacingModel
1904 //=======================================================================
1907 void AIS_InteractiveContext::SetCurrentFacingModel(
1908 const Handle(AIS_InteractiveObject)& anIObj,
1909 const Aspect_TypeOfFacingModel aModel) {
1910 if ( !anIObj.IsNull () ) {
1911 anIObj->SetCurrentFacingModel(aModel);
1916 //=======================================================================
1917 //function : SetColor
1919 //=======================================================================
1921 void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
1922 const Quantity_NameOfColor aColor,
1923 const Standard_Boolean updateviewer)
1926 SetColor(anIObj,Quantity_Color(aColor),updateviewer);
1929 void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
1930 const Quantity_Color &aColor,
1931 const Standard_Boolean updateviewer)
1934 if(anIObj.IsNull()) return ;
1936 if(!anIObj->HasInteractiveContext())
1937 anIObj->SetContext(this);
1938 anIObj->SetColor(aColor);
1939 if(anIObj->RecomputeEveryPrs())
1940 anIObj->Redisplay();
1943 Standard_Integer NbDisp=0;
1944 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
1945 for (;ITI.More();ITI.Next())
1947 anIObj->Update(ITI.Value(),Standard_False);
1950 anIObj->SetRecomputeOk();
1952 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
1959 // if(anIObj->Type()==AIS_KOI_Datum && anIObj->Signature()==3){
1960 // Handle(AIS_Trihedron) Tr = *((Handle(AIS_Trihedron)*)&anIObj);
1961 // Standard_Real Lx = myDefaultDrawer->DatumAspect()->FirstAxisLength();
1963 // gp_Dir D =Tr->Component()->XDirection();
1964 // gp_Pnt O = Tr->Component()->Location();
1965 // gp_Vec V(D);V*=Lx/5.;
1966 // T.SetRotation(gp_Ax1(O,D),PI/6.);
1967 // T.SetTranslationPart(V);
1968 // TopLoc_Location L,IncLoc(T);
1970 // for(Standard_Integer I=1;I<90;I++){
1971 // if(anIObj->HasLocation())
1972 // L = anIObj->Location() * IncLoc;
1975 // SetLocation(anIObj,L);
1976 // UpdateCurrentViewer();
1978 // for(I=1;I<90;I++){
1979 // L = anIObj->Location() /IncLoc;
1980 // SetLocation(anIObj,L);
1981 // UpdateCurrentViewer();
1983 // ResetLocation(anIObj);
1986 if(updateviewer) UpdateCurrentViewer();
1989 //=======================================================================
1990 //function : SetDeviationCoefficient
1992 //=======================================================================
1994 void AIS_InteractiveContext::SetDeviationCoefficient(
1995 const Handle(AIS_InteractiveObject)& anIObj,
1996 const Standard_Real aCoefficient,
1997 const Standard_Boolean updateviewer)
1999 // cout<<" Coefficient:"<< aCoefficient <<endl;
2000 if(anIObj.IsNull()) return ;
2002 if(!anIObj->HasInteractiveContext())
2003 anIObj->SetContext(this);
2005 // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
2006 if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
2007 if(anIObj->Signature()!=0) return;
2008 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationCoefficient(aCoefficient);
2012 if(anIObj->RecomputeEveryPrs())
2013 anIObj->Redisplay();
2016 Standard_Integer NbDisp=0;
2017 TColStd_ListOfInteger LL;
2018 anIObj->ToBeUpdated(LL);
2019 TColStd_ListIteratorOfListOfInteger ITI(LL);
2020 for (;ITI.More();ITI.Next())
2022 anIObj->Update(ITI.Value(),Standard_False);
2025 anIObj->SetRecomputeOk();
2027 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2030 if(updateviewer) UpdateCurrentViewer();
2033 //=======================================================================
2034 //function : SetHLRDeviationCoefficient
2036 //=======================================================================
2038 void AIS_InteractiveContext::SetHLRDeviationCoefficient(
2039 const Handle(AIS_InteractiveObject)& anIObj,
2040 const Standard_Real aCoefficient,
2041 const Standard_Boolean updateviewer)
2043 // cout<<" HLRCoefficient:"<< aCoefficient <<endl;
2044 if(anIObj.IsNull()) return ;
2046 if(!anIObj->HasInteractiveContext())
2047 anIObj->SetContext(this);
2048 // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
2049 if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
2050 if(anIObj->Signature()!=0) return;
2051 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationCoefficient(aCoefficient);
2055 if(anIObj->RecomputeEveryPrs())
2056 anIObj->Redisplay();
2059 Standard_Integer NbDisp=0;
2061 TColStd_ListOfInteger LL;
2062 anIObj->ToBeUpdated(LL);
2063 TColStd_ListIteratorOfListOfInteger ITI(LL);
2064 for (;ITI.More();ITI.Next())
2066 anIObj->Update(ITI.Value(),Standard_False);
2069 anIObj->SetRecomputeOk();
2071 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2074 if(updateviewer) UpdateCurrentViewer();
2078 //=======================================================================
2079 //function : SetDeviationAngle
2081 //=======================================================================
2083 void AIS_InteractiveContext::SetDeviationAngle(
2084 const Handle(AIS_InteractiveObject)& anIObj,
2085 const Standard_Real anAngle,
2086 const Standard_Boolean updateviewer)
2088 // cout<<" Angle:"<< anAngle <<endl;
2089 if(anIObj.IsNull()) return ;
2091 if(!anIObj->HasInteractiveContext())
2092 anIObj->SetContext(this);
2093 // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
2094 if(anIObj->Type()!=AIS_KOI_Shape) return;
2095 if(anIObj->Signature()!=0) return;
2096 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationAngle(anAngle);
2099 if(anIObj->RecomputeEveryPrs())
2100 anIObj->Redisplay();
2103 Standard_Integer NbDisp=0;
2104 TColStd_ListOfInteger LL;
2105 anIObj->ToBeUpdated(LL);
2106 TColStd_ListIteratorOfListOfInteger ITI(LL);
2107 for (;ITI.More();ITI.Next())
2109 anIObj->Update(ITI.Value(),Standard_False);
2112 anIObj->SetRecomputeOk();
2114 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2117 if(updateviewer) UpdateCurrentViewer();
2119 //=======================================================================
2120 //function : SetDeviationAngle
2122 //=======================================================================
2124 void AIS_InteractiveContext::SetAngleAndDeviation(
2125 const Handle(AIS_InteractiveObject)& anIObj,
2126 const Standard_Real anAngle,
2127 const Standard_Boolean updateviewer)
2129 // cout<<" Angle:"<< anAngle <<endl;
2130 if(anIObj.IsNull()) return ;
2131 // Standard_Real anAngleRad = PI*anAngle/180; test rob...
2132 if(!anIObj->HasInteractiveContext())
2133 anIObj->SetContext(this);
2135 // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
2136 if(anIObj->Type()!=AIS_KOI_Shape) return;
2137 if(anIObj->Signature()!=0) return;
2138 (*((Handle(AIS_Shape)*)&anIObj))->SetAngleAndDeviation(anAngle);
2141 if(anIObj->RecomputeEveryPrs())
2142 anIObj->Redisplay();
2144 Update(anIObj,updateviewer);
2147 //=======================================================================
2148 //function : SetDeviationAngle
2150 //=======================================================================
2152 void AIS_InteractiveContext::SetHLRAngleAndDeviation(
2153 const Handle(AIS_InteractiveObject)& anIObj,
2154 const Standard_Real anAngle,
2155 const Standard_Boolean updateviewer)
2157 // cout<<" Angle:"<< anAngle <<endl;
2159 if(anIObj.IsNull()) return ;
2160 if(!anIObj->HasInteractiveContext())
2161 anIObj->SetContext(this);
2163 // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
2164 if(anIObj->Type()!=AIS_KOI_Shape) return;
2165 if(anIObj->Signature()!=0) return;
2166 (*((Handle(AIS_Shape)*)&anIObj))->SetHLRAngleAndDeviation(anAngle);
2169 if(anIObj->RecomputeEveryPrs())
2170 anIObj->Redisplay();
2173 Standard_Integer NbDisp=0;
2175 TColStd_ListOfInteger LL;
2176 anIObj->ToBeUpdated(LL);
2177 TColStd_ListIteratorOfListOfInteger ITI(LL);
2178 for (;ITI.More();ITI.Next())
2180 anIObj->Update(ITI.Value(),Standard_False);
2183 anIObj->SetRecomputeOk();
2185 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2188 if(updateviewer) UpdateCurrentViewer();
2191 //=======================================================================
2192 //function : SetHLRDeviationAngle
2194 //=======================================================================
2196 void AIS_InteractiveContext::SetHLRDeviationAngle(
2197 const Handle(AIS_InteractiveObject)& anIObj,
2198 const Standard_Real anAngle,
2199 const Standard_Boolean updateviewer)
2201 // cout<<" HLRAngle:"<< anAngle <<endl;
2202 if(anIObj.IsNull()) return ;
2204 if(!anIObj->HasInteractiveContext())
2205 anIObj->SetContext(this);
2206 // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
2207 if( anIObj->Type()!=AIS_KOI_Shape) return;
2208 if(anIObj->Signature()!=0) return;
2209 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationAngle(anAngle);
2212 if(anIObj->RecomputeEveryPrs())
2213 anIObj->Redisplay();
2216 Standard_Integer NbDisp=0;
2217 TColStd_ListOfInteger LL;
2218 anIObj->ToBeUpdated(LL);
2219 TColStd_ListIteratorOfListOfInteger ITI(LL);
2220 for (;ITI.More();ITI.Next())
2222 anIObj->Update(ITI.Value(),Standard_False);
2225 anIObj->SetRecomputeOk();
2227 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2230 if(updateviewer) UpdateCurrentViewer();
2233 //=======================================================================
2234 //function : UnsetColor
2236 //=======================================================================
2238 void AIS_InteractiveContext::UnsetColor(const Handle(AIS_InteractiveObject)& anIObj,
2239 const Standard_Boolean updateviewer)
2241 if(anIObj.IsNull()) return ;
2242 anIObj->UnsetColor();
2243 if(anIObj->RecomputeEveryPrs())
2244 anIObj->Redisplay();
2247 Standard_Integer NbDisp =0;
2248 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2249 for (;ITI.More();ITI.Next())
2251 anIObj->Update(ITI.Value(),Standard_False);
2255 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2257 anIObj->SetRecomputeOk();
2260 UpdateCurrentViewer();
2263 //=======================================================================
2264 //function : HasColor
2266 //=======================================================================
2268 Standard_Boolean AIS_InteractiveContext::HasColor(const Handle(AIS_InteractiveObject)& anIObj) const
2270 return anIObj->HasColor();
2274 //=======================================================================
2277 //=======================================================================
2279 Quantity_NameOfColor AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj) const
2281 return anIObj->Color();
2285 void AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj,
2286 Quantity_Color &aColor) const
2288 anIObj->Color(aColor);
2292 //=======================================================================
2295 //=======================================================================
2297 Standard_Real AIS_InteractiveContext::Width(const Handle(AIS_InteractiveObject)& anIObj) const
2299 return anIObj->Width();
2302 //=======================================================================
2303 //function : SetWidth
2305 //=======================================================================
2307 void AIS_InteractiveContext::SetWidth(const Handle(AIS_InteractiveObject)& anIObj,
2308 const Standard_Real aValue,
2309 const Standard_Boolean updateviewer)
2311 if(anIObj.IsNull()) return ;
2313 if(!anIObj->HasInteractiveContext())
2314 anIObj->SetContext(this);
2315 anIObj->SetWidth(aValue);
2316 if(anIObj->RecomputeEveryPrs())
2317 anIObj->Redisplay();
2320 Standard_Integer NbDisp=0;
2321 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2322 for (;ITI.More();ITI.Next())
2324 anIObj->Update(ITI.Value(),Standard_False);
2328 cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
2330 anIObj->SetRecomputeOk();
2333 UpdateCurrentViewer();
2336 //=======================================================================
2337 //function : UnsetWidth
2339 //=======================================================================
2341 void AIS_InteractiveContext::UnsetWidth(const Handle(AIS_InteractiveObject)& anIObj,
2342 const Standard_Boolean updateviewer)
2344 if(anIObj.IsNull()) return ;
2345 anIObj->UnsetWidth();
2346 if(anIObj->RecomputeEveryPrs())
2347 anIObj->Redisplay();
2350 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2351 for (;ITI.More();ITI.Next())
2353 anIObj->Update(ITI.Value(),Standard_False);
2355 anIObj->SetRecomputeOk();
2358 UpdateCurrentViewer();
2361 //=======================================================================
2362 //function : SetMaterial
2364 //=======================================================================
2366 void AIS_InteractiveContext::SetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
2368 const Graphic3d_NameOfMaterial aName,
2369 // const Graphic3d_NameOfPhysicalMaterial aName,
2370 const Standard_Boolean updateviewer)
2372 if(!anIObj->HasInteractiveContext())
2373 anIObj->SetContext(this);
2374 anIObj->SetMaterial(aName);
2375 if(anIObj->RecomputeEveryPrs())
2376 anIObj->Redisplay();
2379 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2380 for (;ITI.More();ITI.Next())
2382 anIObj->Update(ITI.Value(),Standard_False);
2384 anIObj->SetRecomputeOk();
2387 UpdateCurrentViewer();
2391 //=======================================================================
2392 //function : UnsetMaterial
2394 //=======================================================================
2396 void AIS_InteractiveContext::UnsetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
2397 const Standard_Boolean updateviewer)
2399 if(anIObj.IsNull()) return ;
2400 anIObj->UnsetMaterial();
2401 if(anIObj->RecomputeEveryPrs())
2402 anIObj->Redisplay();
2405 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2406 for (;ITI.More();ITI.Next())
2408 anIObj->Update(ITI.Value(),Standard_False);
2410 anIObj->SetRecomputeOk();
2413 UpdateCurrentViewer();
2416 //=======================================================================
2417 //function : SetTransparency
2419 //=======================================================================
2421 void AIS_InteractiveContext::SetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
2422 const Standard_Real aValue,
2423 const Standard_Boolean updateviewer)
2425 if(anIObj.IsNull()) return ;
2426 if(!anIObj->HasInteractiveContext())
2427 anIObj->SetContext(this);
2429 #ifdef BUC60577 //right optimization
2430 if(!anIObj->IsTransparent() && aValue<=0.05) return;
2432 // if(!anIObj->IsTransparent() && aValue<=0.05) return;
2435 UnsetTransparency(anIObj,updateviewer);
2439 if(!myMainVwr->Viewer()->Transparency())
2440 myMainVwr->Viewer()->SetTransparency(Standard_True);
2441 anIObj->SetTransparency(aValue);
2442 if(anIObj->RecomputeEveryPrs())
2443 anIObj->Redisplay();
2446 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2447 for (;ITI.More();ITI.Next())
2449 anIObj->Update(ITI.Value(),Standard_False);
2451 anIObj->SetRecomputeOk();
2454 UpdateCurrentViewer();
2457 //=======================================================================
2458 //function : UnsetTransparency
2460 //=======================================================================
2462 void AIS_InteractiveContext::UnsetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
2463 const Standard_Boolean updateviewer)
2465 if(anIObj.IsNull()) return ;
2466 anIObj->UnsetTransparency();
2467 if(anIObj->RecomputeEveryPrs())
2468 anIObj->Redisplay();
2471 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2472 for (;ITI.More();ITI.Next())
2474 anIObj->Update(ITI.Value(),Standard_False);
2476 anIObj->SetRecomputeOk();
2479 // To Unset transparency in the viewer, if no other object is transparent ...(Speed)
2480 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
2481 Standard_Boolean FoundTransp(Standard_False);
2482 for(;It.More() && !FoundTransp ;It.Next()){
2483 if(It.Key()->IsTransparent())
2484 FoundTransp = Standard_True;
2487 myMainVwr->Viewer()->SetTransparency(Standard_False);
2491 UpdateCurrentViewer();
2494 //=======================================================================
2495 //function : SetDegenerateModel
2497 //=======================================================================
2500 void AIS_InteractiveContext :: SetDegenerateModel (
2501 const Handle( AIS_InteractiveObject )& anObject,
2502 const Aspect_TypeOfDegenerateModel aModel,
2503 const Quantity_Ratio aRatio
2505 if ( !anObject.IsNull () ) {
2506 if ( !anObject -> HasInteractiveContext () )
2507 anObject -> SetContext ( this );
2508 anObject->SetDegenerateModel(aModel,aRatio);
2511 } // end AIS_InteractiveContext :: SetDegenerateModel
2513 void AIS_InteractiveContext :: SetDegenerateModel (
2514 const Aspect_TypeOfDegenerateModel aModel,
2515 const Quantity_Ratio aRatio
2518 AIS_DataMapIteratorOfDataMapOfIOStatus it ( myObjects );
2520 while ( it.More () ) {
2522 Handle( AIS_InteractiveObject ) obj = it.Key ();
2524 obj->SetDegenerateModel(aModel,aRatio);
2530 } // end AIS_InteractiveContext :: SetDegenerateModel
2534 //=======================================================================
2535 //function : SetSelectedAspect
2537 //=======================================================================
2538 void AIS_InteractiveContext::SetSelectedAspect(
2539 const Handle(Prs3d_BasicAspect)& anAspect,
2540 const Standard_Boolean globalChange,
2541 const Standard_Boolean updateViewer) {
2542 if( !HasOpenedContext() ) {
2543 Standard_Boolean found = Standard_False;
2544 Handle(AIS_Selection) sel =
2545 AIS_Selection::Selection(myCurrentName.ToCString());
2546 Handle(AIS_InteractiveObject) object;
2547 for( sel->Init() ; sel->More() ; sel->Next()) {
2548 found = Standard_True;
2549 object = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
2550 object->SetAspect(anAspect,globalChange);
2552 if( found && updateViewer) {
2553 myMainVwr->Update();
2554 if( !(myIsCollClosed && myCollectorVwr.IsNull()) )
2555 myCollectorVwr->Update();
2561 //=======================================================================
2562 //function : SetLocalAttributes
2564 //=======================================================================
2566 void AIS_InteractiveContext::SetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj,
2567 const Handle(AIS_Drawer)& aDrawer,
2568 const Standard_Boolean updateviewer)
2570 if(anIObj.IsNull()) return ;
2571 if(!anIObj->HasInteractiveContext())
2572 anIObj->SetContext(this);
2573 anIObj->SetAttributes(aDrawer);
2574 Update(anIObj,updateviewer);
2578 //=======================================================================
2579 //function : UnsetLocalAttributes
2581 //=======================================================================
2582 void AIS_InteractiveContext::UnsetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj,
2583 const Standard_Boolean updateviewer)
2585 if(anIObj.IsNull()) return ;
2586 if(!anIObj->HasInteractiveContext())
2587 anIObj->SetContext(this);
2588 anIObj->UnsetAttributes();
2589 Update(anIObj,updateviewer);
2593 //=======================================================================
2596 //=======================================================================
2598 void AIS_InteractiveContext::Status(const Handle(AIS_InteractiveObject)& anIObj, TCollection_ExtendedString& astatus) const
2602 if(anIObj.IsNull()) return ;
2603 if(myObjects.IsBound(anIObj)){
2604 astatus += "\t ____________________________________________";
2605 astatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
2606 const Handle(AIS_GlobalStatus)& ST = myObjects(anIObj);
2607 switch(ST->GraphicStatus()){
2608 case AIS_DS_Displayed:
2610 astatus +="\t| -->Displayed\n";
2615 astatus +="\t| -->Erased\n";
2618 case AIS_DS_FullErased:
2620 astatus +="\t| -->Full Erased\n";
2626 astatus += "\t| Active Display Modes in the MainViewer :\n";
2627 TColStd_ListIteratorOfListOfInteger ItL (ST->DisplayedModes());
2628 for(;ItL.More();ItL.Next()){
2629 astatus += "\t|\t Mode ";
2630 astatus += TCollection_AsciiString(ItL.Value());
2633 if(IsCurrent(anIObj)) astatus +="\t| Current\n";
2634 if(IsSelected(anIObj)) astatus +="\t| Selected\n";
2636 astatus += "\t| Active Selection Modes in the MainViewer :\n";
2637 for(ItL.Initialize(ST->SelectionModes());ItL.More();ItL.Next()){
2638 astatus += "\t\t Mode ";
2639 astatus += TCollection_AsciiString(ItL.Value());
2642 astatus += "\t ____________________________________________";
2648 //=======================================================================
2649 //function : GetDefModes
2651 //=======================================================================
2653 void AIS_InteractiveContext::GetDefModes(const Handle(AIS_InteractiveObject)& anIObj,
2654 Standard_Integer& DispMode,
2655 Standard_Integer& HiMode,
2656 Standard_Integer& SelMode) const
2658 if(anIObj.IsNull()) return ;
2659 DispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() :
2660 (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
2662 HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():DispMode;
2664 SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : -1;
2666 SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : 0;
2671 //=======================================================================
2672 //function : EraseGlobal
2674 //=======================================================================
2676 void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& anIObj,
2677 const Standard_Boolean updateviewer,
2678 const Standard_Boolean PutInCollector)
2680 if(anIObj.IsNull()) return ;
2681 if(!myObjects.IsBound(anIObj)) return;
2684 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
2685 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
2687 Standard_Integer Dmode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
2688 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
2690 TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
2691 for(;ItL.More();ItL.Next()){
2692 if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
2693 myMainPM->Unhighlight(anIObj,ItL.Value());
2694 myMainPM->Erase(anIObj,ItL.Value());
2696 if(IsCurrent(anIObj) && !STATUS->IsDModeIn(Dmode))
2697 myMainPM->Erase(anIObj,Dmode);
2699 for(ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
2700 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
2701 if(updateviewer) myMainVwr->Update();
2703 if(PutInCollector && !myCollectorPM.IsNull()){
2704 myCollectorPM->Display(anIObj,Dmode);
2706 Standard_Integer SMode = anIObj->SelectionMode();
2707 mgrSelector->Activate(anIObj,SMode,myCollectorSel);
2709 mgrSelector->Activate(anIObj,0,myCollectorSel);
2711 if(STATUS->IsHilighted())
2712 myCollectorPM->Highlight(anIObj,Dmode);
2713 STATUS->SetGraphicStatus(AIS_DS_Erased);
2714 if(updateviewer) myCollectorVwr->Update();
2717 STATUS->SetGraphicStatus(AIS_DS_FullErased);
2721 //=======================================================================
2722 //function : ClearGlobal
2724 //=======================================================================
2726 void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& anIObj,
2727 const Standard_Boolean updateviewer)
2729 if(anIObj.IsNull()) return ;
2730 if(!myObjects.IsBound(anIObj)) return;
2732 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
2733 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
2735 TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
2736 for(;ItL.More();ItL.Next()){
2737 if(STATUS->IsHilighted()){
2738 if(IsCurrent(anIObj))
2740 AddOrRemoveCurrentObject( anIObj, updateviewer );
2742 AddOrRemoveCurrentObject(anIObj);
2744 else if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
2745 myMainPM->Unhighlight(anIObj,ItL.Value());
2747 myMainPM->Erase(anIObj,ItL.Value());
2748 myMainPM->Clear(anIObj,ItL.Value());
2749 if(anIObj->HasHilightMode()){
2750 Standard_Integer im = anIObj->HilightMode();
2751 myMainPM->Unhighlight(anIObj,im);
2752 myMainPM->Erase(anIObj,im);
2757 //Object removes from Detected sequence
2758 Standard_Integer i = 1;
2759 for(i = 1; i < myAISDetectedSeq.Length(); i++)
2761 Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
2762 if( !anObj.IsNull() && anObj != anIObj )
2763 myAISDetectedSeq.Remove( i );
2766 if(myWasLastMain && !myLastinMain.IsNull())
2767 if(myLastinMain == anIObj)
2768 myLastinMain.Nullify();
2770 if(!myWasLastMain && !myLastinColl.IsNull())
2771 if(myLastinColl == anIObj)
2772 myLastinColl.Nullify();
2774 if(myLastPicked == anIObj)
2775 myLastPicked.Nullify();
2777 // OCC21671: Remove IO from the selection manager in any case
2778 // to avoid memory leaks
2779 mgrSelector->Remove(anIObj);
2781 switch(STATUS->GraphicStatus()){
2784 Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
2785 if(STATUS->IsHilighted()){
2786 myCollectorPM->Unhighlight(anIObj,DM);
2788 myCollectorPM->Erase(anIObj,DM);
2789 myCollectorPM->Clear(anIObj,DM);
2790 if(updateviewer) myCollectorVwr->Update();
2793 case AIS_DS_Displayed:
2795 if(updateviewer) myMainVwr->Update();
2801 myObjects.UnBind(anIObj);
2805 //=======================================================================
2806 //function : ClearGlobalPrs
2808 //=======================================================================
2810 void AIS_InteractiveContext::ClearGlobalPrs(const Handle(AIS_InteractiveObject)& anIObj,
2811 const Standard_Integer aMode,
2812 const Standard_Boolean updateviewer)
2814 if(anIObj.IsNull()) return ;
2815 if(!myObjects.IsBound(anIObj)) return;
2816 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
2818 Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
2819 if(STATUS->IsDModeIn(aMode)){
2820 if(DM==aMode && myMainPM->IsHighlighted(anIObj,aMode))
2821 myMainPM->Unhighlight(anIObj,aMode);
2823 myMainPM->Erase(anIObj,aMode);
2824 myMainPM->Clear(anIObj,aMode);
2827 if(STATUS->GraphicStatus()== AIS_DS_Erased)
2830 if(STATUS->IsHilighted())
2831 myCollectorPM->Unhighlight(anIObj,aMode);
2832 myCollectorPM->Erase(anIObj,DM);
2833 myCollectorPM->Clear(anIObj,DM);
2835 if(updateviewer) myCollectorVwr->Update();
2837 else if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer)
2838 myMainVwr->Update();
2841 //=======================================================================
2842 //function : DrawHiddenLine
2844 //=======================================================================
2846 Standard_Boolean AIS_InteractiveContext::DrawHiddenLine () const {
2848 return myDefaultDrawer->DrawHiddenLine();
2851 //=======================================================================
2852 //function : EnableDrawHiddenLine
2854 //=======================================================================
2856 void AIS_InteractiveContext::EnableDrawHiddenLine () const {
2857 myDefaultDrawer->EnableDrawHiddenLine();
2860 //=======================================================================
2861 //function : DisableDrawHiddenLine
2863 //=======================================================================
2865 void AIS_InteractiveContext::DisableDrawHiddenLine () const {
2866 myDefaultDrawer->DisableDrawHiddenLine();
2869 //=======================================================================
2870 //function : HiddenLineAspect
2872 //=======================================================================
2874 Handle (Prs3d_LineAspect) AIS_InteractiveContext::HiddenLineAspect () const {
2875 return myDefaultDrawer->HiddenLineAspect();
2878 //=======================================================================
2879 //function : SetHiddenLineAspect
2881 //=======================================================================
2883 void AIS_InteractiveContext::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) const {
2884 myDefaultDrawer->SetHiddenLineAspect(anAspect);
2887 //=======================================================================
2888 //function : SetIsoNumber
2890 //=======================================================================
2892 void AIS_InteractiveContext::SetIsoNumber(const Standard_Integer Nb,const AIS_TypeOfIso Type)
2896 myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
2899 myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
2902 myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
2903 myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
2908 //=======================================================================
2909 //function : IsoNumber
2911 //=======================================================================
2913 Standard_Integer AIS_InteractiveContext::IsoNumber(const AIS_TypeOfIso Type)
2918 return myDefaultDrawer->UIsoAspect()->Number();
2920 return myDefaultDrawer->VIsoAspect()->Number();
2922 return (myDefaultDrawer->UIsoAspect()->Number()==
2923 myDefaultDrawer->VIsoAspect()->Number()) ?
2924 myDefaultDrawer->UIsoAspect()->Number(): -1;
2929 //=======================================================================
2930 //function : IsoOnPlane
2932 //=======================================================================
2934 void AIS_InteractiveContext::IsoOnPlane(const Standard_Boolean SwitchOn)
2936 myDefaultDrawer->SetIsoOnPlane(SwitchOn);
2939 //=======================================================================
2940 //function : IsoOnPlane
2942 //=======================================================================
2944 Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const
2946 return myDefaultDrawer->IsoOnPlane();
2949 //=======================================================================
2950 //function : SetSelectionMode
2952 //=======================================================================
2954 void AIS_InteractiveContext::SetSelectionMode(const Handle_AIS_InteractiveObject&, const Standard_Integer )
2958 //=======================================================================
2959 //function : UnsetSelectionMode
2961 //=======================================================================
2963 void AIS_InteractiveContext::UnsetSelectionMode(const Handle_AIS_InteractiveObject&)
2968 //=======================================================================
2969 //function : SetSensitivity
2971 //=======================================================================
2973 void AIS_InteractiveContext::SetSensitivity(const Standard_Real aPrecision) {
2975 if( HasOpenedContext() )
2976 myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
2978 myMainSel->SetSensitivity(aPrecision);
2979 if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivity(aPrecision);
2983 //=======================================================================
2984 //function : SetSensitivity
2986 //=======================================================================
2988 void AIS_InteractiveContext::SetSensitivity(const Standard_Integer aPrecision) {
2990 if( HasOpenedContext() )
2991 myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
2993 myMainSel->Set(aPrecision);
2994 if( !myCollectorSel.IsNull() ) myCollectorSel->Set(aPrecision);
2999 //=======================================================================
3000 //function : IsInLocal
3002 //=======================================================================
3004 Standard_Boolean AIS_InteractiveContext::IsInLocal(const Handle_AIS_InteractiveObject& anIObj,
3005 Standard_Integer& TheIndex) const
3007 if(anIObj.IsNull()) return Standard_False;
3008 // if it exists at neutral point 0 index is returned
3009 if(myObjects.IsBound(anIObj)) {
3011 return Standard_False;
3013 for(Standard_Integer I=1;I<=myLocalContexts.Extent();I++){
3014 if(myLocalContexts.IsBound(I)){
3015 if(myLocalContexts(I)->IsIn(anIObj)){
3017 return Standard_True;
3023 return Standard_False;
3026 //=======================================================================
3027 //function : InitAttributes
3029 //=======================================================================
3031 void AIS_InteractiveContext::InitAttributes()
3034 mgrSelector->Add(myMainSel);
3035 myCurrentName = AIS_Context_NewCurName();
3036 mySelectionName = AIS_Context_NewSelName();
3038 AIS_Selection::CreateSelection(mySelectionName.ToCString());
3039 AIS_Selection::CreateSelection(myCurrentName.ToCString());
3042 myDefaultDrawer->SetShadingAspectGlobal(Standard_False);
3043 Graphic3d_MaterialAspect aMat(Graphic3d_NOM_BRASS);
3044 myDefaultDrawer->ShadingAspect()->SetMaterial(aMat);
3046 // myDefaultDrawer->ShadingAspect()->SetColor(Quantity_NOC_GRAY70);
3047 Handle (Prs3d_LineAspect) HLA = myDefaultDrawer->HiddenLineAspect();
3048 HLA->SetColor(Quantity_NOC_GRAY20);
3050 HLA->SetTypeOfLine(Aspect_TOL_DASH);
3052 // tolerance to 4 pixels...
3059 // Customizing the drawer for trihedrons and planes...
3061 Handle (Prs3d_DatumAspect) DA = myDefaultDrawer->DatumAspect();
3062 Standard_Real aLength(100.);
3063 DA->SetAxisLength(aLength,aLength,aLength);
3064 Quantity_NameOfColor col = Quantity_NOC_LIGHTSTEELBLUE4;
3065 DA->FirstAxisAspect()->SetColor(col);
3066 DA->SecondAxisAspect()->SetColor(col);
3067 DA->ThirdAxisAspect()->SetColor(col);
3069 Handle(Prs3d_PlaneAspect)PA = myDefaultDrawer->PlaneAspect();
3071 PA->SetPlaneLength(aLength,aLength);
3072 PA->EdgesAspect()->SetColor(Quantity_NOC_SKYBLUE);
3078 //=======================================================================
3079 //function : TrihedronSize
3081 //=======================================================================
3082 Standard_Real AIS_InteractiveContext::TrihedronSize() const
3084 return myDefaultDrawer->DatumAspect()->FirstAxisLength();
3086 //=======================================================================
3087 //function : SetTrihedronSize
3089 //=======================================================================
3090 void AIS_InteractiveContext::SetTrihedronSize(const Standard_Real aVal,const Standard_Boolean /*updateviewer*/)
3092 myDefaultDrawer->DatumAspect()->SetAxisLength(aVal,aVal,aVal);
3093 Redisplay(AIS_KOI_Datum,3,Standard_False);
3094 Redisplay(AIS_KOI_Datum,4,Standard_True);
3099 //=======================================================================
3100 //function : SetPlaneSize
3102 //=======================================================================
3103 void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aValX,
3104 const Standard_Real aValY,
3105 const Standard_Boolean /*updateviewer*/)
3107 myDefaultDrawer->PlaneAspect()->SetPlaneLength(aValX,aValY);
3108 Redisplay(AIS_KOI_Datum,7);
3111 //=======================================================================
3112 //function : SetPlaneSize
3114 //=======================================================================
3116 void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aVal,
3117 const Standard_Boolean updateviewer)
3119 SetPlaneSize(aVal,aVal,updateviewer);
3122 //=======================================================================
3123 //function : PlaneSize
3125 //=======================================================================
3127 Standard_Boolean AIS_InteractiveContext::PlaneSize(Standard_Real& LX,Standard_Real& LY) const
3129 LX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
3130 LY = myDefaultDrawer->PlaneAspect()->PlaneYLength();
3131 return (Abs(LX-LY)<=Precision::Confusion());
3136 //=======================================================================
3139 //=======================================================================
3140 void AIS_InteractiveContext::SetAutoActivateSelection( const Standard_Boolean Auto )
3142 myIsAutoActivateSelMode = Auto;
3145 //=======================================================================
3148 //=======================================================================
3149 Standard_Boolean AIS_InteractiveContext::GetAutoActivateSelection() const
3151 return myIsAutoActivateSelMode;