]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Union of validator and filter functionalities.
authornds <natalia.donis@opencascade.com>
Wed, 25 Mar 2015 05:02:14 +0000 (08:02 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 25 Mar 2015 05:02:14 +0000 (08:02 +0300)
An attempt to remove external objects, created by moving over the line/edges from another sketch.

src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.h
src/ModuleBase/ModuleBase_WidgetValidated.h
src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp
src/PartSet/PartSet_WidgetConstraintShapeSelector.h
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.h

index d88a844102c216ab4cacd0b1cb9cf20a324d1dc5..0cf9b6e44299bc9c7f0ebd1fceacd12d1b4d9d8d 100644 (file)
@@ -133,7 +133,7 @@ bool ModuleBase_WidgetShapeSelector::storeValueCustom() const
 
 //********************************************************************
 bool ModuleBase_WidgetShapeSelector::storeAttributeValues(ObjectPtr theSelectedObject,
-                                                          GeomShapePtr theShape) const
+                                                          GeomShapePtr theShape)
 {
   bool isChanged = false;
   FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(theSelectedObject);
@@ -385,6 +385,7 @@ void ModuleBase_WidgetShapeSelector::backupAttributeValue(const bool isBackup)
       myIsObject = aRefAttr->isObject();
       myRefAttribute = aRefAttr->attr();
     }
+    myExternalObject = NULL;
   }
   else {
     storeAttributeValues(myObject, myShape);
@@ -393,6 +394,13 @@ void ModuleBase_WidgetShapeSelector::backupAttributeValue(const bool isBackup)
       if (!myIsObject)
         aRefAttr->setAttr(myRefAttribute);
     }
+    if (myExternalObject.get()) {
+      /*DocumentPtr aDoc = myExternalObject->document();
+      FeaturePtr aFeature = ModelAPI_Feature::feature(myExternalObject);
+      if (aFeature.get() != NULL) {
+        aDoc->removeFeature(aFeature);
+      }*/
+    }
   }
 }
 
index bcf13cbf1d0393192223d4c8131964f3694e94ad..34c4c0212545a75448215b15b2ef7ea6cdce03f6 100644 (file)
@@ -134,7 +134,7 @@ Q_OBJECT
   /// the specific type and set the given values
   /// \param theSelectedObject an object
   /// \param theShape a selected shape, which is used in the selection attribute
-  virtual bool storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape) const;
+  virtual bool storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape);
 
   //----------- Class members -------------
   protected:
@@ -164,6 +164,8 @@ Q_OBJECT
   AttributePtr myRefAttribute;
   /// A boolean value whether refAttr uses reference of object
   bool myIsObject;
+  /// An external object
+  ObjectPtr myExternalObject;
 };
 
 #endif
index db28807d15628b0c08222dd74b23ea29cf7530db..eea1bca0fa2707b69a799cce4d13a3bed144a662 100644 (file)
@@ -45,6 +45,8 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
 
   /// Set the given wrapped value to the current widget
   /// This value should be processed in the widget according to the needs
+  /// The method is called by the current operation to process the operation preselection.
+  /// It is redefined to check the value validity and if it is, fill the attribute with by value
   /// \param theValue the wrapped widget value
   virtual bool setSelection(ModuleBase_ViewerPrs theValue);
 
index e559fa608b8e464b67a2490b2526c5577ac50ae7..f54e0fbc338c6903339998bfad411f606ee88b05 100644 (file)
@@ -12,7 +12,7 @@
 #include <PartSet_Tools.h>
 #include <SketchPlugin_Feature.h>
 
-bool PartSet_WidgetConstraintShapeSelector::storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape) const
+bool PartSet_WidgetConstraintShapeSelector::storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape)
 {
   ObjectPtr aSelectedObject = theSelectedObject;
 
@@ -25,6 +25,7 @@ bool PartSet_WidgetConstraintShapeSelector::storeAttributeValues(ObjectPtr theSe
                                                                   aSelectedObject, mySketch);
       if (aObj) {
         aSelectedObject = aObj;
+        myExternalObject = aObj;
       } else 
         return false;
     }
index 29ca68dafd55b2ae67611c81cc77d4765e8cdec8..ea8bbaa9e7a1a2b0eb657e29f897a22826e15b16 100644 (file)
@@ -47,7 +47,7 @@ protected:
   /// the specific type and set the given values
   /// \param theSelectedObject an object
   /// \param theShape a selected shape, which is used in the selection attribute
-  virtual bool storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape) const;
+  virtual bool storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape);
 
 private:
   /// Pointer to a sketch 
index 45fe790e76675c38f733199dba43de5e6853eeb2..a7ada4a646c433a8f79b2a82c518debf7ff881c2 100644 (file)
@@ -13,7 +13,7 @@
 #include <PartSet_Tools.h>
 #include <SketchPlugin_Feature.h>
 
-bool PartSet_WidgetShapeSelector::storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape) const
+bool PartSet_WidgetShapeSelector::storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape)
 {
   ObjectPtr aSelectedObject = theSelectedObject;
   GeomShapePtr aShape = theShape;
@@ -30,6 +30,7 @@ bool PartSet_WidgetShapeSelector::storeAttributeValues(ObjectPtr theSelectedObje
     if (aObj) {
       PartSet_WidgetShapeSelector* that = (PartSet_WidgetShapeSelector*) this;
       aSelectedObject = aObj;
+      myExternalObject = aObj;
     } else 
       return false;
   } else {
index bae13ae921be71b9add95ce466d7746dd707adf1..f7d075b48cfa3436574e11db2fb3c8fd15df71cb 100644 (file)
@@ -47,7 +47,7 @@ protected:
   /// the specific type and set the given values
   /// \param theSelectedObject an object
   /// \param theShape a selected shape, which is used in the selection attribute
-  virtual bool storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape) const;
+  virtual bool storeAttributeValues(ObjectPtr theSelectedObject, GeomShapePtr theShape);
 
 private:
   /// Pointer to a sketch