Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_DataTreeModel.h
index be711129293bb2f8bb55932384b19ce906f0c7d4..0b8844e2f494414f3874424e701b3c5ccadd1fe7 100644 (file)
@@ -6,6 +6,9 @@
 #include "XGUI_Constants.h"
 
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_ResultPart.h>
+
 #include <QAbstractItemModel>
 #include <QColor>
 
 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
 {
 public:
-  XGUI_FeaturesModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
-      QAbstractItemModel(theParent), myDocument(theDocument), myItemsColor(Qt::black) {}
+  XGUI_FeaturesModel(QObject* theParent):
+      QAbstractItemModel(theParent), myItemsColor(Qt::black) {}
 
   //! Returns Feature object by the given Model index.
   //! Returns 0 if the given index is not index of a feature
-  virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0;
+  virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
+
+  //! Returns QModelIndex which corresponds to the given feature
+  //! If the feature is not found then index is not valid
+  virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
+  virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
@@ -34,7 +41,6 @@ public:
   QColor itemsColor() const { return myItemsColor; }
 
 protected:
-  boost::shared_ptr<ModelAPI_Document> myDocument;
   QColor myItemsColor;
 };
 
@@ -46,16 +52,16 @@ protected:
 class XGUI_PartModel : public XGUI_FeaturesModel
 {
 public:
-  XGUI_PartModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
-      XGUI_FeaturesModel(theDocument, theParent) {}
+  XGUI_PartModel(QObject* theParent):
+      XGUI_FeaturesModel(theParent) {}
 
   void setPartId(int theId) { myId = theId; }
 
   //! Returns true if the given document is a sub-document of this tree
-  virtual bool hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
+  virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
 
   //! Return a Part object
-  virtual FeaturePtr part() const = 0;
+  virtual ResultPartPtr part() const = 0;
 
 protected:
   //! Id of the current part object in the document