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
9 -- under the terms of the GNU Lesser General Public 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 AsciiString from TCollection,
67 Create returns mutable Drawer from AIS;
69 -- Constructs an empty attribute management framework.
70 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
73 -- Returns the type of chordal deflection: relative to the
74 -- size of the object or absolute.
76 MaximalChordialDeviation (me) returns Length from Quantity
77 ---Purpose: Returns the maximal chordal deviation. The default
78 -- value is 0.1. Drawings of curves or patches are
79 -- made with respect to an absolute maximal chordal deviation.
83 ------------------------------------------------------------
84 SetDeviationCoefficient(me: mutable) ;
85 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_False
88 SetHLRDeviationCoefficient(me: mutable) ;
89 ---Purpose: Sets the deviation coefficient aCoefficient for
90 -- removal of hidden lines created by different
91 -- viewpoints in different presentations. The Default value is 0.02.
94 SetDeviationAngle(me: mutable) ;
95 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_False
98 SetHLRAngle(me: mutable) ;
99 ---Purpose: Sets the angle of maximum chordal deviation for
100 -- removal of hidden lines created by different viewpoints
101 -- in different presentations. The default value is 20*PI/180.
104 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
105 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_True,
106 -- sets myOwnDeviationCoefficient and myPreviousDeviationCoefficient
109 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
110 ---Purpose: Sets the hasOwnHLRDeviationCoefficient flag to Standard_True,
111 -- sets myOwnHLRDeviationCoefficient and myPreviousHLRDeviationCoefficient
114 SetDeviationAngle(me: mutable; anAngle: Real from Standard ) is redefined ;
115 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_True,
116 -- sets myOwnDeviationAngle and myPreviousDeviationAngle
118 SetHLRAngle(me: mutable; anAngle: Real from Standard )
119 ---Purpose: Sets the hasOwnHLRDeviationAngle flag to Standard_True,
120 -- sets myOwnHLRDeviationAngle and myPreviousHLRDeviationAngle
123 SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d)
125 ---Purpose: Sets the type of HLR algorithm
126 -- used by drawer's interactive objects
129 TypeOfHLR(me) returns TypeOfHLR from Prs3d
131 ---Purpose: Returns the type of HLR algorithm currently in use.
134 DeviationCoefficient(me) returns Real from Standard
135 ---Purpose: Drawings of curves or patches are made with respect
136 -- to a maximal chordal deviation. A Deviation coefficient
137 -- is used in the shading display mode. The shape is
138 -- seen decomposed into triangles. These are used to
139 -- calculate reflection of light from the surface of the
140 -- object. The triangles are formed from chords of the
141 -- curves in the shape. The deviation coefficient gives
142 -- the highest value of the angle with which a chord can
143 -- deviate from a tangent to a curve. If this limit is
144 -- reached, a new triangle is begun.
145 -- This deviation is absolute and is set through the
146 -- method: SetMaximalChordialDeviation. The default value is 0.001.
147 -- In drawing shapes, however, you are allowed to ask
148 -- for a relative deviation. This deviation will be:
149 -- SizeOfObject * DeviationCoefficient.
152 HLRDeviationCoefficient(me) returns Real from Standard
153 ---Purpose: Returns the real number value of the HLR deviation
154 -- coefficient in this framework, if the flag
155 -- hasOwnHLRDeviationCoefficient is true.
156 -- If hasOwnHLRDeviationCoefficient is false, the
157 -- shape's HLR deviation coefficient is used.
158 -- A Deviation coefficient is used in the shading display
159 -- mode. The shape is seen decomposed into triangles.
160 -- These are used to calculate reflection of light from the
161 -- surface of the object.
162 -- The triangles are formed from chords of the curves in
163 -- the shape. The deviation coefficient give the highest
164 -- value of the angle with which a chord can deviate
165 -- from a tangent to a curve. If this limit is reached, a
166 -- new triangle is begun.
167 -- To find the hidden lines, hidden line display mode
168 -- entails recalculation of the view at each different
169 -- projector perspective.
170 -- Since hidden lines entail calculations of more than
171 -- usual complexity to decompose them into these
172 -- triangles, a deviation coefficient allowing greater
173 -- tolerance is used. This increases efficiency in calculation.
174 -- The Default value is 0.02.
178 DeviationAngle(me) returns Real from Standard
179 ---Purpose: Returns myOwnDeviationAngle if hasOwnDeviationAngle is True
180 -- else gets myDeviationAngle field from Prs3d_Drawer
183 HLRAngle(me) returns Real from Standard
184 ---Purpose: Returns the real number value of the deviation angle
185 -- in hidden line removal views. The default value is 20*PI/180.
189 PreviousDeviationCoefficient(me) returns Real from Standard
190 ---Purpose: Saves the previous value used for the chordal
191 -- deviation coefficient. The default value is 0.1.
195 PreviousHLRDeviationCoefficient(me) returns Real from Standard
196 ---Purpose: returns myPreviousHLRDeviationCoefficient
200 PreviousDeviationAngle(me) returns Real from Standard
201 ---Purpose: returns myPreviousDeviationAngle
205 PreviousHLRDeviationAngle(me) returns Real from Standard
206 ---Purpose: returns myPreviousHLRDeviationAngle
210 IsOwnDeviationCoefficient(me) returns Boolean from Standard;
211 ---Purpose: Returns true if the there is a local setting for deviation
212 -- coefficient in this framework for a specific interactive object.
215 IsOwnHLRDeviationCoefficient(me) returns Boolean from Standard;
216 ---Purpose: Returns true if the there is a setting for HLR deviation
217 -- coefficient in this framework for a specific interactive object.
220 IsOwnDeviationAngle(me) returns Boolean from Standard;
221 ---Purpose: Returns true if the there is a local setting for deviation
222 -- angle in this framework for a specific interactive object.
225 IsOwnHLRDeviationAngle(me) returns Boolean from Standard;
226 ---Purpose: Returns true if the there is a setting for HLR deviation
227 -- angle in this framework for a specific interactive object.
230 Discretisation(me) returns Integer from Standard
232 ---Purpose: Draws algorithms using discretisation, a default
233 -- number of points has been set to 17. You can use the
234 -- method Prs3d_Drawer_SetDiscretisation to change this value.
236 MaximalParameterValue(me) returns Real from Standard
239 -- Sets the maximum value allowed for the first and last
240 -- parameters of an infinite curve. By default, this value is 500000.
242 IsoOnPlane(me) returns Boolean from Standard
243 ---Purpose: returns True if the drawing of isos on planes is enabled.
248 -- Attributes for the U Isoparametric lines of patches.
250 UIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
251 ---Purpose: Defines the attributes which are used when drawing an
252 -- U isoparametric curve of a face. Defines the number
253 -- of U isoparametric curves to be drawn for a single face.
254 -- The LineAspect for U isoparametric lines can be edited
255 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
256 -- The default values are:
257 -- COLOR : Quantity_NOC_GRAY75
258 -- TYPE OF LINE: Aspect_TOL_SOLID
260 -- These attributes are used by the following algorithms:
261 -- Prs3d_WFDeflectionSurface
262 -- Prs3d_WFDeflectionRestrictedFace
268 -- Attributes for the V Isoparametric line of patches.
271 VIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
272 ---Purpose: Defines the attributes which are used when drawing an
273 -- V isoparametric curve of a face. Defines the number
274 -- of V isoparametric curves to be drawn for a single face.
275 -- The LineAspect for V isoparametric lines can be edited
276 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
277 -- The default values are:
278 -- COLOR : Quantity_NOC_GRAY82
279 -- TYPE OF LINE: Aspect_TOL_SOLID
281 -- These attributes are used by the following algorithms:
282 -- Prs3d_WFDeflectionSurface
283 -- Prs3d_WFDeflectionRestrictedFace
287 -- Attributes for the free boundaries
289 FreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
290 ---Purpose: Returns a link with
291 -- Prs3d_Drawer_FreeBoundaryAspect. Stores the
292 -- values for presentation of free boundaries, in other
293 -- words, boundaries which are not shared . The
294 -- LineAspect for the free boundaries can be edited. The
295 -- default values are: Color: Quantity_NOC_GREEN
296 -- Type of line: Aspect_TOL_SOLID Width: 1.
297 -- These attributes are used by Prs3d_WFShape.
301 FreeBoundaryDraw(me) returns Boolean from Standard
302 ---Purpose: returns True if the drawing of the free boundaries is enabled.
306 -- Attributes for the wires
308 WireAspect (me:mutable) returns mutable LineAspect from Prs3d
309 ---Purpose: Returns a link with Prs3d_Drawer_WireAspect.
310 -- This method provides wire aspect settings.
311 -- The LineAspect for wires can be edited. The default values are:
312 -- Color: Quantity_NOC_RED
313 -- Type of line: Aspect_TOL_SOLID
315 -- These attributes are used by the following algorithms:
319 HasLineAspect (me) returns Boolean from Standard
320 ---Purpose: Returns true if the Interactive Object has a line
321 -- visualization aspect.
325 HasWireAspect (me) returns Boolean from Standard
326 ---Purpose: Returns true if the Drawer has a wire aspect setting active.
330 WireDraw(me) returns Boolean from Standard
331 ---Purpose: Returns a link with Prs3d_Drawer_WireDraw. This
332 -- method returns true if drawing of wires is enabled.
333 -- The default setting is true.
337 -- Attributes for the unfree boundaries
339 UnFreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
340 ---Purpose: Returns a link with
341 -- Prs3d_Drawer_UnFreeBoundaryAspect, which
342 -- provides settings for shared boundary line aspects.
343 -- The LineAspect for shared boundaries can be edited.
344 -- The default values are:
345 -- Color: Quantity_NOC_YELLOW
346 -- Type of line: Aspect_TOL_SOLID
348 -- These attributes are used by the following algorithms:
353 UnFreeBoundaryDraw(me) returns Boolean from Standard
354 ---Purpose: Returns True if the drawing of the shared boundaries
355 -- is enabled. True is the default setting.
360 -- Attributes for the lines.
363 LineAspect(me:mutable) returns mutable LineAspect from Prs3d
364 ---Purpose: Returns a link with Prs3d_Drawer_LineAspect,
365 -- which provides settings for line aspects. These
366 -- settings can be edited. The default values are:
367 -- Color: Quantity_NOC_YELLOW
368 -- Type of line: Aspect_TOL_SOLID
370 -- These attributes are used by the following algorithms:
379 HasTextAspect(me) returns Boolean from Standard
382 TextAspect(me:mutable) returns mutable TextAspect from Prs3d
384 -- Color: Quantity_NOC_YELLOW
387 LineArrowDraw(me) returns Boolean from Standard
388 ---Purpose: Returns True if the drawing of an arrow at the end of
389 -- each line is enabled. The default setting is False.
392 ArrowAspect(me:mutable) returns mutable ArrowAspect from Prs3d
397 -- Attributes for the points
399 PointAspect(me:mutable) returns mutable PointAspect from Prs3d
400 ---Purpose: Returns the point aspect setting. The default values
401 -- are: Color: Quantity_NOC_YELLOW
402 -- Type of marker: Aspect_TOM_PLUS
404 -- These attributes are used by the following algorithms:
408 HasPointAspect (me) returns Boolean from Standard
409 ---Purpose: Returns true if the Drawer has a point aspect setting active.
414 -- Attributes for the faces:
416 ShadingAspect (me:mutable) returns mutable ShadingAspect from Prs3d
418 -- Returns a link with Prs3d_Drawer_ShadingAspect,
419 -- which provides settings for shading aspects.
420 -- These settings can be edited. The default values are:
421 -- Color: Quantity_NOC_YELLOW
422 -- Material: Graphic3d_NOM_BRASS
423 -- hading aspect is obtained through decomposition of
424 -- 3D faces into triangles, each side of each triangle
425 -- being a chord of the corresponding curved edge in
426 -- the face. Reflection of light in each projector
427 -- perspective is then calculated for each of the
428 -- resultant triangular planes.
431 HasShadingAspect (me) returns Boolean from Standard
433 ---Purpose: Returns True if the Drawer has shading aspect active.
436 ShadingAspectGlobal(me) returns Boolean from Standard
438 ---Purpose: Provides the attributes for hidden line removal.
441 DrawHiddenLine(me) returns Boolean from Standard
442 ---Purpose: Returns Standard_True if the hidden lines are to be drawn.
443 -- By default the hidden lines are not drawn.
446 HiddenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
447 ---Purpose: Returns a link with
448 -- Prs3d_Drawer_HiddenLineAspect, which provides
449 -- settings for hidden line aspects.
450 -- These settings can be edited. The default values are:
451 -- Color: Quantity_NOC_YELLOW
452 -- Type of line: Aspect_TOL_DASH
457 SeenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
458 ---Purpose: Returns a link with
459 -- Prs3d_Drawer_SeenLineAspect, which provides
460 -- settings for seen line aspects.
461 -- These settings can be edited. The default values are:
462 -- Color: Quantity_NOC_YELLOW
463 -- Type of line: Aspect_TOL_SOLID
468 HasPlaneAspect(me) returns Boolean from Standard;
471 PlaneAspect(me:mutable) returns mutable PlaneAspect from Prs3d
474 -- Returns a link with Prs3d_Drawer_PlaneAspect.
475 -- This method provides settings for the appearance of planes.
478 VectorAspect(me:mutable) returns mutable LineAspect from Prs3d
479 ---Purpose: Returns a link with Prs3d_Drawer_VectorAspect,
480 -- which provides settings for the appearance of vectors.
481 -- These settings can be edited. The default values are:
482 -- Color: Quantity_NOC_SKYBLUE
483 -- Type of line: Aspect_TOL_SOLID Width: 1.
486 SetFaceBoundaryDraw (me : mutable;
487 theIsEnabled : Boolean from Standard)
489 ---Purpose: Enables or disables drawing of face boundaries for shading presentations.
490 -- The method sets drawing flag owned by the drawer that will be used during
491 -- visualization instead of the one set in link.
492 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
495 IsFaceBoundaryDraw (me) returns Boolean from Standard
497 ---Purpose: Checks whether the drawing of face boundaries is enabled or not.
499 SetFaceBoundaryAspect (me : mutable;
500 theAspect : LineAspect from Prs3d)
502 ---Purpose: Sets line aspect for face boundaries.
503 -- The method sets line aspect owned by the drawer that will be used during
504 -- visualization instead of the one set in link.
505 -- theAspect is the line aspect that determines the look of the face boundaries.
507 FaceBoundaryAspect (me : mutable) returns mutable LineAspect from Prs3d
509 ---Purpose: Returns line aspect of face boundaries.
511 IsOwnFaceBoundaryDraw (me) returns Boolean from Standard
513 ---Purpose: Returns true if the drawer has its own attribute for
514 -- "draw face boundaries" flag that overrides the one in the link.
517 IsOwnFaceBoundaryAspect (me) returns Boolean from Standard
519 ---Purpose: Returns true if the drawer has its own attribute for
520 -- face boundaries aspect that overrides the one in the link.
523 -- Attributes for the presentation of a Datum.
526 HasDatumAspect(me) returns Boolean from Standard;
529 DatumAspect(me:mutable) returns mutable DatumAspect from Prs3d
530 ---Purpose: Returns a link with Prs3d_Drawer_DatumAspect,
531 -- which provides settings for the appearance of datums.
532 -- These settings can be edited. The default values for
533 -- the three axes are:
534 -- Color: Quantity_NOC_PEACHPUFF
535 -- Type of line: Aspect_TOL_SOLID Width: 1.
539 -- Attributes for the presentation of a dimensions.
542 DimensionAspect (me : mutable) returns mutable DimensionAspect from Prs3d is redefined static;
543 ---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
544 -- which provides settings for the appearance of dimensions.
546 HasDimensionAspect (me) returns Boolean from Standard is static;
548 -- Purpose: Returns true if the Drawer has a dimension aspect setting active.
550 SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
551 ---Purpose: Sets dimension length model units for computing of dimension presentation.
553 SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
554 ---Purpose: Sets dimension angle model units for computing of dimension presentation.
556 DimAngleModelUnits (me) returns AsciiString from TCollection is redefined static;
557 ---Purpose: Returns angle model units for the dimension presentation.
558 ---C++: return const &
560 DimLengthModelUnits (me) returns AsciiString from TCollection is redefined static;
561 ---Purpose: Returns length model units for the dimension presentation.
562 ---C++: return const &
564 SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
565 ---Purpose: Sets length units in which value for dimension presentation is displayed.
567 SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
568 ---Purpose: Sets angle units in which value for dimension presentation is displayed.
570 DimLengthDisplayUnits (me) returns AsciiString from TCollection is redefined static;
571 ---Purpose: Returns length units in which dimension presentation is displayed.
572 ---C++: return const &
574 DimAngleDisplayUnits (me) returns AsciiString from TCollection is redefined static;
575 ---Purpose: Returns angle units in which dimension presentation is displayed.
576 ---C++: return const &
578 -- Attributes for the sections
580 SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
581 ---Purpose: Returns a link with Prs3d_Drawer_SectionAspect,
582 -- which provides settings for wires which highlight sections.
583 -- The LineAspect for the wire can be edited.
584 -- The default values are:
585 -- Color: Quantity_NOC_ORANGE
586 -- Type of line: Aspect_TOL_SOLID
588 -- These attributes are used by the following algorithms:
592 Link(me:mutable) returns any Drawer from Prs3d
594 ---C++: return const&
596 HasLink(me) returns Boolean from Standard
600 Link (me:mutable; aDrawer: Drawer from Prs3d)
605 ClearLocalAttributes(me:mutable) is virtual;
606 ---Purpose: Removes attributes stored in a Local Context.
608 WasLastLocal(me) returns Boolean from Standard;
610 ---Purpose: Returns true if the last called attribute was local; false if it was global.
612 HasLocalAttributes(me) returns Boolean from Standard;
615 -- Returns true if a Local Context has stored attributes
616 -- for Interactive Objects.
620 myLink : Drawer from Prs3d;
621 hasLocalAttributes : Boolean from Standard;
623 myhasOwnDeviationCoefficient : Boolean from Standard;
624 myOwnDeviationCoefficient : Real from Standard;
625 myPreviousDeviationCoefficient : Real from Standard;
627 myhasOwnHLRDeviationCoefficient : Boolean from Standard;
628 myOwnHLRDeviationCoefficient : Real from Standard;
629 myPreviousHLRDeviationCoefficient: Real from Standard;
631 myhasOwnDeviationAngle : Boolean from Standard;
632 myOwnDeviationAngle : Real from Standard;
633 myPreviousDeviationAngle : Real from Standard;
635 myhasOwnHLRDeviationAngle : Boolean from Standard;
636 myOwnHLRDeviationAngle : Real from Standard;
637 myPreviousHLRDeviationAngle : Real from Standard;
638 myHasOwnFaceBoundaryDraw : Boolean from Standard;
640 myHasOwnDimLengthModelUnits : Boolean from Standard;
641 myHasOwnDimLengthDisplayUnits : Boolean from Standard;
642 myHasOwnDimAngleModelUnits : Boolean from Standard;
643 myHasOwnDimAngleDisplayUnits : Boolean from Standard;