0027555: Visualization, AIS_Shape - own deviation coefficient change is not considere...
[occt.git] / src / Prs3d / Prs3d_Drawer.hxx
CommitLineData
6262338c 1// Copyright (c) 1995-1999 Matra Datavision
2// Copyright (c) 1999-2014 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _Prs3d_Drawer_HeaderFile
16#define _Prs3d_Drawer_HeaderFile
17
18#include <Standard.hxx>
ec357c5c 19#include <Standard_Type.hxx>
6262338c 20
6262338c 21#include <Standard_Integer.hxx>
22#include <Standard_Boolean.hxx>
6262338c 23#include <Quantity_Length.hxx>
24#include <Aspect_TypeOfDeflection.hxx>
25#include <Standard_Real.hxx>
6262338c 26#include <Prs3d_VertexDrawMode.hxx>
6262338c 27#include <Prs3d_DimensionUnits.hxx>
28#include <Prs3d_TypeOfHLR.hxx>
29#include <MMgt_TShared.hxx>
30
31class Prs3d_IsoAspect;
32class Prs3d_LineAspect;
33class Prs3d_TextAspect;
34class Prs3d_ShadingAspect;
35class Prs3d_PointAspect;
36class Prs3d_PlaneAspect;
37class Prs3d_ArrowAspect;
38class Prs3d_DatumAspect;
39class Prs3d_DimensionAspect;
40class TCollection_AsciiString;
41
c04c30b3 42class Prs3d_Drawer;
6262338c 43DEFINE_STANDARD_HANDLE(Prs3d_Drawer, MMgt_TShared)
44
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.
48class Prs3d_Drawer : public MMgt_TShared
49{
50
51public:
52
53 //! Default constructor.
54 Standard_EXPORT Prs3d_Drawer();
55
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);
59
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
63 {
64 return HasOwnTypeOfDeflection() || myLink.IsNull()
65 ? myTypeOfDeflection
66 : myLink->TypeOfDeflection();
67 }
68
69 //! Returns true if the drawer has a type of deflection setting active.
70 Standard_Boolean HasOwnTypeOfDeflection() const { return myHasOwnTypeOfDeflection; }
71
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);
78
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
82 {
83 return HasOwnMaximalChordialDeviation() || myLink.IsNull()
84 ? myChordialDeviation
85 : myLink->MaximalChordialDeviation();
86 }
87
88 //! Returns true if the drawer has a maximal chordial deviation setting active.
89 Standard_Boolean HasOwnMaximalChordialDeviation() const { return myHasOwnChordialDeviation; }
90
91 //! Sets the type of HLR algorithm used by drawer's interactive objects
92 Standard_EXPORT void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR);
93
94 //! Returns the type of HLR algorithm currently in use.
95 Standard_EXPORT Prs3d_TypeOfHLR TypeOfHLR();
96
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); }
99
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);
103
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
107 {
108 return HasOwnMaximalParameterValue() || myLink.IsNull()
109 ? myMaximalParameterValue
110 : myLink->MaximalParameterValue();
111 }
112
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; }
116
117 //! Sets IsoOnPlane on or off by setting the parameter theIsEnabled to true or false.
118 Standard_EXPORT void SetIsoOnPlane (const Standard_Boolean theIsEnabled);
119
120 //! Returns True if the drawing of isos on planes is enabled.
121 Standard_Boolean IsoOnPlane() const
122 {
123 return HasOwnIsoOnPlane() || myLink.IsNull()
124 ? myIsoOnPlane
125 : myLink->IsoOnPlane();
126 }
127
128 //! Returns true if the drawer has IsoOnPlane setting active.
129 Standard_Boolean HasOwnIsoOnPlane() const { return myHasOwnIsoOnPlane; }
130
5ad8c033 131 //! Returns True if the drawing of isos on triangulation is enabled.
132 Standard_Boolean IsoOnTriangulation() const
133 {
134 return HasOwnIsoOnTriangulation() || myLink.IsNull()
135 ? myIsoOnTriangulation
136 : myLink->IsoOnTriangulation();
137 }
138
139 //! Returns true if the drawer has IsoOnTriangulation setting active.
140 Standard_Boolean HasOwnIsoOnTriangulation() const { return myHasOwnIsoOnTriangulation; }
141
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);
144
6262338c 145 //! Sets the discretisation parameter theValue.
146 Standard_EXPORT void SetDiscretisation (const Standard_Integer theValue);
147
148 //! Returns the discretisation setting.
149 Standard_Integer Discretisation() const
150 {
151 return HasOwnDiscretisation() || myLink.IsNull()
152 ? myNbPoints
153 : myLink->Discretisation();
154 }
155
156 //! Returns true if the drawer has discretisation setting active.
157 Standard_Boolean HasOwnDiscretisation() const { return myHasOwnNbPoints; }
158
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);
162
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
180 {
181 return HasOwnDeviationCoefficient() || myLink.IsNull()
182 ? myDeviationCoefficient
183 : myLink->DeviationCoefficient();
184 }
185
186 //! Sets the hasOwnDeviationCoefficient flag to Standard_False
187 void SetDeviationCoefficient()
188 {
189 myHasOwnDeviationCoefficient = Standard_False;
190 }
191
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; }
195
196 //! Saves the previous value used for the chordal
197 //! deviation coefficient.
198 Standard_Real PreviousDeviationCoefficient() const
199 {
200 return myHasOwnDeviationCoefficient
201 ? myPreviousDeviationCoefficient
202 : 0.0;
203 }
204
83b0f13a 205 //! Updates the previous value used for the chordal deviation coefficient to the current state.
206 void UpdatePreviousDeviationCoefficient()
207 {
208 if (myHasOwnDeviationCoefficient)
209 {
210 myPreviousDeviationCoefficient = DeviationCoefficient();
211 }
212 }
213
6262338c 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);
219
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
240 {
241 return HasOwnHLRDeviationCoefficient() || myLink.IsNull()
242 ? myHLRDeviationCoefficient
243 : myLink->HLRDeviationCoefficient();
244 }
245
246 //! Sets the hasOwnHLRDeviationCoefficient flag to Standard_False
247 void SetHLRDeviationCoefficient()
248 {
249 myHasOwnHLRDeviationCoefficient = Standard_False;
250 }
251
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; }
255
256 //! Returns the previous value of the hidden line removal deviation coefficient.
257 Standard_Real PreviousHLRDeviationCoefficient() const
258 {
259 return myHasOwnHLRDeviationCoefficient
260 ? myPreviousHLRDeviationCoefficient
261 : 0.0;
262 }
263
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);
267
268 //! Returns the value for deviation angle.
269 Standard_Real DeviationAngle() const
270 {
271 return HasOwnDeviationAngle() || myLink.IsNull()
272 ? myDeviationAngle
273 : myLink->DeviationAngle();
274 }
275
276 //! Sets the hasOwnDeviationAngle flag to Standard_False
277 void SetDeviationAngle()
278 {
279 myHasOwnDeviationAngle = Standard_False;
280 }
281
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; }
285
286 //! Returns the previous deviation angle
287 Standard_Real PreviousDeviationAngle() const
288 {
289 return myHasOwnDeviationAngle
290 ? myPreviousDeviationAngle
291 : 0.0;
292 }
293
83b0f13a 294 //! Updates the previous deviation angle to the current value
295 void UpdatePreviousDeviationAngle()
296 {
297 if (myHasOwnDeviationAngle)
298 {
299 myPreviousDeviationAngle = DeviationAngle();
300 }
301 }
302
6262338c 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);
308
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
312 {
313 return HasOwnHLRDeviationAngle() || myLink.IsNull()
314 ? myHLRAngle
315 : myLink->HLRAngle();
316 }
317
318 //! Sets the hasOwnHLRDeviationAngle flag to Standard_False
319 void SetHLRAngle()
320 {
321 myHasOwnHLRDeviationAngle = Standard_False;
322 }
323
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; }
327
328 //! Returns the previous value of the HLR deviation angle.
329 Standard_Real PreviousHLRDeviationAngle() const
330 {
331 return myHasOwnHLRDeviationAngle
332 ? myPreviousHLRDeviationAngle
333 : 0.0;
334 }
335
4c513386 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);
341
342 //! Returns True if automatic triangulation is enabled.
343 Standard_Boolean IsAutoTriangulation() const
344 {
345 return HasOwnIsAutoTriangulation() || myLink.IsNull()
346 ? myIsAutoTriangulated
347 : myLink->IsAutoTriangulation();
348 }
349
350 //! Returns true if the drawer has IsoOnPlane setting active.
351 Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
352
6262338c 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
361 //! WIDTH : 0.5
362 //!
363 //! These attributes are used by the following algorithms:
364 //! Prs3d_WFDeflectionSurface
365 //! Prs3d_WFDeflectionRestrictedFace
366 Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect();
367
368 Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
369
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; }
373
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
382 //! WIDTH : 0.5
383 //!
384 //! These attributes are used by the following algorithms:
385 //! Prs3d_WFDeflectionSurface
386 //! Prs3d_WFDeflectionRestrictedFace
387 Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect();
388
389 //! Sets the appearance of V isoparameters - theAspect.
390 Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
391
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; }
395
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
401 //! Width: 1.0
402 //! These attributes are used by the algorithm Prs3d_WFShape.
403 Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect();
404
405 //! Sets the parameter theAspect for display of wires.
406 Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect);
407
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; }
411
412 //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false.
413 Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled);
414
415 //! Returns True if the drawing of the wire is enabled.
416 Standard_Boolean WireDraw() const
417 {
418 return HasOwnWireDraw() || myLink.IsNull()
419 ? myWireDraw
420 : myLink->WireDraw();
421 }
422
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; }
426
427 //! Returns the point aspect setting. The default values are
428 //! Color: Quantity_NOC_YELLOW
429 //! Type of marker: Aspect_TOM_PLUS
430 //! Scale: 1.0
431 //! These attributes are used by the algorithms Prs3d_Point.
432 Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect();
433
434 //! Sets the parameter theAspect for display attributes of points
435 Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
436
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; }
440
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
445 //! Width: 1.0
446 //! These attributes are used by the following algorithms:
447 //! Prs3d_Curve
448 //! Prs3d_Line
449 //! Prs3d_HLRShape
450 Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect();
451
452 //! Sets the parameter theAspect for display attributes of lines.
453 Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
454
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; }
458
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();
463
464 //! Sets the parameter theAspect for display attributes of text.
465 Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect);
466
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; }
470
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();
481
482 //! Sets the parameter theAspect for display attributes of shading.
483 Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect);
484
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; }
488
489 //! Returns True if the ShadingAspect is applied
490 //! to the whole presentation.
491 Standard_Boolean ShadingAspectGlobal() const
492 {
493 return HasOwnShadingAspectGlobal() || myLink.IsNull()
494 ? myShadingAspectGlobal
495 : myLink->ShadingAspectGlobal();
496 }
497
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);
502
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; }
506
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
511 //! Width: 1.0
512 Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect();
513
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);
516
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; }
520
521 //! Returns settings for the appearance of planes.
522 Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect();
523
524 //! Sets the parameter theAspect for the display of planes.
525 Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect);
526
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; }
530
531 //! Returns the attributes for display of arrows.
532 Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect();
533
534 //! Sets the parameter theAspect for display attributes of arrows.
535 Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect);
536
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; }
540
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);
544
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
548 {
549 return HasOwnLineArrowDraw() || myLink.IsNull()
550 ? myLineArrowDraw
551 : myLink->LineArrowDraw();
552 }
553
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
557 {
558 return myHasOwnLineArrowDraw;
559 }
560
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
565 //! Width: 1.0
566 Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect();
567
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);
570
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; }
574
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
578 {
579 return HasOwnDrawHiddenLine() || myLink.IsNull()
580 ? myDrawHiddenLine
581 : myLink->DrawHiddenLine();
582 }
583
584 //! Enables the DrawHiddenLine function.
585 Standard_EXPORT void EnableDrawHiddenLine();
586
587 //! Disables the DrawHiddenLine function.
588 Standard_EXPORT void DisableDrawHiddenLine();
589
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; }
593
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
598 //! Width: 1.0
599 Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect();
600
601 //! Sets the modality theAspect for the display of vectors.
602 Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect);
603
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; }
607
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);
615
616 //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
617 Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode();
618
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); }
623
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
628 //! Width: 1.0
629 Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect();
630
631 //! Sets the modality theAspect for the display of datums.
632 Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect);
633
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; }
637
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
642 //! Width: 1.0
643 //! These attributes are used by the algorithm Prs3d_WFShape.
644 Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect();
645
646 //! Sets the parameter theAspect for display attributes of sections.
647 Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect);
648
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; }
652
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);
657
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
664 //! Width: 1.0
665 //! These attributes are used by the algorithm Prs3d_WFShape
666 Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect();
667
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; }
671
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
676 //! drawn or not.
677 Standard_EXPORT void SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
678
679 //! Returns True if the drawing of the free boundaries is enabled
680 //! True is the default setting.
681 Standard_Boolean FreeBoundaryDraw() const
682 {
683 return HasOwnFreeBoundaryDraw() || myLink.IsNull()
684 ? myFreeBoundaryDraw
685 : myLink->FreeBoundaryDraw();
686 }
687
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; }
691
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);
696
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
702 //! Width: 1.
703 //! These attributes are used by the algorithm Prs3d_WFShape
704 Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect();
705
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; }
709
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);
715
716 //! Returns True if the drawing of the shared boundaries is enabled.
717 //! True is the default setting.
718 Standard_Boolean UnFreeBoundaryDraw() const
719 {
720 return HasOwnUnFreeBoundaryDraw() || myLink.IsNull()
721 ? myUnFreeBoundaryDraw
722 : myLink->UnFreeBoundaryDraw();
723 }
724
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; }
728
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);
734
735 //! Returns line aspect of face boundaries.
736 Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect();
737
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; }
741
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);
747
748 //! Checks whether the face boundary drawing is enabled or not.
749 Standard_Boolean FaceBoundaryDraw() const
750 {
751 return HasOwnFaceBoundaryDraw() || myLink.IsNull()
752 ? myFaceBoundaryDraw
753 : myLink->FaceBoundaryDraw();
754 }
755
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; }
759
760 //! Returns settings for the appearance of dimensions.
761 Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
762
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);
767
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; }
771
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);
776
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);
781
782 //! Returns length model units for the dimension presentation.
783 const TCollection_AsciiString& DimLengthModelUnits() const
784 {
785 return HasOwnDimLengthModelUnits() || myLink.IsNull()
786 ? myDimensionModelUnits.GetLengthUnits()
787 : myLink->DimLengthModelUnits();
788 }
789
790 //! Returns angle model units for the dimension presentation.
791 const TCollection_AsciiString& DimAngleModelUnits() const
792 {
793 return HasOwnDimAngleModelUnits() || myLink.IsNull()
794 ? myDimensionModelUnits.GetAngleUnits()
795 : myLink->DimAngleModelUnits();
796 }
797
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; }
801
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; }
805
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);
810
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);
815
816 //! Returns length units in which dimension presentation is displayed.
817 const TCollection_AsciiString& DimLengthDisplayUnits() const
818 {
819 return HasOwnDimLengthDisplayUnits() || myLink.IsNull()
820 ? myDimensionDisplayUnits.GetLengthUnits()
821 : myLink->DimLengthDisplayUnits();
822 }
823
824 //! Returns angle units in which dimension presentation is displayed.
825 const TCollection_AsciiString& DimAngleDisplayUnits() const
826 {
827 return HasOwnDimAngleDisplayUnits() || myLink.IsNull()
828 ? myDimensionDisplayUnits.GetAngleUnits()
829 : myLink->DimAngleDisplayUnits();
830 }
831
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; }
836
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; }
841
842 //! Returns the drawer to which the current object references.
843 const Handle(Prs3d_Drawer)& Link() { return myLink; }
844
845 //! Returns true if the current object has a link on the other drawer.
846 Standard_Boolean HasLink() const { return !myLink.IsNull(); }
847
848 //! Sets theDrawer as a link to which the current object references.
849 void Link (const Handle(Prs3d_Drawer)& theDrawer)
850 {
851 myLink = theDrawer;
852 }
853
854 //! Removes local attributes.
855 Standard_EXPORT void ClearLocalAttributes();
856
857protected:
858
859 Handle(Prs3d_Drawer) myLink;
860
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;
5ad8c033 884 Standard_Boolean myIsoOnTriangulation;
885 Standard_Boolean myHasOwnIsoOnTriangulation;
4c513386 886 Standard_Boolean myIsAutoTriangulated;
887 Standard_Boolean myHasOwnIsAutoTriangulated;
6262338c 888
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;
926
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;
939
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;
948
949public:
950
92efcf78 951 DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
6262338c 952
953};
954
955#endif // _Prs3d_Drawer_HeaderFile