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>
32 #include <GeomAbs_Shape.hxx>
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;
45 DEFINE_STANDARD_HANDLE(Prs3d_Drawer, Graphic3d_PresentationAttributes)
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
52 DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
55 //! Default constructor.
56 Standard_EXPORT Prs3d_Drawer();
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);
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
66 return HasOwnTypeOfDeflection() || myLink.IsNull()
68 : myLink->TypeOfDeflection();
71 //! Returns true if the drawer has a type of deflection setting active.
72 Standard_Boolean HasOwnTypeOfDeflection() const { return myHasOwnTypeOfDeflection; }
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 Standard_Real theChordialDeviation);
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 Standard_Real MaximalChordialDeviation() const
85 return HasOwnMaximalChordialDeviation() || myLink.IsNull()
87 : myLink->MaximalChordialDeviation();
90 //! Returns true if the drawer has a maximal chordial deviation setting active.
91 Standard_Boolean HasOwnMaximalChordialDeviation() const { return myHasOwnChordialDeviation; }
93 //! Sets the type of HLR algorithm used by drawer's interactive objects
94 Standard_EXPORT void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR);
96 //! Returns the type of HLR algorithm currently in use.
97 Standard_EXPORT Prs3d_TypeOfHLR TypeOfHLR();
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); }
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);
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
110 return HasOwnMaximalParameterValue() || myLink.IsNull()
111 ? myMaximalParameterValue
112 : myLink->MaximalParameterValue();
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; }
119 //! Sets IsoOnPlane on or off by setting the parameter theIsEnabled to true or false.
120 Standard_EXPORT void SetIsoOnPlane (const Standard_Boolean theIsEnabled);
122 //! Returns True if the drawing of isos on planes is enabled.
123 Standard_Boolean IsoOnPlane() const
125 return HasOwnIsoOnPlane() || myLink.IsNull()
127 : myLink->IsoOnPlane();
130 //! Returns true if the drawer has IsoOnPlane setting active.
131 Standard_Boolean HasOwnIsoOnPlane() const { return myHasOwnIsoOnPlane; }
133 //! Returns True if the drawing of isos on triangulation is enabled.
134 Standard_Boolean IsoOnTriangulation() const
136 return HasOwnIsoOnTriangulation() || myLink.IsNull()
137 ? myIsoOnTriangulation
138 : myLink->IsoOnTriangulation();
141 //! Returns true if the drawer has IsoOnTriangulation setting active.
142 Standard_Boolean HasOwnIsoOnTriangulation() const { return myHasOwnIsoOnTriangulation; }
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);
147 //! Sets the discretisation parameter theValue.
148 Standard_EXPORT void SetDiscretisation (const Standard_Integer theValue);
150 //! Returns the discretisation setting.
151 Standard_Integer Discretisation() const
153 return HasOwnDiscretisation() || myLink.IsNull()
155 : myLink->Discretisation();
158 //! Returns true if the drawer has discretisation setting active.
159 Standard_Boolean HasOwnDiscretisation() const { return myHasOwnNbPoints; }
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);
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
183 return HasOwnDeviationCoefficient() || myLink.IsNull()
184 ? myDeviationCoefficient
185 : myLink->DeviationCoefficient();
188 //! Sets the hasOwnDeviationCoefficient flag to Standard_False
189 void SetDeviationCoefficient()
191 myHasOwnDeviationCoefficient = Standard_False;
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; }
198 //! Saves the previous value used for the chordal
199 //! deviation coefficient.
200 Standard_Real PreviousDeviationCoefficient() const
202 return myHasOwnDeviationCoefficient
203 ? myPreviousDeviationCoefficient
207 //! Updates the previous value used for the chordal deviation coefficient to the current state.
208 void UpdatePreviousDeviationCoefficient()
210 if (myHasOwnDeviationCoefficient)
212 myPreviousDeviationCoefficient = DeviationCoefficient();
216 //! Sets the deviation angle theAngle.
217 //! Also sets the hasOwnDeviationAngle flag to Standard_True, and myPreviousDeviationAngle.
218 Standard_EXPORT void SetDeviationAngle (const Standard_Real theAngle);
220 //! Returns the value for deviation angle in radians, 20 * M_PI / 180 by default.
221 Standard_Real DeviationAngle() const
223 return HasOwnDeviationAngle() || myLink.IsNull()
225 : myLink->DeviationAngle();
228 //! Sets the hasOwnDeviationAngle flag to Standard_False
229 void SetDeviationAngle()
231 myHasOwnDeviationAngle = Standard_False;
234 //! Returns true if the there is a local setting for deviation
235 //! angle in this framework for a specific interactive object.
236 Standard_Boolean HasOwnDeviationAngle() const { return myHasOwnDeviationAngle; }
238 //! Returns the previous deviation angle
239 Standard_Real PreviousDeviationAngle() const
241 return myHasOwnDeviationAngle
242 ? myPreviousDeviationAngle
246 //! Updates the previous deviation angle to the current value
247 void UpdatePreviousDeviationAngle()
249 if (myHasOwnDeviationAngle)
251 myPreviousDeviationAngle = DeviationAngle();
255 //! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false.
256 //! If this flag is True automatic re-triangulation with deflection-check logic will be applied.
257 //! Else this feature will be disable and triangulation is expected to be computed by application itself
258 //! and no shading presentation at all if unavailable.
259 Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled);
261 //! Returns True if automatic triangulation is enabled.
262 Standard_Boolean IsAutoTriangulation() const
264 return HasOwnIsAutoTriangulation() || myLink.IsNull()
265 ? myIsAutoTriangulated
266 : myLink->IsAutoTriangulation();
269 //! Returns true if the drawer has IsoOnPlane setting active.
270 Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
272 //! Defines the attributes which are used when drawing an
273 //! U isoparametric curve of a face. Defines the number
274 //! of U isoparametric curves to be drawn for a single face.
275 //! The LineAspect for U isoparametric lines can be edited
276 //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
277 //! The default values are:
278 //! COLOR : Quantity_NOC_GRAY75
279 //! TYPE OF LINE: Aspect_TOL_SOLID
282 //! These attributes are used by the following algorithms:
283 //! Prs3d_WFDeflectionSurface
284 //! Prs3d_WFDeflectionRestrictedFace
285 Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect();
287 Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
289 //! Returns true if the drawer has its own attribute for
290 //! UIso aspect that overrides the one in the link.
291 Standard_Boolean HasOwnUIsoAspect() const { return myHasOwnUIsoAspect; }
293 //! Defines the attributes which are used when drawing an
294 //! V isoparametric curve of a face. Defines the number
295 //! of V isoparametric curves to be drawn for a single face.
296 //! The LineAspect for V isoparametric lines can be edited
297 //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
298 //! The default values are:
299 //! COLOR : Quantity_NOC_GRAY82
300 //! TYPE OF LINE: Aspect_TOL_SOLID
303 //! These attributes are used by the following algorithms:
304 //! Prs3d_WFDeflectionSurface
305 //! Prs3d_WFDeflectionRestrictedFace
306 Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect();
308 //! Sets the appearance of V isoparameters - theAspect.
309 Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
311 //! Returns true if the drawer has its own attribute for
312 //! VIso aspect that overrides the one in the link.
313 Standard_Boolean HasOwnVIsoAspect() const { return myHasOwnVIsoAspect; }
315 //! Returns wire aspect settings.
316 //! The LineAspect for the free boundaries can be edited.
317 //! The default values are:
318 //! Color: Quantity_NOC_GREEN
319 //! Type of line: Aspect_TOL_SOLID
321 //! These attributes are used by the algorithm Prs3d_WFShape.
322 Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect();
324 //! Sets the parameter theAspect for display of wires.
325 Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect);
327 //! Returns true if the drawer has its own attribute for
328 //! wire aspect that overrides the one in the link.
329 Standard_Boolean HasOwnWireAspect() const { return myHasOwnWireAspect; }
331 //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false.
332 Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled);
334 //! Returns True if the drawing of the wire is enabled.
335 Standard_Boolean WireDraw() const
337 return HasOwnWireDraw() || myLink.IsNull()
339 : myLink->WireDraw();
342 //! Returns true if the drawer has its own attribute for
343 //! "draw wires" flag that overrides the one in the link.
344 Standard_Boolean HasOwnWireDraw() const { return myHasOwnWireDraw; }
346 //! Returns the point aspect setting. The default values are
347 //! Color: Quantity_NOC_YELLOW
348 //! Type of marker: Aspect_TOM_PLUS
350 //! These attributes are used by the algorithms Prs3d_Point.
351 Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect();
353 //! Sets the parameter theAspect for display attributes of points
354 Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
356 //! Returns true if the drawer has its own attribute for
357 //! point aspect that overrides the one in the link.
358 Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; }
360 //! Sets own point aspect.
361 //! Returns FALSE if the drawer already has its own attribute for point aspect.
362 Standard_EXPORT Standard_Boolean SetupOwnPointAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
364 //! Returns settings for line aspects.
365 //! These settings can be edited. The default values are:
366 //! Color: Quantity_NOC_YELLOW
367 //! Type of line: Aspect_TOL_SOLID
369 //! These attributes are used by the following algorithms:
373 Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect();
375 //! Sets the parameter theAspect for display attributes of lines.
376 Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
378 //! Returns true if the drawer has its own attribute for
379 //! line aspect that overrides the one in the link.
380 Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; }
382 //! Sets own line aspects.
383 //! Returns FALSE if own line aspect are already set.
384 Standard_EXPORT Standard_Boolean SetOwnLineAspects (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
386 //! Sets own line aspects for datums.
387 //! Returns FALSE if own line for datums are already set.
388 Standard_EXPORT Standard_Boolean SetOwnDatumAspects (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
390 //! Returns settings for text aspect.
391 //! These settings can be edited. The default value is:
392 //! - Color: Quantity_NOC_YELLOW
393 Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect();
395 //! Sets the parameter theAspect for display attributes of text.
396 Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect);
398 //! Returns true if the drawer has its own attribute for
399 //! text aspect that overrides the one in the link.
400 Standard_Boolean HasOwnTextAspect() const { return myHasOwnTextAspect; }
402 //! Returns settings for shading aspects.
403 //! These settings can be edited. The default values are:
404 //! - Color: Quantity_NOC_YELLOW
405 //! - Material: Graphic3d_NOM_BRASS
406 //! Shading aspect is obtained through decomposition of
407 //! 3d faces into triangles, each side of each triangle
408 //! being a chord of the corresponding curved edge in the face.
409 //! Reflection of light in each projector perspective is then calculated for each of the
410 //! resultant triangular planes.
411 Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect();
413 //! Sets the parameter theAspect for display attributes of shading.
414 Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect);
416 //! Returns true if the drawer has its own attribute for
417 //! shading aspect that overrides the one in the link.
418 Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; }
420 //! Sets own shading aspect.
421 //! Returns FALSE if the drawer already has its own attribute for shading aspect.
422 Standard_EXPORT Standard_Boolean SetupOwnShadingAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
424 //! Returns settings for seen line aspects.
425 //! These settings can be edited. The default values are:
426 //! Color: Quantity_NOC_YELLOW
427 //! Type of line: Aspect_TOL_SOLID
429 Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect();
431 //! Sets the parameter theAspect for the display of seen lines in hidden line removal mode.
432 Standard_EXPORT void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
434 //! Returns true if the drawer has its own attribute for
435 //! seen line aspect that overrides the one in the link.
436 Standard_Boolean HasOwnSeenLineAspect() const { return myHasOwnSeenLineAspect; }
438 //! Returns settings for the appearance of planes.
439 Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect();
441 //! Sets the parameter theAspect for the display of planes.
442 Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect);
444 //! Returns true if the drawer has its own attribute for
445 //! plane aspect that overrides the one in the link.
446 Standard_Boolean HasOwnPlaneAspect() const { return myHasOwnPlaneAspect; }
448 //! Returns the attributes for display of arrows.
449 Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect();
451 //! Sets the parameter theAspect for display attributes of arrows.
452 Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect);
454 //! Returns true if the drawer has its own attribute for
455 //! arrow aspect that overrides the one in the link.
456 Standard_Boolean HasOwnArrowAspect() const { return myHasOwnArrowAspect; }
458 //! Enables the drawing of an arrow at the end of each line.
459 //! By default the arrows are not drawn.
460 Standard_EXPORT void SetLineArrowDraw (const Standard_Boolean theIsEnabled);
462 //! Returns True if drawing an arrow at the end of each edge is enabled
463 //! and False otherwise (the default).
464 Standard_Boolean LineArrowDraw() const
466 return HasOwnLineArrowDraw() || myLink.IsNull()
468 : myLink->LineArrowDraw();
471 //! Returns true if the drawer has its own attribute for
472 //! "draw arrow" flag that overrides the one in the link.
473 Standard_Boolean HasOwnLineArrowDraw() const
475 return myHasOwnLineArrowDraw;
478 //! Returns settings for hidden line aspects.
479 //! These settings can be edited. The default values are:
480 //! Color: Quantity_NOC_YELLOW
481 //! Type of line: Aspect_TOL_DASH
483 Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect();
485 //! Sets the parameter theAspect for the display of hidden lines in hidden line removal mode.
486 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
488 //! Returns true if the drawer has its own attribute for
489 //! hidden lines aspect that overrides the one in the link.
490 Standard_Boolean HasOwnHiddenLineAspect() const { return myHasOwnHiddenLineAspect; }
492 //! Returns Standard_True if the hidden lines are to be drawn.
493 //! By default the hidden lines are not drawn.
494 Standard_Boolean DrawHiddenLine() const
496 return HasOwnDrawHiddenLine() || myLink.IsNull()
498 : myLink->DrawHiddenLine();
501 //! Enables the DrawHiddenLine function.
502 Standard_EXPORT void EnableDrawHiddenLine();
504 //! Disables the DrawHiddenLine function.
505 Standard_EXPORT void DisableDrawHiddenLine();
507 //! Returns true if the drawer has its own attribute for
508 //! "draw hidden lines" flag that overrides the one in the link.
509 Standard_Boolean HasOwnDrawHiddenLine() const { return myHasOwnDrawHiddenLine; }
511 //! Returns settings for the appearance of vectors.
512 //! These settings can be edited. The default values are:
513 //! Color: Quantity_NOC_SKYBLUE
514 //! Type of line: Aspect_TOL_SOLID
516 Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect();
518 //! Sets the modality theAspect for the display of vectors.
519 Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect);
521 //! Returns true if the drawer has its own attribute for
522 //! vector aspect that overrides the one in the link.
523 Standard_Boolean HasOwnVectorAspect() const { return myHasOwnVectorAspect; }
525 //! Sets the mode of visualization of vertices of a TopoDS_Shape instance.
526 //! By default, only stand-alone vertices (not belonging topologically to an edge) are drawn,
527 //! that corresponds to Prs3d_VDM_Standalone mode.
528 //! Switching to Prs3d_VDM_Standalone mode makes all shape's vertices visible.
529 //! To inherit this parameter from the global drawer instance ("the link") when it is present,
530 //! Prs3d_VDM_Inherited value should be used.
531 Standard_EXPORT void SetVertexDrawMode (const Prs3d_VertexDrawMode theMode);
533 //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
534 Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode();
536 //! Returns true if the vertex draw mode is not equal to <b>Prs3d_VDM_Inherited</b>.
537 //! This means that individual vertex draw mode value (i.e. not inherited from the global
538 //! drawer) is used for a specific interactive object.
539 Standard_Boolean HasOwnVertexDrawMode() const { return (myVertexDrawMode != Prs3d_VDM_Inherited); }
541 //! Returns settings for the appearance of datums.
542 //! These settings can be edited. The default values for the three axes are:
543 //! Color: Quantity_NOC_PEACHPUFF
544 //! Type of line: Aspect_TOL_SOLID
546 Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect();
548 //! Sets the modality theAspect for the display of datums.
549 Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect);
551 //! Returns true if the drawer has its own attribute for
552 //! datum aspect that overrides the one in the link.
553 Standard_Boolean HasOwnDatumAspect() const { return myHasOwnDatumAspect; }
555 //! The LineAspect for the wire can be edited.
556 //! The default values are:
557 //! Color: Quantity_NOC_ORANGE
558 //! Type of line: Aspect_TOL_SOLID
560 //! These attributes are used by the algorithm Prs3d_WFShape.
561 Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect();
563 //! Sets the parameter theAspect for display attributes of sections.
564 Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect);
566 //! Returns true if the drawer has its own attribute for
567 //! section aspect that overrides the one in the link.
568 Standard_Boolean HasOwnSectionAspect() const { return myHasOwnSectionAspect; }
570 //! Sets the parameter theAspect for the display of free boundaries.
571 //! The method sets aspect owned by the drawer that will be used during
572 //! visualization instead of the one set in link.
573 Standard_EXPORT void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
575 //! Returns the values for presentation of free boundaries,
576 //! in other words, boundaries which are not shared.
577 //! The LineAspect for the free boundaries can be edited.
578 //! The default values are:
579 //! Color: Quantity_NOC_GREEN
580 //! Type of line: Aspect_TOL_SOLID
582 //! These attributes are used by the algorithm Prs3d_WFShape
583 Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect();
585 //! Returns true if the drawer has its own attribute for
586 //! free boundaries aspect that overrides the one in the link.
587 Standard_Boolean HasOwnFreeBoundaryAspect() const { return myHasOwnFreeBoundaryAspect; }
589 //! Enables or disables drawing of free boundaries for shading presentations.
590 //! The method sets drawing flag owned by the drawer that will be used during
591 //! visualization instead of the one set in link.
592 //! theIsEnabled is a boolean flag indicating whether the free boundaries should be
594 Standard_EXPORT void SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
596 //! Returns True if the drawing of the free boundaries is enabled
597 //! True is the default setting.
598 Standard_Boolean FreeBoundaryDraw() const
600 return HasOwnFreeBoundaryDraw() || myLink.IsNull()
602 : myLink->FreeBoundaryDraw();
605 //! Returns true if the drawer has its own attribute for
606 //! "draw free boundaries" flag that overrides the one in the link.
607 Standard_Boolean HasOwnFreeBoundaryDraw() const { return myHasOwnFreeBoundaryDraw; }
609 //! Sets the parameter theAspect for the display of shared boundaries.
610 //! The method sets aspect owned by the drawer that will be used during
611 //! visualization instead of the one set in link.
612 Standard_EXPORT void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
614 //! Returns settings for shared boundary line aspects.
615 //! The LineAspect for the unfree boundaries can be edited.
616 //! The default values are:
617 //! Color: Quantity_NOC_YELLOW
618 //! Type of line: Aspect_TOL_SOLID
620 //! These attributes are used by the algorithm Prs3d_WFShape
621 Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect();
623 //! Returns true if the drawer has its own attribute for
624 //! unfree boundaries aspect that overrides the one in the link.
625 Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return myHasOwnUnFreeBoundaryAspect; }
627 //! Enables or disables drawing of shared boundaries for shading presentations.
628 //! The method sets drawing flag owned by the drawer that will be used during
629 //! visualization instead of the one set in link.
630 //! theIsEnabled is a boolean flag indicating whether the shared boundaries should be drawn or not.
631 Standard_EXPORT void SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
633 //! Returns True if the drawing of the shared boundaries is enabled.
634 //! True is the default setting.
635 Standard_Boolean UnFreeBoundaryDraw() const
637 return HasOwnUnFreeBoundaryDraw() || myLink.IsNull()
638 ? myUnFreeBoundaryDraw
639 : myLink->UnFreeBoundaryDraw();
642 //! Returns true if the drawer has its own attribute for
643 //! "draw shared boundaries" flag that overrides the one in the link.
644 Standard_Boolean HasOwnUnFreeBoundaryDraw() const { return myHasOwnUnFreeBoundaryDraw; }
646 //! Sets line aspect for face boundaries.
647 //! The method sets line aspect owned by the drawer that will be used during
648 //! visualization instead of the one set in link.
649 //! theAspect is the line aspect that determines the look of the face boundaries.
650 Standard_EXPORT void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
652 //! Returns line aspect of face boundaries.
653 Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect();
655 //! Returns true if the drawer has its own attribute for
656 //! face boundaries aspect that overrides the one in the link.
657 Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
659 //! Sets own face boundary aspect.
660 //! Returns FALSE if the drawer already has its own attribute for face boundary aspect.
661 Standard_EXPORT Standard_Boolean SetupOwnFaceBoundaryAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
663 //! Enables or disables face boundary drawing for shading presentations.
664 //! The method sets drawing flag owned by the drawer that will be used during
665 //! visualization instead of the one set in link.
666 //! theIsEnabled is a boolean flag indicating whether the face boundaries should be drawn or not.
667 Standard_EXPORT void SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled);
669 //! Checks whether the face boundary drawing is enabled or not.
670 Standard_Boolean FaceBoundaryDraw() const
672 return HasOwnFaceBoundaryDraw() || myLink.IsNull()
674 : myLink->FaceBoundaryDraw();
677 //! Returns true if the drawer has its own attribute for
678 //! "draw face boundaries" flag that overrides the one in the link.
679 Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; }
681 //! Returns true if the drawer has its own attribute for face boundaries upper edge continuity class that overrides the one in the link.
682 Standard_Boolean HasOwnFaceBoundaryUpperContinuity() const { return myFaceBoundaryUpperContinuity != -1; }
684 //! Get the most edge continuity class; GeomAbs_CN by default (all edges).
685 GeomAbs_Shape FaceBoundaryUpperContinuity() const
687 return HasOwnFaceBoundaryUpperContinuity()
688 ? (GeomAbs_Shape )myFaceBoundaryUpperContinuity
690 ? myLink->FaceBoundaryUpperContinuity()
694 //! Set the most edge continuity class for face boundaries.
695 void SetFaceBoundaryUpperContinuity (GeomAbs_Shape theMostAllowedEdgeClass) { myFaceBoundaryUpperContinuity = theMostAllowedEdgeClass; }
697 //! Unset the most edge continuity class for face boundaries.
698 void UnsetFaceBoundaryUpperContinuity() { myFaceBoundaryUpperContinuity = -1; }
700 //! Returns settings for the appearance of dimensions.
701 Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
703 //! Sets the settings for the appearance of dimensions.
704 //! The method sets aspect owned by the drawer that will be used during
705 //! visualization instead of the one set in link.
706 Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect);
708 //! Returns true if the drawer has its own attribute for
709 //! the appearance of dimensions that overrides the one in the link.
710 Standard_Boolean HasOwnDimensionAspect() const { return myHasOwnDimensionAspect; }
712 //! Sets dimension length model units for computing of dimension presentation.
713 //! The method sets value owned by the drawer that will be used during
714 //! visualization instead of the one set in link.
715 Standard_EXPORT void SetDimLengthModelUnits (const TCollection_AsciiString& theUnits);
717 //! Sets dimension angle model units for computing of dimension presentation.
718 //! The method sets value owned by the drawer that will be used during
719 //! visualization instead of the one set in link.
720 Standard_EXPORT void SetDimAngleModelUnits (const TCollection_AsciiString& theUnits);
722 //! Returns length model units for the dimension presentation.
723 const TCollection_AsciiString& DimLengthModelUnits() const
725 return HasOwnDimLengthModelUnits() || myLink.IsNull()
726 ? myDimensionModelUnits.GetLengthUnits()
727 : myLink->DimLengthModelUnits();
730 //! Returns angle model units for the dimension presentation.
731 const TCollection_AsciiString& DimAngleModelUnits() const
733 return HasOwnDimAngleModelUnits() || myLink.IsNull()
734 ? myDimensionModelUnits.GetAngleUnits()
735 : myLink->DimAngleModelUnits();
738 //! Returns true if the drawer has its own attribute for
739 //! dimension length model units that overrides the one in the link.
740 Standard_Boolean HasOwnDimLengthModelUnits() const { return myHasOwnDimLengthModelUnits; }
742 //! Returns true if the drawer has its own attribute for
743 //! dimension angle model units that overrides the one in the link.
744 Standard_Boolean HasOwnDimAngleModelUnits() const { return myHasOwnDimAngleModelUnits; }
746 //! Sets length units in which value for dimension presentation is displayed.
747 //! The method sets value owned by the drawer that will be used during
748 //! visualization instead of the one set in link.
749 Standard_EXPORT void SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits);
751 //! Sets angle units in which value for dimension presentation is displayed.
752 //! The method sets value owned by the drawer that will be used during
753 //! visualization instead of the one set in link.
754 Standard_EXPORT void SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits);
756 //! Returns length units in which dimension presentation is displayed.
757 const TCollection_AsciiString& DimLengthDisplayUnits() const
759 return HasOwnDimLengthDisplayUnits() || myLink.IsNull()
760 ? myDimensionDisplayUnits.GetLengthUnits()
761 : myLink->DimLengthDisplayUnits();
764 //! Returns angle units in which dimension presentation is displayed.
765 const TCollection_AsciiString& DimAngleDisplayUnits() const
767 return HasOwnDimAngleDisplayUnits() || myLink.IsNull()
768 ? myDimensionDisplayUnits.GetAngleUnits()
769 : myLink->DimAngleDisplayUnits();
772 //! Returns true if the drawer has its own attribute for
773 //! length units in which dimension presentation is displayed
774 //! that overrides the one in the link.
775 Standard_Boolean HasOwnDimLengthDisplayUnits() const { return myHasOwnDimLengthDisplayUnits; }
777 //! Returns true if the drawer has its own attribute for
778 //! angle units in which dimension presentation is displayed
779 //! that overrides the one in the link.
780 Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; }
782 //! Returns the drawer to which the current object references.
783 const Handle(Prs3d_Drawer)& Link() { return myLink; }
785 //! Returns true if the current object has a link on the other drawer.
786 Standard_Boolean HasLink() const { return !myLink.IsNull(); }
788 //! Sets theDrawer as a link to which the current object references.
789 void Link (const Handle(Prs3d_Drawer)& theDrawer) { SetLink (theDrawer); }
791 //! Sets theDrawer as a link to which the current object references.
792 void SetLink (const Handle(Prs3d_Drawer)& theDrawer) { myLink = theDrawer; }
794 //! Removes local attributes.
795 Standard_EXPORT void ClearLocalAttributes();
797 //! Assign shader program for specified type of primitives.
798 //! @param theProgram new program to set (might be NULL)
799 //! @param theAspect the type of primitives
800 //! @param theToOverrideDefaults if true then non-overridden attributes using defaults will be allocated and copied from the Link;
801 //! otherwise, only already customized attributes will be changed
802 //! @return TRUE if presentation should be recomputed after creating aspects not previously customized (if theToOverrideDefaults is also TRUE)
803 Standard_EXPORT bool SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
804 const Graphic3d_GroupAspect theAspect,
805 const bool theToOverrideDefaults = false);
807 //! Sets Shading Model type for the shading aspect.
808 Standard_EXPORT bool SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
809 bool theToOverrideDefaults = false);
811 //! Dumps the content of me into the stream
812 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
814 public: //! @name deprecated methods
816 Standard_DEPRECATED("SetDeviationAngle() should be used instead")
817 void SetHLRAngle (const Standard_Real theAngle) { SetDeviationAngle (theAngle); }
819 Standard_DEPRECATED("DeviationAngle() should be used instead")
820 Standard_Real HLRAngle() const { return DeviationAngle(); }
822 Standard_DEPRECATED("SetDeviationAngle() should be used instead")
823 void SetHLRAngle() { SetDeviationAngle(); }
825 Standard_DEPRECATED("HasOwnDeviationAngle() should be used instead")
826 Standard_Boolean HasOwnHLRDeviationAngle() const { return HasOwnDeviationAngle(); }
828 Standard_DEPRECATED("PreviousDeviationAngle() should be used instead")
829 Standard_Real PreviousHLRDeviationAngle() const { return PreviousDeviationAngle(); }
833 Handle(Prs3d_Drawer) myLink;
835 Standard_Integer myNbPoints;
836 Standard_Boolean myHasOwnNbPoints;
837 Standard_Real myMaximalParameterValue;
838 Standard_Boolean myHasOwnMaximalParameterValue;
839 Standard_Real myChordialDeviation;
840 Standard_Boolean myHasOwnChordialDeviation;
841 Aspect_TypeOfDeflection myTypeOfDeflection;
842 Standard_Boolean myHasOwnTypeOfDeflection;
843 Prs3d_TypeOfHLR myTypeOfHLR;
844 Standard_Real myDeviationCoefficient;
845 Standard_Real myPreviousDeviationCoefficient;
846 Standard_Boolean myHasOwnDeviationCoefficient;
847 Standard_Real myDeviationAngle;
848 Standard_Boolean myHasOwnDeviationAngle;
849 Standard_Real myPreviousDeviationAngle;
850 Standard_Boolean myIsoOnPlane;
851 Standard_Boolean myHasOwnIsoOnPlane;
852 Standard_Boolean myIsoOnTriangulation;
853 Standard_Boolean myHasOwnIsoOnTriangulation;
854 Standard_Boolean myIsAutoTriangulated;
855 Standard_Boolean myHasOwnIsAutoTriangulated;
857 Handle(Prs3d_IsoAspect) myUIsoAspect;
858 Standard_Boolean myHasOwnUIsoAspect;
859 Handle(Prs3d_IsoAspect) myVIsoAspect;
860 Standard_Boolean myHasOwnVIsoAspect;
861 Handle(Prs3d_LineAspect) myWireAspect;
862 Standard_Boolean myHasOwnWireAspect;
863 Standard_Boolean myWireDraw;
864 Standard_Boolean myHasOwnWireDraw;
865 Handle(Prs3d_PointAspect) myPointAspect;
866 Standard_Boolean myHasOwnPointAspect;
867 Handle(Prs3d_LineAspect) myLineAspect;
868 Standard_Boolean myHasOwnLineAspect;
869 Handle(Prs3d_TextAspect) myTextAspect;
870 Standard_Boolean myHasOwnTextAspect;
871 Handle(Prs3d_ShadingAspect) myShadingAspect;
872 Standard_Boolean myHasOwnShadingAspect;
873 Handle(Prs3d_PlaneAspect) myPlaneAspect;
874 Standard_Boolean myHasOwnPlaneAspect;
875 Handle(Prs3d_LineAspect) mySeenLineAspect;
876 Standard_Boolean myHasOwnSeenLineAspect;
877 Handle(Prs3d_ArrowAspect) myArrowAspect;
878 Standard_Boolean myHasOwnArrowAspect;
879 Standard_Boolean myLineArrowDraw;
880 Standard_Boolean myHasOwnLineArrowDraw;
881 Handle(Prs3d_LineAspect) myHiddenLineAspect;
882 Standard_Boolean myHasOwnHiddenLineAspect;
883 Standard_Boolean myDrawHiddenLine;
884 Standard_Boolean myHasOwnDrawHiddenLine;
885 Handle(Prs3d_LineAspect) myVectorAspect;
886 Standard_Boolean myHasOwnVectorAspect;
887 Prs3d_VertexDrawMode myVertexDrawMode;
888 Handle(Prs3d_DatumAspect) myDatumAspect;
889 Standard_Boolean myHasOwnDatumAspect;
890 Handle(Prs3d_LineAspect) mySectionAspect;
891 Standard_Boolean myHasOwnSectionAspect;
893 Handle(Prs3d_LineAspect) myFreeBoundaryAspect;
894 Standard_Boolean myHasOwnFreeBoundaryAspect;
895 Standard_Boolean myFreeBoundaryDraw;
896 Standard_Boolean myHasOwnFreeBoundaryDraw;
897 Handle(Prs3d_LineAspect) myUnFreeBoundaryAspect;
898 Standard_Boolean myHasOwnUnFreeBoundaryAspect;
899 Standard_Boolean myUnFreeBoundaryDraw;
900 Standard_Boolean myHasOwnUnFreeBoundaryDraw;
901 Handle(Prs3d_LineAspect) myFaceBoundaryAspect;
902 Standard_Integer myFaceBoundaryUpperContinuity; //!< the most edge continuity class (GeomAbs_Shape) to be included to face boundaries presentation, or -1 if undefined
903 Standard_Boolean myHasOwnFaceBoundaryAspect;
904 Standard_Boolean myFaceBoundaryDraw;
905 Standard_Boolean myHasOwnFaceBoundaryDraw;
907 Handle(Prs3d_DimensionAspect) myDimensionAspect;
908 Standard_Boolean myHasOwnDimensionAspect;
909 Prs3d_DimensionUnits myDimensionModelUnits;
910 Standard_Boolean myHasOwnDimLengthModelUnits;
911 Standard_Boolean myHasOwnDimAngleModelUnits;
912 Prs3d_DimensionUnits myDimensionDisplayUnits;
913 Standard_Boolean myHasOwnDimLengthDisplayUnits;
914 Standard_Boolean myHasOwnDimAngleDisplayUnits;
917 Standard_DEPRECATED("Class name is deprecated - use Prs3d_Drawer instead")
918 typedef Prs3d_Drawer Graphic3d_HighlightStyle;
920 #endif // _Prs3d_Drawer_HeaderFile