0022751: Issues around Prs3d_TextAspect::Print()
[occt.git] / src / Prs3d / Prs3d_Drawer.cxx
1 #define BUC60488        //GG_10/10/99   Set correctly all fields
2
3 #include <Prs3d_Drawer.ixx>
4
5 Prs3d_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*M_PI/180),
19  myHLRAngle(20*M_PI/180),
20  myLineDrawArrow(Standard_False),
21  myDrawHiddenLine(Standard_False)
22 {
23
24
25 void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
26
27   myTypeOfDeflection = aTypeOfDeflection;}
28
29 Aspect_TypeOfDeflection Prs3d_Drawer::TypeOfDeflection() const {
30
31   return myTypeOfDeflection;
32
33 }
34
35  
36 void Prs3d_Drawer::SetIsoOnPlane(const Standard_Boolean OnOff)
37 {
38   myIsoOnPlane = OnOff;
39 }
40
41  
42 Standard_Boolean Prs3d_Drawer::IsoOnPlane()const
43 {
44   return myIsoOnPlane;
45 }
46
47
48 Standard_Integer Prs3d_Drawer::Discretisation() const
49 {
50   return myNbPoints;
51 }
52
53
54 void Prs3d_Drawer::SetDiscretisation(const Standard_Integer d) 
55 {
56   myNbPoints = d;
57 }
58
59
60 void Prs3d_Drawer::SetMaximalChordialDeviation(
61                                const Quantity_Length aChordialDeviation) {
62   myChordialDeviation = aChordialDeviation;
63 }
64
65 Quantity_Length Prs3d_Drawer::MaximalChordialDeviation() const {
66   return myChordialDeviation;
67 }
68
69 //
70 //=======================================================================
71 //function : SetDeviationCoefficient
72 //purpose  : 
73 //=======================================================================
74
75 void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real aCoefficient) {
76
77   myDeviationCoefficient = aCoefficient;
78 }
79
80 //=======================================================================
81 //function : DeviationCoefficient
82 //purpose  : 
83 //=======================================================================
84
85 Standard_Real Prs3d_Drawer::DeviationCoefficient () const {
86
87   return myDeviationCoefficient;
88 }
89
90 //=======================================================================
91 //function : SetHLRDeviationCoefficient
92 //purpose  : 
93 //=======================================================================
94
95 void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real aCoefficient) {
96
97   myHLRDeviationCoefficient = aCoefficient;
98 }
99
100 //=======================================================================
101 //function : HLRDeviationCoefficient
102 //purpose  : 
103 //=======================================================================
104
105 Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const {
106
107   return myHLRDeviationCoefficient;
108 }
109
110 //=======================================================================
111 //function : SetHLRAngle
112 //purpose  : 
113 //=======================================================================
114
115 void Prs3d_Drawer::SetHLRAngle (const Standard_Real anAngle) {
116
117   myHLRAngle = anAngle;
118 }
119
120 //=======================================================================
121 //function : HLRAngle
122 //purpose  : 
123 //=======================================================================
124
125 Standard_Real Prs3d_Drawer::HLRAngle () const {
126
127   return myHLRAngle;
128 }
129
130 //=======================================================================
131 //function : SetDeviationAngle
132 //purpose  : 
133 //=======================================================================
134
135 void Prs3d_Drawer::SetDeviationAngle (const Standard_Real anAngle)
136 {
137   myDeviationAngle = anAngle;
138 }
139
140 //=======================================================================
141 //function : DeviationAngle
142 //purpose  : 
143 //=======================================================================
144
145 Standard_Real Prs3d_Drawer::DeviationAngle () const 
146 {
147   return myDeviationAngle;
148 }
149
150
151 void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real Value) {
152   myMaximalParameterValue = Value;
153 }
154
155 Standard_Real Prs3d_Drawer::MaximalParameterValue () const {
156   return myMaximalParameterValue;
157 }
158
159 Handle (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
168 void Prs3d_Drawer::SetUIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
169  myUIsoAspect = anAspect;
170 }
171
172 Handle (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
180 void Prs3d_Drawer::SetVIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
181  myVIsoAspect = anAspect;
182 }
183
184 Handle (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
192 void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& anAspect) {
193  myFreeBoundaryAspect = anAspect;
194 }
195
196 void Prs3d_Drawer::SetFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
197   myFreeBoundaryDraw = OnOff;
198 }
199
200 Standard_Boolean Prs3d_Drawer::FreeBoundaryDraw () const {
201 return myFreeBoundaryDraw;
202 }
203
204 Handle (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
211 void Prs3d_Drawer::SetUnFreeBoundaryAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
212  myUnFreeBoundaryAspect = anAspect;
213 }
214
215 void Prs3d_Drawer::SetUnFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
216   myUnFreeBoundaryDraw = OnOff;
217 }
218
219 Standard_Boolean Prs3d_Drawer::UnFreeBoundaryDraw () const {
220   return myUnFreeBoundaryDraw;
221 }
222
223 Handle (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
230 void Prs3d_Drawer::SetWireAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
231  myWireAspect = anAspect;
232 }
233 void Prs3d_Drawer::SetWireDraw ( const Standard_Boolean OnOff ) {
234   myWireDraw = OnOff;
235 }
236
237 Standard_Boolean Prs3d_Drawer::WireDraw () const {
238 return myWireDraw;
239 }
240
241
242 Handle (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
249 void Prs3d_Drawer::SetLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
250  myLineAspect = anAspect;
251 }
252
253 Handle (Prs3d_TextAspect) Prs3d_Drawer::TextAspect ()  {
254   if (myTextAspect.IsNull())
255     myTextAspect = new Prs3d_TextAspect();
256
257   return myTextAspect;
258 }
259
260 void Prs3d_Drawer::SetTextAspect ( const Handle(Prs3d_TextAspect)& anAspect) {
261  myTextAspect = anAspect;
262 }
263
264 Handle (Prs3d_ShadingAspect) Prs3d_Drawer::ShadingAspect ()  {
265   if (myShadingAspect.IsNull())
266   myShadingAspect = new Prs3d_ShadingAspect();
267
268   return myShadingAspect;
269 }
270
271 void Prs3d_Drawer::SetShadingAspect ( const Handle(Prs3d_ShadingAspect)& anAspect) {
272  myShadingAspect = anAspect;
273 }
274
275 void Prs3d_Drawer::SetShadingAspectGlobal(const Standard_Boolean aValue) {
276  myShadingAspectGlobal = aValue;
277 }
278
279 Standard_Boolean Prs3d_Drawer::ShadingAspectGlobal() const { 
280  
281  return myShadingAspectGlobal;
282
283 }
284  
285 void Prs3d_Drawer::SetLineArrowDraw ( const Standard_Boolean OnOff ) {
286   myLineDrawArrow = OnOff;
287 }
288
289 Standard_Boolean Prs3d_Drawer::LineArrowDraw () const {
290 return myLineDrawArrow;
291 }
292
293 Handle (Prs3d_ArrowAspect) Prs3d_Drawer::ArrowAspect() {
294   if (myArrowAspect.IsNull())
295     myArrowAspect = new Prs3d_ArrowAspect;
296
297   return myArrowAspect;
298 }
299
300 void Prs3d_Drawer::SetArrowAspect ( const Handle(Prs3d_ArrowAspect)& anAspect) {
301  myArrowAspect = anAspect;
302 }
303
304 Handle (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
312 void Prs3d_Drawer::SetPointAspect ( const Handle(Prs3d_PointAspect)& anAspect) {
313  myPointAspect = anAspect;
314 }
315
316 Standard_Boolean Prs3d_Drawer::DrawHiddenLine () const {return myDrawHiddenLine;}
317
318 void Prs3d_Drawer::EnableDrawHiddenLine () {myDrawHiddenLine=Standard_True;}
319
320 void Prs3d_Drawer::DisableDrawHiddenLine () {myDrawHiddenLine=Standard_False;}
321
322 Handle (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
330 void Prs3d_Drawer::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
331  myHiddenLineAspect = anAspect;
332 }
333
334 Handle (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
342 void Prs3d_Drawer::SetSeenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
343  mySeenLineAspect = anAspect;
344 }
345
346 Handle (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
354 void Prs3d_Drawer::SetVectorAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
355  myVectorAspect = anAspect;
356 }
357
358 Handle (Prs3d_DatumAspect) Prs3d_Drawer::DatumAspect () {
359   if (myDatumAspect.IsNull())
360     myDatumAspect = new Prs3d_DatumAspect;
361
362   return myDatumAspect;
363 }
364
365 void Prs3d_Drawer::SetDatumAspect ( const Handle(Prs3d_DatumAspect)& anAspect) {
366  myDatumAspect = anAspect;
367 }
368
369 Handle (Prs3d_PlaneAspect) Prs3d_Drawer::PlaneAspect () {
370   if (myPlaneAspect.IsNull())
371     myPlaneAspect = new Prs3d_PlaneAspect;
372
373   return myPlaneAspect;
374 }
375
376 void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
377   myPlaneAspect = anAspect;
378 }
379
380 Handle (Prs3d_LengthAspect) Prs3d_Drawer::LengthAspect ()  {
381   if (myLengthAspect.IsNull())
382     myLengthAspect = new Prs3d_LengthAspect;
383
384   return myLengthAspect;
385 }
386
387 void Prs3d_Drawer::SetLengthAspect ( const Handle(Prs3d_LengthAspect)& anAspect) {
388  myLengthAspect = anAspect;
389 }
390
391
392
393 Handle (Prs3d_AngleAspect) Prs3d_Drawer::AngleAspect ()  {
394   if (myAngleAspect.IsNull())
395     myAngleAspect = new Prs3d_AngleAspect;
396
397   return myAngleAspect;
398 }
399
400 void Prs3d_Drawer::SetAngleAspect ( const Handle(Prs3d_AngleAspect)& anAspect) {
401  myAngleAspect = anAspect;
402 }
403
404 Handle (Prs3d_RadiusAspect) Prs3d_Drawer::RadiusAspect () const {
405   return myRadiusAspect;
406 }
407
408 void Prs3d_Drawer::SetRadiusAspect ( const Handle(Prs3d_RadiusAspect)& anAspect) {
409  myRadiusAspect = anAspect;
410 }
411
412 Handle (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
420 void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
421  mySectionAspect = anAspect;
422 }