b311480e |
1 | -- Created on: 1995-02-20 |
2 | -- Created by: Mister rmi |
3 | -- Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | deferred class SelectableObject from SelectMgr inherits PresentableObject from PrsMgr |
18 | |
19 | ---Purpose: A framework to supply the structure of the object to be |
20 | -- selected. At the first pick, this structure is created by |
21 | -- calling the appropriate algorithm and retaining this |
22 | -- framework for further picking. |
23 | -- This abstract framework is inherited in Application |
24 | -- Interactive Services (AIS), notably in AIS_InteractiveObject. |
25 | -- Consequently, 3D selection should be handled by the |
26 | -- relevant daughter classes and their member functions |
27 | -- in AIS. This is particularly true in the creation of new interactive objects. |
28 | |
29 | |
30 | uses |
31 | |
f751596e |
32 | Box from Bnd, |
7fd59977 |
33 | SelectionManager from SelectMgr, |
34 | Selection from SelectMgr, |
35 | SequenceOfSelection from SelectMgr, |
36 | TypeOfPresentation3d from PrsMgr, |
6262338c |
37 | Drawer from Prs3d, |
7fd59977 |
38 | Presentation from Prs3d, |
59f45b7c |
39 | PresentationManager from PrsMgr, |
7fd59977 |
40 | PresentationManager3d from PrsMgr, |
41 | SequenceOfOwner from SelectMgr, |
42 | NameOfColor from Quantity, |
43 | EntityOwner from SelectMgr, |
a1954302 |
44 | TransModeFlags from Graphic3d, |
45 | ZLayerId from Graphic3d |
7fd59977 |
46 | |
47 | raises |
48 | NotImplemented from Standard |
49 | |
50 | is |
51 | |
52 | |
53 | ---Category: deferred Methods |
54 | |
55 | |
56 | Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView); |
57 | |
6e33d3ce |
58 | ComputeSelection(me:mutable; aSelection : Selection from SelectMgr; |
0717ddc1 |
59 | aMode : Integer) is deferred; |
7fd59977 |
60 | ---Purpose: Recovers and calculates any sensitive primitive, |
f751596e |
61 | -- aSelection, available in Shape mode, specified by |
62 | -- aMode. As a rule, these are sensitive faces. |
63 | -- This method is defined as virtual. This enables you to |
64 | -- implement it in the creation of a new class of AIS |
65 | -- Interactive Object. You need to do this and in so |
66 | -- doing, redefine this method, if you create a class |
67 | -- which enriches the list of signatures and types. |
7fd59977 |
68 | |
69 | |
70 | ---Category: |
71 | |
72 | |
f751596e |
73 | RecomputePrimitives (me : mutable) |
74 | is static; |
75 | ---Purpose: Re-computes the sensitive primitives for all modes. IMPORTANT: Do not use |
76 | -- this method to update selection primitives except implementing custom selection manager! |
77 | -- This method does not take into account necessary BVH updates, but may invalidate the pointers |
78 | -- it refers to. TO UPDATE SELECTION properly from outside classes, use method UpdateSelection. |
7fd59977 |
79 | |
f751596e |
80 | RecomputePrimitives (me : mutable; |
81 | theMode : Integer from Standard) |
82 | is static; |
83 | ---Purpose: Re-computes the sensitive primitives which correspond to the <theMode>th selection mode. |
84 | -- IMPORTANT: Do not use this method to update selection primitives except implementing custom selection manager! |
85 | -- selection manager! This method does not take into account necessary BVH updates, but may invalidate |
86 | -- the pointers it refers to. TO UPDATE SELECTION properly from outside classes, use method UpdateSelection. |
7fd59977 |
87 | |
88 | |
f751596e |
89 | AddSelection(me:mutable; aSelection : Selection from SelectMgr; |
90 | aMode : Integer) |
7fd59977 |
91 | is static; |
92 | ---Purpose: Adds the selection aSelection with the selection mode |
93 | -- index aMode to this framework. |
94 | |
95 | |
96 | ClearSelections(me:mutable; update: Boolean from Standard = Standard_False) is static; |
97 | ---Level: Public |
98 | ---Purpose: Empties all the selections in the SelectableObject |
99 | -- <update> parameter defines whether all object's |
100 | -- selections should be flagged for further update or not. |
101 | -- This improved method can be used to recompute an |
102 | -- object's selection (without redisplaying the object |
103 | -- completely) when some selection mode is activated not for the first time. |
104 | |
105 | Selection(me;aMode : Integer) |
f751596e |
106 | returns any Selection from SelectMgr |
7fd59977 |
107 | is static; |
108 | ---C++: return const& |
109 | ---Purpose: Returns the selection Selection having the selection mode aMode. |
110 | |
111 | HasSelection(me; aMode: Integer) |
112 | returns Boolean from Standard is static ; |
113 | --- Purpose: Returns true if a selection corresponding to the |
114 | -- selection mode aMode is present in this framework. |
115 | |
116 | |
117 | |
118 | Init(me:mutable) is static; |
119 | ---Purpose: Begins the iteration scanning for sensitive primitives. |
120 | ---C++: inline |
121 | |
122 | |
123 | More(me) returns Boolean is static; |
124 | ---Purpose: Continues the iteration scanning for sensitive primitives. |
125 | ---C++: inline |
126 | |
127 | |
128 | |
129 | Next(me:mutable) is static; |
130 | ---Purpose: Continues the iteration scanning for sensitive primitives. |
131 | ---C++: inline |
132 | |
133 | |
134 | |
135 | CurrentSelection(me) returns any Selection from SelectMgr; |
136 | ---Purpose: Returns the current selection in this framework. |
137 | ---C++: return const& |
138 | ---C++: inline |
139 | |
140 | |
0717ddc1 |
141 | ResetTransformation(me:mutable) is redefined static; |
7fd59977 |
142 | |
0717ddc1 |
143 | UpdateTransformation(me:mutable) is redefined virtual; |
7fd59977 |
144 | ---Purpose: Recomputes the location of the selection aSelection. |
145 | |
913a4c4a |
146 | UpdateTransformations(me:mutable;aSelection: Selection from SelectMgr) is virtual; |
147 | ---Level: Public |
7fd59977 |
148 | ---Purpose: Updates locations in all sensitive entities from <aSelection> |
149 | -- and in corresponding entity owners. |
150 | |
151 | HilightSelected ( me : mutable; PM : PresentationManager3d from PrsMgr; |
152 | Seq : SequenceOfOwner from SelectMgr ) raises NotImplemented from Standard is virtual; |
153 | ---Purpose: Method which draws selected owners ( for fast presentation draw ) |
154 | |
155 | ClearSelected ( me : mutable ) is virtual; |
156 | ---Purpose: Method which clear all selected owners belonging |
157 | -- to this selectable object ( for fast presentation draw ) |
158 | |
159 | HilightOwnerWithColor ( me : mutable; thePM : PresentationManager3d from PrsMgr; |
160 | theColor : NameOfColor from Quantity; |
161 | theOwner : EntityOwner from SelectMgr ) raises NotImplemented from Standard is virtual; |
162 | ---Purpose: Method which hilight an owner belonging to |
163 | -- this selectable object ( for fast presentation draw ) |
164 | |
165 | IsAutoHilight ( me ) returns Boolean from Standard is virtual; |
166 | ---Purpose: If returns True, the old mechanism for highlighting |
167 | -- selected objects is used (HilightSelected Method may be empty). |
168 | -- If returns False, the HilightSelected method will be |
169 | -- fully responsible for highlighting selected entity |
170 | -- owners belonging to this selectable object. |
171 | |
172 | SetAutoHilight ( me : mutable; newAutoHilight : Boolean from Standard ) is virtual; |
173 | ---Purpose: Set AutoHilight property to true or false |
174 | |
175 | -- SetTransformPersistence( me : mutable; |
176 | -- aFlag : TransModeFlags from Graphic3d ) is redefined; |
177 | ---Level: Public |
178 | ---Purpose: Sets up Transform Persistence Mode for this object |
179 | ---Category: Graphic attributes management |
180 | |
181 | GetHilightPresentation( me: mutable; |
182 | TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static; |
183 | |
184 | GetSelectPresentation( me: mutable; |
185 | TheMgr: PresentationManager3d from PrsMgr ) returns Presentation from Prs3d is static; |
a1954302 |
186 | |
59f45b7c |
187 | SetZLayer ( me : mutable; |
a1954302 |
188 | theLayerId : ZLayerId from Graphic3d ) |
59f45b7c |
189 | is redefined virtual; |
a1954302 |
190 | ---Purpose: Set Z layer ID and update all presentations of the selectable object. |
191 | -- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers. |
59f45b7c |
192 | |
f751596e |
193 | UpdateSelection ( me : mutable; |
194 | theMode : Integer from Standard = -1) |
195 | is static; |
196 | ---Purpose: Sets update status FULL to selections of the object. Must be used as the only method of UpdateSelection |
197 | -- from outer classes to prevent BVH structures from being outdated. |
198 | |
199 | BoundingBox (me : mutable; |
200 | theBndBox : out Box from Bnd) |
201 | is deferred; |
202 | ---Purpose: Returns bounding box of selectable object |
203 | -- by storing its minimum and maximum 3d coordinates |
204 | -- to output parameters |
205 | |
6262338c |
206 | SetAttributes(me:mutable; theDrawer: Drawer from Prs3d) is virtual; |
f751596e |
207 | ---Purpose: Initializes the drawing tool theDrawer. |
208 | |
6262338c |
209 | Attributes(me) returns any Drawer from Prs3d; |
f751596e |
210 | ---C++: return const& |
211 | ---C++: inline |
212 | ---Purpose: Returns the attributes settings. |
213 | |
6262338c |
214 | UnsetAttributes(me:mutable) is virtual; |
f751596e |
215 | ---Purpose: Clears settings provided by the drawing tool theDrawer. |
6262338c |
216 | |
7f917335 |
217 | SetHilightAttributes(me:mutable; theDrawer: Drawer from Prs3d) is virtual; |
f751596e |
218 | ---Purpose: Initializes the hilight drawing tool theDrawer. |
7f917335 |
219 | |
220 | HilightAttributes(me) returns any Drawer from Prs3d; |
f751596e |
221 | ---C++: return const& |
222 | ---C++: inline |
223 | ---Purpose: Returns the hilight attributes settings. |
7f917335 |
224 | |
225 | UnsetHilightAttributes(me:mutable) is virtual; |
f751596e |
226 | ---Purpose: Clears settings provided by the hilight drawing tool theDrawer. |
7f917335 |
227 | |
228 | InitDefaultHilightAttributes(myclass; theDrawer : Drawer from Prs3d); |
f751596e |
229 | ---Purpose: Initializes theDrawer by default hilight settings. |
230 | |
231 | SetAssemblyOwner (me : mutable; |
232 | theOwner : EntityOwner from SelectMgr; |
233 | theMode : Integer from Standard = -1); |
234 | ---Purpose: Sets common entity owner for assembly sensitive object entities |
235 | |
236 | GetAssemblyOwner (me) |
237 | returns EntityOwner from SelectMgr |
238 | is static; |
239 | ---C++: return const& |
240 | ---Purpose: Returns common entity owner if the object is an assembly |
7f917335 |
241 | |
7fd59977 |
242 | fields |
243 | |
244 | myselections : SequenceOfSelection is protected; |
6262338c |
245 | myDrawer : Drawer from Prs3d is protected; |
7f917335 |
246 | myHilightDrawer : Drawer from Prs3d is protected; |
f751596e |
247 | myAssemblyOwner : EntityOwner from SelectMgr is protected; |
7fd59977 |
248 | mycurrent : Integer; |
249 | myAutoHilight : Boolean from Standard; |
250 | |
251 | mySelectionPrs : Presentation from Prs3d; |
252 | myHilightPrs : Presentation from Prs3d; |
f751596e |
253 | |
254 | friends |
255 | class SelectionManager from SelectMgr |
7fd59977 |
256 | |
257 | end SelectableObject; |