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,
70 Create returns mutable Drawer from AIS;
72 -- Constructs an empty attribute management framework.
73 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
76 -- Returns the type of chordal deflection: relative to the
77 -- size of the object or absolute.
79 MaximalChordialDeviation (me) returns Length from Quantity
80 ---Purpose: Returns the maximal chordal deviation. The default
81 -- value is 0.1. Drawings of curves or patches are
82 -- made with respect to an absolute maximal chordal deviation.
86 ------------------------------------------------------------
87 SetDeviationCoefficient(me: mutable) ;
88 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_False
91 SetHLRDeviationCoefficient(me: mutable) ;
92 ---Purpose: Sets the deviation coefficient aCoefficient for
93 -- removal of hidden lines created by different
94 -- viewpoints in different presentations. The Default value is 0.02.
97 SetDeviationAngle(me: mutable) ;
98 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_False
101 SetHLRAngle(me: mutable) ;
102 ---Purpose: Sets the angle of maximum chordal deviation for
103 -- removal of hidden lines created by different viewpoints
104 -- in different presentations. The default value is 20*PI/180.
107 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
108 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_True,
109 -- sets myOwnDeviationCoefficient and myPreviousDeviationCoefficient
112 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
113 ---Purpose: Sets the hasOwnHLRDeviationCoefficient flag to Standard_True,
114 -- sets myOwnHLRDeviationCoefficient and myPreviousHLRDeviationCoefficient
117 SetDeviationAngle(me: mutable; anAngle: Real from Standard ) is redefined ;
118 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_True,
119 -- sets myOwnDeviationAngle and myPreviousDeviationAngle
121 SetHLRAngle(me: mutable; anAngle: Real from Standard )
122 ---Purpose: Sets the hasOwnHLRDeviationAngle flag to Standard_True,
123 -- sets myOwnHLRDeviationAngle and myPreviousHLRDeviationAngle
126 SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d)
128 ---Purpose: Sets the type of HLR algorithm
129 -- used by drawer's interactive objects
132 TypeOfHLR(me) returns TypeOfHLR from Prs3d
134 ---Purpose: Returns the type of HLR algorithm currently in use.
137 DeviationCoefficient(me) returns Real from Standard
138 ---Purpose: Drawings of curves or patches are made with respect
139 -- to a maximal chordal deviation. A Deviation coefficient
140 -- is used in the shading display mode. The shape is
141 -- seen decomposed into triangles. These are used to
142 -- calculate reflection of light from the surface of the
143 -- object. The triangles are formed from chords of the
144 -- curves in the shape. The deviation coefficient gives
145 -- the highest value of the angle with which a chord can
146 -- deviate from a tangent to a curve. If this limit is
147 -- reached, a new triangle is begun.
148 -- This deviation is absolute and is set through the
149 -- method: SetMaximalChordialDeviation. The default value is 0.001.
150 -- In drawing shapes, however, you are allowed to ask
151 -- for a relative deviation. This deviation will be:
152 -- SizeOfObject * DeviationCoefficient.
155 HLRDeviationCoefficient(me) returns Real from Standard
156 ---Purpose: Returns the real number value of the HLR deviation
157 -- coefficient in this framework, if the flag
158 -- hasOwnHLRDeviationCoefficient is true.
159 -- If hasOwnHLRDeviationCoefficient is false, the
160 -- shape's HLR deviation coefficient is used.
161 -- A Deviation coefficient is used in the shading display
162 -- mode. The shape is seen decomposed into triangles.
163 -- These are used to calculate reflection of light from the
164 -- surface of the object.
165 -- The triangles are formed from chords of the curves in
166 -- the shape. The deviation coefficient give the highest
167 -- value of the angle with which a chord can deviate
168 -- from a tangent to a curve. If this limit is reached, a
169 -- new triangle is begun.
170 -- To find the hidden lines, hidden line display mode
171 -- entails recalculation of the view at each different
172 -- projector perspective.
173 -- Since hidden lines entail calculations of more than
174 -- usual complexity to decompose them into these
175 -- triangles, a deviation coefficient allowing greater
176 -- tolerance is used. This increases efficiency in calculation.
177 -- The Default value is 0.02.
181 DeviationAngle(me) returns Real from Standard
182 ---Purpose: Returns myOwnDeviationAngle if hasOwnDeviationAngle is True
183 -- else gets myDeviationAngle field from Prs3d_Drawer
186 HLRAngle(me) returns Real from Standard
187 ---Purpose: Returns the real number value of the deviation angle
188 -- in hidden line removal views. The default value is 20*PI/180.
192 PreviousDeviationCoefficient(me) returns Real from Standard
193 ---Purpose: Saves the previous value used for the chordal
194 -- deviation coefficient. The default value is 0.1.
198 PreviousHLRDeviationCoefficient(me) returns Real from Standard
199 ---Purpose: returns myPreviousHLRDeviationCoefficient
203 PreviousDeviationAngle(me) returns Real from Standard
204 ---Purpose: returns myPreviousDeviationAngle
208 PreviousHLRDeviationAngle(me) returns Real from Standard
209 ---Purpose: returns myPreviousHLRDeviationAngle
213 IsOwnDeviationCoefficient(me) returns Boolean from Standard;
214 ---Purpose: Returns true if the there is a local setting for deviation
215 -- coefficient in this framework for a specific interactive object.
218 IsOwnHLRDeviationCoefficient(me) returns Boolean from Standard;
219 ---Purpose: Returns true if the there is a setting for HLR deviation
220 -- coefficient in this framework for a specific interactive object.
223 IsOwnDeviationAngle(me) returns Boolean from Standard;
224 ---Purpose: Returns true if the there is a local setting for deviation
225 -- angle in this framework for a specific interactive object.
228 IsOwnHLRDeviationAngle(me) returns Boolean from Standard;
229 ---Purpose: Returns true if the there is a setting for HLR deviation
230 -- angle in this framework for a specific interactive object.
233 Discretisation(me) returns Integer from Standard
235 ---Purpose: Draws algorithms using discretisation, a default
236 -- number of points has been set to 17. You can use the
237 -- method Prs3d_Drawer_SetDiscretisation to change this value.
239 MaximalParameterValue(me) returns Real from Standard
242 -- Sets the maximum value allowed for the first and last
243 -- parameters of an infinite curve. By default, this value is 500000.
245 IsoOnPlane(me) returns Boolean from Standard
246 ---Purpose: returns True if the drawing of isos on planes is enabled.
251 -- Attributes for the U Isoparametric lines of patches.
253 UIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
254 ---Purpose: Defines the attributes which are used when drawing an
255 -- U isoparametric curve of a face. Defines the number
256 -- of U isoparametric curves to be drawn for a single face.
257 -- The LineAspect for U isoparametric lines can be edited
258 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
259 -- The default values are:
260 -- COLOR : Quantity_NOC_GRAY75
261 -- TYPE OF LINE: Aspect_TOL_SOLID
263 -- These attributes are used by the following algorithms:
264 -- Prs3d_WFDeflectionSurface
265 -- Prs3d_WFDeflectionRestrictedFace
271 -- Attributes for the V Isoparametric line of patches.
274 VIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
275 ---Purpose: Defines the attributes which are used when drawing an
276 -- V isoparametric curve of a face. Defines the number
277 -- of V isoparametric curves to be drawn for a single face.
278 -- The LineAspect for V isoparametric lines can be edited
279 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
280 -- The default values are:
281 -- COLOR : Quantity_NOC_GRAY82
282 -- TYPE OF LINE: Aspect_TOL_SOLID
284 -- These attributes are used by the following algorithms:
285 -- Prs3d_WFDeflectionSurface
286 -- Prs3d_WFDeflectionRestrictedFace
290 -- Attributes for the free boundaries
292 FreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
293 ---Purpose: Returns a link with
294 -- Prs3d_Drawer_FreeBoundaryAspect. Stores the
295 -- values for presentation of free boundaries, in other
296 -- words, boundaries which are not shared . The
297 -- LineAspect for the free boundaries can be edited. The
298 -- default values are: Color: Quantity_NOC_GREEN
299 -- Type of line: Aspect_TOL_SOLID Width: 1.
300 -- These attributes are used by Prs3d_WFShape.
304 FreeBoundaryDraw(me) returns Boolean from Standard
305 ---Purpose: returns True if the drawing of the free boundaries is enabled.
309 -- Attributes for the wires
311 WireAspect (me:mutable) returns mutable LineAspect from Prs3d
312 ---Purpose: Returns a link with Prs3d_Drawer_WireAspect.
313 -- This method provides wire aspect settings.
314 -- The LineAspect for wires can be edited. The default values are:
315 -- Color: Quantity_NOC_RED
316 -- Type of line: Aspect_TOL_SOLID
318 -- These attributes are used by the following algorithms:
322 HasLineAspect (me) returns Boolean from Standard
323 ---Purpose: Returns true if the Interactive Object has a line
324 -- visualization aspect.
328 HasWireAspect (me) returns Boolean from Standard
329 ---Purpose: Returns true if the Drawer has a wire aspect setting active.
333 WireDraw(me) returns Boolean from Standard
334 ---Purpose: Returns a link with Prs3d_Drawer_WireDraw. This
335 -- method returns true if drawing of wires is enabled.
336 -- The default setting is true.
340 -- Attributes for the unfree boundaries
342 UnFreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
343 ---Purpose: Returns a link with
344 -- Prs3d_Drawer_UnFreeBoundaryAspect, which
345 -- provides settings for shared boundary line aspects.
346 -- The LineAspect for shared boundaries can be edited.
347 -- The default values are:
348 -- Color: Quantity_NOC_YELLOW
349 -- Type of line: Aspect_TOL_SOLID
351 -- These attributes are used by the following algorithms:
356 UnFreeBoundaryDraw(me) returns Boolean from Standard
357 ---Purpose: Returns True if the drawing of the shared boundaries
358 -- is enabled. True is the default setting.
363 -- Attributes for the lines.
366 LineAspect(me:mutable) returns mutable LineAspect from Prs3d
367 ---Purpose: Returns a link with Prs3d_Drawer_LineAspect,
368 -- which provides settings for line aspects. These
369 -- settings can be edited. The default values are:
370 -- Color: Quantity_NOC_YELLOW
371 -- Type of line: Aspect_TOL_SOLID
373 -- These attributes are used by the following algorithms:
382 HasTextAspect(me) returns Boolean from Standard
385 TextAspect(me:mutable) returns mutable TextAspect from Prs3d
387 -- Color: Quantity_NOC_YELLOW
390 LineArrowDraw(me) returns Boolean from Standard
391 ---Purpose: Returns True if the drawing of an arrow at the end of
392 -- each line is enabled. The default setting is False.
395 ArrowAspect(me:mutable) returns mutable ArrowAspect from Prs3d
400 -- Attributes for the points
402 PointAspect(me:mutable) returns mutable PointAspect from Prs3d
403 ---Purpose: Returns the point aspect setting. The default values
404 -- are: Color: Quantity_NOC_YELLOW
405 -- Type of marker: Aspect_TOM_PLUS
407 -- These attributes are used by the following algorithms:
411 HasPointAspect (me) returns Boolean from Standard
412 ---Purpose: Returns true if the Drawer has a point aspect setting active.
417 -- Attributes for the faces:
419 ShadingAspect (me:mutable) returns mutable ShadingAspect from Prs3d
421 -- Returns a link with Prs3d_Drawer_ShadingAspect,
422 -- which provides settings for shading aspects.
423 -- These settings can be edited. The default values are:
424 -- Color: Quantity_NOC_YELLOW
425 -- Material: Graphic3d_NOM_BRASS
426 -- hading aspect is obtained through decomposition of
427 -- 3D faces into triangles, each side of each triangle
428 -- being a chord of the corresponding curved edge in
429 -- the face. Reflection of light in each projector
430 -- perspective is then calculated for each of the
431 -- resultant triangular planes.
434 HasShadingAspect (me) returns Boolean from Standard
436 ---Purpose: Returns True if the Drawer has shading aspect active.
439 ShadingAspectGlobal(me) returns Boolean from Standard
441 ---Purpose: Provides the attributes for hidden line removal.
444 DrawHiddenLine(me) returns Boolean from Standard
445 ---Purpose: Returns Standard_True if the hidden lines are to be drawn.
446 -- By default the hidden lines are not drawn.
449 HiddenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
450 ---Purpose: Returns a link with
451 -- Prs3d_Drawer_HiddenLineAspect, which provides
452 -- settings for hidden line aspects.
453 -- These settings can be edited. The default values are:
454 -- Color: Quantity_NOC_YELLOW
455 -- Type of line: Aspect_TOL_DASH
460 SeenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
461 ---Purpose: Returns a link with
462 -- Prs3d_Drawer_SeenLineAspect, which provides
463 -- settings for seen line aspects.
464 -- These settings can be edited. The default values are:
465 -- Color: Quantity_NOC_YELLOW
466 -- Type of line: Aspect_TOL_SOLID
471 HasPlaneAspect(me) returns Boolean from Standard;
474 PlaneAspect(me:mutable) returns mutable PlaneAspect from Prs3d
477 -- Returns a link with Prs3d_Drawer_PlaneAspect.
478 -- This method provides settings for the appearance of planes.
481 VectorAspect(me:mutable) returns mutable LineAspect from Prs3d
482 ---Purpose: Returns a link with Prs3d_Drawer_VectorAspect,
483 -- which provides settings for the appearance of vectors.
484 -- These settings can be edited. The default values are:
485 -- Color: Quantity_NOC_SKYBLUE
486 -- Type of line: Aspect_TOL_SOLID Width: 1.
489 SetFaceBoundaryDraw (me : mutable;
490 theIsEnabled : Boolean from Standard)
492 ---Purpose: Enables or disables drawing of face boundaries for shading presentations.
493 -- The method sets drawing flag owned by the drawer that will be used during
494 -- visualization instead of the one set in link.
495 -- theIsEnabled is a boolean flag indicating whether the face boundaries should be
498 IsFaceBoundaryDraw (me) returns Boolean from Standard
500 ---Purpose: Checks whether the drawing of face boundaries is enabled or not.
502 SetFaceBoundaryAspect (me : mutable;
503 theAspect : LineAspect from Prs3d)
505 ---Purpose: Sets line aspect for face boundaries.
506 -- The method sets line aspect owned by the drawer that will be used during
507 -- visualization instead of the one set in link.
508 -- theAspect is the line aspect that determines the look of the face boundaries.
510 FaceBoundaryAspect (me : mutable) returns mutable LineAspect from Prs3d
512 ---Purpose: Returns line aspect of face boundaries.
514 IsOwnFaceBoundaryDraw (me) returns Boolean from Standard
516 ---Purpose: Returns true if the drawer has its own attribute for
517 -- "draw face boundaries" flag that overrides the one in the link.
520 IsOwnFaceBoundaryAspect (me) returns Boolean from Standard
522 ---Purpose: Returns true if the drawer has its own attribute for
523 -- face boundaries aspect that overrides the one in the link.
526 -- Attributes for the presentation of a Datum.
529 HasDatumAspect(me) returns Boolean from Standard;
532 DatumAspect(me:mutable) returns mutable DatumAspect from Prs3d
533 ---Purpose: Returns a link with Prs3d_Drawer_DatumAspect,
534 -- which provides settings for the appearance of datums.
535 -- These settings can be edited. The default values for
536 -- the three axes are:
537 -- Color: Quantity_NOC_PEACHPUFF
538 -- Type of line: Aspect_TOL_SOLID Width: 1.
542 -- Attributes for the presentation of a dimensions.
545 DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
546 ---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
547 -- which provides settings for the appearance of dimensions.
550 HasDimensionAspect (me) returns Boolean from Standard
552 ---Purpose: Returns true if the Drawer has a dimension aspect setting active.
555 -- Attributes for the sections
557 SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
558 ---Purpose: Returns a link with Prs3d_Drawer_SectionAspect,
559 -- which provides settings for wires which highlight sections.
560 -- The LineAspect for the wire can be edited.
561 -- The default values are:
562 -- Color: Quantity_NOC_ORANGE
563 -- Type of line: Aspect_TOL_SOLID
565 -- These attributes are used by the following algorithms:
569 Link(me:mutable) returns any Drawer from Prs3d
571 ---C++: return const&
573 HasLink(me) returns Boolean from Standard
577 Link (me:mutable; aDrawer: Drawer from Prs3d)
582 ClearLocalAttributes(me:mutable) is virtual;
583 ---Purpose: Removes attributes stored in a Local Context.
585 WasLastLocal(me) returns Boolean from Standard;
587 ---Purpose: Returns true if the last called attribute was local; false if it was global.
589 HasLocalAttributes(me) returns Boolean from Standard;
592 -- Returns true if a Local Context has stored attributes
593 -- for Interactive Objects.
596 myLink : Drawer from Prs3d;
597 hasLocalAttributes : Boolean from Standard;
599 myhasOwnDeviationCoefficient : Boolean from Standard;
600 myOwnDeviationCoefficient : Real from Standard;
601 myPreviousDeviationCoefficient : Real from Standard;
603 myhasOwnHLRDeviationCoefficient : Boolean from Standard;
604 myOwnHLRDeviationCoefficient : Real from Standard;
605 myPreviousHLRDeviationCoefficient: Real from Standard;
607 myhasOwnDeviationAngle : Boolean from Standard;
608 myOwnDeviationAngle : Real from Standard;
609 myPreviousDeviationAngle : Real from Standard;
611 myhasOwnHLRDeviationAngle : Boolean from Standard;
612 myOwnHLRDeviationAngle : Real from Standard;
613 myPreviousHLRDeviationAngle : Real from Standard;
614 myHasOwnFaceBoundaryDraw : Boolean from Standard;