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 LengthAspect from Prs3d,
43 AngleAspect from Prs3d,
44 PlaneAspect from Prs3d,
45 RadiusAspect from Prs3d,
46 ArrowAspect from Prs3d,
47 TypeOfDeflection from Aspect,
48 NameOfColor from Quantity,
49 PlaneAngle from Quantity,
53 Create returns mutable Drawer from Prs3d;
55 ---Category: deviation definition.
57 -- All drawings of curves or patches are made with respect to a maximal
58 -- chordial deviation. This deviation is absolute and given through
59 -- the method: SetMaximalChordialDeviation.
61 -- In the case of drawing shapes, it is allowed to ask for a relative
63 -- This deviation will be: SizeOfObject * DeviationCoefficient where
64 -- DeviationCoefficient can be set through the method: SetDeviationCoefficient.
67 -- For drawing algorithms using discretisation, a default number of
68 -- points has been set to 17. It is possible to use the method SetDiscret
69 -- to change this number.
73 SetTypeOfDeflection (me:mutable;
74 aTypeOfDeflection: TypeOfDeflection from Aspect)
75 ---Purpose: Sets the type of chordal deflection.
76 -- This indicates whether the deflection value is absolute
77 -- or relative to the size of the object.
80 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
82 --- Purpose: Returns the type of chordal deflection.
83 -- This indicates whether the deflection value is absolute
84 -- or relative to the size of the object.
86 SetMaximalChordialDeviation (me: mutable;
87 aChordialDeviation: Length from Quantity)
88 ---Purpose: Defines the maximal chordial deviation when drawing any curve;
89 -- Even if the type of deviation is set to TOD_Relative,
90 -- this value is used by:
92 -- Prs3d_DeflectionCurve
93 -- Prs3d_WFDeflectionSurface
94 -- Prs3d_WFDeflectionRestrictedFace
97 MaximalChordialDeviation (me) returns Length from Quantity
98 ---Purpose: returns the maximal chordial deviation. Default value is 0.1
101 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard)
102 ---Purpose: Sets the deviation coefficient aCoefficient.
105 DeviationCoefficient(me) returns Real from Standard
107 ---Purpose: Returns the deviation coefficient.
108 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard)
109 ---Purpose: Sets the deviation coefficient aCoefficient for removal
110 -- of hidden lines created by different viewpoints in
111 -- different presentations. The Default value is 0.02.
114 HLRDeviationCoefficient(me) returns Real from Standard
116 ---Purpose: Returns the real number value of the hidden line
117 -- removal deviation coefficient.
118 SetHLRAngle(me: mutable; anAngle: Real from Standard)
119 ---Purpose: Sets anAngle, the angle of maximum chordal
120 -- deviation for removal of hidden lines created by
121 -- different viewpoints in different presentations. The
122 -- default value is 20*PI/180.
125 HLRAngle(me) returns Real from Standard
127 ---Purpose: Returns the real number value of the deviation angle
128 -- in hidden line removal views. The default value is 20*PI/180.
130 SetDeviationAngle(me: mutable; anAngle: Real from Standard)
131 ---Purpose: Sets deviation angle
134 DeviationAngle(me) returns Real from Standard
135 ---Purpose: Returns the value for deviation angle.
138 SetDiscretisation(me: mutable; d: Integer from Standard)
139 ---Purpose: Sets the discretisation parameter d.
142 Discretisation(me) returns Integer from Standard
144 ---Purpose: Returns the discretisation setting.
145 SetMaximalParameterValue(me: mutable; Value: Real from Standard)
146 ---Purpose: defines the maximum value allowed for the first and last
147 -- parameters of an infinite curve. Default value: 500.
150 MaximalParameterValue(me) returns Real from Standard
152 --- Purpose: Sets the maximum value allowed for the first and last
153 -- parameters of an infinite curve. By default, this value is 500000.
155 SetIsoOnPlane (me: mutable; OnOff: Boolean from Standard)
156 ---Purpose: Sets IsoOnPlane on or off by setting the parameter
157 -- OnOff to true or false.
160 IsoOnPlane(me) returns Boolean from Standard
161 ---Purpose: Returns True if the drawing of isos on planes is enabled.
166 -- Attributes for the U Isoparametric lines of patches.
168 UIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
169 ---Purpose: Defines the attributes which are used when drawing an
170 -- U isoparametric curve of a face. Defines the number
171 -- of U isoparametric curves to be drawn for a single face.
172 -- The LineAspect for U isoparametric lines can be edited
173 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
174 -- The default values are:
175 -- COLOR : Quantity_NOC_GRAY75
176 -- TYPE OF LINE: Aspect_TOL_SOLID
180 -- These attributes are used by the following algorithms:
181 -- Prs3d_WFDeflectionSurface
182 -- Prs3d_WFDeflectionRestrictedFace
187 SetUIsoAspect (me:mutable; anAspect: IsoAspect from Prs3d)
190 -- Attributes for the V Isoparametric line of patches.
193 VIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
194 ---Purpose: Defines the attributes which are used when drawing an
195 -- V isoparametric curve of a face. Defines the number
196 -- of V isoparametric curves to be drawn for a single face.
197 -- The LineAspect for V isoparametric lines can be edited
198 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
199 -- The default values are:
200 -- COLOR : Quantity_NOC_GRAY82
201 -- TYPE OF LINE: Aspect_TOL_SOLID
205 -- These attributes are used by the following algorithms:
206 -- Prs3d_WFDeflectionSurface
207 -- Prs3d_WFDeflectionRestrictedFace
210 SetVIsoAspect (me:mutable;anAspect: IsoAspect from Prs3d)
212 ---Purpose: Sets the appearance of V isoparameters - anAspect.
214 FreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
215 ---Purpose: Stores the values for presentation of free boundaries,
216 -- in other words, boundaries which are not shared.
217 -- The LineAspect for the free boundaries can be edited.
218 -- The default values are:
219 -- Color: Quantity_NOC_GREEN
220 -- Type of line: Aspect_TOL_SOLID
222 -- These attributes are used by the algorithm Prs3d_WFShape
225 SetFreeBoundaryAspect(me:mutable;anAspect: LineAspect from Prs3d)
227 --- Purpose: Sets the parameter anAspect for the display of free boundaries.
229 SetFreeBoundaryDraw (me: mutable; OnOff: Boolean from Standard)
230 ---Purpose: Sets free boundary drawing on or off by setting the
231 -- parameter OnOff to true or false.
235 FreeBoundaryDraw(me) returns Boolean from Standard
236 ---Purpose: Returns True if the drawing of the shared boundaries
237 -- is disabled. True is the default setting.
241 -- Attributes for the wires
243 WireAspect (me:mutable) returns mutable LineAspect from Prs3d
244 ---Purpose: Returns wire aspect settings.
245 -- The LineAspect for the wire can be edited.
246 -- The default values are:
247 -- Color: Quantity_NOC_RED
248 -- Type of line: Aspect_TOL_SOLID
250 -- These attributes are used by the algorithm Prs3d_WFShape
253 SetWireAspect(me:mutable;anAspect: LineAspect from Prs3d)
256 --- Purpose: Sets the parameter anAspect for display of wires.
258 SetWireDraw (me: mutable; OnOff: Boolean from Standard)
259 ---Purpose: Sets WireDraw on or off by setting the parameter
260 -- OnOff to true or false.
264 WireDraw(me) returns Boolean from Standard
265 ---Purpose: returns True if the drawing of the wire is enabled.
269 -- Attributes for the unfree boundaries
271 UnFreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
272 ---Purpose: Returns settings for shared boundary line aspects.
273 -- The LineAspect for the unfree boundaries can be edited.
274 -- The default values are:
275 -- Color: Quantity_NOC_YELLOW
276 -- Type of line: Aspect_TOL_SOLID
278 -- These attributes are used by the algorithm Prs3d_WFShape
281 SetUnFreeBoundaryAspect(me:mutable; anAspect: LineAspect from Prs3d)
283 --- Purpose: Sets the parameter anAspect for the display of shared boundaries.
284 SetUnFreeBoundaryDraw (me: mutable; OnOff: Boolean from Standard)
285 ---Purpose: Sets FreeBoundaryDraw on or off by setting the
286 -- parameter OnOff to true or false.
287 -- By default the unfree boundaries are drawn.
291 UnFreeBoundaryDraw(me) returns Boolean from Standard
292 ---Purpose: Returns True if the drawing of the shared boundaries is enabled.
293 -- True is the default setting.
298 -- Attributes for the lines.
301 LineAspect(me:mutable) returns mutable LineAspect from Prs3d
302 ---Purpose: Returns settings for line aspects.
303 -- These settings can be edited. The default values are:
304 -- Color: Quantity_NOC_YELLOW
305 -- Type of line: Aspect_TOL_SOLID
307 -- These attributes are used by the following algorithms:
314 SetLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
316 --- Purpose: Sets the parameter anAspect for display attributes of lines.
318 TextAspect(me:mutable) returns mutable TextAspect from Prs3d
319 --- Purpose: Returns settings for text aspect.
320 -- These settings can be edited. The default value is:
321 -- - Color: Quantity_NOC_YELLOW
325 SetTextAspect(me:mutable; anAspect: TextAspect from Prs3d)
327 --- Purpose: Sets the parameter anAspect for display attributes of text.
329 SetLineArrowDraw (me: mutable; OnOff: Boolean from Standard)
330 ---Purpose: enables the drawing of an arrow at the end of each line.
331 -- By default the arrows are not drawn.
335 LineArrowDraw(me) returns Boolean from Standard
336 ---Purpose: Sets LineArrowDraw on or off by setting the
337 -- parameter OnOff to true or false.
340 ArrowAspect(me:mutable) returns mutable ArrowAspect from Prs3d
342 ---Purpose: Returns the attributes for display of arrows.
344 SetArrowAspect(me:mutable; anAspect: ArrowAspect from Prs3d)
346 ---Purpose: Sets the parameter anAspect for display attributes of arrows.
348 PointAspect(me:mutable) returns mutable PointAspect from Prs3d
349 ---Purpose: Returns the point aspect setting. The default values are
350 -- Color: Quantity_NOC_YELLOW
351 -- Type of marker: Aspect_TOM_PLUS
353 -- These attributes are used by the algorithms Prs3d_Point.
356 SetPointAspect(me:mutable; anAspect: PointAspect from Prs3d)
358 --- Purpose: Sets the parameter anAspect for display attributes of points
360 ShadingAspect (me:mutable) returns mutable ShadingAspect from Prs3d
362 ---Purpose: Returns settings for shading aspects.
363 -- These settings can be edited. The default values are:
364 -- - Color: Quantity_NOC_YELLOW
365 -- - Material: Graphic3d_NOM_BRASS
366 -- Shading aspect is obtained through decomposition of
367 -- 3d faces into triangles, each side of each triangle
368 -- being a chord of the corresponding curved edge in
369 -- the face. Reflection of light in each projector
370 -- perspective is then calculated for each of the
371 -- resultant triangular planes.
374 SetShadingAspect(me:mutable; anAspect: ShadingAspect from Prs3d)
376 ---Purpose: Sets the parameter anAspect for display attributes of shading.
378 SetShadingAspectGlobal(me: mutable; aValue: Boolean from Standard)
379 ---Purpose: indicates that the ShadingAspect will be apply
380 -- to the whole presentation. This allows to modify
381 -- the aspect without recomputing the content of the presentation.
384 ShadingAspectGlobal(me) returns Boolean from Standard
387 -- Attributes for hidden lines removal. These attributes are used when
388 -- using an algorithm such Prs3d_HLRShape for example.
391 DrawHiddenLine(me) returns Boolean from Standard
392 ---Purpose: returns Standard_True if the hidden lines are to be drawn.
393 -- By default the hidden lines are not drawn.
396 EnableDrawHiddenLine(me: mutable)
397 ---Purpose: Enables the DrawHiddenLine function.
400 DisableDrawHiddenLine(me: mutable)
401 ---Purpose: Disables the DrawHiddenLine function.
404 HiddenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
405 ---Purpose: Returns settings for hidden line aspects.
406 -- These settings can be edited. The default values are:
407 -- Color: Quantity_NOC_YELLOW
408 -- Type of line: Aspect_TOL_DASH
412 SetHiddenLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
414 ---Purpose: Sets the parameter anAspect for the display of
415 -- hidden lines in hidden line removal mode.
417 SeenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
418 ---Purpose: Returns settings for seen line aspects.
419 -- These settings can be edited. The default values are:
420 -- Color: Quantity_NOC_YELLOW
421 -- Type of line: Aspect_TOL_SOLID
425 SetSeenLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
427 --- Purpose: Sets the parameter anAspect for the display of seen
428 -- lines in hidden line removal mode.
430 PlaneAspect(me:mutable) returns mutable PlaneAspect from Prs3d
432 ---Purpose: Returns settings for the appearance of planes.
434 SetPlaneAspect(me:mutable; anAspect: PlaneAspect from Prs3d)
436 ---Purpose: Sets the parameter anAspect for the display of planes.
438 VectorAspect(me:mutable) returns mutable LineAspect from Prs3d
439 ---Purpose: Returns settings for the appearance of vectors.
440 -- These settings can be edited. The default values are:
441 -- Color: Quantity_NOC_SKYBLUE
442 -- Type of line: Aspect_TOL_SOLID
446 SetVectorAspect(me:mutable; anAspect: LineAspect from Prs3d)
448 ---Purpose: Sets the modality anAspect for the display of vectors.
451 -- Attributes for the presentation of a Datum.
454 DatumAspect(me:mutable) returns mutable DatumAspect from Prs3d
455 ---Purpose: Returns settings for the appearance of datums.
456 -- These settings can be edited. The default values for
457 -- the three axes are:
458 -- Color: Quantity_NOC_PEACHPUFF
459 -- Type of line: Aspect_TOL_SOLID
463 SetDatumAspect(me:mutable; anAspect: DatumAspect from Prs3d)
465 ---Purpose: Sets the modality anAspect for the display of datums.
467 LengthAspect(me:mutable) returns mutable LengthAspect from Prs3d
468 ---Purpose: Returns settings for the appearance of lengths.
471 SetLengthAspect(me:mutable; anAspect: LengthAspect from Prs3d)
474 ---Purpose: Sets the modality anAspect for display of lengths.
476 AngleAspect(me:mutable) returns mutable AngleAspect from Prs3d
477 ---Purpose: Returns settings for lines used to display angles.
480 SetAngleAspect(me:mutable; anAspect: AngleAspect from Prs3d)
482 ---Purpose: Sets the modality anAspect for the display of angles.
484 RadiusAspect(me) returns mutable RadiusAspect from Prs3d
485 ---Purpose: Returns settings for lines which serve to display radii.
488 SetRadiusAspect(me:mutable; anAspect: RadiusAspect from Prs3d)
490 --- Purpose: Sets the parameter anAspect for display attributes of radii.
492 SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
493 ---Purpose: The LineAspect for the wire can be edited.
494 -- The default values are:
495 -- Color: Quantity_NOC_ORANGE
496 -- Type of line: Aspect_TOL_SOLID
498 -- These attributes are used by the algorithm Prs3d_WFShape
501 SetSectionAspect(me:mutable;anAspect: LineAspect from Prs3d)
503 ---Purpose: Sets the parameter anAspect for display attributes of sections.
505 SetFaceBoundaryDraw (me : mutable;
506 theIsEnabled : Boolean from Standard)
508 ---Purpose: Enables or disables face boundary drawing for shading presentations.
509 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
512 IsFaceBoundaryDraw (me) returns Boolean from Standard
514 ---Purpose: Checks whether the face boundary drawing is enabled or not.
516 SetFaceBoundaryAspect (me : mutable;
517 theAspect : LineAspect from Prs3d)
519 ---Purpose: Sets line aspect for face boundaries.
520 -- theAspect is the line aspect that determines the look of the face boundaries.
522 FaceBoundaryAspect (me : mutable) returns mutable LineAspect from Prs3d
524 ---Purpose: Returns line aspect of face boundaries.
527 myUIsoAspect: IsoAspect from Prs3d is protected;
528 myVIsoAspect: IsoAspect from Prs3d is protected;
529 myNbPoints : Integer from Standard is protected;
530 myIsoOnPlane: Boolean from Standard is protected;
531 myFreeBoundaryAspect: LineAspect from Prs3d is protected;
532 myFreeBoundaryDraw: Boolean from Standard is protected;
533 myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
534 myUnFreeBoundaryDraw: Boolean from Standard is protected;
535 myWireAspect: LineAspect from Prs3d is protected;
536 myWireDraw: Boolean from Standard is protected;
537 myLineAspect: LineAspect from Prs3d is protected;
538 myTextAspect: TextAspect from Prs3d is protected;
539 myShadingAspect: ShadingAspect from Prs3d is protected;
540 myShadingAspectGlobal: Boolean from Standard is protected;
541 myChordialDeviation: Length from Quantity is protected;
542 myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
543 myMaximalParameterValue: Real from Standard is protected;
545 myDeviationCoefficient: Real from Standard is protected;
546 myHLRDeviationCoefficient: Real from Standard is protected;
548 myDeviationAngle: Real from Standard is protected;
549 myHLRAngle: Real from Standard is protected;
551 myPointAspect: PointAspect from Prs3d is protected;
552 myPlaneAspect: PlaneAspect from Prs3d is protected;
553 myArrowAspect: ArrowAspect from Prs3d is protected;
554 myLineDrawArrow: Boolean from Standard is protected;
555 myDrawHiddenLine: Boolean from Standard is protected;
556 myHiddenLineAspect: LineAspect from Prs3d is protected;
557 mySeenLineAspect: LineAspect from Prs3d is protected;
558 myVectorAspect: LineAspect from Prs3d is protected;
559 myDatumAspect: DatumAspect from Prs3d is protected;
560 myDatumScale: Real from Standard is protected;
561 myLengthAspect: LengthAspect from Prs3d is protected;
562 myAngleAspect: AngleAspect from Prs3d is protected;
563 myRadiusAspect: RadiusAspect from Prs3d is protected;
564 mySectionAspect: LineAspect from Prs3d is protected;
565 myFaceBoundaryDraw : Boolean from Standard is protected;
566 myFaceBoundaryAspect : LineAspect from Prs3d is protected;