Salome HOME
Merge remote-tracking branch 'origin/PortingSalome760' into Dev_1.3.0
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 4 Jun 2015 13:49:04 +0000 (16:49 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 4 Jun 2015 13:49:04 +0000 (16:49 +0300)
1  2 
src/XGUI/XGUI_Displayer.cpp

index a3d8b3f9fd86f34a40a9640bf73479077397a2ac,844473e788626226546fe24bc6b629f2038b5c37..19da29c51b8a0764f19e6e33d66ad7383c7a2657
@@@ -149,31 -149,15 +149,17 @@@ void XGUI_Displayer::display(ObjectPtr 
    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);
 -    aContext->Display(anAISIO, isShading? Shading : Wireframe, 0, false, true, AIS_DS_Displayed); 
++    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 -229,13 +231,13 @@@ void XGUI_Displayer::redisplay(ObjectPt
      // 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 -260,6 +262,6 @@@ void XGUI_Displayer::deactivate(ObjectP
    }
  }
  
- /*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 -307,10 +309,10 @@@ void XGUI_Displayer::activateObjects(co
    // 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;
      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 -650,8 +652,8 @@@ void XGUI_Displayer::setDisplayMode(Obj
      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();
  }