3 #ifndef XGUI_DataTreeModel_H
4 #define XGUI_DataTreeModel_H
6 #include <ModelAPI_Document.h>
7 #include <QAbstractItemModel>
9 #include "XGUI_Constants.h"
11 /**\class XGUI_FeaturesModel
13 * \brief Abstaract class of model object which operates with features data.
15 class XGUI_FeaturesModel : public QAbstractItemModel
18 XGUI_FeaturesModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
19 QAbstractItemModel(theParent), myDocument(theDocument) {}
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;
25 //! Returns parent index of the given feature
26 virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
29 std::shared_ptr<ModelAPI_Document> myDocument;
33 /**\class XGUI_PartModel
35 * \brief Abstaract class of model object which operates with parts data.
37 class XGUI_PartModel : public XGUI_FeaturesModel
40 XGUI_PartModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
41 XGUI_FeaturesModel(theDocument, theParent) {}
43 void setPartId(int theId) { myId = theId; }
45 //! Returns true if the given document is a sub-document of this tree
46 virtual bool hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
49 //! Id of the current part object in the document