1 -- Created on: 1991-09-05
2 -- Created by: NW,JPB,CAL
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- 05-97: CAL; Ajout du Clear sur les TOS_COMPUTED.
18 -- 05-98: CAL; Perfs. Connection entre structures COMPUTED.
20 class ViewManager from Visual3d inherits StructureManager from Graphic3d
22 ---Purpose: This class allows the definition of a manager to
23 -- which the views are associated.
24 -- It allows them to be globally manipulated.
25 -- It activates the pick.
29 Array2OfReal from TColStd,
30 SequenceOfInteger from TColStd,
31 MapOfInteger from TColStd,
35 TypeOfHighlightMethod from Aspect,
37 GraphicDriver from Graphic3d,
38 Structure from Graphic3d,
39 DataStructureManager from Graphic3d,
40 Vertex from Graphic3d,
42 Vector from Graphic3d,
44 ZLayerSettings from Graphic3d,
45 MapOfZLayerSettings from Visual3d,
47 ContextPick from Visual3d,
49 SetOfView from Visual3d,
50 HSetOfView from Visual3d,
55 Create ( theDriver: GraphicDriver from Graphic3d)
56 returns mutable ViewManager from Visual3d;
58 ---Purpose: Creates a 3D visualizer.
59 -- Currently creating of more than 100 viewer instances
60 -- is not supported and leads to InitializationError and
61 -- initialisation failure.
62 -- This limitation might be addressed in some future OCCT releases.
63 ---------------------------------------------------
64 -- Category: Methods to modify the class definition
65 ---------------------------------------------------
67 Activate ( me : mutable )
70 ---Purpose: Activates all the views of the manager <me>.
71 ---Category: Methods to modify the class definition
73 Deactivate ( me : mutable )
76 ---Purpose: Deactivates all the views of the manager <me>.
77 ---Category: Methods to modify the class definition
79 Destroy ( me : mutable )
82 ---Purpose: Deletes and erases the 3D visualiser <me>.
83 ---Category: Methods to modify the class definition
86 Erase ( me : mutable )
89 ---Purpose: Erases all of the structures displayed in the
91 ---Category: Methods to modify the class definition
96 ---Purpose: Redraws all the displayed structures.
97 ---Category: Methods to modify the class definition
99 RedrawImmediate ( me )
102 ---Purpose: Updates layer of immediate presentations.
107 ---Purpose: Invalidates viewer content but does not redraw it.
109 Remove ( me : mutable )
112 ---Purpose: Deletes and erases the 3D visualiser <me>.
113 ---Category: Methods to modify the class definition
118 ---Purpose: Updates screen in function of modifications of the structures.
119 -- Category: Methods to modify the class definition
121 ----------------------------
122 -- Category: Inquire methods
123 ----------------------------
126 returns HSetOfView from Visual3d
129 ---Purpose: Returns the group of views activated in the visualiser <me>.
130 ---Category: Inquire methods
133 returns HSetOfView from Visual3d
136 ---Purpose: Returns the group of views defined in the visualiser <me>.
137 ---Category: Inquire methods
140 returns Integer from Standard
143 ---Purpose: Returns the theoretical maximum number of
144 -- definable views in the view manager <me>.
145 -- Warning: It's not possible to accept an infinite
146 -- number of definable views because each
147 -- view must have an identification and we
148 -- have different view managers.
149 ---Category: Inquire methods
151 Identification ( me : mutable;
152 AView : View from Visual3d )
153 returns Integer from Standard
156 ---Purpose: Returns :
157 -- a new identification number for a new view
158 -- in the visualiser.
159 ---Category: Inquire methods
161 UnIdentification ( me : mutable;
162 aViewId : Integer from Standard )
163 ---Purpose: Release a unique ID of the view reserved for the view on its creation.
166 -------------------------------------------------
167 -- Summary of Pick Input --
169 -- Picking returns information about an --
170 -- object pointed to on the display. --
172 -- To be picked, a structure must be : --
175 -- Within the pick aperture --
176 -- Pickable as determined by the method --
177 -- Graphic3d_Structure::SetPick --
179 -- To insert a Pick Identification use the --
180 -- method Graphic3d_Group::SetPickId --
182 -- The pick search order tends to select the --
184 -- High to low structure display priority --
185 -- Most recently displayed to least --
186 -- recently displayed. --
187 -------------------------------------------------
189 ------------------------------
190 -- Category: Redefined methods
191 ------------------------------
194 -- 3 redefined methods
196 -- The C++ programming language (Bjarne Stroustrup)
197 -- page 586 r.13.1 Declaration Matching
199 -- A function member of a derived class is not in the same
200 -- scope as a function member of the same name in a base class.
201 -- So Identification (AView) hides Identification (AStructure)
202 -- rather than overloads it !
206 AId : Integer from Standard )
207 returns Structure from Graphic3d
210 ---Purpose: Returns the structure with the identification number <AId>.
211 ---Category: Redefined methods
213 Identification ( me )
214 returns Integer from Standard
217 ---Purpose: Returns the identification number of the visualiser.
218 ---Category: Redefined methods
220 ----------------------------
221 -- Category: Private methods
222 ----------------------------
224 ChangeDisplayPriority ( me : mutable;
225 AStructure : Structure from Graphic3d;
226 OldPriority : Integer from Standard;
227 NewPriority : Integer from Standard )
230 ---Purpose: Changes the display priority of the structure <AStructure>.
231 ---Category: Private methods
233 ChangeZLayer ( me : mutable;
234 theStructure : Structure from Graphic3d;
235 theLayerId : Integer from Standard )
237 ---Purpose: Change Z layer for structure. The layer mechanism allows
238 -- to display structures in higher layers in overlay of structures in
242 theStructure : Structure from Graphic3d )
243 returns Integer from Standard is redefined static;
244 ---Purpose: Get Z layer ID assigned for the structure.
246 SetZLayerSettings ( me : mutable;
247 theLayerId : Integer from Standard;
248 theSettings : ZLayerSettings from Graphic3d )
250 ---Purpose: Sets the settings for a single Z layer for all managed views.
252 ZLayerSettings ( me : mutable;
253 theLayerId : Integer from Standard )
254 returns ZLayerSettings from Graphic3d is redefined static;
255 ---Purpose: Returns the settings of a single Z layer.
257 AddZLayer ( me : mutable;
258 theLayerId : in out Integer from Standard )
259 returns Boolean from Standard is redefined static;
260 ---Purpose: Add a new top-level Z layer and get its ID as
261 -- <theLayerId> value. The method returns Standard_False if the layer
262 -- can not be created. The layer mechanism allows to display
263 -- structures in higher layers in overlay of structures in lower layers.
265 RemoveZLayer ( me : mutable;
266 theLayerId : Integer from Standard )
267 returns Boolean from Standard is redefined static;
268 ---Purpose: Remove Z layer with ID <theLayerId>. Method returns
269 -- Standard_False if the layer can not be removed or doesn't exists.
270 -- By default, there are always default bottom-level layer that can't
274 theLayerSeq : out SequenceOfInteger from TColStd )
276 ---Purpose: Return all Z layer ids in sequence ordered by overlay level
277 -- from lowest layer to highest ( foreground ). The first layer ID
278 -- in sequence is the default layer that can't be removed.
281 theView : View from Visual3d )
283 ---Purpose: Install z layers managed by the view manager into the
284 -- controlled view. This method used on the view initialization to
285 -- make the layer lists consistent.
287 getZLayerGenId ( myclass )
288 ---Purpose: Returns global instance of z layer ids generator.
290 returns GenId from Aspect is protected;
293 Clear ( me : mutable;
294 AStructure : Structure from Graphic3d;
295 WithDestruction : Boolean from Standard )
298 ---Purpose: Clears the structure <AStructure>.
299 ---Category: Private methods
301 Connect ( me : mutable;
302 AMother : Structure from Graphic3d;
303 ADaughter : Structure from Graphic3d )
306 ---Purpose: Connects the structures <AMother> and <ADaughter>.
307 ---Category: Private methods
309 Disconnect ( me : mutable;
310 AMother : Structure from Graphic3d;
311 ADaughter : Structure from Graphic3d )
314 ---Purpose: Disconnects the structures <AMother> and <ADaughter>.
315 ---Category: Private methods
317 Display ( me : mutable;
318 AStructure : Structure from Graphic3d )
321 ---Purpose: Display of the structure <AStructure>.
322 ---Category: Private methods
324 Erase ( me : mutable;
325 AStructure : Structure from Graphic3d )
328 ---Purpose: Erases the structure <AStructure>.
329 ---Category: Private methods
331 Highlight ( me : mutable;
332 AStructure : Structure from Graphic3d;
333 AMethod : TypeOfHighlightMethod from Aspect )
336 ---Purpose: Highlights the structure <AStructure>.
337 ---Category: Private methods
339 SetTransform ( me : mutable;
340 AStructure : Structure from Graphic3d;
341 ATrsf : Array2OfReal from TColStd )
345 ---Category: Private methods
347 UnHighlight ( me : mutable )
350 ---Purpose: Suppress the highlighting on all the structures.
351 ---Category: Private methods
353 UnHighlight ( me : mutable;
354 AStructure : Structure from Graphic3d )
357 ---Purpose: Suppress the highlighting on the structure <AStructure>.
358 ---Category: Private methods
361 AWindow : Window from Aspect;
362 TheCView : out CView from Graphic3d )
363 returns Boolean from Standard
366 ---Purpose: Returns Standard_True if the view associated to the
367 -- window <AWindow> exists and is activated.
368 -- <TheViewId> contains the internal identification of
369 -- the associated view.
370 ---Category: Private methods
372 SetLayer ( me : mutable;
373 ALayer : Layer from Visual3d )
376 ---Purpose: Adds a new layer in all the views of <me>.
377 ---Category: Private methods
380 returns Layer from Visual3d;
382 ---Purpose: Returns the underlay of the viewer <me>.
383 ---Category: Private methods
384 ---C++: return const &
387 returns Layer from Visual3d;
389 ---Purpose: Returns the underlay of the viewer <me>.
390 ---Category: Private methods
391 ---C++: return const &
393 -----------------------------
394 -- Category: Internal methods
395 -----------------------------
397 ReCompute ( me : mutable;
398 AStructure : Structure from Graphic3d )
401 ---Purpose: Forces a new construction of the structure <AStructure>
402 -- if <AStructure> is displayed and TOS_COMPUTED.
403 ---Category: Private methods
405 ReCompute ( me : mutable;
406 AStructure : Structure from Graphic3d;
407 AProjector : DataStructureManager from Graphic3d )
410 ---Purpose: Forces a new construction of the structure <AStructure>
411 -- if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
412 ---Category: Private methods
415 returns Boolean from Standard
418 ---Purpose: Returns Standard_True if the transparency
419 -- is activated in all activated views.
420 -- Default Standard_False
421 ---Category: Internal methods
423 SetTransparency ( me : mutable;
424 AFlag : Boolean from Standard )
427 ---Purpose: if <AFlag> is Standard_True then the transparency
429 -- Default Standard_False
430 ---Category: Internal methods
433 returns Boolean from Standard
436 ---Purpose: Returns Standard_True if the zbuffer activity
437 -- is managed automatically.
438 -- Default Standard_False
439 ---Category: Internal methods
441 SetZBufferAuto ( me : mutable;
442 AFlag : Boolean from Standard )
445 ---Purpose: if <AFlag> is Standard_True then the zbuffer activity
446 -- is managed automatically.
447 -- Default Standard_False
448 ---Category: Internal methods
454 -- Class : Visual3d_ViewManager
456 -- Purpose : Declaration of the variables specific to visualiser
458 -- Reminder : A visualiser manipulates a group of structures
459 -- and a group of views.
462 MyDefinedView : SetOfView from Visual3d;
465 MyUnderLayer : Layer from Visual3d;
466 MyOverLayer : Layer from Visual3d;
468 -- the view identifier generator
469 MyViewGenId : GenId from Aspect;
471 -- the graphic driver used
472 MyGraphicDriver : GraphicDriver from Graphic3d;
475 MyZBufferAuto : Boolean from Standard;
476 MyTransparency : Boolean from Standard;
479 myLayerIds : MapOfInteger from TColStd;
480 myLayerSeq : SequenceOfInteger from TColStd;
482 myMapOfZLayerSettings : MapOfZLayerSettings from Visual3d;
486 class View from Visual3d,
488 class Layer from Visual3d
489 -- Create, Destroy, SetType