1 -- Created on: 1993-07-01
2 -- Created by: Jean Louis FRENKEL,Gerard GRAS
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- Update: Fri Jan 30 16:05:00 1998
18 -- Adds <useMFT> parameter in the SetFontMap() method
19 -- and adds the new method UseMFT()
20 -- for using MDTV fonts instead system fonts.
22 deferred class Driver from Aspect inherits TShared from MMgt
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(),...
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.
38 ExtendedString from TCollection,
39 Array1OfShortReal from TShort,
45 TypeOfText from Aspect,
46 PlaneAngle from Quantity,
54 DriverDefinitionError from Aspect,
55 DriverError from Aspect,
56 UndefinedMap from Aspect
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.
65 ---------------------------------------------
66 -- Category: Methods to define the attributes
67 ---------------------------------------------
69 SetColorMap(me: mutable;
70 aColorMap: ColorMap from Aspect)
71 raises DriverError from Aspect is static;
72 ---Category: Methods to define the ColorIndexs
74 SetTypeMap(me: mutable;
75 aTypeMap: TypeMap from Aspect)
76 raises DriverError from Aspect is static;
77 ---Category: Methods to define the TypeIndexs
79 SetWidthMap(me: mutable;
80 aWidthMap: WidthMap from Aspect)
81 raises DriverError from Aspect is static;
82 ---Category: Methods to define the WidthIndexs
84 SetFontMap(me: mutable;
85 aFontMap: FontMap from Aspect)
86 raises DriverError from Aspect is static;
87 ---Category: Methods to define the FontIndexs
89 -- Sets the current font map to this driver and Enable/Disable
90 -- this driver to use MDTV fonts instead system fonts.
92 SetMarkMap(me: mutable;
93 aMarkMap: MarkMap from Aspect)
94 raises DriverError from Aspect is static;
95 ---Category: Methods to define the MarkerIndexs
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
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
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
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
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
134 ---Category: Images methods:
136 IsKnownImage(me: mutable; anImage: Transient from Standard)
137 returns Boolean from Standard
140 SizeOfImageFile(me; anImageFile: CString from Standard;
141 aWidth,aHeight: out Integer from Standard)
142 returns Boolean from Standard
145 ClearImage (me: mutable; anImageId: Transient from Standard)
146 raises DriverError from Aspect is deferred;
148 ClearImageFile (me: mutable; anImageFile: CString from Standard)
149 raises DriverError from Aspect is deferred;
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
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
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;
168 ---Purpose: Fills a complete Image .
169 ---Category: Methods to draw primitives
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;
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
182 DrawPolyline (me : mutable;
183 aListX, aListY: Array1OfShortReal from TShort)
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
190 DrawPolygon (me : mutable;
191 aListX, aListY: Array1OfShortReal from TShort)
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
198 DrawSegment (me : mutable;
199 X1, Y1: ShortReal from Standard;
200 X2, Y2: ShortReal from Standard)
202 ---Purpose: Draw a segment depending of the SetLineAttrib() attributes.
203 raises DriverError from Aspect is deferred;
204 ---Category: Methods to draw primitives
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)
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
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)
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
238 DrawPoint (me : mutable; X, Y: ShortReal from Standard)
240 ---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib()
241 --color attribute or add a point depending of the incremental BeginXxxxxx()
243 raises DriverError from Aspect is deferred;
244 ---Category: Methods to draw primitives
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)
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
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)
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
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)
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
292 BeginPolyline (me : mutable; aNumber : Integer) is deferred;
294 ---Purpose: Begin an incremental polyline primitive of <aNumber> of points .
295 -- Warning: Points must be added by the the DrawPoint() method.
297 BeginPolygon (me : mutable; aNumber : Integer) is deferred;
299 ---Purpose: Begin an incremental polygon primitive of <aNumber> of points .
300 -- Warning: Points must be added by the the DrawPoint() method.
302 BeginSegments (me : mutable) is deferred;
304 ---Purpose: Begin a set of segments .
305 -- Warning: Segments must be added by the DrawSegment() method.
307 BeginArcs (me : mutable) is deferred;
309 ---Purpose: Begin a set of circles or ellips .
310 -- Warning: Arcs must be added by the DrawArc() methods.
312 BeginPolyArcs (me : mutable) is deferred;
314 ---Purpose: Begin a set of polygon circles or ellips .
315 -- Warning: Arcs must be added by the DrawPolyArc() methods.
317 BeginMarkers (me : mutable) is deferred;
319 ---Purpose: Begin a set of markers .
320 -- Warning: Markers must be added by the DrawMarker() method.
322 BeginPoints (me : mutable) is deferred;
324 ---Purpose: Begin a set of points .
325 -- Warning: Points must be added by the DrawPoint() method.
327 ClosePrimitive (me : mutable)
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().
333 InitializeColorMap(me: mutable;
334 aColorMap: ColorMap from Aspect)
335 raises DriverError from Aspect is deferred protected;
336 ---Category: Methods to define the ColorIndexs
338 InitializeTypeMap(me: mutable;
339 aTypeMap: TypeMap from Aspect)
340 raises DriverError from Aspect is deferred protected;
341 ---Category: Methods to define the TypeIndexs
343 InitializeWidthMap(me: mutable;
344 aWidthMap: WidthMap from Aspect)
345 raises DriverError from Aspect is deferred protected;
346 ---Category: Methods to define the WidthIndexs
348 InitializeFontMap(me: mutable;
349 aFontMap: FontMap from Aspect)
350 raises DriverError from Aspect is deferred protected;
351 ---Category: Methods to define the FontIndexs
353 InitializeMarkMap(me: mutable;
354 aMarkMap: MarkMap from Aspect)
355 raises DriverError from Aspect is deferred protected;
356 ---Category: Methods to define the MarkerIndexs
358 ----------------------------
359 -- Category: Inquire methods
360 ----------------------------
362 ColorMap(me) returns ColorMap from Aspect
363 raises UndefinedMap from Aspect is static;
365 TypeMap(me) returns TypeMap from Aspect
366 raises UndefinedMap from Aspect is static;
368 WidthMap(me) returns WidthMap from Aspect
369 raises UndefinedMap from Aspect is static;
371 FontMap(me) returns FontMap from Aspect
372 raises UndefinedMap from Aspect is static;
374 MarkMap(me) returns MarkMap from Aspect
375 raises UndefinedMap from Aspect is static;
377 WorkSpace ( me ; Width,Heigth : out Length from Quantity )
380 ---Purpose: Returns the Available WorkSpace in DWU coordinates
381 ---Category: Inquire methods
383 Convert ( me ; PV : Integer from Standard )
384 returns Length from Quantity is deferred;
386 ---Purpose: Returns the DWU value depending of
388 ---Category: Inquire methods
390 Convert ( me ; DV : Length from Quantity )
391 returns Integer from Standard is deferred;
393 ---Purpose: Returns the PIXEL value depending of
395 ---Category: Inquire methods
397 Convert ( me ; PX, PY : Integer from Standard ;
398 DX, DY : out Length from Quantity ) is deferred ;
400 ---Purpose: Returns the DWU position depending of
401 -- the PIXEL position .
402 ---Category: Inquire methods
404 Convert ( me ; DX, DY : Length from Quantity ;
405 PX, PY : out Integer from Standard ) is deferred;
407 ---Purpose: Returns the PIXEL position depending of
408 -- the DWU position .
409 ---Category: Inquire methods
412 ---Purpose: Returns TRUE when the driver must use MDTV fonts
413 -- instead system fonts.
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;
427 end Driver from Aspect;