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