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 VInspector_ViewModel_H |
17 | #define VInspector_ViewModel_H |
18 | |
19 | #include <AIS_InteractiveContext.hxx> |
20 | #include <NCollection_List.hxx> |
bbd92927 |
21 | #include <SelectMgr_EntityOwner.hxx> |
22 | |
0cb512c0 |
23 | #include <inspector/TreeModel_ModelBase.hxx> |
24 | #include <inspector/VInspector_ItemBase.hxx> |
14bbbdcb |
25 | |
130eb114 |
26 | #include <Standard_WarningsDisable.hxx> |
14bbbdcb |
27 | #include <QByteArray> |
28 | #include <QHash> |
29 | #include <QMap> |
30 | #include <QObject> |
130eb114 |
31 | #include <Standard_WarningsRestore.hxx> |
14bbbdcb |
32 | |
33 | class OCAFSampleAPI_Module; |
34 | class OCAFSampleModel_DocumentMgr; |
35 | |
36 | class QItemSelectionModel; |
37 | |
38 | //! \class VInspector_ViewModel |
39 | //! The class that visualizes the AIS context content |
40 | class VInspector_ViewModel : public TreeModel_ModelBase |
41 | { |
42 | Q_OBJECT |
43 | |
44 | public: |
45 | |
46 | //! Constructor |
47 | Standard_EXPORT VInspector_ViewModel (QObject* theParent); |
48 | |
49 | //! Destructor |
7e1c1e48 |
50 | virtual ~VInspector_ViewModel() {} |
51 | |
52 | //! Creates model columns and root items. |
53 | Standard_EXPORT virtual void InitColumns() Standard_OVERRIDE; |
14bbbdcb |
54 | |
55 | //! Initialize the model by the given context |
56 | //! \param theContext viewer context |
6822a3be |
57 | Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const; |
58 | |
14bbbdcb |
59 | //! Initialize the model by the given context |
60 | //! \param theContext viewer context |
61 | Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& theContext); |
62 | |
63 | //! Returns tree view indices for the given pointers of presentable object |
64 | //! \param thePointers a list of presentation pointers |
7e1c1e48 |
65 | //! \param theParent an index of the parent item |
66 | //! \param [out] container of indices |
67 | Standard_EXPORT void FindPointers (const QStringList& thePointers, |
68 | const QModelIndex& theParent, |
69 | QModelIndexList& theFoundIndices); |
14bbbdcb |
70 | |
0cb512c0 |
71 | //! Returns tree model index of the presentation item in the tree view. |
72 | //! \param thePresentation a presentation |
73 | //! \return model index if the value is found or Null model index |
74 | Standard_EXPORT QModelIndex FindIndex (const Handle(AIS_InteractiveObject)& thePresentation) const; |
75 | |
6822a3be |
76 | //! Updates tree model |
77 | Standard_EXPORT void UpdateTreeModel(); |
78 | |
79 | protected: |
6822a3be |
80 | //! Creates root item |
81 | //! \param theColumnId index of a column |
7e1c1e48 |
82 | Standard_EXPORT virtual TreeModel_ItemBasePtr createRootItem (const int theColumnId) Standard_OVERRIDE; |
14bbbdcb |
83 | |
14bbbdcb |
84 | }; |
85 | |
86 | #endif |