0026411: Necessary to improve XCAF to store and querying GD&T data.
[occt.git] / src / Prs3d / Prs3d_Drawer.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
6262338c 15#include <Prs3d_Drawer.hxx>
16#include <Prs3d_ArrowAspect.hxx>
17#include <Prs3d_DatumAspect.hxx>
18#include <Prs3d_DimensionAspect.hxx>
19#include <Prs3d_IsoAspect.hxx>
20#include <Prs3d_LineAspect.hxx>
21#include <Prs3d_PlaneAspect.hxx>
22#include <Prs3d_PointAspect.hxx>
23#include <Prs3d_ShadingAspect.hxx>
24#include <Prs3d_TextAspect.hxx>
25
7fd59977 26
60bf98ae 27// =======================================================================
28// function : Prs3d_Drawer
29// purpose :
30// =======================================================================
31Prs3d_Drawer::Prs3d_Drawer()
6262338c 32: myNbPoints (30),
33 myHasOwnNbPoints (Standard_False),
34 myMaximalParameterValue (500000.),
35 myHasOwnMaximalParameterValue (Standard_False),
36 myChordialDeviation (0.0001),
37 myHasOwnChordialDeviation (Standard_False),
38 myTypeOfDeflection (Aspect_TOD_RELATIVE),
39 myHasOwnTypeOfDeflection (Standard_False),
40 myTypeOfHLR (Prs3d_TOH_NotSet),
41 myDeviationCoefficient (0.001),
42 myHasOwnDeviationCoefficient (Standard_False),
43 myHLRDeviationCoefficient (0.02),
44 myHasOwnHLRDeviationCoefficient (Standard_False),
45 myDeviationAngle (12.0 * M_PI / 180.0),
46 myHasOwnDeviationAngle (Standard_False),
47 myHLRAngle (20.0 * M_PI / 180.0),
48 myHasOwnHLRDeviationAngle (Standard_False),
49 myIsoOnPlane (Standard_False),
50 myHasOwnIsoOnPlane (Standard_False),
4c513386 51 myIsAutoTriangulated (Standard_True),
52 myHasOwnIsAutoTriangulated (Standard_False),
6262338c 53
54 myHasOwnUIsoAspect (Standard_False),
55 myHasOwnVIsoAspect (Standard_False),
56 myHasOwnWireAspect (Standard_False),
57 myWireDraw (Standard_True),
58 myHasOwnWireDraw (Standard_False),
59 myHasOwnPointAspect (Standard_False),
60 myHasOwnLineAspect (Standard_False),
61 myHasOwnTextAspect (Standard_False),
62 myHasOwnShadingAspect (Standard_False),
63 myShadingAspectGlobal (Standard_True),
64 myHasOwnShadingAspectGlobal (Standard_False),
65 myHasOwnPlaneAspect (Standard_False),
66 myHasOwnSeenLineAspect (Standard_False),
67 myHasOwnArrowAspect (Standard_False),
68 myLineArrowDraw (Standard_False),
69 myHasOwnLineArrowDraw (Standard_False),
70 myHasOwnHiddenLineAspect (Standard_False),
71 myDrawHiddenLine (Standard_False),
72 myHasOwnDrawHiddenLine (Standard_False),
73 myHasOwnVectorAspect (Standard_False),
74 myVertexDrawMode (Prs3d_VDM_Inherited),
75 myHasOwnDatumAspect (Standard_False),
76 myHasOwnSectionAspect (Standard_False),
77
78 myHasOwnFreeBoundaryAspect (Standard_False),
79 myFreeBoundaryDraw (Standard_True),
80 myHasOwnFreeBoundaryDraw (Standard_False),
81 myHasOwnUnFreeBoundaryAspect (Standard_False),
82 myUnFreeBoundaryDraw (Standard_True),
83 myHasOwnUnFreeBoundaryDraw (Standard_False),
84 myHasOwnFaceBoundaryAspect (Standard_False),
85 myFaceBoundaryDraw (Standard_False),
86 myHasOwnFaceBoundaryDraw (Standard_False),
87
88 myHasOwnDimensionAspect (Standard_False),
89 myHasOwnDimLengthModelUnits (Standard_False),
90 myHasOwnDimAngleModelUnits (Standard_False),
91 myHasOwnDimLengthDisplayUnits (Standard_False),
92 myHasOwnDimAngleDisplayUnits (Standard_False)
7fd59977 93{
60bf98ae 94 myDimensionModelUnits.SetLengthUnits ("m");
95 myDimensionModelUnits.SetAngleUnits ("rad");
96 myDimensionDisplayUnits.SetLengthUnits ("m");
97 myDimensionDisplayUnits.SetAngleUnits ("deg");
98}
7fd59977 99
6262338c 100// =======================================================================
101// function : SetTypeOfDeflection
102// purpose :
103// =======================================================================
7fd59977 104
6262338c 105void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection)
7fd59977 106{
6262338c 107 myHasOwnTypeOfDeflection = Standard_True;
108 myTypeOfDeflection = theTypeOfDeflection;
7fd59977 109}
110
6262338c 111// =======================================================================
112// function : SetMaximalChordialDeviation
113// purpose :
114// =======================================================================
115
116void Prs3d_Drawer::SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation)
7fd59977 117{
6262338c 118 myHasOwnChordialDeviation = Standard_True;
119 myChordialDeviation = theChordialDeviation;
7fd59977 120}
121
6262338c 122// =======================================================================
123// function : SetTypeOfHLR
124// purpose : set type of HLR algorithm
125// =======================================================================
7fd59977 126
6262338c 127void Prs3d_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
7fd59977 128{
6262338c 129 myTypeOfHLR = theTypeOfHLR;
7fd59977 130}
131
6262338c 132// =======================================================================
133// function : TypeOfHLR
134// purpose : gets type of HLR algorithm
135// =======================================================================
7fd59977 136
6262338c 137Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR()
7fd59977 138{
6262338c 139 if (!HasOwnTypeOfHLR())
140 {
141 if (!myLink.IsNull())
142 {
143 return myLink->TypeOfHLR();
144 }
145 // Prs3d_TOH_PolyAlgo is default value for this setting.
146 myTypeOfHLR = Prs3d_TOH_PolyAlgo;
147 }
148 return myTypeOfHLR;
7fd59977 149}
150
6262338c 151// =======================================================================
152// function : SetMaximalParameterValue
153// purpose :
154// =======================================================================
7fd59977 155
6262338c 156void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real theValue)
157{
158 myHasOwnMaximalParameterValue = Standard_True;
159 myMaximalParameterValue = theValue;
7fd59977 160}
161
6262338c 162// =======================================================================
163// function : SetIsoOnPlane
164// purpose :
165// =======================================================================
7fd59977 166
6262338c 167void Prs3d_Drawer::SetIsoOnPlane (const Standard_Boolean theIsEnabled)
168{
169 myHasOwnIsoOnPlane = Standard_True;
170 myIsoOnPlane = theIsEnabled;
171}
7fd59977 172
6262338c 173// =======================================================================
174// function : SetDiscretisation
175// purpose :
176// =======================================================================
7fd59977 177
6262338c 178void Prs3d_Drawer::SetDiscretisation (const Standard_Integer theValue)
179{
180 myHasOwnNbPoints = Standard_True;
181 myNbPoints = theValue;
7fd59977 182}
183
184//=======================================================================
6262338c 185//function : SetDeviationCoefficient
7fd59977 186//purpose :
187//=======================================================================
188
6262338c 189void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real theCoefficient)
190{
191 myPreviousDeviationCoefficient = DeviationCoefficient();
192 myDeviationCoefficient = theCoefficient;
193 myHasOwnDeviationCoefficient = Standard_True;
7fd59977 194}
195
196//=======================================================================
197//function : SetHLRDeviationCoefficient
198//purpose :
199//=======================================================================
200
6262338c 201void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real theCoefficient)
202{
203 myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient();
204 myHLRDeviationCoefficient = theCoefficient;
205 myHasOwnHLRDeviationCoefficient = Standard_True;
7fd59977 206}
207
208//=======================================================================
6262338c 209//function : SetDeviationAngle
7fd59977 210//purpose :
211//=======================================================================
212
6262338c 213void Prs3d_Drawer::SetDeviationAngle (const Standard_Real theAngle)
214{
215 myPreviousDeviationAngle = DeviationAngle();
216 myDeviationAngle = theAngle;
217 myHasOwnDeviationAngle = Standard_True;
7fd59977 218}
219
220//=======================================================================
221//function : SetHLRAngle
222//purpose :
223//=======================================================================
224
6262338c 225void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle)
226{
227 myPreviousHLRDeviationAngle = HLRAngle();
228 myHLRAngle = theAngle;
229 myHasOwnHLRDeviationAngle = Standard_True;
7fd59977 230}
231
6262338c 232// =======================================================================
4c513386 233// function : SetAutoTriangulation
234// purpose :
235// =======================================================================
236
237void Prs3d_Drawer::SetAutoTriangulation (const Standard_Boolean theIsEnabled)
238{
239 myHasOwnIsAutoTriangulated = Standard_True;
240 myIsAutoTriangulated = theIsEnabled;
241}
242
243// =======================================================================
6262338c 244// function : FreeBoundaryAspect
245// purpose :
246// =======================================================================
7fd59977 247
6262338c 248const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FreeBoundaryAspect()
249{
250 if (!HasOwnFreeBoundaryAspect())
251 {
252 if (!myLink.IsNull())
253 {
254 return myLink->FreeBoundaryAspect();
255 }
256 if (myFreeBoundaryAspect.IsNull())
257 {
258 myFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1.0);
259 }
260 }
261 return myFreeBoundaryAspect;
7fd59977 262}
263
6262338c 264// =======================================================================
265// function : FreeBoundaryAspect
266// purpose :
267// =======================================================================
7fd59977 268
6262338c 269void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
7fd59977 270{
6262338c 271 myFreeBoundaryAspect = theAspect;
272 myHasOwnFreeBoundaryAspect = !myFreeBoundaryAspect.IsNull();
7fd59977 273}
274
6262338c 275// =======================================================================
276// function : SetFreeBoundaryDraw
277// purpose :
278// =======================================================================
7fd59977 279
6262338c 280void Prs3d_Drawer::SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled)
7fd59977 281{
6262338c 282 myHasOwnFreeBoundaryDraw = Standard_True;
283 myFreeBoundaryDraw = theIsEnabled;
7fd59977 284}
285
6262338c 286// =======================================================================
287// function : UnFreeBoundaryAspect
288// purpose :
289// =======================================================================
7fd59977 290
6262338c 291const Handle(Prs3d_LineAspect)& Prs3d_Drawer::UnFreeBoundaryAspect()
292{
293 if (!HasOwnUnFreeBoundaryAspect())
294 {
295 if (!myLink.IsNull())
296 {
297 return myLink->UnFreeBoundaryAspect();
298 }
299 if (myUnFreeBoundaryAspect.IsNull())
300 {
301 myUnFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0);
302 }
303 }
304 return myUnFreeBoundaryAspect;
7fd59977 305}
306
6262338c 307// =======================================================================
308// function : SetUnFreeBoundaryAspect
309// purpose :
310// =======================================================================
7fd59977 311
6262338c 312void Prs3d_Drawer::SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
313{
314 myUnFreeBoundaryAspect = theAspect;
315 myHasOwnUnFreeBoundaryAspect = !myUnFreeBoundaryAspect.IsNull();
7fd59977 316}
317
6262338c 318// =======================================================================
319// function : SetUnFreeBoundaryDraw
320// purpose :
321// =======================================================================
7fd59977 322
6262338c 323void Prs3d_Drawer::SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled)
324{
325 myHasOwnUnFreeBoundaryDraw = Standard_True;
326 myUnFreeBoundaryDraw = theIsEnabled;
7fd59977 327}
328
6262338c 329// =======================================================================
330// function : FaceBoundaryAspect
331// purpose :
332// =======================================================================
7fd59977 333
6262338c 334const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FaceBoundaryAspect()
335{
336 if (!HasOwnFaceBoundaryAspect())
337 {
338 if (!myLink.IsNull())
339 {
340 return myLink->FaceBoundaryAspect();
341 }
342 if (myFaceBoundaryAspect.IsNull())
343 {
344 myFaceBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0);
345 }
346 }
347 return myFaceBoundaryAspect;
7fd59977 348}
349
6262338c 350// =======================================================================
351// function : SetFaceBoundaryAspect
352// purpose :
353// =======================================================================
7fd59977 354
6262338c 355void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
356{
357 myFaceBoundaryAspect = theAspect;
358 myHasOwnFaceBoundaryAspect = !myFaceBoundaryAspect.IsNull();
7fd59977 359}
360
6262338c 361// =======================================================================
362// function : SetFaceBoundaryDraw
363// purpose :
364// =======================================================================
7fd59977 365
6262338c 366void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled)
367{
368 myHasOwnFaceBoundaryDraw = Standard_True;
369 myFaceBoundaryDraw = theIsEnabled;
7fd59977 370}
371
6262338c 372// =======================================================================
373// function : DimensionAspect
374// purpose :
375// =======================================================================
7fd59977 376
6262338c 377const Handle(Prs3d_DimensionAspect)& Prs3d_Drawer::DimensionAspect()
378{
379 if (!HasOwnDimensionAspect())
380 {
381 if (!myLink.IsNull())
382 {
383 return myLink->DimensionAspect();
384 }
385 if (myDimensionAspect.IsNull())
386 {
387 myDimensionAspect = new Prs3d_DimensionAspect;
388 }
389 }
390 return myDimensionAspect;
7fd59977 391}
392
6262338c 393// =======================================================================
394// function : SetDimensionAspect
395// purpose :
396// =======================================================================
7fd59977 397
6262338c 398void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
399{
400 myDimensionAspect = theAspect;
401 myHasOwnDimensionAspect = !myDimensionAspect.IsNull();
7fd59977 402}
403
6262338c 404// =======================================================================
405// function : SetDimLengthModelUnits
406// purpose :
407// =======================================================================
7fd59977 408
6262338c 409void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits)
410{
411 myHasOwnDimLengthModelUnits = Standard_True;
412 myDimensionModelUnits.SetLengthUnits (theUnits);
7fd59977 413}
414
6262338c 415// =======================================================================
416// function : SetDimAngleModelUnits
417// purpose :
418// =======================================================================
7fd59977 419
6262338c 420void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits)
421{
422 myHasOwnDimAngleModelUnits = Standard_True;
423 myDimensionModelUnits.SetAngleUnits (theUnits);
7fd59977 424}
425
6262338c 426// =======================================================================
427// function : SetDimLengthDisplayUnits
428// purpose :
429// =======================================================================
430
431void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits)
432{
433 myHasOwnDimLengthDisplayUnits = Standard_True;
434 myDimensionDisplayUnits.SetLengthUnits (theUnits);
7fd59977 435}
436
6262338c 437// =======================================================================
438// function : SetDimAngleDisplayUnits
439// purpose :
440// =======================================================================
7fd59977 441
6262338c 442void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits)
443{
444 myHasOwnDimAngleDisplayUnits = Standard_True;
445 myDimensionDisplayUnits.SetAngleUnits (theUnits);
7fd59977 446}
447
6262338c 448// =======================================================================
449// function : UIsoAspect
450// purpose :
451// =======================================================================
452
453const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect()
454{
455 if (!HasOwnUIsoAspect())
456 {
457 if (!myLink.IsNull())
458 {
459 return myLink->UIsoAspect();
460 }
461 if (myUIsoAspect.IsNull())
462 {
463 myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1);
464 }
465 }
466 return myUIsoAspect;
7fd59977 467}
468
6262338c 469// =======================================================================
470// function : SetUIsoAspect
471// purpose :
472// =======================================================================
7fd59977 473
6262338c 474void Prs3d_Drawer::SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
475{
476 myUIsoAspect = theAspect;
477 myHasOwnUIsoAspect = !myUIsoAspect.IsNull();
7fd59977 478}
479
6262338c 480// =======================================================================
481// function : VIsoAspect
482// purpose :
483// =======================================================================
7fd59977 484
6262338c 485const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect()
486{
487 if (!HasOwnVIsoAspect())
488 {
489 if (!myLink.IsNull())
490 {
491 return myLink->VIsoAspect();
492 }
493 if (myVIsoAspect.IsNull())
494 {
495 myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1);
496 }
497 }
498 return myVIsoAspect;
7fd59977 499}
500
6262338c 501// =======================================================================
502// function : SetVIsoAspect
503// purpose :
504// =======================================================================
7fd59977 505
6262338c 506void Prs3d_Drawer::SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
507{
508 myVIsoAspect = theAspect;
509 myHasOwnVIsoAspect= !myVIsoAspect.IsNull();
7fd59977 510}
7fd59977 511
6262338c 512// =======================================================================
513// function : WireAspect
514// purpose :
515// =======================================================================
516
517const Handle(Prs3d_LineAspect)& Prs3d_Drawer::WireAspect()
518{
519 if (!HasOwnWireAspect())
520 {
521 if (!myLink.IsNull())
522 {
523 return myLink->WireAspect();
524 }
525 if (myWireAspect.IsNull())
526 {
527 myWireAspect = new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0);
528 }
529 }
530 return myWireAspect;
7fd59977 531}
532
6262338c 533// =======================================================================
534// function : SetWireAspect
535// purpose :
536// =======================================================================
7fd59977 537
6262338c 538void Prs3d_Drawer::SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect)
539{
540 myWireAspect = theAspect;
541 myHasOwnWireAspect = !myWireAspect.IsNull();
7fd59977 542}
543
6262338c 544// =======================================================================
545// function : SetWireDraw
546// purpose :
547// =======================================================================
548
549void Prs3d_Drawer::SetWireDraw (const Standard_Boolean theIsEnabled)
550{
551 myHasOwnWireDraw = Standard_True;
552 myWireDraw = theIsEnabled;
7fd59977 553}
554
6262338c 555// =======================================================================
556// function : PointAspect
557// purpose :
558// =======================================================================
7fd59977 559
6262338c 560const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect()
561{
562 if (!HasOwnPointAspect())
563 {
564 if (!myLink.IsNull())
565 {
566 return myLink->PointAspect();
567 }
568 if (myPointAspect.IsNull())
569 {
570 myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0);
571 }
572 }
7fd59977 573 return myPointAspect;
574}
575
6262338c 576// =======================================================================
577// function : SetPointAspect
578// purpose :
579// =======================================================================
7fd59977 580
6262338c 581void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
53b15292 582{
6262338c 583 myPointAspect = theAspect;
584 myHasOwnPointAspect = !myPointAspect.IsNull();
53b15292 585}
586
6262338c 587// =======================================================================
588// function : LineAspect
589// purpose :
590// =======================================================================
591
592const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect()
53b15292 593{
6262338c 594 if (!HasOwnLineAspect())
595 {
596 if (!myLink.IsNull())
597 {
598 return myLink->LineAspect();
599 }
600 if (myLineAspect.IsNull())
601 {
602 myLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0);
603 }
604 }
605 return myLineAspect;
53b15292 606}
607
6262338c 608// =======================================================================
609// function : SetLineAspect
610// purpose :
611// =======================================================================
7fd59977 612
6262338c 613void Prs3d_Drawer::SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
614{
615 myLineAspect = theAspect;
616 myHasOwnLineAspect = !myLineAspect.IsNull();
7fd59977 617}
618
6262338c 619// =======================================================================
620// function : TextAspect
621// purpose :
622// =======================================================================
7fd59977 623
6262338c 624const Handle(Prs3d_TextAspect)& Prs3d_Drawer::TextAspect()
625{
626 if (!HasOwnTextAspect())
627 {
628 if (!myLink.IsNull())
629 {
630 return myLink->TextAspect();
631 }
632 if (myTextAspect.IsNull())
633 {
634 myTextAspect = new Prs3d_TextAspect();
635 }
636 }
637 return myTextAspect;
7fd59977 638}
639
6262338c 640// =======================================================================
641// function : SetTextAspect
642// purpose :
643// =======================================================================
7fd59977 644
6262338c 645void Prs3d_Drawer::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
646{
647 myTextAspect = theAspect;
648 myHasOwnTextAspect = !myTextAspect.IsNull();
7fd59977 649}
650
6262338c 651// =======================================================================
652// function : ShadingAspect
653// purpose :
654// =======================================================================
655
656const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect()
657{
658 if (!HasOwnShadingAspect())
659 {
660 if (!myLink.IsNull())
661 {
662 return myLink->ShadingAspect();
663 }
664 if (myShadingAspect.IsNull())
665 {
666 myShadingAspect = new Prs3d_ShadingAspect();
667 }
668 }
669 return myShadingAspect;
7fd59977 670}
671
6262338c 672// =======================================================================
673// function : SetShadingAspect
674// purpose :
675// =======================================================================
7fd59977 676
6262338c 677void Prs3d_Drawer::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect)
678{
679 myShadingAspect = theAspect;
680 myHasOwnShadingAspect = !myShadingAspect.IsNull();
7fd59977 681}
682
6262338c 683// =======================================================================
684// function : SetShadingAspectGlobal
685// purpose :
686// =======================================================================
687
688void Prs3d_Drawer::SetShadingAspectGlobal (const Standard_Boolean theValue)
689{
690 myHasOwnShadingAspectGlobal = Standard_True;
691 myShadingAspectGlobal = theValue;
7fd59977 692}
693
6262338c 694// =======================================================================
695// function : PlaneAspect
696// purpose :
697// =======================================================================
7fd59977 698
6262338c 699const Handle(Prs3d_PlaneAspect)& Prs3d_Drawer::PlaneAspect()
700{
701 if (!HasOwnPlaneAspect())
702 {
703 if (!myLink.IsNull())
704 {
705 return myLink->PlaneAspect();
706 }
707 if (myPlaneAspect.IsNull())
708 {
709 myPlaneAspect = new Prs3d_PlaneAspect();
710 }
711 }
7fd59977 712 return myPlaneAspect;
713}
714
6262338c 715// =======================================================================
716// function : SetPlaneAspect
717// purpose :
718// =======================================================================
719
720void Prs3d_Drawer::SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect)
721{
722 myPlaneAspect = theAspect;
723 myHasOwnPlaneAspect = !myPlaneAspect.IsNull();
7fd59977 724}
725
60bf98ae 726// =======================================================================
6262338c 727// function : SeenLineAspect
60bf98ae 728// purpose :
729// =======================================================================
6262338c 730
731const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect()
a6eb515f 732{
6262338c 733 if (!HasOwnSeenLineAspect())
60bf98ae 734 {
6262338c 735 if (!myLink.IsNull())
736 {
737 return myLink->SeenLineAspect();
738 }
739 if (mySeenLineAspect.IsNull())
740 {
741 mySeenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0);
742 }
60bf98ae 743 }
6262338c 744 return mySeenLineAspect;
7fd59977 745}
746
60bf98ae 747// =======================================================================
6262338c 748// function : SetSeenLineAspect
60bf98ae 749// purpose :
750// =======================================================================
6262338c 751
752void Prs3d_Drawer::SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
60bf98ae 753{
6262338c 754 mySeenLineAspect = theAspect;
755 myHasOwnSeenLineAspect = !mySeenLineAspect.IsNull();
60bf98ae 756}
757
758// =======================================================================
6262338c 759// function : ArrowAspect
60bf98ae 760// purpose :
761// =======================================================================
6262338c 762
763const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect()
60bf98ae 764{
6262338c 765 if (!HasOwnArrowAspect())
766 {
767 if (!myLink.IsNull())
768 {
769 return myLink->ArrowAspect();
770 }
771 if (myArrowAspect.IsNull())
772 {
773 myArrowAspect = new Prs3d_ArrowAspect();
774 }
775 }
776 return myArrowAspect;
60bf98ae 777}
778
779// =======================================================================
6262338c 780// function : SetArrowAspect
60bf98ae 781// purpose :
782// =======================================================================
6262338c 783
784void Prs3d_Drawer::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
60bf98ae 785{
6262338c 786 myArrowAspect = theAspect;
787 myHasOwnArrowAspect = !myArrowAspect.IsNull();
60bf98ae 788}
789
790// =======================================================================
6262338c 791// function : SetLineArrowDraw
60bf98ae 792// purpose :
793// =======================================================================
6262338c 794
795void Prs3d_Drawer::SetLineArrowDraw (const Standard_Boolean theIsEnabled)
60bf98ae 796{
6262338c 797 myHasOwnLineArrowDraw = Standard_True;
798 myLineArrowDraw = theIsEnabled;
60bf98ae 799}
800
801// =======================================================================
6262338c 802// function : HiddenLineAspect
60bf98ae 803// purpose :
804// =======================================================================
6262338c 805
806const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect()
60bf98ae 807{
6262338c 808 if (!HasOwnHiddenLineAspect())
809 {
810 if (!myLink.IsNull())
811 {
812 return myLink->HiddenLineAspect();
813 }
814 if (myHiddenLineAspect.IsNull())
815 {
816 myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 0.5);
817 }
818 }
819 return myHiddenLineAspect;
60bf98ae 820}
821
822// =======================================================================
6262338c 823// function : SetHiddenLineAspect
60bf98ae 824// purpose :
825// =======================================================================
6262338c 826
827void Prs3d_Drawer::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
60bf98ae 828{
6262338c 829 myHiddenLineAspect = theAspect;
830 myHasOwnHiddenLineAspect = !myHiddenLineAspect.IsNull();
60bf98ae 831}
832
833// =======================================================================
6262338c 834// function : EnableDrawHiddenLineDraw
60bf98ae 835// purpose :
836// =======================================================================
6262338c 837
838void Prs3d_Drawer::EnableDrawHiddenLine()
60bf98ae 839{
6262338c 840 myHasOwnDrawHiddenLine = Standard_True;
841 myDrawHiddenLine = Standard_True;
60bf98ae 842}
843
844// =======================================================================
6262338c 845// function : DisableDrawHiddenLine
60bf98ae 846// purpose :
847// =======================================================================
6262338c 848
849void Prs3d_Drawer::DisableDrawHiddenLine()
a6eb515f 850{
6262338c 851 myHasOwnDrawHiddenLine = Standard_True;
852 myDrawHiddenLine = Standard_False;
7fd59977 853}
854
60bf98ae 855// =======================================================================
6262338c 856// function : VectorAspect
60bf98ae 857// purpose :
858// =======================================================================
6262338c 859
860const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect()
60bf98ae 861{
6262338c 862 if (!HasOwnVectorAspect())
863 {
864 if (!myLink.IsNull())
865 {
866 return myLink->VectorAspect();
867 }
868 if (myVectorAspect.IsNull())
869 {
870 myVectorAspect = new Prs3d_LineAspect (Quantity_NOC_SKYBLUE, Aspect_TOL_SOLID, 1.0);
871 }
872 }
873 return myVectorAspect;
60bf98ae 874}
7fd59977 875
60bf98ae 876// =======================================================================
6262338c 877// function : SetVectorAspect
60bf98ae 878// purpose :
879// =======================================================================
7fd59977 880
6262338c 881void Prs3d_Drawer::SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect)
882{
883 myVectorAspect = theAspect;
884 myHasOwnVectorAspect = !myVectorAspect.IsNull();
7fd59977 885}
886
60bf98ae 887// =======================================================================
6262338c 888// function : SetVertexDrawMode
60bf98ae 889// purpose :
890// =======================================================================
6262338c 891
892void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode)
60bf98ae 893{
6262338c 894 // Prs3d_VDM_Inherited is default value and means
895 // that correct value should be taken from the Link if it exists.
896 myVertexDrawMode = theMode;
7fd59977 897}
a2d5ab2e 898
899// =======================================================================
6262338c 900// function : VertexDrawMode
a2d5ab2e 901// purpose :
902// =======================================================================
6262338c 903
904Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode()
a2d5ab2e 905{
6262338c 906 if (!HasOwnVertexDrawMode())
907 {
908 if (!myLink.IsNull())
909 {
910 return myLink->VertexDrawMode();
911 }
912 // Prs3d_VDM_Isolated is default value for this setting.
913 myVertexDrawMode = Prs3d_VDM_Isolated;
914 }
915 return myVertexDrawMode;
a2d5ab2e 916}
917
918// =======================================================================
6262338c 919// function : DatumAspect
a2d5ab2e 920// purpose :
921// =======================================================================
6262338c 922
923const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect()
a2d5ab2e 924{
6262338c 925 if (!HasOwnDatumAspect())
926 {
927 if (!myLink.IsNull())
928 {
929 return myLink->DatumAspect();
930 }
931 if (myDatumAspect.IsNull())
932 {
933 myDatumAspect = new Prs3d_DatumAspect();
934 }
935 }
936 return myDatumAspect;
a2d5ab2e 937}
938
939// =======================================================================
6262338c 940// function : SetDatumAspect
a2d5ab2e 941// purpose :
942// =======================================================================
6262338c 943
944void Prs3d_Drawer::SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect)
a2d5ab2e 945{
6262338c 946 myDatumAspect = theAspect;
947 myHasOwnDatumAspect = !myDatumAspect.IsNull();
a2d5ab2e 948}
949
950// =======================================================================
6262338c 951// function : SectionAspect
a2d5ab2e 952// purpose :
953// =======================================================================
6262338c 954
955const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect()
a2d5ab2e 956{
6262338c 957 if (!HasOwnSectionAspect())
a2d5ab2e 958 {
6262338c 959 if (!myLink.IsNull())
960 {
961 return myLink->SectionAspect();
962 }
963 if (mySectionAspect.IsNull())
964 {
965 mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0);
966 }
a2d5ab2e 967 }
6262338c 968 return mySectionAspect;
a2d5ab2e 969}
0a768f56 970
971// =======================================================================
6262338c 972// function : SetSectionAspect
973// purpose :
0a768f56 974// =======================================================================
6262338c 975
976void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
0a768f56 977{
6262338c 978 mySectionAspect = theAspect;
979 myHasOwnSectionAspect = !mySectionAspect.IsNull();
0a768f56 980}
981
982// =======================================================================
6262338c 983// function : SetSectionAspect
984// purpose :
0a768f56 985// =======================================================================
6262338c 986
987void Prs3d_Drawer::ClearLocalAttributes()
0a768f56 988{
6262338c 989 if (myLink.IsNull())
990 {
991 return;
992 }
993
994 myUIsoAspect.Nullify();
995 myVIsoAspect.Nullify();
996 myFreeBoundaryAspect.Nullify();
997 myUnFreeBoundaryAspect.Nullify();
998 myFaceBoundaryAspect.Nullify();
999 myWireAspect.Nullify();
1000 myLineAspect.Nullify();
1001 myTextAspect.Nullify();
1002 myShadingAspect.Nullify();
1003 myPointAspect.Nullify();
1004 myPlaneAspect.Nullify();
1005 myArrowAspect.Nullify();
1006 myHiddenLineAspect.Nullify();
1007 mySeenLineAspect.Nullify();
1008 myVectorAspect .Nullify();
1009 myDatumAspect.Nullify();
1010 myDimensionAspect.Nullify();
1011 mySectionAspect.Nullify();
1012
1013 myHasOwnUIsoAspect = Standard_False;
1014 myHasOwnVIsoAspect = Standard_False;
1015 myHasOwnWireAspect = Standard_False;
1016 myHasOwnPointAspect = Standard_False;
1017 myHasOwnLineAspect = Standard_False;
1018 myHasOwnTextAspect = Standard_False;
1019 myHasOwnShadingAspect = Standard_False;
1020 myHasOwnPlaneAspect = Standard_False;
1021 myHasOwnSeenLineAspect = Standard_False;
1022 myHasOwnArrowAspect = Standard_False;
1023 myHasOwnHiddenLineAspect = Standard_False;
1024 myHasOwnVectorAspect = Standard_False;
1025 myHasOwnDatumAspect = Standard_False;
1026 myHasOwnSectionAspect = Standard_False;
1027 myHasOwnFreeBoundaryAspect = Standard_False;
1028 myHasOwnUnFreeBoundaryAspect = Standard_False;
1029 myHasOwnFaceBoundaryAspect = Standard_False;
1030 myHasOwnDimensionAspect = Standard_False;
1031
1032 myHasOwnNbPoints = Standard_False;
1033 myHasOwnMaximalParameterValue = Standard_False;
1034 myHasOwnTypeOfDeflection = Standard_False;
1035 myHasOwnChordialDeviation = Standard_False;
1036 myHasOwnDeviationCoefficient = Standard_False;
1037 myHasOwnHLRDeviationCoefficient = Standard_False;
1038 myHasOwnDeviationAngle = Standard_False;
1039 myHasOwnHLRDeviationAngle = Standard_False;
1040 myHasOwnIsoOnPlane = Standard_False;
4c513386 1041 myHasOwnIsAutoTriangulated = Standard_False;
6262338c 1042 myHasOwnWireDraw = Standard_False;
1043 myHasOwnShadingAspectGlobal = Standard_False;
1044 myHasOwnLineArrowDraw = Standard_False;
1045 myHasOwnDrawHiddenLine = Standard_False;
1046 myHasOwnFreeBoundaryDraw = Standard_False;
1047 myHasOwnUnFreeBoundaryDraw = Standard_False;
1048 myHasOwnFaceBoundaryDraw = Standard_False;
1049 myHasOwnDimLengthModelUnits = Standard_False;
1050 myHasOwnDimLengthDisplayUnits = Standard_False;
1051 myHasOwnDimAngleModelUnits = Standard_False;
1052 myHasOwnDimAngleDisplayUnits = Standard_False;
1053
1054 myVertexDrawMode = Prs3d_VDM_Inherited;
1055 myTypeOfHLR = Prs3d_TOH_NotSet;
0a768f56 1056}