Salome HOME
Issue #1933:Set auxiliary presentation style
[modules/shaper.git] / src / PartSet / PartSet_ExternalObjectsMgr.h
old mode 100644 (file)
new mode 100755 (executable)
index 82f9dbf..4cc3696
@@ -31,44 +31,52 @@ class PARTSET_EXPORT PartSet_ExternalObjectsMgr
  public:
   /// Constructor
   /// \param theExternal the external state
+  /// \param theCanCreateExternal the state if it can and should create external features
   /// \param theDefaultValue the default value for the external object using
-  PartSet_ExternalObjectsMgr(const std::string& theExternal, const bool theDefaultValue);
+  PartSet_ExternalObjectsMgr(const std::string& theExternal,
+                             const std::string& theCanCreateExternal,
+                             const bool theDefaultValue);
 
   virtual ~PartSet_ExternalObjectsMgr() {}
 
   /// Returns the state whether the external object is used
   bool useExternal() const { return myUseExternal; }
 
+  /// Returns if new external objects can be created
+  /// \return boolean value
+  bool canCreateExternal() { return myCanCreateExternal;}
+
+  /// Checks validity of the given object
+  /// \param theObject an object to check
+  /// \return valid or not valid
   bool isValidObject(const ObjectPtr& theObject);
 
   /// Finds or create and external object
   /// \param theSelectedObject an object
   /// \param theShape a selected shape, which is used in the selection attribute
   /// \param theSketch a current sketch
+  /// \param theTemporary the created external object is temporary, execute is not performed for it
   /// \return the object
   ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
-                           const CompositeFeaturePtr& theSketch);
-
-  ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
-                           const CompositeFeaturePtr& theSketch);
+                           const CompositeFeaturePtr& theSketch, const bool theTemporary = false);
 
   // Removes the external presentation from the model
   /// \param theSketch a current sketch
   /// \param theFeature a current feature
-  /// \param theFeature a current workshop
+  /// \param theWorkshop a current workshop
+  /// \param theTemporary if true, a temporary external object is removed overwise all ext objects
   void removeExternal(const CompositeFeaturePtr& theSketch,
                       const FeaturePtr& theFeature,
-                      ModuleBase_IWorkshop* theWorkshop);
-
-  void removeExternalValidated(const CompositeFeaturePtr& theSketch,
-                               const FeaturePtr& theFeature,
-                               ModuleBase_IWorkshop* theWorkshop);
-
-  void removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects,
-                            const CompositeFeaturePtr& theSketch,
-                            const FeaturePtr& theFeature);
+                      ModuleBase_IWorkshop* theWorkshop,
+                      const bool theTemporary);
 
 protected:
+  /// Delete from the document the feature of the object. It deletes all objects, which refers to
+  /// the deleted one. The parameter feature is ignored even it refer to the deleted object.
+  /// \param theObject a removed object
+  /// \param theSketch a current sketch
+  /// \param theFeature a current feature
+  /// \param theWorkshop a current workshop
   void removeExternalObject(const ObjectPtr& theObject,
                             const CompositeFeaturePtr& theSketch,
                             const FeaturePtr& theFeature,
@@ -78,14 +86,13 @@ protected:
   static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop);
 
 protected:
-  /// An external object
-  QObjectPtrList myExternalObjects;
-
   /// An external object
   ObjectPtr myExternalObjectValidated;
 
   /// Boolean value about the neccessity of the external object use
   bool myUseExternal;
+  /// Boolean value about the necessity of a new external object creation
+  bool myCanCreateExternal;
 };
 
 #endif
\ No newline at end of file