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