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