0031458: Visualization - refine classes across Prs3d and StdPrs packages
[occt.git] / src / MeshVS / MeshVS_MeshOwner.hxx
1 // Created on: 2007-01-24
2 // Created by: Sergey  Kochetkov
3 // Copyright (c) 2007-2014 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 _MeshVS_MeshOwner_HeaderFile
17 #define _MeshVS_MeshOwner_HeaderFile
18
19 #include <SelectMgr_EntityOwner.hxx>
20 #include <PrsMgr_PresentationManager3d.hxx>
21 #include <Quantity_NameOfColor.hxx>
22
23 class MeshVS_DataSource;
24 class TColStd_HPackedMapOfInteger;
25 class PrsMgr_PresentationManager;
26
27
28 class MeshVS_MeshOwner;
29 DEFINE_STANDARD_HANDLE(MeshVS_MeshOwner, SelectMgr_EntityOwner)
30
31 //! The custom mesh owner used for advanced mesh selection. This class provides methods to store information:
32 //! 1) IDs of hilighted mesh nodes and elements
33 //! 2) IDs of mesh nodes and elements selected on the mesh
34 class MeshVS_MeshOwner : public SelectMgr_EntityOwner
35 {
36
37 public:
38
39   
40   Standard_EXPORT MeshVS_MeshOwner(const SelectMgr_SelectableObject* theSelObj, const Handle(MeshVS_DataSource)& theDS, const Standard_Integer thePriority = 0);
41   
42   Standard_EXPORT const Handle(MeshVS_DataSource)& GetDataSource() const;
43   
44   //! Returns ids of selected mesh nodes
45   Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetSelectedNodes() const;
46   
47   //! Returns ids of selected mesh elements
48   Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetSelectedElements() const;
49   
50   //! Saves ids of selected mesh entities
51   Standard_EXPORT virtual void AddSelectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems);
52   
53   //! Clears ids of selected mesh entities
54   Standard_EXPORT virtual void ClearSelectedEntities();
55   
56   //! Returns ids of hilighted mesh nodes
57   Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetDetectedNodes() const;
58   
59   //! Returns ids of hilighted mesh elements
60   Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetDetectedElements() const;
61   
62   //! Saves ids of hilighted mesh entities
63   Standard_EXPORT void SetDetectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems);
64   
65   Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
66                                                  const Handle(Prs3d_Drawer)& theColor,
67                                                  const Standard_Integer theMode = 0) Standard_OVERRIDE;
68   
69   Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE;
70   
71   Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE;
72
73
74
75
76   DEFINE_STANDARD_RTTIEXT(MeshVS_MeshOwner,SelectMgr_EntityOwner)
77
78 protected:
79
80
81   Handle(TColStd_HPackedMapOfInteger) mySelectedNodes;
82   Handle(TColStd_HPackedMapOfInteger) mySelectedElems;
83
84
85 private:
86
87
88   Handle(MeshVS_DataSource) myDataSource;
89   Handle(TColStd_HPackedMapOfInteger) myDetectedNodes;
90   Handle(TColStd_HPackedMapOfInteger) myDetectedElems;
91   Standard_Integer myLastID;
92
93
94 };
95
96
97
98
99
100
101
102 #endif // _MeshVS_MeshOwner_HeaderFile