1 -- Created on: 1992-09-18
2 -- Created by: Odile Olivier
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 AIS inherits Drawer from Prs3d
26 -- A framework to manage display attributes of interactive objects.
27 -- An interactive object can have a certain number of
28 -- display attributes specific to it. These include
29 -- visualization mode, color, material
30 -- and so on. To deal with this information, the
31 -- interactive context has a Drawer attribute manager
32 -- which is valid by default for the objects it
33 -- controls. When an interactive object is visualized, the
34 -- required graphic display attributes are first taken from
35 -- its own Drawer if it has the ones required, or from the
36 -- context drawer for those it does not have them.
37 -- The set of display attributes of an interactive object is
38 -- stocked in an AIS_Drawer, which is, in fact, a
39 -- Prs3d_Drawer with the possibility of a link to another
40 -- display attribute manager. This drawer then manages
41 -- the stocked graphic display attributes by specifying
42 -- how the presentation algorithms compute the
43 -- presentation of a specific kind of object. These
44 -- factors involved include color, width and type of line,
45 -- and maximal chordal deviation. The Drawer includes
46 -- instances of the aspect classes providing the default
48 -- Prs3d_Drawer completes AIS_Drawer by adding
49 -- functions for setting deviation angle and deviation
50 -- coefficient in presentations using hidden line removal.
54 DatumAspect from Prs3d,
55 LineAspect from Prs3d,
56 TextAspect from Prs3d,
57 PointAspect from Prs3d,
58 ShadingAspect from Prs3d,
60 DimensionAspect from Prs3d,
61 PlaneAspect from Prs3d,
62 ArrowAspect from Prs3d,
63 TypeOfDeflection from Aspect,
64 NameOfColor from Quantity,
65 PlaneAngle from Quantity,
67 DimensionUnits from Prs3d,
68 AsciiString from TCollection,
73 Create returns mutable Drawer from AIS;
75 -- Constructs an empty attribute management framework.
76 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
79 -- Returns the type of chordal deflection: relative to the
80 -- size of the object or absolute.
82 MaximalChordialDeviation (me) returns Length from Quantity
83 ---Purpose: Returns the maximal chordal deviation. The default
84 -- value is 0.1. Drawings of curves or patches are
85 -- made with respect to an absolute maximal chordal deviation.
89 ------------------------------------------------------------
90 SetDeviationCoefficient(me: mutable) ;
91 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_False
94 SetHLRDeviationCoefficient(me: mutable) ;
95 ---Purpose: Sets the deviation coefficient aCoefficient for
96 -- removal of hidden lines created by different
97 -- viewpoints in different presentations. The Default value is 0.02.
100 SetDeviationAngle(me: mutable) ;
101 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_False
104 SetHLRAngle(me: mutable) ;
105 ---Purpose: Sets the angle of maximum chordal deviation for
106 -- removal of hidden lines created by different viewpoints
107 -- in different presentations. The default value is 20*PI/180.
110 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
111 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_True,
112 -- sets myOwnDeviationCoefficient and myPreviousDeviationCoefficient
115 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
116 ---Purpose: Sets the hasOwnHLRDeviationCoefficient flag to Standard_True,
117 -- sets myOwnHLRDeviationCoefficient and myPreviousHLRDeviationCoefficient
120 SetDeviationAngle(me: mutable; anAngle: Real from Standard ) is redefined ;
121 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_True,
122 -- sets myOwnDeviationAngle and myPreviousDeviationAngle
124 SetHLRAngle(me: mutable; anAngle: Real from Standard )
125 ---Purpose: Sets the hasOwnHLRDeviationAngle flag to Standard_True,
126 -- sets myOwnHLRDeviationAngle and myPreviousHLRDeviationAngle
129 SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d)
131 ---Purpose: Sets the type of HLR algorithm
132 -- used by drawer's interactive objects
135 TypeOfHLR(me) returns TypeOfHLR from Prs3d
137 ---Purpose: Returns the type of HLR algorithm currently in use.
140 DeviationCoefficient(me) returns Real from Standard
141 ---Purpose: Drawings of curves or patches are made with respect
142 -- to a maximal chordal deviation. A Deviation coefficient
143 -- is used in the shading display mode. The shape is
144 -- seen decomposed into triangles. These are used to
145 -- calculate reflection of light from the surface of the
146 -- object. The triangles are formed from chords of the
147 -- curves in the shape. The deviation coefficient gives
148 -- the highest value of the angle with which a chord can
149 -- deviate from a tangent to a curve. If this limit is
150 -- reached, a new triangle is begun.
151 -- This deviation is absolute and is set through the
152 -- method: SetMaximalChordialDeviation. The default value is 0.001.
153 -- In drawing shapes, however, you are allowed to ask
154 -- for a relative deviation. This deviation will be:
155 -- SizeOfObject * DeviationCoefficient.
158 HLRDeviationCoefficient(me) returns Real from Standard
159 ---Purpose: Returns the real number value of the HLR deviation
160 -- coefficient in this framework, if the flag
161 -- hasOwnHLRDeviationCoefficient is true.
162 -- If hasOwnHLRDeviationCoefficient is false, the
163 -- shape's HLR deviation coefficient is used.
164 -- A Deviation coefficient is used in the shading display
165 -- mode. The shape is seen decomposed into triangles.
166 -- These are used to calculate reflection of light from the
167 -- surface of the object.
168 -- The triangles are formed from chords of the curves in
169 -- the shape. The deviation coefficient give the highest
170 -- value of the angle with which a chord can deviate
171 -- from a tangent to a curve. If this limit is reached, a
172 -- new triangle is begun.
173 -- To find the hidden lines, hidden line display mode
174 -- entails recalculation of the view at each different
175 -- projector perspective.
176 -- Since hidden lines entail calculations of more than
177 -- usual complexity to decompose them into these
178 -- triangles, a deviation coefficient allowing greater
179 -- tolerance is used. This increases efficiency in calculation.
180 -- The Default value is 0.02.
184 DeviationAngle(me) returns Real from Standard
185 ---Purpose: Returns myOwnDeviationAngle if hasOwnDeviationAngle is True
186 -- else gets myDeviationAngle field from Prs3d_Drawer
189 HLRAngle(me) returns Real from Standard
190 ---Purpose: Returns the real number value of the deviation angle
191 -- in hidden line removal views. The default value is 20*PI/180.
195 PreviousDeviationCoefficient(me) returns Real from Standard
196 ---Purpose: Saves the previous value used for the chordal
197 -- deviation coefficient. The default value is 0.1.
201 PreviousHLRDeviationCoefficient(me) returns Real from Standard
202 ---Purpose: returns myPreviousHLRDeviationCoefficient
206 PreviousDeviationAngle(me) returns Real from Standard
207 ---Purpose: returns myPreviousDeviationAngle
211 PreviousHLRDeviationAngle(me) returns Real from Standard
212 ---Purpose: returns myPreviousHLRDeviationAngle
216 IsOwnDeviationCoefficient(me) returns Boolean from Standard;
217 ---Purpose: Returns true if the there is a local setting for deviation
218 -- coefficient in this framework for a specific interactive object.
221 IsOwnHLRDeviationCoefficient(me) returns Boolean from Standard;
222 ---Purpose: Returns true if the there is a setting for HLR deviation
223 -- coefficient in this framework for a specific interactive object.
226 IsOwnDeviationAngle(me) returns Boolean from Standard;
227 ---Purpose: Returns true if the there is a local setting for deviation
228 -- angle in this framework for a specific interactive object.
231 IsOwnHLRDeviationAngle(me) returns Boolean from Standard;
232 ---Purpose: Returns true if the there is a setting for HLR deviation
233 -- angle in this framework for a specific interactive object.
236 Discretisation(me) returns Integer from Standard
238 ---Purpose: Draws algorithms using discretisation, a default
239 -- number of points has been set to 17. You can use the
240 -- method Prs3d_Drawer_SetDiscretisation to change this value.
242 MaximalParameterValue(me) returns Real from Standard
245 -- Sets the maximum value allowed for the first and last
246 -- parameters of an infinite curve. By default, this value is 500000.
248 IsoOnPlane(me) returns Boolean from Standard
249 ---Purpose: returns True if the drawing of isos on planes is enabled.
254 -- Attributes for the U Isoparametric lines of patches.
256 UIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
257 ---Purpose: Defines the attributes which are used when drawing an
258 -- U isoparametric curve of a face. Defines the number
259 -- of U isoparametric curves to be drawn for a single face.
260 -- The LineAspect for U isoparametric lines can be edited
261 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
262 -- The default values are:
263 -- COLOR : Quantity_NOC_GRAY75
264 -- TYPE OF LINE: Aspect_TOL_SOLID
266 -- These attributes are used by the following algorithms:
267 -- Prs3d_WFDeflectionSurface
268 -- Prs3d_WFDeflectionRestrictedFace
274 -- Attributes for the V Isoparametric line of patches.
277 VIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
278 ---Purpose: Defines the attributes which are used when drawing an
279 -- V isoparametric curve of a face. Defines the number
280 -- of V isoparametric curves to be drawn for a single face.
281 -- The LineAspect for V isoparametric lines can be edited
282 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
283 -- The default values are:
284 -- COLOR : Quantity_NOC_GRAY82
285 -- TYPE OF LINE: Aspect_TOL_SOLID
287 -- These attributes are used by the following algorithms:
288 -- Prs3d_WFDeflectionSurface
289 -- Prs3d_WFDeflectionRestrictedFace
293 -- Attributes for the free boundaries
295 FreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
296 ---Purpose: Returns a link with
297 -- Prs3d_Drawer_FreeBoundaryAspect. Stores the
298 -- values for presentation of free boundaries, in other
299 -- words, boundaries which are not shared . The
300 -- LineAspect for the free boundaries can be edited. The
301 -- default values are: Color: Quantity_NOC_GREEN
302 -- Type of line: Aspect_TOL_SOLID Width: 1.
303 -- These attributes are used by Prs3d_WFShape.
307 FreeBoundaryDraw(me) returns Boolean from Standard
308 ---Purpose: returns True if the drawing of the free boundaries is enabled.
312 -- Attributes for the wires
314 WireAspect (me:mutable) returns mutable LineAspect from Prs3d
315 ---Purpose: Returns a link with Prs3d_Drawer_WireAspect.
316 -- This method provides wire aspect settings.
317 -- The LineAspect for wires can be edited. The default values are:
318 -- Color: Quantity_NOC_RED
319 -- Type of line: Aspect_TOL_SOLID
321 -- These attributes are used by the following algorithms:
325 HasLineAspect (me) returns Boolean from Standard
326 ---Purpose: Returns true if the Interactive Object has a line
327 -- visualization aspect.
331 HasWireAspect (me) returns Boolean from Standard
332 ---Purpose: Returns true if the Drawer has a wire aspect setting active.
336 WireDraw(me) returns Boolean from Standard
337 ---Purpose: Returns a link with Prs3d_Drawer_WireDraw. This
338 -- method returns true if drawing of wires is enabled.
339 -- The default setting is true.
343 -- Attributes for the unfree boundaries
345 UnFreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
346 ---Purpose: Returns a link with
347 -- Prs3d_Drawer_UnFreeBoundaryAspect, which
348 -- provides settings for shared boundary line aspects.
349 -- The LineAspect for shared boundaries can be edited.
350 -- The default values are:
351 -- Color: Quantity_NOC_YELLOW
352 -- Type of line: Aspect_TOL_SOLID
354 -- These attributes are used by the following algorithms:
359 UnFreeBoundaryDraw(me) returns Boolean from Standard
360 ---Purpose: Returns True if the drawing of the shared boundaries
361 -- is enabled. True is the default setting.
366 -- Attributes for the lines.
369 LineAspect(me:mutable) returns mutable LineAspect from Prs3d
370 ---Purpose: Returns a link with Prs3d_Drawer_LineAspect,
371 -- which provides settings for line aspects. These
372 -- settings can be edited. The default values are:
373 -- Color: Quantity_NOC_YELLOW
374 -- Type of line: Aspect_TOL_SOLID
376 -- These attributes are used by the following algorithms:
385 HasTextAspect(me) returns Boolean from Standard
388 TextAspect(me:mutable) returns mutable TextAspect from Prs3d
390 -- Color: Quantity_NOC_YELLOW
393 LineArrowDraw(me) returns Boolean from Standard
394 ---Purpose: Returns True if the drawing of an arrow at the end of
395 -- each line is enabled. The default setting is False.
398 ArrowAspect(me:mutable) returns mutable ArrowAspect from Prs3d
403 -- Attributes for the points
405 PointAspect(me:mutable) returns mutable PointAspect from Prs3d
406 ---Purpose: Returns the point aspect setting. The default values
407 -- are: Color: Quantity_NOC_YELLOW
408 -- Type of marker: Aspect_TOM_PLUS
410 -- These attributes are used by the following algorithms:
414 HasPointAspect (me) returns Boolean from Standard
415 ---Purpose: Returns true if the Drawer has a point aspect setting active.
420 -- Attributes for the faces:
422 ShadingAspect (me:mutable) returns mutable ShadingAspect from Prs3d
424 -- Returns a link with Prs3d_Drawer_ShadingAspect,
425 -- which provides settings for shading aspects.
426 -- These settings can be edited. The default values are:
427 -- Color: Quantity_NOC_YELLOW
428 -- Material: Graphic3d_NOM_BRASS
429 -- hading aspect is obtained through decomposition of
430 -- 3D faces into triangles, each side of each triangle
431 -- being a chord of the corresponding curved edge in
432 -- the face. Reflection of light in each projector
433 -- perspective is then calculated for each of the
434 -- resultant triangular planes.
437 HasShadingAspect (me) returns Boolean from Standard
439 ---Purpose: Returns True if the Drawer has shading aspect active.
442 ShadingAspectGlobal(me) returns Boolean from Standard
444 ---Purpose: Provides the attributes for hidden line removal.
447 DrawHiddenLine(me) returns Boolean from Standard
448 ---Purpose: Returns Standard_True if the hidden lines are to be drawn.
449 -- By default the hidden lines are not drawn.
452 HiddenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
453 ---Purpose: Returns a link with
454 -- Prs3d_Drawer_HiddenLineAspect, which provides
455 -- settings for hidden line aspects.
456 -- These settings can be edited. The default values are:
457 -- Color: Quantity_NOC_YELLOW
458 -- Type of line: Aspect_TOL_DASH
463 SeenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
464 ---Purpose: Returns a link with
465 -- Prs3d_Drawer_SeenLineAspect, which provides
466 -- settings for seen line aspects.
467 -- These settings can be edited. The default values are:
468 -- Color: Quantity_NOC_YELLOW
469 -- Type of line: Aspect_TOL_SOLID
474 HasPlaneAspect(me) returns Boolean from Standard;
477 PlaneAspect(me:mutable) returns mutable PlaneAspect from Prs3d
480 -- Returns a link with Prs3d_Drawer_PlaneAspect.
481 -- This method provides settings for the appearance of planes.
484 VectorAspect(me:mutable) returns mutable LineAspect from Prs3d
485 ---Purpose: Returns a link with Prs3d_Drawer_VectorAspect,
486 -- which provides settings for the appearance of vectors.
487 -- These settings can be edited. The default values are:
488 -- Color: Quantity_NOC_SKYBLUE
489 -- Type of line: Aspect_TOL_SOLID Width: 1.
492 SetFaceBoundaryDraw (me : mutable;
493 theIsEnabled : Boolean from Standard)
495 ---Purpose: Enables or disables drawing of face boundaries for shading presentations.
496 -- The method sets drawing flag owned by the drawer that will be used during
497 -- visualization instead of the one set in link.
498 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
501 IsFaceBoundaryDraw (me) returns Boolean from Standard
503 ---Purpose: Checks whether the drawing of face boundaries is enabled or not.
505 SetFaceBoundaryAspect (me : mutable;
506 theAspect : LineAspect from Prs3d)
508 ---Purpose: Sets line aspect for face boundaries.
509 -- The method sets line aspect owned by the drawer that will be used during
510 -- visualization instead of the one set in link.
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.
517 IsOwnFaceBoundaryDraw (me) returns Boolean from Standard
519 ---Purpose: Returns true if the drawer has its own attribute for
520 -- "draw face boundaries" flag that overrides the one in the link.
523 IsOwnFaceBoundaryAspect (me) returns Boolean from Standard
525 ---Purpose: Returns true if the drawer has its own attribute for
526 -- face boundaries aspect that overrides the one in the link.
529 -- Attributes for the presentation of a Datum.
532 HasDatumAspect(me) returns Boolean from Standard;
535 DatumAspect(me:mutable) returns mutable DatumAspect from Prs3d
536 ---Purpose: Returns a link with Prs3d_Drawer_DatumAspect,
537 -- which provides settings for the appearance of datums.
538 -- These settings can be edited. The default values for
539 -- the three axes are:
540 -- Color: Quantity_NOC_PEACHPUFF
541 -- Type of line: Aspect_TOL_SOLID Width: 1.
545 -- Attributes for the presentation of a dimensions.
548 DimensionAspect (me : mutable) returns mutable DimensionAspect from Prs3d is redefined static;
549 ---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
550 -- which provides settings for the appearance of dimensions.
552 HasDimensionAspect (me) returns Boolean from Standard is static;
554 -- Purpose: Returns true if the Drawer has a dimension aspect setting active.
556 SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
557 ---Purpose: Sets dimension length model units for computing of dimension presentation.
559 SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
560 ---Purpose: Sets dimension angle model units for computing of dimension presentation.
562 DimAngleModelUnits (me) returns AsciiString from TCollection is redefined static;
563 ---Purpose: Returns angle model units for the dimension presentation.
564 ---C++: return const &
566 DimLengthModelUnits (me) returns AsciiString from TCollection is redefined static;
567 ---Purpose: Returns length model units for the dimension presentation.
568 ---C++: return const &
570 SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
571 ---Purpose: Sets length units in which value for dimension presentation is displayed.
573 SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
574 ---Purpose: Sets angle units in which value for dimension presentation is displayed.
576 DimLengthDisplayUnits (me) returns AsciiString from TCollection is redefined static;
577 ---Purpose: Returns length units in which dimension presentation is displayed.
578 ---C++: return const &
580 DimAngleDisplayUnits (me) returns AsciiString from TCollection is redefined static;
581 ---Purpose: Returns angle units in which dimension presentation is displayed.
582 ---C++: return const &
584 -- Attributes for the sections
586 SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
587 ---Purpose: Returns a link with Prs3d_Drawer_SectionAspect,
588 -- which provides settings for wires which highlight sections.
589 -- The LineAspect for the wire can be edited.
590 -- The default values are:
591 -- Color: Quantity_NOC_ORANGE
592 -- Type of line: Aspect_TOL_SOLID
594 -- These attributes are used by the following algorithms:
598 Link(me:mutable) returns any Drawer from Prs3d
600 ---C++: return const&
602 HasLink(me) returns Boolean from Standard
606 Link (me:mutable; aDrawer: Drawer from Prs3d)
611 ClearLocalAttributes(me:mutable) is virtual;
612 ---Purpose: Removes attributes stored in a Local Context.
614 WasLastLocal(me) returns Boolean from Standard;
616 ---Purpose: Returns true if the last called attribute was local; false if it was global.
618 HasLocalAttributes(me) returns Boolean from Standard;
621 -- Returns true if a Local Context has stored attributes
622 -- for Interactive Objects.
626 myLink : Drawer from Prs3d;
627 hasLocalAttributes : Boolean from Standard;
629 myhasOwnDeviationCoefficient : Boolean from Standard;
630 myOwnDeviationCoefficient : Real from Standard;
631 myPreviousDeviationCoefficient : Real from Standard;
633 myhasOwnHLRDeviationCoefficient : Boolean from Standard;
634 myOwnHLRDeviationCoefficient : Real from Standard;
635 myPreviousHLRDeviationCoefficient: Real from Standard;
637 myhasOwnDeviationAngle : Boolean from Standard;
638 myOwnDeviationAngle : Real from Standard;
639 myPreviousDeviationAngle : Real from Standard;
641 myhasOwnHLRDeviationAngle : Boolean from Standard;
642 myOwnHLRDeviationAngle : Real from Standard;
643 myPreviousHLRDeviationAngle : Real from Standard;
644 myHasOwnFaceBoundaryDraw : Boolean from Standard;
646 myHasOwnDimLengthModelUnits : Boolean from Standard;
647 myHasOwnDimLengthDisplayUnits : Boolean from Standard;
648 myHasOwnDimAngleModelUnits : Boolean from Standard;
649 myHasOwnDimAngleDisplayUnits : Boolean from Standard;