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