b311480e |
1 | -- Created on: 1991-09-05 |
2 | -- Created by: NW,JPB,CAL |
3 | -- Copyright (c) 1991-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
7fd59977 |
5 | -- |
b311480e |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
7fd59977 |
10 | -- |
b311480e |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
7fd59977 |
13 | -- |
b311480e |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
21 | -- 05-97: CAL; Ajout du Clear sur les TOS_COMPUTED. |
22 | -- 05-98: CAL; Perfs. Connection entre structures COMPUTED. |
7fd59977 |
23 | |
24 | class ViewManager from Visual3d inherits StructureManager from Graphic3d |
25 | |
26 | ---Purpose: This class allows the definition of a manager to |
27 | -- which the views are associated. |
28 | -- It allows them to be globally manipulated. |
29 | -- It activates the pick. |
30 | |
31 | uses |
32 | |
33 | Array2OfReal from TColStd, |
59f45b7c |
34 | SequenceOfInteger from TColStd, |
35 | MapOfInteger from TColStd, |
7fd59977 |
36 | |
37 | GenId from Aspect, |
7fd59977 |
38 | Window from Aspect, |
39 | TypeOfHighlightMethod from Aspect, |
40 | |
41 | GraphicDriver from Graphic3d, |
42 | Structure from Graphic3d, |
43 | DataStructureManager from Graphic3d, |
44 | Vertex from Graphic3d, |
45 | CView from Graphic3d, |
46 | Vector from Graphic3d, |
47 | |
48 | ContextPick from Visual3d, |
49 | Layer from Visual3d, |
50 | PickDescriptor from Visual3d, |
51 | SetOfView from Visual3d, |
52 | HSetOfView from Visual3d, |
53 | View from Visual3d |
54 | |
55 | is |
56 | |
dc3fe572 |
57 | Create ( theDriver: GraphicDriver from Graphic3d) |
7fd59977 |
58 | returns mutable ViewManager from Visual3d; |
59 | ---Level: Public |
60 | ---Purpose: Creates a 3D visualizer. |
bcfa72e4 |
61 | -- Currently creating of more than 100 viewer instances |
62 | -- is not supported and leads to InitializationError and |
63 | -- initialisation failure. |
64 | -- This limitation might be addressed in some future OCCT releases. |
7fd59977 |
65 | --------------------------------------------------- |
66 | -- Category: Methods to modify the class definition |
67 | --------------------------------------------------- |
68 | |
69 | Activate ( me : mutable ) |
70 | is static; |
71 | ---Level: Public |
72 | ---Purpose: Activates all the views of the manager <me>. |
73 | ---Category: Methods to modify the class definition |
74 | |
75 | Deactivate ( me : mutable ) |
76 | is static; |
77 | ---Level: Public |
78 | ---Purpose: Deactivates all the views of the manager <me>. |
79 | ---Category: Methods to modify the class definition |
80 | |
81 | Destroy ( me : mutable ) |
82 | is redefined; |
83 | ---Level: Public |
84 | ---Purpose: Deletes and erases the 3D visualiser <me>. |
85 | ---Category: Methods to modify the class definition |
86 | ---C++: alias ~ |
87 | |
88 | Erase ( me : mutable ) |
89 | is static; |
90 | ---Level: Public |
91 | ---Purpose: Erases all of the structures displayed in the |
92 | -- visualiser <me>. |
93 | ---Category: Methods to modify the class definition |
94 | |
95 | Redraw ( me ) |
96 | is static; |
97 | ---Level: Public |
98 | ---Purpose: Redraws all the displayed structures. |
99 | ---Category: Methods to modify the class definition |
100 | |
101 | Remove ( me : mutable ) |
102 | is static; |
103 | ---Level: Public |
104 | ---Purpose: Deletes and erases the 3D visualiser <me>. |
105 | ---Category: Methods to modify the class definition |
106 | |
107 | Update ( me ) |
108 | is redefined static; |
109 | ---Level: Public |
110 | ---Purpose: Updates screen in function of modifications of |
111 | -- the structures. |
112 | -- Category: Methods to modify the class definition |
113 | -- Warning: Not necessary if the update mode is TOU_ASAP. |
114 | |
115 | ---------------------------- |
116 | -- Category: Inquire methods |
117 | ---------------------------- |
118 | |
119 | ActivatedView ( me ) |
120 | returns HSetOfView from Visual3d |
121 | is static; |
122 | ---Level: Internal |
123 | ---Purpose: Returns the group of views activated in the visualiser <me>. |
124 | ---Category: Inquire methods |
125 | |
126 | ConvertCoord ( me; |
127 | AWindow : Window from Aspect; |
128 | AVertex : Vertex from Graphic3d; |
129 | AU, AV : out Integer from Standard ) |
130 | is static; |
131 | ---Level: Public |
132 | ---Purpose: Applies the view orientation transformation, the |
133 | -- view mapping transformation and view clip, the |
134 | -- display transformation to the vertex <AVertex>. |
135 | -- Returns the pixel coordinates <AU>, <AV>. |
136 | -- Warning: Returns <AU> = <AV> = IntegerLast () if the |
137 | -- evaluation is impossible. |
138 | -- -- Bad Window, Numeric error... |
139 | ---Category: Inquire methods |
140 | |
141 | ConvertCoord ( me; |
142 | AWindow : Window from Aspect; |
143 | AU, AV : Integer from Standard ) |
144 | returns Vertex from Graphic3d |
145 | is static; |
146 | ---Level: Public |
147 | ---Purpose: Applies the inverse of the display transformation, the |
148 | -- inverse of the view mapping transformation and view clip, |
149 | -- the inverse of the view orientation transformation to |
150 | -- the pixel coordinates <AU>, <AV>. |
151 | -- Returns the world coordinates <AVertex>. |
152 | -- Warning: Returns AVertex (X, Y, Z) with X = Y = Z = RealLast () |
153 | -- if the evaluation is impossible. |
154 | -- -- Bad Window, Numeric error... |
155 | ---Category: Inquire methods |
156 | |
157 | ConvertCoordWithProj ( me; |
158 | AWindow : Window from Aspect; |
159 | AU, AV : Integer from Standard; |
160 | Point : out Vertex from Graphic3d; |
161 | Proj : out Vector from Graphic3d ) |
162 | is static; |
163 | ---Level: Public |
164 | ---Purpose: Applies the inverse of the display transformation, the |
165 | -- inverse of the view mapping transformation and view clip, |
166 | -- the inverse of the view orientation transformation to |
167 | -- the pixel coordinates <AU>, <AV>. |
168 | -- Returns the world coordinates <AVertex> and projection ray <AVector>. |
169 | -- Warning: Returns AVertex (X, Y, Z) with X = Y = Z = RealLast () and |
170 | -- AVector (VX, VY, VZ) with VX = VY = VZ = 0. |
171 | -- if the evaluation is impossible. |
172 | -- -- Bad Window, Numeric error... |
173 | ---Category: Inquire methods |
174 | |
175 | DefinedView ( me ) |
176 | returns HSetOfView from Visual3d |
177 | is static; |
178 | ---Level: Internal |
179 | ---Purpose: Returns the group of views defined in the visualiser <me>. |
180 | ---Category: Inquire methods |
181 | |
182 | MaxNumOfViews ( me ) |
183 | returns Integer from Standard |
184 | is static; |
185 | ---Level: Internal |
186 | ---Purpose: Returns the theoretical maximum number of |
187 | -- definable views in the view manager <me>. |
188 | -- Warning: It's not possible to accept an infinite |
189 | -- number of definable views because each |
190 | -- view must have an identification and we |
191 | -- have different view managers. |
192 | ---Category: Inquire methods |
193 | |
194 | Identification ( me : mutable; |
195 | AView : View from Visual3d ) |
196 | returns Integer from Standard |
197 | is static; |
198 | ---Level: Internal |
199 | ---Purpose: Returns : |
200 | -- a new identification number for a new view |
201 | -- in the visualiser. |
202 | ---Category: Inquire methods |
203 | |
204 | UnIdentification ( me : mutable; |
205 | aViewId : Integer from Standard ) |
206 | ---Purpose: Release a unique ID of the view reserved for the view on its creation. |
207 | is static; |
208 | |
209 | ------------------------------------------------- |
210 | -- Summary of Pick Input -- |
211 | -- -- |
212 | -- Picking returns information about an -- |
213 | -- object pointed to on the display. -- |
214 | -- -- |
215 | -- To be picked, a structure must be : -- |
216 | -- -- |
217 | -- Visible -- |
218 | -- Within the pick aperture -- |
219 | -- Pickable as determined by the method -- |
220 | -- Graphic3d_Structure::SetPick -- |
221 | -- -- |
222 | -- The PickDescriptor is : -- |
223 | -- A list of PickPath. -- |
224 | -- -- |
225 | -- The PickPath is defined by : -- |
226 | -- A Structure Identification -- |
227 | -- A Pick Identification -- |
228 | -- An Element Number. -- |
229 | -- -- |
230 | -- To insert a Pick Identification use the -- |
231 | -- method Graphic3d_Group::SetPickId -- |
232 | -- -- |
233 | -- The pick search order tends to select the -- |
234 | -- "top" object : -- |
235 | -- High to low structure display priority -- |
236 | -- Most recently displayed to least -- |
237 | -- recently displayed. -- |
238 | ------------------------------------------------- |
239 | |
7fd59977 |
240 | ------------------------------ |
241 | -- Category: Redefined methods |
242 | ------------------------------ |
243 | |
244 | -- |
245 | -- 3 redefined methods |
246 | -- |
247 | -- The C++ programming language (Bjarne Stroustrup) |
248 | -- page 586 r.13.1 Declaration Matching |
249 | -- |
250 | -- A function member of a derived class is not in the same |
251 | -- scope as a function member of the same name in a base class. |
252 | -- So Identification (AView) hides Identification (AStructure) |
253 | -- rather than overloads it ! |
254 | -- |
255 | |
256 | Identification ( me; |
257 | AId : Integer from Standard ) |
258 | returns Structure from Graphic3d |
259 | is redefined static; |
260 | ---Level: Internal |
261 | ---Purpose: Returns the structure with the identification number <AId>. |
262 | ---Category: Redefined methods |
263 | |
264 | Identification ( me ) |
265 | returns Integer from Standard |
266 | is redefined static; |
267 | ---Level: Internal |
268 | ---Purpose: Returns the identification number of the visualiser. |
269 | ---Category: Redefined methods |
270 | |
271 | ---------------------------- |
272 | -- Category: Private methods |
273 | ---------------------------- |
274 | |
275 | ChangeDisplayPriority ( me : mutable; |
276 | AStructure : Structure from Graphic3d; |
277 | OldPriority : Integer from Standard; |
278 | NewPriority : Integer from Standard ) |
279 | is redefined static; |
280 | ---Level: Internal |
281 | ---Purpose: Changes the display priority of the structure <AStructure>. |
282 | ---Category: Private methods |
283 | |
59f45b7c |
284 | ChangeZLayer ( me : mutable; |
285 | theStructure : Structure from Graphic3d; |
286 | theLayerId : Integer from Standard ) |
287 | is redefined static; |
288 | ---Purpose: Change Z layer for structure. The layer mechanism allows |
289 | -- to display structures in higher layers in overlay of structures in |
290 | -- lower layers. |
291 | |
292 | GetZLayer ( me; |
293 | theStructure : Structure from Graphic3d ) |
294 | returns Integer from Standard is redefined static; |
295 | ---Purpose: Get Z layer ID assigned for the structure. |
296 | |
297 | AddZLayer ( me : mutable; |
298 | theLayerId : in out Integer from Standard ) |
299 | returns Boolean from Standard is redefined static; |
300 | ---Purpose: Add a new top-level Z layer and get its ID as |
301 | -- <theLayerId> value. The method returns Standard_False if the layer |
302 | -- can not be created. The layer mechanism allows to display |
303 | -- structures in higher layers in overlay of structures in lower layers. |
304 | |
305 | RemoveZLayer ( me : mutable; |
306 | theLayerId : Integer from Standard ) |
307 | returns Boolean from Standard is redefined static; |
308 | ---Purpose: Remove Z layer with ID <theLayerId>. Method returns |
309 | -- Standard_False if the layer can not be removed or doesn't exists. |
310 | -- By default, there are always default bottom-level layer that can't |
311 | -- be removed. |
312 | |
313 | GetAllZLayers ( me; |
314 | theLayerSeq : out SequenceOfInteger from TColStd ) |
315 | is redefined static; |
316 | ---Purpose: Return all Z layer ids in sequence ordered by overlay level |
317 | -- from lowest layer to highest ( foreground ). The first layer ID |
318 | -- in sequence is the default layer that can't be removed. |
319 | |
71c4f9c6 |
320 | InstallZLayers ( me; |
321 | theView : View from Visual3d ) |
322 | is private; |
323 | ---Purpose: Install z layers managed by the view manager into the |
324 | -- controlled view. This method used on the view initialization to |
325 | -- make the layer lists consistent. |
326 | |
59f45b7c |
327 | getZLayerGenId ( myclass ) |
328 | ---Purpose: Returns global instance of z layer ids generator. |
329 | ---C++: return & |
330 | returns GenId from Aspect is protected; |
331 | |
332 | |
7fd59977 |
333 | Clear ( me : mutable; |
334 | AStructure : Structure from Graphic3d; |
335 | WithDestruction : Boolean from Standard ) |
336 | is redefined static; |
337 | ---Level: Internal |
338 | ---Purpose: Clears the structure <AStructure>. |
339 | ---Category: Private methods |
340 | |
341 | Connect ( me : mutable; |
342 | AMother : Structure from Graphic3d; |
343 | ADaughter : Structure from Graphic3d ) |
344 | is redefined static; |
345 | ---Level: Internal |
346 | ---Purpose: Connects the structures <AMother> and <ADaughter>. |
347 | ---Category: Private methods |
348 | |
349 | Disconnect ( me : mutable; |
350 | AMother : Structure from Graphic3d; |
351 | ADaughter : Structure from Graphic3d ) |
352 | is redefined static; |
353 | ---Level: Internal |
354 | ---Purpose: Disconnects the structures <AMother> and <ADaughter>. |
355 | ---Category: Private methods |
356 | |
357 | Display ( me : mutable; |
358 | AStructure : Structure from Graphic3d ) |
359 | is redefined static; |
360 | ---Level: Internal |
361 | ---Purpose: Display of the structure <AStructure>. |
362 | ---Category: Private methods |
363 | |
364 | Erase ( me : mutable; |
365 | AStructure : Structure from Graphic3d ) |
366 | is redefined static; |
367 | ---Level: Internal |
368 | ---Purpose: Erases the structure <AStructure>. |
369 | ---Category: Private methods |
370 | |
371 | Highlight ( me : mutable; |
372 | AStructure : Structure from Graphic3d; |
373 | AMethod : TypeOfHighlightMethod from Aspect ) |
374 | is redefined static; |
375 | ---Level: Internal |
376 | ---Purpose: Highlights the structure <AStructure>. |
377 | ---Category: Private methods |
378 | |
379 | SetTransform ( me : mutable; |
380 | AStructure : Structure from Graphic3d; |
381 | ATrsf : Array2OfReal from TColStd ) |
382 | is redefined static; |
383 | ---Level: Internal |
384 | ---Purpose: |
385 | ---Category: Private methods |
386 | |
387 | UnHighlight ( me : mutable ) |
388 | is redefined static; |
389 | ---Level: Internal |
390 | ---Purpose: Suppress the highlighting on all the structures. |
391 | ---Category: Private methods |
392 | |
393 | UnHighlight ( me : mutable; |
394 | AStructure : Structure from Graphic3d ) |
395 | is redefined static; |
396 | ---Level: Internal |
397 | ---Purpose: Suppress the highlighting on the structure <AStructure>. |
398 | ---Category: Private methods |
399 | |
400 | ViewExists ( me; |
401 | AWindow : Window from Aspect; |
402 | TheCView : out CView from Graphic3d ) |
403 | returns Boolean from Standard |
404 | is static; |
405 | ---Level: Internal |
406 | ---Purpose: Returns Standard_True if the view associated to the |
407 | -- window <AWindow> exists and is activated. |
408 | -- <TheViewId> contains the internal identification of |
409 | -- the associated view. |
410 | ---Category: Private methods |
411 | |
412 | SetLayer ( me : mutable; |
413 | ALayer : Layer from Visual3d ) |
414 | is static private; |
415 | ---Level: Internal |
416 | ---Purpose: Adds a new layer in all the views of <me>. |
417 | ---Category: Private methods |
418 | |
419 | UnderLayer ( me ) |
420 | returns Layer from Visual3d; |
421 | ---Level: Internal |
422 | ---Purpose: Returns the underlay of the viewer <me>. |
423 | ---Category: Private methods |
424 | ---C++: return const & |
425 | |
426 | OverLayer ( me ) |
427 | returns Layer from Visual3d; |
428 | ---Level: Internal |
429 | ---Purpose: Returns the underlay of the viewer <me>. |
430 | ---Category: Private methods |
431 | ---C++: return const & |
432 | |
433 | ----------------------------- |
434 | -- Category: Internal methods |
435 | ----------------------------- |
436 | |
437 | ReCompute ( me : mutable; |
438 | AStructure : Structure from Graphic3d ) |
439 | is redefined static; |
440 | ---Level: Advanced |
441 | ---Purpose: Forces a new construction of the structure <AStructure> |
442 | -- if <AStructure> is displayed and TOS_COMPUTED. |
443 | ---Category: Private methods |
444 | |
445 | ReCompute ( me : mutable; |
446 | AStructure : Structure from Graphic3d; |
447 | AProjector : DataStructureManager from Graphic3d ) |
448 | is redefined static; |
449 | ---Level: Advanced |
450 | ---Purpose: Forces a new construction of the structure <AStructure> |
451 | -- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED. |
452 | ---Category: Private methods |
453 | |
454 | Transparency ( me ) |
455 | returns Boolean from Standard |
456 | is static; |
457 | ---Level: Advanced |
458 | ---Purpose: Returns Standard_True if the transparency |
459 | -- is activated in all activated views. |
460 | -- Default Standard_False |
461 | ---Category: Internal methods |
462 | |
463 | SetTransparency ( me : mutable; |
464 | AFlag : Boolean from Standard ) |
465 | is static; |
466 | ---Level: Advanced |
467 | ---Purpose: if <AFlag> is Standard_True then the transparency |
468 | -- is managed. |
469 | -- Default Standard_False |
470 | ---Category: Internal methods |
471 | |
472 | ZBufferAuto ( me ) |
473 | returns Boolean from Standard |
474 | is static; |
475 | ---Level: Advanced |
476 | ---Purpose: Returns Standard_True if the zbuffer activity |
477 | -- is managed automatically. |
478 | -- Default Standard_False |
479 | ---Category: Internal methods |
480 | |
481 | SetZBufferAuto ( me : mutable; |
482 | AFlag : Boolean from Standard ) |
483 | is static; |
484 | ---Level: Advanced |
485 | ---Purpose: if <AFlag> is Standard_True then the zbuffer activity |
486 | -- is managed automatically. |
487 | -- Default Standard_False |
488 | ---Category: Internal methods |
59f45b7c |
489 | -- |
7fd59977 |
490 | |
491 | fields |
492 | |
493 | -- |
494 | -- Class : Visual3d_ViewManager |
495 | -- |
496 | -- Purpose : Declaration of the variables specific to visualiser |
497 | -- |
498 | -- Reminder : A visualiser manipulates a group of structures |
499 | -- and a group of views. |
500 | -- |
501 | -- the defined views |
502 | MyDefinedView : SetOfView from Visual3d; |
503 | |
504 | -- the layers |
505 | MyUnderLayer : Layer from Visual3d; |
506 | MyOverLayer : Layer from Visual3d; |
507 | |
508 | -- the view identifier generator |
509 | MyViewGenId : GenId from Aspect; |
510 | |
511 | -- the graphic driver used |
512 | MyGraphicDriver : GraphicDriver from Graphic3d; |
513 | |
514 | -- advanced |
515 | MyZBufferAuto : Boolean from Standard; |
516 | MyTransparency : Boolean from Standard; |
517 | |
59f45b7c |
518 | -- Z layer indexes |
519 | myLayerIds : MapOfInteger from TColStd; |
520 | myLayerSeq : SequenceOfInteger from TColStd; |
521 | |
7fd59977 |
522 | friends |
523 | |
524 | class View from Visual3d, |
525 | |
526 | class Layer from Visual3d |
527 | -- Create, Destroy, SetType |
528 | |
529 | end ViewManager; |