f751596e |
1 | // Created on: 1995-02-16 |
2 | // Created by: Mister rmi |
3 | // Copyright (c) 1995-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _SelectMgr_Selection_HeaderFile |
18 | #define _SelectMgr_Selection_HeaderFile |
19 | |
f751596e |
20 | #include <NCollection_Vector.hxx> |
21 | |
22 | #include <Standard.hxx> |
23 | #include <Standard_Type.hxx> |
ec357c5c |
24 | #include <Standard_Type.hxx> |
f751596e |
25 | |
26 | #include <SelectMgr_TypeOfUpdate.hxx> |
27 | #include <MMgt_TShared.hxx> |
f751596e |
28 | #include <SelectMgr_SensitiveEntity.hxx> |
29 | #include <SelectMgr_StateOfSelection.hxx> |
30 | #include <SelectMgr_TypeOfBVHUpdate.hxx> |
31 | |
32 | class Standard_NullObject; |
33 | class SelectBasics_SensitiveEntity; |
34 | |
f751596e |
35 | //! Represents the state of a given selection mode for a |
36 | //! Selectable Object. Contains all the sensitive entities available for this mode. |
37 | //! An interactive object can have an indefinite number of |
38 | //! modes of selection, each representing a |
39 | //! "decomposition" into sensitive primitives; each |
40 | //! primitive has an Owner (SelectMgr_EntityOwner) |
41 | //! which allows us to identify the exact entity which has |
42 | //! been detected. Each Selection mode is identified by |
43 | //! an index. The set of sensitive primitives which |
44 | //! correspond to a given mode is stocked in a |
45 | //! SelectMgr_Selection object. By Convention, the |
46 | //! default selection mode which allows us to grasp the |
47 | //! Interactive object in its entirety will be mode 0. |
48 | //! AIS_Trihedron : 4 selection modes |
49 | //! - mode 0 : selection of a trihedron |
50 | //! - mode 1 : selection of the origin of the trihedron |
51 | //! - mode 2 : selection of the axes |
52 | //! - mode 3 : selection of the planes XOY, YOZ, XOZ |
53 | //! when you activate one of modes 1 2 3 4 , you pick AIS objects of type: |
54 | //! - AIS_Point |
55 | //! - AIS_Axis (and information on the type of axis) |
56 | //! - AIS_Plane (and information on the type of plane). |
57 | //! AIS_PlaneTrihedron offers 3 selection modes: |
58 | //! - mode 0 : selection of the whole trihedron |
59 | //! - mode 1 : selection of the origin of the trihedron |
60 | //! - mode 2 : selection of the axes - same remarks as for the Trihedron. |
61 | //! AIS_Shape : 7 maximum selection modes, depending |
62 | //! on the complexity of the shape : |
63 | //! - mode 0 : selection of the AIS_Shape |
64 | //! - mode 1 : selection of the vertices |
65 | //! - mode 2 : selection of the edges |
66 | //! - mode 3 : selection of the wires |
67 | //! - mode 4 : selection of the faces |
68 | //! - mode 5 : selection of the shells |
69 | //! - mode 6 : selection of the constituent solids. |
70 | class SelectMgr_Selection : public MMgt_TShared |
71 | { |
72 | |
73 | public: |
74 | |
75 | //! Constructs a selection object defined by the selection mode IdMode. |
76 | //! The default setting 0 is the selection mode for a shape in its entirety. |
77 | Standard_EXPORT SelectMgr_Selection (const Standard_Integer theModeIdx = 0); |
78 | |
79 | ~SelectMgr_Selection(); |
80 | |
81 | Standard_EXPORT void Destroy(); |
82 | |
83 | //! Adds the sensitive primitive aprimitive to the list of |
84 | //! stored entities in this object. |
85 | //! Raises NullObject if the primitive is a null handle. |
86 | Standard_EXPORT void Add (const Handle(SelectBasics_SensitiveEntity)& theSensitive); |
87 | |
88 | //! empties the selection from all the stored entities |
89 | Standard_EXPORT void Clear(); |
90 | |
91 | //! returns true if no sensitive entity is stored. |
92 | Standard_EXPORT Standard_Boolean IsEmpty() const; |
93 | |
94 | //! returns the selection mode represented by this selection |
95 | Standard_Integer Mode() const; |
96 | |
97 | //! Begins an iteration scanning for sensitive primitives. |
98 | void Init(); |
99 | |
100 | //! Continues the iteration scanning for sensitive |
101 | //! primitives with the mode defined in this framework. |
102 | Standard_Boolean More() const; |
103 | |
104 | //! Returns the next sensitive primitive found in the |
105 | //! iteration. This is a scan for entities with the mode |
106 | //! defined in this framework. |
107 | void Next(); |
108 | |
109 | //! Returns any sensitive primitive in this framework. |
7ab15952 |
110 | const Handle(SelectMgr_SensitiveEntity)& Sensitive() const; |
f751596e |
111 | |
112 | //! Returns the flag UpdateFlag. |
113 | //! This flage gives the update status of this framework |
114 | //! in a ViewerSelector object: |
115 | //! - full |
116 | //! - partial, or |
117 | //! - none. |
118 | SelectMgr_TypeOfUpdate UpdateStatus() const; |
119 | |
120 | void UpdateStatus (const SelectMgr_TypeOfUpdate theStatus); |
121 | |
122 | void UpdateBVHStatus (const SelectMgr_TypeOfBVHUpdate theStatus); |
123 | |
124 | SelectMgr_TypeOfBVHUpdate BVHUpdateStatus() const; |
125 | |
126 | //! Returns status of selection |
127 | Standard_EXPORT const SelectMgr_StateOfSelection GetSelectionState() const; |
128 | |
129 | //! Sets status of selection |
130 | Standard_EXPORT void SetSelectionState (const SelectMgr_StateOfSelection theState) const; |
131 | |
132 | //! Returns sensitivity of the selection |
7ab15952 |
133 | Standard_EXPORT Standard_Real Sensitivity() const; |
f751596e |
134 | |
ec357c5c |
135 | DEFINE_STANDARD_RTTI (SelectMgr_Selection, MMgt_TShared) |
f751596e |
136 | |
137 | protected: |
138 | |
139 | //! Returns sensitive entity stored by index theIdx in entites vector |
7ab15952 |
140 | Handle(SelectMgr_SensitiveEntity)& GetEntityById (const Standard_Integer theIdx); |
f751596e |
141 | |
142 | private: |
143 | |
7ab15952 |
144 | NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities; |
145 | NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator myEntityIter; |
146 | Standard_Integer myMode; |
147 | SelectMgr_TypeOfUpdate myUpdateStatus; |
148 | mutable SelectMgr_StateOfSelection mySelectionState; |
149 | mutable SelectMgr_TypeOfBVHUpdate myBVHUpdateStatus; |
150 | Standard_Real mySensFactor; |
f751596e |
151 | }; |
152 | |
153 | DEFINE_STANDARD_HANDLE(SelectMgr_Selection, MMgt_TShared) |
154 | |
155 | #include <SelectMgr_Selection.lxx> |
156 | |
157 | #endif |