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-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
22 -- Update: Fri Jan 30 16:05:00 1998
23 -- Adds <useMFT> parameter in the SetFontMap() method
24 -- and adds the new method UseMFT()
25 -- for using MDTV fonts instead system fonts.
27 deferred class Driver from Aspect inherits TShared from MMgt
29 ---Purpose: Defines the common behaviour of the output driver.
30 -- Warning: Permits to defines polyline,polygon,marker and text attributes in relation
31 -- with the SINGLE primitives DrawPolyline(),DrawPolygon(),....
32 -- or the INCREMENTAL primitives BeginPolyline(),BeginPolygon(),...
33 -- or the SET of primitives BeginArcs(),BeginMarkers(),...
36 -- The incremental primitives are interesting to used because
37 -- no more arrays are necessary to fill it.
38 -- The set of primitives are interesting to used because this
39 -- increase the drawing performances.
43 ExtendedString from TCollection,
44 Array1OfShortReal from TShort,
50 TypeOfText from Aspect,
51 PlaneAngle from Quantity,
59 DriverDefinitionError from Aspect,
60 DriverError from Aspect,
61 UndefinedMap from Aspect
66 EndDraw (me: mutable; Synchronize: Boolean = Standard_False) is deferred;
67 ---Purpose: Flush all graphics and Wait after up to date
68 --display when Synchronize is TRUE.
70 ---------------------------------------------
71 -- Category: Methods to define the attributes
72 ---------------------------------------------
74 SetColorMap(me: mutable;
75 aColorMap: ColorMap from Aspect)
76 raises DriverError from Aspect is static;
77 ---Category: Methods to define the ColorIndexs
79 SetTypeMap(me: mutable;
80 aTypeMap: TypeMap from Aspect)
81 raises DriverError from Aspect is static;
82 ---Category: Methods to define the TypeIndexs
84 SetWidthMap(me: mutable;
85 aWidthMap: WidthMap from Aspect)
86 raises DriverError from Aspect is static;
87 ---Category: Methods to define the WidthIndexs
89 SetFontMap(me: mutable;
90 aFontMap: FontMap from Aspect;
91 useMFT: Boolean from Standard = Standard_True)
92 raises DriverError from Aspect is static;
93 ---Category: Methods to define the FontIndexs
95 -- Sets the current font map to this driver and Enable/Disable
96 -- this driver to use MDTV fonts instead system fonts.
98 SetMarkMap(me: mutable;
99 aMarkMap: MarkMap from Aspect)
100 raises DriverError from Aspect is static;
101 ---Category: Methods to define the MarkerIndexs
103 SetLineAttrib (me: mutable;
104 ColorIndex: Integer from Standard;
105 TypeIndex: Integer from Standard;
106 WidthIndex: Integer from Standard)
107 raises DriverError from Aspect is deferred;
108 ---Category: Methods to define the Current Line Attibutes
110 SetTextAttrib (me: mutable;
111 ColorIndex: Integer from Standard;
112 FontIndex: Integer from Standard)
113 raises DriverError from Aspect is deferred;
114 ---Category: Methods to define the Current Text Attributes
116 SetTextAttrib (me: mutable;
117 ColorIndex: Integer from Standard;
118 FontIndex: Integer from Standard;
119 aSlant: PlaneAngle from Quantity;
120 aHScale: Factor from Quantity;
121 aWScale: Factor from Quantity;
122 isUnderlined: Boolean from Standard = Standard_False)
123 raises DriverError from Aspect is deferred;
124 ---Category: Methods to define the Current Extended Text Attributes
126 SetPolyAttrib (me: mutable;
127 ColorIndex: Integer from Standard;
128 TileIndex: Integer from Standard;
129 DrawEdge: Boolean from Standard = Standard_False)
130 raises DriverError from Aspect is deferred;
131 ---Category: Methods to set the poly attributes
133 SetMarkerAttrib (me: mutable;
134 ColorIndex: Integer from Standard;
135 WidthIndex: Integer from Standard;
136 FillMarker: Boolean from Standard = Standard_False)
137 raises DriverError from Aspect is deferred;
138 ---Category: Methods to define the Current Marker Attributes
140 ---Category: Images methods:
142 IsKnownImage(me: mutable; anImage: Transient from Standard)
143 returns Boolean from Standard
146 SizeOfImageFile(me; anImageFile: CString from Standard;
147 aWidth,aHeight: out Integer from Standard)
148 returns Boolean from Standard
151 ClearImage (me: mutable; anImageId: Transient from Standard)
152 raises DriverError from Aspect is deferred;
154 ClearImageFile (me: mutable; anImageFile: CString from Standard)
155 raises DriverError from Aspect is deferred;
157 DrawImage (me: mutable; anImageId: Transient from Standard;
158 aX, aY: ShortReal from Standard)
159 raises DriverError from Aspect is deferred;
160 ---Category: Methods to draw primitives
162 DrawImageFile (me: mutable; anImageFile: CString from Standard;
163 aX, aY: ShortReal from Standard;
164 aScale: Factor from Quantity = 1.0)
165 raises DriverError from Aspect is deferred;
166 ---Category: Methods to draw primitives
168 FillAndDrawImage (me: mutable; anImageId: Transient from Standard;
169 aX, aY: ShortReal from Standard;
170 aWidth, aHeight: Integer from Standard;
171 anArrayOfPixels: Address from Standard)
172 raises DriverError from Aspect is deferred;
174 ---Purpose: Fills a complete Image .
175 ---Category: Methods to draw primitives
177 FillAndDrawImage (me: mutable; anImageId: Transient from Standard;
178 aX, aY: ShortReal from Standard;
179 anIndexOfLine, aWidth, aHeight: Integer from Standard;
180 anArrayOfPixels: Address from Standard)
181 raises DriverError from Aspect is deferred;
183 ---Purpose: Fills a line of the Image .
184 -- Warning: 0 <= anIndexOfLine < aHeight
185 -- anIndexOfLine = 0 must be the first call
186 ---Category: Methods to draw primitives
188 DrawPolyline (me : mutable;
189 aListX, aListY: Array1OfShortReal from TShort)
191 ---Purpose: Draw a polyline depending of the SetLineAttrib() attributes.
192 raises DriverError from Aspect is deferred;
193 ---Trigger: Raises if <aListX,aListY> have not the same size.
194 ---Category: Methods to draw primitives
196 DrawPolygon (me : mutable;
197 aListX, aListY: Array1OfShortReal from TShort)
199 ---Purpose: Draw a polygon depending of the SetPolyAttrib() attributes.
200 raises DriverError from Aspect is deferred;
201 ---Trigger: Raises if <aListX,aListY> have not the same size.
202 ---Category: Methods to draw primitives
204 DrawSegment (me : mutable;
205 X1, Y1: ShortReal from Standard;
206 X2, Y2: ShortReal from Standard)
208 ---Purpose: Draw a segment depending of the SetLineAttrib() attributes.
209 raises DriverError from Aspect is deferred;
210 ---Category: Methods to draw primitives
212 DrawText (me : mutable;
213 aText: ExtendedString from TCollection;
214 Xpos: ShortReal from Standard;
215 Ypos: ShortReal from Standard;
216 anAngle: ShortReal from Standard = 0.0;
217 aType: TypeOfText from Aspect = Aspect_TOT_SOLID)
219 ---Purpose: Draws a text depending of the SetTextAttrib() attributes.
220 ---Warning: Coordinates must be defined in DWU space.
221 raises DriverError from Aspect is deferred;
222 ---Trigger: Raises if Text has too many chars (> 1024)
223 ---Category: Methods to draw primitives
225 DrawPolyText (me : mutable;
226 aText: ExtendedString from TCollection;
227 Xpos: ShortReal from Standard;
228 Ypos: ShortReal from Standard;
229 aMarge: Ratio from Quantity = 0.1;
230 anAngle: ShortReal from Standard = 0.0;
231 aType: TypeOfText from Aspect = Aspect_TOT_SOLID)
233 ---Purpose: Draws an framed text depending of the
234 -- SetTextAttrib() and SetPolyAttrib() attributes.
235 -- Warning: Coordinates must be defined in DWU space.
236 -- <aMarge> defines the ratio of the space between the
237 -- polygon borders and the bounding box of the text and
238 -- depending of the height of the text.
239 raises DriverError from Aspect is deferred;
240 ---Trigger: Raises if Text has too many chars (> 1024)
241 -- or <aMarge is < 0 or > 1.
242 ---Category: Methods to draw primitives
244 DrawPoint (me : mutable; X, Y: ShortReal from Standard)
246 ---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib()
247 --color attribute or add a point depending of the incremental BeginXxxxxx()
249 raises DriverError from Aspect is deferred;
250 ---Category: Methods to draw primitives
252 DrawMarker (me : mutable;
253 aMarker: Integer from Standard;
254 Xpos: ShortReal from Standard;
255 Ypos: ShortReal from Standard;
256 Width: ShortReal from Standard;
257 Height: ShortReal from Standard;
258 Angle: ShortReal from Standard = 0.0)
260 ---Purpose: Draws the prevously defined marker <aMarker>
261 --depending of the SetMarkerAttrib() attributes.
262 -- Warning: Coordinates and sizes must be defined in DWU space.
263 -- Angle must be defined in RADIAN.
264 -- A one pixel marker is drawn when aMarker index is undefined.
265 raises DriverError from Aspect is deferred;
266 ---Category: Methods to draw primitives
268 DrawArc (me : mutable; X,Y : ShortReal from Standard;
269 anXradius,anYradius : ShortReal from Standard;
270 aStartAngle: ShortReal from Standard = 0.0;
271 anOpenAngle: ShortReal from Standard = 6.283185)
274 ---Purpose: Draws an Ellipsoid arc of center <X,Y> and Radius
275 --<anXradius,anYradius> of relative angle <anOpenAngle> from
276 --the base angle <aStartAngle> and depending of the SetLineAttrib() attributes.
277 -- Warning: Returns FALSE if the hardware can't drawing this
278 --primitive properly,application must to simulate it.
279 raises DriverError from Aspect is deferred;
280 ---Trigger: Raises if one of <aXradius,aYradius> is <= 0.
281 ---Category: Methods to draw primitives
283 DrawPolyArc (me : mutable; X,Y : ShortReal from Standard;
284 anXradius,anYradius : ShortReal from Standard;
285 aStartAngle: ShortReal from Standard = 0.0;
286 anOpenAngle: ShortReal from Standard = 6.283185)
289 ---Purpose: Draws an filled Ellipsoid arc of center <X,Y> and Radius
290 --<anXradius,anYradius> of relative angle <anOpenAngle> from
291 --the base angle <aStartAngle> and depending of the SetPolyAttrib() attributes.
292 -- Warning: Returns FALSE if the hardware can't drawing this
293 --primitive properly,application must to simulate it.
294 raises DriverError from Aspect is deferred;
295 ---Trigger: Raises if one of <aXradius,aYradius> is <= 0.
296 ---Category: Methods to draw primitives
298 BeginPolyline (me : mutable; aNumber : Integer) is deferred;
300 ---Purpose: Begin an incremental polyline primitive of <aNumber> of points .
301 -- Warning: Points must be added by the the DrawPoint() method.
303 BeginPolygon (me : mutable; aNumber : Integer) is deferred;
305 ---Purpose: Begin an incremental polygon primitive of <aNumber> of points .
306 -- Warning: Points must be added by the the DrawPoint() method.
308 BeginSegments (me : mutable) is deferred;
310 ---Purpose: Begin a set of segments .
311 -- Warning: Segments must be added by the DrawSegment() method.
313 BeginArcs (me : mutable) is deferred;
315 ---Purpose: Begin a set of circles or ellips .
316 -- Warning: Arcs must be added by the DrawArc() methods.
318 BeginPolyArcs (me : mutable) is deferred;
320 ---Purpose: Begin a set of polygon circles or ellips .
321 -- Warning: Arcs must be added by the DrawPolyArc() methods.
323 BeginMarkers (me : mutable) is deferred;
325 ---Purpose: Begin a set of markers .
326 -- Warning: Markers must be added by the DrawMarker() method.
328 BeginPoints (me : mutable) is deferred;
330 ---Purpose: Begin a set of points .
331 -- Warning: Points must be added by the DrawPoint() method.
333 ClosePrimitive (me : mutable)
335 ---Purpose: Close the last Begining primitive
336 raises DriverError from Aspect is deferred;
337 ---Trigger: Raises if no primitive have been opened by BeginXxxxxx().
339 InitializeColorMap(me: mutable;
340 aColorMap: ColorMap from Aspect)
341 raises DriverError from Aspect is deferred protected;
342 ---Category: Methods to define the ColorIndexs
344 InitializeTypeMap(me: mutable;
345 aTypeMap: TypeMap from Aspect)
346 raises DriverError from Aspect is deferred protected;
347 ---Category: Methods to define the TypeIndexs
349 InitializeWidthMap(me: mutable;
350 aWidthMap: WidthMap from Aspect)
351 raises DriverError from Aspect is deferred protected;
352 ---Category: Methods to define the WidthIndexs
354 InitializeFontMap(me: mutable;
355 aFontMap: FontMap from Aspect)
356 raises DriverError from Aspect is deferred protected;
357 ---Category: Methods to define the FontIndexs
359 InitializeMarkMap(me: mutable;
360 aMarkMap: MarkMap from Aspect)
361 raises DriverError from Aspect is deferred protected;
362 ---Category: Methods to define the MarkerIndexs
364 ----------------------------
365 -- Category: Inquire methods
366 ----------------------------
368 ColorMap(me) returns mutable ColorMap from Aspect
369 raises UndefinedMap from Aspect is static;
371 TypeMap(me) returns mutable TypeMap from Aspect
372 raises UndefinedMap from Aspect is static;
374 WidthMap(me) returns mutable WidthMap from Aspect
375 raises UndefinedMap from Aspect is static;
377 FontMap(me) returns mutable FontMap from Aspect
378 raises UndefinedMap from Aspect is static;
380 MarkMap(me) returns mutable MarkMap from Aspect
381 raises UndefinedMap from Aspect is static;
383 WorkSpace ( me ; Width,Heigth : out Length from Quantity )
386 ---Purpose: Returns the Available WorkSpace in DWU coordinates
387 ---Category: Inquire methods
389 Convert ( me ; PV : Integer from Standard )
390 returns Length from Quantity is deferred;
392 ---Purpose: Returns the DWU value depending of
394 ---Category: Inquire methods
396 Convert ( me ; DV : Length from Quantity )
397 returns Integer from Standard is deferred;
399 ---Purpose: Returns the PIXEL value depending of
401 ---Category: Inquire methods
403 Convert ( me ; PX, PY : Integer from Standard ;
404 DX, DY : out Length from Quantity ) is deferred ;
406 ---Purpose: Returns the DWU position depending of
407 -- the PIXEL position .
408 ---Category: Inquire methods
410 Convert ( me ; DX, DY : Length from Quantity ;
411 PX, PY : out Integer from Standard ) is deferred;
413 ---Purpose: Returns the PIXEL position depending of
414 -- the DWU position .
415 ---Category: Inquire methods
417 UseMFT ( me ) returns Boolean from Standard is static;
420 ---Purpose: Returns TRUE when the driver must use MDTV fonts
421 -- instead system fonts.
424 myColorMap: ColorMap from Aspect;
425 myTypeMap: TypeMap from Aspect;
426 myWidthMap: WidthMap from Aspect;
427 myFontMap: FontMap from Aspect;
428 myMarkMap: MarkMap from Aspect;
429 myColorMapIsDefined: Boolean from Standard;
430 myWidthMapIsDefined: Boolean from Standard;
431 myTypeMapIsDefined: Boolean from Standard;
432 myFontMapIsDefined: Boolean from Standard;
433 myMarkMapIsDefined: Boolean from Standard;
434 myUseMFT: Boolean from Standard;
436 end Driver from Aspect;