]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_Displayer.cpp
Salome HOME
Merge remote-tracking branch 'origin/PortingSalome760' into Dev_1.3.0
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
index a3d8b3f9fd86f34a40a9640bf73479077397a2ac..19da29c51b8a0764f19e6e33d66ad7383c7a2657 100644 (file)
@@ -149,31 +149,17 @@ void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
   if (!anAISIO.IsNull()) {
     appendResultObject(theObject, theAIS);
 
-    bool aCanBeShaded = ::canBeShaded(anAISIO);
-    // In order to avoid extra closing/opening context
-    SelectMgr_IndexedMapOfOwner aSelectedOwners;
-    if (aCanBeShaded) {
-      myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
-      closeLocalContexts(false);
-    }
-    aContext->Display(anAISIO, false);
-    aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, false);
+    bool isCustomized = customizeObject(theObject);
+
+    int aDispMode = isShading? Shading : Wireframe;
     if (isShading)
       anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
-    emit objectDisplayed(theObject, theAIS);
+    anAISIO->SetDisplayMode(aDispMode);
+    aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed); 
 
-    bool isCustomized = customizeObject(theObject);
-    if (isCustomized)
-      aContext->Redisplay(anAISIO, false);
-
-    if (aCanBeShaded) {
-      openLocalContext();
-      activateObjects(myActiveSelectionModes);
-      myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
-    }
-    else
-      activate(anAISIO, myActiveSelectionModes);
- }
+    emit objectDisplayed(theObject, theAIS);
+    activate(anAISIO, myActiveSelectionModes);
+ } 
   if (isUpdateViewer)
     updateViewer();
 }
@@ -245,13 +231,13 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
     // Customization of presentation
     bool isCustomized = customizeObject(theObject);
     #ifdef DEBUG_FEATURE_REDISPLAY
-      //qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
-      //  arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
+      qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
+        arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
     #endif
     if (!isEqualShapes || isCustomized) {
       aContext->Redisplay(aAISIO, false);
       #ifdef DEBUG_FEATURE_REDISPLAY
-      //qDebug("  Redisplay happens");
+        qDebug("  Redisplay happens");
       #endif
       if (isUpdateViewer)
         updateViewer();
@@ -276,41 +262,6 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject)
   }
 }
 
-/*void XGUI_Displayer::activate(ObjectPtr theFeature)
-{
-  activate(theFeature, myActiveSelectionModes);
-}
-
-void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes)
-{
-#ifdef DEBUG_ACTIVATE
-    FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
-
-    if (aFeature.get() != NULL) {
-      QIntList aModes;
-      getModesOfActivation(theObject, aModes);
-
-
-      qDebug(QString("activate feature: %1, theModes: %2, myActiveSelectionModes: %3, getModesOf: %4").
-        arg(aFeature->data()->name().c_str()).
-        arg(theModes.size()).
-        arg(myActiveSelectionModes.size()).
-        arg(aModes.size()).toStdString().c_str());
-    }
-#endif
-
-  if (isVisible(theObject)) {
-    Handle(AIS_InteractiveContext) aContext = AISContext();
-    if (aContext.IsNull())
-      return;
-
-    AISObjectPtr anObj = myResult2AISObjectMap[theObject];
-    Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
-
-    activate(anAIS, theModes);
-  }
-}*/
-
 void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes)
 {
   if (!isVisible(theObject))
@@ -358,10 +309,10 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrL
   // we need to block the sort of the viewer selector during deactivate/activate because
   // it takes a lot of time if there are a many objects are processed. It can be performed
   // manualy after the activation is peformed
-  Handle(StdSelect_ViewerSelector3d) aSelector = aContext->LocalContext()->MainSelector();
-  bool isUpdateSortPossible = !aSelector.IsNull() && aSelector->IsUpdateSortPossible();
-  if (!aSelector.IsNull())
-    aSelector->SetUpdateSortPossible(false);
+  //Handle(StdSelect_ViewerSelector3d) aSelector = aContext->LocalContext()->MainSelector();
+  //bool isUpdateSortPossible = !aSelector.IsNull() && aSelector->IsUpdateSortPossible();
+  //if (!aSelector.IsNull())
+  //  aSelector->SetUpdateSortPossible(false);
 
   //aContext->UseDisplayedObjects();
   //myUseExternalObjects = true;
@@ -383,10 +334,10 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrL
     activate(anAISIO, myActiveSelectionModes);
   }
   // restore the sorting flag and perform the sort of selection
-  if (!aSelector.IsNull()) {
-    aSelector->SetUpdateSortPossible(isUpdateSortPossible);
-    aSelector->UpdateSort();
-  }
+  //if (!aSelector.IsNull()) {
+  //  aSelector->SetUpdateSortPossible(isUpdateSortPossible);
+  //  aSelector->UpdateSort();
+  //}
 }
 
 
@@ -701,21 +652,8 @@ void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bo
     return;
 
   Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
-  bool aCanBeShaded = ::canBeShaded(aAISIO);
-  // In order to avoid extra closing/opening context
-  SelectMgr_IndexedMapOfOwner aSelectedOwners;
-  if (aCanBeShaded) {
-    myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
-    closeLocalContexts(false);
-  }
   aContext->SetDisplayMode(aAISIO, theMode, false);
   // Redisplay in order to update new mode because it could be not computed before
-  aContext->Redisplay(aAISIO, false);
-  if (aCanBeShaded) {
-    openLocalContext();
-    activateObjects(myActiveSelectionModes);
-    myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
-  }
   if (toUpdate)
     updateViewer();
 }