51835d5adbd1a71c143ddbe520f349c9a0934d61
[occt.git] / src / Visual3d / Visual3d_Layer.cdl
1 --
2 -- File:    Visual3d_Layer.cdl
3 -- Created: Mardi 1 decembre 1998
4 -- Author:  CAL
5 --
6 ---Copyright:   MatraDatavision 1998
7 --
8
9 class Layer from Visual3d inherits TShared
10
11     ---Version:
12
13     ---Purpose: This class allows to manage 2d graphics.
14     ---Keywords:
15     ---Warning:
16     ---References:
17
18 uses
19
20     Color                   from Quantity,
21     PlaneAngle              from Quantity,
22
23     CLayer2d                from Aspect,
24     TypeOfConstraint        from Aspect,
25     TypeOfLayer             from Aspect,
26     TypeOfLine              from Aspect,
27     TypeOfDisplayText       from Aspect,
28
29     GraphicDriver           from Graphic3d,
30     TextPath                from Graphic3d,
31     HorizontalTextAlignment from Graphic3d,
32     VerticalTextAlignment   from Graphic3d,
33
34     ViewManager             from Visual3d,
35     LayerItem               from Visual3d,
36     NListOfLayerItem        from Visual3d,
37     
38         FontAspect          from OSD
39 raises
40     LayerDefinitionError    from Visual3d
41
42 is
43     -------------------------
44     -- Category: Constructors
45     -------------------------
46
47     Create (AViewer : ViewManager from Visual3d;
48         AType   : TypeOfLayer from Aspect = Aspect_TOL_OVERLAY;
49         AFlag   : Boolean from Standard = Standard_False)
50         returns mutable Layer from Visual3d;
51     ---Level: Public
52     ---Purpose: Creates a layer with the type <Atype>.
53     --      if <AFlag> == Standard_True then the layer is
54     --      "size dependent".
55     --      The mapping of the layer is dependent of each
56     --      window's size.
57     --      if <AFlag> == Standard_False then the mapping of the
58     --      layer is dependent of the highest window and the largest
59     --      window of all the views of the viewer <AViewer>.
60     --      When the viewer <AViewer> have only one view, the
61     --      result will be the same with <AFlag> == Standard_False
62     --      or <AFlag> == Standard_True.
63     ---Category: Constructors
64
65     ------------------------
66     -- Category: Destructors
67     ------------------------
68
69     Destroy (me : mutable);
70     ---Level: Public
71     ---Purpose: Suppress the layer <me>.
72     ---Category: Destructors
73     ---C++: alias ~
74
75     ---------------------------------------------------
76     -- Category: Methods to modify the class definition
77     ---------------------------------------------------
78
79     Begin (me   : mutable)
80     ---Level: Public
81     ---Purpose: Begins the definition of the layer <me>
82     --  Warning: No default attributes
83     raises LayerDefinitionError from Visual3d;
84     -- if   Layer is already open.
85     ---Category: Methods to modify the class definition
86
87     End (me     : mutable)
88     ---Level: Public
89     ---Purpose: Finishs the definition of the layer <me>.
90     raises LayerDefinitionError from Visual3d;
91     -- if   Layer is not open.
92     ---Category: Methods to modify the class definition
93
94     Clear (me   : mutable)
95     ---Level: Public
96     ---Purpose: Clear all graphics managed by the layer <me>.
97     raises LayerDefinitionError from Visual3d;
98     -- if   Layer is already open.
99     ---Category: Methods to modify the class definition
100
101     ---------------------------------------
102     -- Category: Graphic definition methods
103     ---------------------------------------
104
105     BeginPolyline (me   : mutable)
106     ---Level: Public
107     ---Purpose: After this call, <me> is ready to receive
108     --      a definition of a polyline with AddVertex().
109     raises LayerDefinitionError from Visual3d;
110     -- if a Begin... primitive is already open,
111     -- or   Layer is not open.
112     ---Category: Graphic definition methods
113
114     BeginPolygon (me    : mutable)
115     ---Level: Public
116     ---Purpose: After this call, <me> is ready to receive
117     --      a definition of a polygon with AddEdge().
118     raises LayerDefinitionError from Visual3d;
119     -- if a Begin... primitive is already open,
120     -- or   Layer is not open.
121     ---Category: Graphic definition methods
122
123     AddVertex (me   : mutable;
124         X, Y    : Real from Standard;
125         AFlag   : Boolean from Standard = Standard_True)
126     ---Level: Public
127     ---Purpose: Puts <X, Y> as a new point in the current primitive.
128     --      If <AFlag> then it is a draw between last point and
129     --      this point else it is a move between last point and
130     --      this point.
131     raises LayerDefinitionError from Visual3d;
132     -- if a Begin... primitive is not open,
133     -- or   Layer is not open.
134     ---Category: Graphic definition methods
135
136     ClosePrimitive (me  : mutable)
137     ---Level: Public
138     ---Purpose: After this call, <me> stops the reception of
139     --      a definition of a Begin... primitive.
140     raises LayerDefinitionError from Visual3d;
141     -- if a Begin... primitive is not open,
142     -- or   Layer is not open.
143     ---Category: Graphic definition methods
144
145     DrawRectangle (me   : mutable;
146         X, Y        : Real from Standard;
147         Width, Height   : Real from Standard)
148     ---Level: Public
149     ---Purpose: Draws the rectangle at position <X,Y>.
150     raises LayerDefinitionError from Visual3d;
151     -- if   Layer is not open.
152     ---Category: Graphic definition methods
153
154     DrawText (me       : mutable;
155               AText   : CString from Standard;
156               X, Y    : Real from Standard;
157               AHeight : Real from Standard)
158     ---Level: Public
159     ---Purpose: Draws the string <AText> at position <X,Y>.
160     --      The attributes are given with respect to the plane of
161     --      projection.
162     --      <AHeight>   : Height of text.
163     --            (Relative to the Normalized Projection
164     --          Coordinates (NPC) Space).
165     raises LayerDefinitionError from Visual3d;
166     -- if   Layer is not open.
167     ---Category: Graphic definition methods
168
169     TextSize (me;
170               AText    : CString from Standard;
171               AHeight  : Real from Standard;
172               AWidth   : in out Real from Standard;
173               AnAscent : in out Real from Standard;
174               ADescent : in out Real from Standard )
175     ---Level: Public
176     ---Purpose: Get the size of text.
177     --      The attributes are given with respect to the plane of
178     --      projection.
179     --      <AHeight>   : Height of text.
180     --            (Relative to the Normalized Projection
181     --          Coordinates (NPC) Space).
182     raises LayerDefinitionError from Visual3d;
183     -- if   Layer is not open.
184     ---Category: Graphic definition methods
185
186     -----------------------------------------------------
187     -- Category: Methods to manage the graphics attributs
188     -----------------------------------------------------
189
190     SetColor (me      : mutable;
191               AColor  : Color from Quantity)
192     ---Level: Public
193     ---Purpose: Modifies the current color.
194     --  Warning: No default color
195     raises LayerDefinitionError from Visual3d;
196     -- if   Layer is not open.
197     ---Category: Methods to manage the graphics attributs
198
199     SetTransparency (me              : mutable;
200                      ATransparency   : ShortReal from Standard)
201     ---Level: Public
202     ---Purpose: Modifies the current transparency.
203     --  Warning: No default transparency
204     raises LayerDefinitionError from Visual3d;
205     -- if   Layer is not open.
206     ---Category: Methods to manage the graphics attributs
207
208     UnsetTransparency (me   : mutable)
209     ---Level: Public
210     ---Purpose: Unsets the transparency.
211     raises LayerDefinitionError from Visual3d;
212     -- if   Layer is not open.
213     ---Category: Methods to manage the graphics attributs
214
215     SetLineAttributes (me      : mutable;
216                        AType   : TypeOfLine from Aspect;
217                        AWidth  : Real from Standard)
218     ---Level: Public
219     ---Purpose: Modifies the current lines attributes.
220     --  Warning: No default attributes
221     raises LayerDefinitionError from Visual3d;
222     -- if   Layer is not open.
223     ---Category: Methods to manage the graphics attributs
224
225     SetTextAttributes (me     : mutable;
226                        AFont   : CString from Standard;
227                        AType   : TypeOfDisplayText from Aspect;
228                        AColor  : Color from Quantity)
229     ---Level: Public
230     ---Purpose: Modifies the current texts attributes.
231     --  Warning: No default attributes
232     raises LayerDefinitionError from Visual3d;
233     -- if   Layer is not open.
234     
235     -------------------------------------------------------
236     -- Category: Methods to manage the graphics coordinates
237     -------------------------------------------------------
238
239     SetOrtho (me      : mutable;
240               Left    : Real from Standard;
241               Right   : Real from Standard;
242               Bottom  : Real from Standard;
243               Top     : Real from Standard;
244               Attach  : TypeOfConstraint from Aspect = Aspect_TOC_BOTTOM_LEFT)
245     ---Level: Public
246     ---Purpose: Modifies the current coordinates system of the layer <me>.
247     raises LayerDefinitionError from Visual3d;
248     -- if   Layer is not opened.
249     ---Category: Methods to manage the graphics coordinates
250
251     SetViewport (me      : mutable;
252                  Width   : Integer from Standard;
253                  Height  : Integer from Standard)
254     ---Level: Public
255     ---Purpose: Modifies the current viewport of the layer <me>.
256     raises LayerDefinitionError from Visual3d;
257     -- if   Layer is not opened.
258     ---Category: Methods to manage the graphics coordinates
259
260     ----------------------------
261     -- Category: Inquire methods
262     ----------------------------
263
264     CLayer (me)
265         returns CLayer2d from Aspect;
266     ---Level: Public
267     ---Purpose: Returns the associated C structure.
268     ---Category: Inquire methods
269
270     Type (me)
271         returns TypeOfLayer from Aspect;
272     ---Level: Public
273     ---Purpose: Returns the type.
274     ---Category: Inquire methods
275
276         AddLayerItem( me   : mutable;
277                       Item : LayerItem from Visual3d );
278         
279     RemoveLayerItem( me   : mutable;
280                      Item : LayerItem from Visual3d );
281         
282     RemoveAllLayerItems( me: mutable );
283     
284     GetLayerItemList( me )
285             returns  NListOfLayerItem from Visual3d;
286     ---C++: return const &
287
288         RenderLayerItems(me);
289     --- Redraw all loaded layer items
290 fields
291
292 --
293 -- Classe   :   Visual3d_Layer
294 --
295 -- Purpose  :   Declaration of the variables specific to layers.
296 --
297 -- Reminder :   A layer is defined by:
298 --          - a ViewManager
299 --
300
301     -- the graphic driver used
302     MyGraphicDriver     :   GraphicDriver from Graphic3d;
303
304     -- the associated C structure
305     MyCLayer        :   CLayer2d from Aspect;
306
307     -- the ViewManager associated with the view
308     MyPtrViewManager    :   Address from Standard;
309     
310     -- the List of Layer Items
311         MyListOfLayerItems      :       NListOfLayerItem from Visual3d;
312
313 end Layer from Visual3d;