1 -- Created on: 1992-09-18
2 -- Created by: Odile Olivier
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 AIS inherits Drawer from Prs3d
20 -- A framework to manage display attributes of interactive objects.
21 -- An interactive object can have a certain number of
22 -- display attributes specific to it. These include
23 -- visualization mode, color, material
24 -- and so on. To deal with this information, the
25 -- interactive context has a Drawer attribute manager
26 -- which is valid by default for the objects it
27 -- controls. When an interactive object is visualized, the
28 -- required graphic display attributes are first taken from
29 -- its own Drawer if it has the ones required, or from the
30 -- context drawer for those it does not have them.
31 -- The set of display attributes of an interactive object is
32 -- stocked in an AIS_Drawer, which is, in fact, a
33 -- Prs3d_Drawer with the possibility of a link to another
34 -- display attribute manager. This drawer then manages
35 -- the stocked graphic display attributes by specifying
36 -- how the presentation algorithms compute the
37 -- presentation of a specific kind of object. These
38 -- factors involved include color, width and type of line,
39 -- and maximal chordal deviation. The Drawer includes
40 -- instances of the aspect classes providing the default
42 -- Prs3d_Drawer completes AIS_Drawer by adding
43 -- functions for setting deviation angle and deviation
44 -- coefficient in presentations using hidden line removal.
48 DatumAspect from Prs3d,
49 LineAspect from Prs3d,
50 TextAspect from Prs3d,
51 PointAspect from Prs3d,
52 ShadingAspect from Prs3d,
54 DimensionAspect from Prs3d,
55 PlaneAspect from Prs3d,
56 ArrowAspect from Prs3d,
57 TypeOfDeflection from Aspect,
58 NameOfColor from Quantity,
59 PlaneAngle from Quantity,
61 DimensionUnits from Prs3d,
62 VertexDrawMode from Prs3d,
63 AsciiString from TCollection,
68 Create returns Drawer from AIS;
70 -- Constructs an empty attribute management framework.
71 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
74 -- Returns the type of chordal deflection: relative to the
75 -- size of the object or absolute.
77 MaximalChordialDeviation (me) returns Length from Quantity
78 ---Purpose: Returns the maximal chordal deviation. The default
79 -- value is 0.1. Drawings of curves or patches are
80 -- made with respect to an absolute maximal chordal deviation.
84 ------------------------------------------------------------
85 SetDeviationCoefficient(me: mutable) ;
86 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_False
89 SetHLRDeviationCoefficient(me: mutable) ;
90 ---Purpose: Sets the deviation coefficient aCoefficient for
91 -- removal of hidden lines created by different
92 -- viewpoints in different presentations. The Default value is 0.02.
95 SetDeviationAngle(me: mutable) ;
96 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_False
99 SetHLRAngle(me: mutable) ;
100 ---Purpose: Sets the angle of maximum chordal deviation for
101 -- removal of hidden lines created by different viewpoints
102 -- in different presentations. The default value is 20*PI/180.
105 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
106 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_True,
107 -- sets myOwnDeviationCoefficient and myPreviousDeviationCoefficient
110 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
111 ---Purpose: Sets the hasOwnHLRDeviationCoefficient flag to Standard_True,
112 -- sets myOwnHLRDeviationCoefficient and myPreviousHLRDeviationCoefficient
115 SetDeviationAngle(me: mutable; anAngle: Real from Standard ) is redefined ;
116 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_True,
117 -- sets myOwnDeviationAngle and myPreviousDeviationAngle
119 SetHLRAngle(me: mutable; anAngle: Real from Standard )
120 ---Purpose: Sets the hasOwnHLRDeviationAngle flag to Standard_True,
121 -- sets myOwnHLRDeviationAngle and myPreviousHLRDeviationAngle
124 SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d)
126 ---Purpose: Sets the type of HLR algorithm
127 -- used by drawer's interactive objects
130 TypeOfHLR(me) returns TypeOfHLR from Prs3d
132 ---Purpose: Returns the type of HLR algorithm currently in use.
135 DeviationCoefficient(me) returns Real from Standard
136 ---Purpose: Drawings of curves or patches are made with respect
137 -- to a maximal chordal deviation. A Deviation coefficient
138 -- is used in the shading display mode. The shape is
139 -- seen decomposed into triangles. These are used to
140 -- calculate reflection of light from the surface of the
141 -- object. The triangles are formed from chords of the
142 -- curves in the shape. The deviation coefficient gives
143 -- the highest value of the angle with which a chord can
144 -- deviate from a tangent to a curve. If this limit is
145 -- reached, a new triangle is begun.
146 -- This deviation is absolute and is set through the
147 -- method: SetMaximalChordialDeviation. The default value is 0.001.
148 -- In drawing shapes, however, you are allowed to ask
149 -- for a relative deviation. This deviation will be:
150 -- SizeOfObject * DeviationCoefficient.
153 HLRDeviationCoefficient(me) returns Real from Standard
154 ---Purpose: Returns the real number value of the HLR deviation
155 -- coefficient in this framework, if the flag
156 -- hasOwnHLRDeviationCoefficient is true.
157 -- If hasOwnHLRDeviationCoefficient is false, the
158 -- shape's HLR deviation coefficient is used.
159 -- A Deviation coefficient is used in the shading display
160 -- mode. The shape is seen decomposed into triangles.
161 -- These are used to calculate reflection of light from the
162 -- surface of the object.
163 -- The triangles are formed from chords of the curves in
164 -- the shape. The deviation coefficient give the highest
165 -- value of the angle with which a chord can deviate
166 -- from a tangent to a curve. If this limit is reached, a
167 -- new triangle is begun.
168 -- To find the hidden lines, hidden line display mode
169 -- entails recalculation of the view at each different
170 -- projector perspective.
171 -- Since hidden lines entail calculations of more than
172 -- usual complexity to decompose them into these
173 -- triangles, a deviation coefficient allowing greater
174 -- tolerance is used. This increases efficiency in calculation.
175 -- The Default value is 0.02.
179 DeviationAngle(me) returns Real from Standard
180 ---Purpose: Returns myOwnDeviationAngle if hasOwnDeviationAngle is True
181 -- else gets myDeviationAngle field from Prs3d_Drawer
184 HLRAngle(me) returns Real from Standard
185 ---Purpose: Returns the real number value of the deviation angle
186 -- in hidden line removal views. The default value is 20*PI/180.
190 PreviousDeviationCoefficient(me) returns Real from Standard
191 ---Purpose: Saves the previous value used for the chordal
192 -- deviation coefficient. The default value is 0.1.
196 PreviousHLRDeviationCoefficient(me) returns Real from Standard
197 ---Purpose: returns myPreviousHLRDeviationCoefficient
201 PreviousDeviationAngle(me) returns Real from Standard
202 ---Purpose: returns myPreviousDeviationAngle
206 PreviousHLRDeviationAngle(me) returns Real from Standard
207 ---Purpose: returns myPreviousHLRDeviationAngle
211 IsOwnDeviationCoefficient(me) returns Boolean from Standard;
212 ---Purpose: Returns true if the there is a local setting for deviation
213 -- coefficient in this framework for a specific interactive object.
216 IsOwnHLRDeviationCoefficient(me) returns Boolean from Standard;
217 ---Purpose: Returns true if the there is a setting for HLR deviation
218 -- coefficient in this framework for a specific interactive object.
221 IsOwnDeviationAngle(me) returns Boolean from Standard;
222 ---Purpose: Returns true if the there is a local setting for deviation
223 -- angle in this framework for a specific interactive object.
226 IsOwnHLRDeviationAngle(me) returns Boolean from Standard;
227 ---Purpose: Returns true if the there is a setting for HLR deviation
228 -- angle in this framework for a specific interactive object.
231 Discretisation(me) returns Integer from Standard
233 ---Purpose: Draws algorithms using discretisation, a default
234 -- number of points has been set to 17. You can use the
235 -- method Prs3d_Drawer_SetDiscretisation to change this value.
237 MaximalParameterValue(me) returns Real from Standard
240 -- Sets the maximum value allowed for the first and last
241 -- parameters of an infinite curve. By default, this value is 500000.
243 IsoOnPlane(me) returns Boolean from Standard
244 ---Purpose: returns True if the drawing of isos on planes is enabled.
249 -- Attributes for the U Isoparametric lines of patches.
251 UIsoAspect (me:mutable) returns IsoAspect from Prs3d
252 ---Purpose: Defines the attributes which are used when drawing an
253 -- U isoparametric curve of a face. Defines the number
254 -- of U isoparametric curves to be drawn for a single face.
255 -- The LineAspect for U isoparametric lines can be edited
256 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
257 -- The default values are:
258 -- COLOR : Quantity_NOC_GRAY75
259 -- TYPE OF LINE: Aspect_TOL_SOLID
261 -- These attributes are used by the following algorithms:
262 -- Prs3d_WFDeflectionSurface
263 -- Prs3d_WFDeflectionRestrictedFace
268 HasUIsoAspect (me) returns Boolean from Standard
269 ---Purpose: Returns true if the Drawer has a UIso aspect setting active.
273 -- Attributes for the V Isoparametric line of patches.
276 VIsoAspect (me:mutable) returns IsoAspect from Prs3d
277 ---Purpose: Defines the attributes which are used when drawing an
278 -- V isoparametric curve of a face. Defines the number
279 -- of V isoparametric curves to be drawn for a single face.
280 -- The LineAspect for V isoparametric lines can be edited
281 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
282 -- The default values are:
283 -- COLOR : Quantity_NOC_GRAY82
284 -- TYPE OF LINE: Aspect_TOL_SOLID
286 -- These attributes are used by the following algorithms:
287 -- Prs3d_WFDeflectionSurface
288 -- Prs3d_WFDeflectionRestrictedFace
291 HasVIsoAspect (me) returns Boolean from Standard
292 ---Purpose: Returns true if the Drawer has a VIso aspect setting active.
296 -- Attributes for the free boundaries
298 FreeBoundaryAspect (me:mutable) returns LineAspect from Prs3d
299 ---Purpose: Returns a link with
300 -- Prs3d_Drawer_FreeBoundaryAspect. Stores the
301 -- values for presentation of free boundaries, in other
302 -- words, boundaries which are not shared . The
303 -- LineAspect for the free boundaries can be edited. The
304 -- default values are: Color: Quantity_NOC_GREEN
305 -- Type of line: Aspect_TOL_SOLID Width: 1.
306 -- These attributes are used by Prs3d_WFShape.
309 HasFreeBoundaryAspect (me) returns Boolean from Standard
310 ---Purpose: Returns true if the Drawer has a free boundary aspect setting active.
314 FreeBoundaryDraw(me) returns Boolean from Standard
315 ---Purpose: returns True if the drawing of the free boundaries is enabled.
319 -- Attributes for the wires
321 WireAspect (me:mutable) returns LineAspect from Prs3d
322 ---Purpose: Returns a link with Prs3d_Drawer_WireAspect.
323 -- This method provides wire aspect settings.
324 -- The LineAspect for wires can be edited. The default values are:
325 -- Color: Quantity_NOC_RED
326 -- Type of line: Aspect_TOL_SOLID
328 -- These attributes are used by the following algorithms:
332 HasLineAspect (me) returns Boolean from Standard
333 ---Purpose: Returns true if the Interactive Object has a line
334 -- visualization aspect.
338 HasWireAspect (me) returns Boolean from Standard
339 ---Purpose: Returns true if the Drawer has a wire aspect setting active.
343 WireDraw(me) returns Boolean from Standard
344 ---Purpose: Returns a link with Prs3d_Drawer_WireDraw. This
345 -- method returns true if drawing of wires is enabled.
346 -- The default setting is true.
350 -- Attributes for the unfree boundaries
352 UnFreeBoundaryAspect (me:mutable) returns LineAspect from Prs3d
353 ---Purpose: Returns a link with
354 -- Prs3d_Drawer_UnFreeBoundaryAspect, which
355 -- provides settings for shared boundary line aspects.
356 -- The LineAspect for shared boundaries can be edited.
357 -- The default values are:
358 -- Color: Quantity_NOC_YELLOW
359 -- Type of line: Aspect_TOL_SOLID
361 -- These attributes are used by the following algorithms:
365 HasUnFreeBoundaryAspect (me) returns Boolean from Standard
366 ---Purpose: Returns true if the Drawer has an unfree boundary aspect setting active.
370 UnFreeBoundaryDraw(me) returns Boolean from Standard
371 ---Purpose: Returns True if the drawing of the shared boundaries
372 -- is enabled. True is the default setting.
377 -- Attributes for the lines.
380 LineAspect(me:mutable) returns LineAspect from Prs3d
381 ---Purpose: Returns a link with Prs3d_Drawer_LineAspect,
382 -- which provides settings for line aspects. These
383 -- settings can be edited. The default values are:
384 -- Color: Quantity_NOC_YELLOW
385 -- Type of line: Aspect_TOL_SOLID
387 -- These attributes are used by the following algorithms:
396 HasTextAspect(me) returns Boolean from Standard
399 TextAspect(me:mutable) returns TextAspect from Prs3d
401 -- Color: Quantity_NOC_YELLOW
404 LineArrowDraw(me) returns Boolean from Standard
405 ---Purpose: Returns True if the drawing of an arrow at the end of
406 -- each line is enabled. The default setting is False.
409 ArrowAspect(me:mutable) returns ArrowAspect from Prs3d
414 -- Attributes for the points
416 PointAspect(me:mutable) returns PointAspect from Prs3d
417 ---Purpose: Returns the point aspect setting. The default values
418 -- are: Color: Quantity_NOC_YELLOW
419 -- Type of marker: Aspect_TOM_PLUS
421 -- These attributes are used by the following algorithms:
425 HasPointAspect (me) returns Boolean from Standard
426 ---Purpose: Returns true if the Drawer has a point aspect setting active.
430 SetVertexDrawMode(me: mutable; theMode: VertexDrawMode from Prs3d)
431 ---Purpose: Sets the mode of visualization of vertices by AIS_Shape and helper algorithms.
432 -- By default, only isolated vertices not belonging to any face are drawn,
433 -- that corresponds to <b>Prs3d_VDM_Isolated</b> mode.
434 -- Switching to <b>Prs3d_VDM_Isolated</b> mode makes all shape's vertices visible.
435 -- To inherit this parameter from the global drawer instance ("the link") when it is present,
436 -- <b>Prs3d_VDM_Inherited</b> value should be used.
439 VertexDrawMode(me) returns VertexDrawMode from Prs3d
440 ---Purpose: Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
443 IsOwnVertexDrawMode(me) returns Boolean from Standard;
444 ---Purpose: Returns true if the vertex draw mode is not equal to <b>Prs3d_VDM_Inherited</b>.
445 -- This means that individual vertex draw mode value (i.e. not inherited from the global
446 -- drawer) is used for a specific interactive object.
449 -- Attributes for the faces:
451 ShadingAspect (me:mutable) returns ShadingAspect from Prs3d
453 -- Returns a link with Prs3d_Drawer_ShadingAspect,
454 -- which provides settings for shading aspects.
455 -- These settings can be edited. The default values are:
456 -- Color: Quantity_NOC_YELLOW
457 -- Material: Graphic3d_NOM_BRASS
458 -- hading aspect is obtained through decomposition of
459 -- 3D faces into triangles, each side of each triangle
460 -- being a chord of the corresponding curved edge in
461 -- the face. Reflection of light in each projector
462 -- perspective is then calculated for each of the
463 -- resultant triangular planes.
466 HasShadingAspect (me) returns Boolean from Standard
468 ---Purpose: Returns True if the Drawer has shading aspect active.
471 ShadingAspectGlobal(me) returns Boolean from Standard
473 ---Purpose: Provides the attributes for hidden line removal.
476 DrawHiddenLine(me) returns Boolean from Standard
477 ---Purpose: Returns Standard_True if the hidden lines are to be drawn.
478 -- By default the hidden lines are not drawn.
481 HiddenLineAspect(me:mutable) returns LineAspect from Prs3d
482 ---Purpose: Returns a link with
483 -- Prs3d_Drawer_HiddenLineAspect, which provides
484 -- settings for hidden line aspects.
485 -- These settings can be edited. The default values are:
486 -- Color: Quantity_NOC_YELLOW
487 -- Type of line: Aspect_TOL_DASH
492 SeenLineAspect(me:mutable) returns LineAspect from Prs3d
493 ---Purpose: Returns a link with
494 -- Prs3d_Drawer_SeenLineAspect, which provides
495 -- settings for seen line aspects.
496 -- These settings can be edited. The default values are:
497 -- Color: Quantity_NOC_YELLOW
498 -- Type of line: Aspect_TOL_SOLID
503 HasPlaneAspect(me) returns Boolean from Standard;
506 PlaneAspect(me:mutable) returns PlaneAspect from Prs3d
509 -- Returns a link with Prs3d_Drawer_PlaneAspect.
510 -- This method provides settings for the appearance of planes.
513 VectorAspect(me:mutable) returns LineAspect from Prs3d
514 ---Purpose: Returns a link with Prs3d_Drawer_VectorAspect,
515 -- which provides settings for the appearance of vectors.
516 -- These settings can be edited. The default values are:
517 -- Color: Quantity_NOC_SKYBLUE
518 -- Type of line: Aspect_TOL_SOLID Width: 1.
521 SetFaceBoundaryDraw (me : mutable;
522 theIsEnabled : Boolean from Standard)
524 ---Purpose: Enables or disables drawing of face boundaries for shading presentations.
525 -- The method sets drawing flag owned by the drawer that will be used during
526 -- visualization instead of the one set in link.
527 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
530 IsFaceBoundaryDraw (me) returns Boolean from Standard
532 ---Purpose: Checks whether the drawing of face boundaries is enabled or not.
534 SetFaceBoundaryAspect (me : mutable;
535 theAspect : LineAspect from Prs3d)
537 ---Purpose: Sets line aspect for face boundaries.
538 -- The method sets line aspect owned by the drawer that will be used during
539 -- visualization instead of the one set in link.
540 -- theAspect is the line aspect that determines the look of the face boundaries.
542 FaceBoundaryAspect (me : mutable) returns LineAspect from Prs3d
544 ---Purpose: Returns line aspect of face boundaries.
546 IsOwnFaceBoundaryDraw (me) returns Boolean from Standard
548 ---Purpose: Returns true if the drawer has its own attribute for
549 -- "draw face boundaries" flag that overrides the one in the link.
552 IsOwnFaceBoundaryAspect (me) returns Boolean from Standard
554 ---Purpose: Returns true if the drawer has its own attribute for
555 -- face boundaries aspect that overrides the one in the link.
558 -- Attributes for the presentation of a Datum.
561 HasDatumAspect(me) returns Boolean from Standard;
564 DatumAspect(me:mutable) returns DatumAspect from Prs3d
565 ---Purpose: Returns a link with Prs3d_Drawer_DatumAspect,
566 -- which provides settings for the appearance of datums.
567 -- These settings can be edited. The default values for
568 -- the three axes are:
569 -- Color: Quantity_NOC_PEACHPUFF
570 -- Type of line: Aspect_TOL_SOLID Width: 1.
574 -- Attributes for the presentation of a dimensions.
577 DimensionAspect (me : mutable) returns DimensionAspect from Prs3d is redefined static;
578 ---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
579 -- which provides settings for the appearance of dimensions.
581 HasDimensionAspect (me) returns Boolean from Standard is static;
583 -- Purpose: Returns true if the Drawer has a dimension aspect setting active.
585 SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
586 ---Purpose: Sets dimension length model units for computing of dimension presentation.
588 SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
589 ---Purpose: Sets dimension angle model units for computing of dimension presentation.
591 DimAngleModelUnits (me) returns AsciiString from TCollection is redefined static;
592 ---Purpose: Returns angle model units for the dimension presentation.
593 ---C++: return const &
595 DimLengthModelUnits (me) returns AsciiString from TCollection is redefined static;
596 ---Purpose: Returns length model units for the dimension presentation.
597 ---C++: return const &
599 SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
600 ---Purpose: Sets length units in which value for dimension presentation is displayed.
602 SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
603 ---Purpose: Sets angle units in which value for dimension presentation is displayed.
605 DimLengthDisplayUnits (me) returns AsciiString from TCollection is redefined static;
606 ---Purpose: Returns length units in which dimension presentation is displayed.
607 ---C++: return const &
609 DimAngleDisplayUnits (me) returns AsciiString from TCollection is redefined static;
610 ---Purpose: Returns angle units in which dimension presentation is displayed.
611 ---C++: return const &
613 -- Attributes for the sections
615 SectionAspect (me:mutable) returns LineAspect from Prs3d
616 ---Purpose: Returns a link with Prs3d_Drawer_SectionAspect,
617 -- which provides settings for wires which highlight sections.
618 -- The LineAspect for the wire can be edited.
619 -- The default values are:
620 -- Color: Quantity_NOC_ORANGE
621 -- Type of line: Aspect_TOL_SOLID
623 -- These attributes are used by the following algorithms:
627 Link(me:mutable) returns any Drawer from Prs3d
629 ---C++: return const&
631 HasLink(me) returns Boolean from Standard
635 Link (me:mutable; aDrawer: Drawer from Prs3d)
640 ClearLocalAttributes(me:mutable) is virtual;
641 ---Purpose: Removes attributes stored in a Local Context.
643 WasLastLocal(me) returns Boolean from Standard;
645 ---Purpose: Returns true if the last called attribute was local; false if it was global.
647 HasLocalAttributes(me) returns Boolean from Standard;
650 -- Returns true if a Local Context has stored attributes
651 -- for Interactive Objects.
655 myLink : Drawer from Prs3d;
656 hasLocalAttributes : Boolean from Standard;
658 myhasOwnDeviationCoefficient : Boolean from Standard;
659 myOwnDeviationCoefficient : Real from Standard;
660 myPreviousDeviationCoefficient : Real from Standard;
662 myhasOwnHLRDeviationCoefficient : Boolean from Standard;
663 myOwnHLRDeviationCoefficient : Real from Standard;
664 myPreviousHLRDeviationCoefficient: Real from Standard;
666 myhasOwnDeviationAngle : Boolean from Standard;
667 myOwnDeviationAngle : Real from Standard;
668 myPreviousDeviationAngle : Real from Standard;
670 myhasOwnHLRDeviationAngle : Boolean from Standard;
671 myOwnHLRDeviationAngle : Real from Standard;
672 myPreviousHLRDeviationAngle : Real from Standard;
673 myHasOwnFaceBoundaryDraw : Boolean from Standard;
675 myHasOwnDimLengthModelUnits : Boolean from Standard;
676 myHasOwnDimLengthDisplayUnits : Boolean from Standard;
677 myHasOwnDimAngleModelUnits : Boolean from Standard;
678 myHasOwnDimAngleDisplayUnits : Boolean from Standard;