0022807: Loading of STEP entities in model during reading of STEP file requires redun...
[occt.git] / src / Prs3d / Prs3d_Drawer.cxx
CommitLineData
7fd59977 1#define BUC60488 //GG_10/10/99 Set correctly all fields
2
3#include <Prs3d_Drawer.ixx>
4
5Prs3d_Drawer::Prs3d_Drawer(): myNbPoints(30),myIsoOnPlane(Standard_False),
6 myFreeBoundaryDraw(Standard_True),
7 myUnFreeBoundaryDraw(Standard_True),
8 myWireDraw(Standard_True),
9#ifdef BUC60488
10 myShadingAspect( new Prs3d_ShadingAspect()),
11#endif
12 myShadingAspectGlobal(Standard_True),
13 myChordialDeviation(0.0001),
14 myTypeOfDeflection(Aspect_TOD_RELATIVE),
15 myMaximalParameterValue(500000.),
16 myDeviationCoefficient(0.001),
17 myHLRDeviationCoefficient(0.02),
18 myDeviationAngle(12*PI/180),
19 myHLRAngle(20*PI/180),
20 myLineDrawArrow(Standard_False),
21 myDrawHiddenLine(Standard_False)
22{
23}
24
25void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
26
27 myTypeOfDeflection = aTypeOfDeflection;}
28
29Aspect_TypeOfDeflection Prs3d_Drawer::TypeOfDeflection() const {
30
31 return myTypeOfDeflection;
32
33}
34
35
36void Prs3d_Drawer::SetIsoOnPlane(const Standard_Boolean OnOff)
37{
38 myIsoOnPlane = OnOff;
39}
40
41
42Standard_Boolean Prs3d_Drawer::IsoOnPlane()const
43{
44 return myIsoOnPlane;
45}
46
47
48Standard_Integer Prs3d_Drawer::Discretisation() const
49{
50 return myNbPoints;
51}
52
53
54void Prs3d_Drawer::SetDiscretisation(const Standard_Integer d)
55{
56 myNbPoints = d;
57}
58
59
60void Prs3d_Drawer::SetMaximalChordialDeviation(
61 const Quantity_Length aChordialDeviation) {
62 myChordialDeviation = aChordialDeviation;
63}
64
65Quantity_Length Prs3d_Drawer::MaximalChordialDeviation() const {
66 return myChordialDeviation;
67}
68
69//
70//=======================================================================
71//function : SetDeviationCoefficient
72//purpose :
73//=======================================================================
74
75void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real aCoefficient) {
76
77 myDeviationCoefficient = aCoefficient;
78}
79
80//=======================================================================
81//function : DeviationCoefficient
82//purpose :
83//=======================================================================
84
85Standard_Real Prs3d_Drawer::DeviationCoefficient () const {
86
87 return myDeviationCoefficient;
88}
89
90//=======================================================================
91//function : SetHLRDeviationCoefficient
92//purpose :
93//=======================================================================
94
95void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real aCoefficient) {
96
97 myHLRDeviationCoefficient = aCoefficient;
98}
99
100//=======================================================================
101//function : HLRDeviationCoefficient
102//purpose :
103//=======================================================================
104
105Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const {
106
107 return myHLRDeviationCoefficient;
108}
109
110//=======================================================================
111//function : SetHLRAngle
112//purpose :
113//=======================================================================
114
115void Prs3d_Drawer::SetHLRAngle (const Standard_Real anAngle) {
116
117 myHLRAngle = anAngle;
118}
119
120//=======================================================================
121//function : HLRAngle
122//purpose :
123//=======================================================================
124
125Standard_Real Prs3d_Drawer::HLRAngle () const {
126
127 return myHLRAngle;
128}
129
130//=======================================================================
131//function : SetDeviationAngle
132//purpose :
133//=======================================================================
134
135void Prs3d_Drawer::SetDeviationAngle (const Standard_Real anAngle)
136{
137 myDeviationAngle = anAngle;
138}
139
140//=======================================================================
141//function : DeviationAngle
142//purpose :
143//=======================================================================
144
145Standard_Real Prs3d_Drawer::DeviationAngle () const
146{
147 return myDeviationAngle;
148}
149
150
151void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real Value) {
152 myMaximalParameterValue = Value;
153}
154
155Standard_Real Prs3d_Drawer::MaximalParameterValue () const {
156 return myMaximalParameterValue;
157}
158
159Handle (Prs3d_IsoAspect) Prs3d_Drawer::UIsoAspect (){
160
161 if (myUIsoAspect.IsNull())
162 myUIsoAspect = new Prs3d_IsoAspect
163 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
164
165 return myUIsoAspect;
166}
167
168void Prs3d_Drawer::SetUIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
169 myUIsoAspect = anAspect;
170}
171
172Handle (Prs3d_IsoAspect) Prs3d_Drawer::VIsoAspect () {
173 if (myVIsoAspect.IsNull())
174 myVIsoAspect = new Prs3d_IsoAspect
175 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
176
177 return myVIsoAspect;
178}
179
180void Prs3d_Drawer::SetVIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
181 myVIsoAspect = anAspect;
182}
183
184Handle (Prs3d_LineAspect) Prs3d_Drawer::FreeBoundaryAspect () {
185 if (myFreeBoundaryAspect.IsNull())
186 myFreeBoundaryAspect = new Prs3d_LineAspect
187 (Quantity_NOC_GREEN,Aspect_TOL_SOLID,1.);
188
189 return myFreeBoundaryAspect;
190}
191
192void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& anAspect) {
193 myFreeBoundaryAspect = anAspect;
194}
195
196void Prs3d_Drawer::SetFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
197 myFreeBoundaryDraw = OnOff;
198}
199
200Standard_Boolean Prs3d_Drawer::FreeBoundaryDraw () const {
201return myFreeBoundaryDraw;
202}
203
204Handle (Prs3d_LineAspect) Prs3d_Drawer::UnFreeBoundaryAspect (){
205 if (myUnFreeBoundaryAspect.IsNull())
206 myUnFreeBoundaryAspect = new Prs3d_LineAspect
207 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
208 return myUnFreeBoundaryAspect;
209}
210
211void Prs3d_Drawer::SetUnFreeBoundaryAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
212 myUnFreeBoundaryAspect = anAspect;
213}
214
215void Prs3d_Drawer::SetUnFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
216 myUnFreeBoundaryDraw = OnOff;
217}
218
219Standard_Boolean Prs3d_Drawer::UnFreeBoundaryDraw () const {
220 return myUnFreeBoundaryDraw;
221}
222
223Handle (Prs3d_LineAspect) Prs3d_Drawer::WireAspect () {
224 if (myWireAspect.IsNull())
225 myWireAspect = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_SOLID,1.);
226
227 return myWireAspect;
228}
229
230void Prs3d_Drawer::SetWireAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
231 myWireAspect = anAspect;
232}
233void Prs3d_Drawer::SetWireDraw ( const Standard_Boolean OnOff ) {
234 myWireDraw = OnOff;
235}
236
237Standard_Boolean Prs3d_Drawer::WireDraw () const {
238return myWireDraw;
239}
240
241
242Handle (Prs3d_LineAspect) Prs3d_Drawer::LineAspect () {
243 if (myLineAspect.IsNull())
244 myLineAspect = new Prs3d_LineAspect
245 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
246 return myLineAspect;
247}
248
249void Prs3d_Drawer::SetLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
250 myLineAspect = anAspect;
251}
252
253Handle (Prs3d_TextAspect) Prs3d_Drawer::TextAspect () {
254 if (myTextAspect.IsNull())
255 myTextAspect = new Prs3d_TextAspect();
256
257 return myTextAspect;
258}
259
260void Prs3d_Drawer::SetTextAspect ( const Handle(Prs3d_TextAspect)& anAspect) {
261 myTextAspect = anAspect;
262}
263
264Handle (Prs3d_ShadingAspect) Prs3d_Drawer::ShadingAspect () {
265 if (myShadingAspect.IsNull())
266 myShadingAspect = new Prs3d_ShadingAspect();
267
268 return myShadingAspect;
269}
270
271void Prs3d_Drawer::SetShadingAspect ( const Handle(Prs3d_ShadingAspect)& anAspect) {
272 myShadingAspect = anAspect;
273}
274
275void Prs3d_Drawer::SetShadingAspectGlobal(const Standard_Boolean aValue) {
276 myShadingAspectGlobal = aValue;
277}
278
279Standard_Boolean Prs3d_Drawer::ShadingAspectGlobal() const {
280
281 return myShadingAspectGlobal;
282
283}
284
285void Prs3d_Drawer::SetLineArrowDraw ( const Standard_Boolean OnOff ) {
286 myLineDrawArrow = OnOff;
287}
288
289Standard_Boolean Prs3d_Drawer::LineArrowDraw () const {
290return myLineDrawArrow;
291}
292
293Handle (Prs3d_ArrowAspect) Prs3d_Drawer::ArrowAspect() {
294 if (myArrowAspect.IsNull())
295 myArrowAspect = new Prs3d_ArrowAspect;
296
297 return myArrowAspect;
298}
299
300void Prs3d_Drawer::SetArrowAspect ( const Handle(Prs3d_ArrowAspect)& anAspect) {
301 myArrowAspect = anAspect;
302}
303
304Handle (Prs3d_PointAspect) Prs3d_Drawer::PointAspect() {
305 if (myPointAspect.IsNull())
306 myPointAspect = new Prs3d_PointAspect
307 (Aspect_TOM_PLUS,Quantity_NOC_YELLOW,1.);
308
309 return myPointAspect;
310}
311
312void Prs3d_Drawer::SetPointAspect ( const Handle(Prs3d_PointAspect)& anAspect) {
313 myPointAspect = anAspect;
314}
315
316Standard_Boolean Prs3d_Drawer::DrawHiddenLine () const {return myDrawHiddenLine;}
317
318void Prs3d_Drawer::EnableDrawHiddenLine () {myDrawHiddenLine=Standard_True;}
319
320void Prs3d_Drawer::DisableDrawHiddenLine () {myDrawHiddenLine=Standard_False;}
321
322Handle (Prs3d_LineAspect) Prs3d_Drawer::HiddenLineAspect () {
323 if (myHiddenLineAspect.IsNull())
324 myHiddenLineAspect = new Prs3d_LineAspect
325 (Quantity_NOC_YELLOW,Aspect_TOL_DASH,0.5);
326
327 return myHiddenLineAspect;
328}
329
330void Prs3d_Drawer::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
331 myHiddenLineAspect = anAspect;
332}
333
334Handle (Prs3d_LineAspect) Prs3d_Drawer::SeenLineAspect () {
335 if (mySeenLineAspect.IsNull())
336 mySeenLineAspect = new Prs3d_LineAspect
337 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
338
339 return mySeenLineAspect;
340}
341
342void Prs3d_Drawer::SetSeenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
343 mySeenLineAspect = anAspect;
344}
345
346Handle (Prs3d_LineAspect) Prs3d_Drawer::VectorAspect () {
347 if (myVectorAspect.IsNull())
348 myVectorAspect = new Prs3d_LineAspect
349 (Quantity_NOC_SKYBLUE,Aspect_TOL_SOLID,1.);
350
351 return myVectorAspect;
352}
353
354void Prs3d_Drawer::SetVectorAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
355 myVectorAspect = anAspect;
356}
357
358Handle (Prs3d_DatumAspect) Prs3d_Drawer::DatumAspect () {
359 if (myDatumAspect.IsNull())
360 myDatumAspect = new Prs3d_DatumAspect;
361
362 return myDatumAspect;
363}
364
365void Prs3d_Drawer::SetDatumAspect ( const Handle(Prs3d_DatumAspect)& anAspect) {
366 myDatumAspect = anAspect;
367}
368
369Handle (Prs3d_PlaneAspect) Prs3d_Drawer::PlaneAspect () {
370 if (myPlaneAspect.IsNull())
371 myPlaneAspect = new Prs3d_PlaneAspect;
372
373 return myPlaneAspect;
374}
375
376void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
377 myPlaneAspect = anAspect;
378}
379
380Handle (Prs3d_LengthAspect) Prs3d_Drawer::LengthAspect () {
381 if (myLengthAspect.IsNull())
382 myLengthAspect = new Prs3d_LengthAspect;
383
384 return myLengthAspect;
385}
386
387void Prs3d_Drawer::SetLengthAspect ( const Handle(Prs3d_LengthAspect)& anAspect) {
388 myLengthAspect = anAspect;
389}
390
391
392
393Handle (Prs3d_AngleAspect) Prs3d_Drawer::AngleAspect () {
394 if (myAngleAspect.IsNull())
395 myAngleAspect = new Prs3d_AngleAspect;
396
397 return myAngleAspect;
398}
399
400void Prs3d_Drawer::SetAngleAspect ( const Handle(Prs3d_AngleAspect)& anAspect) {
401 myAngleAspect = anAspect;
402}
403
404Handle (Prs3d_RadiusAspect) Prs3d_Drawer::RadiusAspect () const {
405 return myRadiusAspect;
406}
407
408void Prs3d_Drawer::SetRadiusAspect ( const Handle(Prs3d_RadiusAspect)& anAspect) {
409 myRadiusAspect = anAspect;
410}
411
412Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
413 if (mySectionAspect.IsNull())
414 mySectionAspect = new Prs3d_LineAspect
415 (Quantity_NOC_ORANGE,Aspect_TOL_SOLID,1.);
416
417 return mySectionAspect;
418}
419
420void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
421 mySectionAspect = anAspect;
422}
423
424
425void Prs3d_Drawer::Print (Standard_OStream& s) const {
426
427 s << "Drawer: " << endl;
428 s << "UIsoAspect: " ;
429 myUIsoAspect->Print(s);
430 s << endl;
431
432 s << "VIsoAspect: " ;
433 myVIsoAspect->Print(s);
434 s << endl;
435
436 s << "LineAspect: " ;
437 myLineAspect->Print(s);
438 s << endl;
439
440 if (myDrawHiddenLine)
441 s << "draws hidden lines" << endl;
442 else
443 s << "does not draw hidden lines" << endl;
444
445 s << "HiddenLineAspect: ";
446 myHiddenLineAspect->Print(s);
447 s << endl ;
448
449 s << "SeenLineAspect: ";
450 mySeenLineAspect->Print(s);
451 s << endl;
452
453 s << "WireAspect: ";
454 myWireAspect->Print(s);
455 s << endl;
456
457 s << "FreeBoundaryAspect: ";
458 myFreeBoundaryAspect->Print(s);
459 s << endl;
460
461 s << "UnFreeBoundaryAspect: ";
462 myUnFreeBoundaryAspect->Print(s);
463 s << endl;
464
465
466 s << "SectionAspect: ";
467 mySectionAspect->Print(s);
468 s << endl;
469
470 s << "DatumAspect: ";
471
472 myDatumAspect->Print(s);
473 s << endl;
474
475 s << "VectorAspect: ";
476 myVectorAspect->Print(s);
477 s << endl;
478
479
480 s << "PointAspect: ";
481 myPointAspect->Print(s);
482 s << endl;
483
484 s << "TextAspect: ";
485 myTextAspect->Print(s);
486 s << endl;
487
488 s << "ArrowAspect: ";
489 myArrowAspect->Print(s);
490 s << endl;
491
492 s << "LengthAspect: ";
493 myLengthAspect->Print(s);
494
495 s << "AngleAspect: ";
496 myAngleAspect->Print(s);
497
498 if (myTypeOfDeflection == Aspect_TOD_RELATIVE)
499 s << "TypeOfDeflection: TOD_Relative; Coefficient: " << myDeviationCoefficient << endl;
500 else
501 s << "TypeOfDeflection: TOD_Absolute; Maximal chordial deviation: " << myChordialDeviation << endl;
502 s << "HLRAngle: " << myHLRAngle;
503}