Salome HOME
Issue #3232: Abort current operation if previous automatic constraint caused a conflict
[modules/shaper.git] / src / PartSet / PartSet_TreeNodes.h
index 9dec63009b29dd5a58a909f45cbb48b48bfaf2b2..33cbb68083233c021e42637d04f73678b5435fd7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef PartSet_TreeNodes_H
@@ -47,13 +46,6 @@ public:
 class PartSet_ObjectNode : public PartSet_TreeNode
 {
 public:
-  enum VisibilityState {
-    NoneState,
-    Visible,
-    SemiVisible,
-    Hidden
-  };
-
   PartSet_ObjectNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent = 0)
     : PartSet_TreeNode(theParent), myObject(theObj) {}
 
@@ -74,10 +66,29 @@ public:
   /// Returns object referenced by the node (can be null)
   virtual ObjectPtr object() const { return myObject; }
 
+  /// Sets an object to the node
+  /// theObj a new object
+  void setObject(ObjectPtr theObj) { myObject = theObj; }
+
+  virtual VisibilityState visibilityState() const;
+
   /// Updates sub-nodes of the node
-  virtual void update() {}
+  virtual void update();
+
+  /// Process creation of objects.
+  /// \param theObjects a list of created objects
+  /// \return a list of nodes which corresponds to the created objects
+  virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects);
 
-  VisibilityState getVisibilityState() const;
+  /// Process deletion of objects.
+  /// \param theDoc a document where objects were deleted
+  /// \param theGroup a name of group where objects were deleted
+  virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup);
+
+  /// Returns number of sub-objects of the current object
+  virtual int numberOfSubs() const;
+
+  virtual ObjectPtr subObject(int theId) const;
 
 protected:
   ObjectPtr myObject;
@@ -144,6 +155,8 @@ public:
 private:
   std::string groupName() const;
 
+  ModuleBase_ITreeNode* createNode(const ObjectPtr& theObj);
+
   FolderType myType;
 };
 
@@ -313,10 +326,34 @@ public:
   /// \param theGroup a name of group where objects were deleted
   virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup);
 
-private:
-  FeaturePtr getFeature(const std::string& theId) const;
+  /// Returns the node representation according to theRole.
+  virtual QVariant data(int theColumn, int theRole) const;
+};
+
+
+/////////////////////////////////////////////////////////////////////
+/**
+* \ingroup Modules
+* Implementation of a node for compsolid representation
+*/
+class PartSet_StepNode : public PartSet_ObjectNode
+{
+public:
+  PartSet_StepNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent) :
+    PartSet_ObjectNode(theObj, theParent) {}
+
+  static std::string typeId()
+  {
+    static std::string myType = "FieldStep";
+    return myType;
+  }
+
+  virtual std::string type() const { return typeId(); }
+
+  /// Returns the node representation according to theRole.
+  virtual QVariant data(int theColumn, int theRole) const;
 
-  void getFirstAndLastIndex(int& theFirst, int& theLast) const;
+  virtual VisibilityState visibilityState() const;
 };
 
-#endif
\ No newline at end of file
+#endif