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