0024023: Revamp the OCCT Handle -- general
[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
131 //! Sets the discretisation parameter theValue.
132 Standard_EXPORT void SetDiscretisation (const Standard_Integer theValue);
133
134 //! Returns the discretisation setting.
135 Standard_Integer Discretisation() const
136 {
137 return HasOwnDiscretisation() || myLink.IsNull()
138 ? myNbPoints
139 : myLink->Discretisation();
140 }
141
142 //! Returns true if the drawer has discretisation setting active.
143 Standard_Boolean HasOwnDiscretisation() const { return myHasOwnNbPoints; }
144
145 //! Sets the deviation coefficient theCoefficient.
146 //! Also sets the hasOwnDeviationCoefficient flag to Standard_True and myPreviousDeviationCoefficient
147 Standard_EXPORT void SetDeviationCoefficient (const Standard_Real theCoefficient);
148
149 //! Returns the deviation coefficient.
150 //! Drawings of curves or patches are made with respect
151 //! to a maximal chordal deviation. A Deviation coefficient
152 //! is used in the shading display mode. The shape is
153 //! seen decomposed into triangles. These are used to
154 //! calculate reflection of light from the surface of the
155 //! object. The triangles are formed from chords of the
156 //! curves in the shape. The deviation coefficient gives
157 //! the highest value of the angle with which a chord can
158 //! deviate from a tangent to a curve. If this limit is
159 //! reached, a new triangle is begun.
160 //! This deviation is absolute and is set through the
161 //! method: SetMaximalChordialDeviation. The default value is 0.001.
162 //! In drawing shapes, however, you are allowed to ask
163 //! for a relative deviation. This deviation will be:
164 //! SizeOfObject * DeviationCoefficient.
165 Standard_Real DeviationCoefficient() const
166 {
167 return HasOwnDeviationCoefficient() || myLink.IsNull()
168 ? myDeviationCoefficient
169 : myLink->DeviationCoefficient();
170 }
171
172 //! Sets the hasOwnDeviationCoefficient flag to Standard_False
173 void SetDeviationCoefficient()
174 {
175 myHasOwnDeviationCoefficient = Standard_False;
176 }
177
178 //! Returns true if there is a local setting for deviation
179 //! coefficient in this framework for a specific interactive object.
180 Standard_Boolean HasOwnDeviationCoefficient() const { return myHasOwnDeviationCoefficient; }
181
182 //! Saves the previous value used for the chordal
183 //! deviation coefficient.
184 Standard_Real PreviousDeviationCoefficient() const
185 {
186 return myHasOwnDeviationCoefficient
187 ? myPreviousDeviationCoefficient
188 : 0.0;
189 }
190
191 //! Sets the deviation coefficient aCoefficient for removal
192 //! of hidden lines created by different viewpoints in
193 //! different presentations. The Default value is 0.02.
194 //! Also sets the hasOwnHLRDeviationCoefficient flag to Standard_True and myPreviousHLRDeviationCoefficient
195 Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real theCoefficient);
196
197 //! Returns the real number value of the hidden line
198 //! removal deviation coefficient in this framework, if the flag
199 //! hasOwnHLRDeviationCoefficient is true or there is no Link.
200 //! Else the shape's HLR deviation coefficient is used.
201 //! A Deviation coefficient is used in the shading display
202 //! mode. The shape is seen decomposed into triangles.
203 //! These are used to calculate reflection of light from the
204 //! surface of the object.
205 //! The triangles are formed from chords of the curves in
206 //! the shape. The deviation coefficient give the highest
207 //! value of the angle with which a chord can deviate
208 //! from a tangent to a curve. If this limit is reached, a new triangle is begun.
209 //! To find the hidden lines, hidden line display mode
210 //! entails recalculation of the view at each different projector perspective.
211 //! Since hidden lines entail calculations of more than
212 //! usual complexity to decompose them into these
213 //! triangles, a deviation coefficient allowing greater
214 //! tolerance is used. This increases efficiency in calculation.
215 //! The Default value is 0.02.
216 Standard_Real HLRDeviationCoefficient() const
217 {
218 return HasOwnHLRDeviationCoefficient() || myLink.IsNull()
219 ? myHLRDeviationCoefficient
220 : myLink->HLRDeviationCoefficient();
221 }
222
223 //! Sets the hasOwnHLRDeviationCoefficient flag to Standard_False
224 void SetHLRDeviationCoefficient()
225 {
226 myHasOwnHLRDeviationCoefficient = Standard_False;
227 }
228
229 //! Returns true if the there is a setting for HLR deviation
230 //! coefficient in this framework for a specific interactive object.
231 Standard_Boolean HasOwnHLRDeviationCoefficient() const { return myHasOwnHLRDeviationCoefficient; }
232
233 //! Returns the previous value of the hidden line removal deviation coefficient.
234 Standard_Real PreviousHLRDeviationCoefficient() const
235 {
236 return myHasOwnHLRDeviationCoefficient
237 ? myPreviousHLRDeviationCoefficient
238 : 0.0;
239 }
240
241 //! Sets the deviation angle theAngle.
242 //! Also sets the hasOwnDeviationAngle flag to Standard_True, and myPreviousDeviationAngle.
243 Standard_EXPORT void SetDeviationAngle (const Standard_Real theAngle);
244
245 //! Returns the value for deviation angle.
246 Standard_Real DeviationAngle() const
247 {
248 return HasOwnDeviationAngle() || myLink.IsNull()
249 ? myDeviationAngle
250 : myLink->DeviationAngle();
251 }
252
253 //! Sets the hasOwnDeviationAngle flag to Standard_False
254 void SetDeviationAngle()
255 {
256 myHasOwnDeviationAngle = Standard_False;
257 }
258
259 //! Returns true if the there is a local setting for deviation
260 //! angle in this framework for a specific interactive object.
261 Standard_Boolean HasOwnDeviationAngle() const { return myHasOwnDeviationAngle; }
262
263 //! Returns the previous deviation angle
264 Standard_Real PreviousDeviationAngle() const
265 {
266 return myHasOwnDeviationAngle
267 ? myPreviousDeviationAngle
268 : 0.0;
269 }
270
271 //! Sets anAngle, the angle of maximum chordal deviation for removal of hidden lines created by
272 //! different viewpoints in different presentations.
273 //! The default value is 20 * M_PI / 180.
274 //! Also sets the hasOwnHLRDeviationAngle flag to Standard_True and myPreviousHLRDeviationAngle.
275 Standard_EXPORT void SetHLRAngle (const Standard_Real theAngle);
276
277 //! Returns the real number value of the deviation angle
278 //! in hidden line removal views. The default value is 20 * M_PI / 180.
279 Standard_Real HLRAngle() const
280 {
281 return HasOwnHLRDeviationAngle() || myLink.IsNull()
282 ? myHLRAngle
283 : myLink->HLRAngle();
284 }
285
286 //! Sets the hasOwnHLRDeviationAngle flag to Standard_False
287 void SetHLRAngle()
288 {
289 myHasOwnHLRDeviationAngle = Standard_False;
290 }
291
292 //! Returns true if the there is a setting for HLR deviation
293 //! angle in this framework for a specific interactive object.
294 Standard_Boolean HasOwnHLRDeviationAngle() const { return myHasOwnHLRDeviationAngle; }
295
296 //! Returns the previous value of the HLR deviation angle.
297 Standard_Real PreviousHLRDeviationAngle() const
298 {
299 return myHasOwnHLRDeviationAngle
300 ? myPreviousHLRDeviationAngle
301 : 0.0;
302 }
303
4c513386 304 //! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false.
305 //! If this flag is True automatic re-triangulation with deflection-check logic will be applied.
306 //! Else this feature will be disable and triangulation is expected to be computed by application itself
307 //! and no shading presentation at all if unavailable.
308 Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled);
309
310 //! Returns True if automatic triangulation is enabled.
311 Standard_Boolean IsAutoTriangulation() const
312 {
313 return HasOwnIsAutoTriangulation() || myLink.IsNull()
314 ? myIsAutoTriangulated
315 : myLink->IsAutoTriangulation();
316 }
317
318 //! Returns true if the drawer has IsoOnPlane setting active.
319 Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; }
320
6262338c 321 //! Defines the attributes which are used when drawing an
322 //! U isoparametric curve of a face. Defines the number
323 //! of U isoparametric curves to be drawn for a single face.
324 //! The LineAspect for U isoparametric lines can be edited
325 //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
326 //! The default values are:
327 //! COLOR : Quantity_NOC_GRAY75
328 //! TYPE OF LINE: Aspect_TOL_SOLID
329 //! WIDTH : 0.5
330 //!
331 //! These attributes are used by the following algorithms:
332 //! Prs3d_WFDeflectionSurface
333 //! Prs3d_WFDeflectionRestrictedFace
334 Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect();
335
336 Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
337
338 //! Returns true if the drawer has its own attribute for
339 //! UIso aspect that overrides the one in the link.
340 Standard_Boolean HasOwnUIsoAspect() const { return myHasOwnUIsoAspect; }
341
342 //! Defines the attributes which are used when drawing an
343 //! V isoparametric curve of a face. Defines the number
344 //! of V isoparametric curves to be drawn for a single face.
345 //! The LineAspect for V isoparametric lines can be edited
346 //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
347 //! The default values are:
348 //! COLOR : Quantity_NOC_GRAY82
349 //! TYPE OF LINE: Aspect_TOL_SOLID
350 //! WIDTH : 0.5
351 //!
352 //! These attributes are used by the following algorithms:
353 //! Prs3d_WFDeflectionSurface
354 //! Prs3d_WFDeflectionRestrictedFace
355 Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect();
356
357 //! Sets the appearance of V isoparameters - theAspect.
358 Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
359
360 //! Returns true if the drawer has its own attribute for
361 //! VIso aspect that overrides the one in the link.
362 Standard_Boolean HasOwnVIsoAspect() const { return myHasOwnVIsoAspect; }
363
364 //! Returns wire aspect settings.
365 //! The LineAspect for the free boundaries can be edited.
366 //! The default values are:
367 //! Color: Quantity_NOC_GREEN
368 //! Type of line: Aspect_TOL_SOLID
369 //! Width: 1.0
370 //! These attributes are used by the algorithm Prs3d_WFShape.
371 Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect();
372
373 //! Sets the parameter theAspect for display of wires.
374 Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect);
375
376 //! Returns true if the drawer has its own attribute for
377 //! wire aspect that overrides the one in the link.
378 Standard_Boolean HasOwnWireAspect() const { return myHasOwnWireAspect; }
379
380 //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false.
381 Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled);
382
383 //! Returns True if the drawing of the wire is enabled.
384 Standard_Boolean WireDraw() const
385 {
386 return HasOwnWireDraw() || myLink.IsNull()
387 ? myWireDraw
388 : myLink->WireDraw();
389 }
390
391 //! Returns true if the drawer has its own attribute for
392 //! "draw wires" flag that overrides the one in the link.
393 Standard_Boolean HasOwnWireDraw() const { return myHasOwnWireDraw; }
394
395 //! Returns the point aspect setting. The default values are
396 //! Color: Quantity_NOC_YELLOW
397 //! Type of marker: Aspect_TOM_PLUS
398 //! Scale: 1.0
399 //! These attributes are used by the algorithms Prs3d_Point.
400 Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect();
401
402 //! Sets the parameter theAspect for display attributes of points
403 Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
404
405 //! Returns true if the drawer has its own attribute for
406 //! point aspect that overrides the one in the link.
407 Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; }
408
409 //! Returns settings for line aspects.
410 //! These settings can be edited. The default values are:
411 //! Color: Quantity_NOC_YELLOW
412 //! Type of line: Aspect_TOL_SOLID
413 //! Width: 1.0
414 //! These attributes are used by the following algorithms:
415 //! Prs3d_Curve
416 //! Prs3d_Line
417 //! Prs3d_HLRShape
418 Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect();
419
420 //! Sets the parameter theAspect for display attributes of lines.
421 Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
422
423 //! Returns true if the drawer has its own attribute for
424 //! line aspect that overrides the one in the link.
425 Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; }
426
427 //! Returns settings for text aspect.
428 //! These settings can be edited. The default value is:
429 //! - Color: Quantity_NOC_YELLOW
430 Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect();
431
432 //! Sets the parameter theAspect for display attributes of text.
433 Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect);
434
435 //! Returns true if the drawer has its own attribute for
436 //! text aspect that overrides the one in the link.
437 Standard_Boolean HasOwnTextAspect() const { return myHasOwnTextAspect; }
438
439 //! Returns settings for shading aspects.
440 //! These settings can be edited. The default values are:
441 //! - Color: Quantity_NOC_YELLOW
442 //! - Material: Graphic3d_NOM_BRASS
443 //! Shading aspect is obtained through decomposition of
444 //! 3d faces into triangles, each side of each triangle
445 //! being a chord of the corresponding curved edge in the face.
446 //! Reflection of light in each projector perspective is then calculated for each of the
447 //! resultant triangular planes.
448 Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect();
449
450 //! Sets the parameter theAspect for display attributes of shading.
451 Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect);
452
453 //! Returns true if the drawer has its own attribute for
454 //! shading aspect that overrides the one in the link.
455 Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; }
456
457 //! Returns True if the ShadingAspect is applied
458 //! to the whole presentation.
459 Standard_Boolean ShadingAspectGlobal() const
460 {
461 return HasOwnShadingAspectGlobal() || myLink.IsNull()
462 ? myShadingAspectGlobal
463 : myLink->ShadingAspectGlobal();
464 }
465
466 //! Indicates that the ShadingAspect will be apply
467 //! to the whole presentation. This allows to modify
468 //! the aspect without recomputing the content of the presentation.
469 Standard_EXPORT void SetShadingAspectGlobal (const Standard_Boolean theValue);
470
471 //! Returns true if the drawer has its own attribute for
472 //! ShadingAspectGlobal flag that overrides the one in the link.
473 Standard_Boolean HasOwnShadingAspectGlobal() const { return myHasOwnShadingAspectGlobal; }
474
475 //! Returns settings for seen line aspects.
476 //! These settings can be edited. The default values are:
477 //! Color: Quantity_NOC_YELLOW
478 //! Type of line: Aspect_TOL_SOLID
479 //! Width: 1.0
480 Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect();
481
482 //! Sets the parameter theAspect for the display of seen lines in hidden line removal mode.
483 Standard_EXPORT void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
484
485 //! Returns true if the drawer has its own attribute for
486 //! seen line aspect that overrides the one in the link.
487 Standard_Boolean HasOwnSeenLineAspect() const { return myHasOwnSeenLineAspect; }
488
489 //! Returns settings for the appearance of planes.
490 Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect();
491
492 //! Sets the parameter theAspect for the display of planes.
493 Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect);
494
495 //! Returns true if the drawer has its own attribute for
496 //! plane aspect that overrides the one in the link.
497 Standard_Boolean HasOwnPlaneAspect() const { return myHasOwnPlaneAspect; }
498
499 //! Returns the attributes for display of arrows.
500 Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect();
501
502 //! Sets the parameter theAspect for display attributes of arrows.
503 Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect);
504
505 //! Returns true if the drawer has its own attribute for
506 //! arrow aspect that overrides the one in the link.
507 Standard_Boolean HasOwnArrowAspect() const { return myHasOwnArrowAspect; }
508
509 //! Enables the drawing of an arrow at the end of each line.
510 //! By default the arrows are not drawn.
511 Standard_EXPORT void SetLineArrowDraw (const Standard_Boolean theIsEnabled);
512
513 //! Returns True if drawing an arrow at the end of each edge is enabled
514 //! and False otherwise (the default).
515 Standard_Boolean LineArrowDraw() const
516 {
517 return HasOwnLineArrowDraw() || myLink.IsNull()
518 ? myLineArrowDraw
519 : myLink->LineArrowDraw();
520 }
521
522 //! Returns true if the drawer has its own attribute for
523 //! "draw arrow" flag that overrides the one in the link.
524 Standard_Boolean HasOwnLineArrowDraw() const
525 {
526 return myHasOwnLineArrowDraw;
527 }
528
529 //! Returns settings for hidden line aspects.
530 //! These settings can be edited. The default values are:
531 //! Color: Quantity_NOC_YELLOW
532 //! Type of line: Aspect_TOL_DASH
533 //! Width: 1.0
534 Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect();
535
536 //! Sets the parameter theAspect for the display of hidden lines in hidden line removal mode.
537 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
538
539 //! Returns true if the drawer has its own attribute for
540 //! hidden lines aspect that overrides the one in the link.
541 Standard_Boolean HasOwnHiddenLineAspect() const { return myHasOwnHiddenLineAspect; }
542
543 //! Returns Standard_True if the hidden lines are to be drawn.
544 //! By default the hidden lines are not drawn.
545 Standard_Boolean DrawHiddenLine() const
546 {
547 return HasOwnDrawHiddenLine() || myLink.IsNull()
548 ? myDrawHiddenLine
549 : myLink->DrawHiddenLine();
550 }
551
552 //! Enables the DrawHiddenLine function.
553 Standard_EXPORT void EnableDrawHiddenLine();
554
555 //! Disables the DrawHiddenLine function.
556 Standard_EXPORT void DisableDrawHiddenLine();
557
558 //! Returns true if the drawer has its own attribute for
559 //! "draw hidden lines" flag that overrides the one in the link.
560 Standard_Boolean HasOwnDrawHiddenLine() const { return myHasOwnDrawHiddenLine; }
561
562 //! Returns settings for the appearance of vectors.
563 //! These settings can be edited. The default values are:
564 //! Color: Quantity_NOC_SKYBLUE
565 //! Type of line: Aspect_TOL_SOLID
566 //! Width: 1.0
567 Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect();
568
569 //! Sets the modality theAspect for the display of vectors.
570 Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect);
571
572 //! Returns true if the drawer has its own attribute for
573 //! vector aspect that overrides the one in the link.
574 Standard_Boolean HasOwnVectorAspect() const { return myHasOwnVectorAspect; }
575
576 //! Sets the mode of visualization of vertices of a TopoDS_Shape instance.
577 //! By default, only stand-alone vertices (not belonging topologically to an edge) are drawn,
578 //! that corresponds to Prs3d_VDM_Standalone mode.
579 //! Switching to Prs3d_VDM_Standalone mode makes all shape's vertices visible.
580 //! To inherit this parameter from the global drawer instance ("the link") when it is present,
581 //! Prs3d_VDM_Inherited value should be used.
582 Standard_EXPORT void SetVertexDrawMode (const Prs3d_VertexDrawMode theMode);
583
584 //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
585 Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode();
586
587 //! Returns true if the vertex draw mode is not equal to <b>Prs3d_VDM_Inherited</b>.
588 //! This means that individual vertex draw mode value (i.e. not inherited from the global
589 //! drawer) is used for a specific interactive object.
590 Standard_Boolean HasOwnVertexDrawMode() const { return (myVertexDrawMode != Prs3d_VDM_Inherited); }
591
592 //! Returns settings for the appearance of datums.
593 //! These settings can be edited. The default values for the three axes are:
594 //! Color: Quantity_NOC_PEACHPUFF
595 //! Type of line: Aspect_TOL_SOLID
596 //! Width: 1.0
597 Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect();
598
599 //! Sets the modality theAspect for the display of datums.
600 Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect);
601
602 //! Returns true if the drawer has its own attribute for
603 //! datum aspect that overrides the one in the link.
604 Standard_Boolean HasOwnDatumAspect() const { return myHasOwnDatumAspect; }
605
606 //! The LineAspect for the wire can be edited.
607 //! The default values are:
608 //! Color: Quantity_NOC_ORANGE
609 //! Type of line: Aspect_TOL_SOLID
610 //! Width: 1.0
611 //! These attributes are used by the algorithm Prs3d_WFShape.
612 Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect();
613
614 //! Sets the parameter theAspect for display attributes of sections.
615 Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect);
616
617 //! Returns true if the drawer has its own attribute for
618 //! section aspect that overrides the one in the link.
619 Standard_Boolean HasOwnSectionAspect() const { return myHasOwnSectionAspect; }
620
621 //! Sets the parameter theAspect for the display of free boundaries.
622 //! The method sets aspect owned by the drawer that will be used during
623 //! visualization instead of the one set in link.
624 Standard_EXPORT void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
625
626 //! Returns the values for presentation of free boundaries,
627 //! in other words, boundaries which are not shared.
628 //! The LineAspect for the free boundaries can be edited.
629 //! The default values are:
630 //! Color: Quantity_NOC_GREEN
631 //! Type of line: Aspect_TOL_SOLID
632 //! Width: 1.0
633 //! These attributes are used by the algorithm Prs3d_WFShape
634 Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect();
635
636 //! Returns true if the drawer has its own attribute for
637 //! free boundaries aspect that overrides the one in the link.
638 Standard_Boolean HasOwnFreeBoundaryAspect() const { return myHasOwnFreeBoundaryAspect; }
639
640 //! Enables or disables drawing of free boundaries for shading presentations.
641 //! The method sets drawing flag owned by the drawer that will be used during
642 //! visualization instead of the one set in link.
643 //! theIsEnabled is a boolean flag indicating whether the free boundaries should be
644 //! drawn or not.
645 Standard_EXPORT void SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
646
647 //! Returns True if the drawing of the free boundaries is enabled
648 //! True is the default setting.
649 Standard_Boolean FreeBoundaryDraw() const
650 {
651 return HasOwnFreeBoundaryDraw() || myLink.IsNull()
652 ? myFreeBoundaryDraw
653 : myLink->FreeBoundaryDraw();
654 }
655
656 //! Returns true if the drawer has its own attribute for
657 //! "draw free boundaries" flag that overrides the one in the link.
658 Standard_Boolean HasOwnFreeBoundaryDraw() const { return myHasOwnFreeBoundaryDraw; }
659
660 //! Sets the parameter theAspect for the display of shared boundaries.
661 //! The method sets aspect owned by the drawer that will be used during
662 //! visualization instead of the one set in link.
663 Standard_EXPORT void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
664
665 //! Returns settings for shared boundary line aspects.
666 //! The LineAspect for the unfree boundaries can be edited.
667 //! The default values are:
668 //! Color: Quantity_NOC_YELLOW
669 //! Type of line: Aspect_TOL_SOLID
670 //! Width: 1.
671 //! These attributes are used by the algorithm Prs3d_WFShape
672 Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect();
673
674 //! Returns true if the drawer has its own attribute for
675 //! unfree boundaries aspect that overrides the one in the link.
676 Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return myHasOwnUnFreeBoundaryAspect; }
677
678 //! Enables or disables drawing of shared boundaries for shading presentations.
679 //! The method sets drawing flag owned by the drawer that will be used during
680 //! visualization instead of the one set in link.
681 //! theIsEnabled is a boolean flag indicating whether the shared boundaries should be drawn or not.
682 Standard_EXPORT void SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled);
683
684 //! Returns True if the drawing of the shared boundaries is enabled.
685 //! True is the default setting.
686 Standard_Boolean UnFreeBoundaryDraw() const
687 {
688 return HasOwnUnFreeBoundaryDraw() || myLink.IsNull()
689 ? myUnFreeBoundaryDraw
690 : myLink->UnFreeBoundaryDraw();
691 }
692
693 //! Returns true if the drawer has its own attribute for
694 //! "draw shared boundaries" flag that overrides the one in the link.
695 Standard_Boolean HasOwnUnFreeBoundaryDraw() const { return myHasOwnUnFreeBoundaryDraw; }
696
697 //! Sets line aspect for face boundaries.
698 //! The method sets line aspect owned by the drawer that will be used during
699 //! visualization instead of the one set in link.
700 //! theAspect is the line aspect that determines the look of the face boundaries.
701 Standard_EXPORT void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
702
703 //! Returns line aspect of face boundaries.
704 Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect();
705
706 //! Returns true if the drawer has its own attribute for
707 //! face boundaries aspect that overrides the one in the link.
708 Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
709
710 //! Enables or disables face boundary drawing 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 face boundaries should be drawn or not.
714 Standard_EXPORT void SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled);
715
716 //! Checks whether the face boundary drawing is enabled or not.
717 Standard_Boolean FaceBoundaryDraw() const
718 {
719 return HasOwnFaceBoundaryDraw() || myLink.IsNull()
720 ? myFaceBoundaryDraw
721 : myLink->FaceBoundaryDraw();
722 }
723
724 //! Returns true if the drawer has its own attribute for
725 //! "draw face boundaries" flag that overrides the one in the link.
726 Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; }
727
728 //! Returns settings for the appearance of dimensions.
729 Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
730
731 //! Sets the settings for the appearance of dimensions.
732 //! The method sets aspect owned by the drawer that will be used during
733 //! visualization instead of the one set in link.
734 Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect);
735
736 //! Returns true if the drawer has its own attribute for
737 //! the appearance of dimensions that overrides the one in the link.
738 Standard_Boolean HasOwnDimensionAspect() const { return myHasOwnDimensionAspect; }
739
740 //! Sets dimension length model units for computing of dimension presentation.
741 //! The method sets value owned by the drawer that will be used during
742 //! visualization instead of the one set in link.
743 Standard_EXPORT void SetDimLengthModelUnits (const TCollection_AsciiString& theUnits);
744
745 //! Sets dimension angle model units for computing of dimension presentation.
746 //! The method sets value owned by the drawer that will be used during
747 //! visualization instead of the one set in link.
748 Standard_EXPORT void SetDimAngleModelUnits (const TCollection_AsciiString& theUnits);
749
750 //! Returns length model units for the dimension presentation.
751 const TCollection_AsciiString& DimLengthModelUnits() const
752 {
753 return HasOwnDimLengthModelUnits() || myLink.IsNull()
754 ? myDimensionModelUnits.GetLengthUnits()
755 : myLink->DimLengthModelUnits();
756 }
757
758 //! Returns angle model units for the dimension presentation.
759 const TCollection_AsciiString& DimAngleModelUnits() const
760 {
761 return HasOwnDimAngleModelUnits() || myLink.IsNull()
762 ? myDimensionModelUnits.GetAngleUnits()
763 : myLink->DimAngleModelUnits();
764 }
765
766 //! Returns true if the drawer has its own attribute for
767 //! dimension length model units that overrides the one in the link.
768 Standard_Boolean HasOwnDimLengthModelUnits() const { return myHasOwnDimLengthModelUnits; }
769
770 //! Returns true if the drawer has its own attribute for
771 //! dimension angle model units that overrides the one in the link.
772 Standard_Boolean HasOwnDimAngleModelUnits() const { return myHasOwnDimAngleModelUnits; }
773
774 //! Sets length units in which value for dimension presentation is displayed.
775 //! The method sets value owned by the drawer that will be used during
776 //! visualization instead of the one set in link.
777 Standard_EXPORT void SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits);
778
779 //! Sets angle units in which value for dimension presentation is displayed.
780 //! The method sets value owned by the drawer that will be used during
781 //! visualization instead of the one set in link.
782 Standard_EXPORT void SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits);
783
784 //! Returns length units in which dimension presentation is displayed.
785 const TCollection_AsciiString& DimLengthDisplayUnits() const
786 {
787 return HasOwnDimLengthDisplayUnits() || myLink.IsNull()
788 ? myDimensionDisplayUnits.GetLengthUnits()
789 : myLink->DimLengthDisplayUnits();
790 }
791
792 //! Returns angle units in which dimension presentation is displayed.
793 const TCollection_AsciiString& DimAngleDisplayUnits() const
794 {
795 return HasOwnDimAngleDisplayUnits() || myLink.IsNull()
796 ? myDimensionDisplayUnits.GetAngleUnits()
797 : myLink->DimAngleDisplayUnits();
798 }
799
800 //! Returns true if the drawer has its own attribute for
801 //! length units in which dimension presentation is displayed
802 //! that overrides the one in the link.
803 Standard_Boolean HasOwnDimLengthDisplayUnits() const { return myHasOwnDimLengthDisplayUnits; }
804
805 //! Returns true if the drawer has its own attribute for
806 //! angle units in which dimension presentation is displayed
807 //! that overrides the one in the link.
808 Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; }
809
810 //! Returns the drawer to which the current object references.
811 const Handle(Prs3d_Drawer)& Link() { return myLink; }
812
813 //! Returns true if the current object has a link on the other drawer.
814 Standard_Boolean HasLink() const { return !myLink.IsNull(); }
815
816 //! Sets theDrawer as a link to which the current object references.
817 void Link (const Handle(Prs3d_Drawer)& theDrawer)
818 {
819 myLink = theDrawer;
820 }
821
822 //! Removes local attributes.
823 Standard_EXPORT void ClearLocalAttributes();
824
825protected:
826
827 Handle(Prs3d_Drawer) myLink;
828
829 Standard_Integer myNbPoints;
830 Standard_Boolean myHasOwnNbPoints;
831 Standard_Real myMaximalParameterValue;
832 Standard_Boolean myHasOwnMaximalParameterValue;
833 Quantity_Length myChordialDeviation;
834 Standard_Boolean myHasOwnChordialDeviation;
835 Aspect_TypeOfDeflection myTypeOfDeflection;
836 Standard_Boolean myHasOwnTypeOfDeflection;
837 Prs3d_TypeOfHLR myTypeOfHLR;
838 Standard_Real myDeviationCoefficient;
839 Standard_Real myPreviousDeviationCoefficient;
840 Standard_Boolean myHasOwnDeviationCoefficient;
841 Standard_Real myHLRDeviationCoefficient;
842 Standard_Boolean myHasOwnHLRDeviationCoefficient;
843 Standard_Real myPreviousHLRDeviationCoefficient;
844 Standard_Real myDeviationAngle;
845 Standard_Boolean myHasOwnDeviationAngle;
846 Standard_Real myPreviousDeviationAngle;
847 Standard_Real myHLRAngle;
848 Standard_Boolean myHasOwnHLRDeviationAngle;
849 Standard_Real myPreviousHLRDeviationAngle;
850 Standard_Boolean myIsoOnPlane;
851 Standard_Boolean myHasOwnIsoOnPlane;
4c513386 852 Standard_Boolean myIsAutoTriangulated;
853 Standard_Boolean myHasOwnIsAutoTriangulated;
6262338c 854
855 Handle(Prs3d_IsoAspect) myUIsoAspect;
856 Standard_Boolean myHasOwnUIsoAspect;
857 Handle(Prs3d_IsoAspect) myVIsoAspect;
858 Standard_Boolean myHasOwnVIsoAspect;
859 Handle(Prs3d_LineAspect) myWireAspect;
860 Standard_Boolean myHasOwnWireAspect;
861 Standard_Boolean myWireDraw;
862 Standard_Boolean myHasOwnWireDraw;
863 Handle(Prs3d_PointAspect) myPointAspect;
864 Standard_Boolean myHasOwnPointAspect;
865 Handle(Prs3d_LineAspect) myLineAspect;
866 Standard_Boolean myHasOwnLineAspect;
867 Handle(Prs3d_TextAspect) myTextAspect;
868 Standard_Boolean myHasOwnTextAspect;
869 Handle(Prs3d_ShadingAspect) myShadingAspect;
870 Standard_Boolean myHasOwnShadingAspect;
871 Standard_Boolean myShadingAspectGlobal;
872 Standard_Boolean myHasOwnShadingAspectGlobal;
873 Handle(Prs3d_PlaneAspect) myPlaneAspect;
874 Standard_Boolean myHasOwnPlaneAspect;
875 Handle(Prs3d_LineAspect) mySeenLineAspect;
876 Standard_Boolean myHasOwnSeenLineAspect;
877 Handle(Prs3d_ArrowAspect) myArrowAspect;
878 Standard_Boolean myHasOwnArrowAspect;
879 Standard_Boolean myLineArrowDraw;
880 Standard_Boolean myHasOwnLineArrowDraw;
881 Handle(Prs3d_LineAspect) myHiddenLineAspect;
882 Standard_Boolean myHasOwnHiddenLineAspect;
883 Standard_Boolean myDrawHiddenLine;
884 Standard_Boolean myHasOwnDrawHiddenLine;
885 Handle(Prs3d_LineAspect) myVectorAspect;
886 Standard_Boolean myHasOwnVectorAspect;
887 Prs3d_VertexDrawMode myVertexDrawMode;
888 Handle(Prs3d_DatumAspect) myDatumAspect;
889 Standard_Boolean myHasOwnDatumAspect;
890 Handle(Prs3d_LineAspect) mySectionAspect;
891 Standard_Boolean myHasOwnSectionAspect;
892
893 Handle(Prs3d_LineAspect) myFreeBoundaryAspect;
894 Standard_Boolean myHasOwnFreeBoundaryAspect;
895 Standard_Boolean myFreeBoundaryDraw;
896 Standard_Boolean myHasOwnFreeBoundaryDraw;
897 Handle(Prs3d_LineAspect) myUnFreeBoundaryAspect;
898 Standard_Boolean myHasOwnUnFreeBoundaryAspect;
899 Standard_Boolean myUnFreeBoundaryDraw;
900 Standard_Boolean myHasOwnUnFreeBoundaryDraw;
901 Handle(Prs3d_LineAspect) myFaceBoundaryAspect;
902 Standard_Boolean myHasOwnFaceBoundaryAspect;
903 Standard_Boolean myFaceBoundaryDraw;
904 Standard_Boolean myHasOwnFaceBoundaryDraw;
905
906 Handle(Prs3d_DimensionAspect) myDimensionAspect;
907 Standard_Boolean myHasOwnDimensionAspect;
908 Prs3d_DimensionUnits myDimensionModelUnits;
909 Standard_Boolean myHasOwnDimLengthModelUnits;
910 Standard_Boolean myHasOwnDimAngleModelUnits;
911 Prs3d_DimensionUnits myDimensionDisplayUnits;
912 Standard_Boolean myHasOwnDimLengthDisplayUnits;
913 Standard_Boolean myHasOwnDimAngleDisplayUnits;
914
915public:
916
ec357c5c 917 DEFINE_STANDARD_RTTI(Prs3d_Drawer, MMgt_TShared)
6262338c 918
919};
920
921#endif // _Prs3d_Drawer_HeaderFile