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 LengthAspect from Prs3d,
61 AngleAspect from Prs3d,
62 PlaneAspect from Prs3d,
63 RadiusAspect from Prs3d,
64 ArrowAspect from Prs3d,
65 TypeOfDeflection from Aspect,
66 NameOfColor from Quantity,
67 PlaneAngle from Quantity,
71 Create returns mutable Drawer from AIS;
73 -- Constructs an empty attribute management framework.
74 TypeOfDeflection(me) returns TypeOfDeflection from Aspect
77 -- Returns the type of chordal deflection: relative to the
78 -- size of the object or absolute.
80 MaximalChordialDeviation (me) returns Length from Quantity
81 ---Purpose: Returns the maximal chordal deviation. The default
82 -- value is 0.1. Drawings of curves or patches are
83 -- made with respect to an absolute maximal chordal deviation.
87 ------------------------------------------------------------
88 SetDeviationCoefficient(me: mutable) ;
89 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_False
92 SetHLRDeviationCoefficient(me: mutable) ;
93 ---Purpose: Sets the deviation coefficient aCoefficient for
94 -- removal of hidden lines created by different
95 -- viewpoints in different presentations. The Default value is 0.02.
98 SetDeviationAngle(me: mutable) ;
99 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_False
102 SetHLRAngle(me: mutable) ;
103 ---Purpose: Sets the angle of maximum chordal deviation for
104 -- removal of hidden lines created by different viewpoints
105 -- in different presentations. The default value is 20*PI/180.
108 SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
109 ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_True,
110 -- sets myOwnDeviationCoefficient and myPreviousDeviationCoefficient
113 SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard )
114 ---Purpose: Sets the hasOwnHLRDeviationCoefficient flag to Standard_True,
115 -- sets myOwnHLRDeviationCoefficient and myPreviousHLRDeviationCoefficient
118 SetDeviationAngle(me: mutable; anAngle: Real from Standard ) is redefined ;
119 ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_True,
120 -- sets myOwnDeviationAngle and myPreviousDeviationAngle
122 SetHLRAngle(me: mutable; anAngle: Real from Standard )
123 ---Purpose: Sets the hasOwnHLRDeviationAngle flag to Standard_True,
124 -- sets myOwnHLRDeviationAngle and myPreviousHLRDeviationAngle
129 DeviationCoefficient(me) returns Real from Standard
130 ---Purpose: Drawings of curves or patches are made with respect
131 -- to a maximal chordal deviation. A Deviation coefficient
132 -- is used in the shading display mode. The shape is
133 -- seen decomposed into triangles. These are used to
134 -- calculate reflection of light from the surface of the
135 -- object. The triangles are formed from chords of the
136 -- curves in the shape. The deviation coefficient gives
137 -- the highest value of the angle with which a chord can
138 -- deviate from a tangent to a curve. If this limit is
139 -- reached, a new triangle is begun.
140 -- This deviation is absolute and is set through the
141 -- method: SetMaximalChordialDeviation. The default value is 0.001.
142 -- In drawing shapes, however, you are allowed to ask
143 -- for a relative deviation. This deviation will be:
144 -- SizeOfObject * DeviationCoefficient.
147 HLRDeviationCoefficient(me) returns Real from Standard
148 ---Purpose: Returns the real number value of the HLR deviation
149 -- coefficient in this framework, if the flag
150 -- hasOwnHLRDeviationCoefficient is true.
151 -- If hasOwnHLRDeviationCoefficient is false, the
152 -- shape's HLR deviation coefficient is used.
153 -- A Deviation coefficient is used in the shading display
154 -- mode. The shape is seen decomposed into triangles.
155 -- These are used to calculate reflection of light from the
156 -- surface of the object.
157 -- The triangles are formed from chords of the curves in
158 -- the shape. The deviation coefficient give the highest
159 -- value of the angle with which a chord can deviate
160 -- from a tangent to a curve. If this limit is reached, a
161 -- new triangle is begun.
162 -- To find the hidden lines, hidden line display mode
163 -- entails recalculation of the view at each different
164 -- projector perspective.
165 -- Since hidden lines entail calculations of more than
166 -- usual complexity to decompose them into these
167 -- triangles, a deviation coefficient allowing greater
168 -- tolerance is used. This increases efficiency in calculation.
169 -- The Default value is 0.02.
173 DeviationAngle(me) returns Real from Standard
174 ---Purpose: Returns myOwnDeviationAngle if hasOwnDeviationAngle is True
175 -- else gets myDeviationAngle field from Prs3d_Drawer
178 HLRAngle(me) returns Real from Standard
179 ---Purpose: Returns the real number value of the deviation angle
180 -- in hidden line removal views. The default value is 20*PI/180.
184 PreviousDeviationCoefficient(me) returns Real from Standard
185 ---Purpose: Saves the previous value used for the chordal
186 -- deviation coefficient. The default value is 0.1.
190 PreviousHLRDeviationCoefficient(me) returns Real from Standard
191 ---Purpose: returns myPreviousHLRDeviationCoefficient
195 PreviousDeviationAngle(me) returns Real from Standard
196 ---Purpose: returns myPreviousDeviationAngle
200 PreviousHLRDeviationAngle(me) returns Real from Standard
201 ---Purpose: returns myPreviousHLRDeviationAngle
205 IsOwnDeviationCoefficient(me) returns Boolean from Standard;
206 ---Purpose: Returns true if the there is a local setting for deviation
207 -- coefficient in this framework for a specific interactive object.
210 IsOwnHLRDeviationCoefficient(me) returns Boolean from Standard;
211 ---Purpose: Returns true if the there is a setting for HLR deviation
212 -- coefficient in this framework for a specific interactive object.
215 IsOwnDeviationAngle(me) returns Boolean from Standard;
216 ---Purpose: Returns true if the there is a local setting for deviation
217 -- angle in this framework for a specific interactive object.
220 IsOwnHLRDeviationAngle(me) returns Boolean from Standard;
221 ---Purpose: Returns true if the there is a setting for HLR deviation
222 -- angle in this framework for a specific interactive object.
225 Discretisation(me) returns Integer from Standard
227 ---Purpose: Draws algorithms using discretisation, a default
228 -- number of points has been set to 17. You can use the
229 -- method Prs3d_Drawer_SetDiscretisation to change this value.
231 MaximalParameterValue(me) returns Real from Standard
234 -- Sets the maximum value allowed for the first and last
235 -- parameters of an infinite curve. By default, this value is 500000.
237 IsoOnPlane(me) returns Boolean from Standard
238 ---Purpose: returns True if the drawing of isos on planes is enabled.
243 -- Attributes for the U Isoparametric lines of patches.
245 UIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
246 ---Purpose: Defines the attributes which are used when drawing an
247 -- U isoparametric curve of a face. Defines the number
248 -- of U isoparametric curves to be drawn for a single face.
249 -- The LineAspect for U isoparametric lines can be edited
250 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
251 -- The default values are:
252 -- COLOR : Quantity_NOC_GRAY75
253 -- TYPE OF LINE: Aspect_TOL_SOLID
255 -- These attributes are used by the following algorithms:
256 -- Prs3d_WFDeflectionSurface
257 -- Prs3d_WFDeflectionRestrictedFace
263 -- Attributes for the V Isoparametric line of patches.
266 VIsoAspect (me:mutable) returns mutable IsoAspect from Prs3d
267 ---Purpose: Defines the attributes which are used when drawing an
268 -- V isoparametric curve of a face. Defines the number
269 -- of V isoparametric curves to be drawn for a single face.
270 -- The LineAspect for V isoparametric lines can be edited
271 -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
272 -- The default values are:
273 -- COLOR : Quantity_NOC_GRAY82
274 -- TYPE OF LINE: Aspect_TOL_SOLID
276 -- These attributes are used by the following algorithms:
277 -- Prs3d_WFDeflectionSurface
278 -- Prs3d_WFDeflectionRestrictedFace
282 -- Attributes for the free boundaries
284 FreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
285 ---Purpose: Returns a link with
286 -- Prs3d_Drawer_FreeBoundaryAspect. Stores the
287 -- values for presentation of free boundaries, in other
288 -- words, boundaries which are not shared . The
289 -- LineAspect for the free boundaries can be edited. The
290 -- default values are: Color: Quantity_NOC_GREEN
291 -- Type of line: Aspect_TOL_SOLID Width: 1.
292 -- These attributes are used by Prs3d_WFShape.
296 FreeBoundaryDraw(me) returns Boolean from Standard
297 ---Purpose: returns True if the drawing of the free boundaries is enabled.
301 -- Attributes for the wires
303 WireAspect (me:mutable) returns mutable LineAspect from Prs3d
304 ---Purpose: Returns a link with Prs3d_Drawer_WireAspect.
305 -- This method provides wire aspect settings.
306 -- The LineAspect for wires can be edited. The default values are:
307 -- Color: Quantity_NOC_RED
308 -- Type of line: Aspect_TOL_SOLID
310 -- These attributes are used by the following algorithms:
314 HasLineAspect (me) returns Boolean from Standard
315 ---Purpose: Returns true if the Interactive Object has a line
316 -- visualization aspect.
320 HasWireAspect (me) returns Boolean from Standard
321 ---Purpose: Returns true if the Drawer has a wire aspect setting active.
325 WireDraw(me) returns Boolean from Standard
326 ---Purpose: Returns a link with Prs3d_Drawer_WireDraw. This
327 -- method returns true if drawing of wires is enabled.
328 -- The default setting is true.
332 -- Attributes for the unfree boundaries
334 UnFreeBoundaryAspect (me:mutable) returns mutable LineAspect from Prs3d
335 ---Purpose: Returns a link with
336 -- Prs3d_Drawer_UnFreeBoundaryAspect, which
337 -- provides settings for shared boundary line aspects.
338 -- The LineAspect for shared boundaries can be edited.
339 -- The default values are:
340 -- Color: Quantity_NOC_YELLOW
341 -- Type of line: Aspect_TOL_SOLID
343 -- These attributes are used by the following algorithms:
348 UnFreeBoundaryDraw(me) returns Boolean from Standard
349 ---Purpose: Returns True if the drawing of the shared boundaries
350 -- is enabled. True is the default setting.
355 -- Attributes for the lines.
358 LineAspect(me:mutable) returns mutable LineAspect from Prs3d
359 ---Purpose: Returns a link with Prs3d_Drawer_LineAspect,
360 -- which provides settings for line aspects. These
361 -- settings can be edited. The default values are:
362 -- Color: Quantity_NOC_YELLOW
363 -- Type of line: Aspect_TOL_SOLID
365 -- These attributes are used by the following algorithms:
374 HasTextAspect(me) returns Boolean from Standard
377 TextAspect(me:mutable) returns mutable TextAspect from Prs3d
379 -- Color: Quantity_NOC_YELLOW
382 LineArrowDraw(me) returns Boolean from Standard
383 ---Purpose: Returns True if the drawing of an arrow at the end of
384 -- each line is enabled. The default setting is False.
387 ArrowAspect(me:mutable) returns mutable ArrowAspect from Prs3d
392 -- Attributes for the points
394 PointAspect(me:mutable) returns mutable PointAspect from Prs3d
395 ---Purpose: Returns the point aspect setting. The default values
396 -- are: Color: Quantity_NOC_YELLOW
397 -- Type of marker: Aspect_TOM_PLUS
399 -- These attributes are used by the following algorithms:
403 HasPointAspect (me) returns Boolean from Standard
404 ---Purpose: Returns true if the Drawer has a point aspect setting active.
409 -- Attributes for the faces:
411 ShadingAspect (me:mutable) returns mutable ShadingAspect from Prs3d
413 -- Returns a link with Prs3d_Drawer_ShadingAspect,
414 -- which provides settings for shading aspects.
415 -- These settings can be edited. The default values are:
416 -- Color: Quantity_NOC_YELLOW
417 -- Material: Graphic3d_NOM_BRASS
418 -- hading aspect is obtained through decomposition of
419 -- 3D faces into triangles, each side of each triangle
420 -- being a chord of the corresponding curved edge in
421 -- the face. Reflection of light in each projector
422 -- perspective is then calculated for each of the
423 -- resultant triangular planes.
426 HasShadingAspect (me) returns Boolean from Standard
428 ---Purpose: Returns True if the Drawer has shading aspect active.
431 ShadingAspectGlobal(me) returns Boolean from Standard
433 ---Purpose: Provides the attributes for hidden line removal.
436 DrawHiddenLine(me) returns Boolean from Standard
437 ---Purpose: Returns Standard_True if the hidden lines are to be drawn.
438 -- By default the hidden lines are not drawn.
441 HiddenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
442 ---Purpose: Returns a link with
443 -- Prs3d_Drawer_HiddenLineAspect, which provides
444 -- settings for hidden line aspects.
445 -- These settings can be edited. The default values are:
446 -- Color: Quantity_NOC_YELLOW
447 -- Type of line: Aspect_TOL_DASH
452 SeenLineAspect(me:mutable) returns mutable LineAspect from Prs3d
453 ---Purpose: Returns a link with
454 -- Prs3d_Drawer_SeenLineAspect, which provides
455 -- settings for seen line aspects.
456 -- These settings can be edited. The default values are:
457 -- Color: Quantity_NOC_YELLOW
458 -- Type of line: Aspect_TOL_SOLID
463 HasPlaneAspect(me) returns Boolean from Standard;
466 PlaneAspect(me:mutable) returns mutable PlaneAspect from Prs3d
469 -- Returns a link with Prs3d_Drawer_PlaneAspect.
470 -- This method provides settings for the appearance of planes.
473 VectorAspect(me:mutable) returns mutable LineAspect from Prs3d
474 ---Purpose: Returns a link with Prs3d_Drawer_VectorAspect,
475 -- which provides settings for the appearance of vectors.
476 -- These settings can be edited. The default values are:
477 -- Color: Quantity_NOC_SKYBLUE
478 -- Type of line: Aspect_TOL_SOLID Width: 1.
483 -- Attributes for the presentation of a Datum.
486 HasDatumAspect(me) returns Boolean from Standard;
489 DatumAspect(me:mutable) returns mutable DatumAspect from Prs3d
490 ---Purpose: Returns a link with Prs3d_Drawer_DatumAspect,
491 -- which provides settings for the appearance of datums.
492 -- These settings can be edited. The default values for
493 -- the three axes are:
494 -- Color: Quantity_NOC_PEACHPUFF
495 -- Type of line: Aspect_TOL_SOLID Width: 1.
499 -- Attributes for the presentation of a Length.
502 LengthAspect(me:mutable) returns mutable LengthAspect from Prs3d
503 ---Purpose: Returns a link with Prs3d_Drawer_LengthAspect,
504 -- which provides settings for the appearance of lengths.
507 HasLengthAspect (me) returns Boolean from Standard
509 ---Purpose: Returns true if the Drawer has a length aspect setting active.
513 -- Attributes for the presentation of a Angle.
516 AngleAspect(me:mutable) returns mutable AngleAspect from Prs3d
517 ---Purpose: Returns a link with Prs3d_Drawer_AngleAspect,
518 -- which provides settings for lines used to display angles.
521 HasAngleAspect (me) returns Boolean from Standard
523 ---Purpose: Returns true if the Drawer has an angle aspect
528 -- Attributes for the presentation of a Radius.
531 RadiusAspect(me) returns mutable RadiusAspect from Prs3d
532 ---Purpose: Returns a link with Prs3d_Drawer_RadiusAspect,
533 -- which provides settings for lines which serve to display radii.
536 -- Attributes for the sections
538 SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
539 ---Purpose: Returns a link with Prs3d_Drawer_SectionAspect,
540 -- which provides settings for wires which highlight sections.
541 -- The LineAspect for the wire can be edited.
542 -- The default values are:
543 -- Color: Quantity_NOC_ORANGE
544 -- Type of line: Aspect_TOL_SOLID
546 -- These attributes are used by the following algorithms:
550 Link(me:mutable) returns any Drawer from Prs3d
552 ---C++: return const&
554 HasLink(me) returns Boolean from Standard
558 Link (me:mutable; aDrawer: Drawer from Prs3d)
563 ClearLocalAttributes(me:mutable) is virtual;
564 ---Purpose: Removes attributes stored in a Local Context.
566 WasLastLocal(me) returns Boolean from Standard;
568 ---Purpose: Returns true if the last called attribute was local; false if it was global.
570 HasLocalAttributes(me) returns Boolean from Standard;
573 -- Returns true if a Local Context has stored attributes
574 -- for Interactive Objects.
577 myLink : Drawer from Prs3d;
578 hasLocalAttributes : Boolean from Standard;
580 myhasOwnDeviationCoefficient : Boolean from Standard;
581 myOwnDeviationCoefficient : Real from Standard;
582 myPreviousDeviationCoefficient : Real from Standard;
584 myhasOwnHLRDeviationCoefficient : Boolean from Standard;
585 myOwnHLRDeviationCoefficient : Real from Standard;
586 myPreviousHLRDeviationCoefficient: Real from Standard;
588 myhasOwnDeviationAngle : Boolean from Standard;
589 myOwnDeviationAngle : Real from Standard;
590 myPreviousDeviationAngle : Real from Standard;
592 myhasOwnHLRDeviationAngle : Boolean from Standard;
593 myOwnHLRDeviationAngle : Real from Standard;
594 myPreviousHLRDeviationAngle : Real from Standard;