Salome HOME
Copyright update 2022
[modules/shaper.git] / src / XGUI / XGUI_SelectionActivate.cpp
1 // Copyright (C) 2014-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "XGUI_SelectionActivate.h"
21
22 #include "ModelAPI_Object.h"
23
24 #include "ModuleBase_IModule.h"
25 #include "ModuleBase_IViewer.h"
26 #include "ModuleBase_ModelWidget.h"
27 #include "ModuleBase_Preferences.h"
28
29 #include "XGUI_ActiveControlMgr.h"
30 #include "XGUI_ActiveControlSelector.h"
31 #include "XGUI_Displayer.h"
32 #include "XGUI_FacesPanel.h"
33 #include "XGUI_FacesPanelSelector.h"
34 #include "XGUI_SelectionMgr.h"
35 #include "XGUI_Tools.h"
36 #include "XGUI_Workshop.h"
37
38 #include <SUIT_ResourceMgr.h>
39
40 #include <AIS_InteractiveContext.hxx>
41 #include <AIS_Shape.hxx>
42 #include <AIS_Trihedron.hxx>
43
44 #include <SelectMgr_SelectionManager.hxx>
45
46 //#define DEBUG_ACTIVATE_OBJECTS
47 //#define DEBUG_DEACTIVATE
48 //#define DEBUG_ACTIVATE_AIS
49 //#define DEBUG_DEACTIVATE_AIS
50
51 #ifdef TINSPECTOR
52 #include <inspector/VInspectorAPI_CallBack.hxx>
53 #endif
54
55 #define CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
56
57 //**************************************************************
58 XGUI_SelectionActivate::XGUI_SelectionActivate(ModuleBase_IWorkshop* theWorkshop)
59  : ModuleBase_ISelectionActivate(theWorkshop), myIsTrihedronActive(true)
60 {
61 }
62
63 //**************************************************************
64 XGUI_SelectionActivate::SelectionPlace XGUI_SelectionActivate::activeSelectionPlace() const
65 {
66   XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
67   XGUI_ActiveControlSelector* anActiveSelector = aWorkshop->activeControlMgr()->activeSelector();
68   if (!anActiveSelector)
69     return Workshop;
70
71   if (anActiveSelector->getType() == XGUI_FacesPanelSelector::Type())
72     return FacesPanel;
73   else
74     return PropertyPanel;
75 }
76
77 //**************************************************************
78 void XGUI_SelectionActivate::updateSelectionModes()
79 {
80   QIntList aModes;
81   switch (activeSelectionPlace()) {
82   case Workshop:
83     myWorkshop->module()->activeSelectionModes(aModes);
84     break;
85     case PropertyPanel: {
86       ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget();
87       if (anActiveWidget)
88         getSelectionModes(anActiveWidget, aModes);
89       else
90         myWorkshop->module()->activeSelectionModes(aModes); //using module modes
91     }
92     break;
93     case FacesPanel: {
94       XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionModes(aModes);
95       myWorkshop->module()->moduleSelectionModes(-1/*all modes*/, aModes);
96     }
97     break;
98     default: break;
99   }
100   activateObjects(aModes, getDisplayer()->displayedObjects(), true);
101 }
102
103 //**************************************************************
104 void XGUI_SelectionActivate::updateSelectionFilters()
105 {
106   SelectMgr_ListOfFilter aSelectionFilters;
107   switch (activeSelectionPlace()) {
108     case Workshop: {
109       QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
110       myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
111     }
112     break;
113     case PropertyPanel: {
114       QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
115
116       ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget();
117       if (anActiveWidget)
118         anActiveWidget->selectionFilters(aModuleSelectionFilters, aSelectionFilters);
119       myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
120     }
121     break;
122     case FacesPanel: {
123       XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionFilters(aSelectionFilters);
124       //QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
125       //myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
126     }
127     break;
128     default: break;
129   }
130   activateSelectionFilters(aSelectionFilters);
131 }
132
133 //**************************************************************
134 void XGUI_SelectionActivate::activateSelectionFilters
135   (const SelectMgr_ListOfFilter& theSelectionFilters)
136 {
137   XGUI_Displayer* aDisplayer = getDisplayer();
138   aDisplayer->deactivateSelectionFilters(false);
139
140   SelectMgr_ListIteratorOfListOfFilter aIt(theSelectionFilters);
141   for (; aIt.More(); aIt.Next()) {
142     Handle(SelectMgr_Filter) aFilter = aIt.Value();
143     if (aFilter.IsNull())
144       continue;
145     aDisplayer->addSelectionFilter(aFilter);
146   }
147 }
148
149 //**************************************************************
150 void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget,
151                                                QIntList& theModes)
152 {
153   if (!theWidget)
154     return;
155
156   int aModuleSelectionModes = -1;
157   theWidget->selectionModes(aModuleSelectionModes, theModes);
158   myWorkshop->module()->moduleSelectionModes(aModuleSelectionModes, theModes);
159 }
160
161 //**************************************************************
162 QIntList XGUI_SelectionActivate::activeSelectionModes() const
163 {
164   QIntList aModes;
165   foreach (int aMode, myActiveSelectionModes) {
166     // aMode < 9 is a Shape Enum values
167     aModes << ((aMode < 9)? AIS_Shape::SelectionType(aMode) : aMode);
168   }
169   return aModes;
170 }
171
172 //**************************************************************
173 bool XGUI_SelectionActivate::isActive(ObjectPtr theObject) const
174 {
175   Handle(AIS_InteractiveContext) aContext = AISContext();
176   if (aContext.IsNull() || !getDisplayer()->isVisible(theObject))
177     return false;
178
179   AISObjectPtr anObj = getDisplayedAISObject(theObject);
180   Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
181
182   TColStd_ListOfInteger aModes;
183   aContext->ActivatedModes(anAIS, aModes);
184
185   return aModes.Extent() > 0;
186 }
187
188 //**************************************************************
189 void XGUI_SelectionActivate::activateObjects(const QIntList& theModes,
190   const QObjectPtrList& theObjList, const bool theUpdateViewer)
191 {
192   setSelectionModes(theModes);
193
194   Handle(AIS_InteractiveContext) aContext = AISContext();
195   // Open local context if there is no one
196   if (aContext.IsNull())
197     return;
198
199   //aContext->UseDisplayedObjects();
200   //myUseExternalObjects = true;
201
202   Handle(AIS_InteractiveObject) anAISIO;
203   AIS_ListOfInteractive aPrsList;
204   AIS_ListOfInteractive aPrsListToBeDeactivated;
205   //if (aObjList.isEmpty())
206   //  return;
207   //else {
208   foreach(ObjectPtr anObject, theObjList) {
209     AISObjectPtr anAISObject = getDisplayedAISObject(anObject);
210     if (!anAISObject.get())
211       continue;
212
213     Handle(AIS_InteractiveObject) aPrs = anAISObject->impl<Handle(AIS_InteractiveObject)>();
214     if (myWorkshop->module()->canActivateSelection(anObject))
215       aPrsList.Append(aPrs);
216     else
217       aPrsListToBeDeactivated.Append(aPrs);
218   }
219   //}
220
221   // Add trihedron because it has to partisipate in selection
222   Handle(AIS_InteractiveObject) aTrihedron;
223   if (isTrihedronActive()) {
224     aTrihedron = getTrihedron();
225     if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron))
226       aPrsList.Append(aTrihedron);
227   }
228   if (aPrsList.Extent() == 0 && aPrsListToBeDeactivated.Extent() == 0)
229     return;
230
231   AIS_ListIteratorOfListOfInteractive aLIt;
232 #ifdef _DEBUG
233   bool isActivationChanged = false;
234 #endif
235   for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()) {
236     anAISIO = aLIt.Value();
237     if (activate(anAISIO, false)) {
238 #ifdef _DEBUG
239       isActivationChanged = true;
240 #endif
241     }
242   }
243
244   for(aLIt.Initialize(aPrsListToBeDeactivated); aLIt.More(); aLIt.Next()) {
245     anAISIO = aLIt.Value();
246     deactivateAIS(anAISIO);
247 #ifdef _DEBUG
248     isActivationChanged = true;
249 #endif
250   }
251 }
252
253 #ifdef DEBUG_ACTIVATE_OBJECTS
254 //**************************************************************
255 QString getModeInfo(const int theMode)
256 {
257   QString anInfo = "Undefined";
258   switch(theMode) {
259     case 0: anInfo = "SHAPE(0)"; break;
260     case 1: anInfo = "VERTEX(1)"; break;
261     case 2: anInfo = "EDGE(2)"; break;
262     case 3: anInfo = "WIRE(3)"; break;
263     case 4: anInfo = "FACE(4)"; break;
264     case 5: anInfo = "SHELL(5)"; break;
265     case 6: anInfo = "SOLID(6)"; break;
266     case 7: anInfo = "COMPSOLID(7)"; break;
267     case 8: anInfo = "COMPOUND(8)"; break;
268     case 100: anInfo = "Sel_Mode_First(100)"; break; //SketcherPrs_Tools
269     case 101: anInfo = "Sel_Constraint(101)"; break;
270     case 102: anInfo = "Sel_Dimension_All(102)"; break;
271     case 103: anInfo = "Sel_Dimension_Line(103)"; break;
272     case 104: anInfo = "Sel_Dimension_Text(104)"; break;
273     default: break;
274   }
275   return anInfo;
276 }
277
278 //**************************************************************
279 QString getModesInfo(const QIntList& theModes)
280 {
281   QStringList aModesInfo;
282   for (int i = 0, aSize = theModes.size(); i < aSize; i++)
283     aModesInfo.append(getModeInfo(theModes[i]));
284   return QString("[%1] = %2").arg(aModesInfo.size()).arg(aModesInfo.join(", "));
285 }
286 #endif
287
288 //**************************************************************
289 void XGUI_SelectionActivate::setSelectionModes(const QIntList& theModes)
290 {
291   // Convert shape types to selection types
292   QIntList aModes;
293   foreach(int aType, theModes) {
294     aModes.append(getSelectionMode(aType));
295   }
296
297 #ifdef DEBUG_ACTIVATE_OBJECTS
298   QStringList anInfo;
299   QObjectPtrList::const_iterator anIt = theObjList.begin(), aLast = theObjList.end();
300   for (; anIt != aLast; ++anIt) {
301     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
302   }
303   QString anInfoStr = anInfo.join(", ");
304
305   qDebug(QString("activateObjects: new modes%1, active modes%2, objects[%3] = %4").
306     arg(getModesInfo(aModes)).
307     arg(getModesInfo(myActiveSelectionModes)).
308     arg(theObjList.size()).
309     arg(anInfoStr).
310     toStdString().c_str());
311 #endif
312   // In order to avoid doblications of selection modes
313   QIntList aNewModes;
314   foreach (int aMode, aModes) {
315     if (!aNewModes.contains(aMode))
316       aNewModes.append(aMode);
317   }
318   myActiveSelectionModes = aNewModes;
319 }
320
321 //**************************************************************
322 void XGUI_SelectionActivate::activateOnDisplay(const Handle(AIS_InteractiveObject)& theIO,
323                                                const bool theUpdateViewer)
324 {
325   if (myActiveSelectionModes.size() == 0)
326     activateAIS(theIO, 0, theUpdateViewer);
327   else {
328     foreach(int aMode, myActiveSelectionModes) {
329       activateAIS(theIO, aMode, theUpdateViewer);
330     }
331   }
332 }
333
334 //**************************************************************
335 void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& theIO,
336                                          const int theMode, const bool theUpdateViewer) const
337 {
338   Handle(AIS_InteractiveContext) aContext = AISContext();
339   if (!theIO.IsNull() && theIO == getTrihedron()) {
340     if (theMode != AIS_Shape::SelectionType(TopAbs_EDGE) &&
341         theMode != AIS_Shape::SelectionType(TopAbs_VERTEX))
342       return;
343   }
344   if (!aContext.IsNull()) {
345     if (myWorkshop->module()) {
346       // the code is obsolete, used in additional check before activate, it was removed
347       //int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
348       aContext->Activate(theIO, theMode, false);
349 #ifdef TINSPECTOR
350       if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
351 #endif
352     }
353     else {
354       aContext->Activate(theIO, theMode, false);
355 #ifdef TINSPECTOR
356       if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
357 #endif
358     }
359     // the fix from VPA for more suitable selection of sketcher lines
360     if (theIO->Width() > 1) {
361       double aPrecision = theIO->Width() + 2;
362       if (theMode == getSelectionMode(TopAbs_VERTEX))
363         aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
364         "point-selection-sensitivity", 12);
365       else if ((theMode == getSelectionMode(TopAbs_EDGE)) ||
366                (theMode == getSelectionMode(TopAbs_WIRE)))
367         aPrecision = theIO->Width() + ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
368            "edge-selection-sensitivity", 2);
369       if (aPrecision <= 0)
370         aPrecision = 2;
371       aContext->SetSelectionSensitivity(theIO, theMode, aPrecision);
372     }
373
374 #ifdef DEBUG_ACTIVATE_AIS
375     ObjectPtr anObject = getObject(theIO);
376     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
377     qDebug(QString("activateAIS: theMode = %1, object = %2").arg(theMode)
378       .arg(anInfo).toStdString().c_str());
379 #endif
380     if (theUpdateViewer)
381       getDisplayer()->updateViewer();
382   }
383 }
384
385 //**************************************************************
386 void XGUI_SelectionActivate::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
387                                            const int theMode) const
388 {
389   Handle(AIS_InteractiveContext) aContext = AISContext();
390   if (!aContext.IsNull()) {
391     if (theMode == -1)
392       aContext->Deactivate(theIO);
393     else
394       aContext->Deactivate(theIO, theMode);
395
396 #ifdef DEBUG_DEACTIVATE_AIS
397     ObjectPtr anObject = getObject(theIO);
398     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
399     qDebug(QString("deactivateAIS: theMode = %1, object = %2").arg(theMode)
400       .arg(anInfo).toStdString().c_str());
401 #endif
402   }
403 }
404
405 //**************************************************************
406 bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject)& theIO,
407                                       const bool theUpdateViewer) const
408 {
409   Handle(AIS_InteractiveContext) aContext = AISContext();
410   if (aContext.IsNull() || theIO.IsNull())
411     return false;
412
413   bool isActivationChanged = false;
414   // deactivate object in all modes, which are not in the list of activation
415   // It seems that after the IO deactivation the selected state of the IO's owners
416   // is modified in OCC(version: 6.8.0) and the selection of the object later is lost.
417   // By this reason, the number of the IO deactivate is decreased and the object is deactivated
418   // only if there is a difference in the current modes and the parameters modes.
419   // If the selection problem happens again, it is possible to write a test scenario and create
420   // a bug. The bug steps are the following:
421   // Create two IO, activate them in 5 modes, select the first IO, deactivate 3 modes for both,
422   // with clicked SHIFT select the second object.
423   // The result is the selection of the first IO is lost.
424   TColStd_ListOfInteger aTColModes;
425   aContext->ActivatedModes(theIO, aTColModes);
426   TColStd_ListIteratorOfListOfInteger itr( aTColModes );
427   QIntList aModesActivatedForIO;
428   bool isDeactivated = false;
429   bool aHasValidMode = false;
430   for (; itr.More(); itr.Next() ) {
431     Standard_Integer aMode = itr.Value();
432     aHasValidMode = aHasValidMode || aMode != -1;
433     //int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode);
434     if (!myActiveSelectionModes.contains(aMode)) {
435       deactivateAIS(theIO, aMode);
436       isDeactivated = true;
437     }
438     else {
439       aModesActivatedForIO.append(aMode);
440     }
441   }
442   if (isDeactivated) {
443     // the selection from the previous activation modes should be cleared manually (#26172)
444     //theIO->ClearSelected();
445 #ifndef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
446     XGUI_Tools::workshop(myWorkshop)->selector()->deselectPresentation(theIO);
447 #endif
448     // For performance issues
449     //if (theUpdateViewer)
450     //  getDisplayer()->updateViewer();
451     isActivationChanged = true;
452   }
453
454   // loading the interactive object allowing the decomposition
455   if (aTColModes.IsEmpty() || !aHasValidMode) {
456     aContext->Load(theIO);
457     Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO);
458     if (!aTrihedron.IsNull()) {
459       // Workaround for Trihedron. It should be loaded using the next Load method to
460       // add this object to myGlobal map of selection manager
461       // it is important to activate trihedron in two selection modes: edges and vertices
462       aContext->SelectionManager()->Load(theIO);
463     }
464   }
465
466   // trihedron AIS check should be after the AIS loading.
467   // If it is not loaded, it is steel selectable in the viewer.
468   Handle(AIS_Trihedron) aTrihedron;
469   if (!isTrihedronActive())
470     aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO);
471   if (aTrihedron.IsNull()) {
472       // In order to clear active modes list
473     if (myActiveSelectionModes.size() == 0) {
474       activateAIS(theIO, 0, theUpdateViewer);
475     } else {
476       foreach(int aMode, myActiveSelectionModes) {
477         if (!aModesActivatedForIO.contains(aMode)) {
478           activateAIS(theIO, aMode, theUpdateViewer);
479           isActivationChanged = true;
480         }
481       }
482     }
483   }
484   return isActivationChanged;
485 }
486
487 //**************************************************************
488 void XGUI_SelectionActivate::deactivate(const ObjectPtr& theObject, const bool theUpdateViewer)
489 {
490 #ifdef DEBUG_DEACTIVATE
491   QString anInfoStr = ModuleBase_Tools::objectInfo(theObject);
492   qDebug(QString("deactivate: myActiveSelectionModes[%1]: %2, objects = ").
493     arg(myActiveSelectionModes.size()).arg(qIntListInfo(myActiveSelectionModes)).
494     arg(anInfoStr).
495     toStdString().c_str());
496 #endif
497   Handle(AIS_InteractiveContext) aContext = AISContext();
498   if (!aContext.IsNull() && getDisplayer()->isVisible(theObject)) {
499     AISObjectPtr anObj = getDisplayedAISObject(theObject);
500     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
501
502     deactivateAIS(anAIS);
503     // the selection from the previous activation modes should be cleared manually (#26172)
504 #ifndef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
505     XGUI_Tools::workshop(myWorkshop)->selector()->deselectPresentation(anAIS);
506 #endif
507     if (theUpdateViewer)
508       getDisplayer()->updateViewer();
509   }
510 }
511
512 /// #1136 hidden axis are selected in sketch
513 #ifdef BEFORE_TRIHEDRON_PATCH
514 //**************************************************************
515 void deactivateObject(Handle(AIS_InteractiveContext) theContext,
516                       Handle(AIS_InteractiveObject) theObject)
517 {
518   if (!theObject.IsNull())
519     theContext->Deactivate(theObject);
520 }
521 #endif
522
523 //**************************************************************
524 void XGUI_SelectionActivate::activateTrihedron(bool theIsActive)
525 {
526   myIsTrihedronActive = theIsActive;
527   if (!myIsTrihedronActive)
528     deactivateTrihedron(true);
529 }
530
531 //**************************************************************
532 void XGUI_SelectionActivate::deactivateTrihedron(const bool theUpdateViewer) const
533 {
534   Handle(AIS_InteractiveObject) aTrihedron = getTrihedron();
535   Handle(AIS_InteractiveContext) aContext = AISContext();
536   if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) {
537     Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
538     if (!aTrie.IsNull())
539       aContext->Deactivate(aTrie);
540
541     /// #1136 hidden axis are selected in sketch
542 #ifdef BEFORE_TRIHEDRON_PATCH
543     deactivateObject(aContext, aTrie->XAxis());
544     deactivateObject(aContext, aTrie->YAxis());
545     deactivateObject(aContext, aTrie->Axis());
546     deactivateObject(aContext, aTrie->Position());
547
548     deactivateObject(aContext, aTrie->XYPlane());
549     deactivateObject(aContext, aTrie->XZPlane());
550     deactivateObject(aContext, aTrie->YZPlane());
551 #endif
552     if (theUpdateViewer)
553       getDisplayer()->updateViewer();
554   }
555 }
556
557 //**************************************************************
558 void XGUI_SelectionActivate::deactivateTrihedronInSelectionModes()
559 {
560   Handle(AIS_InteractiveContext) aContext = AISContext();
561   if (!aContext.IsNull()) {
562     Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(getTrihedron());
563     /// deactivate trihedron in selection modes
564     TColStd_ListOfInteger aTColModes;
565     aContext->ActivatedModes(aTrihedron, aTColModes);
566     TColStd_ListIteratorOfListOfInteger itr(aTColModes);
567     for (; itr.More(); itr.Next()) {
568       Standard_Integer aMode = itr.Value();
569       aContext->Deactivate(aTrihedron, aMode);
570     }
571   }
572 }
573
574 //**************************************************************
575 Handle(AIS_InteractiveContext) XGUI_SelectionActivate::AISContext() const
576 {
577   return myWorkshop->viewer()->AISContext();
578 }
579
580 //**************************************************************
581 XGUI_Displayer* XGUI_SelectionActivate::getDisplayer() const
582 {
583   return XGUI_Tools::workshop(myWorkshop)->displayer();
584 }
585
586 //**************************************************************
587 Handle(AIS_InteractiveObject) XGUI_SelectionActivate::getTrihedron() const
588 {
589   return myWorkshop->viewer()->trihedron();
590 }
591
592 //**************************************************************
593 AISObjectPtr XGUI_SelectionActivate::getDisplayedAISObject(ObjectPtr theObject) const
594 {
595   return getDisplayer()->getAISObject(theObject);
596 }
597
598 //**************************************************************
599 int XGUI_SelectionActivate::getSelectionMode(int theShapeType)
600 {
601   return (theShapeType > TopAbs_SHAPE) ? theShapeType :
602                                          AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType);
603 }