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 | -- 11/97 ; CAL : gestion du GraphicClear |
22 | -- 05/98 ; CAL : gestion du GraphicConnect et Disconnect |
7fd59977 |
23 | |
24 | deferred class StructureManager from Graphic3d inherits TShared |
25 | |
26 | ---Version: |
27 | |
28 | ---Purpose: This class allows the definition of a manager to |
29 | -- which the graphic objects are associated. |
30 | -- It allows them to be globally manipulated. |
31 | -- It defines the global attributes. |
32 | -- Keywords: Structure, Structure Manager, Update Mode, |
33 | -- Destroy, Highlight, Visible, Detectable |
34 | |
35 | ---Warning: |
36 | ---References: |
37 | |
38 | uses |
39 | |
40 | Array2OfReal from TColStd, |
59f45b7c |
41 | SequenceOfInteger from TColStd, |
7fd59977 |
42 | |
43 | GenId from Aspect, |
44 | GraphicDevice from Aspect, |
45 | TypeOfHighlightMethod from Aspect, |
46 | TypeOfUpdate from Aspect, |
47 | |
48 | DataStructureManager from Graphic3d, |
49 | AspectFillArea3d from Graphic3d, |
50 | AspectLine3d from Graphic3d, |
51 | AspectMarker3d from Graphic3d, |
52 | AspectText3d from Graphic3d, |
53 | Structure from Graphic3d, |
54 | MapOfStructure from Graphic3d, |
55 | SequenceOfStructure from Graphic3d |
56 | |
57 | raises |
58 | |
59 | InitialisationError from Graphic3d |
60 | |
61 | is |
62 | |
63 | Initialize ( aDevice : GraphicDevice from Aspect ) |
64 | ---Level: Public |
65 | ---Purpose: Initialise the constructor of the ViewManager. |
66 | -- Warning: Raises InitialisationError if the initialisation |
67 | -- of the ViewManager failed. |
68 | raises InitialisationError from Graphic3d; |
69 | -- if the initialisation of the ViewManager failed. |
70 | |
71 | Destroy ( me : mutable ) |
72 | is virtual; |
73 | ---Level: Public |
74 | ---Purpose: Deletes the manager <me>. |
75 | ---C++: alias ~ |
76 | |
77 | --------------------------------------------------- |
78 | -- Category: Methods to modify the class definition |
79 | --------------------------------------------------- |
80 | |
81 | SetPrimitivesAspect ( me : mutable; |
82 | CTX : AspectLine3d from Graphic3d ) |
83 | is static; |
84 | ---Level: Public |
85 | ---Purpose: Modifies the default attributes for lines |
86 | -- in the visualiser. |
87 | ---Category: Methods to modify the class definition |
88 | |
89 | SetPrimitivesAspect ( me : mutable; |
90 | CTX : AspectFillArea3d from Graphic3d) |
91 | is static; |
92 | ---Level: Public |
93 | ---Purpose: Modifies the default attributes for faces |
94 | -- in the visualiser. |
95 | ---Category: Methods to modify the class definition |
96 | |
97 | SetPrimitivesAspect ( me : mutable; |
98 | CTX : AspectText3d from Graphic3d ) |
99 | is static; |
100 | ---Level: Public |
101 | ---Purpose: Modifies the default attributes for text |
102 | -- in the visualiser. |
103 | ---Category: Methods to modify the class definition |
104 | |
105 | SetPrimitivesAspect ( me : mutable; |
106 | CTX : AspectMarker3d from Graphic3d) |
107 | is static; |
108 | ---Level: Public |
109 | ---Purpose: Modifies the default attributes for markers |
110 | -- in the visualiser. |
111 | ---Category: Methods to modify the class definition |
112 | |
113 | --------------------------------------------------- |
114 | -- Summary of Dynamic Operations and Update Mode -- |
115 | -- -- |
116 | -- Use SetUpdateMode to control when changes to -- |
117 | -- the display are made. -- |
118 | -- -- |
119 | -- Use one of the following functions to update -- |
120 | -- one or more views : -- |
121 | -- -- |
122 | -- Update all views of the viewer : -- |
123 | -- Visual3d_ViewManager::Update () -- |
124 | -- -- |
125 | -- Update one view of the viewer -- |
126 | -- Visual3d_View::Update () -- |
127 | -- -- |
128 | -- Use one of the following functions to update -- |
129 | -- the entire display : -- |
130 | -- -- |
131 | -- Redraw all structures in all views : -- |
132 | -- Visual3d_ViewManager::Redraw () -- |
133 | -- -- |
134 | -- Redraw all structures in one view : -- |
135 | -- Visual3d_View::Redraw () -- |
136 | --------------------------------------------------- |
137 | |
138 | SetUpdateMode ( me : mutable; |
139 | AType : TypeOfUpdate from Aspect ) |
140 | is static; |
141 | ---Level: Public |
142 | ---Purpose: Modifies the screen update mode. |
143 | -- |
144 | -- TOU_ASAP as soon as possible |
145 | -- TOU_WAIT on demand (with the Update function) |
146 | -- Note : Dynamic Operations and Update Mode |
147 | -- Use SetUpdateMode to control when changes to |
148 | -- the display are made. Use one of the following |
149 | -- functions to update one or more views: |
150 | -- - Update all views of the viewer: Visual3d_ViewManager::Update () |
151 | -- - Update one view of the viewer: Visual3d_View::Update () Use one of |
152 | -- the following functions to update the entire display: |
153 | -- - Redraw all structures in all views: Visual3d_ViewManager::Redraw () |
154 | -- - Redraw all structures in one view: Visual3d_View::Redraw () Update) |
155 | |
156 | Update ( me ) |
157 | is deferred; |
158 | ---Purpose: Updates screen in function of modifications of |
159 | -- the structures. |
160 | -- Warning: Not necessary if the update mode is TOU_ASAP. |
161 | |
162 | --------------------------------------------- |
163 | -- Category: Inquire methods, MapOfStructure |
164 | --------------------------------------------- |
165 | |
166 | DisplayedStructures ( me; SG: in out MapOfStructure from Graphic3d) |
167 | is static; |
168 | ---Level: Internal |
169 | ---Purpose: Returns the set of structures displayed in |
170 | -- visualiser <me>. |
171 | ---Category: Inquire methods, MapOfStructure |
172 | |
173 | NumberOfDisplayedStructures ( me ) |
174 | returns Integer from Standard |
175 | is static protected; |
176 | ---Level: Internal |
177 | ---Purpose: Returns the number of structures displayed in |
178 | -- visualiser <me>. |
179 | |
180 | --DisplayedStructure ( me; |
181 | -- AnIndex : Integer from Standard ) |
182 | --returns Structure from Graphic3d |
183 | --is static protected; |
184 | ---Level: Internal |
185 | ---Purpose: Returns the structure displayed in visualiser <me>. |
186 | |
187 | HighlightedStructures ( me; SG: in out MapOfStructure from Graphic3d ) |
188 | is static; |
189 | ---Level: Internal |
190 | ---Purpose: Returns the set of highlighted structures |
191 | -- in a visualiser <me>. |
192 | ---Category: Inquire methods, MapOfStructure |
193 | |
194 | PickStructures ( me; SG: in out MapOfStructure from Graphic3d ) |
195 | is static; |
196 | ---Level: Internal |
197 | ---Purpose: Returns the set of detectable structures |
198 | -- in a visualiser <me>. |
199 | ---Category: Inquire methods, MapOfStructure |
200 | |
201 | VisibleStructures ( me; SG: in out MapOfStructure from Graphic3d ) |
202 | is static; |
203 | ---Level: Internal |
204 | ---Purpose: Returns the set of visible structures |
205 | -- in a visualiser <me>. |
206 | ---Category: Inquire methods, MapOfStructure |
207 | |
208 | ---------------------------- |
209 | -- Category: Inquire methods |
210 | ---------------------------- |
211 | |
212 | FillArea3dAspect ( me ) |
213 | returns AspectFillArea3d from Graphic3d |
214 | is static; |
215 | ---Level: Public |
216 | ---Purpose: Returns the values of the current default attributes. |
217 | ---Category: Inquire methods |
218 | |
219 | Limit ( myclass ) |
220 | returns Integer from Standard; |
221 | ---Level: Internal |
222 | ---Purpose: Returns maximum number of managers defineable. |
223 | ---Category: Inquire methods |
224 | |
225 | Line3dAspect ( me ) |
226 | returns AspectLine3d from Graphic3d |
227 | is static; |
228 | ---Level: Public |
229 | ---Purpose: Returns the values of the current default attributes. |
230 | ---Category: Inquire methods |
231 | |
232 | Marker3dAspect ( me ) |
233 | returns AspectMarker3d from Graphic3d |
234 | is static; |
235 | ---Level: Public |
236 | ---Purpose: Returns the values of the current default attributes. |
237 | ---Category: Inquire methods |
238 | |
239 | MinMaxValues ( me; |
240 | XMin, YMin, ZMin : out Real from Standard; |
241 | XMax, YMax, ZMax : out Real from Standard ) |
242 | is static; |
243 | ---Level: Public |
244 | ---Purpose: Returns the coordinates of the boundary box of all |
245 | -- structures displayed in the manager <me>. |
246 | ---Category: Inquire methods |
247 | |
248 | PrimitivesAspect ( me; |
249 | CTXL : out AspectLine3d from Graphic3d; |
250 | CTXT : out AspectText3d from Graphic3d; |
251 | CTXM : out AspectMarker3d from Graphic3d; |
252 | CTXF : out AspectFillArea3d from Graphic3d ) |
253 | is static; |
254 | ---Level: Public |
255 | ---Purpose: Returns the values of the current default attributes. |
256 | ---Category: Inquire methods |
257 | |
258 | Text3dAspect ( me ) |
259 | returns AspectText3d from Graphic3d |
260 | is static; |
261 | ---Level: Public |
262 | ---Purpose: Returns the values of the current default attributes. |
263 | ---Category: Inquire methods |
264 | |
265 | UpdateMode ( me ) |
266 | returns TypeOfUpdate from Aspect |
267 | is static; |
268 | ---Level: Public |
269 | ---Purpose: Returns the screen update mode. |
270 | -- |
271 | -- TOU_ASAP as soon as possible |
272 | -- TOU_WAIT on demand (Update) |
273 | -- |
274 | ---Category: Inquire methods |
275 | |
276 | ---------------------------- |
277 | -- Category: Private methods |
278 | ---------------------------- |
279 | |
280 | ChangeDisplayPriority ( me : mutable; |
281 | AStructure : Structure from Graphic3d; |
282 | OldPriority : Integer from Standard; |
283 | NewPriority : Integer from Standard ) |
284 | is deferred; |
285 | ---Level: Internal |
286 | ---Purpose: Changes the display priority of the structure <AStructure>. |
287 | ---Category: Private methods |
288 | |
59f45b7c |
289 | ChangeZLayer ( me : mutable; |
290 | theStructure : Structure from Graphic3d; |
291 | theLayerId : Integer from Standard ) |
292 | is deferred; |
293 | ---Purpose: Change Z layer for structure. The z layer mechanism allows |
294 | -- to display structures in higher layers in overlay of structures in |
295 | -- lower layers. |
296 | |
297 | GetZLayer ( me; |
298 | theStructure : Structure from Graphic3d ) |
299 | returns Integer from Standard is deferred; |
300 | ---Purpose: Get Z layer ID assigned to structure. If the structure |
301 | -- has no layer ID (deleted from graphic driver), the method returns -1. |
302 | |
303 | AddZLayer ( me : mutable; |
304 | theLayerId : in out Integer from Standard ) |
305 | returns Boolean from Standard is deferred; |
306 | ---Purpose: Add a new top-level Z layer and get its ID as |
307 | -- <theLayerId> value. The method returns Standard_False if the layer |
308 | -- can not be created. The z layer mechanism allows to display |
309 | -- structures in higher layers in overlay of structures in lower layers. |
310 | |
311 | RemoveZLayer ( me : mutable; |
312 | theLayerId : Integer from Standard ) |
313 | returns Boolean from Standard is deferred; |
314 | ---Purpose: Remove Z layer with ID <theLayerId>. Method returns |
315 | -- Standard_False if the layer can not be removed or doesn't exists. |
316 | -- By default, there is always a default bottom-level layer that can't |
317 | -- be removed. |
318 | |
319 | GetAllZLayers ( me; |
320 | theLayerSeq : out SequenceOfInteger from TColStd ) |
321 | is deferred; |
322 | ---Purpose: Return all Z layer ids in sequence ordered by level |
323 | -- from lowest layer to highest. The first layer ID in sequence is |
324 | -- the default layer that can't be removed. |
325 | |
7fd59977 |
326 | CurrentId ( myclass ) |
327 | returns Integer from Standard; |
328 | ---Level: Internal |
329 | ---Purpose: Returns a current identifier available. |
330 | ---Category: Private methods |
331 | |
332 | ReCompute ( me : mutable; |
333 | AStructure : Structure from Graphic3d ) |
334 | is deferred; |
335 | ---Level: Advanced |
336 | ---Purpose: Forces a new construction of the structure <AStructure> |
337 | -- if <AStructure> is displayed and TOS_COMPUTED. |
338 | ---Category: Private methods |
339 | |
340 | ReCompute ( me : mutable; |
341 | AStructure : Structure from Graphic3d; |
342 | AProjector : DataStructureManager from Graphic3d ) |
343 | is deferred; |
344 | ---Level: Advanced |
345 | ---Purpose: Forces a new construction of the structure <AStructure> |
346 | -- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED. |
347 | ---Category: Private methods |
348 | |
349 | Detectable ( me : mutable; |
350 | AStructure : Structure from Graphic3d ) |
351 | is static private; |
352 | ---Level: Internal |
353 | ---Purpose: Sets detectable the structure <AStructure>. |
354 | ---Category: Private methods |
355 | |
356 | Clear ( me : mutable; |
357 | AStructure : Structure from Graphic3d; |
358 | WithDestruction : Boolean from Standard ) |
359 | is deferred; |
360 | ---Level: Internal |
361 | ---Purpose: Clears the structure <AStructure>. |
362 | ---Category: Private methods |
363 | |
364 | Connect ( me : mutable; |
365 | AMother : Structure from Graphic3d; |
366 | ADaughter : Structure from Graphic3d ) |
367 | is deferred; |
368 | ---Level: Internal |
369 | ---Purpose: Connects the structures <AMother> and <ADaughter>. |
370 | ---Category: Private methods |
371 | |
372 | Disconnect ( me : mutable; |
373 | AMother : Structure from Graphic3d; |
374 | ADaughter : Structure from Graphic3d ) |
375 | is deferred; |
376 | ---Level: Internal |
377 | ---Purpose: Disconnects the structures <AMother> and <ADaughter>. |
378 | ---Category: Private methods |
379 | |
380 | Display ( me : mutable; |
381 | AStructure : Structure from Graphic3d ) |
382 | is deferred; |
383 | ---Level: Internal |
384 | ---Purpose: Display the structure <AStructure>. |
385 | ---Category: Private methods |
386 | |
387 | Erase ( me : mutable; |
388 | AStructure : Structure from Graphic3d ) |
389 | is deferred; |
390 | ---Level: Internal |
391 | ---Purpose: Erases the structure <AStructure>. |
392 | ---Category: Private methods |
393 | |
394 | Highlight ( me : mutable; |
395 | AStructure : Structure from Graphic3d; |
396 | AMethod : TypeOfHighlightMethod from Aspect ) |
397 | is deferred; |
398 | ---Level: Internal |
399 | ---Purpose: Highlights the structure <AStructure>. |
400 | ---Category: Private methods |
401 | |
402 | SetTransform ( me : mutable; |
403 | AStructure : Structure from Graphic3d; |
404 | ATrsf : Array2OfReal from TColStd ) |
405 | is deferred; |
406 | ---Level: Internal |
407 | ---Purpose: Transforms the structure <AStructure>. |
408 | ---Category: Private methods |
409 | |
410 | GraphicDevice ( me ) |
411 | returns GraphicDevice from Aspect; |
412 | ---Level: Internal |
413 | ---Purpose: Returns the graphic device of <me>. |
414 | ---Category: Private methods |
415 | |
416 | Invisible ( me : mutable; |
417 | AStructure : Structure from Graphic3d ) |
418 | is static private; |
419 | ---Level: Internal |
420 | ---Purpose: Sets invisible the structure <AStructure>. |
421 | ---Category: Private methods |
422 | |
423 | Identification ( me ) |
424 | returns Integer from Standard |
425 | is virtual; |
426 | ---Level: Internal |
427 | ---Purpose: Returns the identification number of the manager. |
428 | ---Category: Private methods |
429 | |
430 | Identification ( me; |
431 | AId : Integer from Standard ) |
432 | returns Structure from Graphic3d |
433 | is virtual; |
434 | ---Level: Internal |
435 | ---Purpose: Returns the structure with the identification number <AId>. |
436 | ---Warning: Returns a null structure if the identification number |
437 | -- is not a structure identifier. |
438 | ---Category: Private methods |
439 | |
440 | NewIdentification ( me : mutable ) |
441 | returns Integer from Standard |
442 | is static private; |
443 | ---Level: Internal |
444 | ---Purpose: Returns a new identification number for a new structure |
445 | -- in the manager. |
446 | ---Category: Private methods |
447 | |
448 | Remove ( me : mutable; |
449 | AnId : Integer from Standard ) |
450 | is static private; |
451 | ---Level: Internal |
452 | ---Purpose: Frees the identifieur <AnId>. |
453 | ---Category: Private methods |
454 | |
455 | Undetectable ( me : mutable; |
456 | AStructure : Structure from Graphic3d ) |
457 | is static private; |
458 | ---Level: Internal |
459 | ---Purpose: Sets no detectable the structure <AStructure>. |
460 | ---Category: Private methods |
461 | |
462 | UnHighlight ( me : mutable ) |
463 | is deferred; |
464 | ---Level: Internal |
465 | ---Purpose: Suppresses the highlighting on all the structures in <me>. |
466 | ---Category: Private methods |
467 | |
468 | UnHighlight ( me : mutable; |
469 | AStructure : Structure from Graphic3d ) |
470 | is deferred; |
471 | ---Level: Internal |
472 | ---Purpose: Suppress the highlighting on the structure <AStructure>. |
473 | ---Category: Private methods |
474 | |
475 | Visible ( me : mutable; |
476 | AStructure : Structure from Graphic3d ) |
477 | is static private; |
478 | ---Level: Internal |
479 | ---Purpose: Sets visible the structure <AStructure>. |
480 | -- in the manager. |
481 | ---Category: Private methods |
482 | --\f |
483 | |
484 | fields |
485 | |
486 | -- |
487 | -- Class : Graphic3d_StructureManager |
488 | -- |
489 | -- Purpose : Declaration of variables specific to managers |
490 | -- |
491 | -- Reminder : A manager manipulates a group of structures |
492 | |
493 | -- the identifier of the manager |
494 | MyId : Integer from Standard is protected; |
495 | |
496 | -- the update display mode |
497 | MyUpdateMode : TypeOfUpdate from Aspect is protected; |
498 | |
499 | -- the different contexts for primitives |
500 | MyAspectLine3d : AspectLine3d from Graphic3d |
501 | is protected; |
502 | MyAspectText3d : AspectText3d from Graphic3d |
503 | is protected; |
504 | MyAspectMarker3d : AspectMarker3d from Graphic3d |
505 | is protected; |
506 | MyAspectFillArea3d : AspectFillArea3d from Graphic3d |
507 | is protected; |
508 | |
509 | -- the displayed structures |
510 | MyDisplayedStructure : MapOfStructure from Graphic3d |
511 | is protected; |
512 | |
513 | -- the highlighted structures |
514 | MyHighlightedStructure : MapOfStructure from Graphic3d |
515 | is protected; |
516 | |
517 | -- the visible structures |
518 | MyVisibleStructure : MapOfStructure from Graphic3d |
519 | is protected; |
520 | |
521 | -- the pickable structures |
522 | MyPickStructure : MapOfStructure from Graphic3d |
523 | is protected; |
524 | |
525 | -- the structure identifier generator |
526 | MyStructGenId : GenId from Aspect is protected; |
527 | |
528 | |
529 | MyGraphicDevice : GraphicDevice from Aspect is protected; |
530 | |
531 | friends |
532 | |
533 | class Structure from Graphic3d |
534 | |
535 | end StructureManager; |