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