0023663: Removing 2D viewer library
[occt.git] / src / PrsMgr / PrsMgr_PresentableObject.cdl
1 -- Created on: 1995-01-25
2 -- Created by: Jean-Louis Frenkel
3 -- Copyright (c) 1995-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
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.
10 --
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.
13 --
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 -- Modified by  Rob (18/12/96) -> information about modes to update.
22 --              Rob (04/07/97) ->   TypeOfPresentation3d () Method 
23 --                                  changed to Public Method.
24 --                             -> Option Projector Dependant/Independant
25 --                                may be set at any time , not only in
26 --                                the constructor or the presentable.
27 --                               ->Insert Locations Methods...
28 --              Rob (16/12/97) -> Get the list of modes to be updated
29 --                             -> Flags all the Prs to be updated...                 
30 --              GG IMP020200   -> Presentations() method become protected
31 --                              and no more private.
32 --              SAN (22/03/04) -> OCC4895 High-level interface for controlling 
33 --                              polygon offsets: Fill() made protected virtual.
34
35 deferred class PresentableObject from PrsMgr inherits TShared from MMgt
36
37
38         ---Purpose: A framework to supply the Graphic3d
39         -- structure of the object to be presented. On the first
40         -- display request, this structure is created by calling the
41         -- appropriate algorithm and retaining this frameworkfor
42         -- further display.
43         -- This abstract framework is inherited in Application
44         -- Interactive Services (AIS), notably in:
45         -- -   AIS_InteractiveObject
46         -- -   AIS_ConnectedInteractive
47         -- -   AIS_MultipleConnectedInteractive
48         -- -   AIS_Shape
49         --   Consequently, 3D presentation should be handled by
50         -- the relevant daughter classes and their member
51         -- functions in AIS. This is particularly true in the
52         -- creation of new interactive objects.
53
54 uses
55     Presentation          from PrsMgr,
56     Presentation          from Prs3d,
57     Presentations         from PrsMgr,
58     PresentationManager   from PrsMgr,
59     PresentationManager3d from PrsMgr,
60     TypeOfPresentation3d  from PrsMgr,
61     DataStructureManager  from Graphic3d,
62     Projector             from Prs3d,
63     Transformation        from Geom,
64     ListOfInteger         from TColStd,
65     Location              from TopLoc, 
66     --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
67     TransModeFlags        from Graphic3d, 
68     Pnt                   from gp, 
69     CTransPersStruct      from  Graphic3d      
70     --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
71
72 raises
73     NotImplemented from Standard
74 is
75
76
77     Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
78     
79 ---Category: deferred methods.
80 --           
81     
82     Compute(me:mutable;
83                 aPresentationManager: PresentationManager3d from PrsMgr;
84                 aPresentation: mutable Presentation from Prs3d;
85                 aMode: Integer from Standard = 0)
86         ---Purpose: Calculates the 3D view aPresentation and its
87         -- updates. The latter are managed by aPresentationManager.
88         -- aPresentableObject has the display mode aMode;
89         -- this has the default value of 0, that is, the wireframe display mode.
90     raises NotImplemented from Standard
91     is virtual protected;
92     
93     Compute(me            : mutable;
94             aProjector    : Projector from Prs3d;
95             aPresentation  : mutable Presentation from Prs3d)
96         ---Purpose: Calculates the 3D view aPresentation and its
97         -- updates. The latter are managed by
98         -- aPresentationManager. Each of the views in the
99         -- viewer and every modification such as rotation, for
100         -- example, entails recalculation.
101         -- It must be redefined to implement hidden line removal
102         -- for the object. The user never calls this method
103         -- himself. This is done via the InteractiveContext object
104         -- and is dependent on the point of view from which the
105         -- object is displayed.
106     raises NotImplemented from Standard
107     is virtual protected;
108
109     Compute(me            : mutable;
110             aProjector    : Projector from Prs3d;
111             aTrsf         : Transformation from Geom;
112             aPresentation : mutable Presentation from Prs3d)
113     is virtual protected;
114         ---Purpose: Calculates the 3D view aPresentation and its
115         -- updates. The latter are managed by
116         -- aPresentationManager. A point of view is provided
117         -- by the projector aProjector, and the geometric
118         -- transformation which has transformed associated
119         -- presentable objects is specified by aTrsf.
120         -- This function is to be used in case where a hidden
121         -- line removal display cannot be calculated
122         -- automatically. This occurs   when associated
123         -- presentable objects have been transformed
124         -- geometrically, but not translated.
125         -- Warning
126         -- The transformation aTrsf must be applied to the
127         -- object before computation.
128
129     Update(me: mutable;AllModes: Boolean=Standard_False)
130         ---Purpose: recomputes all presentations of the object.
131         ---Level: Public 
132     is protected;
133
134     Update(me: mutable; aMode: Integer from Standard; ClearOther: Boolean from Standard)
135         ---Purpose: Recomputes the presentation in the given mode.
136         --          If ClearOther is true, other presentation will be cleared.
137     is protected;
138     
139     Fill(me: mutable; 
140                 aPresentationManager: PresentationManager from PrsMgr;
141                 aPresentation: mutable Presentation from PrsMgr;
142                 aMode: Integer from Standard = 0)
143     -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
144     is virtual protected;
145         --- Purpose: High-level interface for controlling polygon offsets
146         
147         -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
148
149     
150     -- Presentations(me: mutable) returns Presentations from PrsMgr
151     -- is static private;
152     
153     Presentations(me : mutable) returns Presentations from PrsMgr
154     is static protected;
155         ---C++: return &
156             
157    TypeOfPresentation3d(me) returns TypeOfPresentation3d from PrsMgr
158    is static;
159         ---Purpose: Returns information on whether the object accepts display in HLR mode or not.
160     
161    --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate ) 
162    SetTransformPersistence(  me     :  mutable; 
163                              aFlag  :  TransModeFlags  from  Graphic3d; 
164                              APoint :  Pnt from gp )
165    is virtual; 
166    ---Level:    Public 
167    ---Purpose:  Sets up Transform Persistence Mode for this object.
168    -- This function used to lock in object position, rotation and / or zooming relative to camera position.
169    -- Object will be drawn in the origin setted by APoint parameter (except Graphic3d_TMF_TriedronPers flag
170    -- - see description later). aFlag should be:
171    -- -   Graphic3d_TMF_None - no persistence attributes (reset);
172    -- -   Graphic3d_TMF_PanPers - object doesn't move;
173    -- -   Graphic3d_TMF_ZoomPers - object doesn't resize;
174    -- -   Graphic3d_TMF_RotatePers - object doesn't rotate;
175    -- -   Graphic3d_TMF_FullPers - pan, zoom and rotate transform persistence;
176    -- -   Graphic3d_TMF_TriedronPers - object behaves like trihedron;
177    -- -   combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers);
178    -- -   combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_RotatePers);
179    -- -   combination (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers).
180    -- If Graphic3d_TMF_TriedronPers persistence mode selected APoint coordinates X and Y means:
181    -- -   X = 0.0, Y = 0.0 - center of view window;
182    -- -   X > 0.0, Y > 0.0 - right upper corner of view window;
183    -- -   X > 0.0, Y < 0.0 - right lower corner of view window;
184    -- -   X < 0.0, Y > 0.0 - left  upper corner of view window;
185    -- -   X < 0.0, Y < 0.0 - left  lower corner of view window.
186    -- And Z coordinate defines the gap from border of view window (except center position).
187    ---Category: Graphic attributes management  
188    
189    SetTransformPersistence(  me     :  mutable; 
190                              aFlag  :  TransModeFlags  from  Graphic3d ) 
191    is  static; 
192    ---Level:    Public 
193    ---Purpose:  Calls previous method  with  point  (0,0,0)
194    ---Category: Graphic attributes management 
195    
196     
197    GetTransformPersistenceMode( me )  returns  TransModeFlags  from  Graphic3d  is  static;
198     
199    ---Level:    Public 
200    ---Purpose:  Gets  Transform  Persistence Mode  for  this  object 
201    ---Category: Graphic attributes management
202
203    GetTransformPersistencePoint( me )  returns  Pnt  from  gp  is  static;
204     
205    ---Level:    Public 
206    ---Purpose:  Gets  point  of  transform  persistence for  this  object 
207    ---Category: Graphic attributes management
208     
209    --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
210     
211    SetTypeOfPresentation(me:mutable; aType: TypeOfPresentation3d from PrsMgr);    
212
213    SetToUpdate    (me:mutable;aMode:Integer from Standard);
214    ---Purpose: flags the Prs of mode <AMode> to be Updated.
215    --          the Update will be done when needed.
216    
217    SetToUpdate(me:mutable); 
218    ---Purpose: flags all the Presentations to be Updated.
219     
220    ToBeUpdated(me;ListOfMode : out ListOfInteger from TColStd);
221    ---Purpose: gives the list of modes which are flagged "to be updated".
222     
223    SetLocation(me:mutable;aLoc:Location from TopLoc) is virtual;
224     
225    HasLocation(me) returns Boolean from Standard;
226    
227    Location(me) returns any Location from TopLoc;
228    ---C++: inline
229    ---C++: return const&
230    
231    ResetLocation(me:mutable)  is virtual;
232
233    UpdateLocation(me:mutable) is virtual;
234     
235    UpdateLocation(me:mutable;P : mutable Presentation from Prs3d) is virtual;
236     
237    SetZLayer ( me         : mutable;
238                thePrsMgr  : PresentationManager from PrsMgr;
239                theLayerId : Integer from Standard )
240      is virtual;
241    ---Purpose: Set Z layer ID and update all presentations of
242    -- the presentable object. The layer can be set only for displayed object.
243    -- If all object presentations are removed, the layer ID will be set to 
244    -- default value when computing presentation. The layers mechanism allows
245    -- drawing objects in higher layers in overlay of objects in lower layers.
246     
247    GetZLayer ( me;
248                thePrsMgr  : PresentationManager from PrsMgr )
249      returns Integer from Standard is static;
250    ---Purpose: Get ID of Z layer. If no presentations of object is displayed,
251    -- and layer ID is unavailable, the -1 value is returned.
252  
253 fields
254     myPresentations: Presentations from PrsMgr is protected;
255     myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
256     myLocation  : Location from TopLoc is protected; 
257     --myTransformPersistence  :  TransModeFlags  from  Graphic3d; 
258     myTransformPersistence  :  CTransPersStruct  from  Graphic3d;
259
260 friends
261     class PresentationManager from PrsMgr,
262     Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d),
263     Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
264                                                           aGivenStruct :  Structure from Graphic3d),
265     Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
266                                                           TheTrsf   : Transformation from Geom),
267     Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
268                                                           TheTrsf      : Transformation from Geom;
269                                                           aGivenStruct : Structure from Graphic3d)
270 end PresentableObject from PrsMgr;