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
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.
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.
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.
21 -- 11/97 ; CAL : gestion du GraphicClear
22 -- 05/98 ; CAL : gestion du GraphicConnect et Disconnect
24 deferred class StructureManager from Graphic3d inherits TShared
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
40 Array2OfReal from TColStd,
41 SequenceOfInteger from TColStd,
44 GraphicDevice from Aspect,
45 TypeOfHighlightMethod from Aspect,
46 TypeOfUpdate from Aspect,
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
59 InitialisationError from Graphic3d
63 Initialize ( aDevice : GraphicDevice from Aspect )
65 ---Purpose: Initialises the ViewManager.
66 -- Currently creating of more than 100 viewer instances
67 -- is not supported and leads to InitializationError and
68 -- initialisation failure.
69 -- This limitation might be addressed in some future OCCT releases.
70 -- Warning: Raises InitialisationError if the initialisation
71 -- of the ViewManager failed.
72 raises InitialisationError from Graphic3d;
73 -- if the initialisation of the ViewManager failed.
75 Destroy ( me : mutable )
78 ---Purpose: Deletes the manager <me>.
81 ---------------------------------------------------
82 -- Category: Methods to modify the class definition
83 ---------------------------------------------------
85 SetPrimitivesAspect ( me : mutable;
86 CTX : AspectLine3d from Graphic3d )
89 ---Purpose: Modifies the default attributes for lines
91 ---Category: Methods to modify the class definition
93 SetPrimitivesAspect ( me : mutable;
94 CTX : AspectFillArea3d from Graphic3d)
97 ---Purpose: Modifies the default attributes for faces
99 ---Category: Methods to modify the class definition
101 SetPrimitivesAspect ( me : mutable;
102 CTX : AspectText3d from Graphic3d )
105 ---Purpose: Modifies the default attributes for text
106 -- in the visualiser.
107 ---Category: Methods to modify the class definition
109 SetPrimitivesAspect ( me : mutable;
110 CTX : AspectMarker3d from Graphic3d)
113 ---Purpose: Modifies the default attributes for markers
114 -- in the visualiser.
115 ---Category: Methods to modify the class definition
117 ---------------------------------------------------
118 -- Summary of Dynamic Operations and Update Mode --
120 -- Use SetUpdateMode to control when changes to --
121 -- the display are made. --
123 -- Use one of the following functions to update --
124 -- one or more views : --
126 -- Update all views of the viewer : --
127 -- Visual3d_ViewManager::Update () --
129 -- Update one view of the viewer --
130 -- Visual3d_View::Update () --
132 -- Use one of the following functions to update --
133 -- the entire display : --
135 -- Redraw all structures in all views : --
136 -- Visual3d_ViewManager::Redraw () --
138 -- Redraw all structures in one view : --
139 -- Visual3d_View::Redraw () --
140 ---------------------------------------------------
142 SetUpdateMode ( me : mutable;
143 AType : TypeOfUpdate from Aspect )
146 ---Purpose: Modifies the screen update mode.
148 -- TOU_ASAP as soon as possible
149 -- TOU_WAIT on demand (with the Update function)
150 -- Note : Dynamic Operations and Update Mode
151 -- Use SetUpdateMode to control when changes to
152 -- the display are made. Use one of the following
153 -- functions to update one or more views:
154 -- - Update all views of the viewer: Visual3d_ViewManager::Update ()
155 -- - Update one view of the viewer: Visual3d_View::Update () Use one of
156 -- the following functions to update the entire display:
157 -- - Redraw all structures in all views: Visual3d_ViewManager::Redraw ()
158 -- - Redraw all structures in one view: Visual3d_View::Redraw () Update)
162 ---Purpose: Updates screen in function of modifications of
164 -- Warning: Not necessary if the update mode is TOU_ASAP.
166 ---------------------------------------------
167 -- Category: Inquire methods, MapOfStructure
168 ---------------------------------------------
170 DisplayedStructures ( me; SG: in out MapOfStructure from Graphic3d)
173 ---Purpose: Returns the set of structures displayed in
175 ---Category: Inquire methods, MapOfStructure
177 NumberOfDisplayedStructures ( me )
178 returns Integer from Standard
181 ---Purpose: Returns the number of structures displayed in
184 --DisplayedStructure ( me;
185 -- AnIndex : Integer from Standard )
186 --returns Structure from Graphic3d
187 --is static protected;
189 ---Purpose: Returns the structure displayed in visualiser <me>.
191 HighlightedStructures ( me; SG: in out MapOfStructure from Graphic3d )
194 ---Purpose: Returns the set of highlighted structures
195 -- in a visualiser <me>.
196 ---Category: Inquire methods, MapOfStructure
198 PickStructures ( me; SG: in out MapOfStructure from Graphic3d )
201 ---Purpose: Returns the set of detectable structures
202 -- in a visualiser <me>.
203 ---Category: Inquire methods, MapOfStructure
205 VisibleStructures ( me; SG: in out MapOfStructure from Graphic3d )
208 ---Purpose: Returns the set of visible structures
209 -- in a visualiser <me>.
210 ---Category: Inquire methods, MapOfStructure
212 ----------------------------
213 -- Category: Inquire methods
214 ----------------------------
216 FillArea3dAspect ( me )
217 returns AspectFillArea3d from Graphic3d
220 ---Purpose: Returns the values of the current default attributes.
221 ---Category: Inquire methods
224 returns Integer from Standard;
226 ---Purpose: Returns maximum number of managers defineable.
227 ---Category: Inquire methods
230 returns AspectLine3d from Graphic3d
233 ---Purpose: Returns the values of the current default attributes.
234 ---Category: Inquire methods
236 Marker3dAspect ( me )
237 returns AspectMarker3d from Graphic3d
240 ---Purpose: Returns the values of the current default attributes.
241 ---Category: Inquire methods
244 XMin, YMin, ZMin : out Real from Standard;
245 XMax, YMax, ZMax : out Real from Standard )
248 ---Purpose: Returns the coordinates of the boundary box of all
249 -- structures displayed in the manager <me>.
250 ---Category: Inquire methods
252 PrimitivesAspect ( me;
253 CTXL : out AspectLine3d from Graphic3d;
254 CTXT : out AspectText3d from Graphic3d;
255 CTXM : out AspectMarker3d from Graphic3d;
256 CTXF : out AspectFillArea3d from Graphic3d )
259 ---Purpose: Returns the values of the current default attributes.
260 ---Category: Inquire methods
263 returns AspectText3d from Graphic3d
266 ---Purpose: Returns the values of the current default attributes.
267 ---Category: Inquire methods
270 returns TypeOfUpdate from Aspect
273 ---Purpose: Returns the screen update mode.
275 -- TOU_ASAP as soon as possible
276 -- TOU_WAIT on demand (Update)
278 ---Category: Inquire methods
280 ----------------------------
281 -- Category: Private methods
282 ----------------------------
284 ChangeDisplayPriority ( me : mutable;
285 AStructure : Structure from Graphic3d;
286 OldPriority : Integer from Standard;
287 NewPriority : Integer from Standard )
290 ---Purpose: Changes the display priority of the structure <AStructure>.
291 ---Category: Private methods
293 ChangeZLayer ( me : mutable;
294 theStructure : Structure from Graphic3d;
295 theLayerId : Integer from Standard )
297 ---Purpose: Change Z layer for structure. The z layer mechanism allows
298 -- to display structures in higher layers in overlay of structures in
302 theStructure : Structure from Graphic3d )
303 returns Integer from Standard is deferred;
304 ---Purpose: Get Z layer ID assigned to structure. If the structure
305 -- has no layer ID (deleted from graphic driver), the method returns -1.
307 AddZLayer ( me : mutable;
308 theLayerId : in out Integer from Standard )
309 returns Boolean from Standard is deferred;
310 ---Purpose: Add a new top-level Z layer and get its ID as
311 -- <theLayerId> value. The method returns Standard_False if the layer
312 -- can not be created. The z layer mechanism allows to display
313 -- structures in higher layers in overlay of structures in lower layers.
315 RemoveZLayer ( me : mutable;
316 theLayerId : Integer from Standard )
317 returns Boolean from Standard is deferred;
318 ---Purpose: Remove Z layer with ID <theLayerId>. Method returns
319 -- Standard_False if the layer can not be removed or doesn't exists.
320 -- By default, there is always a default bottom-level layer that can't
324 theLayerSeq : out SequenceOfInteger from TColStd )
326 ---Purpose: Return all Z layer ids in sequence ordered by level
327 -- from lowest layer to highest. The first layer ID in sequence is
328 -- the default layer that can't be removed.
330 CurrentId ( myclass )
331 returns Integer from Standard;
333 ---Purpose: Returns a current identifier available.
334 ---Category: Private methods
336 ReCompute ( me : mutable;
337 AStructure : Structure from Graphic3d )
340 ---Purpose: Forces a new construction of the structure <AStructure>
341 -- if <AStructure> is displayed and TOS_COMPUTED.
342 ---Category: Private methods
344 ReCompute ( me : mutable;
345 AStructure : Structure from Graphic3d;
346 AProjector : DataStructureManager from Graphic3d )
349 ---Purpose: Forces a new construction of the structure <AStructure>
350 -- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
351 ---Category: Private methods
353 Detectable ( me : mutable;
354 AStructure : Structure from Graphic3d )
357 ---Purpose: Sets detectable the structure <AStructure>.
358 ---Category: Private methods
360 Clear ( me : mutable;
361 AStructure : Structure from Graphic3d;
362 WithDestruction : Boolean from Standard )
365 ---Purpose: Clears the structure <AStructure>.
366 ---Category: Private methods
368 Connect ( me : mutable;
369 AMother : Structure from Graphic3d;
370 ADaughter : Structure from Graphic3d )
373 ---Purpose: Connects the structures <AMother> and <ADaughter>.
374 ---Category: Private methods
376 Disconnect ( me : mutable;
377 AMother : Structure from Graphic3d;
378 ADaughter : Structure from Graphic3d )
381 ---Purpose: Disconnects the structures <AMother> and <ADaughter>.
382 ---Category: Private methods
384 Display ( me : mutable;
385 AStructure : Structure from Graphic3d )
388 ---Purpose: Display the structure <AStructure>.
389 ---Category: Private methods
391 Erase ( me : mutable;
392 AStructure : Structure from Graphic3d )
395 ---Purpose: Erases the structure <AStructure>.
396 ---Category: Private methods
398 Highlight ( me : mutable;
399 AStructure : Structure from Graphic3d;
400 AMethod : TypeOfHighlightMethod from Aspect )
403 ---Purpose: Highlights the structure <AStructure>.
404 ---Category: Private methods
406 SetTransform ( me : mutable;
407 AStructure : Structure from Graphic3d;
408 ATrsf : Array2OfReal from TColStd )
411 ---Purpose: Transforms the structure <AStructure>.
412 ---Category: Private methods
415 returns GraphicDevice from Aspect;
417 ---Purpose: Returns the graphic device of <me>.
418 ---Category: Private methods
420 Invisible ( me : mutable;
421 AStructure : Structure from Graphic3d )
424 ---Purpose: Sets invisible the structure <AStructure>.
425 ---Category: Private methods
427 Identification ( me )
428 returns Integer from Standard
431 ---Purpose: Returns the identification number of the manager.
432 ---Category: Private methods
435 AId : Integer from Standard )
436 returns Structure from Graphic3d
439 ---Purpose: Returns the structure with the identification number <AId>.
440 ---Warning: Returns a null structure if the identification number
441 -- is not a structure identifier.
442 ---Category: Private methods
444 NewIdentification ( me : mutable )
445 returns Integer from Standard
448 ---Purpose: Returns a new identification number for a new structure
450 ---Category: Private methods
452 Remove ( me : mutable;
453 AnId : Integer from Standard )
456 ---Purpose: Frees the identifieur <AnId>.
457 ---Category: Private methods
459 Undetectable ( me : mutable;
460 AStructure : Structure from Graphic3d )
463 ---Purpose: Sets no detectable the structure <AStructure>.
464 ---Category: Private methods
466 UnHighlight ( me : mutable )
469 ---Purpose: Suppresses the highlighting on all the structures in <me>.
470 ---Category: Private methods
472 UnHighlight ( me : mutable;
473 AStructure : Structure from Graphic3d )
476 ---Purpose: Suppress the highlighting on the structure <AStructure>.
477 ---Category: Private methods
479 Visible ( me : mutable;
480 AStructure : Structure from Graphic3d )
483 ---Purpose: Sets visible the structure <AStructure>.
485 ---Category: Private methods
491 -- Class : Graphic3d_StructureManager
493 -- Purpose : Declaration of variables specific to managers
495 -- Reminder : A manager manipulates a group of structures
497 -- the identifier of the manager
498 MyId : Integer from Standard is protected;
500 -- the update display mode
501 MyUpdateMode : TypeOfUpdate from Aspect is protected;
503 -- the different contexts for primitives
504 MyAspectLine3d : AspectLine3d from Graphic3d
506 MyAspectText3d : AspectText3d from Graphic3d
508 MyAspectMarker3d : AspectMarker3d from Graphic3d
510 MyAspectFillArea3d : AspectFillArea3d from Graphic3d
513 -- the displayed structures
514 MyDisplayedStructure : MapOfStructure from Graphic3d
517 -- the highlighted structures
518 MyHighlightedStructure : MapOfStructure from Graphic3d
521 -- the visible structures
522 MyVisibleStructure : MapOfStructure from Graphic3d
525 -- the pickable structures
526 MyPickStructure : MapOfStructure from Graphic3d
529 -- the structure identifier generator
530 MyStructGenId : GenId from Aspect is protected;
533 MyGraphicDevice : GraphicDevice from Aspect is protected;
537 class Structure from Graphic3d
539 end StructureManager;