From: nds Date: Wed, 25 Mar 2015 05:02:14 +0000 (+0300) Subject: Union of validator and filter functionalities. X-Git-Tag: V_1.1.0~85^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d04185a613955ab097c4484ce881aa4e35f424f7;p=modules%2Fshaper.git Union of validator and filter functionalities. An attempt to remove external objects, created by moving over the line/edges from another sketch. --- diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index d88a84410..0cf9b6e44 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -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); + }*/ + } } } diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index bcf13cbf1..34c4c0212 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index db28807d1..eea1bca0f 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -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); diff --git a/src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp b/src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp index e559fa608..f54e0fbc3 100644 --- a/src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp @@ -12,7 +12,7 @@ #include #include -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; } diff --git a/src/PartSet/PartSet_WidgetConstraintShapeSelector.h b/src/PartSet/PartSet_WidgetConstraintShapeSelector.h index 29ca68daf..ea8bbaa9e 100644 --- a/src/PartSet/PartSet_WidgetConstraintShapeSelector.h +++ b/src/PartSet/PartSet_WidgetConstraintShapeSelector.h @@ -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 diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 45fe790e7..a7ada4a64 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -13,7 +13,7 @@ #include #include -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 { diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index bae13ae92..f7d075b48 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -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