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