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 TypeOfHighlightMethod from Aspect,
45 TypeOfUpdate from Aspect,
47 DataStructureManager from Graphic3d,
48 AspectFillArea3d from Graphic3d,
49 AspectLine3d from Graphic3d,
50 AspectMarker3d from Graphic3d,
51 AspectText3d from Graphic3d,
52 Structure from Graphic3d,
53 MapOfStructure from Graphic3d,
54 SequenceOfStructure from Graphic3d,
55 GraphicDriver from Graphic3d
59 InitialisationError from Graphic3d
63 Initialize ( theDriver: GraphicDriver from Graphic3d )
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 ----------------------------
206 -- Category: Inquire methods
207 ----------------------------
209 FillArea3dAspect ( me )
210 returns AspectFillArea3d from Graphic3d
213 ---Purpose: Returns the values of the current default attributes.
214 ---Category: Inquire methods
217 returns Integer from Standard;
219 ---Purpose: Returns maximum number of managers defineable.
220 ---Category: Inquire methods
223 returns AspectLine3d from Graphic3d
226 ---Purpose: Returns the values of the current default attributes.
227 ---Category: Inquire methods
229 Marker3dAspect ( me )
230 returns AspectMarker3d from Graphic3d
233 ---Purpose: Returns the values of the current default attributes.
234 ---Category: Inquire methods
237 XMin, YMin, ZMin : out Real from Standard;
238 XMax, YMax, ZMax : out Real from Standard )
241 ---Purpose: Returns the coordinates of the boundary box of all
242 -- structures displayed in the manager <me>.
243 ---Category: Inquire methods
245 PrimitivesAspect ( me;
246 CTXL : out AspectLine3d from Graphic3d;
247 CTXT : out AspectText3d from Graphic3d;
248 CTXM : out AspectMarker3d from Graphic3d;
249 CTXF : out AspectFillArea3d from Graphic3d )
252 ---Purpose: Returns the values of the current default attributes.
253 ---Category: Inquire methods
256 returns AspectText3d from Graphic3d
259 ---Purpose: Returns the values of the current default attributes.
260 ---Category: Inquire methods
263 returns TypeOfUpdate from Aspect
266 ---Purpose: Returns the screen update mode.
268 -- TOU_ASAP as soon as possible
269 -- TOU_WAIT on demand (Update)
271 ---Category: Inquire methods
273 ----------------------------
274 -- Category: Private methods
275 ----------------------------
277 ChangeDisplayPriority ( me : mutable;
278 AStructure : Structure from Graphic3d;
279 OldPriority : Integer from Standard;
280 NewPriority : Integer from Standard )
283 ---Purpose: Changes the display priority of the structure <AStructure>.
284 ---Category: Private methods
286 ChangeZLayer ( me : mutable;
287 theStructure : Structure from Graphic3d;
288 theLayerId : Integer from Standard )
290 ---Purpose: Change Z layer for structure. The z layer mechanism allows
291 -- to display structures in higher layers in overlay of structures in
295 theStructure : Structure from Graphic3d )
296 returns Integer from Standard is deferred;
297 ---Purpose: Get Z layer ID assigned to structure. If the structure
298 -- has no layer ID (deleted from graphic driver), the method returns -1.
300 AddZLayer ( me : mutable;
301 theLayerId : in out Integer from Standard )
302 returns Boolean from Standard is deferred;
303 ---Purpose: Add a new top-level Z layer and get its ID as
304 -- <theLayerId> value. The method returns Standard_False if the layer
305 -- can not be created. The z layer mechanism allows to display
306 -- structures in higher layers in overlay of structures in lower layers.
308 RemoveZLayer ( me : mutable;
309 theLayerId : Integer from Standard )
310 returns Boolean from Standard is deferred;
311 ---Purpose: Remove Z layer with ID <theLayerId>. Method returns
312 -- Standard_False if the layer can not be removed or doesn't exists.
313 -- By default, there is always a default bottom-level layer that can't
317 theLayerSeq : out SequenceOfInteger from TColStd )
319 ---Purpose: Return all Z layer ids in sequence ordered by level
320 -- from lowest layer to highest. The first layer ID in sequence is
321 -- the default layer that can't be removed.
323 CurrentId ( myclass )
324 returns Integer from Standard;
326 ---Purpose: Returns a current identifier available.
327 ---Category: Private methods
329 ReCompute ( me : mutable;
330 AStructure : Structure from Graphic3d )
333 ---Purpose: Forces a new construction of the structure <AStructure>
334 -- if <AStructure> is displayed and TOS_COMPUTED.
335 ---Category: Private methods
337 ReCompute ( me : mutable;
338 AStructure : Structure from Graphic3d;
339 AProjector : DataStructureManager from Graphic3d )
342 ---Purpose: Forces a new construction of the structure <AStructure>
343 -- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
344 ---Category: Private methods
346 Detectable ( me : mutable;
347 AStructure : Structure from Graphic3d )
350 ---Purpose: Sets detectable the structure <AStructure>.
351 ---Category: Private methods
353 Clear ( me : mutable;
354 AStructure : Structure from Graphic3d;
355 WithDestruction : Boolean from Standard )
358 ---Purpose: Clears the structure <AStructure>.
359 ---Category: Private methods
361 Connect ( me : mutable;
362 AMother : Structure from Graphic3d;
363 ADaughter : Structure from Graphic3d )
366 ---Purpose: Connects the structures <AMother> and <ADaughter>.
367 ---Category: Private methods
369 Disconnect ( me : mutable;
370 AMother : Structure from Graphic3d;
371 ADaughter : Structure from Graphic3d )
374 ---Purpose: Disconnects the structures <AMother> and <ADaughter>.
375 ---Category: Private methods
377 Display ( me : mutable;
378 AStructure : Structure from Graphic3d )
381 ---Purpose: Display the structure <AStructure>.
382 ---Category: Private methods
384 Erase ( me : mutable;
385 AStructure : Structure from Graphic3d )
388 ---Purpose: Erases the structure <AStructure>.
389 ---Category: Private methods
391 Highlight ( me : mutable;
392 AStructure : Structure from Graphic3d;
393 AMethod : TypeOfHighlightMethod from Aspect )
396 ---Purpose: Highlights the structure <AStructure>.
397 ---Category: Private methods
399 SetTransform ( me : mutable;
400 AStructure : Structure from Graphic3d;
401 ATrsf : Array2OfReal from TColStd )
404 ---Purpose: Transforms the structure <AStructure>.
405 ---Category: Private methods
408 returns GraphicDriver from Graphic3d;
410 ---Purpose: Returns the graphic driver of <me>.
411 ---Category: Private methods
412 ---C++: return const &
414 Identification ( me )
415 returns Integer from Standard
418 ---Purpose: Returns the identification number of the manager.
419 ---Category: Private methods
422 AId : Integer from Standard )
423 returns Structure from Graphic3d
426 ---Purpose: Returns the structure with the identification number <AId>.
427 ---Warning: Returns a null structure if the identification number
428 -- is not a structure identifier.
429 ---Category: Private methods
431 NewIdentification ( me : mutable )
432 returns Integer from Standard
435 ---Purpose: Returns a new identification number for a new structure
437 ---Category: Private methods
439 Remove ( me : mutable;
440 AnId : Integer from Standard )
443 ---Purpose: Frees the identifieur <AnId>.
444 ---Category: Private methods
446 Undetectable ( me : mutable;
447 AStructure : Structure from Graphic3d )
450 ---Purpose: Sets no detectable the structure <AStructure>.
451 ---Category: Private methods
453 UnHighlight ( me : mutable )
456 ---Purpose: Suppresses the highlighting on all the structures in <me>.
457 ---Category: Private methods
459 UnHighlight ( me : mutable;
460 AStructure : Structure from Graphic3d )
463 ---Purpose: Suppress the highlighting on the structure <AStructure>.
464 ---Category: Private methods
466 ReComputeStructures (me: mutable);
467 -- Purpose: Recomputes all displayed structures. Used to recompute GL
468 -- resources after the last view has been closed without removing objects.
475 -- Class : Graphic3d_StructureManager
477 -- Purpose : Declaration of variables specific to managers
479 -- Reminder : A manager manipulates a group of structures
481 -- the identifier of the manager
482 MyId : Integer from Standard is protected;
484 -- the update display mode
485 MyUpdateMode : TypeOfUpdate from Aspect is protected;
487 -- the different contexts for primitives
488 MyAspectLine3d : AspectLine3d from Graphic3d
490 MyAspectText3d : AspectText3d from Graphic3d
492 MyAspectMarker3d : AspectMarker3d from Graphic3d
494 MyAspectFillArea3d : AspectFillArea3d from Graphic3d
497 -- the displayed structures
498 MyDisplayedStructure : MapOfStructure from Graphic3d
501 -- the highlighted structures
502 MyHighlightedStructure : MapOfStructure from Graphic3d
505 -- the pickable structures
506 MyPickStructure : MapOfStructure from Graphic3d
509 -- the structure identifier generator
510 MyStructGenId : GenId from Aspect is protected;
513 MyGraphicDriver : GraphicDriver from Graphic3d is protected;
517 class Structure from Graphic3d
519 end StructureManager;