b311480e |
1 | -- Created on: 1993-07-01 |
2 | -- Created by: Jean Louis FRENKEL,Gerard GRAS |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | -- Update: Fri Jan 30 16:05:00 1998 |
7fd59977 |
18 | -- Adds <useMFT> parameter in the SetFontMap() method |
19 | -- and adds the new method UseMFT() |
20 | -- for using MDTV fonts instead system fonts. |
7fd59977 |
21 | |
22 | deferred class Driver from Aspect inherits TShared from MMgt |
23 | |
24 | ---Purpose: Defines the common behaviour of the output driver. |
25 | -- Warning: Permits to defines polyline,polygon,marker and text attributes in relation |
26 | -- with the SINGLE primitives DrawPolyline(),DrawPolygon(),.... |
27 | -- or the INCREMENTAL primitives BeginPolyline(),BeginPolygon(),... |
28 | -- or the SET of primitives BeginArcs(),BeginMarkers(),... |
29 | -- |
30 | -- NOTE that : |
31 | -- The incremental primitives are interesting to used because |
32 | -- no more arrays are necessary to fill it. |
33 | -- The set of primitives are interesting to used because this |
34 | -- increase the drawing performances. |
35 | |
36 | uses |
37 | |
38 | ExtendedString from TCollection, |
39 | Array1OfShortReal from TShort, |
40 | ColorMap from Aspect, |
41 | TypeMap from Aspect, |
42 | WidthMap from Aspect, |
43 | FontMap from Aspect, |
44 | MarkMap from Aspect, |
45 | TypeOfText from Aspect, |
46 | PlaneAngle from Quantity, |
47 | Length from Quantity, |
48 | Factor from Quantity, |
49 | Ratio from Quantity, |
50 | Color from Quantity |
51 | |
52 | raises |
53 | |
54 | DriverDefinitionError from Aspect, |
55 | DriverError from Aspect, |
56 | UndefinedMap from Aspect |
57 | is |
58 | |
59 | Initialize; |
60 | |
61 | EndDraw (me: mutable; Synchronize: Boolean = Standard_False) is deferred; |
62 | ---Purpose: Flush all graphics and Wait after up to date |
63 | --display when Synchronize is TRUE. |
64 | |
65 | --------------------------------------------- |
66 | -- Category: Methods to define the attributes |
67 | --------------------------------------------- |
68 | |
69 | SetColorMap(me: mutable; |
70 | aColorMap: ColorMap from Aspect) |
71 | raises DriverError from Aspect is static; |
72 | ---Category: Methods to define the ColorIndexs |
73 | |
74 | SetTypeMap(me: mutable; |
75 | aTypeMap: TypeMap from Aspect) |
76 | raises DriverError from Aspect is static; |
77 | ---Category: Methods to define the TypeIndexs |
78 | |
79 | SetWidthMap(me: mutable; |
80 | aWidthMap: WidthMap from Aspect) |
81 | raises DriverError from Aspect is static; |
82 | ---Category: Methods to define the WidthIndexs |
83 | |
84 | SetFontMap(me: mutable; |
128cc8df |
85 | aFontMap: FontMap from Aspect) |
7fd59977 |
86 | raises DriverError from Aspect is static; |
87 | ---Category: Methods to define the FontIndexs |
88 | ---Purpose: |
89 | -- Sets the current font map to this driver and Enable/Disable |
90 | -- this driver to use MDTV fonts instead system fonts. |
91 | |
92 | SetMarkMap(me: mutable; |
93 | aMarkMap: MarkMap from Aspect) |
94 | raises DriverError from Aspect is static; |
95 | ---Category: Methods to define the MarkerIndexs |
96 | |
97 | SetLineAttrib (me: mutable; |
98 | ColorIndex: Integer from Standard; |
99 | TypeIndex: Integer from Standard; |
100 | WidthIndex: Integer from Standard) |
101 | raises DriverError from Aspect is deferred; |
102 | ---Category: Methods to define the Current Line Attibutes |
103 | |
104 | SetTextAttrib (me: mutable; |
105 | ColorIndex: Integer from Standard; |
106 | FontIndex: Integer from Standard) |
107 | raises DriverError from Aspect is deferred; |
108 | ---Category: Methods to define the Current Text Attributes |
109 | |
110 | SetTextAttrib (me: mutable; |
111 | ColorIndex: Integer from Standard; |
112 | FontIndex: Integer from Standard; |
113 | aSlant: PlaneAngle from Quantity; |
114 | aHScale: Factor from Quantity; |
115 | aWScale: Factor from Quantity; |
116 | isUnderlined: Boolean from Standard = Standard_False) |
117 | raises DriverError from Aspect is deferred; |
118 | ---Category: Methods to define the Current Extended Text Attributes |
119 | |
120 | SetPolyAttrib (me: mutable; |
121 | ColorIndex: Integer from Standard; |
122 | TileIndex: Integer from Standard; |
123 | DrawEdge: Boolean from Standard = Standard_False) |
124 | raises DriverError from Aspect is deferred; |
125 | ---Category: Methods to set the poly attributes |
126 | |
127 | SetMarkerAttrib (me: mutable; |
128 | ColorIndex: Integer from Standard; |
129 | WidthIndex: Integer from Standard; |
130 | FillMarker: Boolean from Standard = Standard_False) |
131 | raises DriverError from Aspect is deferred; |
132 | ---Category: Methods to define the Current Marker Attributes |
133 | |
134 | ---Category: Images methods: |
135 | |
136 | IsKnownImage(me: mutable; anImage: Transient from Standard) |
137 | returns Boolean from Standard |
138 | is deferred; |
139 | |
140 | SizeOfImageFile(me; anImageFile: CString from Standard; |
141 | aWidth,aHeight: out Integer from Standard) |
142 | returns Boolean from Standard |
143 | is deferred; |
144 | |
145 | ClearImage (me: mutable; anImageId: Transient from Standard) |
146 | raises DriverError from Aspect is deferred; |
147 | |
148 | ClearImageFile (me: mutable; anImageFile: CString from Standard) |
149 | raises DriverError from Aspect is deferred; |
150 | |
151 | DrawImage (me: mutable; anImageId: Transient from Standard; |
152 | aX, aY: ShortReal from Standard) |
153 | raises DriverError from Aspect is deferred; |
154 | ---Category: Methods to draw primitives |
155 | |
156 | DrawImageFile (me: mutable; anImageFile: CString from Standard; |
157 | aX, aY: ShortReal from Standard; |
158 | aScale: Factor from Quantity = 1.0) |
159 | raises DriverError from Aspect is deferred; |
160 | ---Category: Methods to draw primitives |
161 | |
162 | FillAndDrawImage (me: mutable; anImageId: Transient from Standard; |
163 | aX, aY: ShortReal from Standard; |
164 | aWidth, aHeight: Integer from Standard; |
165 | anArrayOfPixels: Address from Standard) |
166 | raises DriverError from Aspect is deferred; |
167 | ---Level: Public |
168 | ---Purpose: Fills a complete Image . |
169 | ---Category: Methods to draw primitives |
170 | |
171 | FillAndDrawImage (me: mutable; anImageId: Transient from Standard; |
172 | aX, aY: ShortReal from Standard; |
173 | anIndexOfLine, aWidth, aHeight: Integer from Standard; |
174 | anArrayOfPixels: Address from Standard) |
175 | raises DriverError from Aspect is deferred; |
176 | ---Level: Public |
177 | ---Purpose: Fills a line of the Image . |
178 | -- Warning: 0 <= anIndexOfLine < aHeight |
179 | -- anIndexOfLine = 0 must be the first call |
180 | ---Category: Methods to draw primitives |
181 | |
182 | DrawPolyline (me : mutable; |
183 | aListX, aListY: Array1OfShortReal from TShort) |
184 | ---Level: Public |
185 | ---Purpose: Draw a polyline depending of the SetLineAttrib() attributes. |
186 | raises DriverError from Aspect is deferred; |
187 | ---Trigger: Raises if <aListX,aListY> have not the same size. |
188 | ---Category: Methods to draw primitives |
189 | |
190 | DrawPolygon (me : mutable; |
191 | aListX, aListY: Array1OfShortReal from TShort) |
192 | ---Level: Public |
193 | ---Purpose: Draw a polygon depending of the SetPolyAttrib() attributes. |
194 | raises DriverError from Aspect is deferred; |
195 | ---Trigger: Raises if <aListX,aListY> have not the same size. |
196 | ---Category: Methods to draw primitives |
197 | |
198 | DrawSegment (me : mutable; |
199 | X1, Y1: ShortReal from Standard; |
200 | X2, Y2: ShortReal from Standard) |
201 | ---Level: Public |
202 | ---Purpose: Draw a segment depending of the SetLineAttrib() attributes. |
203 | raises DriverError from Aspect is deferred; |
204 | ---Category: Methods to draw primitives |
205 | |
206 | DrawText (me : mutable; |
207 | aText: ExtendedString from TCollection; |
208 | Xpos: ShortReal from Standard; |
209 | Ypos: ShortReal from Standard; |
210 | anAngle: ShortReal from Standard = 0.0; |
211 | aType: TypeOfText from Aspect = Aspect_TOT_SOLID) |
212 | ---Level: Public |
213 | ---Purpose: Draws a text depending of the SetTextAttrib() attributes. |
214 | ---Warning: Coordinates must be defined in DWU space. |
215 | raises DriverError from Aspect is deferred; |
216 | ---Trigger: Raises if Text has too many chars (> 1024) |
217 | ---Category: Methods to draw primitives |
218 | |
219 | DrawPolyText (me : mutable; |
220 | aText: ExtendedString from TCollection; |
221 | Xpos: ShortReal from Standard; |
222 | Ypos: ShortReal from Standard; |
223 | aMarge: Ratio from Quantity = 0.1; |
224 | anAngle: ShortReal from Standard = 0.0; |
225 | aType: TypeOfText from Aspect = Aspect_TOT_SOLID) |
226 | ---Level: Public |
227 | ---Purpose: Draws an framed text depending of the |
228 | -- SetTextAttrib() and SetPolyAttrib() attributes. |
229 | -- Warning: Coordinates must be defined in DWU space. |
230 | -- <aMarge> defines the ratio of the space between the |
231 | -- polygon borders and the bounding box of the text and |
232 | -- depending of the height of the text. |
233 | raises DriverError from Aspect is deferred; |
234 | ---Trigger: Raises if Text has too many chars (> 1024) |
235 | -- or <aMarge is < 0 or > 1. |
236 | ---Category: Methods to draw primitives |
237 | |
238 | DrawPoint (me : mutable; X, Y: ShortReal from Standard) |
239 | ---Level: Public |
240 | ---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib() |
241 | --color attribute or add a point depending of the incremental BeginXxxxxx() |
242 | --primitive used. |
243 | raises DriverError from Aspect is deferred; |
244 | ---Category: Methods to draw primitives |
245 | |
246 | DrawMarker (me : mutable; |
247 | aMarker: Integer from Standard; |
248 | Xpos: ShortReal from Standard; |
249 | Ypos: ShortReal from Standard; |
250 | Width: ShortReal from Standard; |
251 | Height: ShortReal from Standard; |
252 | Angle: ShortReal from Standard = 0.0) |
253 | ---Level: Public |
254 | ---Purpose: Draws the prevously defined marker <aMarker> |
255 | --depending of the SetMarkerAttrib() attributes. |
256 | -- Warning: Coordinates and sizes must be defined in DWU space. |
257 | -- Angle must be defined in RADIAN. |
258 | -- A one pixel marker is drawn when aMarker index is undefined. |
259 | raises DriverError from Aspect is deferred; |
260 | ---Category: Methods to draw primitives |
261 | |
262 | DrawArc (me : mutable; X,Y : ShortReal from Standard; |
263 | anXradius,anYradius : ShortReal from Standard; |
264 | aStartAngle: ShortReal from Standard = 0.0; |
265 | anOpenAngle: ShortReal from Standard = 6.283185) |
266 | returns Boolean |
267 | ---Level: Public |
268 | ---Purpose: Draws an Ellipsoid arc of center <X,Y> and Radius |
269 | --<anXradius,anYradius> of relative angle <anOpenAngle> from |
270 | --the base angle <aStartAngle> and depending of the SetLineAttrib() attributes. |
271 | -- Warning: Returns FALSE if the hardware can't drawing this |
272 | --primitive properly,application must to simulate it. |
273 | raises DriverError from Aspect is deferred; |
274 | ---Trigger: Raises if one of <aXradius,aYradius> is <= 0. |
275 | ---Category: Methods to draw primitives |
276 | |
277 | DrawPolyArc (me : mutable; X,Y : ShortReal from Standard; |
278 | anXradius,anYradius : ShortReal from Standard; |
279 | aStartAngle: ShortReal from Standard = 0.0; |
280 | anOpenAngle: ShortReal from Standard = 6.283185) |
281 | returns Boolean |
282 | ---Level: Public |
283 | ---Purpose: Draws an filled Ellipsoid arc of center <X,Y> and Radius |
284 | --<anXradius,anYradius> of relative angle <anOpenAngle> from |
285 | --the base angle <aStartAngle> and depending of the SetPolyAttrib() attributes. |
286 | -- Warning: Returns FALSE if the hardware can't drawing this |
287 | --primitive properly,application must to simulate it. |
288 | raises DriverError from Aspect is deferred; |
289 | ---Trigger: Raises if one of <aXradius,aYradius> is <= 0. |
290 | ---Category: Methods to draw primitives |
291 | |
292 | BeginPolyline (me : mutable; aNumber : Integer) is deferred; |
293 | ---Level: Public |
294 | ---Purpose: Begin an incremental polyline primitive of <aNumber> of points . |
295 | -- Warning: Points must be added by the the DrawPoint() method. |
296 | |
297 | BeginPolygon (me : mutable; aNumber : Integer) is deferred; |
298 | ---Level: Public |
299 | ---Purpose: Begin an incremental polygon primitive of <aNumber> of points . |
300 | -- Warning: Points must be added by the the DrawPoint() method. |
301 | |
302 | BeginSegments (me : mutable) is deferred; |
303 | ---Level: Public |
304 | ---Purpose: Begin a set of segments . |
305 | -- Warning: Segments must be added by the DrawSegment() method. |
306 | |
307 | BeginArcs (me : mutable) is deferred; |
308 | ---Level: Public |
309 | ---Purpose: Begin a set of circles or ellips . |
310 | -- Warning: Arcs must be added by the DrawArc() methods. |
311 | |
312 | BeginPolyArcs (me : mutable) is deferred; |
313 | ---Level: Public |
314 | ---Purpose: Begin a set of polygon circles or ellips . |
315 | -- Warning: Arcs must be added by the DrawPolyArc() methods. |
316 | |
317 | BeginMarkers (me : mutable) is deferred; |
318 | ---Level: Public |
319 | ---Purpose: Begin a set of markers . |
320 | -- Warning: Markers must be added by the DrawMarker() method. |
321 | |
322 | BeginPoints (me : mutable) is deferred; |
323 | ---Level: Public |
324 | ---Purpose: Begin a set of points . |
325 | -- Warning: Points must be added by the DrawPoint() method. |
326 | |
327 | ClosePrimitive (me : mutable) |
328 | ---Level: Public |
329 | ---Purpose: Close the last Begining primitive |
330 | raises DriverError from Aspect is deferred; |
331 | ---Trigger: Raises if no primitive have been opened by BeginXxxxxx(). |
332 | |
333 | InitializeColorMap(me: mutable; |
334 | aColorMap: ColorMap from Aspect) |
335 | raises DriverError from Aspect is deferred protected; |
336 | ---Category: Methods to define the ColorIndexs |
337 | |
338 | InitializeTypeMap(me: mutable; |
339 | aTypeMap: TypeMap from Aspect) |
340 | raises DriverError from Aspect is deferred protected; |
341 | ---Category: Methods to define the TypeIndexs |
342 | |
343 | InitializeWidthMap(me: mutable; |
344 | aWidthMap: WidthMap from Aspect) |
345 | raises DriverError from Aspect is deferred protected; |
346 | ---Category: Methods to define the WidthIndexs |
347 | |
348 | InitializeFontMap(me: mutable; |
349 | aFontMap: FontMap from Aspect) |
350 | raises DriverError from Aspect is deferred protected; |
351 | ---Category: Methods to define the FontIndexs |
352 | |
353 | InitializeMarkMap(me: mutable; |
354 | aMarkMap: MarkMap from Aspect) |
355 | raises DriverError from Aspect is deferred protected; |
356 | ---Category: Methods to define the MarkerIndexs |
357 | |
358 | ---------------------------- |
359 | -- Category: Inquire methods |
360 | ---------------------------- |
361 | |
362 | ColorMap(me) returns mutable ColorMap from Aspect |
363 | raises UndefinedMap from Aspect is static; |
364 | |
365 | TypeMap(me) returns mutable TypeMap from Aspect |
366 | raises UndefinedMap from Aspect is static; |
367 | |
368 | WidthMap(me) returns mutable WidthMap from Aspect |
369 | raises UndefinedMap from Aspect is static; |
370 | |
371 | FontMap(me) returns mutable FontMap from Aspect |
372 | raises UndefinedMap from Aspect is static; |
373 | |
374 | MarkMap(me) returns mutable MarkMap from Aspect |
375 | raises UndefinedMap from Aspect is static; |
376 | |
377 | WorkSpace ( me ; Width,Heigth : out Length from Quantity ) |
378 | is deferred; |
379 | ---Level: Public |
380 | ---Purpose: Returns the Available WorkSpace in DWU coordinates |
381 | ---Category: Inquire methods |
382 | |
383 | Convert ( me ; PV : Integer from Standard ) |
384 | returns Length from Quantity is deferred; |
385 | ---Level: Public |
386 | ---Purpose: Returns the DWU value depending of |
387 | -- the PIXEL value. |
388 | ---Category: Inquire methods |
389 | |
390 | Convert ( me ; DV : Length from Quantity ) |
391 | returns Integer from Standard is deferred; |
392 | ---Level: Public |
393 | ---Purpose: Returns the PIXEL value depending of |
394 | -- the DWU value. |
395 | ---Category: Inquire methods |
396 | |
397 | Convert ( me ; PX, PY : Integer from Standard ; |
398 | DX, DY : out Length from Quantity ) is deferred ; |
399 | ---Level: Public |
400 | ---Purpose: Returns the DWU position depending of |
401 | -- the PIXEL position . |
402 | ---Category: Inquire methods |
403 | |
404 | Convert ( me ; DX, DY : Length from Quantity ; |
405 | PX, PY : out Integer from Standard ) is deferred; |
406 | ---Level: Public |
407 | ---Purpose: Returns the PIXEL position depending of |
408 | -- the DWU position . |
409 | ---Category: Inquire methods |
410 | |
7fd59977 |
411 | ---Level: Advanced |
412 | ---Purpose: Returns TRUE when the driver must use MDTV fonts |
413 | -- instead system fonts. |
414 | |
415 | fields |
416 | myColorMap: ColorMap from Aspect; |
417 | myTypeMap: TypeMap from Aspect; |
418 | myWidthMap: WidthMap from Aspect; |
419 | myFontMap: FontMap from Aspect; |
420 | myMarkMap: MarkMap from Aspect; |
421 | myColorMapIsDefined: Boolean from Standard; |
422 | myWidthMapIsDefined: Boolean from Standard; |
423 | myTypeMapIsDefined: Boolean from Standard; |
424 | myFontMapIsDefined: Boolean from Standard; |
425 | myMarkMapIsDefined: Boolean from Standard; |
7fd59977 |
426 | |
427 | end Driver from Aspect; |