14bbbdcb |
1 | // Created on: 2017-06-16 |
2 | // Created by: Natalia ERMOLAEVA |
3 | // Copyright (c) 2017 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef ShapeView_TreeModel_H |
17 | #define ShapeView_TreeModel_H |
18 | |
0cb512c0 |
19 | #include <inspector/ShapeView_ItemBase.hxx> |
14bbbdcb |
20 | #include <Standard.hxx> |
21 | #include <TopoDS_Shape.hxx> |
0cb512c0 |
22 | #include <inspector/TreeModel_ModelBase.hxx> |
14bbbdcb |
23 | |
130eb114 |
24 | #include <Standard_WarningsDisable.hxx> |
14bbbdcb |
25 | #include <QMap> |
26 | #include <QObject> |
130eb114 |
27 | #include <Standard_WarningsRestore.hxx> |
14bbbdcb |
28 | |
29 | class ShapeView_TreeModel; |
30 | |
31 | //! \class ShapeView_TreeModel |
32 | //! View model to visualize content of TopoDS_Shape |
33 | class ShapeView_TreeModel : public TreeModel_ModelBase |
34 | { |
35 | public: |
36 | |
37 | //! Constructor |
38 | Standard_EXPORT ShapeView_TreeModel (QObject* theParent); |
39 | |
40 | //! Destructor |
41 | virtual ~ShapeView_TreeModel() Standard_OVERRIDE {}; |
42 | |
43 | //! Add shape, append it to the model root item |
44 | //! \param theShape a shape instance |
45 | Standard_EXPORT void AddShape (const TopoDS_Shape& theShape); |
46 | |
47 | //! Remove all shapes in the model root item |
48 | Standard_EXPORT void RemoveAllShapes(); |
49 | |
50 | //! Returns root item by column |
51 | //! \param theColumn an index of the column |
52 | //! \return root item instance |
53 | virtual TreeModel_ItemBasePtr RootItem(const int theColumn) const Standard_OVERRIDE |
54 | { return myRootItems[theColumn]; } |
55 | |
0cb512c0 |
56 | //! Returns model index of the shape. |
57 | //! \param theShape a shape object |
58 | //! \return the model index |
59 | QModelIndex FindIndex (const TopoDS_Shape& theShape) const; |
60 | |
6822a3be |
61 | protected: |
62 | //! Creates root item |
63 | //! \param theColumnId index of a column |
64 | virtual void createRootItem (const int theColumnId) Standard_OVERRIDE; |
14bbbdcb |
65 | |
66 | private: |
67 | QMap<int, TreeModel_ItemBasePtr> myRootItems; //!< container of root items, for each column own root item |
68 | }; |
69 | |
70 | #endif |