Salome HOME
Fix for the issue #593: do not remove naming attribute, but use TNaming_Builder for...
[modules/shaper.git] / src / ModelAPI / ModelAPI_Feature.h
index 85ebe38b533d0c7ce3093fb575c3ebd67aa07b0b..8631c3e08b2d53beb32c0ad5fb951e2e5064337a 100644 (file)
@@ -26,6 +26,8 @@ class ModelAPI_Feature : public ModelAPI_Object
 {
   ///< list of current results of this feature
   std::list<std::shared_ptr<ModelAPI_Result> > myResults;
+  ///< is feature disabled or not
+  bool myIsDisabled;
  public:
   /// Returns the unique kind of a feature (like "Point")
   virtual const std::string& getKind() = 0;
@@ -81,11 +83,16 @@ class ModelAPI_Feature : public ModelAPI_Object
   /// removes the result from the feature
   MODELAPI_EXPORT void removeResult(const std::shared_ptr<ModelAPI_Result>& theResult);
   /// removes all results starting from the gived index (zero-based)
-  MODELAPI_EXPORT void removeResults(const int theSinceIndex);
+  /// \param theSinceIndex - index of the deleted result and all after also will be deleted
+  /// \param theFlush - if it is false, REDISPLAY message is not flushed
+  MODELAPI_EXPORT void removeResults(const int theSinceIndex, const bool theFlush = true);
   /// removes all results from the feature
   MODELAPI_EXPORT void eraseResults();
   /// removes all fields from this feature: results, data, etc
   MODELAPI_EXPORT virtual void erase();
+  /// removes the result from the list of feature (not doing in disabled): normally this
+  /// method is not used from features. only internally
+  MODELAPI_EXPORT void eraseResultFromList(const std::shared_ptr<ModelAPI_Result>& theResult);
 
   /// Returns true if result is persistent (stored in document) and on undo-redo, save-open
   /// it is not needed to recompute it.
@@ -98,10 +105,27 @@ class ModelAPI_Feature : public ModelAPI_Object
     return false;
   }
 
+  /// Returns true if this feature is used as macro: creates other features and then removed.
+  /// \returns false by default
+  MODELAPI_EXPORT virtual bool isMacro() const;
+
+  /// Returns true if preview update during the edition needed. Otherwise the update-mechanism
+  /// calls the \a execute function only on "apply" of the operation
+  /// \returns true by default
+  MODELAPI_EXPORT virtual bool isPreviewNeeded() const;
+
   /// Must return document where the new feature must be added to
   /// By default it is empty: it is added to the document this method is called to
   MODELAPI_EXPORT virtual const std::string& documentToAdd();
 
+  /// Enables/disables the feature. The disabled feature has no results and does not participate in
+  /// any calculation.
+  /// \returns true if state is really changed
+  MODELAPI_EXPORT virtual bool setDisabled(const bool theFlag);
+
+  /// Returns the feature is disabled or not.
+  MODELAPI_EXPORT virtual bool isDisabled() const;
+
   /// To virtually destroy the fields of successors
   MODELAPI_EXPORT virtual ~ModelAPI_Feature();