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 <UnitsAPI.hxx>
62 #include <AIS_Trihedron.hxx>
63 #include <Geom_Axis2Placement.hxx>
64 #include <OSD_Environment.hxx>
66 #include <AIS_ListIteratorOfListOfInteractive.hxx>
68 // In the method GetDefModes() the returned value of the selection mode
69 // is always equal to 0 if it is -1.
72 // On close the local context the method ::ResetOriginalState() sets the selection mode equal to 0
73 // in spite of the selection mode of the interactive object in Natural Point.
76 // An interactive Object being erased in the main viewer and put into collector should have the same selection mode.
77 // It impacts the performance!
80 static Standard_Boolean AISDebugModeOn()
82 // static OSD_Environment aisdb("AISDEBUGMODE");
83 // return !aisdb.Value().IsEmpty();
84 static Standard_Integer isDebugMode(-1);
85 if (isDebugMode < 0) {
87 OSD_Environment aisdb("AISDEBUGMODE");
88 if (aisdb.Value().IsEmpty())
91 return (isDebugMode != 0);
94 static TCollection_AsciiString AIS_Context_NewSelName()
96 static Standard_Integer index_sel = 1;
97 TCollection_AsciiString name("AIS_SelContext_");
98 TCollection_AsciiString theind(index_sel);
104 static TCollection_AsciiString AIS_Context_NewCurName()
106 static Standard_Integer index_cur = 1;
107 TCollection_AsciiString name("AIS_CurContext_");
108 TCollection_AsciiString theind(index_cur);
114 static TColStd_ListIteratorOfListOfInteger ItL;
117 //=======================================================================
118 //function : AIS_InteractiveContext
120 //=======================================================================
122 AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer):
123 mgrSelector(new SelectMgr_SelectionManager()),
124 myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
125 myMainVwr(MainViewer),
126 myMainSel(new StdSelect_ViewerSelector3d()),
127 myIsCollClosed(Standard_True),
128 myToHilightSelected( Standard_False ),
129 myFilters(new SelectMgr_OrFilter()),
130 myDefaultDrawer(new Prs3d_Drawer()),
131 myDefaultColor(Quantity_NOC_GOLDENROD),
132 myHilightColor(Quantity_NOC_CYAN1),
133 mySelectionColor(Quantity_NOC_GRAY80),
134 myPreselectionColor(Quantity_NOC_GREEN),
135 mySubIntensity(Quantity_NOC_GRAY40),
141 myIsAutoActivateSelMode( Standard_True )
147 //=======================================================================
148 //function : AIS_InteractiveContext
150 //=======================================================================
152 AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer,
153 const Handle(V3d_Viewer)& Collector):
154 mgrSelector(new SelectMgr_SelectionManager()),
155 myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
156 myMainVwr(MainViewer),
157 myMainSel(new StdSelect_ViewerSelector3d()),
158 myCollectorPM(new PrsMgr_PresentationManager3d(Collector->Viewer())),
159 myCollectorVwr(Collector),
160 myCollectorSel(new StdSelect_ViewerSelector3d()),
161 myIsCollClosed(Standard_False),
162 myToHilightSelected( Standard_False ),
163 myFilters(new SelectMgr_OrFilter()),
164 myDefaultDrawer(new Prs3d_Drawer()),
165 myDefaultColor(Quantity_NOC_GOLDENROD),
166 myHilightColor(Quantity_NOC_CYAN1),
167 mySelectionColor(Quantity_NOC_GRAY80),
168 myPreselectionColor(Quantity_NOC_GREEN),
169 mySubIntensity(Quantity_NOC_GRAY40),
175 myIsAutoActivateSelMode( Standard_True )
178 mgrSelector->Add(myCollectorSel);
182 myCollectorSel->Set(4);
187 void AIS_InteractiveContext::Delete() const
190 // to avoid an exception
191 if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
192 AIS_Selection::Remove( mySelectionName.ToCString() );
194 // to avoid an exception
195 if ( AIS_Selection::Find( myCurrentName.ToCString() ) )
196 AIS_Selection::Remove( myCurrentName.ToCString() );
198 // let's remove one reference explicitly. this operation's supposed to
199 // be performed when mgrSelector will be destroyed but anyway...
200 mgrSelector->Remove( myMainSel );
202 MMgt_TShared::Delete();
205 //=======================================================================
206 //function : AIS_SelectionName
208 //=======================================================================
209 const TCollection_AsciiString& AIS_InteractiveContext::SelectionName() const
211 if(!HasOpenedContext())
212 return mySelectionName;
213 return myLocalContexts(myCurLocalIndex)->SelectionName();
219 //=======================================================================
220 //function : UpdateCurrentViewer
222 //=======================================================================
224 void AIS_InteractiveContext::UpdateCurrentViewer()
226 if (!myMainVwr.IsNull())
230 void AIS_InteractiveContext::OpenCollector()
232 myIsCollClosed =Standard_True;
238 //=======================================================================
239 //function : DomainOfMainViewer
241 //=======================================================================
243 Standard_CString AIS_InteractiveContext::DomainOfMainViewer() const
245 return myMainVwr->Domain();
249 //=======================================================================
250 //function : DisplayedObjects
252 //=======================================================================
254 void AIS_InteractiveContext::DisplayedObjects(AIS_ListOfInteractive& aListOfIO,
255 const Standard_Boolean OnlyFromNeutral) const
258 cout<<"AIS_IC::DisplayedObjects"<<endl;
261 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
262 if(!HasOpenedContext() || OnlyFromNeutral){
263 for(;It.More();It.Next()){
264 if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
265 aListOfIO.Append(It.Key());
269 TColStd_MapOfTransient theMap;
271 for(;It.More();It.Next()){
272 if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
273 theMap.Add(It.Key());
276 cout<<"\tFrom Neutral Point : "<<theMap.Extent()<<endl;
279 //balayons tous les contextes locaux...
280 Standard_Integer NbDisp;
281 for(AIS_DataMapIteratorOfDataMapOfILC it1(myLocalContexts);it1.More();it1.Next()){
282 const Handle(AIS_LocalContext)& LC = it1.Value();
283 NbDisp = LC->DisplayedObjects(theMap);
285 cout<<"\tIn Local Context "<<it1.Key()<<" : "<<NbDisp<<endl;
289 Handle(AIS_InteractiveObject) curIO;
290 Handle(Standard_Transient) Tr;
291 for(TColStd_MapIteratorOfMapOfTransient it2(theMap);it2.More();it2.Next()){
293 curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
294 aListOfIO.Append(curIO);
298 //=======================================================================
299 //function : DisplayedObjects
301 //=======================================================================
303 void AIS_InteractiveContext::DisplayedObjects(const AIS_KindOfInteractive TheKind,
304 const Standard_Integer TheSign,
305 AIS_ListOfInteractive& aListOfIO,
306 const Standard_Boolean /*OnlyFromNeutral*/) const
308 ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Displayed, aListOfIO );
311 //=======================================================================
312 //function : UpdateCollector
314 //=======================================================================
316 void AIS_InteractiveContext::UpdateCollector()
318 if (!myCollectorVwr.IsNull())
319 myCollectorVwr->Update();
322 //=======================================================================
323 //function : DomainOfCollector
325 //=======================================================================
327 Standard_CString AIS_InteractiveContext::DomainOfCollector() const
329 if(myCollectorVwr.IsNull()) return "";
330 return myCollectorVwr->Domain();
333 //=======================================================================
334 //function : ObjectsInCollector
336 //=======================================================================
338 void AIS_InteractiveContext::ObjectsInCollector(AIS_ListOfInteractive& aListOfIO) const
340 ObjectsByDisplayStatus( AIS_DS_Erased, aListOfIO );
343 //=======================================================================
344 //function : ObjectsInCollector
346 //=======================================================================
348 void AIS_InteractiveContext::ObjectsInCollector(const AIS_KindOfInteractive TheKind,
349 const Standard_Integer TheSign,
350 AIS_ListOfInteractive& aListOfIO) const
352 ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, aListOfIO );
355 //=======================================================================
356 //function : ErasedObjects
358 //=======================================================================
360 void AIS_InteractiveContext::ErasedObjects(AIS_ListOfInteractive& theListOfIO) const
362 ObjectsByDisplayStatus( AIS_DS_FullErased, theListOfIO );
365 //=======================================================================
366 //function : ErasedObjects
368 //=======================================================================
370 void AIS_InteractiveContext::ErasedObjects(const AIS_KindOfInteractive TheKind,
371 const Standard_Integer TheSign,
372 AIS_ListOfInteractive& theListOfIO) const
374 ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_FullErased, theListOfIO );
377 //=======================================================================
378 //function : ObjectsByDisplayStatus
380 //=======================================================================
382 void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_DisplayStatus theStatus,
383 AIS_ListOfInteractive& theListOfIO) const
385 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
386 for(;It.More();It.Next()){
387 if(It.Value()->GraphicStatus() == theStatus)
388 theListOfIO.Append(It.Key());
392 //=======================================================================
393 //function : ObjectsByDisplayStatus
395 //=======================================================================
397 void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_KindOfInteractive TheKind,
398 const Standard_Integer TheSign,
399 const AIS_DisplayStatus theStatus,
400 AIS_ListOfInteractive& theListOfIO) const
402 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
403 for(;It.More();It.Next()){
404 if(It.Value()->GraphicStatus()==theStatus){
405 if(It.Key()->Type()==TheKind){
407 theListOfIO.Append(It.Key());
409 if(It.Key()->Signature()==TheSign)
410 theListOfIO.Append(It.Key());
417 //=======================================================================
418 //function : ObjectsInside
420 //=======================================================================
422 void AIS_InteractiveContext::ObjectsInside(AIS_ListOfInteractive& aListOfIO,
423 const AIS_KindOfInteractive TheKind,
424 const Standard_Integer TheSign) const
426 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
427 if(TheKind==AIS_KOI_None && TheSign ==-1){
428 for(;It.More();It.Next()){
429 aListOfIO.Append(It.Key());
433 for(;It.More();It.Next()){
434 if(It.Key()->Type()==TheKind){
436 aListOfIO.Append(It.Key());
438 if(It.Key()->Signature()==TheSign)
439 aListOfIO.Append(It.Key());
446 //=======================================================================
449 //=======================================================================
451 void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
452 const Standard_Boolean updateviewer )
454 if(anIObj.IsNull()) return;
456 Standard_Integer DispMode,HiMod,SelMode;
458 GetDefModes(anIObj,DispMode,HiMod,SelMode);
460 Handle (AIS_InteractiveContext) aThis = this;
461 if(!anIObj->HasInteractiveContext())
462 anIObj->SetContext(aThis);
464 //PAS DE CONTEXTE LOCAL OUVERT
465 if(!HasOpenedContext()) {
467 // SAN : Do not return here. Perform advanced display mode analysis a bit later...
468 if(IsDisplayed(anIObj)) return;
470 Standard_Boolean updcol = Standard_False;
472 // il n'existait pas encore
473 if(!myObjects.IsBound(anIObj)){
475 Handle(AIS_GlobalStatus) STATUS=
477 new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,SelMode);
479 new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,0);
481 myObjects.Bind (anIObj,STATUS);
482 myMainPM->Display(anIObj,DispMode);
483 if( myIsAutoActivateSelMode )
485 if(!mgrSelector->Contains(anIObj))
486 mgrSelector->Load(anIObj);
487 mgrSelector->Activate(anIObj,SelMode,myMainSel);
490 if(updateviewer) myMainVwr->Update();
492 // il est quelque part ailleurs....
495 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
496 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
498 switch (STATUS->GraphicStatus()){
500 if(STATUS->IsHilighted())
501 myCollectorPM->Unhighlight(anIObj,HiMod);
502 myCollectorPM->Erase(anIObj,HiMod);
503 mgrSelector->Deactivate(anIObj,myCollectorSel);
504 updcol = updateviewer;
505 }// attention on fait expres de ne pas mettre de break..
506 case AIS_DS_FullErased:{
507 for (ItL.Initialize(STATUS->DisplayedModes());ItL.More();ItL.Next()){
508 myMainPM->Display(anIObj,ItL.Value());
509 if(STATUS->IsSubIntensityOn())
510 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
512 if( myIsAutoActivateSelMode )
513 for (ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
514 mgrSelector->Activate(anIObj,ItL.Value(),myMainSel);
515 STATUS->SetGraphicStatus(AIS_DS_Displayed);
516 if(STATUS->IsHilighted())
517 myMainPM->Highlight(anIObj,HiMod);
521 // SAN : erase presentations for all display modes different from <DispMode>;
522 // then make sure <DispMode> is displayed and maybe highlighted;
523 // Finally, activate selection mode <SelMode> if not yet activated.
524 case AIS_DS_Displayed:{
525 TColStd_ListOfInteger aModesToRemove;
526 for(ItL.Initialize(STATUS->DisplayedModes());ItL.More();ItL.Next()){
528 Standard_Integer OldMode = ItL.Value();
530 if(OldMode!=DispMode){
531 aModesToRemove.Append(OldMode);
532 if(myMainPM->IsHighlighted(anIObj,OldMode))
533 myMainPM->Unhighlight(anIObj,OldMode);
534 myMainPM->Erase(anIObj,OldMode);
538 for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
539 STATUS->RemoveDisplayMode(ItL.Value());
541 if(!STATUS->IsDModeIn(DispMode))
542 STATUS->AddDisplayMode(DispMode);
544 myMainPM->Display(anIObj,DispMode);
545 if(STATUS->IsHilighted()){
546 myMainPM->Highlight(anIObj,HiMod);
548 if( myIsAutoActivateSelMode )
550 if(!mgrSelector->Contains(anIObj))
551 mgrSelector->Load(anIObj);
552 if(!mgrSelector->IsActivated(anIObj,SelMode))
553 mgrSelector->Activate(anIObj,SelMode,myMainSel);
564 if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
565 myMainVwr->Viewer()->SetTransparency(Standard_True);
566 if(updateviewer) myMainVwr->Update();
567 if(updcol && !myCollectorVwr.IsNull()) myCollectorVwr->Update();
570 // CONTEXTE LOCAL OUVERT
573 myLocalContexts(myCurLocalIndex)->Display(anIObj,DispMode,anIObj->AcceptShapeDecomposition(),SelMode);
575 if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
576 myMainVwr->Viewer()->SetTransparency(Standard_True);
579 if(updateviewer) myMainVwr->Update();
583 //=======================================================================
586 //=======================================================================
588 void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
589 const Standard_Integer aDisplayMode,
590 const Standard_Integer aSelectionMode,
591 const Standard_Boolean updateviewer,
592 const Standard_Boolean allowdecomposition)
594 if(anIObj.IsNull()) return;
596 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
598 // si aucun contexte local...
599 if(!HasOpenedContext()) {
600 // if(!anIObj->HasDisplayMode())
601 // anIObj->SetDisplayMode(aDisplayMode);
603 if(!myObjects.IsBound(anIObj)){
604 Handle(AIS_GlobalStatus) STATUS=
605 new AIS_GlobalStatus(AIS_DS_Displayed,aDisplayMode,aSelectionMode);
606 myObjects.Bind (anIObj,STATUS);
607 myMainPM->Display(anIObj,aDisplayMode);
608 if(aSelectionMode!=-1){
609 if(!mgrSelector->Contains(anIObj))
610 mgrSelector->Load(anIObj,aSelectionMode);
611 mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
613 if(updateviewer) myMainVwr->Update();
615 // anIObj->SelectionMode(aSelectionMode);
618 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
619 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
621 if(!STATUS->IsDModeIn(aDisplayMode)){
622 myMainPM->Display(anIObj,aDisplayMode);
623 STATUS->AddDisplayMode(aDisplayMode);
624 if(STATUS->IsSubIntensityOn())
625 myMainPM->Color(anIObj,mySubIntensity,aDisplayMode);
627 if(aSelectionMode!=-1){
628 STATUS->AddSelectionMode(aSelectionMode);
629 mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
631 if(updateviewer) myMainVwr->Update();
637 myLocalContexts(myCurLocalIndex)->Display(anIObj,aDisplayMode,allowdecomposition,aSelectionMode);
638 if(updateviewer) myMainVwr->Update();
643 //=======================================================================
646 //=======================================================================
648 void AIS_InteractiveContext::Load(const Handle(AIS_InteractiveObject)& anIObj,
649 const Standard_Integer SelMode,
650 const Standard_Boolean AllowDecomposition)
652 if(anIObj.IsNull()) return;
653 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
656 if(!HasOpenedContext()) {
657 if(SelMode==-1 && !AllowDecomposition){
658 Standard_Integer DispMode,HiMod,SelModeDef;
660 GetDefModes(anIObj,DispMode,HiMod,SelModeDef);
661 Handle(AIS_GlobalStatus) STATUS=
662 new AIS_GlobalStatus(AIS_DS_FullErased,DispMode,SelModeDef);
663 myObjects.Bind (anIObj,STATUS);
667 myLocalContexts(myCurLocalIndex)->Load(anIObj,AllowDecomposition,SelMode);
671 //=======================================================================
674 //=======================================================================
676 void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj,
677 const Standard_Boolean updateviewer,
678 const Standard_Boolean PutInCollector)
680 if(anIObj.IsNull()) return;
682 if ( !anIObj->IsAutoHilight() )
683 anIObj->ClearSelected();
685 if(!HasOpenedContext()){
686 EraseGlobal(anIObj,updateviewer,PutInCollector);
690 // d'abors on regarde si on peut effacer dans le contexte local courant
691 // ensuite, on essaye d'effacer dans les autres contextes locaux,
692 // s'ils le permettent...
694 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Erase(anIObj);
696 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
697 for (;It.More();It.Next()){
698 if(It.Value()->AcceptErase())
700 WasInCtx |= It.Value()->Erase(anIObj);
702 WasInCtx = It.Value()->Erase(anIObj);
707 EraseGlobal(anIObj,updateviewer,PutInCollector);
709 if(updateviewer) myMainVwr->Update();
712 //=======================================================================
715 //=======================================================================
717 void AIS_InteractiveContext::EraseMode(const Handle(AIS_InteractiveObject)& anIObj,
718 const Standard_Integer aMode,
719 const Standard_Boolean /*updateviewer*/)
721 if(anIObj.IsNull()) return;
723 if(!myObjects.IsBound(anIObj)) return;
725 if(anIObj->HasDisplayMode()){
726 if(anIObj->DisplayMode()==aMode) return;
728 else if(myDisplayMode==aMode) return;
730 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
731 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
733 if(STATUS->GraphicStatus()!=AIS_DS_Displayed) return;
736 // if(STATUS->IsDModeIn(aMode)) {}
741 //=======================================================================
742 //function : EraseAll
744 //=======================================================================
746 void AIS_InteractiveContext::EraseAll(const Standard_Boolean PutInCollector,
747 const Standard_Boolean updateviewer)
749 if(!HasOpenedContext()){
750 AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects);
752 for(;ItM.More();ItM.Next()){
753 if(ItM.Value()->GraphicStatus() == AIS_DS_Displayed)
754 Erase(ItM.Key(),Standard_False,PutInCollector);
758 if (PutInCollector && !myCollectorVwr.IsNull())
759 myCollectorVwr->Update();
765 //=======================================================================
766 //function : DisplayAll
768 //=======================================================================
770 void AIS_InteractiveContext::DisplayAll(const Standard_Boolean OnlyFromCollector,
771 const Standard_Boolean updateviewer)
773 if(!HasOpenedContext()){
774 Standard_Boolean FoundInCollector(Standard_False);
775 AIS_DisplayStatus aDStatus = OnlyFromCollector ? AIS_DS_Erased : AIS_DS_FullErased,TheStatus;
777 if(!HasOpenedContext()){
778 AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects);
780 for(;ItM.More();ItM.Next()){
781 TheStatus = ItM.Value()->GraphicStatus();
782 if(TheStatus == aDStatus)
783 Display(ItM.Key(),Standard_False);
784 if(TheStatus == AIS_DS_Erased)
785 FoundInCollector = Standard_True;
789 if(FoundInCollector && !myCollectorVwr.IsNull())
790 myCollectorVwr->Update();
797 //=======================================================================
798 //function : DisplaySelected
800 //=======================================================================
802 void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer)
805 if(!HasOpenedContext()){
806 Standard_Boolean found = Standard_False;
807 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
808 Handle(AIS_InteractiveObject) iObj;
809 for (sel->Init();sel->More();sel->Next()) {
810 iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
811 Display(iObj,Standard_False);
812 found = Standard_True;
814 if(found && updateviewer) {
816 if(!(myIsCollClosed && myCollectorVwr.IsNull()))
818 myCollectorVwr->Update();
824 //=======================================================================
825 //function : EraseSelected
827 //=======================================================================
829 void AIS_InteractiveContext::EraseSelected(const Standard_Boolean PutInCollector,
830 const Standard_Boolean updateviewer)
833 if(!HasOpenedContext()){
834 Standard_Boolean found = Standard_False;
835 Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
836 Handle(AIS_InteractiveObject) iObj;
837 for(sel->Init();sel->More();sel->Next()) {
838 iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
839 Erase(iObj,Standard_False,PutInCollector);
840 found = Standard_True;
842 if(found && updateviewer) {
844 if(PutInCollector && !myCollectorVwr.IsNull())
845 myCollectorVwr->Update();
849 //=======================================================================
852 //=======================================================================
854 Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_InteractiveObject)& anIObj,
855 const Standard_Integer WhichContext)
857 if(anIObj.IsNull()) return Standard_False;
859 if(!HasOpenedContext()) return Standard_False;
860 if(myObjects.IsBound(anIObj)) return Standard_False;
861 if(WhichContext!=-1 && !myLocalContexts.IsBound(WhichContext)) return Standard_False;
863 // Protection : si on essaye de conserver un objet temporaire
864 // qui n'est pas dans le contexte local actif... rob 11-06-97
866 Standard_Integer IsItInLocal = myCurLocalIndex;
867 Standard_Boolean Found(Standard_False);
869 while(IsItInLocal>0 && !Found){
870 if(!myLocalContexts.IsBound(IsItInLocal))
872 else if(myLocalContexts(IsItInLocal)->IsIn(anIObj))
873 Found = Standard_True;
878 if(!Found) return Standard_False;
881 // const Handle(AIS_LocalStatus)& LS = (WhichContext== -1) ?
882 // myLocalContexts(IsItInLocal)->Status(anIObj):myLocalContexts(WhichContext)->Status(anIObj);
884 // const Handle(AIS_LocalStatus)& LS = myLocalContexts(IsItInLocal)->Status(anIObj);
885 Handle(AIS_LocalStatus) LS = myLocalContexts(IsItInLocal)->Status(anIObj);
889 if(LS->IsTemporary()){
890 Standard_Integer DM,HM,SM;
891 GetDefModes(anIObj,DM,HM,SM);
893 SM = LS->SelectionModes().IsEmpty() ? SM : LS->SelectionModes().First();
894 if(LS->DisplayMode()!= DM ){
895 Standard_Integer LSM = LS->SelectionModes().IsEmpty() ? -1 : LS->SelectionModes().First();
896 myLocalContexts(IsItInLocal)->Display(anIObj,DM,LS->Decomposed(),LSM);
899 Handle (AIS_GlobalStatus) GS = new AIS_GlobalStatus(AIS_DS_Displayed,
903 // GS->SubIntensityOn();
904 myObjects.Bind(anIObj,GS);
905 mgrSelector->Load(anIObj);
906 mgrSelector->Activate(anIObj,SM,myMainSel);
908 LS->SetTemporary(Standard_False);
910 return Standard_True;
914 //=======================================================================
916 //=======================================================================
918 AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus(const Handle(AIS_InteractiveObject)& anIObj) const
920 if(anIObj.IsNull()) return AIS_DS_None;
922 if(myObjects.IsBound(anIObj))
923 return myObjects(anIObj)->GraphicStatus();
925 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
926 for(;ItM.More();ItM.Next()){
927 if(ItM.Value()->IsIn(anIObj))
928 return AIS_DS_Temporary;
938 //=======================================================================
939 //function : DisplayedModes
941 //=======================================================================
943 const TColStd_ListOfInteger& AIS_InteractiveContext::
944 DisplayedModes(const Handle(AIS_InteractiveObject)& anIObj) const
946 return myObjects(anIObj)->DisplayedModes();
950 //=======================================================================
953 //=======================================================================
954 void AIS_InteractiveContext::Remove(const Handle(AIS_InteractiveObject)& anIObj,
955 const Standard_Boolean updateviewer)
958 if(anIObj.IsNull()) return;
960 if(!HasOpenedContext()){
961 ClearGlobal(anIObj,updateviewer);
965 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
966 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
967 for (;It.More() ;It.Next()){
968 if(It.Value()->AcceptErase())
969 WasInCtx = It.Value()->Remove(anIObj);
973 ClearGlobal(anIObj,updateviewer);
975 // if(updateviewer) myMainVwr->Update();
979 //=======================================================================
980 //function : RemoveAll
982 //=======================================================================
983 void AIS_InteractiveContext::RemoveAll(const Standard_Boolean updateviewer)
985 AIS_ListOfInteractive aList;
986 ObjectsInside(aList);
987 AIS_ListIteratorOfListOfInteractive aListIterator;
988 for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
989 Remove(aListIterator.Value(), Standard_False);
996 //=======================================================================
999 //=======================================================================
1001 void AIS_InteractiveContext::Clear(const Handle(AIS_InteractiveObject)& anIObj,
1002 const Standard_Boolean updateviewer)
1004 if(anIObj.IsNull()) return;
1006 if(!HasOpenedContext()){
1007 ClearGlobal(anIObj,updateviewer);
1012 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
1013 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
1014 for (;It.More() ;It.Next()){
1015 if(It.Value()->AcceptErase())
1016 WasInCtx = It.Value()->Remove(anIObj);
1020 ClearGlobal(anIObj,updateviewer);
1022 if(updateviewer) myMainVwr->Update();
1029 //=======================================================================
1030 //function : ClearPrs
1032 //=======================================================================
1034 void AIS_InteractiveContext::ClearPrs(const Handle(AIS_InteractiveObject)& anIObj,
1035 const Standard_Integer aMode,
1036 const Standard_Boolean updateviewer)
1038 if(anIObj.IsNull()) return;
1040 if(!HasOpenedContext()){
1041 ClearGlobalPrs(anIObj,aMode,updateviewer);
1045 Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->ClearPrs(anIObj,aMode);
1046 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
1047 for (;It.More() ;It.Next()){
1048 if(It.Value()->AcceptErase())
1049 WasInCtx = It.Value()->ClearPrs(anIObj,aMode);
1052 ClearGlobalPrs(anIObj,aMode,updateviewer);
1054 if(updateviewer) myMainVwr->Update();
1059 //=======================================================================
1060 //function : Hilight
1062 //=======================================================================
1064 void AIS_InteractiveContext::Hilight(const Handle(AIS_InteractiveObject)& anIObj,
1065 const Standard_Boolean updateviewer)
1067 if(anIObj.IsNull()) return;
1069 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
1070 if (!HasOpenedContext())
1072 if(!myObjects.IsBound(anIObj)) return;
1075 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1076 // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes();
1077 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1080 STATUS->SetHilightStatus (Standard_True);
1082 switch(STATUS->GraphicStatus()){
1083 case AIS_DS_Displayed:
1085 Standard_Integer DispMode,HiMode,SelMode;
1086 GetDefModes(anIObj,DispMode,HiMode,SelMode);
1087 // if(!STATUS->IsDModeIn(HiMode)){
1088 // myMainPM->Display(anIObj,HiMode);
1090 myMainPM->Highlight(anIObj,HiMode);
1091 if(updateviewer) myMainVwr->Update();
1096 Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
1097 myCollectorPM->Highlight(anIObj,HiMode);
1098 if(updateviewer) myCollectorVwr->Update();
1106 myLocalContexts(myCurLocalIndex)->Hilight(anIObj);
1107 if(updateviewer) myMainVwr->Update();
1109 //=======================================================================
1110 //function : Hilight
1112 //=======================================================================
1114 void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject)& anIObj,
1115 const Quantity_NameOfColor aCol,
1116 const Standard_Boolean updateviewer)
1118 if(anIObj.IsNull()) return;
1120 if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
1122 if (!HasOpenedContext())
1124 if(!myObjects.IsBound(anIObj)) return;
1126 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1127 STATUS->SetHilightStatus (Standard_True);
1129 switch(STATUS->GraphicStatus()){
1130 case AIS_DS_Displayed:
1132 Standard_Integer DispMode,HiMode,SelMode;
1133 GetDefModes(anIObj,DispMode,HiMode,SelMode);
1134 // if(!STATUS->IsDModeIn(HiMode)){
1135 // myMainPM->Display(anIObj,HiMode);
1137 myMainPM->Color(anIObj,aCol,HiMode);
1138 STATUS->SetHilightColor(aCol);
1139 if(updateviewer) myMainVwr->Update();
1144 Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
1145 myCollectorPM->Color(anIObj,aCol,HiMode);
1146 if(updateviewer) myCollectorVwr->Update();
1154 myLocalContexts(myCurLocalIndex)->Hilight(anIObj,aCol);
1155 if(updateviewer) myMainVwr->Update();
1158 //=======================================================================
1159 //function : Unhilight
1161 //=======================================================================
1163 void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
1165 if(anIObj.IsNull()) return;
1167 if (!HasOpenedContext())
1169 if(!myObjects.IsBound(anIObj)) return;
1171 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1172 STATUS->SetHilightStatus (Standard_False);
1173 STATUS->SetHilightColor(Quantity_NOC_WHITE);
1175 switch(STATUS->GraphicStatus()){
1176 case AIS_DS_Displayed:
1178 Standard_Integer DispMode,HiMode,SelMode;
1179 GetDefModes(anIObj,DispMode,HiMode,SelMode);
1180 myMainPM->Unhighlight(anIObj,HiMode);
1181 // if(!STATUS->IsDModeIn(HiMode))
1182 // myMainPM->Erase(anIObj,HiMode);
1183 if(updateviewer) myMainVwr->Update();
1188 Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0;
1189 myCollectorPM->Unhighlight(anIObj,HiMode);
1190 if(updateviewer) myCollectorVwr->Update();
1198 myLocalContexts(myCurLocalIndex)->Unhilight(anIObj);
1199 if(updateviewer) myMainVwr->Update();
1202 //=======================================================================
1203 //function : IsHilighted
1205 //=======================================================================
1207 Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_InteractiveObject)& anIObj) const
1209 if(anIObj.IsNull()) return Standard_False;
1211 if (!HasOpenedContext()){
1212 if(!myObjects.IsBound(anIObj))
1213 return Standard_False;
1214 return myObjects(anIObj)->IsHilighted();
1216 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
1217 for(;ItM.More();ItM.Next()){
1218 if(ItM.Value()->IsHilighted(anIObj))
1219 return Standard_True;
1221 return Standard_False;
1224 Standard_Boolean AIS_InteractiveContext::IsHilighted(const Handle(AIS_InteractiveObject)& anIObj,
1225 Standard_Boolean& WithColor,
1226 Quantity_NameOfColor& TheHiCol) const
1228 if(!HasOpenedContext()){
1229 if(myObjects.IsBound(anIObj)){
1230 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
1231 if(STAT->IsHilighted()){
1232 if(STAT->HilightColor()!=Quantity_NOC_WHITE){
1233 WithColor=Standard_True;
1234 TheHiCol = STAT->HilightColor();
1237 WithColor = Standard_False;
1238 return Standard_True;
1241 return Standard_False;
1243 Standard_Integer MaxIndex = HighestIndex();
1244 for(Standard_Integer i=MaxIndex;i>=1 ; i--){
1245 if(myLocalContexts.IsBound(i)){
1246 if(myLocalContexts(i)->IsHilighted(anIObj,WithColor,TheHiCol))
1247 return Standard_True;
1251 return Standard_False;
1256 //=======================================================================
1257 //function : IsDisplayed
1259 //=======================================================================
1261 Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj) const
1263 if(anIObj.IsNull()) return Standard_False;
1266 if(myObjects.IsBound(anIObj))
1267 if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed)
1268 return Standard_True;
1270 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
1271 for(;ItM.More();ItM.Next()){
1272 if(ItM.Value()->IsDisplayed(anIObj))
1273 return Standard_True;
1275 return Standard_False;
1278 //=======================================================================
1279 //function : IsDisplayed
1281 //=======================================================================
1283 Standard_Boolean AIS_InteractiveContext::IsInCollector(const Handle(AIS_InteractiveObject)& anIObj) const
1285 if(anIObj.IsNull()) return Standard_False;
1288 if(myObjects.IsBound(anIObj))
1289 return (myObjects(anIObj)->GraphicStatus()==AIS_DS_Erased);
1290 return Standard_False;
1294 //=======================================================================
1295 //function : IsDisplayed
1297 //=======================================================================
1299 Standard_Boolean AIS_InteractiveContext::
1300 IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj,
1301 const Standard_Integer aMode) const
1303 if(anIObj.IsNull()) return Standard_False;
1304 if(myObjects.IsBound(anIObj)) {
1305 if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed &&
1306 myObjects(anIObj)->IsDModeIn(aMode))
1307 return Standard_True;
1310 AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
1311 for(;ItM.More();ItM.Next()){
1312 if(ItM.Value()->IsDisplayed(anIObj,aMode))
1313 return Standard_True;
1315 return Standard_False;
1319 //=======================================================================
1320 //function : DisplayPriority
1322 //=======================================================================
1324 Standard_Integer AIS_InteractiveContext::
1325 DisplayPriority(const Handle(AIS_InteractiveObject)& anIObj) const
1327 if(anIObj.IsNull()) return -1;
1328 if(myObjects.IsBound(anIObj)){
1330 // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj);
1331 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1333 Standard_Integer DM,HM,SM ;
1334 GetDefModes(anIObj,DM,HM,SM);
1335 switch(STATUS->GraphicStatus()){
1336 case AIS_DS_Displayed:
1338 return myMainPM->DisplayPriority(anIObj,DM);
1342 return myCollectorPM->DisplayPriority(anIObj,HM);
1350 //=======================================================================
1351 //function : SetDisplayPriority
1353 //=======================================================================
1355 void AIS_InteractiveContext::SetDisplayPriority(const Handle(AIS_InteractiveObject)& anIObj,
1356 const Standard_Integer aPriority)
1360 if(!anIObj->HasInteractiveContext())
1361 anIObj->SetContext(this);
1362 if(myObjects.IsBound(anIObj)){
1364 // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj);
1365 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1367 Standard_Integer DM,HM,SM ;
1368 GetDefModes(anIObj,DM,HM,SM);
1369 switch(STATUS->GraphicStatus()){
1370 case AIS_DS_Displayed:
1372 myMainPM->SetDisplayPriority(anIObj,DM,aPriority);
1377 myCollectorPM->SetDisplayPriority(anIObj,HM,aPriority);
1384 else if (HasOpenedContext())
1385 {myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);}
1388 //=======================================================================
1389 //function : Redisplay
1391 //=======================================================================
1393 void AIS_InteractiveContext::Redisplay(const Handle(AIS_InteractiveObject)& anIObj,
1394 const Standard_Boolean updateviewer,
1395 const Standard_Boolean allmodes)
1397 if(AISDebugModeOn()){
1398 cout<<"===>AIS_InteractiveContext::Redisplay de :";
1399 cout<<anIObj->DynamicType()->Name()<<endl;
1402 RecomputePrsOnly(anIObj,updateviewer,allmodes);
1403 RecomputeSelectionOnly(anIObj);
1406 //=======================================================================
1407 //function : Redisplay
1409 //=======================================================================
1411 void AIS_InteractiveContext::Redisplay(const AIS_KindOfInteractive KOI,
1412 const Standard_Integer /*Sign*/,
1413 const Standard_Boolean updateviewer)
1415 Standard_Boolean found_viewer(Standard_False),found_coll(Standard_False);
1417 for(AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);It.More();It.Next()){
1419 // const Handle(AIS_InteractiveObject)& IO = It.Key();
1420 Handle(AIS_InteractiveObject) IO = It.Key();
1422 if(IO->Type()== KOI){
1424 // Standard_Boolean good = (Sign==-1)? Standard_True :
1425 // ((IO->Signature()==Sign)? Standard_True:Standard_False);
1427 Redisplay(IO,Standard_False);
1428 switch(It.Value()->GraphicStatus()){
1429 case AIS_DS_Displayed:
1430 found_viewer = Standard_True;
1433 found_coll = Standard_True;
1443 myMainVwr->Update();
1445 myCollectorVwr->Update();
1450 //=======================================================================
1451 //function : RecomputePrsOnly
1453 //=======================================================================
1455 void AIS_InteractiveContext::RecomputePrsOnly(const Handle(AIS_InteractiveObject)& anIObj,
1456 const Standard_Boolean updateviewer,
1457 const Standard_Boolean allmodes)
1459 if(anIObj.IsNull()) return;
1460 anIObj->Update(allmodes);
1463 if(HasOpenedContext())
1464 myMainVwr->Update();
1466 if(myObjects.IsBound(anIObj)){
1467 switch(myObjects(anIObj)->GraphicStatus()){
1468 case AIS_DS_Displayed:
1469 myMainVwr->Update();
1473 if(!myCollectorVwr.IsNull())
1474 myCollectorVwr->Update();
1483 //=======================================================================
1484 //function : RecomputeSelectionOnly
1486 //=======================================================================
1487 void AIS_InteractiveContext::RecomputeSelectionOnly(const Handle(AIS_InteractiveObject)& anIObj)
1489 if(anIObj.IsNull()) return;
1490 mgrSelector->RecomputeSelection(anIObj);
1493 // A VOIR SI ENCORE UTILE...
1494 TColStd_ListOfInteger LI;
1495 TColStd_ListIteratorOfListOfInteger Lit;
1496 ActivatedModes(anIObj,LI);
1497 if(!HasOpenedContext()){
1498 if(!myObjects.IsBound(anIObj)) return;
1499 switch(myObjects(anIObj)->GraphicStatus())
1501 case AIS_DS_Displayed:
1503 for(Lit.Initialize(LI);Lit.More();Lit.Next())
1504 mgrSelector->Activate(anIObj,Lit.Value(),myMainSel);
1509 for(Lit.Initialize(LI);Lit.More();Lit.Next())
1510 mgrSelector->Activate(anIObj,Lit.Value(),myCollectorSel);
1520 //=======================================================================
1523 //=======================================================================
1525 void AIS_InteractiveContext::Update(const Handle(AIS_InteractiveObject)& anIObj,
1526 const Standard_Boolean updateviewer)
1528 if(anIObj.IsNull()) return;
1532 TColStd_ListOfInteger LL;
1533 anIObj->ToBeUpdated(LL);
1534 TColStd_ListIteratorOfListOfInteger ITI(LL);
1535 Standard_Boolean wasupdated(Standard_False);
1537 for (;ITI.More();ITI.Next()){
1538 anIObj->Update(ITI.Value(),Standard_False);
1539 wasupdated = Standard_True;
1543 mgrSelector->Update(anIObj);
1546 if(!myObjects.IsBound(anIObj)) return;
1547 switch(myObjects(anIObj)->GraphicStatus()){
1548 case AIS_DS_Displayed:
1549 case AIS_DS_Temporary:
1550 myMainVwr->Update();
1553 myCollectorVwr->Update();
1563 //=======================================================================
1564 //function : SetLocation
1566 //=======================================================================
1568 void AIS_InteractiveContext::SetLocation(const Handle(AIS_InteractiveObject)& anIObj,
1569 const TopLoc_Location& aLoc)
1571 if(anIObj.IsNull()) return;
1574 if(anIObj->HasLocation() && aLoc.IsIdentity()){
1575 anIObj->ResetLocation();
1576 mgrSelector->Update(anIObj,Standard_False);
1579 if(aLoc.IsIdentity()) return ;
1581 // d'abord faire un reset de la precedente location pour tout nettoyer proprement...
1582 if(anIObj->HasLocation())
1583 anIObj->ResetLocation();
1586 anIObj->SetLocation(aLoc);
1588 if(!HasOpenedContext())
1589 mgrSelector->Update(anIObj,Standard_False);
1593 // const Handle(StdSelect_ViewerSelector3d)& tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
1594 Handle(StdSelect_ViewerSelector3d) tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
1596 mgrSelector->Update(anIObj,tempSel,Standard_False);
1599 //=======================================================================
1600 //function : ResetLocation
1602 //=======================================================================
1603 void AIS_InteractiveContext::ResetLocation(const Handle(AIS_InteractiveObject)& anIObj)
1605 if(anIObj.IsNull()) return;
1607 anIObj->ResetLocation();
1608 mgrSelector->Update(anIObj,Standard_False);
1611 //=======================================================================
1612 //function : HasLocation
1614 //=======================================================================
1616 Standard_Boolean AIS_InteractiveContext::
1617 HasLocation(const Handle(AIS_InteractiveObject)& anIObj) const
1619 if(anIObj.IsNull()) return Standard_False;
1621 return anIObj->HasLocation();
1624 const TopLoc_Location& AIS_InteractiveContext::
1625 Location(const Handle(AIS_InteractiveObject)& anIObj) const
1627 return anIObj->Location();
1630 //=======================================================================
1631 //function : SetDeviationCoefficient
1633 //=======================================================================
1635 void AIS_InteractiveContext::SetDeviationCoefficient(const Standard_Real aCoefficient)
1637 myDefaultDrawer->SetDeviationCoefficient(aCoefficient);
1639 //=======================================================================
1640 //function : SetDeviationAngle
1642 //=======================================================================
1644 void AIS_InteractiveContext::SetDeviationAngle(const Standard_Real anAngle)
1646 myDefaultDrawer->SetDeviationCoefficient(anAngle);
1649 //=======================================================================
1650 //function : DeviationAngle
1651 //purpose : Gets deviationAngle
1652 //=======================================================================
1654 Standard_Real AIS_InteractiveContext::DeviationAngle() const
1657 // return myDefaultDrawer->DeviationAngle();
1660 //=======================================================================
1661 //function : DeviationCoefficient
1663 //=======================================================================
1665 Standard_Real AIS_InteractiveContext::DeviationCoefficient() const
1667 return myDefaultDrawer->DeviationCoefficient();
1669 //=======================================================================
1670 //function : SetHLRDeviationCoefficient
1672 //=======================================================================
1674 void AIS_InteractiveContext::SetHLRDeviationCoefficient(const Standard_Real aCoefficient)
1676 myDefaultDrawer->SetHLRDeviationCoefficient(aCoefficient);
1679 //=======================================================================
1680 //function : HLRDeviationCoefficient
1682 //=======================================================================
1684 Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const
1686 return myDefaultDrawer->HLRDeviationCoefficient();
1689 //=======================================================================
1690 //function : SetHLRAngle
1692 //=======================================================================
1694 void AIS_InteractiveContext::SetHLRAngle(const Standard_Real anAngle)
1696 myDefaultDrawer->SetHLRAngle(anAngle);
1699 //=======================================================================
1700 //function : SetHLRAngleAndDeviation
1701 //purpose : compute with anangle a HLRAngle and a HLRDeviationCoefficient
1702 // and set them in myHLRAngle and in myHLRDeviationCoefficient
1703 // of myDefaultDrawer
1704 //=======================================================================
1706 void AIS_InteractiveContext::SetHLRAngleAndDeviation(const Standard_Real anAngle)
1709 Standard_Real OutAngl,OutDefl;
1710 HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1712 myDefaultDrawer->SetHLRAngle(OutAngl);
1713 myDefaultDrawer->SetHLRDeviationCoefficient(OutDefl);
1717 //=======================================================================
1718 //function : HLRAngle
1720 //=======================================================================
1722 Standard_Real AIS_InteractiveContext::HLRAngle() const
1724 return myDefaultDrawer->HLRAngle();
1727 //=======================================================================
1728 //function : SetDisplayMode
1730 //=======================================================================
1732 void AIS_InteractiveContext::SetDisplayMode(const AIS_DisplayMode aMode,
1733 const Standard_Boolean updateviewer)
1735 if(aMode==myDisplayMode) return;
1736 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
1738 for(;It.More();It.Next()){
1740 // const Handle(AIS_InteractiveObject)& anObj = It.Key();
1741 Handle(AIS_InteractiveObject) anObj = It.Key();
1743 Standard_Boolean Processed = (anObj->IsKind(STANDARD_TYPE(AIS_Shape)) ||
1744 anObj->IsKind(STANDARD_TYPE(AIS_ConnectedShape)) ||
1745 anObj->IsKind(STANDARD_TYPE(AIS_MultipleConnectedShape)) );
1747 if ((!anObj->HasDisplayMode()) && Processed)
1749 if(anObj->AcceptDisplayMode(aMode)){
1751 // const Handle(AIS_GlobalStatus)& STATUS = It.Value();
1752 Handle(AIS_GlobalStatus) STATUS = It.Value();
1754 if(STATUS->IsDModeIn(myDisplayMode))
1755 STATUS->RemoveDisplayMode(myDisplayMode);
1757 STATUS->AddDisplayMode(aMode);
1759 if(STATUS->GraphicStatus()== AIS_DS_Displayed){
1760 myMainPM->Erase(anObj, myDisplayMode);
1761 myMainPM->Display(anObj, aMode);
1762 if(STATUS->IsSubIntensityOn())
1763 myMainPM->Color(anObj,mySubIntensity,aMode);
1765 // myDisplayMode = aMode;
1770 myDisplayMode = aMode;
1771 if(updateviewer) myMainVwr->Update();
1774 //=======================================================================
1775 //function : SetDisplayMode
1777 //=======================================================================
1779 void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
1780 const Standard_Integer aMode,
1781 const Standard_Boolean updateviewer)
1784 if(!anIObj->HasInteractiveContext())
1785 anIObj->SetContext(this);
1786 if(!HasOpenedContext()){
1788 if(!myObjects.IsBound(anIObj))
1789 anIObj->SetDisplayMode(aMode);
1791 else if( anIObj->AcceptDisplayMode(aMode) )
1797 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1798 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
1801 // l'objet interactif n'avait pas de mode propre : OldMode = Mode Session
1802 // avait deja un mode propre : OldMode = ancien mode Propre
1804 Standard_Integer OldMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode(): myDisplayMode;
1806 if(STATUS->IsDModeIn(OldMode))
1807 STATUS->RemoveDisplayMode(OldMode);
1808 STATUS->AddDisplayMode(aMode);
1810 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
1811 if(aMode!=OldMode ){
1812 if(myMainPM->IsHighlighted(anIObj,OldMode))
1813 myMainPM->Unhighlight(anIObj,OldMode);
1815 myMainPM->Erase(anIObj,OldMode);
1817 // SAN : erase presentations for all display modes different from <aMode>
1818 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
1819 TColStd_ListOfInteger aModesToRemove;
1820 for(ItL.Initialize(STATUS->DisplayedModes());ItL.More();ItL.Next()){
1822 Standard_Integer OldMode = ItL.Value();
1825 aModesToRemove.Append(OldMode);
1826 if(myMainPM->IsHighlighted(anIObj,OldMode))
1827 myMainPM->Unhighlight(anIObj,OldMode);
1828 myMainPM->Erase(anIObj,OldMode);
1832 for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
1833 STATUS->RemoveDisplayMode(ItL.Value());
1835 if(!STATUS->IsDModeIn(aMode))
1836 STATUS->AddDisplayMode(aMode);
1839 myMainPM->Display(anIObj,aMode);
1840 Standard_Integer DM,HM,SM;
1841 GetDefModes(anIObj,DM,HM,SM);
1842 if(STATUS->IsHilighted()){
1843 myMainPM->Highlight(anIObj,HM);
1845 if(STATUS->IsSubIntensityOn()){
1846 myMainPM->Color(anIObj,mySubIntensity,aMode);
1848 if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
1849 myMainVwr->Viewer()->SetTransparency(Standard_True);
1851 if(updateviewer) myMainVwr->Update();
1856 anIObj->SetDisplayMode(aMode);
1861 //=======================================================================
1862 //function : UnsetDisplayMode
1864 //=======================================================================
1866 void AIS_InteractiveContext::
1867 UnsetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
1868 const Standard_Boolean updateviewer)
1870 if(anIObj.IsNull()) return ;
1871 if(!anIObj->HasDisplayMode()) return;
1873 if(!myObjects.IsBound(anIObj))
1874 anIObj->UnsetDisplayMode();
1877 Standard_Integer OldMode = anIObj->DisplayMode();
1878 if(myDisplayMode==OldMode) return;
1879 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
1880 STATUS->RemoveDisplayMode(OldMode);
1881 if(!STATUS->IsDModeIn(myDisplayMode))
1882 STATUS->AddDisplayMode(myDisplayMode);
1883 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
1884 if(myMainPM->IsHighlighted(anIObj,OldMode))
1885 myMainPM->Unhighlight(anIObj,OldMode);
1886 myMainPM->Erase(anIObj,OldMode);
1887 myMainPM->Display(anIObj,myDisplayMode);
1888 Standard_Integer DM,HM,SM;
1889 GetDefModes(anIObj,DM,HM,SM);
1890 if(STATUS->IsHilighted()){
1891 myMainPM->Highlight(anIObj,HM);
1893 if(STATUS->IsSubIntensityOn()){
1894 myMainPM->Color(anIObj,mySubIntensity,myDisplayMode);
1896 if(updateviewer) myMainVwr->Update();
1898 anIObj->UnsetDisplayMode();
1903 //=======================================================================
1904 //function : SetCurrentFacingModel
1906 //=======================================================================
1909 void AIS_InteractiveContext::SetCurrentFacingModel(
1910 const Handle(AIS_InteractiveObject)& anIObj,
1911 const Aspect_TypeOfFacingModel aModel) {
1912 if ( !anIObj.IsNull () ) {
1913 anIObj->SetCurrentFacingModel(aModel);
1918 //=======================================================================
1919 //function : SetColor
1921 //=======================================================================
1923 void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
1924 const Quantity_NameOfColor aColor,
1925 const Standard_Boolean updateviewer)
1928 SetColor(anIObj,Quantity_Color(aColor),updateviewer);
1931 void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
1932 const Quantity_Color &aColor,
1933 const Standard_Boolean updateviewer)
1936 if(anIObj.IsNull()) return ;
1938 if(!anIObj->HasInteractiveContext())
1939 anIObj->SetContext(this);
1940 anIObj->SetColor(aColor);
1941 if(anIObj->RecomputeEveryPrs())
1942 anIObj->Redisplay();
1945 Standard_Integer NbDisp=0;
1946 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
1947 for (;ITI.More();ITI.Next())
1949 anIObj->Update(ITI.Value(),Standard_False);
1952 anIObj->SetRecomputeOk();
1954 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
1961 // if(anIObj->Type()==AIS_KOI_Datum && anIObj->Signature()==3){
1962 // Handle(AIS_Trihedron) Tr = *((Handle(AIS_Trihedron)*)&anIObj);
1963 // Standard_Real Lx = myDefaultDrawer->DatumAspect()->FirstAxisLength();
1965 // gp_Dir D =Tr->Component()->XDirection();
1966 // gp_Pnt O = Tr->Component()->Location();
1967 // gp_Vec V(D);V*=Lx/5.;
1968 // T.SetRotation(gp_Ax1(O,D),PI/6.);
1969 // T.SetTranslationPart(V);
1970 // TopLoc_Location L,IncLoc(T);
1972 // for(Standard_Integer I=1;I<90;I++){
1973 // if(anIObj->HasLocation())
1974 // L = anIObj->Location() * IncLoc;
1977 // SetLocation(anIObj,L);
1978 // UpdateCurrentViewer();
1980 // for(I=1;I<90;I++){
1981 // L = anIObj->Location() /IncLoc;
1982 // SetLocation(anIObj,L);
1983 // UpdateCurrentViewer();
1985 // ResetLocation(anIObj);
1988 if(updateviewer) UpdateCurrentViewer();
1991 //=======================================================================
1992 //function : SetDeviationCoefficient
1994 //=======================================================================
1996 void AIS_InteractiveContext::SetDeviationCoefficient(
1997 const Handle(AIS_InteractiveObject)& anIObj,
1998 const Standard_Real aCoefficient,
1999 const Standard_Boolean updateviewer)
2001 // cout<<" Coefficient:"<< aCoefficient <<endl;
2002 if(anIObj.IsNull()) return ;
2004 if(!anIObj->HasInteractiveContext())
2005 anIObj->SetContext(this);
2007 // A Modifier apres descente des methodes concernees de AIS_Shape dans InteractiveObject
2008 if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
2009 if(anIObj->Signature()!=0) return;
2010 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationCoefficient(aCoefficient);
2014 if(anIObj->RecomputeEveryPrs())
2015 anIObj->Redisplay();
2018 Standard_Integer NbDisp=0;
2019 TColStd_ListOfInteger LL;
2020 anIObj->ToBeUpdated(LL);
2021 TColStd_ListIteratorOfListOfInteger ITI(LL);
2022 for (;ITI.More();ITI.Next())
2024 anIObj->Update(ITI.Value(),Standard_False);
2027 anIObj->SetRecomputeOk();
2029 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2032 if(updateviewer) UpdateCurrentViewer();
2035 //=======================================================================
2036 //function : SetHLRDeviationCoefficient
2038 //=======================================================================
2040 void AIS_InteractiveContext::SetHLRDeviationCoefficient(
2041 const Handle(AIS_InteractiveObject)& anIObj,
2042 const Standard_Real aCoefficient,
2043 const Standard_Boolean updateviewer)
2045 // cout<<" HLRCoefficient:"<< aCoefficient <<endl;
2046 if(anIObj.IsNull()) return ;
2048 if(!anIObj->HasInteractiveContext())
2049 anIObj->SetContext(this);
2050 // A Modifier apres descente des methodes concernees de AIS_Shape dans InteractiveObject
2051 if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
2052 if(anIObj->Signature()!=0) return;
2053 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationCoefficient(aCoefficient);
2057 if(anIObj->RecomputeEveryPrs())
2058 anIObj->Redisplay();
2061 Standard_Integer NbDisp=0;
2063 TColStd_ListOfInteger LL;
2064 anIObj->ToBeUpdated(LL);
2065 TColStd_ListIteratorOfListOfInteger ITI(LL);
2066 for (;ITI.More();ITI.Next())
2068 anIObj->Update(ITI.Value(),Standard_False);
2071 anIObj->SetRecomputeOk();
2073 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2076 if(updateviewer) UpdateCurrentViewer();
2080 //=======================================================================
2081 //function : SetDeviationAngle
2083 //=======================================================================
2085 void AIS_InteractiveContext::SetDeviationAngle(
2086 const Handle(AIS_InteractiveObject)& anIObj,
2087 const Standard_Real anAngle,
2088 const Standard_Boolean updateviewer)
2090 // cout<<" Angle:"<< anAngle <<endl;
2091 if(anIObj.IsNull()) return ;
2093 if(!anIObj->HasInteractiveContext())
2094 anIObj->SetContext(this);
2095 // A Modifier apres descente des methodes concernees de AIS_Shape dans InteractiveObject
2096 if(anIObj->Type()!=AIS_KOI_Shape) return;
2097 if(anIObj->Signature()!=0) return;
2098 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationAngle(anAngle);
2101 if(anIObj->RecomputeEveryPrs())
2102 anIObj->Redisplay();
2105 Standard_Integer NbDisp=0;
2106 TColStd_ListOfInteger LL;
2107 anIObj->ToBeUpdated(LL);
2108 TColStd_ListIteratorOfListOfInteger ITI(LL);
2109 for (;ITI.More();ITI.Next())
2111 anIObj->Update(ITI.Value(),Standard_False);
2114 anIObj->SetRecomputeOk();
2116 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2119 if(updateviewer) UpdateCurrentViewer();
2121 //=======================================================================
2122 //function : SetDeviationAngle
2124 //=======================================================================
2126 void AIS_InteractiveContext::SetAngleAndDeviation(
2127 const Handle(AIS_InteractiveObject)& anIObj,
2128 const Standard_Real anAngle,
2129 const Standard_Boolean updateviewer)
2131 // cout<<" Angle:"<< anAngle <<endl;
2132 if(anIObj.IsNull()) return ;
2133 // Standard_Real anAngleRad = PI*anAngle/180; test rob...
2134 if(!anIObj->HasInteractiveContext())
2135 anIObj->SetContext(this);
2137 // A Modifier apres descente des methodes concernees de AIS_Shape dans InteractiveObject
2138 if(anIObj->Type()!=AIS_KOI_Shape) return;
2139 if(anIObj->Signature()!=0) return;
2140 (*((Handle(AIS_Shape)*)&anIObj))->SetAngleAndDeviation(anAngle);
2143 if(anIObj->RecomputeEveryPrs())
2144 anIObj->Redisplay();
2146 Update(anIObj,updateviewer);
2149 //=======================================================================
2150 //function : SetDeviationAngle
2152 //=======================================================================
2154 void AIS_InteractiveContext::SetHLRAngleAndDeviation(
2155 const Handle(AIS_InteractiveObject)& anIObj,
2156 const Standard_Real anAngle,
2157 const Standard_Boolean updateviewer)
2159 // cout<<" Angle:"<< anAngle <<endl;
2161 if(anIObj.IsNull()) return ;
2162 if(!anIObj->HasInteractiveContext())
2163 anIObj->SetContext(this);
2165 // A Modifier apres descente des methodes concernees de AIS_Shape dans InteractiveObject
2166 if(anIObj->Type()!=AIS_KOI_Shape) return;
2167 if(anIObj->Signature()!=0) return;
2168 (*((Handle(AIS_Shape)*)&anIObj))->SetHLRAngleAndDeviation(anAngle);
2171 if(anIObj->RecomputeEveryPrs())
2172 anIObj->Redisplay();
2175 Standard_Integer NbDisp=0;
2177 TColStd_ListOfInteger LL;
2178 anIObj->ToBeUpdated(LL);
2179 TColStd_ListIteratorOfListOfInteger ITI(LL);
2180 for (;ITI.More();ITI.Next())
2182 anIObj->Update(ITI.Value(),Standard_False);
2185 anIObj->SetRecomputeOk();
2187 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2190 if(updateviewer) UpdateCurrentViewer();
2193 //=======================================================================
2194 //function : SetHLRDeviationAngle
2196 //=======================================================================
2198 void AIS_InteractiveContext::SetHLRDeviationAngle(
2199 const Handle(AIS_InteractiveObject)& anIObj,
2200 const Standard_Real anAngle,
2201 const Standard_Boolean updateviewer)
2203 // cout<<" HLRAngle:"<< anAngle <<endl;
2204 if(anIObj.IsNull()) return ;
2206 if(!anIObj->HasInteractiveContext())
2207 anIObj->SetContext(this);
2208 // A Modifier apres descente des methodes concernees de AIS_Shape dans InteractiveObject
2209 if( anIObj->Type()!=AIS_KOI_Shape) return;
2210 if(anIObj->Signature()!=0) return;
2211 (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationAngle(anAngle);
2214 if(anIObj->RecomputeEveryPrs())
2215 anIObj->Redisplay();
2218 Standard_Integer NbDisp=0;
2219 TColStd_ListOfInteger LL;
2220 anIObj->ToBeUpdated(LL);
2221 TColStd_ListIteratorOfListOfInteger ITI(LL);
2222 for (;ITI.More();ITI.Next())
2224 anIObj->Update(ITI.Value(),Standard_False);
2227 anIObj->SetRecomputeOk();
2229 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2232 if(updateviewer) UpdateCurrentViewer();
2235 //=======================================================================
2236 //function : UnsetColor
2238 //=======================================================================
2240 void AIS_InteractiveContext::UnsetColor(const Handle(AIS_InteractiveObject)& anIObj,
2241 const Standard_Boolean updateviewer)
2243 if(anIObj.IsNull()) return ;
2244 anIObj->UnsetColor();
2245 if(anIObj->RecomputeEveryPrs())
2246 anIObj->Redisplay();
2249 Standard_Integer NbDisp =0;
2250 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2251 for (;ITI.More();ITI.Next())
2253 anIObj->Update(ITI.Value(),Standard_False);
2257 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2259 anIObj->SetRecomputeOk();
2262 UpdateCurrentViewer();
2265 //=======================================================================
2266 //function : HasColor
2268 //=======================================================================
2270 Standard_Boolean AIS_InteractiveContext::HasColor(const Handle(AIS_InteractiveObject)& anIObj) const
2272 return anIObj->HasColor();
2276 //=======================================================================
2279 //=======================================================================
2281 Quantity_NameOfColor AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj) const
2283 return anIObj->Color();
2287 void AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj,
2288 Quantity_Color &aColor) const
2290 anIObj->Color(aColor);
2294 //=======================================================================
2297 //=======================================================================
2299 Standard_Real AIS_InteractiveContext::Width(const Handle(AIS_InteractiveObject)& anIObj) const
2301 return anIObj->Width();
2304 //=======================================================================
2305 //function : SetWidth
2307 //=======================================================================
2309 void AIS_InteractiveContext::SetWidth(const Handle(AIS_InteractiveObject)& anIObj,
2310 const Standard_Real aValue,
2311 const Standard_Boolean updateviewer)
2313 if(anIObj.IsNull()) return ;
2315 if(!anIObj->HasInteractiveContext())
2316 anIObj->SetContext(this);
2317 anIObj->SetWidth(aValue);
2318 if(anIObj->RecomputeEveryPrs())
2319 anIObj->Redisplay();
2322 Standard_Integer NbDisp=0;
2323 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2324 for (;ITI.More();ITI.Next())
2326 anIObj->Update(ITI.Value(),Standard_False);
2330 cout<<"nb de modes a recalculer : "<<NbDisp<<endl;
2332 anIObj->SetRecomputeOk();
2335 UpdateCurrentViewer();
2338 //=======================================================================
2339 //function : UnsetWidth
2341 //=======================================================================
2343 void AIS_InteractiveContext::UnsetWidth(const Handle(AIS_InteractiveObject)& anIObj,
2344 const Standard_Boolean updateviewer)
2346 if(anIObj.IsNull()) return ;
2347 anIObj->UnsetWidth();
2348 if(anIObj->RecomputeEveryPrs())
2349 anIObj->Redisplay();
2352 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2353 for (;ITI.More();ITI.Next())
2355 anIObj->Update(ITI.Value(),Standard_False);
2357 anIObj->SetRecomputeOk();
2360 UpdateCurrentViewer();
2363 //=======================================================================
2364 //function : SetMaterial
2366 //=======================================================================
2368 void AIS_InteractiveContext::SetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
2370 const Graphic3d_NameOfMaterial aName,
2371 // const Graphic3d_NameOfPhysicalMaterial aName,
2372 const Standard_Boolean updateviewer)
2374 if(!anIObj->HasInteractiveContext())
2375 anIObj->SetContext(this);
2376 anIObj->SetMaterial(aName);
2377 if(anIObj->RecomputeEveryPrs())
2378 anIObj->Redisplay();
2381 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2382 for (;ITI.More();ITI.Next())
2384 anIObj->Update(ITI.Value(),Standard_False);
2386 anIObj->SetRecomputeOk();
2389 UpdateCurrentViewer();
2393 //=======================================================================
2394 //function : UnsetMaterial
2396 //=======================================================================
2398 void AIS_InteractiveContext::UnsetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
2399 const Standard_Boolean updateviewer)
2401 if(anIObj.IsNull()) return ;
2402 anIObj->UnsetMaterial();
2403 if(anIObj->RecomputeEveryPrs())
2404 anIObj->Redisplay();
2407 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2408 for (;ITI.More();ITI.Next())
2410 anIObj->Update(ITI.Value(),Standard_False);
2412 anIObj->SetRecomputeOk();
2415 UpdateCurrentViewer();
2418 //=======================================================================
2419 //function : SetTransparency
2421 //=======================================================================
2423 void AIS_InteractiveContext::SetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
2424 const Standard_Real aValue,
2425 const Standard_Boolean updateviewer)
2427 if(anIObj.IsNull()) return ;
2428 if(!anIObj->HasInteractiveContext())
2429 anIObj->SetContext(this);
2431 #ifdef BUC60577 //right optimization
2432 if(!anIObj->IsTransparent() && aValue<=0.05) return;
2434 // if(!anIObj->IsTransparent() && aValue<=0.05) return;
2437 UnsetTransparency(anIObj,updateviewer);
2441 if(!myMainVwr->Viewer()->Transparency())
2442 myMainVwr->Viewer()->SetTransparency(Standard_True);
2443 anIObj->SetTransparency(aValue);
2444 if(anIObj->RecomputeEveryPrs())
2445 anIObj->Redisplay();
2448 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2449 for (;ITI.More();ITI.Next())
2451 anIObj->Update(ITI.Value(),Standard_False);
2453 anIObj->SetRecomputeOk();
2456 UpdateCurrentViewer();
2459 //=======================================================================
2460 //function : UnsetTransparency
2462 //=======================================================================
2464 void AIS_InteractiveContext::UnsetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
2465 const Standard_Boolean updateviewer)
2467 if(anIObj.IsNull()) return ;
2468 anIObj->UnsetTransparency();
2469 if(anIObj->RecomputeEveryPrs())
2470 anIObj->Redisplay();
2473 TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
2474 for (;ITI.More();ITI.Next())
2476 anIObj->Update(ITI.Value(),Standard_False);
2478 anIObj->SetRecomputeOk();
2481 // To Unset transparency in the viewer, if no other object is transparent ...(Speed)
2482 AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
2483 Standard_Boolean FoundTransp(Standard_False);
2484 for(;It.More() && !FoundTransp ;It.Next()){
2485 if(It.Key()->IsTransparent())
2486 FoundTransp = Standard_True;
2489 myMainVwr->Viewer()->SetTransparency(Standard_False);
2493 UpdateCurrentViewer();
2496 //=======================================================================
2497 //function : SetDegenerateModel
2499 //=======================================================================
2502 void AIS_InteractiveContext :: SetDegenerateModel (
2503 const Handle( AIS_InteractiveObject )& anObject,
2504 const Aspect_TypeOfDegenerateModel aModel,
2505 const Quantity_Ratio aRatio
2507 if ( !anObject.IsNull () ) {
2508 if ( !anObject -> HasInteractiveContext () )
2509 anObject -> SetContext ( this );
2510 anObject->SetDegenerateModel(aModel,aRatio);
2513 } // end AIS_InteractiveContext :: SetDegenerateModel
2515 void AIS_InteractiveContext :: SetDegenerateModel (
2516 const Aspect_TypeOfDegenerateModel aModel,
2517 const Quantity_Ratio aRatio
2520 AIS_DataMapIteratorOfDataMapOfIOStatus it ( myObjects );
2522 while ( it.More () ) {
2524 Handle( AIS_InteractiveObject ) obj = it.Key ();
2526 obj->SetDegenerateModel(aModel,aRatio);
2532 } // end AIS_InteractiveContext :: SetDegenerateModel
2536 //=======================================================================
2537 //function : SetSelectedAspect
2539 //=======================================================================
2540 void AIS_InteractiveContext::SetSelectedAspect(
2541 const Handle(Prs3d_BasicAspect)& anAspect,
2542 const Standard_Boolean globalChange,
2543 const Standard_Boolean updateViewer) {
2544 if( !HasOpenedContext() ) {
2545 Standard_Boolean found = Standard_False;
2546 Handle(AIS_Selection) sel =
2547 AIS_Selection::Selection(myCurrentName.ToCString());
2548 Handle(AIS_InteractiveObject) object;
2549 for( sel->Init() ; sel->More() ; sel->Next()) {
2550 found = Standard_True;
2551 object = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
2552 object->SetAspect(anAspect,globalChange);
2554 if( found && updateViewer) {
2555 myMainVwr->Update();
2556 if( !(myIsCollClosed && myCollectorVwr.IsNull()) )
2557 myCollectorVwr->Update();
2563 //=======================================================================
2564 //function : SetLocalAttributes
2566 //=======================================================================
2568 void AIS_InteractiveContext::SetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj,
2569 const Handle(AIS_Drawer)& aDrawer,
2570 const Standard_Boolean updateviewer)
2572 if(anIObj.IsNull()) return ;
2573 if(!anIObj->HasInteractiveContext())
2574 anIObj->SetContext(this);
2575 anIObj->SetAttributes(aDrawer);
2576 Update(anIObj,updateviewer);
2580 //=======================================================================
2581 //function : UnsetLocalAttributes
2583 //=======================================================================
2584 void AIS_InteractiveContext::UnsetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj,
2585 const Standard_Boolean updateviewer)
2587 if(anIObj.IsNull()) return ;
2588 if(!anIObj->HasInteractiveContext())
2589 anIObj->SetContext(this);
2590 anIObj->UnsetAttributes();
2591 Update(anIObj,updateviewer);
2595 //=======================================================================
2598 //=======================================================================
2600 void AIS_InteractiveContext::Status(const Handle(AIS_InteractiveObject)& anIObj, TCollection_ExtendedString& astatus) const
2604 if(anIObj.IsNull()) return ;
2605 if(myObjects.IsBound(anIObj)){
2606 astatus += "\t ____________________________________________";
2607 astatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
2608 const Handle(AIS_GlobalStatus)& ST = myObjects(anIObj);
2609 switch(ST->GraphicStatus()){
2610 case AIS_DS_Displayed:
2612 astatus +="\t| -->Displayed\n";
2617 astatus +="\t| -->Erased\n";
2620 case AIS_DS_FullErased:
2622 astatus +="\t| -->Full Erased\n";
2628 astatus += "\t| Active Display Modes in the MainViewer :\n";
2629 for(ItL.Initialize(ST->DisplayedModes());ItL.More();ItL.Next()){
2630 astatus += "\t|\t Mode ";
2631 astatus += TCollection_AsciiString(ItL.Value());
2634 if(IsCurrent(anIObj)) astatus +="\t| Current\n";
2635 if(IsSelected(anIObj)) astatus +="\t| Selected\n";
2637 astatus += "\t| Active Selection Modes in the MainViewer :\n";
2638 for(ItL.Initialize(ST->SelectionModes());ItL.More();ItL.Next()){
2639 astatus += "\t\t Mode ";
2640 astatus += TCollection_AsciiString(ItL.Value());
2643 astatus += "\t ____________________________________________";
2649 //=======================================================================
2650 //function : GetDefModes
2652 //=======================================================================
2654 void AIS_InteractiveContext::GetDefModes(const Handle(AIS_InteractiveObject)& anIObj,
2655 Standard_Integer& DispMode,
2656 Standard_Integer& HiMode,
2657 Standard_Integer& SelMode) const
2659 if(anIObj.IsNull()) return ;
2660 DispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() :
2661 (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
2663 HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():DispMode;
2665 SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : -1;
2667 SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : 0;
2672 //=======================================================================
2673 //function : EraseGlobal
2675 //=======================================================================
2677 void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& anIObj,
2678 const Standard_Boolean updateviewer,
2679 const Standard_Boolean PutInCollector)
2681 if(anIObj.IsNull()) return ;
2682 if(!myObjects.IsBound(anIObj)) return;
2685 // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
2686 Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
2688 Standard_Integer Dmode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
2689 if(STATUS->GraphicStatus()==AIS_DS_Displayed){
2691 for(ItL.Initialize(STATUS->DisplayedModes());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 for(ItL.Initialize(STATUS->DisplayedModes());ItL.More();ItL.Next()){
2736 if(STATUS->IsHilighted()){
2737 if(IsCurrent(anIObj))
2739 AddOrRemoveCurrentObject( anIObj, updateviewer );
2741 AddOrRemoveCurrentObject(anIObj);
2743 else if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
2744 myMainPM->Unhighlight(anIObj,ItL.Value());
2746 myMainPM->Erase(anIObj,ItL.Value());
2747 myMainPM->Clear(anIObj,ItL.Value());
2748 if(anIObj->HasHilightMode()){
2749 Standard_Integer im = anIObj->HilightMode();
2750 myMainPM->Unhighlight(anIObj,im);
2751 myMainPM->Erase(anIObj,im);
2756 //Object removes from Detected sequence
2757 Standard_Integer i = 1;
2758 for(i = 1; i < myAISDetectedSeq.Length(); i++)
2760 Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
2761 if( !anObj.IsNull() && anObj != anIObj )
2762 myAISDetectedSeq.Remove( i );
2765 if(myWasLastMain && !myLastinMain.IsNull())
2766 if(myLastinMain == anIObj)
2767 myLastinMain.Nullify();
2769 if(!myWasLastMain && !myLastinColl.IsNull())
2770 if(myLastinColl == anIObj)
2771 myLastinColl.Nullify();
2773 if(myLastPicked == anIObj)
2774 myLastPicked.Nullify();
2776 // OCC21671: Remove IO from the selection manager in any case
2777 // to avoid memory leaks
2778 mgrSelector->Remove(anIObj);
2780 switch(STATUS->GraphicStatus()){
2783 Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
2784 if(STATUS->IsHilighted()){
2785 myCollectorPM->Unhighlight(anIObj,DM);
2787 myCollectorPM->Erase(anIObj,DM);
2788 myCollectorPM->Clear(anIObj,DM);
2789 if(updateviewer) myCollectorVwr->Update();
2792 case AIS_DS_Displayed:
2794 if(updateviewer) myMainVwr->Update();
2800 myObjects.UnBind(anIObj);
2804 //=======================================================================
2805 //function : ClearGlobalPrs
2807 //=======================================================================
2809 void AIS_InteractiveContext::ClearGlobalPrs(const Handle(AIS_InteractiveObject)& anIObj,
2810 const Standard_Integer aMode,
2811 const Standard_Boolean updateviewer)
2813 if(anIObj.IsNull()) return ;
2814 if(!myObjects.IsBound(anIObj)) return;
2815 const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
2817 Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
2818 if(STATUS->IsDModeIn(aMode)){
2819 if(DM==aMode && myMainPM->IsHighlighted(anIObj,aMode))
2820 myMainPM->Unhighlight(anIObj,aMode);
2822 myMainPM->Erase(anIObj,aMode);
2823 myMainPM->Clear(anIObj,aMode);
2826 if(STATUS->GraphicStatus()== AIS_DS_Erased)
2829 if(STATUS->IsHilighted())
2830 myCollectorPM->Unhighlight(anIObj,aMode);
2831 myCollectorPM->Erase(anIObj,DM);
2832 myCollectorPM->Clear(anIObj,DM);
2834 if(updateviewer) myCollectorVwr->Update();
2836 else if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer)
2837 myMainVwr->Update();
2840 //=======================================================================
2841 //function : DrawHiddenLine
2843 //=======================================================================
2845 Standard_Boolean AIS_InteractiveContext::DrawHiddenLine () const {
2847 return myDefaultDrawer->DrawHiddenLine();
2850 //=======================================================================
2851 //function : EnableDrawHiddenLine
2853 //=======================================================================
2855 void AIS_InteractiveContext::EnableDrawHiddenLine () const {
2856 myDefaultDrawer->EnableDrawHiddenLine();
2859 //=======================================================================
2860 //function : DisableDrawHiddenLine
2862 //=======================================================================
2864 void AIS_InteractiveContext::DisableDrawHiddenLine () const {
2865 myDefaultDrawer->DisableDrawHiddenLine();
2868 //=======================================================================
2869 //function : HiddenLineAspect
2871 //=======================================================================
2873 Handle (Prs3d_LineAspect) AIS_InteractiveContext::HiddenLineAspect () const {
2874 return myDefaultDrawer->HiddenLineAspect();
2877 //=======================================================================
2878 //function : SetHiddenLineAspect
2880 //=======================================================================
2882 void AIS_InteractiveContext::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) const {
2883 myDefaultDrawer->SetHiddenLineAspect(anAspect);
2886 //=======================================================================
2887 //function : SetIsoNumber
2889 //=======================================================================
2891 void AIS_InteractiveContext::SetIsoNumber(const Standard_Integer Nb,const AIS_TypeOfIso Type)
2895 myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
2898 myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
2901 myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
2902 myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
2907 //=======================================================================
2908 //function : IsoNumber
2910 //=======================================================================
2912 Standard_Integer AIS_InteractiveContext::IsoNumber(const AIS_TypeOfIso Type)
2917 return myDefaultDrawer->UIsoAspect()->Number();
2919 return myDefaultDrawer->VIsoAspect()->Number();
2921 return (myDefaultDrawer->UIsoAspect()->Number()==
2922 myDefaultDrawer->VIsoAspect()->Number()) ?
2923 myDefaultDrawer->UIsoAspect()->Number(): -1;
2928 //=======================================================================
2929 //function : IsoOnPlane
2931 //=======================================================================
2933 void AIS_InteractiveContext::IsoOnPlane(const Standard_Boolean SwitchOn)
2935 myDefaultDrawer->SetIsoOnPlane(SwitchOn);
2938 //=======================================================================
2939 //function : IsoOnPlane
2941 //=======================================================================
2943 Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const
2945 return myDefaultDrawer->IsoOnPlane();
2948 //=======================================================================
2949 //function : SetSelectionMode
2951 //=======================================================================
2953 void AIS_InteractiveContext::SetSelectionMode(const Handle_AIS_InteractiveObject&, const Standard_Integer )
2957 //=======================================================================
2958 //function : UnsetSelectionMode
2960 //=======================================================================
2962 void AIS_InteractiveContext::UnsetSelectionMode(const Handle_AIS_InteractiveObject&)
2967 //=======================================================================
2968 //function : SetSensitivity
2970 //=======================================================================
2972 void AIS_InteractiveContext::SetSensitivity(const Standard_Real aPrecision) {
2974 if( HasOpenedContext() )
2975 myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
2977 myMainSel->SetSensitivity(aPrecision);
2978 if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivity(aPrecision);
2982 //=======================================================================
2983 //function : SetSensitivity
2985 //=======================================================================
2987 void AIS_InteractiveContext::SetSensitivity(const Standard_Integer aPrecision) {
2989 if( HasOpenedContext() )
2990 myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
2992 myMainSel->Set(aPrecision);
2993 if( !myCollectorSel.IsNull() ) myCollectorSel->Set(aPrecision);
2998 //=======================================================================
2999 //function : IsInLocal
3001 //=======================================================================
3003 Standard_Boolean AIS_InteractiveContext::IsInLocal(const Handle_AIS_InteractiveObject& anIObj,
3004 Standard_Integer& TheIndex) const
3006 if(anIObj.IsNull()) return Standard_False;
3007 // s'il existe au point neutre on retourne l'index 0
3008 if(myObjects.IsBound(anIObj)) {
3010 return Standard_False;
3012 for(Standard_Integer I=1;I<=myLocalContexts.Extent();I++){
3013 if(myLocalContexts.IsBound(I)){
3014 if(myLocalContexts(I)->IsIn(anIObj)){
3016 return Standard_True;
3022 return Standard_False;
3025 //=======================================================================
3026 //function : InitAttributes
3028 //=======================================================================
3030 void AIS_InteractiveContext::InitAttributes()
3033 mgrSelector->Add(myMainSel);
3034 myCurrentName = AIS_Context_NewCurName();
3035 mySelectionName = AIS_Context_NewSelName();
3037 AIS_Selection::CreateSelection(mySelectionName.ToCString());
3038 AIS_Selection::CreateSelection(myCurrentName.ToCString());
3041 myDefaultDrawer->SetShadingAspectGlobal(Standard_False);
3042 Graphic3d_MaterialAspect aMat(Graphic3d_NOM_BRASS);
3043 myDefaultDrawer->ShadingAspect()->SetMaterial(aMat);
3045 // myDefaultDrawer->ShadingAspect()->SetColor(Quantity_NOC_GRAY70);
3046 Handle (Prs3d_LineAspect) HLA = myDefaultDrawer->HiddenLineAspect();
3047 HLA->SetColor(Quantity_NOC_GRAY20);
3049 HLA->SetTypeOfLine(Aspect_TOL_DASH);
3051 // tolerance a 4 pixels...
3058 // Customizing the drawer for trihedrons and planes...
3060 Handle (Prs3d_DatumAspect) DA = myDefaultDrawer->DatumAspect();
3061 Standard_Real aLength(100.);
3062 DA->SetAxisLength(aLength,aLength,aLength);
3063 Quantity_NameOfColor col = Quantity_NOC_LIGHTSTEELBLUE4;
3064 DA->FirstAxisAspect()->SetColor(col);
3065 DA->SecondAxisAspect()->SetColor(col);
3066 DA->ThirdAxisAspect()->SetColor(col);
3068 Handle(Prs3d_PlaneAspect)PA = myDefaultDrawer->PlaneAspect();
3070 PA->SetPlaneLength(aLength,aLength);
3071 PA->EdgesAspect()->SetColor(Quantity_NOC_SKYBLUE);
3077 //=======================================================================
3078 //function : TrihedronSize
3080 //=======================================================================
3081 Standard_Real AIS_InteractiveContext::TrihedronSize() const
3083 return myDefaultDrawer->DatumAspect()->FirstAxisLength();
3085 //=======================================================================
3086 //function : SetTrihedronSize
3088 //=======================================================================
3089 void AIS_InteractiveContext::SetTrihedronSize(const Standard_Real aVal,const Standard_Boolean /*updateviewer*/)
3091 myDefaultDrawer->DatumAspect()->SetAxisLength(aVal,aVal,aVal);
3092 Redisplay(AIS_KOI_Datum,3,Standard_False);
3093 Redisplay(AIS_KOI_Datum,4,Standard_True);
3098 //=======================================================================
3099 //function : SetPlaneSize
3101 //=======================================================================
3102 void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aValX,
3103 const Standard_Real aValY,
3104 const Standard_Boolean /*updateviewer*/)
3106 myDefaultDrawer->PlaneAspect()->SetPlaneLength(aValX,aValY);
3107 Redisplay(AIS_KOI_Datum,7);
3110 //=======================================================================
3111 //function : SetPlaneSize
3113 //=======================================================================
3115 void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aVal,
3116 const Standard_Boolean updateviewer)
3118 SetPlaneSize(aVal,aVal,updateviewer);
3121 //=======================================================================
3122 //function : PlaneSize
3124 //=======================================================================
3126 Standard_Boolean AIS_InteractiveContext::PlaneSize(Standard_Real& LX,Standard_Real& LY) const
3128 LX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
3129 LY = myDefaultDrawer->PlaneAspect()->PlaneYLength();
3130 return (Abs(LX-LY)<=Precision::Confusion());
3135 //=======================================================================
3138 //=======================================================================
3139 void AIS_InteractiveContext::SetAutoActivateSelection( const Standard_Boolean Auto )
3141 myIsAutoActivateSelMode = Auto;
3144 //=======================================================================
3147 //=======================================================================
3148 Standard_Boolean AIS_InteractiveContext::GetAutoActivateSelection() const
3150 return myIsAutoActivateSelMode;