2 #ifndef XGUI_DataTreeModel_H
3 #define XGUI_DataTreeModel_H
6 #include "XGUI_Constants.h"
8 #include <ModelAPI_Document.h>
9 #include <QAbstractItemModel>
11 /**\class XGUI_FeaturesModel
13 * \brief Abstaract class of model object which operates with features data.
15 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
18 XGUI_FeaturesModel(const boost::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 boost::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
28 //! Returns index corresponded to the group
29 virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
32 boost::shared_ptr<ModelAPI_Document> myDocument;
36 /**\class XGUI_PartModel
38 * \brief Abstaract class of model object which operates with parts data.
40 class XGUI_PartModel : public XGUI_FeaturesModel
43 XGUI_PartModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
44 XGUI_FeaturesModel(theDocument, theParent) {}
46 void setPartId(int theId) { myId = theId; }
48 //! Returns true if the given document is a sub-document of this tree
49 virtual bool hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
51 //! Return a Part object
52 virtual FeaturePtr part() const = 0;
55 //! Id of the current part object in the document