0025695: Visualization, AIS_InteractiveContext - define default HilightMode
[occt.git] / src / Prs3d / Prs3d_Drawer.hxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _Prs3d_Drawer_HeaderFile
16 #define _Prs3d_Drawer_HeaderFile
17
18 #include <Standard.hxx>
19 #include <Standard_Type.hxx>
20
21 #include <Standard_Integer.hxx>
22 #include <Standard_Boolean.hxx>
23 #include <Quantity_Length.hxx>
24 #include <Aspect_TypeOfDeflection.hxx>
25 #include <Graphic3d_GroupAspect.hxx>
26 #include <Graphic3d_PresentationAttributes.hxx>
27 #include <Graphic3d_ShaderProgram.hxx>
28 #include <Standard_Real.hxx>
29 #include <Prs3d_VertexDrawMode.hxx>
30 #include <Prs3d_DimensionUnits.hxx>
31 #include <Prs3d_TypeOfHLR.hxx>
32 #include <MMgt_TShared.hxx>
33
34 class Prs3d_IsoAspect;
35 class Prs3d_LineAspect;
36 class Prs3d_TextAspect;
37 class Prs3d_ShadingAspect;
38 class Prs3d_PointAspect;
39 class Prs3d_PlaneAspect;
40 class Prs3d_ArrowAspect;
41 class Prs3d_DatumAspect;
42 class Prs3d_DimensionAspect;
43 class TCollection_AsciiString;
44
45 DEFINE_STANDARD_HANDLE(Prs3d_Drawer, Graphic3d_PresentationAttributes)
46
47 //! A graphic attribute manager which governs how
48 //! objects such as color, width, line thickness and deflection are displayed.
49 //! A drawer includes an instance of the Aspect classes with particular default values.
50 class Prs3d_Drawer : public Graphic3d_PresentationAttributes
51 {
52   DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
53 public:
54
55   //! Default constructor.
56   Standard_EXPORT Prs3d_Drawer();
57
58   //! Sets the type of chordal deflection.
59   //! This indicates whether the deflection value is absolute or relative to the size of the object.
60   Standard_EXPORT void SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection);
61
62   //! Returns the type of chordal deflection.
63   //! This indicates whether the deflection value is absolute or relative to the size of the object.
64   Aspect_TypeOfDeflection TypeOfDeflection() const
65   {
66     return HasOwnTypeOfDeflection() || myLink.IsNull()
67          ? myTypeOfDeflection
68          : myLink->TypeOfDeflection();
69   }
70
71   //! Returns true if the drawer has a type of deflection setting active.
72   Standard_Boolean HasOwnTypeOfDeflection() const { return myHasOwnTypeOfDeflection; }
73
74   //! Defines the maximal chordial deviation when drawing any curve.
75   //! Even if the type of deviation is set to TOD_Relative, this value is used by: 
76   //!   Prs3d_DeflectionCurve
77   //!   Prs3d_WFDeflectionSurface
78   //!   Prs3d_WFDeflectionRestrictedFace
79   Standard_EXPORT void SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation);
80
81   //! Returns the maximal chordal deviation. The default value is 0.1.
82   //! Drawings of curves or patches are made with respect to an absolute maximal chordal deviation.
83   Quantity_Length MaximalChordialDeviation() const
84   {
85     return HasOwnMaximalChordialDeviation() || myLink.IsNull()
86          ? myChordialDeviation
87          : myLink->MaximalChordialDeviation();
88   }
89
90   //! Returns true if the drawer has a maximal chordial deviation setting active.
91   Standard_Boolean HasOwnMaximalChordialDeviation() const { return myHasOwnChordialDeviation; }
92
93   //! Sets the type of HLR algorithm used by drawer's interactive objects
94   Standard_EXPORT void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR);
95
96   //! Returns the type of HLR algorithm currently in use.
97   Standard_EXPORT Prs3d_TypeOfHLR TypeOfHLR();
98
99   //! Returns true if the type of HLR is not equal to Prs3d_TOH_NotSet.
100   Standard_Boolean HasOwnTypeOfHLR() const { return (myTypeOfHLR != Prs3d_TOH_NotSet); }
101
102   //! Defines the maximum value allowed for the first and last
103   //! parameters of an infinite curve.
104   Standard_EXPORT void SetMaximalParameterValue (const Standard_Real theValue);
105
106   //! Sets the maximum value allowed for the first and last
107   //! parameters of an infinite curve. By default, this value is 500000.
108   Standard_Real MaximalParameterValue() const
109   {
110     return HasOwnMaximalParameterValue() || myLink.IsNull()
111          ? myMaximalParameterValue
112          : myLink->MaximalParameterValue();
113   }
114
115   //! Returns true if the drawer has a maximum value allowed for the first and last
116   //! parameters of an infinite curve setting active.
117   Standard_Boolean HasOwnMaximalParameterValue() const { return myHasOwnMaximalParameterValue; }
118
119   //! Sets IsoOnPlane on or off by setting the parameter theIsEnabled to true or false.
120   Standard_EXPORT void SetIsoOnPlane (const Standard_Boolean theIsEnabled);
121
122   //! Returns True if the drawing of isos on planes is enabled.
123   Standard_Boolean IsoOnPlane() const
124   {
125     return HasOwnIsoOnPlane() || myLink.IsNull()
126          ? myIsoOnPlane
127          : myLink->IsoOnPlane();
128   }
129
130   //! Returns true if the drawer has IsoOnPlane setting active.
131   Standard_Boolean HasOwnIsoOnPlane() const { return myHasOwnIsoOnPlane; }
132
133   //! Returns True if the drawing of isos on triangulation is enabled.
134   Standard_Boolean IsoOnTriangulation() const
135   {
136     return HasOwnIsoOnTriangulation() || myLink.IsNull()
137          ? myIsoOnTriangulation
138          : myLink->IsoOnTriangulation();
139   }
140
141   //! Returns true if the drawer has IsoOnTriangulation setting active.
142   Standard_Boolean HasOwnIsoOnTriangulation() const { return myHasOwnIsoOnTriangulation; }
143
144   //! Enables or disables isolines on triangulation by setting the parameter theIsEnabled to true or false.
145   Standard_EXPORT void SetIsoOnTriangulation (const Standard_Boolean theToEnable);
146
147   //! Sets the discretisation parameter theValue.
148   Standard_EXPORT void SetDiscretisation (const Standard_Integer theValue);
149
150   //! Returns the discretisation setting. 
151   Standard_Integer Discretisation() const
152   {
153     return HasOwnDiscretisation() || myLink.IsNull()
154          ? myNbPoints
155          : myLink->Discretisation();
156   }
157
158   //! Returns true if the drawer has discretisation setting active.
159   Standard_Boolean HasOwnDiscretisation() const { return myHasOwnNbPoints; }
160
161   //! Sets the deviation coefficient theCoefficient.
162   //! Also sets the hasOwnDeviationCoefficient flag to Standard_True and myPreviousDeviationCoefficient
163   Standard_EXPORT void SetDeviationCoefficient (const Standard_Real theCoefficient);
164
165   //! Returns the deviation coefficient.
166   //! Drawings of curves or patches are made with respect
167   //! to a maximal chordal deviation. A Deviation coefficient
168   //! is used in the shading display mode. The shape is
169   //! seen decomposed into triangles. These are used to
170   //! calculate reflection of light from the surface of the
171   //! object. The triangles are formed from chords of the
172   //! curves in the shape. The deviation coefficient gives
173   //! the highest value of the angle with which a chord can
174   //! deviate from a tangent to a   curve. If this limit is
175   //! reached, a new triangle is begun.
176   //! This deviation is absolute and is set through the
177   //! method: SetMaximalChordialDeviation. The default value is 0.001.
178   //! In drawing shapes, however, you are allowed to ask
179   //! for a relative deviation. This deviation will be:
180   //! SizeOfObject * DeviationCoefficient.
181   Standard_Real DeviationCoefficient() const
182   {
183     return HasOwnDeviationCoefficient() || myLink.IsNull()
184          ? myDeviationCoefficient
185          : myLink->DeviationCoefficient();
186   }
187
188   //! Sets the hasOwnDeviationCoefficient flag to Standard_False
189   void SetDeviationCoefficient()
190   {
191     myHasOwnDeviationCoefficient = Standard_False;
192   }
193
194   //! Returns true if there is a local setting for deviation
195   //! coefficient in this framework for a specific interactive object.
196   Standard_Boolean HasOwnDeviationCoefficient() const { return myHasOwnDeviationCoefficient; }
197
198   //! Saves the previous value used for the chordal
199   //! deviation coefficient. 
200   Standard_Real PreviousDeviationCoefficient() const
201   {
202     return myHasOwnDeviationCoefficient
203          ? myPreviousDeviationCoefficient
204          : 0.0;
205   }
206
207   //! Updates the previous value used for the chordal deviation coefficient to the current state.
208   void UpdatePreviousDeviationCoefficient()
209   {
210     if (myHasOwnDeviationCoefficient)
211     {
212       myPreviousDeviationCoefficient = DeviationCoefficient();
213     }
214   }
215
216   //! Sets the deviation coefficient aCoefficient for removal
217   //! of hidden lines created by different viewpoints in
218   //! different presentations. The Default value is 0.02.
219   //! Also sets the hasOwnHLRDeviationCoefficient flag to Standard_True and myPreviousHLRDeviationCoefficient
220   Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real theCoefficient);
221
222   //! Returns the real number value of the hidden line
223   //! removal deviation coefficient in this framework, if the flag
224   //! hasOwnHLRDeviationCoefficient is true or there is no Link.
225   //! Else the shape's HLR deviation coefficient is used.
226   //! A Deviation coefficient is used in the shading display
227   //! mode. The shape is seen decomposed into triangles.
228   //! These are used to calculate reflection of light from the
229   //! surface of the object.
230   //! The triangles are formed from chords of the curves in
231   //! the shape. The deviation coefficient give the highest
232   //! value of the angle with which a chord can deviate
233   //! from a tangent to a curve. If this limit is reached, a new triangle is begun.
234   //! To find the hidden lines, hidden line display mode
235   //! entails recalculation of the view at each different projector perspective.
236   //! Since hidden lines entail calculations of more than
237   //! usual complexity to decompose them into these
238   //! triangles, a deviation coefficient allowing greater
239   //! tolerance is used. This increases efficiency in calculation.
240   //! The Default value is 0.02.
241   Standard_Real HLRDeviationCoefficient() const
242   {
243     return HasOwnHLRDeviationCoefficient() || myLink.IsNull()
244          ? myHLRDeviationCoefficient
245          : myLink->HLRDeviationCoefficient();
246   }
247
248   //! Sets the hasOwnHLRDeviationCoefficient flag to Standard_False 
249   void SetHLRDeviationCoefficient()
250   {
251     myHasOwnHLRDeviationCoefficient = Standard_False;
252   }
253
254   //! Returns true if the there is a setting for HLR deviation
255   //! coefficient in this framework for a specific interactive object.
256   Standard_Boolean HasOwnHLRDeviationCoefficient() const { return myHasOwnHLRDeviationCoefficient; }
257
258   //! Returns the previous value of the hidden line removal deviation coefficient.
259   Standard_Real PreviousHLRDeviationCoefficient() const
260   {
261     return myHasOwnHLRDeviationCoefficient
262          ? myPreviousHLRDeviationCoefficient
263          : 0.0;
264   }
265
266   //! Sets the deviation angle theAngle.
267   //! Also sets the hasOwnDeviationAngle flag to Standard_True, and myPreviousDeviationAngle.
268   Standard_EXPORT void SetDeviationAngle (const Standard_Real theAngle);
269
270   //! Returns the value for deviation angle.
271   Standard_Real DeviationAngle() const
272   {
273     return HasOwnDeviationAngle() || myLink.IsNull()
274          ? myDeviationAngle
275          : myLink->DeviationAngle();
276   }
277
278   //! Sets the hasOwnDeviationAngle flag to Standard_False
279   void SetDeviationAngle()
280   {
281     myHasOwnDeviationAngle = Standard_False;
282   }
283
284   //! Returns true if the there is a local setting for deviation
285   //! angle in this framework for a specific interactive object.
286   Standard_Boolean HasOwnDeviationAngle() const { return myHasOwnDeviationAngle; }
287
288   //! Returns the previous deviation angle
289   Standard_Real PreviousDeviationAngle() const
290   {
291     return myHasOwnDeviationAngle
292          ? myPreviousDeviationAngle
293          : 0.0;
294   }
295
296   //! Updates the previous deviation angle to the current value
297   void UpdatePreviousDeviationAngle()
298   {
299     if (myHasOwnDeviationAngle)
300     {
301       myPreviousDeviationAngle = DeviationAngle();
302     }
303   }
304
305   //! Sets anAngle, the angle of maximum chordal deviation for removal of hidden lines created by
306   //! different viewpoints in different presentations.
307   //! The default value is 20 * M_PI / 180.
308   //! Also sets the hasOwnHLRDeviationAngle flag to Standard_True and myPreviousHLRDeviationAngle.
309   Standard_EXPORT void SetHLRAngle (const Standard_Real theAngle);
310
311   //! Returns the real number value of the deviation angle
312   //! in hidden line removal views. The default value is 20 * M_PI / 180.
313   Standard_Real HLRAngle() const
314   {
315     return HasOwnHLRDeviationAngle() || myLink.IsNull()
316          ? myHLRAngle
317          : myLink->HLRAngle();
318   }
319
320   //! Sets the hasOwnHLRDeviationAngle flag to Standard_False
321   void SetHLRAngle()
322   {
323     myHasOwnHLRDeviationAngle = Standard_False;
324   }
325
326   //! Returns true if the there is a setting for HLR deviation
327   //! angle in this framework for a specific interactive object.
328   Standard_Boolean HasOwnHLRDeviationAngle() const { return myHasOwnHLRDeviationAngle; }
329
330   //! Returns the previous value of the HLR deviation angle.
331   Standard_Real PreviousHLRDeviationAngle() const
332   {
333     return myHasOwnHLRDeviationAngle
334          ? myPreviousHLRDeviationAngle
335          : 0.0;
336   }
337
338   //! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false.
339   //! If this flag is True automatic re-triangulation with deflection-check logic will be applied.
340   //! Else this feature will be disable and triangulation is expected to be computed by application itself
341   //! and no shading presentation at all if unavailable.
342   Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled);
343
344   //! Returns True if automatic triangulation is enabled.
345   Standard_Boolean IsAutoTriangulation() const
346   {
347     return HasOwnIsAutoTriangulation() || myLink.IsNull()
348          ? myIsAutoTriangulated
349          : myLink->IsAutoTriangulation();
350   }
351
352   //! Returns true if the drawer has IsoOnPlane setting active.
353   Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
354
355   //! Defines the attributes which are used when drawing an
356   //! U isoparametric curve of a face. Defines the number
357   //! of U isoparametric curves to be drawn for a single face.
358   //! The LineAspect for U isoparametric lines can be edited
359   //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
360   //! The default values are:
361   //!   COLOR       : Quantity_NOC_GRAY75
362   //!   TYPE OF LINE: Aspect_TOL_SOLID
363   //!   WIDTH       : 0.5
364   //!
365   //! These attributes are used by the following algorithms:
366   //!   Prs3d_WFDeflectionSurface
367   //!   Prs3d_WFDeflectionRestrictedFace
368   Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect();
369
370   Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
371
372   //! Returns true if the drawer has its own attribute for
373   //! UIso aspect that overrides the one in the link.
374   Standard_Boolean HasOwnUIsoAspect() const { return myHasOwnUIsoAspect; }
375
376   //! Defines the attributes which are used when drawing an
377   //! V isoparametric curve of a face. Defines the number
378   //! of V isoparametric curves to be drawn for a single face.
379   //! The LineAspect for V isoparametric lines can be edited
380   //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
381   //! The default values are:
382   //!   COLOR       : Quantity_NOC_GRAY82
383   //!   TYPE OF LINE: Aspect_TOL_SOLID
384   //!   WIDTH       : 0.5
385   //!
386   //! These attributes are used by the following algorithms:
387   //!   Prs3d_WFDeflectionSurface
388   //!   Prs3d_WFDeflectionRestrictedFace
389   Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect();
390
391   //! Sets the appearance of V isoparameters - theAspect.
392   Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
393
394   //! Returns true if the drawer has its own attribute for
395   //! VIso aspect that overrides the one in the link.
396   Standard_Boolean HasOwnVIsoAspect() const { return myHasOwnVIsoAspect; }
397
398   //! Returns wire aspect settings.
399   //! The LineAspect for the free boundaries can be edited.
400   //! The default values are:
401   //!   Color: Quantity_NOC_GREEN
402   //!   Type of line: Aspect_TOL_SOLID
403   //!   Width: 1.0
404   //! These attributes are used by the algorithm Prs3d_WFShape.
405   Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect();
406
407   //! Sets the parameter theAspect for display of wires.
408   Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect);
409
410   //! Returns true if the drawer has its own attribute for
411   //! wire aspect that overrides the one in the link.
412   Standard_Boolean HasOwnWireAspect() const { return myHasOwnWireAspect; }
413
414   //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false.
415   Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled);
416
417   //! Returns True if the drawing of the wire is enabled.
418   Standard_Boolean WireDraw() const
419   {
420     return HasOwnWireDraw() || myLink.IsNull()
421          ? myWireDraw
422          : myLink->WireDraw();
423   }
424
425   //! Returns true if the drawer has its own attribute for
426   //! "draw wires" flag that overrides the one in the link.
427   Standard_Boolean HasOwnWireDraw() const { return myHasOwnWireDraw; }
428
429   //! Returns the point aspect setting. The default values are
430   //!   Color: Quantity_NOC_YELLOW
431   //!   Type of marker: Aspect_TOM_PLUS
432   //!   Scale: 1.0
433   //! These attributes are used by the algorithms Prs3d_Point.
434   Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect();
435
436   //! Sets the parameter theAspect for display attributes of points
437   Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
438
439   //! Returns true if the drawer has its own attribute for
440   //! point aspect that overrides the one in the link.
441   Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; }
442
443   //! Returns settings for line aspects.
444   //! These settings can be edited. The default values are:
445   //!   Color: Quantity_NOC_YELLOW
446   //!   Type of line: Aspect_TOL_SOLID
447   //!   Width: 1.0
448   //! These attributes are used by the following algorithms:
449   //!   Prs3d_Curve
450   //!   Prs3d_Line
451   //!   Prs3d_HLRShape
452   Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect();
453
454   //! Sets the parameter theAspect for display attributes of lines.
455   Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
456
457   //! Returns true if the drawer has its own attribute for
458   //! line aspect that overrides the one in the link.
459   Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; }
460
461   //! Returns settings for text aspect.
462   //! These settings can be edited. The default value is:
463   //! - Color: Quantity_NOC_YELLOW
464   Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect();
465
466   //! Sets the parameter theAspect for display attributes of text.
467   Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect);
468
469   //! Returns true if the drawer has its own attribute for
470   //! text aspect that overrides the one in the link.
471   Standard_Boolean HasOwnTextAspect() const { return myHasOwnTextAspect; }
472
473   //! Returns settings for shading aspects.
474   //! These settings can be edited. The default values are:
475   //! -   Color: Quantity_NOC_YELLOW
476   //! -   Material: Graphic3d_NOM_BRASS
477   //! Shading aspect is obtained through decomposition of
478   //! 3d faces into triangles, each side of each triangle
479   //! being a chord of the corresponding curved edge in the face.
480   //! Reflection of light in each projector perspective is then calculated for each of the
481   //! resultant triangular planes.
482   Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect();
483
484   //! Sets the parameter theAspect for display attributes of shading.
485   Standard_EXPORT  void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect);
486
487   //! Returns true if the drawer has its own attribute for
488   //! shading aspect that overrides the one in the link.
489   Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; }
490
491   //! Returns settings for seen line aspects.
492   //! These settings can be edited. The default values are:
493   //!   Color: Quantity_NOC_YELLOW
494   //!   Type of line: Aspect_TOL_SOLID
495   //!   Width: 1.0
496   Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect();
497
498   //! Sets the parameter theAspect for the display of seen lines in hidden line removal mode.
499   Standard_EXPORT void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
500
501   //! Returns true if the drawer has its own attribute for
502   //! seen line aspect that overrides the one in the link.
503   Standard_Boolean HasOwnSeenLineAspect() const { return myHasOwnSeenLineAspect; }
504
505   //! Returns settings for the appearance of planes.
506   Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect();
507
508   //! Sets the parameter theAspect for the display of planes. 
509   Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect);
510
511   //! Returns true if the drawer has its own attribute for
512   //! plane aspect that overrides the one in the link.
513   Standard_Boolean HasOwnPlaneAspect() const { return myHasOwnPlaneAspect; }
514
515   //! Returns the attributes for display of arrows.
516   Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect();
517
518   //! Sets the parameter theAspect for display attributes of arrows.
519   Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect);
520
521   //! Returns true if the drawer has its own attribute for
522   //! arrow aspect that overrides the one in the link.
523   Standard_Boolean HasOwnArrowAspect() const { return myHasOwnArrowAspect; }
524
525   //! Enables the drawing of an arrow at the end of each line.
526   //! By default the arrows are not drawn.
527   Standard_EXPORT void SetLineArrowDraw (const Standard_Boolean theIsEnabled);
528
529   //! Returns True if drawing an arrow at the end of each edge is enabled
530   //! and False otherwise (the default).
531   Standard_Boolean LineArrowDraw() const
532   {
533     return HasOwnLineArrowDraw() || myLink.IsNull()
534          ? myLineArrowDraw
535          : myLink->LineArrowDraw();
536   }
537
538   //! Returns true if the drawer has its own attribute for
539   //! "draw arrow" flag that overrides the one in the link.
540   Standard_Boolean HasOwnLineArrowDraw() const
541   {
542     return myHasOwnLineArrowDraw;
543   }
544
545   //! Returns settings for hidden line aspects.
546   //! These settings can be edited. The default values are:
547   //!   Color: Quantity_NOC_YELLOW
548   //!   Type of line: Aspect_TOL_DASH
549   //!   Width: 1.0
550   Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect();
551
552   //! Sets the parameter theAspect for the display of hidden lines in hidden line removal mode.
553   Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
554
555   //! Returns true if the drawer has its own attribute for
556   //! hidden lines aspect that overrides the one in the link.
557   Standard_Boolean HasOwnHiddenLineAspect() const { return myHasOwnHiddenLineAspect; }
558
559   //! Returns Standard_True if the hidden lines are to be drawn.
560   //! By default the hidden lines are not drawn.
561   Standard_Boolean DrawHiddenLine() const
562   {
563     return HasOwnDrawHiddenLine() || myLink.IsNull()
564          ? myDrawHiddenLine
565          : myLink->DrawHiddenLine();
566   }
567
568   //! Enables the DrawHiddenLine function.
569   Standard_EXPORT void EnableDrawHiddenLine();
570
571   //! Disables the DrawHiddenLine function.
572   Standard_EXPORT void DisableDrawHiddenLine();
573
574   //! Returns true if the drawer has its own attribute for
575   //! "draw hidden lines" flag that overrides the one in the link.
576   Standard_Boolean HasOwnDrawHiddenLine() const { return myHasOwnDrawHiddenLine; }
577
578   //! Returns settings for the appearance of vectors.
579   //! These settings can be edited. The default values are:
580   //!   Color: Quantity_NOC_SKYBLUE
581   //!   Type of line: Aspect_TOL_SOLID
582   //!   Width: 1.0
583   Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect();
584
585   //! Sets the modality theAspect for the display of vectors.
586   Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect);
587
588   //! Returns true if the drawer has its own attribute for
589   //! vector aspect that overrides the one in the link.
590   Standard_Boolean HasOwnVectorAspect() const { return myHasOwnVectorAspect; }
591
592   //! Sets the mode of visualization of vertices of a TopoDS_Shape instance.
593   //! By default, only stand-alone vertices (not belonging topologically to an edge) are drawn,
594   //! that corresponds to Prs3d_VDM_Standalone mode. 
595   //! Switching to Prs3d_VDM_Standalone mode makes all shape's vertices visible.
596   //! To inherit this parameter from the global drawer instance ("the link") when it is present,
597   //! Prs3d_VDM_Inherited value should be used.
598   Standard_EXPORT void SetVertexDrawMode (const Prs3d_VertexDrawMode theMode);
599
600   //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
601   Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode();
602
603   //! Returns true if the vertex draw mode is not equal to <b>Prs3d_VDM_Inherited</b>. 
604   //! This means that individual vertex draw mode value (i.e. not inherited from the global 
605   //! drawer) is used for a specific interactive object.
606   Standard_Boolean HasOwnVertexDrawMode() const { return (myVertexDrawMode != Prs3d_VDM_Inherited); }
607
608   //! Returns settings for the appearance of datums.
609   //! These settings can be edited. The default values for the three axes are:
610   //!   Color: Quantity_NOC_PEACHPUFF
611   //!   Type of line: Aspect_TOL_SOLID
612   //!   Width: 1.0
613   Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect();
614
615   //! Sets the modality theAspect for the display of datums.
616   Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect);
617
618   //! Returns true if the drawer has its own attribute for
619   //! datum aspect that overrides the one in the link.
620   Standard_Boolean HasOwnDatumAspect() const { return myHasOwnDatumAspect; }
621
622   //! The LineAspect for the wire can be edited.
623   //! The default values are:
624   //!   Color: Quantity_NOC_ORANGE
625   //!   Type of line: Aspect_TOL_SOLID
626   //!   Width: 1.0
627   //! These attributes are used by the algorithm Prs3d_WFShape.
628   Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect();
629
630   //! Sets the parameter theAspect for display attributes of sections. 
631   Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect);
632
633   //! Returns true if the drawer has its own attribute for
634   //! section aspect that overrides the one in the link.
635   Standard_Boolean HasOwnSectionAspect() const { return myHasOwnSectionAspect; }
636
637   //! Sets the parameter theAspect for the display of free boundaries.
638   //! The method sets aspect owned by the drawer that will be used during
639   //! visualization instead of the one set in link.
640   Standard_EXPORT void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
641
642   //! Returns the values for presentation of free boundaries,
643   //! in other words, boundaries which are not shared.
644   //! The LineAspect for the  free boundaries can be edited.
645   //! The default values are:
646   //!   Color: Quantity_NOC_GREEN
647   //!   Type of line: Aspect_TOL_SOLID
648   //!   Width: 1.0
649   //! These attributes are used by the algorithm Prs3d_WFShape
650   Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect();
651
652   //! Returns true if the drawer has its own attribute for
653   //! free boundaries aspect that overrides the one in the link.
654   Standard_Boolean HasOwnFreeBoundaryAspect() const { return myHasOwnFreeBoundaryAspect; }
655
656   //! Enables or disables drawing of free boundaries for shading presentations.
657   //! The method sets drawing flag owned by the drawer that will be used during
658   //! visualization instead of the one set in link.
659   //! theIsEnabled is a boolean flag indicating whether the free boundaries should be
660   //! drawn or not.
661   Standard_EXPORT void SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
662
663   //! Returns True if the drawing of the free boundaries is enabled
664   //! True is the default setting.
665   Standard_Boolean FreeBoundaryDraw() const
666   {
667     return HasOwnFreeBoundaryDraw() || myLink.IsNull()
668          ? myFreeBoundaryDraw
669          : myLink->FreeBoundaryDraw();
670   }
671
672   //! Returns true if the drawer has its own attribute for
673   //! "draw free boundaries" flag that overrides the one in the link.
674   Standard_Boolean HasOwnFreeBoundaryDraw() const { return myHasOwnFreeBoundaryDraw; }
675
676   //! Sets the parameter theAspect for the display of shared boundaries.
677   //! The method sets aspect owned by the drawer that will be used during
678   //! visualization instead of the one set in link.
679   Standard_EXPORT void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
680
681   //! Returns settings for shared boundary line aspects.
682   //! The LineAspect for the unfree boundaries can be edited.
683   //! The default values are:
684   //! Color: Quantity_NOC_YELLOW
685   //! Type of line: Aspect_TOL_SOLID
686   //! Width: 1.
687   //! These attributes are used by the algorithm Prs3d_WFShape
688   Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect();
689
690   //! Returns true if the drawer has its own attribute for
691   //! unfree boundaries aspect that overrides the one in the link.
692   Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return myHasOwnUnFreeBoundaryAspect; }
693
694   //! Enables or disables drawing of shared boundaries for shading presentations.
695   //! The method sets drawing flag owned by the drawer that will be used during
696   //! visualization instead of the one set in link.
697   //! theIsEnabled is a boolean flag indicating whether the shared boundaries should be drawn or not.
698   Standard_EXPORT void SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
699
700   //! Returns True if the drawing of the shared boundaries is enabled.
701   //! True is the default setting.
702   Standard_Boolean UnFreeBoundaryDraw() const
703   {
704     return HasOwnUnFreeBoundaryDraw() || myLink.IsNull()
705          ? myUnFreeBoundaryDraw
706          : myLink->UnFreeBoundaryDraw();
707   }
708
709   //! Returns true if the drawer has its own attribute for
710   //! "draw shared boundaries" flag that overrides the one in the link.
711   Standard_Boolean HasOwnUnFreeBoundaryDraw() const { return myHasOwnUnFreeBoundaryDraw; }
712
713   //! Sets line aspect for face boundaries.
714   //! The method sets line aspect owned by the drawer that will be used during
715   //! visualization instead of the one set in link.
716   //! theAspect is the line aspect that determines the look of the face boundaries.
717   Standard_EXPORT void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
718
719   //! Returns line aspect of face boundaries.
720   Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect();
721
722   //! Returns true if the drawer has its own attribute for
723   //! face boundaries aspect that overrides the one in the link.
724   Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
725
726   //! Enables or disables face boundary drawing for shading presentations. 
727   //! The method sets drawing flag owned by the drawer that will be used during
728   //! visualization instead of the one set in link.
729   //! theIsEnabled is a boolean flag indicating whether the face boundaries should be drawn or not.
730   Standard_EXPORT void SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled);
731
732   //! Checks whether the face boundary drawing is enabled or not.
733   Standard_Boolean FaceBoundaryDraw() const
734   {
735     return HasOwnFaceBoundaryDraw() || myLink.IsNull()
736          ? myFaceBoundaryDraw
737          : myLink->FaceBoundaryDraw();
738   }
739
740   //! Returns true if the drawer has its own attribute for
741   //! "draw face boundaries" flag that overrides the one in the link.
742   Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; }
743
744   //! Returns settings for the appearance of dimensions. 
745   Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
746
747   //! Sets the settings for the appearance of dimensions.
748   //! The method sets aspect owned by the drawer that will be used during
749   //! visualization instead of the one set in link.
750   Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect);
751
752   //! Returns true if the drawer has its own attribute for
753   //! the appearance of dimensions that overrides the one in the link.
754   Standard_Boolean HasOwnDimensionAspect() const { return myHasOwnDimensionAspect; }
755
756   //! Sets dimension length model units for computing of dimension presentation.
757   //! The method sets value owned by the drawer that will be used during
758   //! visualization instead of the one set in link.
759   Standard_EXPORT void SetDimLengthModelUnits (const TCollection_AsciiString& theUnits);
760
761   //! Sets dimension angle model units for computing of dimension presentation.
762   //! The method sets value owned by the drawer that will be used during
763   //! visualization instead of the one set in link.
764   Standard_EXPORT void SetDimAngleModelUnits (const TCollection_AsciiString& theUnits);
765
766   //! Returns length model units for the dimension presentation. 
767   const TCollection_AsciiString& DimLengthModelUnits() const
768   {
769     return HasOwnDimLengthModelUnits() || myLink.IsNull()
770          ? myDimensionModelUnits.GetLengthUnits()
771          : myLink->DimLengthModelUnits();
772   }
773
774   //! Returns angle model units for the dimension presentation. 
775   const TCollection_AsciiString& DimAngleModelUnits() const
776   {
777     return HasOwnDimAngleModelUnits() || myLink.IsNull()
778          ? myDimensionModelUnits.GetAngleUnits()
779          : myLink->DimAngleModelUnits();
780   }
781
782   //! Returns true if the drawer has its own attribute for
783   //! dimension length model units that overrides the one in the link.
784   Standard_Boolean HasOwnDimLengthModelUnits() const { return myHasOwnDimLengthModelUnits; }
785
786   //! Returns true if the drawer has its own attribute for
787   //! dimension angle model units that overrides the one in the link.
788   Standard_Boolean HasOwnDimAngleModelUnits() const { return myHasOwnDimAngleModelUnits; }
789
790   //! Sets length units in which value for dimension presentation is displayed.
791   //! The method sets value owned by the drawer that will be used during
792   //! visualization instead of the one set in link.
793   Standard_EXPORT void SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits);
794
795   //! Sets angle units in which value for dimension presentation is displayed.
796   //! The method sets value owned by the drawer that will be used during
797   //! visualization instead of the one set in link.
798   Standard_EXPORT void SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits);
799
800   //! Returns length units in which dimension presentation is displayed.
801   const TCollection_AsciiString& DimLengthDisplayUnits() const
802   {
803     return HasOwnDimLengthDisplayUnits() || myLink.IsNull()
804          ? myDimensionDisplayUnits.GetLengthUnits()
805          : myLink->DimLengthDisplayUnits();
806   }
807
808   //! Returns angle units in which dimension presentation is displayed.
809   const TCollection_AsciiString& DimAngleDisplayUnits() const
810   {
811     return HasOwnDimAngleDisplayUnits() || myLink.IsNull()
812          ? myDimensionDisplayUnits.GetAngleUnits()
813          : myLink->DimAngleDisplayUnits();
814   }
815
816   //! Returns true if the drawer has its own attribute for
817   //! length units in which dimension presentation is displayed
818   //! that overrides the one in the link.
819   Standard_Boolean HasOwnDimLengthDisplayUnits() const { return myHasOwnDimLengthDisplayUnits; }
820
821   //! Returns true if the drawer has its own attribute for
822   //! angle units in which dimension presentation is displayed
823   //! that overrides the one in the link.
824   Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; }
825
826   //! Returns the drawer to which the current object references.
827   const Handle(Prs3d_Drawer)& Link() { return myLink; }
828
829   //! Returns true if the current object has a link on the other drawer.
830   Standard_Boolean HasLink() const { return !myLink.IsNull(); }
831
832   //! Sets theDrawer as a link to which the current object references.
833   void Link (const Handle(Prs3d_Drawer)& theDrawer) { SetLink (theDrawer); }
834
835   //! Sets theDrawer as a link to which the current object references.
836   void SetLink (const Handle(Prs3d_Drawer)& theDrawer) { myLink = theDrawer; }
837
838   //! Removes local attributes. 
839   Standard_EXPORT void ClearLocalAttributes();
840
841   //! Assign shader program for specified type of primitives.
842   //! @param theProgram new program to set (might be NULL)
843   //! @param theAspect  the type of primitives
844   //! @param theToOverrideDefaults if true then non-overridden attributes using defaults will be allocated and copied from the Link;
845   //!                              otherwise, only already customized attributes will be changed
846   Standard_EXPORT void SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
847                                          const Graphic3d_GroupAspect            theAspect,
848                                          const bool                             theToOverrideDefaults = false);
849
850 protected:
851
852   Handle(Prs3d_Drawer)          myLink;
853
854   Standard_Integer              myNbPoints;
855   Standard_Boolean              myHasOwnNbPoints;
856   Standard_Real                 myMaximalParameterValue;
857   Standard_Boolean              myHasOwnMaximalParameterValue;
858   Quantity_Length               myChordialDeviation;
859   Standard_Boolean              myHasOwnChordialDeviation;
860   Aspect_TypeOfDeflection       myTypeOfDeflection;
861   Standard_Boolean              myHasOwnTypeOfDeflection;
862   Prs3d_TypeOfHLR               myTypeOfHLR;
863   Standard_Real                 myDeviationCoefficient;
864   Standard_Real                 myPreviousDeviationCoefficient;
865   Standard_Boolean              myHasOwnDeviationCoefficient;
866   Standard_Real                 myHLRDeviationCoefficient;
867   Standard_Boolean              myHasOwnHLRDeviationCoefficient;
868   Standard_Real                 myPreviousHLRDeviationCoefficient;
869   Standard_Real                 myDeviationAngle;
870   Standard_Boolean              myHasOwnDeviationAngle;
871   Standard_Real                 myPreviousDeviationAngle;
872   Standard_Real                 myHLRAngle;
873   Standard_Boolean              myHasOwnHLRDeviationAngle;
874   Standard_Real                 myPreviousHLRDeviationAngle;
875   Standard_Boolean              myIsoOnPlane;
876   Standard_Boolean              myHasOwnIsoOnPlane;
877   Standard_Boolean              myIsoOnTriangulation;
878   Standard_Boolean              myHasOwnIsoOnTriangulation;
879   Standard_Boolean              myIsAutoTriangulated;
880   Standard_Boolean              myHasOwnIsAutoTriangulated;
881
882   Handle(Prs3d_IsoAspect)       myUIsoAspect;
883   Standard_Boolean              myHasOwnUIsoAspect;
884   Handle(Prs3d_IsoAspect)       myVIsoAspect;
885   Standard_Boolean              myHasOwnVIsoAspect;
886   Handle(Prs3d_LineAspect)      myWireAspect;
887   Standard_Boolean              myHasOwnWireAspect;
888   Standard_Boolean              myWireDraw;
889   Standard_Boolean              myHasOwnWireDraw;
890   Handle(Prs3d_PointAspect)     myPointAspect;
891   Standard_Boolean              myHasOwnPointAspect;
892   Handle(Prs3d_LineAspect)      myLineAspect;
893   Standard_Boolean              myHasOwnLineAspect;
894   Handle(Prs3d_TextAspect)      myTextAspect;
895   Standard_Boolean              myHasOwnTextAspect;
896   Handle(Prs3d_ShadingAspect)   myShadingAspect;
897   Standard_Boolean              myHasOwnShadingAspect;
898   Handle(Prs3d_PlaneAspect)     myPlaneAspect;
899   Standard_Boolean              myHasOwnPlaneAspect;
900   Handle(Prs3d_LineAspect)      mySeenLineAspect;
901   Standard_Boolean              myHasOwnSeenLineAspect;
902   Handle(Prs3d_ArrowAspect)     myArrowAspect;
903   Standard_Boolean              myHasOwnArrowAspect;
904   Standard_Boolean              myLineArrowDraw;
905   Standard_Boolean              myHasOwnLineArrowDraw;
906   Handle(Prs3d_LineAspect)      myHiddenLineAspect;
907   Standard_Boolean              myHasOwnHiddenLineAspect;
908   Standard_Boolean              myDrawHiddenLine;
909   Standard_Boolean              myHasOwnDrawHiddenLine;
910   Handle(Prs3d_LineAspect)      myVectorAspect;
911   Standard_Boolean              myHasOwnVectorAspect;
912   Prs3d_VertexDrawMode          myVertexDrawMode;
913   Handle(Prs3d_DatumAspect)     myDatumAspect;
914   Standard_Boolean              myHasOwnDatumAspect;
915   Handle(Prs3d_LineAspect)      mySectionAspect;
916   Standard_Boolean              myHasOwnSectionAspect;
917
918   Handle(Prs3d_LineAspect)      myFreeBoundaryAspect;
919   Standard_Boolean              myHasOwnFreeBoundaryAspect;
920   Standard_Boolean              myFreeBoundaryDraw;
921   Standard_Boolean              myHasOwnFreeBoundaryDraw;
922   Handle(Prs3d_LineAspect)      myUnFreeBoundaryAspect;
923   Standard_Boolean              myHasOwnUnFreeBoundaryAspect;
924   Standard_Boolean              myUnFreeBoundaryDraw;
925   Standard_Boolean              myHasOwnUnFreeBoundaryDraw;
926   Handle(Prs3d_LineAspect)      myFaceBoundaryAspect;
927   Standard_Boolean              myHasOwnFaceBoundaryAspect;
928   Standard_Boolean              myFaceBoundaryDraw;
929   Standard_Boolean              myHasOwnFaceBoundaryDraw;
930
931   Handle(Prs3d_DimensionAspect) myDimensionAspect;
932   Standard_Boolean              myHasOwnDimensionAspect;
933   Prs3d_DimensionUnits          myDimensionModelUnits;
934   Standard_Boolean              myHasOwnDimLengthModelUnits;
935   Standard_Boolean              myHasOwnDimAngleModelUnits;
936   Prs3d_DimensionUnits          myDimensionDisplayUnits;
937   Standard_Boolean              myHasOwnDimLengthDisplayUnits;
938   Standard_Boolean              myHasOwnDimAngleDisplayUnits;
939
940 };
941
942 Standard_DEPRECATED("Class name is deprecated - use Prs3d_Drawer instead")
943 typedef Prs3d_Drawer Graphic3d_HighlightStyle;
944
945 #endif // _Prs3d_Drawer_HeaderFile