0027679: Wrong offset: overlapping edges
[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
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
28
60bf98ae 29// =======================================================================
30// function : Prs3d_Drawer
31// purpose :
32// =======================================================================
33Prs3d_Drawer::Prs3d_Drawer()
6262338c 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),
5ad8c033 53 myIsoOnTriangulation (Standard_False),
54 myHasOwnIsoOnTriangulation (Standard_False),
4c513386 55 myIsAutoTriangulated (Standard_True),
56 myHasOwnIsAutoTriangulated (Standard_False),
6262338c 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)
7fd59977 97{
60bf98ae 98 myDimensionModelUnits.SetLengthUnits ("m");
99 myDimensionModelUnits.SetAngleUnits ("rad");
100 myDimensionDisplayUnits.SetLengthUnits ("m");
101 myDimensionDisplayUnits.SetAngleUnits ("deg");
102}
7fd59977 103
6262338c 104// =======================================================================
105// function : SetTypeOfDeflection
106// purpose :
107// =======================================================================
7fd59977 108
6262338c 109void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection)
7fd59977 110{
6262338c 111 myHasOwnTypeOfDeflection = Standard_True;
112 myTypeOfDeflection = theTypeOfDeflection;
7fd59977 113}
114
6262338c 115// =======================================================================
116// function : SetMaximalChordialDeviation
117// purpose :
118// =======================================================================
119
120void Prs3d_Drawer::SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation)
7fd59977 121{
6262338c 122 myHasOwnChordialDeviation = Standard_True;
123 myChordialDeviation = theChordialDeviation;
7fd59977 124}
125
6262338c 126// =======================================================================
127// function : SetTypeOfHLR
128// purpose : set type of HLR algorithm
129// =======================================================================
7fd59977 130
6262338c 131void Prs3d_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
7fd59977 132{
6262338c 133 myTypeOfHLR = theTypeOfHLR;
7fd59977 134}
135
6262338c 136// =======================================================================
137// function : TypeOfHLR
138// purpose : gets type of HLR algorithm
139// =======================================================================
7fd59977 140
6262338c 141Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR()
7fd59977 142{
6262338c 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;
7fd59977 153}
154
6262338c 155// =======================================================================
5ad8c033 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// =======================================================================
6262338c 166// function : SetMaximalParameterValue
167// purpose :
168// =======================================================================
7fd59977 169
6262338c 170void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real theValue)
171{
172 myHasOwnMaximalParameterValue = Standard_True;
173 myMaximalParameterValue = theValue;
7fd59977 174}
175
6262338c 176// =======================================================================
177// function : SetIsoOnPlane
178// purpose :
179// =======================================================================
7fd59977 180
6262338c 181void Prs3d_Drawer::SetIsoOnPlane (const Standard_Boolean theIsEnabled)
182{
183 myHasOwnIsoOnPlane = Standard_True;
184 myIsoOnPlane = theIsEnabled;
185}
7fd59977 186
6262338c 187// =======================================================================
188// function : SetDiscretisation
189// purpose :
190// =======================================================================
7fd59977 191
6262338c 192void Prs3d_Drawer::SetDiscretisation (const Standard_Integer theValue)
193{
194 myHasOwnNbPoints = Standard_True;
195 myNbPoints = theValue;
7fd59977 196}
197
198//=======================================================================
6262338c 199//function : SetDeviationCoefficient
7fd59977 200//purpose :
201//=======================================================================
202
6262338c 203void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real theCoefficient)
204{
205 myPreviousDeviationCoefficient = DeviationCoefficient();
206 myDeviationCoefficient = theCoefficient;
207 myHasOwnDeviationCoefficient = Standard_True;
7fd59977 208}
209
210//=======================================================================
211//function : SetHLRDeviationCoefficient
212//purpose :
213//=======================================================================
214
6262338c 215void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real theCoefficient)
216{
217 myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient();
218 myHLRDeviationCoefficient = theCoefficient;
219 myHasOwnHLRDeviationCoefficient = Standard_True;
7fd59977 220}
221
222//=======================================================================
6262338c 223//function : SetDeviationAngle
7fd59977 224//purpose :
225//=======================================================================
226
6262338c 227void Prs3d_Drawer::SetDeviationAngle (const Standard_Real theAngle)
228{
229 myPreviousDeviationAngle = DeviationAngle();
230 myDeviationAngle = theAngle;
231 myHasOwnDeviationAngle = Standard_True;
7fd59977 232}
233
234//=======================================================================
235//function : SetHLRAngle
236//purpose :
237//=======================================================================
238
6262338c 239void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle)
240{
241 myPreviousHLRDeviationAngle = HLRAngle();
242 myHLRAngle = theAngle;
243 myHasOwnHLRDeviationAngle = Standard_True;
7fd59977 244}
245
6262338c 246// =======================================================================
4c513386 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// =======================================================================
6262338c 258// function : FreeBoundaryAspect
259// purpose :
260// =======================================================================
7fd59977 261
6262338c 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;
7fd59977 276}
277
6262338c 278// =======================================================================
279// function : FreeBoundaryAspect
280// purpose :
281// =======================================================================
7fd59977 282
6262338c 283void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
7fd59977 284{
6262338c 285 myFreeBoundaryAspect = theAspect;
286 myHasOwnFreeBoundaryAspect = !myFreeBoundaryAspect.IsNull();
7fd59977 287}
288
6262338c 289// =======================================================================
290// function : SetFreeBoundaryDraw
291// purpose :
292// =======================================================================
7fd59977 293
6262338c 294void Prs3d_Drawer::SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled)
7fd59977 295{
6262338c 296 myHasOwnFreeBoundaryDraw = Standard_True;
297 myFreeBoundaryDraw = theIsEnabled;
7fd59977 298}
299
6262338c 300// =======================================================================
301// function : UnFreeBoundaryAspect
302// purpose :
303// =======================================================================
7fd59977 304
6262338c 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;
7fd59977 319}
320
6262338c 321// =======================================================================
322// function : SetUnFreeBoundaryAspect
323// purpose :
324// =======================================================================
7fd59977 325
6262338c 326void Prs3d_Drawer::SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
327{
328 myUnFreeBoundaryAspect = theAspect;
329 myHasOwnUnFreeBoundaryAspect = !myUnFreeBoundaryAspect.IsNull();
7fd59977 330}
331
6262338c 332// =======================================================================
333// function : SetUnFreeBoundaryDraw
334// purpose :
335// =======================================================================
7fd59977 336
6262338c 337void Prs3d_Drawer::SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled)
338{
339 myHasOwnUnFreeBoundaryDraw = Standard_True;
340 myUnFreeBoundaryDraw = theIsEnabled;
7fd59977 341}
342
6262338c 343// =======================================================================
344// function : FaceBoundaryAspect
345// purpose :
346// =======================================================================
7fd59977 347
6262338c 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;
7fd59977 362}
363
6262338c 364// =======================================================================
365// function : SetFaceBoundaryAspect
366// purpose :
367// =======================================================================
7fd59977 368
6262338c 369void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
370{
371 myFaceBoundaryAspect = theAspect;
372 myHasOwnFaceBoundaryAspect = !myFaceBoundaryAspect.IsNull();
7fd59977 373}
374
6262338c 375// =======================================================================
376// function : SetFaceBoundaryDraw
377// purpose :
378// =======================================================================
7fd59977 379
6262338c 380void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled)
381{
382 myHasOwnFaceBoundaryDraw = Standard_True;
383 myFaceBoundaryDraw = theIsEnabled;
7fd59977 384}
385
6262338c 386// =======================================================================
387// function : DimensionAspect
388// purpose :
389// =======================================================================
7fd59977 390
6262338c 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;
7fd59977 405}
406
6262338c 407// =======================================================================
408// function : SetDimensionAspect
409// purpose :
410// =======================================================================
7fd59977 411
6262338c 412void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
413{
414 myDimensionAspect = theAspect;
415 myHasOwnDimensionAspect = !myDimensionAspect.IsNull();
7fd59977 416}
417
6262338c 418// =======================================================================
419// function : SetDimLengthModelUnits
420// purpose :
421// =======================================================================
7fd59977 422
6262338c 423void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits)
424{
425 myHasOwnDimLengthModelUnits = Standard_True;
426 myDimensionModelUnits.SetLengthUnits (theUnits);
7fd59977 427}
428
6262338c 429// =======================================================================
430// function : SetDimAngleModelUnits
431// purpose :
432// =======================================================================
7fd59977 433
6262338c 434void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits)
435{
436 myHasOwnDimAngleModelUnits = Standard_True;
437 myDimensionModelUnits.SetAngleUnits (theUnits);
7fd59977 438}
439
6262338c 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);
7fd59977 449}
450
6262338c 451// =======================================================================
452// function : SetDimAngleDisplayUnits
453// purpose :
454// =======================================================================
7fd59977 455
6262338c 456void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits)
457{
458 myHasOwnDimAngleDisplayUnits = Standard_True;
459 myDimensionDisplayUnits.SetAngleUnits (theUnits);
7fd59977 460}
461
6262338c 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 {
1b9f5d95 477 myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
6262338c 478 }
479 }
480 return myUIsoAspect;
7fd59977 481}
482
6262338c 483// =======================================================================
484// function : SetUIsoAspect
485// purpose :
486// =======================================================================
7fd59977 487
6262338c 488void Prs3d_Drawer::SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
489{
490 myUIsoAspect = theAspect;
491 myHasOwnUIsoAspect = !myUIsoAspect.IsNull();
7fd59977 492}
493
6262338c 494// =======================================================================
495// function : VIsoAspect
496// purpose :
497// =======================================================================
7fd59977 498
6262338c 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 {
1b9f5d95 509 myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
6262338c 510 }
511 }
512 return myVIsoAspect;
7fd59977 513}
514
6262338c 515// =======================================================================
516// function : SetVIsoAspect
517// purpose :
518// =======================================================================
7fd59977 519
6262338c 520void Prs3d_Drawer::SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
521{
522 myVIsoAspect = theAspect;
523 myHasOwnVIsoAspect= !myVIsoAspect.IsNull();
7fd59977 524}
7fd59977 525
6262338c 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;
7fd59977 545}
546
6262338c 547// =======================================================================
548// function : SetWireAspect
549// purpose :
550// =======================================================================
7fd59977 551
6262338c 552void Prs3d_Drawer::SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect)
553{
554 myWireAspect = theAspect;
555 myHasOwnWireAspect = !myWireAspect.IsNull();
7fd59977 556}
557
6262338c 558// =======================================================================
559// function : SetWireDraw
560// purpose :
561// =======================================================================
562
563void Prs3d_Drawer::SetWireDraw (const Standard_Boolean theIsEnabled)
564{
565 myHasOwnWireDraw = Standard_True;
566 myWireDraw = theIsEnabled;
7fd59977 567}
568
6262338c 569// =======================================================================
570// function : PointAspect
571// purpose :
572// =======================================================================
7fd59977 573
6262338c 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 }
7fd59977 587 return myPointAspect;
588}
589
6262338c 590// =======================================================================
591// function : SetPointAspect
592// purpose :
593// =======================================================================
7fd59977 594
6262338c 595void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
53b15292 596{
6262338c 597 myPointAspect = theAspect;
598 myHasOwnPointAspect = !myPointAspect.IsNull();
53b15292 599}
600
6262338c 601// =======================================================================
602// function : LineAspect
603// purpose :
604// =======================================================================
605
606const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect()
53b15292 607{
6262338c 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;
53b15292 620}
621
6262338c 622// =======================================================================
623// function : SetLineAspect
624// purpose :
625// =======================================================================
7fd59977 626
6262338c 627void Prs3d_Drawer::SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
628{
629 myLineAspect = theAspect;
630 myHasOwnLineAspect = !myLineAspect.IsNull();
7fd59977 631}
632
6262338c 633// =======================================================================
634// function : TextAspect
635// purpose :
636// =======================================================================
7fd59977 637
6262338c 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;
7fd59977 652}
653
6262338c 654// =======================================================================
655// function : SetTextAspect
656// purpose :
657// =======================================================================
7fd59977 658
6262338c 659void Prs3d_Drawer::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
660{
661 myTextAspect = theAspect;
662 myHasOwnTextAspect = !myTextAspect.IsNull();
7fd59977 663}
664
6262338c 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;
7fd59977 684}
685
6262338c 686// =======================================================================
687// function : SetShadingAspect
688// purpose :
689// =======================================================================
7fd59977 690
6262338c 691void Prs3d_Drawer::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect)
692{
693 myShadingAspect = theAspect;
694 myHasOwnShadingAspect = !myShadingAspect.IsNull();
7fd59977 695}
696
6262338c 697// =======================================================================
698// function : SetShadingAspectGlobal
699// purpose :
700// =======================================================================
701
702void Prs3d_Drawer::SetShadingAspectGlobal (const Standard_Boolean theValue)
703{
704 myHasOwnShadingAspectGlobal = Standard_True;
705 myShadingAspectGlobal = theValue;
7fd59977 706}
707
6262338c 708// =======================================================================
709// function : PlaneAspect
710// purpose :
711// =======================================================================
7fd59977 712
6262338c 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 }
7fd59977 726 return myPlaneAspect;
727}
728
6262338c 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();
7fd59977 738}
739
60bf98ae 740// =======================================================================
6262338c 741// function : SeenLineAspect
60bf98ae 742// purpose :
743// =======================================================================
6262338c 744
745const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect()
a6eb515f 746{
6262338c 747 if (!HasOwnSeenLineAspect())
60bf98ae 748 {
6262338c 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 }
60bf98ae 757 }
6262338c 758 return mySeenLineAspect;
7fd59977 759}
760
60bf98ae 761// =======================================================================
6262338c 762// function : SetSeenLineAspect
60bf98ae 763// purpose :
764// =======================================================================
6262338c 765
766void Prs3d_Drawer::SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
60bf98ae 767{
6262338c 768 mySeenLineAspect = theAspect;
769 myHasOwnSeenLineAspect = !mySeenLineAspect.IsNull();
60bf98ae 770}
771
772// =======================================================================
6262338c 773// function : ArrowAspect
60bf98ae 774// purpose :
775// =======================================================================
6262338c 776
777const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect()
60bf98ae 778{
6262338c 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;
60bf98ae 791}
792
793// =======================================================================
6262338c 794// function : SetArrowAspect
60bf98ae 795// purpose :
796// =======================================================================
6262338c 797
798void Prs3d_Drawer::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
60bf98ae 799{
6262338c 800 myArrowAspect = theAspect;
801 myHasOwnArrowAspect = !myArrowAspect.IsNull();
60bf98ae 802}
803
804// =======================================================================
6262338c 805// function : SetLineArrowDraw
60bf98ae 806// purpose :
807// =======================================================================
6262338c 808
809void Prs3d_Drawer::SetLineArrowDraw (const Standard_Boolean theIsEnabled)
60bf98ae 810{
6262338c 811 myHasOwnLineArrowDraw = Standard_True;
812 myLineArrowDraw = theIsEnabled;
60bf98ae 813}
814
815// =======================================================================
6262338c 816// function : HiddenLineAspect
60bf98ae 817// purpose :
818// =======================================================================
6262338c 819
820const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect()
60bf98ae 821{
6262338c 822 if (!HasOwnHiddenLineAspect())
823 {
824 if (!myLink.IsNull())
825 {
826 return myLink->HiddenLineAspect();
827 }
828 if (myHiddenLineAspect.IsNull())
829 {
1b9f5d95 830 myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 1.0);
6262338c 831 }
832 }
833 return myHiddenLineAspect;
60bf98ae 834}
835
836// =======================================================================
6262338c 837// function : SetHiddenLineAspect
60bf98ae 838// purpose :
839// =======================================================================
6262338c 840
841void Prs3d_Drawer::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
60bf98ae 842{
6262338c 843 myHiddenLineAspect = theAspect;
844 myHasOwnHiddenLineAspect = !myHiddenLineAspect.IsNull();
60bf98ae 845}
846
847// =======================================================================
6262338c 848// function : EnableDrawHiddenLineDraw
60bf98ae 849// purpose :
850// =======================================================================
6262338c 851
852void Prs3d_Drawer::EnableDrawHiddenLine()
60bf98ae 853{
6262338c 854 myHasOwnDrawHiddenLine = Standard_True;
855 myDrawHiddenLine = Standard_True;
60bf98ae 856}
857
858// =======================================================================
6262338c 859// function : DisableDrawHiddenLine
60bf98ae 860// purpose :
861// =======================================================================
6262338c 862
863void Prs3d_Drawer::DisableDrawHiddenLine()
a6eb515f 864{
6262338c 865 myHasOwnDrawHiddenLine = Standard_True;
866 myDrawHiddenLine = Standard_False;
7fd59977 867}
868
60bf98ae 869// =======================================================================
6262338c 870// function : VectorAspect
60bf98ae 871// purpose :
872// =======================================================================
6262338c 873
874const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect()
60bf98ae 875{
6262338c 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;
60bf98ae 888}
7fd59977 889
60bf98ae 890// =======================================================================
6262338c 891// function : SetVectorAspect
60bf98ae 892// purpose :
893// =======================================================================
7fd59977 894
6262338c 895void Prs3d_Drawer::SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect)
896{
897 myVectorAspect = theAspect;
898 myHasOwnVectorAspect = !myVectorAspect.IsNull();
7fd59977 899}
900
60bf98ae 901// =======================================================================
6262338c 902// function : SetVertexDrawMode
60bf98ae 903// purpose :
904// =======================================================================
6262338c 905
906void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode)
60bf98ae 907{
6262338c 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;
7fd59977 911}
a2d5ab2e 912
913// =======================================================================
6262338c 914// function : VertexDrawMode
a2d5ab2e 915// purpose :
916// =======================================================================
6262338c 917
918Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode()
a2d5ab2e 919{
6262338c 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;
a2d5ab2e 930}
931
932// =======================================================================
6262338c 933// function : DatumAspect
a2d5ab2e 934// purpose :
935// =======================================================================
6262338c 936
937const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect()
a2d5ab2e 938{
6262338c 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;
a2d5ab2e 951}
952
953// =======================================================================
6262338c 954// function : SetDatumAspect
a2d5ab2e 955// purpose :
956// =======================================================================
6262338c 957
958void Prs3d_Drawer::SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect)
a2d5ab2e 959{
6262338c 960 myDatumAspect = theAspect;
961 myHasOwnDatumAspect = !myDatumAspect.IsNull();
a2d5ab2e 962}
963
964// =======================================================================
6262338c 965// function : SectionAspect
a2d5ab2e 966// purpose :
967// =======================================================================
6262338c 968
969const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect()
a2d5ab2e 970{
6262338c 971 if (!HasOwnSectionAspect())
a2d5ab2e 972 {
6262338c 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 }
a2d5ab2e 981 }
6262338c 982 return mySectionAspect;
a2d5ab2e 983}
0a768f56 984
985// =======================================================================
6262338c 986// function : SetSectionAspect
987// purpose :
0a768f56 988// =======================================================================
6262338c 989
990void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
0a768f56 991{
6262338c 992 mySectionAspect = theAspect;
993 myHasOwnSectionAspect = !mySectionAspect.IsNull();
0a768f56 994}
995
996// =======================================================================
6262338c 997// function : SetSectionAspect
998// purpose :
0a768f56 999// =======================================================================
6262338c 1000
1001void Prs3d_Drawer::ClearLocalAttributes()
0a768f56 1002{
6262338c 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;
5ad8c033 1055 myHasOwnIsoOnTriangulation = Standard_False;
4c513386 1056 myHasOwnIsAutoTriangulated = Standard_False;
6262338c 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;
0a768f56 1071}