]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Edit extrusion object
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 4 Jun 2014 08:18:14 +0000 (12:18 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 4 Jun 2014 08:18:14 +0000 (12:18 +0400)
src/ConstructionPlugin/ConstructionPlugin_Extrusion.h
src/ConstructionPlugin/extrusion_widget.xml
src/Model/Model_AttributeReference.cpp
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_SelectorWidget.cpp
src/PartSet/PartSet_Module.cpp

index 6d557a3abfb27a8aa8b5e9fb5df0c1dc27c3f436..b7db8e0115bf9cbefc844c864c57b84fceade3e2 100644 (file)
@@ -9,7 +9,7 @@
 #include <ModelAPI_Feature.h>
 
 /// attribute name of referenced face
-const std::string EXTRUSION_FACE = "extrusion_select_face";
+const std::string EXTRUSION_FACE = "extrusion_face";
 
 /// attribute name of extrusion size
 const std::string EXTRUSION_SIZE = "extrusion_size";
index ed08edc353d3fadd680241539de7b81603ae7ca2..f368a68cd06329b06e35370e617e47a284b3781f 100644 (file)
@@ -1,5 +1,5 @@
 <source>
-  <selector id="extrusion_select_face" 
+  <selector id="extrusion_face" 
     label="Select a face" 
     icon=":icons/sketch.png" 
     tooltip="Select a face for extrusion"
index 105639b742fdda4b3b8b17887361e436875b2ff3..5d7c244665042fe77281ac9ab091a0cb370510ea 100644 (file)
@@ -19,7 +19,7 @@ void Model_AttributeReference::setValue(boost::shared_ptr<ModelAPI_Feature> theF
     if (myRef.IsNull()) {
       boost::shared_ptr<Model_Data> aMyData = 
         boost::dynamic_pointer_cast<Model_Data>(owner()->data());
-      TDF_Reference::Set(aMyData->label(), aData->label());
+      myRef = TDF_Reference::Set(aMyData->label(), aData->label());
     } else {
       myRef->Set(aData->label());
     }
index 8bf69185cea2baa2bb0260b6742d5d46aa98ab23..600c27a345d06bb789071164d73cb3ad0d1f274d 100644 (file)
@@ -80,7 +80,8 @@ void ModuleBase_Operation::storeCustomValue()
 
 void ModuleBase_Operation::startOperation()
 {
-  setFeature(createFeature());
+  if (!myFeature)
+    setFeature(createFeature());
   //emit callSlot();
   //commit();
 }
index 833dbf57c80872c4234aafdf4a3191b3da4d0c68..73e00f663d6598a38e078c47053bb97782685854 100644 (file)
@@ -70,6 +70,9 @@ public:
 
   virtual void keyReleased(std::string theName, QKeyEvent* theEvent) {};
 
+  /// Sets the operation feature
+  void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+
 protected:
   /// Virtual method called when operation started (see start() method for more description)
   /// Default impl calls corresponding slot and commits immediately.
@@ -93,10 +96,6 @@ protected:
   /// \returns the created feature
   virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
 
-  /// Returns the operation feature
-  /// \return the feature
-  void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
-
 private:
   boost::shared_ptr<ModelAPI_Feature> myFeature; /// the operation feature to be handled
 };
index f47911d8394f4e990f9d2c8dd73f38453de6fe7a..7ac7ba946800a96a837af5a71a3228c759fa8a80 100644 (file)
@@ -6,6 +6,9 @@
 #include "ModuleBase_SelectorWidget.h"
 #include "ModuleBase_IWorkshop.h"
 
+#include <Events_Loop.h>
+#include <Model_Events.h>
+
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_AttributeReference.h>
@@ -72,8 +75,11 @@ bool ModuleBase_SelectorWidget::storeValue(FeaturePtr theFeature)
   boost::shared_ptr<ModelAPI_AttributeReference> aRef = 
     boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(myFeatureAttributeID));
 
-  aRef->setFeature(mySelectedFeature);
+  bool isBlocked = this->blockSignals(true);
+  aRef->setValue(mySelectedFeature);
+  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
 
+  this->blockSignals(isBlocked);
   return true;
 }
 
@@ -84,8 +90,11 @@ bool ModuleBase_SelectorWidget::restoreValue(FeaturePtr theFeature)
   boost::shared_ptr<ModelAPI_AttributeReference> aRef = 
     boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(myFeatureAttributeID));
 
+  bool isBlocked = this->blockSignals(true);
   mySelectedFeature = aRef->value();
   updateSelectionName(); 
+
+  this->blockSignals(isBlocked);
   return true;
 }
 
@@ -122,6 +131,9 @@ void ModuleBase_SelectorWidget::onSelectionChanged()
       return;
 
     // TODO: Check that the selection corresponds to selection type
+    if (aFeature->getKind().compare("Sketch") != 0)
+      return;
+
     mySelectedFeature = aFeature;
     if (mySelectedFeature) {
       updateSelectionName();
index e9bba754fc817fde2dd8e747ec6310b283d5a8bf..bb72bb1189578f709c4877ec0dd34302c1dca0e5 100644 (file)
@@ -230,6 +230,8 @@ void PartSet_Module::onLaunchOperation(std::string theName, boost::shared_ptr<Mo
     std::list<XGUI_ViewerPrs> aSelected = aDisplayer->GetSelected(TopAbs_VERTEX);
     std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->GetHighlighted(TopAbs_VERTEX);
     aPreviewOp->init(theFeature, aSelected, aHighlighted);
+  } else {
+    anOperation->setFeature(theFeature);
   }
   sendOperation(anOperation);
   myWorkshop->actionsMgr()->updateCheckState();
@@ -459,7 +461,7 @@ void PartSet_Module::editFeature(FeaturePtr theFeature)
   if (!theFeature)
     return;
 
-  if (theFeature->getKind() == "Sketch") {
+//  if (theFeature->getKind() == "Sketch") {
     FeaturePtr aFeature = theFeature;
     if (XGUI_Tools::isModelObject(aFeature)) {
       ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
@@ -470,5 +472,5 @@ void PartSet_Module::editFeature(FeaturePtr theFeature)
       onLaunchOperation(aFeature->getKind(), aFeature);
       updateCurrentPreview(aFeature->getKind());
     }
-  }
+//  }
 }