1 -- Created on: 1992-09-18
2 -- Created by: Jean Louis FRENKEL
3 -- Copyright (c) 1992-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 class Drawer from Prs3d inherits TShared from MMgt
19 ---Purpose: A graphic attribute manager which governs how
20 -- objects such as color, width, line thickness and
21 -- deflection are displayed.
22 -- Prs3d_Drawer is the mother class of AIS_Drawer.
23 -- As such, it is its set functions which are called to
24 -- modify display parameters. In the example below we
25 -- can see that the AIS_Drawer is modified to set the
26 -- value of the deviation coefficient using a method
27 -- inherited from Prs3d_Drawer.
28 -- A drawer includes an instance of the Aspect classes
29 -- with particular default values.
32 DatumAspect from Prs3d,
33 LineAspect from Prs3d,
34 TextAspect from Prs3d,
35 PointAspect from Prs3d,
36 ShadingAspect from Prs3d,
38 DimensionAspect from Prs3d,
39 PlaneAspect from Prs3d,
40 ArrowAspect from Prs3d,
41 TypeOfDeflection from Aspect,
42 NameOfColor from Quantity,
43 PlaneAngle from Quantity,
46 DimensionUnits from Prs3d,
47 VertexDrawMode from Prs3d,
48 AsciiString from TCollection,
52 Create returns 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 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 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 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 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 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 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 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: Returns True if drawing an arrow at the end of each edge is enabled
345 -- and False otherwise (the default).
348 ArrowAspect(me:mutable) returns 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 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 SetVertexDrawMode(me: mutable; theMode: VertexDrawMode from Prs3d)
369 ---Purpose: Sets the mode of visualization of vertices of a TopoDS_Shape instance.
370 -- By default, only stand-alone vertices (not belonging topologically to an edge) are drawn,
371 -- that corresponds to <b>Prs3d_VDM_Standalone</b> mode.
372 -- Switching to <b>Prs3d_VDM_Standalone</b> mode makes all shape's vertices visible.
373 -- To inherit this parameter from the global drawer instance ("the link") when it is present,
374 -- <b>Prs3d_VDM_Inherited</b> value should be used.
377 VertexDrawMode(me) returns VertexDrawMode from Prs3d
378 ---Purpose: Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
381 ShadingAspect (me:mutable) returns ShadingAspect from Prs3d
383 ---Purpose: Returns settings for shading aspects.
384 -- These settings can be edited. The default values are:
385 -- - Color: Quantity_NOC_YELLOW
386 -- - Material: Graphic3d_NOM_BRASS
387 -- Shading aspect is obtained through decomposition of
388 -- 3d faces into triangles, each side of each triangle
389 -- being a chord of the corresponding curved edge in
390 -- the face. Reflection of light in each projector
391 -- perspective is then calculated for each of the
392 -- resultant triangular planes.
395 SetShadingAspect(me:mutable; anAspect: ShadingAspect from Prs3d)
397 ---Purpose: Sets the parameter anAspect for display attributes of shading.
399 SetShadingAspectGlobal(me: mutable; aValue: Boolean from Standard)
400 ---Purpose: indicates that the ShadingAspect will be apply
401 -- to the whole presentation. This allows to modify
402 -- the aspect without recomputing the content of the presentation.
405 ShadingAspectGlobal(me) returns Boolean from Standard
408 -- Attributes for hidden lines removal. These attributes are used when
409 -- using an algorithm such Prs3d_HLRShape for example.
412 DrawHiddenLine(me) returns Boolean from Standard
413 ---Purpose: returns Standard_True if the hidden lines are to be drawn.
414 -- By default the hidden lines are not drawn.
417 EnableDrawHiddenLine(me: mutable)
418 ---Purpose: Enables the DrawHiddenLine function.
421 DisableDrawHiddenLine(me: mutable)
422 ---Purpose: Disables the DrawHiddenLine function.
425 HiddenLineAspect(me:mutable) returns LineAspect from Prs3d
426 ---Purpose: Returns settings for hidden line aspects.
427 -- These settings can be edited. The default values are:
428 -- Color: Quantity_NOC_YELLOW
429 -- Type of line: Aspect_TOL_DASH
433 SetHiddenLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
435 ---Purpose: Sets the parameter anAspect for the display of
436 -- hidden lines in hidden line removal mode.
438 SeenLineAspect(me:mutable) returns LineAspect from Prs3d
439 ---Purpose: Returns settings for seen line aspects.
440 -- These settings can be edited. The default values are:
441 -- Color: Quantity_NOC_YELLOW
442 -- Type of line: Aspect_TOL_SOLID
446 SetSeenLineAspect(me:mutable; anAspect: LineAspect from Prs3d)
448 --- Purpose: Sets the parameter anAspect for the display of seen
449 -- lines in hidden line removal mode.
451 PlaneAspect(me:mutable) returns PlaneAspect from Prs3d
453 ---Purpose: Returns settings for the appearance of planes.
455 SetPlaneAspect(me:mutable; anAspect: PlaneAspect from Prs3d)
457 ---Purpose: Sets the parameter anAspect for the display of planes.
459 VectorAspect(me:mutable) returns LineAspect from Prs3d
460 ---Purpose: Returns settings for the appearance of vectors.
461 -- These settings can be edited. The default values are:
462 -- Color: Quantity_NOC_SKYBLUE
463 -- Type of line: Aspect_TOL_SOLID
467 SetVectorAspect(me:mutable; anAspect: LineAspect from Prs3d)
469 ---Purpose: Sets the modality anAspect for the display of vectors.
472 -- Attributes for the presentation of a Datum.
475 DatumAspect(me:mutable) returns DatumAspect from Prs3d
476 ---Purpose: Returns settings for the appearance of datums.
477 -- These settings can be edited. The default values for
478 -- the three axes are:
479 -- Color: Quantity_NOC_PEACHPUFF
480 -- Type of line: Aspect_TOL_SOLID
484 SetDatumAspect(me:mutable; anAspect: DatumAspect from Prs3d)
486 ---Purpose: Sets the modality anAspect for the display of datums.
488 DimensionAspect(me:mutable) returns DimensionAspect from Prs3d is virtual;
489 ---Purpose: Returns settings for the appearance of dimensions.
491 SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d) is virtual;
492 ---Purpose: Sets the settings for the appearance of dimensions.
494 SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
495 ---Purpose: Sets dimension length model units for computing of dimension presentation.
497 SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
498 ---Purpose: Sets dimension angle model units for computing of dimension presentation.
500 DimLengthModelUnits (me) returns AsciiString from TCollection is virtual;
501 ---Purpose: Returns length model units for the dimension presentation.
502 ---C++: return const &
504 DimAngleModelUnits (me) returns AsciiString from TCollection is virtual;
505 ---Purpose: Returns angle model units for the dimension presentation.
506 ---C++: return const &
508 SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
509 ---Purpose: Sets length units in which value for dimension presentation is displayed.
511 SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
512 ---Purpose: Sets angle units in which value for dimension presentation is displayed.
514 DimLengthDisplayUnits (me) returns AsciiString from TCollection is virtual;
515 ---Purpose: Returns length units in which dimension presentation is displayed.
516 ---C++: return const &
518 DimAngleDisplayUnits (me) returns AsciiString from TCollection is virtual;
519 ---Purpose: Returns angle units in which dimension presentation is displayed.
520 ---C++: return const &
522 SectionAspect (me : mutable) returns LineAspect from Prs3d is virtual;
523 ---Purpose: The LineAspect for the wire can be edited.
524 -- The default values are:
525 -- Color: Quantity_NOC_ORANGE
526 -- Type of line: Aspect_TOL_SOLID
528 -- These attributes are used by the algorithm Prs3d_WFShape.
530 SetSectionAspect (me : mutable; theAspect: LineAspect from Prs3d) is virtual;
531 ---Purpose: Sets the parameter theAspect for display attributes of sections.
533 SetFaceBoundaryDraw (me : mutable;
534 theIsEnabled : Boolean from Standard)
536 ---Purpose: Enables or disables face boundary drawing for shading presentations.
537 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
540 IsFaceBoundaryDraw (me) returns Boolean from Standard
542 ---Purpose: Checks whether the face boundary drawing is enabled or not.
544 SetFaceBoundaryAspect (me : mutable;
545 theAspect : LineAspect from Prs3d)
547 ---Purpose: Sets line aspect for face boundaries.
548 -- theAspect is the line aspect that determines the look of the face boundaries.
550 FaceBoundaryAspect (me : mutable) returns LineAspect from Prs3d
552 ---Purpose: Returns line aspect of face boundaries.
556 myUIsoAspect: IsoAspect from Prs3d is protected;
557 myVIsoAspect: IsoAspect from Prs3d is protected;
558 myNbPoints : Integer from Standard is protected;
559 myIsoOnPlane: Boolean from Standard is protected;
560 myFreeBoundaryAspect: LineAspect from Prs3d is protected;
561 myFreeBoundaryDraw: Boolean from Standard is protected;
562 myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
563 myUnFreeBoundaryDraw: Boolean from Standard is protected;
564 myWireAspect: LineAspect from Prs3d is protected;
565 myWireDraw: Boolean from Standard is protected;
566 myLineAspect: LineAspect from Prs3d is protected;
567 myTextAspect: TextAspect from Prs3d is protected;
568 myShadingAspect: ShadingAspect from Prs3d is protected;
569 myShadingAspectGlobal: Boolean from Standard is protected;
570 myChordialDeviation: Length from Quantity is protected;
571 myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
572 myMaximalParameterValue: Real from Standard is protected;
574 myDeviationCoefficient: Real from Standard is protected;
575 myHLRDeviationCoefficient: Real from Standard is protected;
577 myDeviationAngle: Real from Standard is protected;
578 myHLRAngle: Real from Standard is protected;
580 myPointAspect: PointAspect from Prs3d is protected;
581 myVertexDrawMode: VertexDrawMode from Prs3d is protected;
582 myPlaneAspect: PlaneAspect from Prs3d is protected;
583 myArrowAspect: ArrowAspect from Prs3d is protected;
584 myLineDrawArrow: Boolean from Standard is protected;
585 myDrawHiddenLine: Boolean from Standard is protected;
586 myHiddenLineAspect: LineAspect from Prs3d is protected;
587 mySeenLineAspect: LineAspect from Prs3d is protected;
588 myVectorAspect: LineAspect from Prs3d is protected;
589 myDatumAspect: DatumAspect from Prs3d is protected;
590 myDatumScale: Real from Standard is protected;
592 myDimensionAspect : DimensionAspect from Prs3d is protected;
593 myDimensionModelUnits : DimensionUnits from Prs3d is protected;
594 myDimensionDisplayUnits : DimensionUnits from Prs3d is protected;
596 mySectionAspect : LineAspect from Prs3d is protected;
597 myFaceBoundaryDraw : Boolean from Standard is protected;
598 myFaceBoundaryAspect : LineAspect from Prs3d is protected;
599 myTypeOfHLR : TypeOfHLR from Prs3d is protected;