1 -- Created on: 1992-09-18
2 -- Created by: Jean Louis FRENKEL
3 -- Copyright (c) 1992-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.
23 class Drawer from Prs3d inherits TShared from MMgt
25 ---Purpose: A graphic attribute manager which governs how
26 -- objects such as color, width, line thickness and
27 -- deflection are displayed.
28 -- Prs3d_Drawer is the mother class of AIS_Drawer.
29 -- As such, it is its set functions which are called to
30 -- modify display parameters. In the example below we
31 -- can see that the AIS_Drawer is modified to set the
32 -- value of the deviation coefficient using a method
33 -- inherited from Prs3d_Drawer.
36 DatumAspect from Prs3d,
37 LineAspect from Prs3d,
38 TextAspect from Prs3d,
39 PointAspect from Prs3d,
40 ShadingAspect from Prs3d,
42 DimensionAspect from Prs3d,
43 PlaneAspect from Prs3d,
44 ArrowAspect from Prs3d,
45 TypeOfDeflection from Aspect,
46 NameOfColor from Quantity,
47 PlaneAngle from Quantity,
52 Create returns mutable Drawer from Prs3d;
54 ---Category: deviation definition.
56 -- All drawings of curves or patches are made with respect to a maximal
57 -- chordial deviation. This deviation is absolute and given through
58 -- the method: SetMaximalChordialDeviation.
60 -- In the case of drawing shapes, it is allowed to ask for a relative
62 -- This deviation will be: SizeOfObject * DeviationCoefficient where
63 -- DeviationCoefficient can be set through the method: SetDeviationCoefficient.
66 -- For drawing algorithms using discretisation, a default number of
67 -- points has been set to 17. It is possible to use the method SetDiscret
68 -- to change this number.
72 SetTypeOfDeflection (me:mutable;
73 aTypeOfDeflection: TypeOfDeflection from Aspect)
74 ---Purpose: Sets the type of chordal deflection.
75 -- This indicates whether the deflection value is absolute
76 -- or relative to the size of the object.
79 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
81 --- Purpose: Returns the type of chordal deflection.
82 -- This indicates whether the deflection value is absolute
83 -- or relative to the size of the object.
85 SetMaximalChordialDeviation (me: mutable;
86 aChordialDeviation: Length from Quantity)
87 ---Purpose: Defines the maximal chordial deviation when drawing any curve;
88 -- Even if the type of deviation is set to TOD_Relative,
89 -- this value is used by:
91 -- Prs3d_DeflectionCurve
92 -- Prs3d_WFDeflectionSurface
93 -- Prs3d_WFDeflectionRestrictedFace
96 MaximalChordialDeviation (me) returns Length from Quantity
97 ---Purpose: returns the maximal chordial deviation. Default value is 0.1
100 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard)
101 ---Purpose: Sets the deviation coefficient aCoefficient.
104 DeviationCoefficient(me) returns Real from Standard
106 ---Purpose: Returns the deviation coefficient.
107 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard)
108 ---Purpose: Sets the deviation coefficient aCoefficient for removal
109 -- of hidden lines created by different viewpoints in
110 -- different presentations. The Default value is 0.02.
113 HLRDeviationCoefficient(me) returns Real from Standard
115 ---Purpose: Returns the real number value of the hidden line
116 -- removal deviation coefficient.
117 SetHLRAngle(me: mutable; anAngle: Real from Standard)
118 ---Purpose: Sets anAngle, the angle of maximum chordal
119 -- deviation for removal of hidden lines created by
120 -- different viewpoints in different presentations. The
121 -- default value is 20*PI/180.
124 HLRAngle(me) returns Real from Standard
126 ---Purpose: Returns the real number value of the deviation angle
127 -- in hidden line removal views. The default value is 20*PI/180.
129 SetDeviationAngle(me: mutable; anAngle: Real from Standard)
130 ---Purpose: Sets deviation angle
133 DeviationAngle(me) returns Real from Standard
134 ---Purpose: Returns the value for deviation angle.
137 SetDiscretisation(me: mutable; d: Integer from Standard)
138 ---Purpose: Sets the discretisation parameter d.
141 Discretisation(me) returns Integer from Standard
143 ---Purpose: Returns the discretisation setting.
144 SetMaximalParameterValue(me: mutable; Value: Real from Standard)
145 ---Purpose: defines the maximum value allowed for the first and last
146 -- parameters of an infinite curve. Default value: 500.
149 MaximalParameterValue(me) returns Real from Standard
151 --- Purpose: Sets the maximum value allowed for the first and last
152 -- parameters of an infinite curve. By default, this value is 500000.
154 SetIsoOnPlane (me: mutable; OnOff: Boolean from Standard)
155 ---Purpose: Sets IsoOnPlane on or off by setting the parameter
156 -- OnOff to true or false.
159 IsoOnPlane(me) returns Boolean from Standard
160 ---Purpose: Returns True if the drawing of isos on planes is enabled.
163 SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d)
165 ---Purpose: Sets the type of HLR algorithm
166 -- used by drawer's interactive objects
168 TypeOfHLR(me) returns TypeOfHLR from Prs3d
170 ---Purpose: Gets the myTypeOfHLR value
174 -- Attributes for the U Isoparametric lines of patches.
176 UIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
177 ---Purpose: Defines the attributes which are used when drawing an
178 -- U isoparametric curve of a face. Defines the number
179 -- of U isoparametric curves to be drawn for a single face.
180 -- The LineAspect for U isoparametric lines can be edited
181 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
182 -- The default values are:
183 -- COLOR : Quantity_NOC_GRAY75
184 -- TYPE OF LINE: Aspect_TOL_SOLID
188 -- These attributes are used by the following algorithms:
189 -- Prs3d_WFDeflectionSurface
190 -- Prs3d_WFDeflectionRestrictedFace
195 SetUIsoAspect (me:mutable; anAspect: IsoAspect from Prs3d)
198 -- Attributes for the V Isoparametric line of patches.
201 VIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
202 ---Purpose: Defines the attributes which are used when drawing an
203 -- V isoparametric curve of a face. Defines the number
204 -- of V isoparametric curves to be drawn for a single face.
205 -- The LineAspect for V isoparametric lines can be edited
206 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
207 -- The default values are:
208 -- COLOR : Quantity_NOC_GRAY82
209 -- TYPE OF LINE: Aspect_TOL_SOLID
213 -- These attributes are used by the following algorithms:
214 -- Prs3d_WFDeflectionSurface
215 -- Prs3d_WFDeflectionRestrictedFace
218 SetVIsoAspect (me:mutable;anAspect: IsoAspect from Prs3d)
220 ---Purpose: Sets the appearance of V isoparameters - anAspect.
222 FreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
223 ---Purpose: Stores the values for presentation of free boundaries,
224 -- in other words, boundaries which are not shared.
225 -- The LineAspect for the free boundaries can be edited.
226 -- The default values are:
227 -- Color: Quantity_NOC_GREEN
228 -- Type of line: Aspect_TOL_SOLID
230 -- These attributes are used by the algorithm Prs3d_WFShape
233 SetFreeBoundaryAspect(me:mutable;anAspect: LineAspect from Prs3d)
235 --- Purpose: Sets the parameter anAspect for the display of free boundaries.
237 SetFreeBoundaryDraw (me: mutable; OnOff: Boolean from Standard)
238 ---Purpose: Sets free boundary drawing on or off by setting the
239 -- parameter OnOff to true or false.
243 FreeBoundaryDraw(me) returns Boolean from Standard
244 ---Purpose: Returns True if the drawing of the shared boundaries
245 -- is disabled. True is the default setting.
249 -- Attributes for the wires
251 WireAspect (me:mutable) returns mutable LineAspect from Prs3d
252 ---Purpose: Returns wire aspect settings.
253 -- The LineAspect for the wire can be edited.
254 -- The default values are:
255 -- Color: Quantity_NOC_RED
256 -- Type of line: Aspect_TOL_SOLID
258 -- These attributes are used by the algorithm Prs3d_WFShape
261 SetWireAspect(me:mutable;anAspect: LineAspect from Prs3d)
264 --- Purpose: Sets the parameter anAspect for display of wires.
266 SetWireDraw (me: mutable; OnOff: Boolean from Standard)
267 ---Purpose: Sets WireDraw on or off by setting the parameter
268 -- OnOff to true or false.
272 WireDraw(me) returns Boolean from Standard
273 ---Purpose: returns True if the drawing of the wire is enabled.
277 -- Attributes for the unfree boundaries
279 UnFreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
280 ---Purpose: Returns settings for shared boundary line aspects.
281 -- The LineAspect for the unfree boundaries can be edited.
282 -- The default values are:
283 -- Color: Quantity_NOC_YELLOW
284 -- Type of line: Aspect_TOL_SOLID
286 -- These attributes are used by the algorithm Prs3d_WFShape
289 SetUnFreeBoundaryAspect(me:mutable; anAspect: LineAspect from Prs3d)
291 --- Purpose: Sets the parameter anAspect for the display of shared boundaries.
292 SetUnFreeBoundaryDraw (me: mutable; OnOff: Boolean from Standard)
293 ---Purpose: Sets FreeBoundaryDraw on or off by setting the
294 -- parameter OnOff to true or false.
295 -- By default the unfree boundaries are drawn.
299 UnFreeBoundaryDraw(me) returns Boolean from Standard
300 ---Purpose: Returns True if the drawing of the shared boundaries is enabled.
301 -- True is the default setting.
306 -- Attributes for the lines.
309 LineAspect(me:mutable) returns mutable LineAspect from Prs3d
310 ---Purpose: Returns settings for line aspects.
311 -- These settings can be edited. The default values are:
312 -- Color: Quantity_NOC_YELLOW
313 -- Type of line: Aspect_TOL_SOLID
315 -- These attributes are used by the following algorithms:
322 SetLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
324 --- Purpose: Sets the parameter anAspect for display attributes of lines.
326 TextAspect(me:mutable) returns mutable TextAspect from Prs3d
327 --- Purpose: Returns settings for text aspect.
328 -- These settings can be edited. The default value is:
329 -- - Color: Quantity_NOC_YELLOW
333 SetTextAspect(me:mutable; anAspect: TextAspect from Prs3d)
335 --- Purpose: Sets the parameter anAspect for display attributes of text.
337 SetLineArrowDraw (me: mutable; OnOff: Boolean from Standard)
338 ---Purpose: enables the drawing of an arrow at the end of each line.
339 -- By default the arrows are not drawn.
343 LineArrowDraw(me) returns Boolean from Standard
344 ---Purpose: Sets LineArrowDraw on or off by setting the
345 -- parameter OnOff to true or false.
348 ArrowAspect(me:mutable) returns mutable ArrowAspect from Prs3d
350 ---Purpose: Returns the attributes for display of arrows.
352 SetArrowAspect(me:mutable; anAspect: ArrowAspect from Prs3d)
354 ---Purpose: Sets the parameter anAspect for display attributes of arrows.
356 PointAspect(me:mutable) returns mutable PointAspect from Prs3d
357 ---Purpose: Returns the point aspect setting. The default values are
358 -- Color: Quantity_NOC_YELLOW
359 -- Type of marker: Aspect_TOM_PLUS
361 -- These attributes are used by the algorithms Prs3d_Point.
364 SetPointAspect(me:mutable; anAspect: PointAspect from Prs3d)
366 --- Purpose: Sets the parameter anAspect for display attributes of points
368 ShadingAspect (me:mutable) returns mutable ShadingAspect from Prs3d
370 ---Purpose: Returns settings for shading aspects.
371 -- These settings can be edited. The default values are:
372 -- - Color: Quantity_NOC_YELLOW
373 -- - Material: Graphic3d_NOM_BRASS
374 -- Shading aspect is obtained through decomposition of
375 -- 3d faces into triangles, each side of each triangle
376 -- being a chord of the corresponding curved edge in
377 -- the face. Reflection of light in each projector
378 -- perspective is then calculated for each of the
379 -- resultant triangular planes.
382 SetShadingAspect(me:mutable; anAspect: ShadingAspect from Prs3d)
384 ---Purpose: Sets the parameter anAspect for display attributes of shading.
386 SetShadingAspectGlobal(me: mutable; aValue: Boolean from Standard)
387 ---Purpose: indicates that the ShadingAspect will be apply
388 -- to the whole presentation. This allows to modify
389 -- the aspect without recomputing the content of the presentation.
392 ShadingAspectGlobal(me) returns Boolean from Standard
395 -- Attributes for hidden lines removal. These attributes are used when
396 -- using an algorithm such Prs3d_HLRShape for example.
399 DrawHiddenLine(me) returns Boolean from Standard
400 ---Purpose: returns Standard_True if the hidden lines are to be drawn.
401 -- By default the hidden lines are not drawn.
404 EnableDrawHiddenLine(me: mutable)
405 ---Purpose: Enables the DrawHiddenLine function.
408 DisableDrawHiddenLine(me: mutable)
409 ---Purpose: Disables the DrawHiddenLine function.
412 HiddenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
413 ---Purpose: Returns settings for hidden line aspects.
414 -- These settings can be edited. The default values are:
415 -- Color: Quantity_NOC_YELLOW
416 -- Type of line: Aspect_TOL_DASH
420 SetHiddenLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
422 ---Purpose: Sets the parameter anAspect for the display of
423 -- hidden lines in hidden line removal mode.
425 SeenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
426 ---Purpose: Returns settings for seen line aspects.
427 -- These settings can be edited. The default values are:
428 -- Color: Quantity_NOC_YELLOW
429 -- Type of line: Aspect_TOL_SOLID
433 SetSeenLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
435 --- Purpose: Sets the parameter anAspect for the display of seen
436 -- lines in hidden line removal mode.
438 PlaneAspect(me:mutable) returns mutable PlaneAspect from Prs3d
440 ---Purpose: Returns settings for the appearance of planes.
442 SetPlaneAspect(me:mutable; anAspect: PlaneAspect from Prs3d)
444 ---Purpose: Sets the parameter anAspect for the display of planes.
446 VectorAspect(me:mutable) returns mutable LineAspect from Prs3d
447 ---Purpose: Returns settings for the appearance of vectors.
448 -- These settings can be edited. The default values are:
449 -- Color: Quantity_NOC_SKYBLUE
450 -- Type of line: Aspect_TOL_SOLID
454 SetVectorAspect(me:mutable; anAspect: LineAspect from Prs3d)
456 ---Purpose: Sets the modality anAspect for the display of vectors.
459 -- Attributes for the presentation of a Datum.
462 DatumAspect(me:mutable) returns mutable DatumAspect from Prs3d
463 ---Purpose: Returns settings for the appearance of datums.
464 -- These settings can be edited. The default values for
465 -- the three axes are:
466 -- Color: Quantity_NOC_PEACHPUFF
467 -- Type of line: Aspect_TOL_SOLID
471 SetDatumAspect(me:mutable; anAspect: DatumAspect from Prs3d)
473 ---Purpose: Sets the modality anAspect for the display of datums.
475 DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
476 ---Purpose: Returns settings for the appearance of dimensions.
479 SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d)
481 ---Purpose: Sets the modality anAspect for display of dimensions.
483 SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
484 ---Purpose: The LineAspect for the wire can be edited.
485 -- The default values are:
486 -- Color: Quantity_NOC_ORANGE
487 -- Type of line: Aspect_TOL_SOLID
489 -- These attributes are used by the algorithm Prs3d_WFShape
492 SetSectionAspect(me:mutable;anAspect: LineAspect from Prs3d)
494 ---Purpose: Sets the parameter anAspect for display attributes of sections.
496 SetFaceBoundaryDraw (me : mutable;
497 theIsEnabled : Boolean from Standard)
499 ---Purpose: Enables or disables face boundary drawing for shading presentations.
500 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
503 IsFaceBoundaryDraw (me) returns Boolean from Standard
505 ---Purpose: Checks whether the face boundary drawing is enabled or not.
507 SetFaceBoundaryAspect (me : mutable;
508 theAspect : LineAspect from Prs3d)
510 ---Purpose: Sets line aspect for face boundaries.
511 -- theAspect is the line aspect that determines the look of the face boundaries.
513 FaceBoundaryAspect (me : mutable) returns mutable LineAspect from Prs3d
515 ---Purpose: Returns line aspect of face boundaries.
518 myUIsoAspect: IsoAspect from Prs3d is protected;
519 myVIsoAspect: IsoAspect from Prs3d is protected;
520 myNbPoints : Integer from Standard is protected;
521 myIsoOnPlane: Boolean from Standard is protected;
522 myFreeBoundaryAspect: LineAspect from Prs3d is protected;
523 myFreeBoundaryDraw: Boolean from Standard is protected;
524 myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
525 myUnFreeBoundaryDraw: Boolean from Standard is protected;
526 myWireAspect: LineAspect from Prs3d is protected;
527 myWireDraw: Boolean from Standard is protected;
528 myLineAspect: LineAspect from Prs3d is protected;
529 myTextAspect: TextAspect from Prs3d is protected;
530 myShadingAspect: ShadingAspect from Prs3d is protected;
531 myShadingAspectGlobal: Boolean from Standard is protected;
532 myChordialDeviation: Length from Quantity is protected;
533 myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
534 myMaximalParameterValue: Real from Standard is protected;
536 myDeviationCoefficient: Real from Standard is protected;
537 myHLRDeviationCoefficient: Real from Standard is protected;
539 myDeviationAngle: Real from Standard is protected;
540 myHLRAngle: Real from Standard is protected;
542 myPointAspect: PointAspect from Prs3d is protected;
543 myPlaneAspect: PlaneAspect from Prs3d is protected;
544 myArrowAspect: ArrowAspect from Prs3d is protected;
545 myLineDrawArrow: Boolean from Standard is protected;
546 myDrawHiddenLine: Boolean from Standard is protected;
547 myHiddenLineAspect: LineAspect from Prs3d is protected;
548 mySeenLineAspect: LineAspect from Prs3d is protected;
549 myVectorAspect: LineAspect from Prs3d is protected;
550 myDatumAspect: DatumAspect from Prs3d is protected;
551 myDatumScale: Real from Standard is protected;
552 myDimensionAspect: DimensionAspect from Prs3d is protected;
553 mySectionAspect: LineAspect from Prs3d is protected;
554 myFaceBoundaryDraw : Boolean from Standard is protected;
555 myFaceBoundaryAspect : LineAspect from Prs3d is protected;
556 myTypeOfHLR : TypeOfHLR from Prs3d is protected;