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