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 //! Updates the previous value used for the chordal deviation coefficient to the current state.
206 void UpdatePreviousDeviationCoefficient()
208 if (myHasOwnDeviationCoefficient)
210 myPreviousDeviationCoefficient = DeviationCoefficient();
214 //! Sets the deviation coefficient aCoefficient for removal
215 //! of hidden lines created by different viewpoints in
216 //! different presentations. The Default value is 0.02.
217 //! Also sets the hasOwnHLRDeviationCoefficient flag to Standard_True and myPreviousHLRDeviationCoefficient
218 Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real theCoefficient);
220 //! Returns the real number value of the hidden line
221 //! removal deviation coefficient in this framework, if the flag
222 //! hasOwnHLRDeviationCoefficient is true or there is no Link.
223 //! Else the shape's HLR deviation coefficient is used.
224 //! A Deviation coefficient is used in the shading display
225 //! mode. The shape is seen decomposed into triangles.
226 //! These are used to calculate reflection of light from the
227 //! surface of the object.
228 //! The triangles are formed from chords of the curves in
229 //! the shape. The deviation coefficient give the highest
230 //! value of the angle with which a chord can deviate
231 //! from a tangent to a curve. If this limit is reached, a new triangle is begun.
232 //! To find the hidden lines, hidden line display mode
233 //! entails recalculation of the view at each different projector perspective.
234 //! Since hidden lines entail calculations of more than
235 //! usual complexity to decompose them into these
236 //! triangles, a deviation coefficient allowing greater
237 //! tolerance is used. This increases efficiency in calculation.
238 //! The Default value is 0.02.
239 Standard_Real HLRDeviationCoefficient() const
241 return HasOwnHLRDeviationCoefficient() || myLink.IsNull()
242 ? myHLRDeviationCoefficient
243 : myLink->HLRDeviationCoefficient();
246 //! Sets the hasOwnHLRDeviationCoefficient flag to Standard_False
247 void SetHLRDeviationCoefficient()
249 myHasOwnHLRDeviationCoefficient = Standard_False;
252 //! Returns true if the there is a setting for HLR deviation
253 //! coefficient in this framework for a specific interactive object.
254 Standard_Boolean HasOwnHLRDeviationCoefficient() const { return myHasOwnHLRDeviationCoefficient; }
256 //! Returns the previous value of the hidden line removal deviation coefficient.
257 Standard_Real PreviousHLRDeviationCoefficient() const
259 return myHasOwnHLRDeviationCoefficient
260 ? myPreviousHLRDeviationCoefficient
264 //! Sets the deviation angle theAngle.
265 //! Also sets the hasOwnDeviationAngle flag to Standard_True, and myPreviousDeviationAngle.
266 Standard_EXPORT void SetDeviationAngle (const Standard_Real theAngle);
268 //! Returns the value for deviation angle.
269 Standard_Real DeviationAngle() const
271 return HasOwnDeviationAngle() || myLink.IsNull()
273 : myLink->DeviationAngle();
276 //! Sets the hasOwnDeviationAngle flag to Standard_False
277 void SetDeviationAngle()
279 myHasOwnDeviationAngle = Standard_False;
282 //! Returns true if the there is a local setting for deviation
283 //! angle in this framework for a specific interactive object.
284 Standard_Boolean HasOwnDeviationAngle() const { return myHasOwnDeviationAngle; }
286 //! Returns the previous deviation angle
287 Standard_Real PreviousDeviationAngle() const
289 return myHasOwnDeviationAngle
290 ? myPreviousDeviationAngle
294 //! Updates the previous deviation angle to the current value
295 void UpdatePreviousDeviationAngle()
297 if (myHasOwnDeviationAngle)
299 myPreviousDeviationAngle = DeviationAngle();
303 //! Sets anAngle, the angle of maximum chordal deviation for removal of hidden lines created by
304 //! different viewpoints in different presentations.
305 //! The default value is 20 * M_PI / 180.
306 //! Also sets the hasOwnHLRDeviationAngle flag to Standard_True and myPreviousHLRDeviationAngle.
307 Standard_EXPORT void SetHLRAngle (const Standard_Real theAngle);
309 //! Returns the real number value of the deviation angle
310 //! in hidden line removal views. The default value is 20 * M_PI / 180.
311 Standard_Real HLRAngle() const
313 return HasOwnHLRDeviationAngle() || myLink.IsNull()
315 : myLink->HLRAngle();
318 //! Sets the hasOwnHLRDeviationAngle flag to Standard_False
321 myHasOwnHLRDeviationAngle = Standard_False;
324 //! Returns true if the there is a setting for HLR deviation
325 //! angle in this framework for a specific interactive object.
326 Standard_Boolean HasOwnHLRDeviationAngle() const { return myHasOwnHLRDeviationAngle; }
328 //! Returns the previous value of the HLR deviation angle.
329 Standard_Real PreviousHLRDeviationAngle() const
331 return myHasOwnHLRDeviationAngle
332 ? myPreviousHLRDeviationAngle
336 //! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false.
337 //! If this flag is True automatic re-triangulation with deflection-check logic will be applied.
338 //! Else this feature will be disable and triangulation is expected to be computed by application itself
339 //! and no shading presentation at all if unavailable.
340 Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled);
342 //! Returns True if automatic triangulation is enabled.
343 Standard_Boolean IsAutoTriangulation() const
345 return HasOwnIsAutoTriangulation() || myLink.IsNull()
346 ? myIsAutoTriangulated
347 : myLink->IsAutoTriangulation();
350 //! Returns true if the drawer has IsoOnPlane setting active.
351 Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
353 //! Defines the attributes which are used when drawing an
354 //! U isoparametric curve of a face. Defines the number
355 //! of U isoparametric curves to be drawn for a single face.
356 //! The LineAspect for U isoparametric lines can be edited
357 //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
358 //! The default values are:
359 //! COLOR : Quantity_NOC_GRAY75
360 //! TYPE OF LINE: Aspect_TOL_SOLID
363 //! These attributes are used by the following algorithms:
364 //! Prs3d_WFDeflectionSurface
365 //! Prs3d_WFDeflectionRestrictedFace
366 Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect();
368 Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
370 //! Returns true if the drawer has its own attribute for
371 //! UIso aspect that overrides the one in the link.
372 Standard_Boolean HasOwnUIsoAspect() const { return myHasOwnUIsoAspect; }
374 //! Defines the attributes which are used when drawing an
375 //! V isoparametric curve of a face. Defines the number
376 //! of V isoparametric curves to be drawn for a single face.
377 //! The LineAspect for V isoparametric lines can be edited
378 //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
379 //! The default values are:
380 //! COLOR : Quantity_NOC_GRAY82
381 //! TYPE OF LINE: Aspect_TOL_SOLID
384 //! These attributes are used by the following algorithms:
385 //! Prs3d_WFDeflectionSurface
386 //! Prs3d_WFDeflectionRestrictedFace
387 Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect();
389 //! Sets the appearance of V isoparameters - theAspect.
390 Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
392 //! Returns true if the drawer has its own attribute for
393 //! VIso aspect that overrides the one in the link.
394 Standard_Boolean HasOwnVIsoAspect() const { return myHasOwnVIsoAspect; }
396 //! Returns wire aspect settings.
397 //! The LineAspect for the free boundaries can be edited.
398 //! The default values are:
399 //! Color: Quantity_NOC_GREEN
400 //! Type of line: Aspect_TOL_SOLID
402 //! These attributes are used by the algorithm Prs3d_WFShape.
403 Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect();
405 //! Sets the parameter theAspect for display of wires.
406 Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect);
408 //! Returns true if the drawer has its own attribute for
409 //! wire aspect that overrides the one in the link.
410 Standard_Boolean HasOwnWireAspect() const { return myHasOwnWireAspect; }
412 //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false.
413 Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled);
415 //! Returns True if the drawing of the wire is enabled.
416 Standard_Boolean WireDraw() const
418 return HasOwnWireDraw() || myLink.IsNull()
420 : myLink->WireDraw();
423 //! Returns true if the drawer has its own attribute for
424 //! "draw wires" flag that overrides the one in the link.
425 Standard_Boolean HasOwnWireDraw() const { return myHasOwnWireDraw; }
427 //! Returns the point aspect setting. The default values are
428 //! Color: Quantity_NOC_YELLOW
429 //! Type of marker: Aspect_TOM_PLUS
431 //! These attributes are used by the algorithms Prs3d_Point.
432 Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect();
434 //! Sets the parameter theAspect for display attributes of points
435 Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
437 //! Returns true if the drawer has its own attribute for
438 //! point aspect that overrides the one in the link.
439 Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; }
441 //! Returns settings for line aspects.
442 //! These settings can be edited. The default values are:
443 //! Color: Quantity_NOC_YELLOW
444 //! Type of line: Aspect_TOL_SOLID
446 //! These attributes are used by the following algorithms:
450 Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect();
452 //! Sets the parameter theAspect for display attributes of lines.
453 Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
455 //! Returns true if the drawer has its own attribute for
456 //! line aspect that overrides the one in the link.
457 Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; }
459 //! Returns settings for text aspect.
460 //! These settings can be edited. The default value is:
461 //! - Color: Quantity_NOC_YELLOW
462 Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect();
464 //! Sets the parameter theAspect for display attributes of text.
465 Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect);
467 //! Returns true if the drawer has its own attribute for
468 //! text aspect that overrides the one in the link.
469 Standard_Boolean HasOwnTextAspect() const { return myHasOwnTextAspect; }
471 //! Returns settings for shading aspects.
472 //! These settings can be edited. The default values are:
473 //! - Color: Quantity_NOC_YELLOW
474 //! - Material: Graphic3d_NOM_BRASS
475 //! Shading aspect is obtained through decomposition of
476 //! 3d faces into triangles, each side of each triangle
477 //! being a chord of the corresponding curved edge in the face.
478 //! Reflection of light in each projector perspective is then calculated for each of the
479 //! resultant triangular planes.
480 Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect();
482 //! Sets the parameter theAspect for display attributes of shading.
483 Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect);
485 //! Returns true if the drawer has its own attribute for
486 //! shading aspect that overrides the one in the link.
487 Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; }
489 //! Returns True if the ShadingAspect is applied
490 //! to the whole presentation.
491 Standard_Boolean ShadingAspectGlobal() const
493 return HasOwnShadingAspectGlobal() || myLink.IsNull()
494 ? myShadingAspectGlobal
495 : myLink->ShadingAspectGlobal();
498 //! Indicates that the ShadingAspect will be apply
499 //! to the whole presentation. This allows to modify
500 //! the aspect without recomputing the content of the presentation.
501 Standard_EXPORT void SetShadingAspectGlobal (const Standard_Boolean theValue);
503 //! Returns true if the drawer has its own attribute for
504 //! ShadingAspectGlobal flag that overrides the one in the link.
505 Standard_Boolean HasOwnShadingAspectGlobal() const { return myHasOwnShadingAspectGlobal; }
507 //! Returns settings for seen line aspects.
508 //! These settings can be edited. The default values are:
509 //! Color: Quantity_NOC_YELLOW
510 //! Type of line: Aspect_TOL_SOLID
512 Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect();
514 //! Sets the parameter theAspect for the display of seen lines in hidden line removal mode.
515 Standard_EXPORT void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
517 //! Returns true if the drawer has its own attribute for
518 //! seen line aspect that overrides the one in the link.
519 Standard_Boolean HasOwnSeenLineAspect() const { return myHasOwnSeenLineAspect; }
521 //! Returns settings for the appearance of planes.
522 Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect();
524 //! Sets the parameter theAspect for the display of planes.
525 Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect);
527 //! Returns true if the drawer has its own attribute for
528 //! plane aspect that overrides the one in the link.
529 Standard_Boolean HasOwnPlaneAspect() const { return myHasOwnPlaneAspect; }
531 //! Returns the attributes for display of arrows.
532 Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect();
534 //! Sets the parameter theAspect for display attributes of arrows.
535 Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect);
537 //! Returns true if the drawer has its own attribute for
538 //! arrow aspect that overrides the one in the link.
539 Standard_Boolean HasOwnArrowAspect() const { return myHasOwnArrowAspect; }
541 //! Enables the drawing of an arrow at the end of each line.
542 //! By default the arrows are not drawn.
543 Standard_EXPORT void SetLineArrowDraw (const Standard_Boolean theIsEnabled);
545 //! Returns True if drawing an arrow at the end of each edge is enabled
546 //! and False otherwise (the default).
547 Standard_Boolean LineArrowDraw() const
549 return HasOwnLineArrowDraw() || myLink.IsNull()
551 : myLink->LineArrowDraw();
554 //! Returns true if the drawer has its own attribute for
555 //! "draw arrow" flag that overrides the one in the link.
556 Standard_Boolean HasOwnLineArrowDraw() const
558 return myHasOwnLineArrowDraw;
561 //! Returns settings for hidden line aspects.
562 //! These settings can be edited. The default values are:
563 //! Color: Quantity_NOC_YELLOW
564 //! Type of line: Aspect_TOL_DASH
566 Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect();
568 //! Sets the parameter theAspect for the display of hidden lines in hidden line removal mode.
569 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
571 //! Returns true if the drawer has its own attribute for
572 //! hidden lines aspect that overrides the one in the link.
573 Standard_Boolean HasOwnHiddenLineAspect() const { return myHasOwnHiddenLineAspect; }
575 //! Returns Standard_True if the hidden lines are to be drawn.
576 //! By default the hidden lines are not drawn.
577 Standard_Boolean DrawHiddenLine() const
579 return HasOwnDrawHiddenLine() || myLink.IsNull()
581 : myLink->DrawHiddenLine();
584 //! Enables the DrawHiddenLine function.
585 Standard_EXPORT void EnableDrawHiddenLine();
587 //! Disables the DrawHiddenLine function.
588 Standard_EXPORT void DisableDrawHiddenLine();
590 //! Returns true if the drawer has its own attribute for
591 //! "draw hidden lines" flag that overrides the one in the link.
592 Standard_Boolean HasOwnDrawHiddenLine() const { return myHasOwnDrawHiddenLine; }
594 //! Returns settings for the appearance of vectors.
595 //! These settings can be edited. The default values are:
596 //! Color: Quantity_NOC_SKYBLUE
597 //! Type of line: Aspect_TOL_SOLID
599 Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect();
601 //! Sets the modality theAspect for the display of vectors.
602 Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect);
604 //! Returns true if the drawer has its own attribute for
605 //! vector aspect that overrides the one in the link.
606 Standard_Boolean HasOwnVectorAspect() const { return myHasOwnVectorAspect; }
608 //! Sets the mode of visualization of vertices of a TopoDS_Shape instance.
609 //! By default, only stand-alone vertices (not belonging topologically to an edge) are drawn,
610 //! that corresponds to Prs3d_VDM_Standalone mode.
611 //! Switching to Prs3d_VDM_Standalone mode makes all shape's vertices visible.
612 //! To inherit this parameter from the global drawer instance ("the link") when it is present,
613 //! Prs3d_VDM_Inherited value should be used.
614 Standard_EXPORT void SetVertexDrawMode (const Prs3d_VertexDrawMode theMode);
616 //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
617 Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode();
619 //! Returns true if the vertex draw mode is not equal to <b>Prs3d_VDM_Inherited</b>.
620 //! This means that individual vertex draw mode value (i.e. not inherited from the global
621 //! drawer) is used for a specific interactive object.
622 Standard_Boolean HasOwnVertexDrawMode() const { return (myVertexDrawMode != Prs3d_VDM_Inherited); }
624 //! Returns settings for the appearance of datums.
625 //! These settings can be edited. The default values for the three axes are:
626 //! Color: Quantity_NOC_PEACHPUFF
627 //! Type of line: Aspect_TOL_SOLID
629 Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect();
631 //! Sets the modality theAspect for the display of datums.
632 Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect);
634 //! Returns true if the drawer has its own attribute for
635 //! datum aspect that overrides the one in the link.
636 Standard_Boolean HasOwnDatumAspect() const { return myHasOwnDatumAspect; }
638 //! The LineAspect for the wire can be edited.
639 //! The default values are:
640 //! Color: Quantity_NOC_ORANGE
641 //! Type of line: Aspect_TOL_SOLID
643 //! These attributes are used by the algorithm Prs3d_WFShape.
644 Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect();
646 //! Sets the parameter theAspect for display attributes of sections.
647 Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect);
649 //! Returns true if the drawer has its own attribute for
650 //! section aspect that overrides the one in the link.
651 Standard_Boolean HasOwnSectionAspect() const { return myHasOwnSectionAspect; }
653 //! Sets the parameter theAspect for the display of free boundaries.
654 //! The method sets aspect owned by the drawer that will be used during
655 //! visualization instead of the one set in link.
656 Standard_EXPORT void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
658 //! Returns the values for presentation of free boundaries,
659 //! in other words, boundaries which are not shared.
660 //! The LineAspect for the free boundaries can be edited.
661 //! The default values are:
662 //! Color: Quantity_NOC_GREEN
663 //! Type of line: Aspect_TOL_SOLID
665 //! These attributes are used by the algorithm Prs3d_WFShape
666 Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect();
668 //! Returns true if the drawer has its own attribute for
669 //! free boundaries aspect that overrides the one in the link.
670 Standard_Boolean HasOwnFreeBoundaryAspect() const { return myHasOwnFreeBoundaryAspect; }
672 //! Enables or disables drawing of free boundaries for shading presentations.
673 //! The method sets drawing flag owned by the drawer that will be used during
674 //! visualization instead of the one set in link.
675 //! theIsEnabled is a boolean flag indicating whether the free boundaries should be
677 Standard_EXPORT void SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
679 //! Returns True if the drawing of the free boundaries is enabled
680 //! True is the default setting.
681 Standard_Boolean FreeBoundaryDraw() const
683 return HasOwnFreeBoundaryDraw() || myLink.IsNull()
685 : myLink->FreeBoundaryDraw();
688 //! Returns true if the drawer has its own attribute for
689 //! "draw free boundaries" flag that overrides the one in the link.
690 Standard_Boolean HasOwnFreeBoundaryDraw() const { return myHasOwnFreeBoundaryDraw; }
692 //! Sets the parameter theAspect for the display of shared boundaries.
693 //! The method sets aspect owned by the drawer that will be used during
694 //! visualization instead of the one set in link.
695 Standard_EXPORT void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
697 //! Returns settings for shared boundary line aspects.
698 //! The LineAspect for the unfree boundaries can be edited.
699 //! The default values are:
700 //! Color: Quantity_NOC_YELLOW
701 //! Type of line: Aspect_TOL_SOLID
703 //! These attributes are used by the algorithm Prs3d_WFShape
704 Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect();
706 //! Returns true if the drawer has its own attribute for
707 //! unfree boundaries aspect that overrides the one in the link.
708 Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return myHasOwnUnFreeBoundaryAspect; }
710 //! Enables or disables drawing of shared boundaries for shading presentations.
711 //! The method sets drawing flag owned by the drawer that will be used during
712 //! visualization instead of the one set in link.
713 //! theIsEnabled is a boolean flag indicating whether the shared boundaries should be drawn or not.
714 Standard_EXPORT void SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
716 //! Returns True if the drawing of the shared boundaries is enabled.
717 //! True is the default setting.
718 Standard_Boolean UnFreeBoundaryDraw() const
720 return HasOwnUnFreeBoundaryDraw() || myLink.IsNull()
721 ? myUnFreeBoundaryDraw
722 : myLink->UnFreeBoundaryDraw();
725 //! Returns true if the drawer has its own attribute for
726 //! "draw shared boundaries" flag that overrides the one in the link.
727 Standard_Boolean HasOwnUnFreeBoundaryDraw() const { return myHasOwnUnFreeBoundaryDraw; }
729 //! Sets line aspect for face boundaries.
730 //! The method sets line aspect owned by the drawer that will be used during
731 //! visualization instead of the one set in link.
732 //! theAspect is the line aspect that determines the look of the face boundaries.
733 Standard_EXPORT void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
735 //! Returns line aspect of face boundaries.
736 Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect();
738 //! Returns true if the drawer has its own attribute for
739 //! face boundaries aspect that overrides the one in the link.
740 Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
742 //! Enables or disables face boundary drawing for shading presentations.
743 //! The method sets drawing flag owned by the drawer that will be used during
744 //! visualization instead of the one set in link.
745 //! theIsEnabled is a boolean flag indicating whether the face boundaries should be drawn or not.
746 Standard_EXPORT void SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled);
748 //! Checks whether the face boundary drawing is enabled or not.
749 Standard_Boolean FaceBoundaryDraw() const
751 return HasOwnFaceBoundaryDraw() || myLink.IsNull()
753 : myLink->FaceBoundaryDraw();
756 //! Returns true if the drawer has its own attribute for
757 //! "draw face boundaries" flag that overrides the one in the link.
758 Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; }
760 //! Returns settings for the appearance of dimensions.
761 Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
763 //! Sets the settings for the appearance of dimensions.
764 //! The method sets aspect owned by the drawer that will be used during
765 //! visualization instead of the one set in link.
766 Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect);
768 //! Returns true if the drawer has its own attribute for
769 //! the appearance of dimensions that overrides the one in the link.
770 Standard_Boolean HasOwnDimensionAspect() const { return myHasOwnDimensionAspect; }
772 //! Sets dimension length model units for computing of dimension presentation.
773 //! The method sets value owned by the drawer that will be used during
774 //! visualization instead of the one set in link.
775 Standard_EXPORT void SetDimLengthModelUnits (const TCollection_AsciiString& theUnits);
777 //! Sets dimension angle model units for computing of dimension presentation.
778 //! The method sets value owned by the drawer that will be used during
779 //! visualization instead of the one set in link.
780 Standard_EXPORT void SetDimAngleModelUnits (const TCollection_AsciiString& theUnits);
782 //! Returns length model units for the dimension presentation.
783 const TCollection_AsciiString& DimLengthModelUnits() const
785 return HasOwnDimLengthModelUnits() || myLink.IsNull()
786 ? myDimensionModelUnits.GetLengthUnits()
787 : myLink->DimLengthModelUnits();
790 //! Returns angle model units for the dimension presentation.
791 const TCollection_AsciiString& DimAngleModelUnits() const
793 return HasOwnDimAngleModelUnits() || myLink.IsNull()
794 ? myDimensionModelUnits.GetAngleUnits()
795 : myLink->DimAngleModelUnits();
798 //! Returns true if the drawer has its own attribute for
799 //! dimension length model units that overrides the one in the link.
800 Standard_Boolean HasOwnDimLengthModelUnits() const { return myHasOwnDimLengthModelUnits; }
802 //! Returns true if the drawer has its own attribute for
803 //! dimension angle model units that overrides the one in the link.
804 Standard_Boolean HasOwnDimAngleModelUnits() const { return myHasOwnDimAngleModelUnits; }
806 //! Sets length units in which value for dimension presentation is displayed.
807 //! The method sets value owned by the drawer that will be used during
808 //! visualization instead of the one set in link.
809 Standard_EXPORT void SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits);
811 //! Sets angle units in which value for dimension presentation is displayed.
812 //! The method sets value owned by the drawer that will be used during
813 //! visualization instead of the one set in link.
814 Standard_EXPORT void SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits);
816 //! Returns length units in which dimension presentation is displayed.
817 const TCollection_AsciiString& DimLengthDisplayUnits() const
819 return HasOwnDimLengthDisplayUnits() || myLink.IsNull()
820 ? myDimensionDisplayUnits.GetLengthUnits()
821 : myLink->DimLengthDisplayUnits();
824 //! Returns angle units in which dimension presentation is displayed.
825 const TCollection_AsciiString& DimAngleDisplayUnits() const
827 return HasOwnDimAngleDisplayUnits() || myLink.IsNull()
828 ? myDimensionDisplayUnits.GetAngleUnits()
829 : myLink->DimAngleDisplayUnits();
832 //! Returns true if the drawer has its own attribute for
833 //! length units in which dimension presentation is displayed
834 //! that overrides the one in the link.
835 Standard_Boolean HasOwnDimLengthDisplayUnits() const { return myHasOwnDimLengthDisplayUnits; }
837 //! Returns true if the drawer has its own attribute for
838 //! angle units in which dimension presentation is displayed
839 //! that overrides the one in the link.
840 Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; }
842 //! Returns the drawer to which the current object references.
843 const Handle(Prs3d_Drawer)& Link() { return myLink; }
845 //! Returns true if the current object has a link on the other drawer.
846 Standard_Boolean HasLink() const { return !myLink.IsNull(); }
848 //! Sets theDrawer as a link to which the current object references.
849 void Link (const Handle(Prs3d_Drawer)& theDrawer)
854 //! Removes local attributes.
855 Standard_EXPORT void ClearLocalAttributes();
859 Handle(Prs3d_Drawer) myLink;
861 Standard_Integer myNbPoints;
862 Standard_Boolean myHasOwnNbPoints;
863 Standard_Real myMaximalParameterValue;
864 Standard_Boolean myHasOwnMaximalParameterValue;
865 Quantity_Length myChordialDeviation;
866 Standard_Boolean myHasOwnChordialDeviation;
867 Aspect_TypeOfDeflection myTypeOfDeflection;
868 Standard_Boolean myHasOwnTypeOfDeflection;
869 Prs3d_TypeOfHLR myTypeOfHLR;
870 Standard_Real myDeviationCoefficient;
871 Standard_Real myPreviousDeviationCoefficient;
872 Standard_Boolean myHasOwnDeviationCoefficient;
873 Standard_Real myHLRDeviationCoefficient;
874 Standard_Boolean myHasOwnHLRDeviationCoefficient;
875 Standard_Real myPreviousHLRDeviationCoefficient;
876 Standard_Real myDeviationAngle;
877 Standard_Boolean myHasOwnDeviationAngle;
878 Standard_Real myPreviousDeviationAngle;
879 Standard_Real myHLRAngle;
880 Standard_Boolean myHasOwnHLRDeviationAngle;
881 Standard_Real myPreviousHLRDeviationAngle;
882 Standard_Boolean myIsoOnPlane;
883 Standard_Boolean myHasOwnIsoOnPlane;
884 Standard_Boolean myIsoOnTriangulation;
885 Standard_Boolean myHasOwnIsoOnTriangulation;
886 Standard_Boolean myIsAutoTriangulated;
887 Standard_Boolean myHasOwnIsAutoTriangulated;
889 Handle(Prs3d_IsoAspect) myUIsoAspect;
890 Standard_Boolean myHasOwnUIsoAspect;
891 Handle(Prs3d_IsoAspect) myVIsoAspect;
892 Standard_Boolean myHasOwnVIsoAspect;
893 Handle(Prs3d_LineAspect) myWireAspect;
894 Standard_Boolean myHasOwnWireAspect;
895 Standard_Boolean myWireDraw;
896 Standard_Boolean myHasOwnWireDraw;
897 Handle(Prs3d_PointAspect) myPointAspect;
898 Standard_Boolean myHasOwnPointAspect;
899 Handle(Prs3d_LineAspect) myLineAspect;
900 Standard_Boolean myHasOwnLineAspect;
901 Handle(Prs3d_TextAspect) myTextAspect;
902 Standard_Boolean myHasOwnTextAspect;
903 Handle(Prs3d_ShadingAspect) myShadingAspect;
904 Standard_Boolean myHasOwnShadingAspect;
905 Standard_Boolean myShadingAspectGlobal;
906 Standard_Boolean myHasOwnShadingAspectGlobal;
907 Handle(Prs3d_PlaneAspect) myPlaneAspect;
908 Standard_Boolean myHasOwnPlaneAspect;
909 Handle(Prs3d_LineAspect) mySeenLineAspect;
910 Standard_Boolean myHasOwnSeenLineAspect;
911 Handle(Prs3d_ArrowAspect) myArrowAspect;
912 Standard_Boolean myHasOwnArrowAspect;
913 Standard_Boolean myLineArrowDraw;
914 Standard_Boolean myHasOwnLineArrowDraw;
915 Handle(Prs3d_LineAspect) myHiddenLineAspect;
916 Standard_Boolean myHasOwnHiddenLineAspect;
917 Standard_Boolean myDrawHiddenLine;
918 Standard_Boolean myHasOwnDrawHiddenLine;
919 Handle(Prs3d_LineAspect) myVectorAspect;
920 Standard_Boolean myHasOwnVectorAspect;
921 Prs3d_VertexDrawMode myVertexDrawMode;
922 Handle(Prs3d_DatumAspect) myDatumAspect;
923 Standard_Boolean myHasOwnDatumAspect;
924 Handle(Prs3d_LineAspect) mySectionAspect;
925 Standard_Boolean myHasOwnSectionAspect;
927 Handle(Prs3d_LineAspect) myFreeBoundaryAspect;
928 Standard_Boolean myHasOwnFreeBoundaryAspect;
929 Standard_Boolean myFreeBoundaryDraw;
930 Standard_Boolean myHasOwnFreeBoundaryDraw;
931 Handle(Prs3d_LineAspect) myUnFreeBoundaryAspect;
932 Standard_Boolean myHasOwnUnFreeBoundaryAspect;
933 Standard_Boolean myUnFreeBoundaryDraw;
934 Standard_Boolean myHasOwnUnFreeBoundaryDraw;
935 Handle(Prs3d_LineAspect) myFaceBoundaryAspect;
936 Standard_Boolean myHasOwnFaceBoundaryAspect;
937 Standard_Boolean myFaceBoundaryDraw;
938 Standard_Boolean myHasOwnFaceBoundaryDraw;
940 Handle(Prs3d_DimensionAspect) myDimensionAspect;
941 Standard_Boolean myHasOwnDimensionAspect;
942 Prs3d_DimensionUnits myDimensionModelUnits;
943 Standard_Boolean myHasOwnDimLengthModelUnits;
944 Standard_Boolean myHasOwnDimAngleModelUnits;
945 Prs3d_DimensionUnits myDimensionDisplayUnits;
946 Standard_Boolean myHasOwnDimLengthDisplayUnits;
947 Standard_Boolean myHasOwnDimAngleDisplayUnits;
951 DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
955 #endif // _Prs3d_Drawer_HeaderFile