2 -- File: Visual3d_Layer.cdl
3 -- Created: Mardi 1 decembre 1998
6 ---Copyright: MatraDatavision 1998
9 class Layer from Visual3d inherits TShared
13 ---Purpose: This class allows to manage 2d graphics.
21 PlaneAngle from Quantity,
24 TypeOfConstraint from Aspect,
25 TypeOfLayer from Aspect,
26 TypeOfLine from Aspect,
27 TypeOfDisplayText from Aspect,
29 GraphicDriver from Graphic3d,
30 TextPath from Graphic3d,
31 HorizontalTextAlignment from Graphic3d,
32 VerticalTextAlignment from Graphic3d,
34 ViewManager from Visual3d,
35 LayerItem from Visual3d,
36 NListOfLayerItem from Visual3d,
40 LayerDefinitionError from Visual3d
43 -------------------------
44 -- Category: Constructors
45 -------------------------
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;
52 ---Purpose: Creates a layer with the type <Atype>.
53 -- if <AFlag> == Standard_True then the layer is
55 -- The mapping of the layer is dependent of each
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
65 ------------------------
66 -- Category: Destructors
67 ------------------------
69 Destroy (me : mutable);
71 ---Purpose: Suppress the layer <me>.
72 ---Category: Destructors
75 ---------------------------------------------------
76 -- Category: Methods to modify the class definition
77 ---------------------------------------------------
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
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
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
101 ---------------------------------------
102 -- Category: Graphic definition methods
103 ---------------------------------------
105 BeginPolyline (me : mutable)
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
114 BeginPolygon (me : mutable)
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
123 AddVertex (me : mutable;
124 X, Y : Real from Standard;
125 AFlag : Boolean from Standard = Standard_True)
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
131 raises LayerDefinitionError from Visual3d;
132 -- if a Begin... primitive is not open,
133 -- or Layer is not open.
134 ---Category: Graphic definition methods
136 ClosePrimitive (me : mutable)
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
145 DrawRectangle (me : mutable;
146 X, Y : Real from Standard;
147 Width, Height : Real from Standard)
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
154 DrawText (me : mutable;
155 AText : CString from Standard;
156 X, Y : Real from Standard;
157 AHeight : Real from Standard)
159 ---Purpose: Draws the string <AText> at position <X,Y>.
160 -- The attributes are given with respect to the plane of
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
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 )
176 ---Purpose: Get the size of text.
177 -- The attributes are given with respect to the plane of
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
186 -----------------------------------------------------
187 -- Category: Methods to manage the graphics attributs
188 -----------------------------------------------------
190 SetColor (me : mutable;
191 AColor : Color from Quantity)
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
199 SetTransparency (me : mutable;
200 ATransparency : ShortReal from Standard)
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
208 UnsetTransparency (me : mutable)
210 ---Purpose: Unsets the transparency.
211 raises LayerDefinitionError from Visual3d;
212 -- if Layer is not open.
213 ---Category: Methods to manage the graphics attributs
215 SetLineAttributes (me : mutable;
216 AType : TypeOfLine from Aspect;
217 AWidth : Real from Standard)
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
225 SetTextAttributes (me : mutable;
226 AFont : CString from Standard;
227 AType : TypeOfDisplayText from Aspect;
228 AColor : Color from Quantity)
230 ---Purpose: Modifies the current texts attributes.
231 -- Warning: No default attributes
232 raises LayerDefinitionError from Visual3d;
233 -- if Layer is not open.
235 -------------------------------------------------------
236 -- Category: Methods to manage the graphics coordinates
237 -------------------------------------------------------
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)
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
251 SetViewport (me : mutable;
252 Width : Integer from Standard;
253 Height : Integer from Standard)
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
260 ----------------------------
261 -- Category: Inquire methods
262 ----------------------------
265 returns CLayer2d from Aspect;
267 ---Purpose: Returns the associated C structure.
268 ---Category: Inquire methods
271 returns TypeOfLayer from Aspect;
273 ---Purpose: Returns the type.
274 ---Category: Inquire methods
276 AddLayerItem( me : mutable;
277 Item : LayerItem from Visual3d );
279 RemoveLayerItem( me : mutable;
280 Item : LayerItem from Visual3d );
282 RemoveAllLayerItems( me: mutable );
284 GetLayerItemList( me )
285 returns NListOfLayerItem from Visual3d;
286 ---C++: return const &
288 RenderLayerItems(me);
289 --- Redraw all loaded layer items
293 -- Classe : Visual3d_Layer
295 -- Purpose : Declaration of the variables specific to layers.
297 -- Reminder : A layer is defined by:
301 -- the graphic driver used
302 MyGraphicDriver : GraphicDriver from Graphic3d;
304 -- the associated C structure
305 MyCLayer : CLayer2d from Aspect;
307 -- the ViewManager associated with the view
308 MyPtrViewManager : Address from Standard;
310 -- the List of Layer Items
311 MyListOfLayerItems : NListOfLayerItem from Visual3d;
313 end Layer from Visual3d;