Salome HOME
35443aa1eed3da8eb246f8d9eb725c131d31981e
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        XGUI_Displayer.cpp
4 // Created:     20 Apr 2014
5 // Author:      Natalia ERMOLAEVA
6
7 #include "XGUI_Displayer.h"
8 #include "XGUI_Workshop.h"
9 #include "XGUI_ViewerProxy.h"
10 #include "XGUI_SelectionMgr.h"
11 #include "XGUI_Selection.h"
12 #include "XGUI_CustomPrs.h"
13
14 #ifndef HAVE_SALOME
15 #include <AppElements_Viewer.h>
16 #endif
17
18 #include <ModelAPI_Document.h>
19 #include <ModelAPI_Data.h>
20 #include <ModelAPI_Object.h>
21 #include <ModelAPI_Tools.h>
22 #include <ModelAPI_AttributeIntArray.h>
23 #include <ModelAPI_ResultCompSolid.h>
24
25 #include <ModuleBase_ResultPrs.h>
26 #include <ModuleBase_Tools.h>
27 #include <ModuleBase_IModule.h>
28
29 #include <GeomAPI_Shape.h>
30 #include <GeomAPI_IPresentable.h>
31 #include <GeomAPI_ICustomPrs.h>
32
33 #include <AIS_InteractiveContext.hxx>
34 #include <AIS_LocalContext.hxx>
35 #include <AIS_ListOfInteractive.hxx>
36 #include <AIS_ListIteratorOfListOfInteractive.hxx>
37 #include <AIS_DimensionSelectionMode.hxx>
38 #include <AIS_Shape.hxx>
39 #include <AIS_Dimension.hxx>
40 #include <AIS_Trihedron.hxx>
41 #include <TColStd_ListIteratorOfListOfInteger.hxx>
42 #include <SelectMgr_ListOfFilter.hxx>
43 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
44 #include <Prs3d_Drawer.hxx>
45 #include <Prs3d_IsoAspect.hxx>
46 #include <SelectMgr_SelectionManager.hxx>
47
48 #include <StdSelect_ViewerSelector3d.hxx>
49
50 #include <TColStd_MapOfTransient.hxx>
51 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
52
53 #include <Events_Loop.h>
54 #include <ModelAPI_Events.h>
55
56 #include <set>
57
58 const int MOUSE_SENSITIVITY_IN_PIXEL = 10;  ///< defines the local context mouse selection sensitivity
59
60 #define WORKAROUND_691
61
62 //#define DEBUG_ACTIVATE_OBJECTS
63 //#define DEBUG_DEACTIVATE
64 //#define DEBUG_ACTIVATE_AIS
65 //#define DEBUG_DEACTIVATE_AIS
66
67 //#define DEBUG_DISPLAY
68 //#define DEBUG_FEATURE_REDISPLAY
69 //#define DEBUG_SELECTION_FILTERS
70
71 //#define DEBUG_COMPOSILID_DISPLAY
72 // Workaround for bug #25637
73 void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList)
74 {
75   // Get from null point
76   theAIS->DisplayedObjects(theList, true);
77   if (theAIS->HasOpenedContext()) {
78     // get from local context
79     const Handle(AIS_LocalContext)& aLC = theAIS->LocalContext();
80     TColStd_MapOfTransient aMap;
81     int NbDisp = aLC->DisplayedObjects(aMap);
82     TColStd_MapIteratorOfMapOfTransient aIt(aMap);
83
84     Handle(AIS_InteractiveObject) curIO;
85     Handle(Standard_Transient) Tr;
86     for(; aIt.More(); aIt.Next()){
87       Tr = aIt.Key();
88       curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
89       theList.Append(curIO);
90     }
91   }
92 }
93
94 QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QString(", "))
95 {
96   QStringList anInfo;
97   QIntList::const_iterator anIt = theValues.begin(), aLast = theValues.end();
98   for (; anIt != aLast; anIt++) {
99     anInfo.append(QString::number(*anIt));
100   }
101   return anInfo.join(theSeparator);
102 }
103
104 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
105   : myWorkshop(theWorkshop), myEnableUpdateViewer(true), myNeedUpdate(false),
106   myIsTrihedronActive(false)
107 {
108   enableUpdateViewer(true);
109   myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs());
110 }
111
112 XGUI_Displayer::~XGUI_Displayer()
113 {
114 }
115
116 bool XGUI_Displayer::isVisible(ObjectPtr theObject) const
117 {
118   return myResult2AISObjectMap.contains(theObject);
119 }
120
121 bool XGUI_Displayer::display(ObjectPtr theObject, bool theUpdateViewer)
122 {
123   bool aDisplayed = false;
124   if (isVisible(theObject)) {
125 #ifdef DEBUG_COMPOSILID_DISPLAY
126     ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
127     if (aCompsolidResult.get()) {
128       for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
129         ResultPtr aSubResult = aCompsolidResult->subResult(i);
130         if (aSubResult.get())
131           redisplay(aSubResult, false);
132       }
133       if (theUpdateViewer)
134         updateViewer();
135     }
136     else
137 #endif
138     aDisplayed = redisplay(theObject, theUpdateViewer);
139   } else {
140     AISObjectPtr anAIS;
141     GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
142     bool isShading = false;
143     if (aPrs.get() != NULL) {
144       anAIS = aPrs->getAISObject(anAIS);
145     } else {
146       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
147       if (aResult.get() != NULL) {
148 #ifdef DEBUG_COMPOSILID_DISPLAY
149         ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
150         if (aCompsolidResult.get()) {
151           for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
152             ResultPtr aSubResult = aCompsolidResult->subResult(i);
153             if (aSubResult.get())
154               display(aSubResult, false);
155           }
156           if (theUpdateViewer)
157             updateViewer();
158         }
159         else {
160 #endif
161         std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
162         if (aShapePtr.get() != NULL) {
163           anAIS = AISObjectPtr(new GeomAPI_AISObject());
164           anAIS->setImpl(new Handle(AIS_InteractiveObject)(new ModuleBase_ResultPrs(aResult)));
165           //anAIS->createShape(aShapePtr);
166           isShading = true;
167         }
168 #ifdef DEBUG_COMPOSILID_DISPLAY
169         } // close else
170 #endif
171       }
172     }
173     if (anAIS)
174       aDisplayed = display(theObject, anAIS, isShading, theUpdateViewer);
175   }
176   return aDisplayed;
177 }
178
179 bool canBeShaded(Handle(AIS_InteractiveObject) theAIS)
180 {
181   Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(theAIS);
182   if (!aShapePrs.IsNull()) {
183     TopoDS_Shape aShape = aShapePrs->Shape();
184     if (aShape.IsNull())
185       return false;
186     TopAbs_ShapeEnum aType = aShape.ShapeType();
187     if ((aType == TopAbs_VERTEX) || (aType == TopAbs_EDGE) || (aType == TopAbs_WIRE))
188       return false;
189     else {
190       // Check that the presentation is not a sketch
191       Handle(ModuleBase_ResultPrs) aPrs = Handle(ModuleBase_ResultPrs)::DownCast(theAIS);
192       if (!aPrs.IsNull()) 
193         return !aPrs->isSketchMode();
194       return true;
195     }
196   }
197   return false;
198 }
199
200 bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, 
201                              bool isShading, bool theUpdateViewer)
202 {
203   bool aDisplayed = false;
204
205   Handle(AIS_InteractiveContext) aContext = AISContext();
206   if (aContext.IsNull())
207     return aDisplayed;
208
209   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
210   if (!anAISIO.IsNull()) {
211     appendResultObject(theObject, theAIS);
212
213     bool isCustomized = customizeObject(theObject);
214
215     int aDispMode = isShading? Shading : Wireframe;
216     if (isShading)
217       anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
218     anAISIO->SetDisplayMode(aDispMode);
219     aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed); 
220     aDisplayed = true;
221
222     emit objectDisplayed(theObject, theAIS);
223     activate(anAISIO, myActiveSelectionModes, theUpdateViewer);
224     // the fix from VPA for more suitable selection of sketcher lines
225     if(anAISIO->Width() > 1) {
226       for(int aModeIdx = 0; aModeIdx < myActiveSelectionModes.length(); ++aModeIdx) {
227         int aMode = myActiveSelectionModes.value(aModeIdx);
228         double aPrecision = (aMode == getSelectionMode(TopAbs_VERTEX))? 20 : 
229                                                     (anAISIO->Width() + 2);
230         aContext->SetSelectionSensitivity(anAISIO, aMode, aPrecision);
231       }
232     }
233   } 
234   if (theUpdateViewer)
235     updateViewer();
236
237   return aDisplayed;
238 }
239
240 bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
241 {
242   bool aErased = false;
243   if (!isVisible(theObject))
244     return aErased;
245
246   Handle(AIS_InteractiveContext) aContext = AISContext();
247   if (aContext.IsNull())
248     return aErased;
249
250   AISObjectPtr anObject = myResult2AISObjectMap[theObject];
251   if (anObject) {
252     Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
253     if (!anAIS.IsNull()) {
254       emit beforeObjectErase(theObject, anObject);
255       aContext->Remove(anAIS, theUpdateViewer);
256       aErased = true;
257     }
258   }
259   myResult2AISObjectMap.remove(theObject);
260
261 #ifdef DEBUG_DISPLAY
262   std::ostringstream aPtrStr;
263   aPtrStr << theObject.get();
264   qDebug(QString("erase object: %1").arg(aPtrStr.str().c_str()).toStdString().c_str());
265   qDebug(getResult2AISObjectMapInfo().c_str());
266 #endif
267   return aErased;
268 }
269
270 bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
271 {
272   bool aRedisplayed = false;
273   if (!isVisible(theObject))
274     return aRedisplayed;
275
276   AISObjectPtr aAISObj = getAISObject(theObject);
277   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
278
279   GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
280   if (aPrs) {
281     AISObjectPtr aAIS_Obj = aPrs->getAISObject(aAISObj);
282     if (!aAIS_Obj) {
283       aRedisplayed = erase(theObject, theUpdateViewer);
284       return aRedisplayed;
285     }
286     if (aAIS_Obj != aAISObj) {
287       appendResultObject(theObject, aAIS_Obj);
288     }
289     aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
290   }
291
292   Handle(AIS_InteractiveContext) aContext = AISContext();
293   if (!aContext.IsNull() && !aAISIO.IsNull()) {
294     // Check that the visualized shape is the same and the redisplay is not necessary
295     // Redisplay of AIS object leads to this object selection compute and the selection 
296     // in the browser is lost
297     // this check is not necessary anymore because the selection store/restore is realized
298     // before and after the values modification.
299     // Moreother, this check avoids customize and redisplay presentation if the presentable
300     // parameter is changed.
301     bool isEqualShapes = false;
302     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
303     if (aResult.get() != NULL) {
304       Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
305       if (!aShapePrs.IsNull()) {
306         std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
307         if (aShapePtr.get()) {
308           const TopoDS_Shape& aOldShape = aShapePrs->Shape();
309           if (!aOldShape.IsNull())
310             isEqualShapes = aOldShape.IsEqual(aShapePtr->impl<TopoDS_Shape>());
311         }
312       }
313     }
314     // Customization of presentation
315     bool isCustomized = customizeObject(theObject);
316     #ifdef DEBUG_FEATURE_REDISPLAY
317       qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
318         arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
319     #endif
320     if (!isEqualShapes || isCustomized) {
321 #ifdef WORKAROUND_691
322       // this is a workaround for OCCT 6.9.1, selection area is wrong
323       // on sketch and 3D features
324       aContext->RecomputePrsOnly (aAISIO, false);
325       aContext->SelectionManager()->RecomputeSelection (aAISIO, true);
326       aContext->LocalContext()->ClearOutdatedSelection (aAISIO, false);
327 #else
328       aContext->Redisplay(aAISIO, false);
329 #endif
330       aRedisplayed = true;
331       #ifdef DEBUG_FEATURE_REDISPLAY
332         qDebug("  Redisplay happens");
333       #endif
334       if (theUpdateViewer)
335         updateViewer();
336     }
337   }
338   return aRedisplayed;
339 }
340
341 void XGUI_Displayer::redisplayObjects()
342 {
343   // redisplay objects visualized in the viewer
344   static Events_ID EVENT_DISP = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
345   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
346   QObjectPtrList aDisplayed = myWorkshop->displayer()->displayedObjects();
347   QObjectPtrList::const_iterator anIt = aDisplayed.begin(), aLast = aDisplayed.end();
348   for (; anIt != aLast; anIt++) {
349     aECreator->sendUpdated(*anIt, EVENT_DISP);
350   }
351   Events_Loop::loop()->flush(EVENT_DISP);
352 }
353
354 void XGUI_Displayer::deactivate(ObjectPtr theObject, const bool theUpdateViewer)
355 {
356 #ifdef DEBUG_DEACTIVATE
357   QString anInfoStr = ModuleBase_Tools::objectInfo(theObject);
358   qDebug(QString("deactivate: myActiveSelectionModes[%1]: %2, objects = ").
359     arg(myActiveSelectionModes.size()).arg(qIntListInfo(myActiveSelectionModes)).
360     arg(anInfoStr).
361     toStdString().c_str());
362 #endif
363   Handle(AIS_InteractiveContext) aContext = AISContext();
364   if (!aContext.IsNull() && isVisible(theObject)) {
365     AISObjectPtr anObj = myResult2AISObjectMap[theObject];
366     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
367
368     deactivateAIS(anAIS);
369     // the selection from the previous activation modes should be cleared manually (#26172)
370     aContext->LocalContext()->ClearOutdatedSelection(anAIS, true);
371     if (theUpdateViewer)
372       updateViewer();
373   }
374 }
375
376 void XGUI_Displayer::deactivateObjects(const QObjectPtrList& theObjList,
377                                        const bool theUpdateViewer)
378 {
379   //Handle(AIS_InteractiveObject) aTrihedron = getTrihedron();
380   //if (!aTrihedron.IsNull())
381   //  deactivateAIS(aTrihedron);
382
383   QObjectPtrList::const_iterator anIt = theObjList.begin(), aLast = theObjList.end();
384   for (; anIt != aLast; anIt++) {
385     deactivate(*anIt, false);
386   }
387   //VSV It seems that there is no necessity to update viewer on deactivation
388   //if (theUpdateViewer)
389   //  updateViewer();
390 }
391
392 void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes)
393 {
394   Handle(AIS_InteractiveContext) aContext = AISContext();
395   if (aContext.IsNull() || !isVisible(theObject))
396     return;
397
398   AISObjectPtr aAISObj = getAISObject(theObject);
399
400   if (aAISObj.get() != NULL) {
401     Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
402     TColStd_ListOfInteger aTColModes;
403     aContext->ActivatedModes(anAISIO, aTColModes);
404     TColStd_ListIteratorOfListOfInteger itr( aTColModes );
405     for (; itr.More(); itr.Next() ) {
406       theModes.append(itr.Value());
407     }
408   }
409 }
410
411 int XGUI_Displayer::getSelectionMode(int theShapeType)
412 {
413   return (theShapeType >= TopAbs_SHAPE)? theShapeType : 
414     AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theShapeType);
415 }
416
417 void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrList& theObjList,
418                                      const bool theUpdateViewer)
419 {
420   // Convert shape types to selection types
421   QIntList aModes;
422   foreach(int aType, theModes) {
423     aModes.append(getSelectionMode(aType));
424   }
425
426 #ifdef DEBUG_ACTIVATE_OBJECTS
427   QStringList anInfo;
428   QObjectPtrList::const_iterator anIt = theObjList.begin(), aLast = theObjList.end();
429   for (; anIt != aLast; ++anIt) {
430     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
431   }
432   QString anInfoStr = anInfo.join(", ");
433
434   qDebug(QString("activateObjects: aModes[%1] = %2, myActiveSelectionModes[%3] = %4, objects = %5").
435     arg(aModes.size()).arg(qIntListInfo(aModes)).
436     arg(myActiveSelectionModes.size()).arg(qIntListInfo(myActiveSelectionModes)).
437     arg(anInfoStr).
438     toStdString().c_str());
439 #endif
440   // In order to avoid doblications of selection modes
441   QIntList aNewModes;
442   foreach (int aMode, aModes) {
443     if (!aNewModes.contains(aMode))
444       aNewModes.append(aMode);
445   }
446   myActiveSelectionModes = aNewModes;
447   Handle(AIS_InteractiveContext) aContext = AISContext();
448   // Open local context if there is no one
449   if (aContext.IsNull() || !aContext->HasOpenedContext()) 
450     return;
451
452   //aContext->UseDisplayedObjects();
453   //myUseExternalObjects = true;
454
455   Handle(AIS_InteractiveObject) anAISIO;
456   AIS_ListOfInteractive aPrsList;
457   //if (aObjList.isEmpty())
458   //  return;
459   //else {
460   foreach(ObjectPtr aObj, theObjList) {
461     if (myResult2AISObjectMap.contains(aObj))
462       aPrsList.Append(myResult2AISObjectMap[aObj]->impl<Handle(AIS_InteractiveObject)>());
463   }
464   //}
465
466   // Add trihedron because it has to partisipate in selection
467   Handle(AIS_InteractiveObject) aTrihedron;
468   if (isTrihedronActive()) {
469     aTrihedron = getTrihedron();
470     if (!aTrihedron.IsNull())
471       aPrsList.Append(aTrihedron);
472   }
473   if (aPrsList.Extent() == 0)
474     return;
475
476   AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
477   bool isActivationChanged = false;
478   for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
479     anAISIO = aLIt.Value();
480     if (activate(anAISIO, myActiveSelectionModes, false))
481       isActivationChanged = true;
482   }
483   if (!aTrihedron.IsNull()) {
484     foreach(int aMode, myActiveSelectionModes)
485       aContext->SetSelectionSensitivity(aTrihedron, aMode, 20);
486   }
487   // VSV It seems that there is no necessity to update viewer on activation
488   //if (theUpdateViewer && isActivationChanged)
489   //  updateViewer();
490 }
491
492 bool XGUI_Displayer::isActive(ObjectPtr theObject) const
493 {
494   Handle(AIS_InteractiveContext) aContext = AISContext();
495   if (aContext.IsNull() || !isVisible(theObject))
496     return false;
497     
498   AISObjectPtr anObj = myResult2AISObjectMap[theObject];
499   Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
500
501   TColStd_ListOfInteger aModes;
502   aContext->ActivatedModes(anAIS, aModes);
503   return aModes.Extent() > 0;
504 }
505 void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrs>& theValues, bool theUpdateViewer)
506 {
507   Handle(AIS_InteractiveContext) aContext = AISContext();
508   if (aContext.IsNull())
509     return;
510   if (aContext->HasOpenedContext()) {
511     aContext->UnhilightSelected();
512     aContext->ClearSelected();
513     foreach (ModuleBase_ViewerPrs aPrs, theValues) {
514       const TopoDS_Shape& aShape = aPrs.shape();
515       if (!aShape.IsNull()) {
516         aContext->AddOrRemoveSelected(aShape, false);
517       } else {
518         ObjectPtr anObject = aPrs.object();
519         ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
520         if (aResult.get() && isVisible(aResult)) {
521           AISObjectPtr anObj = myResult2AISObjectMap[aResult];
522           Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
523           if (!anAIS.IsNull()) {
524             // The methods are replaced in order to provide multi-selection, e.g. restore selection
525             // by activating multi selector widget. It also gives an advantage that the multi
526             // selection in OB gives multi-selection in the viewer
527             //aContext->SetSelected(anAIS, false);
528             // The selection in the context was cleared, so the method sets the objects are selected
529             aContext->AddOrRemoveSelected(anAIS, false);
530           }
531         }
532       }
533     }
534   } else {
535     aContext->UnhilightCurrents();
536     aContext->ClearCurrents();
537     foreach (ModuleBase_ViewerPrs aPrs, theValues) {
538       ObjectPtr anObject = aPrs.object();
539       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
540       if (aResult.get() && isVisible(aResult)) {
541         AISObjectPtr anObj = myResult2AISObjectMap[aResult];
542         Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
543         if (!anAIS.IsNull())
544           aContext->SetCurrentObject(anAIS, false);
545       }
546     }
547   }
548   if (theUpdateViewer)
549     updateViewer();
550 }
551
552 void XGUI_Displayer::clearSelected()
553 {
554   Handle(AIS_InteractiveContext) aContext = AISContext();
555   if (!aContext.IsNull()) {
556     aContext->UnhilightCurrents(false);
557     aContext->ClearSelected();
558   }
559 }
560
561 bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
562 {
563   bool aErased = false;
564   Handle(AIS_InteractiveContext) aContext = AISContext();
565   if (!aContext.IsNull()) {
566     foreach (ObjectPtr aObj, myResult2AISObjectMap.keys()) {
567       AISObjectPtr aAISObj = myResult2AISObjectMap[aObj];
568       // erase an object
569       Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
570       if (!anIO.IsNull()) {
571         emit beforeObjectErase(aObj, aAISObj);
572         aContext->Remove(anIO, false);
573         aErased = true;
574       }
575     }
576     if (theUpdateViewer)
577       updateViewer();
578   }
579   myResult2AISObjectMap.clear();
580 #ifdef DEBUG_DISPLAY
581   qDebug("eraseAll");
582   qDebug(getResult2AISObjectMapInfo().c_str());
583 #endif
584   return aErased;
585 }
586
587 #define DEACTVATE_COMP(TheComp) \
588   if (!TheComp.IsNull()) \
589     aContext->Deactivate(TheComp);
590
591 void XGUI_Displayer::deactivateTrihedron() const
592 {
593   Handle(AIS_InteractiveObject) aTrihedron = getTrihedron();
594   if (!aTrihedron.IsNull()) {
595     Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
596     Handle(AIS_InteractiveContext) aContext = AISContext();
597     aContext->Deactivate(aTrie);
598     DEACTVATE_COMP(aTrie->XAxis());
599     DEACTVATE_COMP(aTrie->YAxis());
600     DEACTVATE_COMP(aTrie->Axis());
601     DEACTVATE_COMP(aTrie->Position());
602     DEACTVATE_COMP(aTrie->XYPlane());
603     DEACTVATE_COMP(aTrie->XZPlane());
604     DEACTVATE_COMP(aTrie->YZPlane());
605   }
606 }
607
608 Handle(AIS_InteractiveObject) XGUI_Displayer::getTrihedron() const
609 {
610   Handle(AIS_InteractiveContext) aContext = AISContext();
611   if (!aContext.IsNull()) {
612     AIS_ListOfInteractive aList;
613     aContext->DisplayedObjects(aList, true);
614     AIS_ListIteratorOfListOfInteractive aIt;
615     for (aIt.Initialize(aList); aIt.More(); aIt.Next()) {
616       Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(aIt.Value());
617       if (!aTrihedron.IsNull()) {
618         return aTrihedron;
619       }
620     }
621   }
622   return Handle(AIS_InteractiveObject)();
623 }
624
625 void XGUI_Displayer::openLocalContext()
626 {
627   Handle(AIS_InteractiveContext) aContext = AISContext();
628   // Open local context if there is no one
629   if (!aContext.IsNull() && !aContext->HasOpenedContext()) {
630     // Preserve selected objects
631     //AIS_ListOfInteractive aAisList;
632     //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
633     //  aAisList.Append(aContext->Current());
634
635     // get the filters from the global context and append them to the local context
636     // a list of filters in the global context is not cleared and should be cleared here
637     SelectMgr_ListOfFilter aFilters;
638     aFilters.Assign(aContext->Filters());
639     // it is important to remove the filters in the global context, because there is a code
640     // in the closeLocalContex, which restore the global context filters
641     aContext->RemoveFilters();
642
643     //aContext->ClearCurrents();
644     aContext->OpenLocalContext();
645     //deactivateTrihedron();
646     //aContext->NotUseDisplayedObjects();
647
648     //myUseExternalObjects = false;
649
650     SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
651     for (;aIt.More(); aIt.Next()) {
652       aContext->AddFilter(aIt.Value());
653     }
654     // Restore selection
655     //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
656     //for(; aIt2.More(); aIt2.Next()) {
657     //  aContext->SetSelected(aIt2.Value(), false);
658     //}
659   }
660 }
661
662 void XGUI_Displayer::closeLocalContexts(const bool theUpdateViewer)
663 {
664   Handle(AIS_InteractiveContext) aContext = AISContext();
665   if (!aContext.IsNull() && aContext->HasOpenedContext()) {
666     // Preserve selected objects
667     //AIS_ListOfInteractive aAisList;
668     //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
669     //  aAisList.Append(aContext->SelectedInteractive());
670
671     // get the filters from the local context and append them to the global context
672     // a list of filters in the local context is cleared
673     SelectMgr_ListOfFilter aFilters;
674     aFilters.Assign(aContext->Filters());
675
676     //aContext->ClearSelected();
677     aContext->CloseAllContexts(false);
678
679     // From the moment when the AIS_DS_Displayed flag is used in the Display of AIS object,
680     // this code is obsolete. It is temporaty commented and should be removed after
681     // the test campaign.
682     // Redisplay all object if they were displayed in localContext
683     /*Handle(AIS_InteractiveObject) aAISIO;
684     foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
685       aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
686       if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
687         aContext->Display(aAISIO, false);
688         aContext->SetDisplayMode(aAISIO, Shading, false);
689       }
690     }*/
691
692     // Append the filters from the local selection in the global selection context
693     SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
694     for (;aIt.More(); aIt.Next()) {
695       Handle(SelectMgr_Filter) aFilter = aIt.Value();
696       aContext->AddFilter(aFilter);
697     }
698
699     if (theUpdateViewer)
700       updateViewer();
701     //myUseExternalObjects = false;
702
703     // Restore selection
704     //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
705     //for(; aIt2.More(); aIt2.Next()) {
706     //  if (aContext->IsDisplayed(aIt2.Value()))
707     //    aContext->SetCurrentObject(aIt2.Value(), false);
708     //}
709   }
710 }
711
712 AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const
713 {
714   AISObjectPtr anIO;
715   if (myResult2AISObjectMap.contains(theObject))
716     anIO = myResult2AISObjectMap[theObject];
717   return anIO;
718 }
719
720 ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const
721 {
722   Handle(AIS_InteractiveObject) aRefAIS = theIO->impl<Handle(AIS_InteractiveObject)>();
723   return getObject(aRefAIS);
724 }
725
726 ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const
727 {
728   ObjectPtr anObject;
729   foreach (ObjectPtr anObj, myResult2AISObjectMap.keys()) {
730     AISObjectPtr aAIS = myResult2AISObjectMap[anObj];
731     Handle(AIS_InteractiveObject) anAIS = aAIS->impl<Handle(AIS_InteractiveObject)>();
732     if (anAIS == theIO)
733       anObject = anObj;
734     if (anObject.get())
735       break;
736   }
737   if (!anObject.get()) {
738     std::shared_ptr<GeomAPI_AISObject> anAISObj = AISObjectPtr(new GeomAPI_AISObject());
739     if (!theIO.IsNull()) {
740       anAISObj->setImpl(new Handle(AIS_InteractiveObject)(theIO));
741     }
742     anObject = myWorkshop->module()->findPresentedObject(anAISObj);
743   }
744   return anObject;
745 }
746
747 bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled)
748 {
749   bool aWasEnabled = myEnableUpdateViewer;
750
751   myEnableUpdateViewer = isEnabled;
752   if (myNeedUpdate && myEnableUpdateViewer) {
753     updateViewer();
754     myNeedUpdate = false;
755   }
756   return aWasEnabled;
757 }
758
759 void XGUI_Displayer::updateViewer() const
760 {
761   Handle(AIS_InteractiveContext) aContext = AISContext();
762   if (!aContext.IsNull() && myEnableUpdateViewer) {
763     myWorkshop->viewer()->Zfitall();
764     aContext->UpdateCurrentViewer();
765   } else {
766     myNeedUpdate = true;
767   }
768 }
769
770 void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO,
771                                  const int theMode, const bool theUpdateViewer) const
772 {
773   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
774   if (!aContext.IsNull()) {
775     aContext->Activate(theIO, theMode, theUpdateViewer);
776
777 #ifdef DEBUG_ACTIVATE_AIS
778     ObjectPtr anObject = getObject(theIO);
779     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
780     qDebug(QString("activateAIS: theMode = %1, object = %2").arg(theMode).arg(anInfo).toStdString().c_str());
781 #endif
782   }
783 }
784
785 void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode) const
786 {
787   Handle(AIS_InteractiveContext) aContext = AISContext();
788   if (!aContext.IsNull()) {
789     if (theMode == -1)
790       aContext->Deactivate(theIO);
791     else
792       aContext->Deactivate(theIO, theMode);
793
794 #ifdef DEBUG_DEACTIVATE_AIS
795     ObjectPtr anObject = getObject(theIO);
796     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
797     qDebug(QString("deactivateAIS: theMode = %1, object = %2").arg(theMode).arg(anInfo).toStdString().c_str());
798 #endif
799   }
800 }
801
802 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
803 {
804   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
805   if (!aContext.IsNull() && !aContext->HasOpenedContext()) {
806     aContext->OpenLocalContext();
807     if (!isTrihedronActive())
808       deactivateTrihedron();
809     aContext->DefaultDrawer()->VIsoAspect()->SetNumber(0);
810     aContext->DefaultDrawer()->UIsoAspect()->SetNumber(0);
811   }
812   return aContext;
813 }
814
815 Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter()
816 {
817   Handle(AIS_InteractiveContext) aContext = AISContext();
818   if (!aContext.IsNull() && myAndFilter.IsNull()) {
819     myAndFilter = new SelectMgr_AndFilter();
820     aContext->AddFilter(myAndFilter);
821   }
822   return myAndFilter;
823 }
824
825 bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSelectionModes,
826                                 bool theUpdateViewer)
827 {
828   bool aDisplayed = false;
829   Handle(AIS_InteractiveContext) aContext = AISContext();
830   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
831   if (!aContext.IsNull() && !anAISIO.IsNull()) {
832     aContext->Display(anAISIO, 0/*wireframe*/, 0, theUpdateViewer, true, AIS_DS_Displayed);
833     aDisplayed = true;
834     aContext->Deactivate(anAISIO);
835     aContext->Load(anAISIO);
836     if (toActivateInSelectionModes) {
837       if (aContext->HasOpenedContext()) {
838         if (myActiveSelectionModes.size() == 0)
839           activateAIS(anAISIO, 0, theUpdateViewer);
840         else {
841           foreach(int aMode, myActiveSelectionModes) {
842             activateAIS(anAISIO, aMode, theUpdateViewer);
843           }
844         }
845       }
846     }
847   }
848   return aDisplayed;
849 }
850
851 bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer)
852 {
853   bool aErased = false;
854   Handle(AIS_InteractiveContext) aContext = AISContext();
855   if (!aContext.IsNull()) {
856     Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
857     if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
858       aContext->Remove(anAISIO, theUpdateViewer);
859       aErased = true;
860     }
861   }
862   return aErased;
863 }
864
865
866 void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool theUpdateViewer)
867 {
868   if (theMode == NoMode)
869     return;
870
871   Handle(AIS_InteractiveContext) aContext = AISContext();
872   if (aContext.IsNull())
873     return;
874
875   AISObjectPtr aAISObj = getAISObject(theObject);
876   if (!aAISObj)
877     return;
878
879   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
880   aContext->SetDisplayMode(aAISIO, theMode, false);
881   // Redisplay in order to update new mode because it could be not computed before
882   if (theUpdateViewer)
883     updateViewer();
884 }
885
886 XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const
887 {
888   Handle(AIS_InteractiveContext) aContext = AISContext();
889   if (aContext.IsNull())
890     return NoMode;
891
892   AISObjectPtr aAISObj = getAISObject(theObject);
893   if (!aAISObj)
894     return NoMode;
895
896   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
897   return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode();
898 }
899
900 void XGUI_Displayer::deactivateSelectionFilters()
901 {
902   Handle(AIS_InteractiveContext) aContext = AISContext();
903   if (!myAndFilter.IsNull()) {
904     bool aFound = false;
905     if (!aContext.IsNull()) {
906       const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
907       SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
908       for (; anIt.More() && !aFound; anIt.Next()) {
909         Handle(SelectMgr_Filter) aFilter = anIt.Value();
910         aFound = aFilter == myAndFilter;
911       }
912       if (aFound)
913         aContext->RemoveFilter(myAndFilter);
914     }
915     myAndFilter.Nullify();
916   }
917 }
918
919 void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
920 {
921   Handle(AIS_InteractiveContext) aContext = AISContext();
922   if (aContext.IsNull() || hasSelectionFilter(theFilter))
923     return;
924
925   Handle(SelectMgr_CompositionFilter) aCompositeFilter = GetFilter();
926   if (!aCompositeFilter.IsNull()) {
927     aCompositeFilter->Add(theFilter);
928 #ifdef DEBUG_SELECTION_FILTERS
929     int aCount = aCompositeFilter->StoredFilters().Extent();
930     qDebug(QString("addSelectionFilter: filters.count() = %1").arg(aCount).toStdString().c_str());
931 #endif
932   }
933 }
934
935 void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
936 {
937   Handle(AIS_InteractiveContext) aContext = AISContext();
938   if (aContext.IsNull())
939     return;
940
941   Handle(SelectMgr_AndFilter) aCompositeFilter = GetFilter();
942   if (!aCompositeFilter.IsNull() && aCompositeFilter->IsIn(theFilter)) {
943     aCompositeFilter->Remove(theFilter);
944 #ifdef DEBUG_SELECTION_FILTERS
945     int aCount = aCompositeFilter->StoredFilters().Extent();
946     qDebug(QString("removeSelectionFilter: filters.count() = %1").arg(aCount).toStdString().c_str());
947 #endif
948   }
949 }
950
951 bool XGUI_Displayer::hasSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
952 {
953   bool aFilterFound = false;
954
955   Handle(AIS_InteractiveContext) aContext = AISContext();
956   if (aContext.IsNull())
957     return aFilterFound;
958   const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
959   SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
960   for (; aIt.More() && !aFilterFound; aIt.Next()) {
961     if (theFilter.Access() == aIt.Value().Access())
962       aFilterFound = true;
963   }
964   Handle(SelectMgr_CompositionFilter) aCompositeFilter = GetFilter();
965   if (!aCompositeFilter.IsNull()) {
966     const SelectMgr_ListOfFilter& aStoredFilters = aCompositeFilter->StoredFilters();
967     for (aIt.Initialize(aStoredFilters); aIt.More() && !aFilterFound; aIt.Next()) {
968       if (theFilter.Access() == aIt.Value().Access())
969         aFilterFound = true;
970     }
971   }
972   return aFilterFound;
973 }
974
975 void XGUI_Displayer::removeFilters()
976 {
977   Handle(AIS_InteractiveContext) aContext = AISContext();
978   if (aContext.IsNull())
979     return;
980
981   Handle(SelectMgr_CompositionFilter) aCompositeFilter = GetFilter();
982   if (!aCompositeFilter.IsNull())
983     aCompositeFilter->Clear();
984 }
985
986 void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
987 {
988   QObjectPtrList aDispList = myResult2AISObjectMap.keys();
989   foreach(ObjectPtr aObj, aDispList) {
990     if (!theList.contains(aObj))
991       erase(aObj, false);
992   }
993   foreach(ObjectPtr aObj, theList) {
994     if (!isVisible(aObj))
995       display(aObj, false);
996   }
997   updateViewer();
998 }
999
1000 bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
1001
1002   if (!isVisible(theObject))
1003     return false;
1004
1005   AISObjectPtr aAISObj = getAISObject(theObject);
1006   if (aAISObj.get() == NULL)
1007     return false;
1008
1009   Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
1010   return ::canBeShaded(anAIS);
1011 }
1012
1013 bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
1014                               const QIntList& theModes,
1015                               const bool theUpdateViewer) const
1016 {
1017   Handle(AIS_InteractiveContext) aContext = AISContext();
1018   if (aContext.IsNull() || theIO.IsNull())
1019     return false;
1020   
1021   bool isActivationChanged = false;
1022   // deactivate object in all modes, which are not in the list of activation
1023   // It seems that after the IO deactivation the selected state of the IO's owners
1024   // is modified in OCC(version: 6.8.0) and the selection of the object later is lost.
1025   // By this reason, the number of the IO deactivate is decreased and the object is deactivated
1026   // only if there is a difference in the current modes and the parameters modes.
1027   // If the selection problem happens again, it is possible to write a test scenario and create
1028   // a bug. The bug steps are the following:
1029   // Create two IO, activate them in 5 modes, select the first IO, deactivate 3 modes for both,
1030   // with clicked SHIFT select the second object. The result is the selection of the first IO is lost.
1031   TColStd_ListOfInteger aTColModes;
1032   aContext->ActivatedModes(theIO, aTColModes);
1033   TColStd_ListIteratorOfListOfInteger itr( aTColModes );
1034   QIntList aModesActivatedForIO;
1035   bool isDeactivated = false;
1036   for (; itr.More(); itr.Next() ) {
1037     Standard_Integer aMode = itr.Value();
1038     if (!theModes.contains(aMode)) {
1039       deactivateAIS(theIO, aMode);
1040       isDeactivated = true;
1041     }
1042     else {
1043       aModesActivatedForIO.append(aMode);
1044     }
1045   }
1046   if (isDeactivated) {
1047     // the selection from the previous activation modes should be cleared manually (#26172)
1048     theIO->ClearSelected();
1049     aContext->LocalContext()->ClearOutdatedSelection(theIO, true);
1050     // For performance issues
1051     //if (theUpdateViewer)
1052     //  updateViewer();
1053     isActivationChanged = true;
1054   }
1055
1056   // loading the interactive object allowing the decomposition
1057   if (aTColModes.IsEmpty()) {
1058     aContext->Load(theIO, -1, true);
1059   }
1060
1061   // trihedron AIS check should be after the AIS loading.
1062   // If it is not loaded, it is steel selectable in the viewer.
1063   Handle(AIS_Trihedron) aTrihedron;
1064   if (!isTrihedronActive())
1065     aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO);
1066   if (aTrihedron.IsNull()) {
1067       // In order to clear active modes list
1068     if (theModes.size() == 0) {
1069       activateAIS(theIO, 0, theUpdateViewer);
1070     } else {
1071       foreach(int aMode, theModes) {
1072         if (!aModesActivatedForIO.contains(aMode)) {
1073           activateAIS(theIO, aMode, theUpdateViewer);
1074           isActivationChanged = true;
1075         }
1076       }
1077     }
1078   }
1079   return isActivationChanged;
1080 }
1081
1082 bool XGUI_Displayer::customizeObject(ObjectPtr theObject)
1083 {
1084   AISObjectPtr anAISObj = getAISObject(theObject);
1085   // correct the result's color it it has the attribute
1086   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
1087
1088   // Customization of presentation
1089   GeomCustomPrsPtr aCustomPrs;
1090   FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
1091   if (aFeature.get() != NULL) {
1092     GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast<GeomAPI_ICustomPrs>(aFeature);
1093     if (aCustPrs.get() != NULL)
1094       aCustomPrs = aCustPrs;
1095   }
1096   if (aCustomPrs.get() == NULL) {
1097     GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
1098     // we ignore presentable not customized objects
1099     if (aPrs.get() == NULL)
1100       aCustomPrs = myCustomPrs;
1101   }
1102   bool isCustomized = aCustomPrs.get() &&
1103                       aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs);
1104   return isCustomized;
1105 }
1106
1107
1108 QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject, const QColor& theColor, bool theUpdateViewer)
1109 {
1110   if (!isVisible(theObject))
1111     return Qt::black;
1112
1113   AISObjectPtr anAISObj = getAISObject(theObject);
1114   int aR, aG, aB;
1115   anAISObj->getColor(aR, aG, aB);
1116   anAISObj->setColor(theColor.red(), theColor.green(), theColor.blue());
1117   if (theUpdateViewer)
1118     updateViewer();
1119   return QColor(aR, aG, aB);
1120 }
1121
1122 void XGUI_Displayer::appendResultObject(ObjectPtr theObject, AISObjectPtr theAIS)
1123 {
1124   myResult2AISObjectMap[theObject] = theAIS;
1125
1126 #ifdef DEBUG_DISPLAY
1127   std::ostringstream aPtrStr;
1128   aPtrStr << theObject.get();
1129   qDebug(QString("display object: %1").arg(aPtrStr.str().c_str()).toStdString().c_str());
1130   qDebug(getResult2AISObjectMapInfo().c_str());
1131 #endif
1132 }
1133
1134 std::string XGUI_Displayer::getResult2AISObjectMapInfo() const
1135 {
1136   QStringList aContent;
1137   foreach (ObjectPtr aObj, myResult2AISObjectMap.keys()) {
1138     AISObjectPtr aAISObj = myResult2AISObjectMap[aObj];
1139     std::ostringstream aPtrStr;
1140     aPtrStr << "aObj = " << aObj.get() << ":";
1141     aPtrStr << "anAIS = " << aAISObj.get() << ":";
1142     aPtrStr << "[" << ModuleBase_Tools::objectInfo(aObj).toStdString().c_str() << "]";
1143     
1144     aContent.append(aPtrStr.str().c_str());
1145   }
1146   return QString("myResult2AISObjectMap: size = %1\n%2\n").arg(myResult2AISObjectMap.size()).
1147                                             arg(aContent.join("\n")).toStdString().c_str();
1148 }
1149
1150 void XGUI_Displayer::activateTrihedron(bool theIsActive) 
1151 {  
1152   myIsTrihedronActive = theIsActive; 
1153   if (!myIsTrihedronActive) {
1154     deactivateTrihedron();
1155   }
1156 }