0023430: Tests in xcaf group fail in parallel mode
[occt.git] / src / Prs3d / Prs3d_Drawer.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19#define BUC60488 //GG_10/10/99 Set correctly all fields
20
21#include <Prs3d_Drawer.ixx>
22
23Prs3d_Drawer::Prs3d_Drawer(): myNbPoints(30),myIsoOnPlane(Standard_False),
24 myFreeBoundaryDraw(Standard_True),
25 myUnFreeBoundaryDraw(Standard_True),
26 myWireDraw(Standard_True),
27#ifdef BUC60488
28 myShadingAspect( new Prs3d_ShadingAspect()),
29#endif
30 myShadingAspectGlobal(Standard_True),
31 myChordialDeviation(0.0001),
32 myTypeOfDeflection(Aspect_TOD_RELATIVE),
33 myMaximalParameterValue(500000.),
34 myDeviationCoefficient(0.001),
35 myHLRDeviationCoefficient(0.02),
c6541a0c
D
36 myDeviationAngle(12*M_PI/180),
37 myHLRAngle(20*M_PI/180),
7fd59977 38 myLineDrawArrow(Standard_False),
39 myDrawHiddenLine(Standard_False)
40{
41}
42
43void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
44
45 myTypeOfDeflection = aTypeOfDeflection;}
46
47Aspect_TypeOfDeflection Prs3d_Drawer::TypeOfDeflection() const {
48
49 return myTypeOfDeflection;
50
51}
52
53
54void Prs3d_Drawer::SetIsoOnPlane(const Standard_Boolean OnOff)
55{
56 myIsoOnPlane = OnOff;
57}
58
59
60Standard_Boolean Prs3d_Drawer::IsoOnPlane()const
61{
62 return myIsoOnPlane;
63}
64
65
66Standard_Integer Prs3d_Drawer::Discretisation() const
67{
68 return myNbPoints;
69}
70
71
72void Prs3d_Drawer::SetDiscretisation(const Standard_Integer d)
73{
74 myNbPoints = d;
75}
76
77
78void Prs3d_Drawer::SetMaximalChordialDeviation(
79 const Quantity_Length aChordialDeviation) {
80 myChordialDeviation = aChordialDeviation;
81}
82
83Quantity_Length Prs3d_Drawer::MaximalChordialDeviation() const {
84 return myChordialDeviation;
85}
86
87//
88//=======================================================================
89//function : SetDeviationCoefficient
90//purpose :
91//=======================================================================
92
93void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real aCoefficient) {
94
95 myDeviationCoefficient = aCoefficient;
96}
97
98//=======================================================================
99//function : DeviationCoefficient
100//purpose :
101//=======================================================================
102
103Standard_Real Prs3d_Drawer::DeviationCoefficient () const {
104
105 return myDeviationCoefficient;
106}
107
108//=======================================================================
109//function : SetHLRDeviationCoefficient
110//purpose :
111//=======================================================================
112
113void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real aCoefficient) {
114
115 myHLRDeviationCoefficient = aCoefficient;
116}
117
118//=======================================================================
119//function : HLRDeviationCoefficient
120//purpose :
121//=======================================================================
122
123Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const {
124
125 return myHLRDeviationCoefficient;
126}
127
128//=======================================================================
129//function : SetHLRAngle
130//purpose :
131//=======================================================================
132
133void Prs3d_Drawer::SetHLRAngle (const Standard_Real anAngle) {
134
135 myHLRAngle = anAngle;
136}
137
138//=======================================================================
139//function : HLRAngle
140//purpose :
141//=======================================================================
142
143Standard_Real Prs3d_Drawer::HLRAngle () const {
144
145 return myHLRAngle;
146}
147
148//=======================================================================
149//function : SetDeviationAngle
150//purpose :
151//=======================================================================
152
153void Prs3d_Drawer::SetDeviationAngle (const Standard_Real anAngle)
154{
155 myDeviationAngle = anAngle;
156}
157
158//=======================================================================
159//function : DeviationAngle
160//purpose :
161//=======================================================================
162
163Standard_Real Prs3d_Drawer::DeviationAngle () const
164{
165 return myDeviationAngle;
166}
167
168
169void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real Value) {
170 myMaximalParameterValue = Value;
171}
172
173Standard_Real Prs3d_Drawer::MaximalParameterValue () const {
174 return myMaximalParameterValue;
175}
176
177Handle (Prs3d_IsoAspect) Prs3d_Drawer::UIsoAspect (){
178
179 if (myUIsoAspect.IsNull())
180 myUIsoAspect = new Prs3d_IsoAspect
181 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
182
183 return myUIsoAspect;
184}
185
186void Prs3d_Drawer::SetUIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
187 myUIsoAspect = anAspect;
188}
189
190Handle (Prs3d_IsoAspect) Prs3d_Drawer::VIsoAspect () {
191 if (myVIsoAspect.IsNull())
192 myVIsoAspect = new Prs3d_IsoAspect
193 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
194
195 return myVIsoAspect;
196}
197
198void Prs3d_Drawer::SetVIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
199 myVIsoAspect = anAspect;
200}
201
202Handle (Prs3d_LineAspect) Prs3d_Drawer::FreeBoundaryAspect () {
203 if (myFreeBoundaryAspect.IsNull())
204 myFreeBoundaryAspect = new Prs3d_LineAspect
205 (Quantity_NOC_GREEN,Aspect_TOL_SOLID,1.);
206
207 return myFreeBoundaryAspect;
208}
209
210void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& anAspect) {
211 myFreeBoundaryAspect = anAspect;
212}
213
214void Prs3d_Drawer::SetFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
215 myFreeBoundaryDraw = OnOff;
216}
217
218Standard_Boolean Prs3d_Drawer::FreeBoundaryDraw () const {
219return myFreeBoundaryDraw;
220}
221
222Handle (Prs3d_LineAspect) Prs3d_Drawer::UnFreeBoundaryAspect (){
223 if (myUnFreeBoundaryAspect.IsNull())
224 myUnFreeBoundaryAspect = new Prs3d_LineAspect
225 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
226 return myUnFreeBoundaryAspect;
227}
228
229void Prs3d_Drawer::SetUnFreeBoundaryAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
230 myUnFreeBoundaryAspect = anAspect;
231}
232
233void Prs3d_Drawer::SetUnFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
234 myUnFreeBoundaryDraw = OnOff;
235}
236
237Standard_Boolean Prs3d_Drawer::UnFreeBoundaryDraw () const {
238 return myUnFreeBoundaryDraw;
239}
240
241Handle (Prs3d_LineAspect) Prs3d_Drawer::WireAspect () {
242 if (myWireAspect.IsNull())
243 myWireAspect = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_SOLID,1.);
244
245 return myWireAspect;
246}
247
248void Prs3d_Drawer::SetWireAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
249 myWireAspect = anAspect;
250}
251void Prs3d_Drawer::SetWireDraw ( const Standard_Boolean OnOff ) {
252 myWireDraw = OnOff;
253}
254
255Standard_Boolean Prs3d_Drawer::WireDraw () const {
256return myWireDraw;
257}
258
259
260Handle (Prs3d_LineAspect) Prs3d_Drawer::LineAspect () {
261 if (myLineAspect.IsNull())
262 myLineAspect = new Prs3d_LineAspect
263 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
264 return myLineAspect;
265}
266
267void Prs3d_Drawer::SetLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
268 myLineAspect = anAspect;
269}
270
271Handle (Prs3d_TextAspect) Prs3d_Drawer::TextAspect () {
272 if (myTextAspect.IsNull())
273 myTextAspect = new Prs3d_TextAspect();
274
275 return myTextAspect;
276}
277
278void Prs3d_Drawer::SetTextAspect ( const Handle(Prs3d_TextAspect)& anAspect) {
279 myTextAspect = anAspect;
280}
281
282Handle (Prs3d_ShadingAspect) Prs3d_Drawer::ShadingAspect () {
283 if (myShadingAspect.IsNull())
284 myShadingAspect = new Prs3d_ShadingAspect();
285
286 return myShadingAspect;
287}
288
289void Prs3d_Drawer::SetShadingAspect ( const Handle(Prs3d_ShadingAspect)& anAspect) {
290 myShadingAspect = anAspect;
291}
292
293void Prs3d_Drawer::SetShadingAspectGlobal(const Standard_Boolean aValue) {
294 myShadingAspectGlobal = aValue;
295}
296
297Standard_Boolean Prs3d_Drawer::ShadingAspectGlobal() const {
298
299 return myShadingAspectGlobal;
300
301}
302
303void Prs3d_Drawer::SetLineArrowDraw ( const Standard_Boolean OnOff ) {
304 myLineDrawArrow = OnOff;
305}
306
307Standard_Boolean Prs3d_Drawer::LineArrowDraw () const {
308return myLineDrawArrow;
309}
310
311Handle (Prs3d_ArrowAspect) Prs3d_Drawer::ArrowAspect() {
312 if (myArrowAspect.IsNull())
313 myArrowAspect = new Prs3d_ArrowAspect;
314
315 return myArrowAspect;
316}
317
318void Prs3d_Drawer::SetArrowAspect ( const Handle(Prs3d_ArrowAspect)& anAspect) {
319 myArrowAspect = anAspect;
320}
321
322Handle (Prs3d_PointAspect) Prs3d_Drawer::PointAspect() {
323 if (myPointAspect.IsNull())
324 myPointAspect = new Prs3d_PointAspect
325 (Aspect_TOM_PLUS,Quantity_NOC_YELLOW,1.);
326
327 return myPointAspect;
328}
329
330void Prs3d_Drawer::SetPointAspect ( const Handle(Prs3d_PointAspect)& anAspect) {
331 myPointAspect = anAspect;
332}
333
334Standard_Boolean Prs3d_Drawer::DrawHiddenLine () const {return myDrawHiddenLine;}
335
336void Prs3d_Drawer::EnableDrawHiddenLine () {myDrawHiddenLine=Standard_True;}
337
338void Prs3d_Drawer::DisableDrawHiddenLine () {myDrawHiddenLine=Standard_False;}
339
340Handle (Prs3d_LineAspect) Prs3d_Drawer::HiddenLineAspect () {
341 if (myHiddenLineAspect.IsNull())
342 myHiddenLineAspect = new Prs3d_LineAspect
343 (Quantity_NOC_YELLOW,Aspect_TOL_DASH,0.5);
344
345 return myHiddenLineAspect;
346}
347
348void Prs3d_Drawer::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
349 myHiddenLineAspect = anAspect;
350}
351
352Handle (Prs3d_LineAspect) Prs3d_Drawer::SeenLineAspect () {
353 if (mySeenLineAspect.IsNull())
354 mySeenLineAspect = new Prs3d_LineAspect
355 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
356
357 return mySeenLineAspect;
358}
359
360void Prs3d_Drawer::SetSeenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
361 mySeenLineAspect = anAspect;
362}
363
364Handle (Prs3d_LineAspect) Prs3d_Drawer::VectorAspect () {
365 if (myVectorAspect.IsNull())
366 myVectorAspect = new Prs3d_LineAspect
367 (Quantity_NOC_SKYBLUE,Aspect_TOL_SOLID,1.);
368
369 return myVectorAspect;
370}
371
372void Prs3d_Drawer::SetVectorAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
373 myVectorAspect = anAspect;
374}
375
376Handle (Prs3d_DatumAspect) Prs3d_Drawer::DatumAspect () {
377 if (myDatumAspect.IsNull())
378 myDatumAspect = new Prs3d_DatumAspect;
379
380 return myDatumAspect;
381}
382
383void Prs3d_Drawer::SetDatumAspect ( const Handle(Prs3d_DatumAspect)& anAspect) {
384 myDatumAspect = anAspect;
385}
386
387Handle (Prs3d_PlaneAspect) Prs3d_Drawer::PlaneAspect () {
388 if (myPlaneAspect.IsNull())
389 myPlaneAspect = new Prs3d_PlaneAspect;
390
391 return myPlaneAspect;
392}
393
394void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
395 myPlaneAspect = anAspect;
396}
397
398Handle (Prs3d_LengthAspect) Prs3d_Drawer::LengthAspect () {
399 if (myLengthAspect.IsNull())
400 myLengthAspect = new Prs3d_LengthAspect;
401
402 return myLengthAspect;
403}
404
405void Prs3d_Drawer::SetLengthAspect ( const Handle(Prs3d_LengthAspect)& anAspect) {
406 myLengthAspect = anAspect;
407}
408
409
410
411Handle (Prs3d_AngleAspect) Prs3d_Drawer::AngleAspect () {
412 if (myAngleAspect.IsNull())
413 myAngleAspect = new Prs3d_AngleAspect;
414
415 return myAngleAspect;
416}
417
418void Prs3d_Drawer::SetAngleAspect ( const Handle(Prs3d_AngleAspect)& anAspect) {
419 myAngleAspect = anAspect;
420}
421
422Handle (Prs3d_RadiusAspect) Prs3d_Drawer::RadiusAspect () const {
423 return myRadiusAspect;
424}
425
426void Prs3d_Drawer::SetRadiusAspect ( const Handle(Prs3d_RadiusAspect)& anAspect) {
427 myRadiusAspect = anAspect;
428}
429
430Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
431 if (mySectionAspect.IsNull())
432 mySectionAspect = new Prs3d_LineAspect
433 (Quantity_NOC_ORANGE,Aspect_TOL_SOLID,1.);
434
435 return mySectionAspect;
436}
437
438void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
439 mySectionAspect = anAspect;
440}