1 -- Created on: 1995-01-25
2 -- Created by: Jean-Louis Frenkel
3 -- Copyright (c) 1995-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 -- Modified by Rob (18/12/96) -> information about modes to update.
18 -- Rob (04/07/97) -> TypeOfPresentation3d () Method
19 -- changed to Public Method.
20 -- -> Option Projector Dependant/Independant
21 -- may be set at any time , not only in
22 -- the constructor or the presentable.
23 -- ->Insert Locations Methods...
24 -- Rob (16/12/97) -> Get the list of modes to be updated
25 -- -> Flags all the Prs to be updated...
27 deferred class PresentableObject from PrsMgr inherits TShared from MMgt
30 ---Purpose: A framework to supply the Graphic3d
31 -- structure of the object to be presented. On the first
32 -- display request, this structure is created by calling the
33 -- appropriate algorithm and retaining this frameworkfor
35 -- This abstract framework is inherited in Application
36 -- Interactive Services (AIS), notably in:
37 -- - AIS_InteractiveObject
38 -- - AIS_ConnectedInteractive
39 -- - AIS_MultipleConnectedInteractive
41 -- Consequently, 3D presentation should be handled by
42 -- the relevant daughter classes and their member
43 -- functions in AIS. This is particularly true in the
44 -- creation of new interactive objects.
47 Presentation from PrsMgr,
48 Presentation from Prs3d,
49 Presentations from PrsMgr,
50 PresentationManager from PrsMgr,
51 PresentationManager3d from PrsMgr,
52 TypeOfPresentation3d from PrsMgr,
53 ListOfPresentableObjects from PrsMgr,
54 PresentableObjectPointer from PrsMgr,
55 DataStructureManager from Graphic3d,
57 Transformation from Geom,
58 ListOfInteger from TColStd,
60 ClipPlane from Graphic3d,
61 SequenceOfHClipPlane from Graphic3d,
62 TransModeFlags from Graphic3d,
65 CTransPersStruct from Graphic3d,
66 ZLayerId from Graphic3d
69 NotImplemented from Standard
73 Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
74 ---C++: alias "Standard_EXPORT virtual ~PrsMgr_PresentableObject();"
76 ---Category: deferred methods.
80 aPresentationManager: PresentationManager3d from PrsMgr;
81 aPresentation: Presentation from Prs3d;
82 aMode: Integer from Standard = 0)
83 ---Purpose: Calculates the 3D view aPresentation and its
84 -- updates. The latter are managed by aPresentationManager.
85 -- aPresentableObject has the display mode aMode;
86 -- this has the default value of 0, that is, the wireframe display mode.
87 raises NotImplemented from Standard
91 aProjector : Projector from Prs3d;
92 aPresentation : Presentation from Prs3d)
93 ---Purpose: Calculates the 3D view aPresentation and its
94 -- updates. The latter are managed by
95 -- aPresentationManager. Each of the views in the
96 -- viewer and every modification such as rotation, for
97 -- example, entails recalculation.
98 -- It must be redefined to implement hidden line removal
99 -- for the object. The user never calls this method
100 -- himself. This is done via the InteractiveContext object
101 -- and is dependent on the point of view from which the
102 -- object is displayed.
103 raises NotImplemented from Standard
104 is virtual protected;
106 Compute(me : mutable;
107 aProjector : Projector from Prs3d;
108 aTrsf : Transformation from Geom;
109 aPresentation : Presentation from Prs3d)
110 is virtual protected;
111 ---Purpose: Calculates the 3D view aPresentation and its
112 -- updates. The latter are managed by
113 -- aPresentationManager. A point of view is provided
114 -- by the projector aProjector, and the geometric
115 -- transformation which has transformed associated
116 -- presentable objects is specified by aTrsf.
117 -- This function is to be used in case where a hidden
118 -- line removal display cannot be calculated
119 -- automatically. This occurs when associated
120 -- presentable objects have been transformed
121 -- geometrically, but not translated.
123 -- The transformation aTrsf must be applied to the
124 -- object before computation.
126 Update(me: mutable;AllModes: Boolean=Standard_False)
127 ---Purpose: recomputes all presentations of the object.
131 Update(me: mutable; aMode: Integer from Standard; ClearOther: Boolean from Standard)
132 ---Purpose: Recomputes the presentation in the given mode.
133 -- If ClearOther is true, other presentation will be cleared.
137 aPresentationManager: PresentationManager from PrsMgr;
138 aPresentation: Presentation from PrsMgr;
139 aMode: Integer from Standard = 0)
140 -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
141 is virtual protected;
142 --- Purpose: High-level interface for controlling polygon offsets
144 -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
147 -- Presentations(me: mutable) returns Presentations from PrsMgr
148 -- is static private;
150 Presentations(me : mutable) returns Presentations from PrsMgr
154 TypeOfPresentation3d(me) returns TypeOfPresentation3d from PrsMgr
156 ---Purpose: Returns information on whether the object accepts display in HLR mode or not.
158 -- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
159 SetTransformPersistence( me : mutable;
160 aFlag : TransModeFlags from Graphic3d;
161 APoint : Pnt from gp )
164 ---Purpose: Sets up Transform Persistence Mode for this object.
165 -- This function used to lock in object position, rotation and / or zooming relative to camera position.
166 -- Object will be drawn in the origin setted by APoint parameter (except Graphic3d_TMF_TriedronPers flag
167 -- - see description later). aFlag should be:
168 -- - Graphic3d_TMF_None - no persistence attributes (reset);
169 -- - Graphic3d_TMF_PanPers - object doesn't move;
170 -- - Graphic3d_TMF_ZoomPers - object doesn't resize;
171 -- - Graphic3d_TMF_RotatePers - object doesn't rotate;
172 -- - Graphic3d_TMF_FullPers - pan, zoom and rotate transform persistence;
173 -- - Graphic3d_TMF_TriedronPers - object behaves like trihedron;
174 -- - combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers);
175 -- - combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_RotatePers);
176 -- - combination (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers).
177 -- If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected APoint coordinates X and Y means:
178 -- - X = 0.0, Y = 0.0 - center of view window;
179 -- - X > 0.0, Y > 0.0 - right upper corner of view window;
180 -- - X > 0.0, Y < 0.0 - right lower corner of view window;
181 -- - X < 0.0, Y > 0.0 - left upper corner of view window;
182 -- - X < 0.0, Y < 0.0 - left lower corner of view window.
183 -- And Z coordinate defines the gap from border of view window (except center position).
184 ---Category: Graphic attributes management
186 SetTransformPersistence( me : mutable;
187 aFlag : TransModeFlags from Graphic3d )
190 ---Purpose: Calls previous method with point (0,0,0)
191 ---Category: Graphic attributes management
194 GetTransformPersistenceMode( me ) returns TransModeFlags from Graphic3d is static;
197 ---Purpose: Gets Transform Persistence Mode for this object
198 ---Category: Graphic attributes management
200 GetTransformPersistencePoint( me ) returns Pnt from gp is static;
203 ---Purpose: Gets point of transform persistence for this object
204 ---Category: Graphic attributes management
206 -- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
208 SetTypeOfPresentation(me:mutable; aType: TypeOfPresentation3d from PrsMgr);
210 SetToUpdate (me:mutable;aMode:Integer from Standard);
211 ---Purpose: flags the Prs of mode <AMode> to be Updated.
212 -- the Update will be done when needed.
214 SetToUpdate(me:mutable);
215 ---Purpose: flags all the Presentations to be Updated.
217 ToBeUpdated(me;ListOfMode : out ListOfInteger from TColStd);
218 ---Purpose: gives the list of modes which are flagged "to be updated".
220 SetLocalTransformation(me:mutable; theTransformation:Trsf from gp) is virtual;
221 ---Purpose: Sets local transformation to theTransformation.
223 SetCombinedParentTransform(me:mutable; theTransformation:Trsf from gp) is virtual protected;
224 ---Purpose: Sets myCombinedParentTransform to theTransformation. Thus object receives transformation
225 -- from parent node and able to derive its own.
227 HasTransformation(me) returns Boolean from Standard;
228 ---Purpose: Returns true if object has a transformation that is different from the identity.
230 LocalTransformation(me) returns any Trsf from gp;
232 ---C++: return const&
234 Transformation(me) returns any Trsf from gp;
236 ---C++: return const&
238 InversedTransformation(me) returns any Trsf from gp;
240 ---C++: return const&
242 ResetTransformation(me:mutable) is virtual;
243 ---Purpose: resets local transformation to identity.
245 UpdateTransformation(me:mutable) is virtual;
247 UpdateTransformation(me:mutable;P : Presentation from Prs3d) is virtual;
249 SetZLayer ( me : mutable;
250 theLayerId : ZLayerId from Graphic3d )
252 ---Purpose: Set Z layer ID and update all presentations of the presentable object.
253 -- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
256 returns ZLayerId from Graphic3d is static;
257 ---Purpose: Get ID of Z layer.
259 AddClipPlane (me : mutable; thePlane : ClipPlane from Graphic3d) is virtual;
260 ---Purpose: Adds clip plane for graphical clipping for all display mode
261 -- presentations. The composition of clip planes truncates the rendering
262 -- space to convex volume. Please be aware that number of supported
263 -- clip plane is limited. The planes which exceed the limit are ignored.
264 -- Besides of this, some planes can be already set in view where the object
265 -- is shown: the number of these planes should be substracted from limit
266 -- to predict the maximum possible number of object clipping planes.
267 -- @param thePlane [in] the clip plane to be appended to map of clip planes.
269 RemoveClipPlane (me : mutable; thePlane : ClipPlane from Graphic3d) is virtual;
270 ---Purpose: Removes previously added clip plane.
271 -- @param thePlane [in] the clip plane to be removed from map of clip planes.
273 SetClipPlanes (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d) is virtual;
274 ---Purpose: Set clip planes for graphical clipping for all display mode presentations.
275 -- The composition of clip planes truncates the rendering space to convex
276 -- volume. Please be aware that number of supported clip plane is limited.
277 -- The planes which exceed the limit are ignored. Besides of this, some
278 -- planes can be already set in view where the object is shown: the number
279 -- of these planes should be substracted from limit to predict the maximum
280 -- possible number of object clipping planes.
282 GetClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d;
284 ---C++: return const&
285 ---Purpose: Get clip planes.
286 -- @return set of previously added clip planes for all display mode presentations.
288 SetMutable ( me : mutable;
289 theIsMutable : Boolean from Standard ) is virtual;
290 ---Purpose: Sets if the object has mutable nature (content or location will be changed regularly).
291 -- This method should be called before object displaying to take effect.
293 IsMutable (me) returns Boolean from Standard;
295 ---Purpose: Returns true if object has mutable nature (content or location are be changed regularly).
296 -- Mutable object will be managed in different way than static onces (another optimizations).
298 AddChild ( me : mutable;
299 theObject : PresentableObject from PrsMgr ) is virtual;
300 --- Purpose: Makes theObject child of current object in scene hierarchy.
302 RemoveChild ( me : mutable;
303 theObject : PresentableObject from PrsMgr ) is virtual;
304 --- Purpose: Removes theObject from children of current object in scene hierarchy.
306 Children (me) returns ListOfPresentableObjects from PrsMgr is static;
307 ---C++: return const&
308 --- Purpose: Returns children of the current object.
310 HasOwnPresentations (me) returns Boolean from Standard is static;
312 --- Purpose: Returns true if object should have own presentations.
314 Parent (me) returns PresentableObjectPointer from PrsMgr is static;
316 --- Purpose: Returns parent of current object in scene hierarchy.
318 UpdateClipping (me : mutable) is virtual protected;
319 ---Purpose: General virtual method for internal update of presentation state
320 -- when some modifications on list of clip planes occurs. Base
321 -- implementation propagate clip planes to every presentation.
324 myPresentations: Presentations from PrsMgr is protected;
325 myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
326 myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected;
327 myTransformPersistence : CTransPersStruct from Graphic3d;
328 myIsMutable : Boolean from Standard is protected;
329 myZLayer : ZLayerId from Graphic3d is protected;
331 myHasOwnPresentations : Boolean from Standard is protected; -- shows if object should have own presentations.
333 myParent : PresentableObjectPointer from PrsMgr; -- Reference to parent object in scene hierarchy.
335 myLocalTransformation : Trsf from gp; -- Own transformation of presentable object.
336 myTransformation : Trsf from gp; -- Combined transformation of presentable object.
337 myInvTransformation : Trsf from gp; -- Inverted combined transformation of presentable object.
338 myCombinedParentTransform : Trsf from gp; -- Combined transformation of presentable object excepting local transformation.
340 myChildren : ListOfPresentableObjects from PrsMgr; -- Child objects in scene hierarchy.
343 class Presentation from PrsMgr,
344 class PresentationManager from PrsMgr,
345 Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d),
346 Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;
347 aGivenStruct : Structure from Graphic3d),
348 Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;
349 TheTrsf : Transformation from Geom),
350 Compute from Presentation from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;
351 TheTrsf : Transformation from Geom;
352 aGivenStruct : Structure from Graphic3d)
353 end PresentableObject from PrsMgr;