1 #define BUC60488 //GG_10/10/99 Set correctly all fields
3 #include <Prs3d_Drawer.ixx>
5 Prs3d_Drawer::Prs3d_Drawer(): myNbPoints(30),myIsoOnPlane(Standard_False),
6 myFreeBoundaryDraw(Standard_True),
7 myUnFreeBoundaryDraw(Standard_True),
8 myWireDraw(Standard_True),
10 myShadingAspect( new Prs3d_ShadingAspect()),
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)
25 void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
27 myTypeOfDeflection = aTypeOfDeflection;}
29 Aspect_TypeOfDeflection Prs3d_Drawer::TypeOfDeflection() const {
31 return myTypeOfDeflection;
36 void Prs3d_Drawer::SetIsoOnPlane(const Standard_Boolean OnOff)
42 Standard_Boolean Prs3d_Drawer::IsoOnPlane()const
48 Standard_Integer Prs3d_Drawer::Discretisation() const
54 void Prs3d_Drawer::SetDiscretisation(const Standard_Integer d)
60 void Prs3d_Drawer::SetMaximalChordialDeviation(
61 const Quantity_Length aChordialDeviation) {
62 myChordialDeviation = aChordialDeviation;
65 Quantity_Length Prs3d_Drawer::MaximalChordialDeviation() const {
66 return myChordialDeviation;
70 //=======================================================================
71 //function : SetDeviationCoefficient
73 //=======================================================================
75 void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real aCoefficient) {
77 myDeviationCoefficient = aCoefficient;
80 //=======================================================================
81 //function : DeviationCoefficient
83 //=======================================================================
85 Standard_Real Prs3d_Drawer::DeviationCoefficient () const {
87 return myDeviationCoefficient;
90 //=======================================================================
91 //function : SetHLRDeviationCoefficient
93 //=======================================================================
95 void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real aCoefficient) {
97 myHLRDeviationCoefficient = aCoefficient;
100 //=======================================================================
101 //function : HLRDeviationCoefficient
103 //=======================================================================
105 Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const {
107 return myHLRDeviationCoefficient;
110 //=======================================================================
111 //function : SetHLRAngle
113 //=======================================================================
115 void Prs3d_Drawer::SetHLRAngle (const Standard_Real anAngle) {
117 myHLRAngle = anAngle;
120 //=======================================================================
121 //function : HLRAngle
123 //=======================================================================
125 Standard_Real Prs3d_Drawer::HLRAngle () const {
130 //=======================================================================
131 //function : SetDeviationAngle
133 //=======================================================================
135 void Prs3d_Drawer::SetDeviationAngle (const Standard_Real anAngle)
137 myDeviationAngle = anAngle;
140 //=======================================================================
141 //function : DeviationAngle
143 //=======================================================================
145 Standard_Real Prs3d_Drawer::DeviationAngle () const
147 return myDeviationAngle;
151 void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real Value) {
152 myMaximalParameterValue = Value;
155 Standard_Real Prs3d_Drawer::MaximalParameterValue () const {
156 return myMaximalParameterValue;
159 Handle (Prs3d_IsoAspect) Prs3d_Drawer::UIsoAspect (){
161 if (myUIsoAspect.IsNull())
162 myUIsoAspect = new Prs3d_IsoAspect
163 (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1);
168 void Prs3d_Drawer::SetUIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
169 myUIsoAspect = anAspect;
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);
180 void Prs3d_Drawer::SetVIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) {
181 myVIsoAspect = anAspect;
184 Handle (Prs3d_LineAspect) Prs3d_Drawer::FreeBoundaryAspect () {
185 if (myFreeBoundaryAspect.IsNull())
186 myFreeBoundaryAspect = new Prs3d_LineAspect
187 (Quantity_NOC_GREEN,Aspect_TOL_SOLID,1.);
189 return myFreeBoundaryAspect;
192 void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& anAspect) {
193 myFreeBoundaryAspect = anAspect;
196 void Prs3d_Drawer::SetFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
197 myFreeBoundaryDraw = OnOff;
200 Standard_Boolean Prs3d_Drawer::FreeBoundaryDraw () const {
201 return myFreeBoundaryDraw;
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;
211 void Prs3d_Drawer::SetUnFreeBoundaryAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
212 myUnFreeBoundaryAspect = anAspect;
215 void Prs3d_Drawer::SetUnFreeBoundaryDraw ( const Standard_Boolean OnOff ) {
216 myUnFreeBoundaryDraw = OnOff;
219 Standard_Boolean Prs3d_Drawer::UnFreeBoundaryDraw () const {
220 return myUnFreeBoundaryDraw;
223 Handle (Prs3d_LineAspect) Prs3d_Drawer::WireAspect () {
224 if (myWireAspect.IsNull())
225 myWireAspect = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_SOLID,1.);
230 void Prs3d_Drawer::SetWireAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
231 myWireAspect = anAspect;
233 void Prs3d_Drawer::SetWireDraw ( const Standard_Boolean OnOff ) {
237 Standard_Boolean Prs3d_Drawer::WireDraw () const {
242 Handle (Prs3d_LineAspect) Prs3d_Drawer::LineAspect () {
243 if (myLineAspect.IsNull())
244 myLineAspect = new Prs3d_LineAspect
245 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
249 void Prs3d_Drawer::SetLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
250 myLineAspect = anAspect;
253 Handle (Prs3d_TextAspect) Prs3d_Drawer::TextAspect () {
254 if (myTextAspect.IsNull())
255 myTextAspect = new Prs3d_TextAspect();
260 void Prs3d_Drawer::SetTextAspect ( const Handle(Prs3d_TextAspect)& anAspect) {
261 myTextAspect = anAspect;
264 Handle (Prs3d_ShadingAspect) Prs3d_Drawer::ShadingAspect () {
265 if (myShadingAspect.IsNull())
266 myShadingAspect = new Prs3d_ShadingAspect();
268 return myShadingAspect;
271 void Prs3d_Drawer::SetShadingAspect ( const Handle(Prs3d_ShadingAspect)& anAspect) {
272 myShadingAspect = anAspect;
275 void Prs3d_Drawer::SetShadingAspectGlobal(const Standard_Boolean aValue) {
276 myShadingAspectGlobal = aValue;
279 Standard_Boolean Prs3d_Drawer::ShadingAspectGlobal() const {
281 return myShadingAspectGlobal;
285 void Prs3d_Drawer::SetLineArrowDraw ( const Standard_Boolean OnOff ) {
286 myLineDrawArrow = OnOff;
289 Standard_Boolean Prs3d_Drawer::LineArrowDraw () const {
290 return myLineDrawArrow;
293 Handle (Prs3d_ArrowAspect) Prs3d_Drawer::ArrowAspect() {
294 if (myArrowAspect.IsNull())
295 myArrowAspect = new Prs3d_ArrowAspect;
297 return myArrowAspect;
300 void Prs3d_Drawer::SetArrowAspect ( const Handle(Prs3d_ArrowAspect)& anAspect) {
301 myArrowAspect = anAspect;
304 Handle (Prs3d_PointAspect) Prs3d_Drawer::PointAspect() {
305 if (myPointAspect.IsNull())
306 myPointAspect = new Prs3d_PointAspect
307 (Aspect_TOM_PLUS,Quantity_NOC_YELLOW,1.);
309 return myPointAspect;
312 void Prs3d_Drawer::SetPointAspect ( const Handle(Prs3d_PointAspect)& anAspect) {
313 myPointAspect = anAspect;
316 Standard_Boolean Prs3d_Drawer::DrawHiddenLine () const {return myDrawHiddenLine;}
318 void Prs3d_Drawer::EnableDrawHiddenLine () {myDrawHiddenLine=Standard_True;}
320 void Prs3d_Drawer::DisableDrawHiddenLine () {myDrawHiddenLine=Standard_False;}
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);
327 return myHiddenLineAspect;
330 void Prs3d_Drawer::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
331 myHiddenLineAspect = anAspect;
334 Handle (Prs3d_LineAspect) Prs3d_Drawer::SeenLineAspect () {
335 if (mySeenLineAspect.IsNull())
336 mySeenLineAspect = new Prs3d_LineAspect
337 (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.);
339 return mySeenLineAspect;
342 void Prs3d_Drawer::SetSeenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
343 mySeenLineAspect = anAspect;
346 Handle (Prs3d_LineAspect) Prs3d_Drawer::VectorAspect () {
347 if (myVectorAspect.IsNull())
348 myVectorAspect = new Prs3d_LineAspect
349 (Quantity_NOC_SKYBLUE,Aspect_TOL_SOLID,1.);
351 return myVectorAspect;
354 void Prs3d_Drawer::SetVectorAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
355 myVectorAspect = anAspect;
358 Handle (Prs3d_DatumAspect) Prs3d_Drawer::DatumAspect () {
359 if (myDatumAspect.IsNull())
360 myDatumAspect = new Prs3d_DatumAspect;
362 return myDatumAspect;
365 void Prs3d_Drawer::SetDatumAspect ( const Handle(Prs3d_DatumAspect)& anAspect) {
366 myDatumAspect = anAspect;
369 Handle (Prs3d_PlaneAspect) Prs3d_Drawer::PlaneAspect () {
370 if (myPlaneAspect.IsNull())
371 myPlaneAspect = new Prs3d_PlaneAspect;
373 return myPlaneAspect;
376 void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
377 myPlaneAspect = anAspect;
380 Handle (Prs3d_LengthAspect) Prs3d_Drawer::LengthAspect () {
381 if (myLengthAspect.IsNull())
382 myLengthAspect = new Prs3d_LengthAspect;
384 return myLengthAspect;
387 void Prs3d_Drawer::SetLengthAspect ( const Handle(Prs3d_LengthAspect)& anAspect) {
388 myLengthAspect = anAspect;
393 Handle (Prs3d_AngleAspect) Prs3d_Drawer::AngleAspect () {
394 if (myAngleAspect.IsNull())
395 myAngleAspect = new Prs3d_AngleAspect;
397 return myAngleAspect;
400 void Prs3d_Drawer::SetAngleAspect ( const Handle(Prs3d_AngleAspect)& anAspect) {
401 myAngleAspect = anAspect;
404 Handle (Prs3d_RadiusAspect) Prs3d_Drawer::RadiusAspect () const {
405 return myRadiusAspect;
408 void Prs3d_Drawer::SetRadiusAspect ( const Handle(Prs3d_RadiusAspect)& anAspect) {
409 myRadiusAspect = anAspect;
412 Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
413 if (mySectionAspect.IsNull())
414 mySectionAspect = new Prs3d_LineAspect
415 (Quantity_NOC_ORANGE,Aspect_TOL_SOLID,1.);
417 return mySectionAspect;
420 void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
421 mySectionAspect = anAspect;
425 void Prs3d_Drawer::Print (Standard_OStream& s) const {
427 s << "Drawer: " << endl;
428 s << "UIsoAspect: " ;
429 myUIsoAspect->Print(s);
432 s << "VIsoAspect: " ;
433 myVIsoAspect->Print(s);
436 s << "LineAspect: " ;
437 myLineAspect->Print(s);
440 if (myDrawHiddenLine)
441 s << "draws hidden lines" << endl;
443 s << "does not draw hidden lines" << endl;
445 s << "HiddenLineAspect: ";
446 myHiddenLineAspect->Print(s);
449 s << "SeenLineAspect: ";
450 mySeenLineAspect->Print(s);
454 myWireAspect->Print(s);
457 s << "FreeBoundaryAspect: ";
458 myFreeBoundaryAspect->Print(s);
461 s << "UnFreeBoundaryAspect: ";
462 myUnFreeBoundaryAspect->Print(s);
466 s << "SectionAspect: ";
467 mySectionAspect->Print(s);
470 s << "DatumAspect: ";
472 myDatumAspect->Print(s);
475 s << "VectorAspect: ";
476 myVectorAspect->Print(s);
480 s << "PointAspect: ";
481 myPointAspect->Print(s);
485 myTextAspect->Print(s);
488 s << "ArrowAspect: ";
489 myArrowAspect->Print(s);
492 s << "LengthAspect: ";
493 myLengthAspect->Print(s);
495 s << "AngleAspect: ";
496 myAngleAspect->Print(s);
498 if (myTypeOfDeflection == Aspect_TOD_RELATIVE)
499 s << "TypeOfDeflection: TOD_Relative; Coefficient: " << myDeviationCoefficient << endl;
501 s << "TypeOfDeflection: TOD_Absolute; Maximal chordial deviation: " << myChordialDeviation << endl;
502 s << "HLRAngle: " << myHLRAngle;