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