]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Editing of a sketcher result
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 25 Jul 2014 07:37:11 +0000 (11:37 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 25 Jul 2014 07:37:11 +0000 (11:37 +0400)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/XGUI/XGUI_Displayer.cpp

index e3f4117e6175291803102a7d46faebbc41aef2bf..ba88c8251297c949d651855c5fb487dc3edff51a 100644 (file)
@@ -346,28 +346,28 @@ void PartSet_Module::onCloseLocalContext()
 
 void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode)
 {
-//  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
-//  if (isDisplay) {
-    ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
-    PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
-    if (aPrevOp) {
-      std::list<FeaturePtr> aList = aPrevOp->subFeatures();
-      XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-      std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
-      std::list<FeaturePtr>::iterator aSFIt; 
-      for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
-        std::list<ResultPtr> aResults = (*aSFIt)->results();
-        std::list<ResultPtr>::iterator aIt;
-        for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
+  ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
+  PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
+  if (aPrevOp) {
+    std::list<FeaturePtr> aList = aPrevOp->subFeatures();
+    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
+    std::list<FeaturePtr>::iterator aSFIt; 
+    for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
+      std::list<ResultPtr> aResults = (*aSFIt)->results();
+      std::list<ResultPtr>::iterator aIt;
+      for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+        if (isDisplay)
           aDisplayer->activateInLocalContext((*aIt), aModes, false);
-        }
+        else
+          aDisplayer->erase((*aIt), false);
       }
     }
+  }
+  if (isDisplay)
     ModelAPI_EventCreator::get()->sendUpdated(theFeature, 
         Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
-//  }
-//  else
-//    ->erase(theFeature->firstResult(), true);
 /*  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
   // TODO visualizePreview(theFeature, isDisplay, false);
   if (!isDisplay) {
@@ -543,8 +543,13 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
       boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
     if (!aSPFeature)
       continue;
-    //visualizePreview((*anIt), true, false);
-    aDisplayer->activateInLocalContext((*anIt), aModes, false);
+    std::list<ResultPtr> aResults = aSPFeature->results();
+    std::list<ResultPtr>::const_iterator aRIt;
+    for (aRIt = aResults.cbegin(); aRIt != aResults.cend(); ++aRIt) {
+      aDisplayer->display((*aRIt), false);
+      aDisplayer->activateInLocalContext((*aRIt), aModes, false);
+    }
+    aDisplayer->display(aSPFeature, false);
   }
   aDisplayer->updateViewer();
 }
index 5adc7e0354de481ef8255cc24f14ceb98194009a..81ba69a079ed80f19ec060c3fe2421f137378751 100644 (file)
@@ -14,6 +14,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_Events.h>
 
 #include <GeomAlgoAPI_FaceBuilder.h>
 #include <GeomDataAPI_Point.h>
@@ -21,6 +22,7 @@
 #include <GeomAPI_XYZ.h>
 
 #include <ModuleBase_ViewerPrs.h>
+#include <Events_Loop.h>
 
 #include <AIS_Shape.hxx>
 #include <AIS_ListOfInteractive.hxx>
@@ -163,6 +165,16 @@ void PartSet_OperationSketch::stopOperation()
   PartSet_OperationSketchBase::stopOperation();
   emit featureConstructed(feature(), FM_Hide);
   emit closeLocalContext();
+
+  FeaturePtr aFeature = feature();
+  std::list<ResultPtr> aResults = aFeature->results();
+  std::list<ResultPtr>::const_iterator aIt;
+  for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+    ModelAPI_EventCreator::get()->sendUpdated(*aIt, 
+      Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+  }
+  //ModelAPI_EventCreator::get()->sendUpdated(aFeature, 
+  //  Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
 }
 
 bool PartSet_OperationSketch::isNestedOperationsEnabled() const
index 38f6181fcac558aa00e560b29eba1de62d749493..f51afd3a9f7d435710212174467574bdc2d1a13f 100644 (file)
@@ -89,7 +89,7 @@ void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
   if (anObject)  {
     Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
     if (!anAIS.IsNull()) {
-      aContext->Erase(anAIS, isUpdateViewer);
+      aContext->Remove(anAIS, isUpdateViewer);
     }
   }
   myResult2AISObjectMap.erase(theObject);
@@ -299,7 +299,7 @@ void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer)
       if (!anObj) continue;
       Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
       if (!anAIS.IsNull()) {
-        aContext->Erase(anAIS, false);
+        aContext->Remove(anAIS, false);
         aRemoved.push_back(aFeature);
       }
     }