]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Redisplay object on data modifications
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 9 Jun 2014 11:08:22 +0000 (15:08 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 9 Jun 2014 11:08:22 +0000 (15:08 +0400)
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_Workshop.cpp

index fee4e4230fb64f7a0f63444924b555232ce934ab..e588367b897b043689c92600aee7b6aa97b29f9a 100644 (file)
@@ -180,6 +180,21 @@ bool XGUI_Displayer::redisplay(FeaturePtr theFeature,
   return isCreated;
 }
 
+void XGUI_Displayer::redisplay(FeaturePtr theFeature, bool isUpdateViewer)
+{
+  FeaturePtr aFeature = XGUI_Tools::realFeature(theFeature);
+  if (!isVisible(aFeature))
+    return;
+
+  Handle(AIS_InteractiveObject) aAISObj = getAISObject(aFeature);
+  boost::shared_ptr<GeomAPI_Shape> aShapePtr = aFeature->data()->shape();
+
+  Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj);
+  aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
+
+  AISContext()->Redisplay(aAISShape);
+}
+
 void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature,
                                          const std::list<int>& theModes, const bool isUpdateViewer)
 {
index fdb8c76008ad2f23909fbb2f39df8e35fc6d569c..7ca8150aeb27139ed71149b2432163a61a514e27 100644 (file)
@@ -84,6 +84,12 @@ public:
                  Handle(AIS_InteractiveObject) theAIS,
                  const int theSelectionMode, const bool isUpdateViewer = true);
 
+  /** Redisplay the shape if it was displayed
+  * \param theFeature a feature instance
+  * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+  */
+  void redisplay(FeaturePtr theFeature, bool isUpdateViewer = true);
+
   /// Redisplay the shape and activate selection of sub-shapes
   /// \param theFeature a feature instance
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
index 0cbafb0458900478340ab074670918c8ba172262..f038d3133a239c8d6e76c7188c4f0ed8cdf940fc 100644 (file)
@@ -232,9 +232,12 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
       FeaturePtr aFeature = (*aIt);
       if (aFeature->getKind() == PARTSET_PART_KIND) {
         aHasPart = true;
-        break;
+        //break;
+      } else {
+        myDisplayer->display(aFeature, false);
       }
     }
+    myDisplayer->updateViewer();
     if (aHasPart) {
       //The created part will be created in Object Browser later and we have to activate it
       // only when it is created everywere
@@ -245,21 +248,31 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
   //Update property panel on corresponding message. If there is no current operation (no
   //property panel), or received message has different feature to the current - do nothing.
   static Events_ID aFeatureUpdatedId = Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED);
-  if (theMessage->eventID() == aFeatureUpdatedId && myOperationMgr->hasOperation())
-  {
+  if (theMessage->eventID() == aFeatureUpdatedId) {
     const Model_FeatureUpdatedMessage* anUpdateMsg =
         dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
-    std::set<FeaturePtr> aFeatures = anUpdateMsg->features();
 
-    FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
+    std::set<FeaturePtr> aFeatures = anUpdateMsg->features();
+    if (myOperationMgr->hasOperation())
+    {
+      FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
+      std::set<FeaturePtr>::const_iterator aIt;
+      for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+        FeaturePtr aNewFeature = (*aIt);
+        if(aNewFeature == aCurrentFeature) {
+          myPropertyPanel->updateContentWidget(aCurrentFeature);
+          break;
+        } 
+      }
+    }
+    // Redisplay feature if it is modified
     std::set<FeaturePtr>::const_iterator aIt;
     for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
-      FeaturePtr aNewFeature = (*aIt);
-      if(aNewFeature == aCurrentFeature) {
-        myPropertyPanel->updateContentWidget(aCurrentFeature);
-        break;
-      } 
+      FeaturePtr aFeature = (*aIt);
+      if (aFeature->getKind() != PARTSET_PART_KIND)
+        myDisplayer->redisplay(aFeature, false);
     }
+    myDisplayer->updateViewer();
   }
   //An operation passed by message. Start it, process and commit.
   const Config_PointerMessage* aPartSetMsg = dynamic_cast<const Config_PointerMessage*>(theMessage);