0024530: TKMesh - remove unused package IntPoly
[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//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15#include <Prs3d_Drawer.ixx>
16
60bf98ae 17// =======================================================================
18// function : Prs3d_Drawer
19// purpose :
20// =======================================================================
21Prs3d_Drawer::Prs3d_Drawer()
22: myNbPoints (30),
23 myIsoOnPlane (Standard_False),
24 myFreeBoundaryDraw (Standard_True),
25 myUnFreeBoundaryDraw (Standard_True),
26 myWireDraw (Standard_True),
27 myShadingAspect (new Prs3d_ShadingAspect()),
28 myShadingAspectGlobal (Standard_True),
29 myChordialDeviation (0.0001),
30 myTypeOfDeflection (Aspect_TOD_RELATIVE),
31 myMaximalParameterValue (500000.),
32 myDeviationCoefficient (0.001),
33 myHLRDeviationCoefficient (0.02),
34 myDeviationAngle (12.0 * M_PI / 180.0),
35 myHLRAngle (20.0 * M_PI / 180.0),
36 myLineDrawArrow (Standard_False),
37 myDrawHiddenLine (Standard_False),
38 myFaceBoundaryDraw (Standard_False),
39 myTypeOfHLR (Prs3d_TOH_PolyAlgo)
7fd59977 40{
60bf98ae 41 myDimensionModelUnits.SetLengthUnits ("m");
42 myDimensionModelUnits.SetAngleUnits ("rad");
43 myDimensionDisplayUnits.SetLengthUnits ("m");
44 myDimensionDisplayUnits.SetAngleUnits ("deg");
45}
7fd59977 46
47void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
48
49 myTypeOfDeflection = aTypeOfDeflection;}
50
51Aspect_TypeOfDeflection Prs3d_Drawer::TypeOfDeflection() const {
52
53 return myTypeOfDeflection;
54
55}
56
57
58void Prs3d_Drawer::SetIsoOnPlane(const Standard_Boolean OnOff)
59{
60 myIsoOnPlane = OnOff;
61}
62
63
64Standard_Boolean Prs3d_Drawer::IsoOnPlane()const
65{
66 return myIsoOnPlane;
67}
68
69
70Standard_Integer Prs3d_Drawer::Discretisation() const
71{
72 return myNbPoints;
73}
74
75
76void Prs3d_Drawer::SetDiscretisation(const Standard_Integer d)
77{
78 myNbPoints = d;
79}
80
81
82void Prs3d_Drawer::SetMaximalChordialDeviation(
83 const Quantity_Length aChordialDeviation) {
84 myChordialDeviation = aChordialDeviation;
85}
86
87Quantity_Length Prs3d_Drawer::MaximalChordialDeviation() const {
88 return myChordialDeviation;
89}
90
91//
92//=======================================================================
93//function : SetDeviationCoefficient
94//purpose :
95//=======================================================================
96
97void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real aCoefficient) {
98
99 myDeviationCoefficient = aCoefficient;
100}
101
102//=======================================================================
103//function : DeviationCoefficient
104//purpose :
105//=======================================================================
106
107Standard_Real Prs3d_Drawer::DeviationCoefficient () const {
108
109 return myDeviationCoefficient;
110}
111
112//=======================================================================
113//function : SetHLRDeviationCoefficient
114//purpose :
115//=======================================================================
116
117void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real aCoefficient) {
118
119 myHLRDeviationCoefficient = aCoefficient;
120}
121
122//=======================================================================
123//function : HLRDeviationCoefficient
124//purpose :
125//=======================================================================
126
127Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const {
128
129 return myHLRDeviationCoefficient;
130}
131
132//=======================================================================
133//function : SetHLRAngle
134//purpose :
135//=======================================================================
136
137void Prs3d_Drawer::SetHLRAngle (const Standard_Real anAngle) {
138
139 myHLRAngle = anAngle;
140}
141
142//=======================================================================
143//function : HLRAngle
144//purpose :
145//=======================================================================
146
147Standard_Real Prs3d_Drawer::HLRAngle () const {
148
149 return myHLRAngle;
150}
151
152//=======================================================================
153//function : SetDeviationAngle
154//purpose :
155//=======================================================================
156
157void Prs3d_Drawer::SetDeviationAngle (const Standard_Real anAngle)
158{
159 myDeviationAngle = anAngle;
160}
161
162//=======================================================================
163//function : DeviationAngle
164//purpose :
165//=======================================================================
166
167Standard_Real Prs3d_Drawer::DeviationAngle () const
168{
169 return myDeviationAngle;
170}
171
172
173void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real Value) {
174 myMaximalParameterValue = Value;
175}
176
177Standard_Real Prs3d_Drawer::MaximalParameterValue () const {
178 return myMaximalParameterValue;
179}
180
181Handle (Prs3d_IsoAspect) Prs3d_Drawer::UIsoAspect (){
182
183 if (myUIsoAspect.IsNull())
184 myUIsoAspect = new Prs3d_IsoAspect
185 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
186
187 return myUIsoAspect;
188}
189
190void Prs3d_Drawer::SetUIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
191 myUIsoAspect = anAspect;
192}
193
194Handle (Prs3d_IsoAspect) Prs3d_Drawer::VIsoAspect () {
195 if (myVIsoAspect.IsNull())
196 myVIsoAspect = new Prs3d_IsoAspect
197 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
198
199 return myVIsoAspect;
200}
201
202void Prs3d_Drawer::SetVIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
203 myVIsoAspect = anAspect;
204}
205
206Handle (Prs3d_LineAspect) Prs3d_Drawer::FreeBoundaryAspect () {
207 if (myFreeBoundaryAspect.IsNull())
208 myFreeBoundaryAspect = new Prs3d_LineAspect
209 (Quantity_NOC_GREEN,Aspect_TOL_SOLID,1.);
210
211 return myFreeBoundaryAspect;
212}
213
214void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& anAspect) {
215 myFreeBoundaryAspect = anAspect;
216}
217
218void Prs3d_Drawer::SetFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
219 myFreeBoundaryDraw = OnOff;
220}
221
222Standard_Boolean Prs3d_Drawer::FreeBoundaryDraw () const {
223return myFreeBoundaryDraw;
224}
225
226Handle (Prs3d_LineAspect) Prs3d_Drawer::UnFreeBoundaryAspect (){
227 if (myUnFreeBoundaryAspect.IsNull())
228 myUnFreeBoundaryAspect = new Prs3d_LineAspect
229 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
230 return myUnFreeBoundaryAspect;
231}
232
233void Prs3d_Drawer::SetUnFreeBoundaryAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
234 myUnFreeBoundaryAspect = anAspect;
235}
236
237void Prs3d_Drawer::SetUnFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
238 myUnFreeBoundaryDraw = OnOff;
239}
240
241Standard_Boolean Prs3d_Drawer::UnFreeBoundaryDraw () const {
242 return myUnFreeBoundaryDraw;
243}
244
245Handle (Prs3d_LineAspect) Prs3d_Drawer::WireAspect () {
246 if (myWireAspect.IsNull())
247 myWireAspect = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_SOLID,1.);
248
249 return myWireAspect;
250}
251
252void Prs3d_Drawer::SetWireAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
253 myWireAspect = anAspect;
254}
255void Prs3d_Drawer::SetWireDraw ( const Standard_Boolean OnOff ) {
256 myWireDraw = OnOff;
257}
258
259Standard_Boolean Prs3d_Drawer::WireDraw () const {
260return myWireDraw;
261}
262
263
264Handle (Prs3d_LineAspect) Prs3d_Drawer::LineAspect () {
265 if (myLineAspect.IsNull())
266 myLineAspect = new Prs3d_LineAspect
267 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
268 return myLineAspect;
269}
270
271void Prs3d_Drawer::SetLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
272 myLineAspect = anAspect;
273}
274
275Handle (Prs3d_TextAspect) Prs3d_Drawer::TextAspect () {
276 if (myTextAspect.IsNull())
277 myTextAspect = new Prs3d_TextAspect();
278
279 return myTextAspect;
280}
281
282void Prs3d_Drawer::SetTextAspect ( const Handle(Prs3d_TextAspect)& anAspect) {
283 myTextAspect = anAspect;
284}
285
286Handle (Prs3d_ShadingAspect) Prs3d_Drawer::ShadingAspect () {
287 if (myShadingAspect.IsNull())
288 myShadingAspect = new Prs3d_ShadingAspect();
289
290 return myShadingAspect;
291}
292
293void Prs3d_Drawer::SetShadingAspect ( const Handle(Prs3d_ShadingAspect)& anAspect) {
294 myShadingAspect = anAspect;
295}
296
297void Prs3d_Drawer::SetShadingAspectGlobal(const Standard_Boolean aValue) {
298 myShadingAspectGlobal = aValue;
299}
300
301Standard_Boolean Prs3d_Drawer::ShadingAspectGlobal() const {
302
303 return myShadingAspectGlobal;
304
305}
306
307void Prs3d_Drawer::SetLineArrowDraw ( const Standard_Boolean OnOff ) {
308 myLineDrawArrow = OnOff;
309}
310
311Standard_Boolean Prs3d_Drawer::LineArrowDraw () const {
312return myLineDrawArrow;
313}
314
315Handle (Prs3d_ArrowAspect) Prs3d_Drawer::ArrowAspect() {
316 if (myArrowAspect.IsNull())
317 myArrowAspect = new Prs3d_ArrowAspect;
318
319 return myArrowAspect;
320}
321
322void Prs3d_Drawer::SetArrowAspect ( const Handle(Prs3d_ArrowAspect)& anAspect) {
323 myArrowAspect = anAspect;
324}
325
326Handle (Prs3d_PointAspect) Prs3d_Drawer::PointAspect() {
327 if (myPointAspect.IsNull())
328 myPointAspect = new Prs3d_PointAspect
329 (Aspect_TOM_PLUS,Quantity_NOC_YELLOW,1.);
330
331 return myPointAspect;
332}
333
334void Prs3d_Drawer::SetPointAspect ( const Handle(Prs3d_PointAspect)& anAspect) {
335 myPointAspect = anAspect;
336}
337
338Standard_Boolean Prs3d_Drawer::DrawHiddenLine () const {return myDrawHiddenLine;}
339
340void Prs3d_Drawer::EnableDrawHiddenLine () {myDrawHiddenLine=Standard_True;}
341
342void Prs3d_Drawer::DisableDrawHiddenLine () {myDrawHiddenLine=Standard_False;}
343
344Handle (Prs3d_LineAspect) Prs3d_Drawer::HiddenLineAspect () {
345 if (myHiddenLineAspect.IsNull())
346 myHiddenLineAspect = new Prs3d_LineAspect
347 (Quantity_NOC_YELLOW,Aspect_TOL_DASH,0.5);
348
349 return myHiddenLineAspect;
350}
351
352void Prs3d_Drawer::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
353 myHiddenLineAspect = anAspect;
354}
355
356Handle (Prs3d_LineAspect) Prs3d_Drawer::SeenLineAspect () {
357 if (mySeenLineAspect.IsNull())
358 mySeenLineAspect = new Prs3d_LineAspect
359 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
360
361 return mySeenLineAspect;
362}
363
364void Prs3d_Drawer::SetSeenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
365 mySeenLineAspect = anAspect;
366}
367
368Handle (Prs3d_LineAspect) Prs3d_Drawer::VectorAspect () {
369 if (myVectorAspect.IsNull())
370 myVectorAspect = new Prs3d_LineAspect
371 (Quantity_NOC_SKYBLUE,Aspect_TOL_SOLID,1.);
372
373 return myVectorAspect;
374}
375
376void Prs3d_Drawer::SetVectorAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
377 myVectorAspect = anAspect;
378}
379
380Handle (Prs3d_DatumAspect) Prs3d_Drawer::DatumAspect () {
381 if (myDatumAspect.IsNull())
382 myDatumAspect = new Prs3d_DatumAspect;
383
384 return myDatumAspect;
385}
386
387void Prs3d_Drawer::SetDatumAspect ( const Handle(Prs3d_DatumAspect)& anAspect) {
388 myDatumAspect = anAspect;
389}
390
391Handle (Prs3d_PlaneAspect) Prs3d_Drawer::PlaneAspect () {
392 if (myPlaneAspect.IsNull())
393 myPlaneAspect = new Prs3d_PlaneAspect;
394
395 return myPlaneAspect;
396}
397
398void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
399 myPlaneAspect = anAspect;
400}
401
60bf98ae 402// =======================================================================
403// function : DimensionAspect
404// purpose :
405// =======================================================================
406Handle(Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect()
a6eb515f 407{
408 if (myDimensionAspect.IsNull())
60bf98ae 409 {
a6eb515f 410 myDimensionAspect = new Prs3d_DimensionAspect;
60bf98ae 411 }
7fd59977 412
a6eb515f 413 return myDimensionAspect;
7fd59977 414}
415
60bf98ae 416// =======================================================================
417// function : SetDimensionAspect
418// purpose :
419// =======================================================================
420void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
421{
422 myDimensionAspect = theAspect;
423}
424
425// =======================================================================
426// function : SetDimLengthModelUnits
427// purpose :
428// =======================================================================
429void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits)
430{
431 myDimensionModelUnits.SetLengthUnits (theUnits);
432}
433
434// =======================================================================
435// function : SetDimAngleModelUnits
436// purpose :
437// =======================================================================
438void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits)
439{
440 myDimensionModelUnits.SetAngleUnits (theUnits);
441}
442
443// =======================================================================
444// function : DimLengthModelUnits
445// purpose :
446// =======================================================================
447const TCollection_AsciiString& Prs3d_Drawer::DimLengthModelUnits() const
448{
449 return myDimensionModelUnits.GetLengthUnits();
450}
451
452// =======================================================================
453// function : DimAngleModelUnits
454// purpose :
455// =======================================================================
456const TCollection_AsciiString& Prs3d_Drawer::DimAngleModelUnits() const
457{
458 return myDimensionModelUnits.GetAngleUnits();
459}
460
461// =======================================================================
462// function : SetDimLengthDisplayUnits
463// purpose :
464// =======================================================================
465void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits)
466{
467 myDimensionDisplayUnits.SetLengthUnits (theUnits);
468}
469
470// =======================================================================
471// function : SetDimAngleDisplayUnits
472// purpose :
473// =======================================================================
474void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits)
475{
476 myDimensionDisplayUnits.SetAngleUnits (theUnits);
477}
478
479// =======================================================================
480// function : DimLengthDisplayUnits
481// purpose :
482// =======================================================================
483const TCollection_AsciiString& Prs3d_Drawer::DimLengthDisplayUnits() const
a6eb515f 484{
60bf98ae 485 return myDimensionDisplayUnits.GetLengthUnits();
7fd59977 486}
487
60bf98ae 488// =======================================================================
489// function : DimAngleDisplayUnits
490// purpose :
491// =======================================================================
492const TCollection_AsciiString& Prs3d_Drawer::DimAngleDisplayUnits() const
493{
494 return myDimensionDisplayUnits.GetAngleUnits();
495}
7fd59977 496
60bf98ae 497// =======================================================================
498// function : SectionAspect
499// purpose :
500// =======================================================================
501Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect()
502{
7fd59977 503 if (mySectionAspect.IsNull())
60bf98ae 504 {
505 mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0);
506 }
7fd59977 507
508 return mySectionAspect;
509}
510
60bf98ae 511// =======================================================================
512// function : SetSectionAspect
513// purpose :
514// =======================================================================
515void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
516{
517 mySectionAspect = theAspect;
7fd59977 518}
a2d5ab2e 519
520// =======================================================================
521// function : SetFaceBoundaryDraw
522// purpose :
523// =======================================================================
524void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled)
525{
526 myFaceBoundaryDraw = theIsEnabled;
527}
528
529// =======================================================================
530// function : IsFaceBoundaryDraw
531// purpose :
532// =======================================================================
533Standard_Boolean Prs3d_Drawer::IsFaceBoundaryDraw () const
534{
535 return myFaceBoundaryDraw;
536}
537
538// =======================================================================
539// function : SetFaceBoundaryAspect
540// purpose :
541// =======================================================================
542void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
543{
544 myFaceBoundaryAspect = theAspect;
545}
546
547// =======================================================================
548// function : FaceBoundaryAspect
549// purpose :
550// =======================================================================
551Handle_Prs3d_LineAspect Prs3d_Drawer::FaceBoundaryAspect ()
552{
553 if (myFaceBoundaryAspect.IsNull ())
554 {
555 myFaceBoundaryAspect =
556 new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0);
557 }
558
559 return myFaceBoundaryAspect;
560}
0a768f56 561
562// =======================================================================
563// function : SetTypeOfHLR
564// purpose : set type of HLR algorithm
565// =======================================================================
0a768f56 566void Prs3d_Drawer::SetTypeOfHLR ( const Prs3d_TypeOfHLR theTypeOfHLR)
567{
568 myTypeOfHLR = theTypeOfHLR;
569}
570
571// =======================================================================
572// function : TypeOfHLR
573// purpose : gets type of HLR algorithm
574// =======================================================================
0a768f56 575Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR ( ) const
576{
577 return myTypeOfHLR;
578}