1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: XGUI_Displayer.cpp
4 // Created: 20 Apr 2014
5 // Author: Natalia ERMOLAEVA
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"
13 #include <AppElements_Viewer.h>
15 #include <ModelAPI_Document.h>
16 #include <ModelAPI_Data.h>
17 #include <ModelAPI_Object.h>
18 #include <ModelAPI_Tools.h>
20 #include <ModuleBase_ResultPrs.h>
22 #include <GeomAPI_Shape.h>
23 #include <GeomAPI_IPresentable.h>
24 #include <GeomAPI_ICustomPrs.h>
26 #include <AIS_InteractiveContext.hxx>
27 #include <AIS_LocalContext.hxx>
28 #include <AIS_ListOfInteractive.hxx>
29 #include <AIS_ListIteratorOfListOfInteractive.hxx>
30 #include <AIS_DimensionSelectionMode.hxx>
31 #include <AIS_Shape.hxx>
32 #include <AIS_Dimension.hxx>
33 #include <TColStd_ListIteratorOfListOfInteger.hxx>
34 #include <SelectMgr_ListOfFilter.hxx>
35 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
37 #include <TColStd_MapOfTransient.hxx>
38 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
42 const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity
44 //#define DEBUG_DISPLAY
45 //#define DEBUG_ACTIVATE
47 // Workaround for bug #25637
48 void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList)
50 // Get from null point
51 theAIS->DisplayedObjects(theList, true);
52 if (theAIS->HasOpenedContext()) {
53 // get from local context
54 const Handle(AIS_LocalContext)& aLC = theAIS->LocalContext();
55 TColStd_MapOfTransient aMap;
56 int NbDisp = aLC->DisplayedObjects(aMap);
57 TColStd_MapIteratorOfMapOfTransient aIt(aMap);
59 Handle(AIS_InteractiveObject) curIO;
60 Handle(Standard_Transient) Tr;
61 for(; aIt.More(); aIt.Next()){
63 curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
64 theList.Append(curIO);
70 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
71 : myWorkshop(theWorkshop)
73 enableUpdateViewer(true);
76 XGUI_Displayer::~XGUI_Displayer()
80 bool XGUI_Displayer::isVisible(ObjectPtr theObject) const
82 return myResult2AISObjectMap.contains(theObject);
85 void XGUI_Displayer::display(ObjectPtr theObject, bool isUpdateViewer)
87 if (isVisible(theObject)) {
88 redisplay(theObject, isUpdateViewer);
91 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
92 if (aFeature.get() != NULL) {
93 qDebug(QString("display feature: %1, displayed: %2").
94 arg(aFeature->data()->name().c_str()).
95 arg(displayedObjects().size()).toStdString().c_str());
100 GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
101 bool isShading = false;
102 if (aPrs.get() != NULL) {
103 anAIS = aPrs->getAISObject(AISObjectPtr());
105 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
106 if (aResult.get() != NULL) {
107 std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
108 if (aShapePtr.get() != NULL) {
109 anAIS = AISObjectPtr(new GeomAPI_AISObject());
110 anAIS->setImpl(new Handle(AIS_InteractiveObject)(new ModuleBase_ResultPrs(aResult)));
111 //anAIS->createShape(aShapePtr);
117 display(theObject, anAIS, isShading, isUpdateViewer);
121 bool canBeShaded(Handle(AIS_InteractiveObject) theAIS)
123 Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(theAIS);
124 if (!aShapePrs.IsNull()) {
125 TopoDS_Shape aShape = aShapePrs->Shape();
126 TopAbs_ShapeEnum aType = aShape.ShapeType();
127 if ((aType == TopAbs_VERTEX) || (aType == TopAbs_EDGE) || (aType == TopAbs_WIRE))
130 // Check that the presentation is not a sketch
131 Handle(ModuleBase_ResultPrs) aPrs = Handle(ModuleBase_ResultPrs)::DownCast(theAIS);
133 return !aPrs->isSketchMode();
140 void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
141 bool isShading, bool isUpdateViewer)
143 Handle(AIS_InteractiveContext) aContext = AISContext();
144 if (aContext.IsNull())
147 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
148 if (!anAISIO.IsNull()) {
149 myResult2AISObjectMap[theObject] = theAIS;
150 bool aCanBeShaded = ::canBeShaded(anAISIO);
151 // In order to avoid extra closing/opening context
152 SelectMgr_IndexedMapOfOwner aSelectedOwners;
154 myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
155 closeLocalContexts(false);
157 aContext->Display(anAISIO, false);
159 aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, false);
160 // Customization of presentation
161 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
162 if (aFeature.get() != NULL) {
163 GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast<GeomAPI_ICustomPrs>(aFeature);
164 if (aCustPrs.get() != NULL)
165 aCustPrs->customisePresentation(theAIS);
169 activateObjects(myActiveSelectionModes);
170 myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
173 activate(anAISIO, myActiveSelectionModes);
179 void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
181 if (!isVisible(theObject))
184 Handle(AIS_InteractiveContext) aContext = AISContext();
185 if (aContext.IsNull())
187 AISObjectPtr anObject = myResult2AISObjectMap[theObject];
189 Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
190 if (!anAIS.IsNull()) {
191 aContext->Remove(anAIS, isUpdateViewer);
194 myResult2AISObjectMap.remove(theObject);
197 void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
199 if (!isVisible(theObject))
202 AISObjectPtr aAISObj = getAISObject(theObject);
203 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
205 GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
207 AISObjectPtr aAIS_Obj = aPrs->getAISObject(aAISObj);
209 erase(theObject, isUpdateViewer);
212 if (aAIS_Obj != aAISObj) {
213 myResult2AISObjectMap[theObject] = aAIS_Obj;
215 aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
218 if (!aAISIO.IsNull()) {
219 Handle(AIS_InteractiveContext) aContext = AISContext();
220 if (aContext.IsNull())
222 // Check that the visualized shape is the same and the redisplay is not necessary
223 // Redisplay of AIS object leads to this object selection compute and the selection
224 // in the browser is lost
226 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
227 if (aResult.get() != NULL) {
228 Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
229 if (!aShapePrs.IsNull()) {
230 std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
231 if (aShapePtr.get()) {
232 const TopoDS_Shape& aShape = aShapePrs->Shape();
233 std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
234 anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
236 if (aShapePtr->isEqual(anAISShapePtr))
241 aContext->Redisplay(aAISIO, false);
247 void XGUI_Displayer::deactivate(ObjectPtr theObject)
249 if (isVisible(theObject)) {
250 Handle(AIS_InteractiveContext) aContext = AISContext();
251 if (aContext.IsNull())
254 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
255 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
256 aContext->Deactivate(anAIS);
260 /*void XGUI_Displayer::activate(ObjectPtr theFeature)
262 activate(theFeature, myActiveSelectionModes);
265 void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes)
267 #ifdef DEBUG_ACTIVATE
268 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
270 if (aFeature.get() != NULL) {
272 getModesOfActivation(theObject, aModes);
275 qDebug(QString("activate feature: %1, theModes: %2, myActiveSelectionModes: %3, getModesOf: %4").
276 arg(aFeature->data()->name().c_str()).
277 arg(theModes.size()).
278 arg(myActiveSelectionModes.size()).
279 arg(aModes.size()).toStdString().c_str());
283 if (isVisible(theObject)) {
284 Handle(AIS_InteractiveContext) aContext = AISContext();
285 if (aContext.IsNull())
288 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
289 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
291 activate(anAIS, theModes);
295 void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes)
297 if (!isVisible(theObject))
300 Handle(AIS_InteractiveContext) aContext = AISContext();
301 if (aContext.IsNull())
304 AISObjectPtr aAISObj = getAISObject(theObject);
306 if (aAISObj.get() != NULL) {
307 Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
308 TColStd_ListOfInteger aTColModes;
309 aContext->ActivatedModes(anAISIO, aTColModes);
310 TColStd_ListIteratorOfListOfInteger itr( aTColModes );
311 for (; itr.More(); itr.Next() ) {
312 theModes.append(itr.Value());
317 void XGUI_Displayer::activateObjects(const QIntList& theModes)
319 #ifdef DEBUG_ACTIVATE
320 qDebug(QString("activate all features: theModes: %2, myActiveSelectionModes: %3").
321 arg(theModes.size()).
322 arg(myActiveSelectionModes.size()).
323 toStdString().c_str());
325 // In order to avoid doblications of selection modes
327 foreach (int aMode, theModes) {
328 if (!aNewModes.contains(aMode))
329 aNewModes.append(aMode);
331 myActiveSelectionModes = aNewModes;
332 Handle(AIS_InteractiveContext) aContext = AISContext();
333 if (aContext.IsNull())
335 // Open local context if there is no one
336 if (!aContext->HasOpenedContext())
339 //aContext->UseDisplayedObjects();
340 //myUseExternalObjects = true;
342 AIS_ListOfInteractive aPrsList;
343 ::displayedObjects(aContext, aPrsList);
345 Handle(AIS_Trihedron) aTrihedron;
346 AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
347 Handle(AIS_InteractiveObject) anAISIO;
348 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
349 anAISIO = aLIt.Value();
350 activate(anAISIO, myActiveSelectionModes);
355 void XGUI_Displayer::deactivateObjects()
357 myActiveSelectionModes.clear();
358 Handle(AIS_InteractiveContext) aContext = AISContext();
359 // Open local context if there is no one
360 if (!aContext->HasOpenedContext())
363 //aContext->NotUseDisplayedObjects();
364 AIS_ListOfInteractive aPrsList;
365 ::displayedObjects(aContext, aPrsList);
367 AIS_ListIteratorOfListOfInteractive aLIt;
368 //Handle(AIS_Trihedron) aTrihedron;
369 Handle(AIS_InteractiveObject) anAISIO;
370 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
371 anAISIO = aLIt.Value();
372 aContext->Deactivate(anAISIO);
376 bool XGUI_Displayer::isActive(ObjectPtr theObject) const
378 Handle(AIS_InteractiveContext) aContext = AISContext();
379 if (aContext.IsNull())
381 if (!isVisible(theObject))
384 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
385 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
387 TColStd_ListOfInteger aModes;
388 aContext->ActivatedModes(anAIS, aModes);
389 return aModes.Extent() > 0;
392 void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
394 Handle(AIS_InteractiveContext) aContext = AISContext();
395 if (aContext.IsNull())
397 if (aContext->HasOpenedContext()) {
398 aContext->UnhilightSelected();
399 aContext->ClearSelected();
400 foreach(ObjectPtr aResult, theResults) {
401 if (isVisible(aResult)) {
402 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
403 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
405 aContext->SetSelected(anAIS, false);
409 aContext->UnhilightCurrents();
410 aContext->ClearCurrents();
411 foreach(ObjectPtr aResult, theResults) {
412 if (isVisible(aResult)) {
413 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
414 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
416 aContext->SetCurrentObject(anAIS, false);
425 void XGUI_Displayer::clearSelected()
427 Handle(AIS_InteractiveContext) aContext = AISContext();
429 aContext->UnhilightCurrents(false);
430 aContext->ClearSelected();
434 void XGUI_Displayer::eraseAll(const bool isUpdateViewer)
436 Handle(AIS_InteractiveContext) aContext = AISContext();
437 if (!aContext.IsNull()) {
438 foreach (AISObjectPtr aAISObj, myResult2AISObjectMap) {
440 Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
442 aContext->Remove(anIO, false);
447 myResult2AISObjectMap.clear();
450 void XGUI_Displayer::openLocalContext()
452 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
453 if (aContext.IsNull())
455 // Open local context if there is no one
456 if (!aContext->HasOpenedContext()) {
457 // Preserve selected objects
458 //AIS_ListOfInteractive aAisList;
459 //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
460 // aAisList.Append(aContext->Current());
462 // get the filters from the global context and append them to the local context
463 // a list of filters in the global context is not cleared and should be cleared here
464 SelectMgr_ListOfFilter aFilters;
465 aFilters.Assign(aContext->Filters());
466 // it is important to remove the filters in the global context, because there is a code
467 // in the closeLocalContex, which restore the global context filters
468 aContext->RemoveFilters();
470 //aContext->ClearCurrents();
471 aContext->OpenLocalContext();
472 //aContext->NotUseDisplayedObjects();
474 //myUseExternalObjects = false;
476 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
477 for (;aIt.More(); aIt.Next()) {
478 aContext->AddFilter(aIt.Value());
481 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
482 //for(; aIt2.More(); aIt2.Next()) {
483 // aContext->SetSelected(aIt2.Value(), false);
488 void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
490 Handle(AIS_InteractiveContext) aContext = AISContext();
491 if ( (!aContext.IsNull()) && (aContext->HasOpenedContext()) ) {
492 // Preserve selected objects
493 //AIS_ListOfInteractive aAisList;
494 //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
495 // aAisList.Append(aContext->SelectedInteractive());
497 // get the filters from the local context and append them to the global context
498 // a list of filters in the local context is cleared
499 SelectMgr_ListOfFilter aFilters;
500 aFilters.Assign(aContext->Filters());
502 //aContext->ClearSelected();
503 aContext->CloseAllContexts(false);
505 // Redisplay all object if they were displayed in localContext
506 Handle(AIS_InteractiveObject) aAISIO;
507 foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
508 aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
509 if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
510 aContext->Display(aAISIO, false);
511 aContext->SetDisplayMode(aAISIO, Shading, false);
515 // Append the filters from the local selection in the global selection context
516 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
517 for (;aIt.More(); aIt.Next()) {
518 Handle(SelectMgr_Filter) aFilter = aIt.Value();
519 aContext->AddFilter(aFilter);
524 //myUseExternalObjects = false;
527 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
528 //for(; aIt2.More(); aIt2.Next()) {
529 // if (aContext->IsDisplayed(aIt2.Value()))
530 // aContext->SetCurrentObject(aIt2.Value(), false);
535 AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const
538 if (myResult2AISObjectMap.contains(theObject))
539 anIO = myResult2AISObjectMap[theObject];
543 ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const
545 Handle(AIS_InteractiveObject) aRefAIS = theIO->impl<Handle(AIS_InteractiveObject)>();
546 return getObject(aRefAIS);
549 ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const
552 foreach (ObjectPtr anObj, myResult2AISObjectMap.keys()) {
553 AISObjectPtr aAIS = myResult2AISObjectMap[anObj];
554 Handle(AIS_InteractiveObject) anAIS = aAIS->impl<Handle(AIS_InteractiveObject)>();
561 bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled)
563 bool aWasEnabled = myEnableUpdateViewer;
565 myEnableUpdateViewer = isEnabled;
570 void XGUI_Displayer::updateViewer()
572 Handle(AIS_InteractiveContext) aContext = AISContext();
573 if (!aContext.IsNull() && myEnableUpdateViewer)
574 aContext->UpdateCurrentViewer();
577 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
579 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
580 if ((!aContext.IsNull()) && (!aContext->HasOpenedContext())) {
581 aContext->OpenLocalContext();
586 Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter()
588 Handle(AIS_InteractiveContext) aContext = AISContext();
589 if (myAndFilter.IsNull() && !aContext.IsNull()) {
590 myAndFilter = new SelectMgr_AndFilter();
591 aContext->AddFilter(myAndFilter);
596 void XGUI_Displayer::displayAIS(AISObjectPtr theAIS, bool isUpdate)
598 Handle(AIS_InteractiveContext) aContext = AISContext();
599 if (aContext.IsNull())
601 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
602 if (!anAISIO.IsNull()) {
603 aContext->Display(anAISIO, isUpdate);
604 if (aContext->HasOpenedContext()) {
605 //if (myUseExternalObjects) {
606 if (myActiveSelectionModes.size() == 0)
607 aContext->Activate(anAISIO);
609 foreach(int aMode, myActiveSelectionModes) {
610 aContext->Activate(anAISIO, aMode);
618 void XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool isUpdate)
620 Handle(AIS_InteractiveContext) aContext = AISContext();
621 if (aContext.IsNull())
623 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
624 if (!anAISIO.IsNull()) {
625 aContext->Remove(anAISIO, isUpdate);
630 void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool toUpdate)
632 if (theMode == NoMode)
635 Handle(AIS_InteractiveContext) aContext = AISContext();
636 if (aContext.IsNull())
639 AISObjectPtr aAISObj = getAISObject(theObject);
643 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
644 bool aCanBeShaded = ::canBeShaded(aAISIO);
645 // In order to avoid extra closing/opening context
646 SelectMgr_IndexedMapOfOwner aSelectedOwners;
648 myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
649 closeLocalContexts(false);
651 aContext->SetDisplayMode(aAISIO, theMode, false);
654 activateObjects(myActiveSelectionModes);
655 myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
661 XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const
663 Handle(AIS_InteractiveContext) aContext = AISContext();
664 if (aContext.IsNull())
667 AISObjectPtr aAISObj = getAISObject(theObject);
671 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
672 return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode();
675 void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
677 Handle(AIS_InteractiveContext) aContext = AISContext();
678 if (aContext.IsNull())
680 const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
681 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
682 for (; aIt.More(); aIt.Next()) {
683 if (theFilter.Access() == aIt.Value().Access())
686 GetFilter()->Add(theFilter);
689 void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
691 Handle(AIS_InteractiveContext) aContext = AISContext();
692 if (aContext.IsNull())
694 GetFilter()->Remove(theFilter);
697 void XGUI_Displayer::removeFilters()
699 Handle(AIS_InteractiveContext) aContext = AISContext();
700 if (aContext.IsNull())
702 GetFilter()->Clear();
705 void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
707 QObjectPtrList aDispList = myResult2AISObjectMap.keys();
708 foreach(ObjectPtr aObj, aDispList) {
709 if (!theList.contains(aObj))
712 foreach(ObjectPtr aObj, theList) {
713 if (!isVisible(aObj))
714 display(aObj, false);
719 bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
721 if (!isVisible(theObject))
724 AISObjectPtr aAISObj = getAISObject(theObject);
725 if (aAISObj.get() == NULL)
728 Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
729 return ::canBeShaded(anAIS);
732 void XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
733 const QIntList& theModes) const
735 Handle(AIS_InteractiveContext) aContext = AISContext();
736 if (aContext.IsNull() || theIO.IsNull())
739 aContext->Load(theIO, -1, true);
740 aContext->Deactivate(theIO);
741 Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO);
742 //Deactivate trihedron which can be activated in local selector
743 if (aTrihedron.IsNull()) {
744 //aContext->Load(anAISIO, -1, true);
745 // In order to clear active modes list
746 if (theModes.size() == 0) {
747 //aContext->Load(anAISIO, 0, true);
748 aContext->Activate(theIO);
750 foreach(int aMode, theModes) {
751 //aContext->Load(anAISIO, aMode, true);
752 aContext->Activate(theIO, aMode);