Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_DataTreeModel.h
1
2
3 #ifndef XGUI_DataTreeModel_H
4 #define XGUI_DataTreeModel_H
5
6 #include <ModelAPI_Document.h>
7 #include <QAbstractItemModel>
8
9 #include "XGUI_Constants.h"
10
11 /**\class XGUI_FeaturesModel
12  * \ingroup GUI
13  * \brief Abstaract class of model object which operates with features data.
14  */
15 class XGUI_FeaturesModel : public QAbstractItemModel
16 {
17 public:
18   XGUI_FeaturesModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
19       QAbstractItemModel(theParent), myDocument(theDocument) {}
20
21   //! Returns Feature object by the given Model index.
22   //! Returns 0 if the given index is not index of a feature
23   virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0;
24
25 protected:
26   std::shared_ptr<ModelAPI_Document> myDocument;
27 };
28
29
30 /**\class XGUI_PartModel
31  * \ingroup GUI
32  * \brief Abstaract class of model object which operates with parts data.
33  */
34 class XGUI_PartModel : public XGUI_FeaturesModel
35 {
36 public:
37   XGUI_PartModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
38       XGUI_FeaturesModel(theDocument, theParent) {}
39
40       void setPartId(int theId) { myId = theId; }
41
42 protected:
43   //! Id of the current part object in the document
44   int myId;
45 };
46
47
48 #endif