b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
6262338c |
15 | #include <Prs3d_Drawer.hxx> |
16 | #include <Prs3d_ArrowAspect.hxx> |
17 | #include <Prs3d_DatumAspect.hxx> |
18 | #include <Prs3d_DimensionAspect.hxx> |
19 | #include <Prs3d_IsoAspect.hxx> |
20 | #include <Prs3d_LineAspect.hxx> |
21 | #include <Prs3d_PlaneAspect.hxx> |
22 | #include <Prs3d_PointAspect.hxx> |
23 | #include <Prs3d_ShadingAspect.hxx> |
24 | #include <Prs3d_TextAspect.hxx> |
25 | |
26 | IMPLEMENT_STANDARD_HANDLE (Prs3d_Drawer, MMgt_TShared) |
27 | IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, MMgt_TShared) |
7fd59977 |
28 | |
60bf98ae |
29 | // ======================================================================= |
30 | // function : Prs3d_Drawer |
31 | // purpose : |
32 | // ======================================================================= |
33 | Prs3d_Drawer::Prs3d_Drawer() |
6262338c |
34 | : myNbPoints (30), |
35 | myHasOwnNbPoints (Standard_False), |
36 | myMaximalParameterValue (500000.), |
37 | myHasOwnMaximalParameterValue (Standard_False), |
38 | myChordialDeviation (0.0001), |
39 | myHasOwnChordialDeviation (Standard_False), |
40 | myTypeOfDeflection (Aspect_TOD_RELATIVE), |
41 | myHasOwnTypeOfDeflection (Standard_False), |
42 | myTypeOfHLR (Prs3d_TOH_NotSet), |
43 | myDeviationCoefficient (0.001), |
44 | myHasOwnDeviationCoefficient (Standard_False), |
45 | myHLRDeviationCoefficient (0.02), |
46 | myHasOwnHLRDeviationCoefficient (Standard_False), |
47 | myDeviationAngle (12.0 * M_PI / 180.0), |
48 | myHasOwnDeviationAngle (Standard_False), |
49 | myHLRAngle (20.0 * M_PI / 180.0), |
50 | myHasOwnHLRDeviationAngle (Standard_False), |
51 | myIsoOnPlane (Standard_False), |
52 | myHasOwnIsoOnPlane (Standard_False), |
53 | |
54 | myHasOwnUIsoAspect (Standard_False), |
55 | myHasOwnVIsoAspect (Standard_False), |
56 | myHasOwnWireAspect (Standard_False), |
57 | myWireDraw (Standard_True), |
58 | myHasOwnWireDraw (Standard_False), |
59 | myHasOwnPointAspect (Standard_False), |
60 | myHasOwnLineAspect (Standard_False), |
61 | myHasOwnTextAspect (Standard_False), |
62 | myHasOwnShadingAspect (Standard_False), |
63 | myShadingAspectGlobal (Standard_True), |
64 | myHasOwnShadingAspectGlobal (Standard_False), |
65 | myHasOwnPlaneAspect (Standard_False), |
66 | myHasOwnSeenLineAspect (Standard_False), |
67 | myHasOwnArrowAspect (Standard_False), |
68 | myLineArrowDraw (Standard_False), |
69 | myHasOwnLineArrowDraw (Standard_False), |
70 | myHasOwnHiddenLineAspect (Standard_False), |
71 | myDrawHiddenLine (Standard_False), |
72 | myHasOwnDrawHiddenLine (Standard_False), |
73 | myHasOwnVectorAspect (Standard_False), |
74 | myVertexDrawMode (Prs3d_VDM_Inherited), |
75 | myHasOwnDatumAspect (Standard_False), |
76 | myHasOwnSectionAspect (Standard_False), |
77 | |
78 | myHasOwnFreeBoundaryAspect (Standard_False), |
79 | myFreeBoundaryDraw (Standard_True), |
80 | myHasOwnFreeBoundaryDraw (Standard_False), |
81 | myHasOwnUnFreeBoundaryAspect (Standard_False), |
82 | myUnFreeBoundaryDraw (Standard_True), |
83 | myHasOwnUnFreeBoundaryDraw (Standard_False), |
84 | myHasOwnFaceBoundaryAspect (Standard_False), |
85 | myFaceBoundaryDraw (Standard_False), |
86 | myHasOwnFaceBoundaryDraw (Standard_False), |
87 | |
88 | myHasOwnDimensionAspect (Standard_False), |
89 | myHasOwnDimLengthModelUnits (Standard_False), |
90 | myHasOwnDimAngleModelUnits (Standard_False), |
91 | myHasOwnDimLengthDisplayUnits (Standard_False), |
92 | myHasOwnDimAngleDisplayUnits (Standard_False) |
7fd59977 |
93 | { |
60bf98ae |
94 | myDimensionModelUnits.SetLengthUnits ("m"); |
95 | myDimensionModelUnits.SetAngleUnits ("rad"); |
96 | myDimensionDisplayUnits.SetLengthUnits ("m"); |
97 | myDimensionDisplayUnits.SetAngleUnits ("deg"); |
98 | } |
7fd59977 |
99 | |
6262338c |
100 | // ======================================================================= |
101 | // function : SetTypeOfDeflection |
102 | // purpose : |
103 | // ======================================================================= |
7fd59977 |
104 | |
6262338c |
105 | void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection) |
7fd59977 |
106 | { |
6262338c |
107 | myHasOwnTypeOfDeflection = Standard_True; |
108 | myTypeOfDeflection = theTypeOfDeflection; |
7fd59977 |
109 | } |
110 | |
6262338c |
111 | // ======================================================================= |
112 | // function : SetMaximalChordialDeviation |
113 | // purpose : |
114 | // ======================================================================= |
115 | |
116 | void Prs3d_Drawer::SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation) |
7fd59977 |
117 | { |
6262338c |
118 | myHasOwnChordialDeviation = Standard_True; |
119 | myChordialDeviation = theChordialDeviation; |
7fd59977 |
120 | } |
121 | |
6262338c |
122 | // ======================================================================= |
123 | // function : SetTypeOfHLR |
124 | // purpose : set type of HLR algorithm |
125 | // ======================================================================= |
7fd59977 |
126 | |
6262338c |
127 | void Prs3d_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) |
7fd59977 |
128 | { |
6262338c |
129 | myTypeOfHLR = theTypeOfHLR; |
7fd59977 |
130 | } |
131 | |
6262338c |
132 | // ======================================================================= |
133 | // function : TypeOfHLR |
134 | // purpose : gets type of HLR algorithm |
135 | // ======================================================================= |
7fd59977 |
136 | |
6262338c |
137 | Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR() |
7fd59977 |
138 | { |
6262338c |
139 | if (!HasOwnTypeOfHLR()) |
140 | { |
141 | if (!myLink.IsNull()) |
142 | { |
143 | return myLink->TypeOfHLR(); |
144 | } |
145 | // Prs3d_TOH_PolyAlgo is default value for this setting. |
146 | myTypeOfHLR = Prs3d_TOH_PolyAlgo; |
147 | } |
148 | return myTypeOfHLR; |
7fd59977 |
149 | } |
150 | |
6262338c |
151 | // ======================================================================= |
152 | // function : SetMaximalParameterValue |
153 | // purpose : |
154 | // ======================================================================= |
7fd59977 |
155 | |
6262338c |
156 | void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real theValue) |
157 | { |
158 | myHasOwnMaximalParameterValue = Standard_True; |
159 | myMaximalParameterValue = theValue; |
7fd59977 |
160 | } |
161 | |
6262338c |
162 | // ======================================================================= |
163 | // function : SetIsoOnPlane |
164 | // purpose : |
165 | // ======================================================================= |
7fd59977 |
166 | |
6262338c |
167 | void Prs3d_Drawer::SetIsoOnPlane (const Standard_Boolean theIsEnabled) |
168 | { |
169 | myHasOwnIsoOnPlane = Standard_True; |
170 | myIsoOnPlane = theIsEnabled; |
171 | } |
7fd59977 |
172 | |
6262338c |
173 | // ======================================================================= |
174 | // function : SetDiscretisation |
175 | // purpose : |
176 | // ======================================================================= |
7fd59977 |
177 | |
6262338c |
178 | void Prs3d_Drawer::SetDiscretisation (const Standard_Integer theValue) |
179 | { |
180 | myHasOwnNbPoints = Standard_True; |
181 | myNbPoints = theValue; |
7fd59977 |
182 | } |
183 | |
184 | //======================================================================= |
6262338c |
185 | //function : SetDeviationCoefficient |
7fd59977 |
186 | //purpose : |
187 | //======================================================================= |
188 | |
6262338c |
189 | void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real theCoefficient) |
190 | { |
191 | myPreviousDeviationCoefficient = DeviationCoefficient(); |
192 | myDeviationCoefficient = theCoefficient; |
193 | myHasOwnDeviationCoefficient = Standard_True; |
7fd59977 |
194 | } |
195 | |
196 | //======================================================================= |
197 | //function : SetHLRDeviationCoefficient |
198 | //purpose : |
199 | //======================================================================= |
200 | |
6262338c |
201 | void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real theCoefficient) |
202 | { |
203 | myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient(); |
204 | myHLRDeviationCoefficient = theCoefficient; |
205 | myHasOwnHLRDeviationCoefficient = Standard_True; |
7fd59977 |
206 | } |
207 | |
208 | //======================================================================= |
6262338c |
209 | //function : SetDeviationAngle |
7fd59977 |
210 | //purpose : |
211 | //======================================================================= |
212 | |
6262338c |
213 | void Prs3d_Drawer::SetDeviationAngle (const Standard_Real theAngle) |
214 | { |
215 | myPreviousDeviationAngle = DeviationAngle(); |
216 | myDeviationAngle = theAngle; |
217 | myHasOwnDeviationAngle = Standard_True; |
7fd59977 |
218 | } |
219 | |
220 | //======================================================================= |
221 | //function : SetHLRAngle |
222 | //purpose : |
223 | //======================================================================= |
224 | |
6262338c |
225 | void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle) |
226 | { |
227 | myPreviousHLRDeviationAngle = HLRAngle(); |
228 | myHLRAngle = theAngle; |
229 | myHasOwnHLRDeviationAngle = Standard_True; |
7fd59977 |
230 | } |
231 | |
6262338c |
232 | // ======================================================================= |
233 | // function : FreeBoundaryAspect |
234 | // purpose : |
235 | // ======================================================================= |
7fd59977 |
236 | |
6262338c |
237 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FreeBoundaryAspect() |
238 | { |
239 | if (!HasOwnFreeBoundaryAspect()) |
240 | { |
241 | if (!myLink.IsNull()) |
242 | { |
243 | return myLink->FreeBoundaryAspect(); |
244 | } |
245 | if (myFreeBoundaryAspect.IsNull()) |
246 | { |
247 | myFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1.0); |
248 | } |
249 | } |
250 | return myFreeBoundaryAspect; |
7fd59977 |
251 | } |
252 | |
6262338c |
253 | // ======================================================================= |
254 | // function : FreeBoundaryAspect |
255 | // purpose : |
256 | // ======================================================================= |
7fd59977 |
257 | |
6262338c |
258 | void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) |
7fd59977 |
259 | { |
6262338c |
260 | myFreeBoundaryAspect = theAspect; |
261 | myHasOwnFreeBoundaryAspect = !myFreeBoundaryAspect.IsNull(); |
7fd59977 |
262 | } |
263 | |
6262338c |
264 | // ======================================================================= |
265 | // function : SetFreeBoundaryDraw |
266 | // purpose : |
267 | // ======================================================================= |
7fd59977 |
268 | |
6262338c |
269 | void Prs3d_Drawer::SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled) |
7fd59977 |
270 | { |
6262338c |
271 | myHasOwnFreeBoundaryDraw = Standard_True; |
272 | myFreeBoundaryDraw = theIsEnabled; |
7fd59977 |
273 | } |
274 | |
6262338c |
275 | // ======================================================================= |
276 | // function : UnFreeBoundaryAspect |
277 | // purpose : |
278 | // ======================================================================= |
7fd59977 |
279 | |
6262338c |
280 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::UnFreeBoundaryAspect() |
281 | { |
282 | if (!HasOwnUnFreeBoundaryAspect()) |
283 | { |
284 | if (!myLink.IsNull()) |
285 | { |
286 | return myLink->UnFreeBoundaryAspect(); |
287 | } |
288 | if (myUnFreeBoundaryAspect.IsNull()) |
289 | { |
290 | myUnFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0); |
291 | } |
292 | } |
293 | return myUnFreeBoundaryAspect; |
7fd59977 |
294 | } |
295 | |
6262338c |
296 | // ======================================================================= |
297 | // function : SetUnFreeBoundaryAspect |
298 | // purpose : |
299 | // ======================================================================= |
7fd59977 |
300 | |
6262338c |
301 | void Prs3d_Drawer::SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) |
302 | { |
303 | myUnFreeBoundaryAspect = theAspect; |
304 | myHasOwnUnFreeBoundaryAspect = !myUnFreeBoundaryAspect.IsNull(); |
7fd59977 |
305 | } |
306 | |
6262338c |
307 | // ======================================================================= |
308 | // function : SetUnFreeBoundaryDraw |
309 | // purpose : |
310 | // ======================================================================= |
7fd59977 |
311 | |
6262338c |
312 | void Prs3d_Drawer::SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled) |
313 | { |
314 | myHasOwnUnFreeBoundaryDraw = Standard_True; |
315 | myUnFreeBoundaryDraw = theIsEnabled; |
7fd59977 |
316 | } |
317 | |
6262338c |
318 | // ======================================================================= |
319 | // function : FaceBoundaryAspect |
320 | // purpose : |
321 | // ======================================================================= |
7fd59977 |
322 | |
6262338c |
323 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FaceBoundaryAspect() |
324 | { |
325 | if (!HasOwnFaceBoundaryAspect()) |
326 | { |
327 | if (!myLink.IsNull()) |
328 | { |
329 | return myLink->FaceBoundaryAspect(); |
330 | } |
331 | if (myFaceBoundaryAspect.IsNull()) |
332 | { |
333 | myFaceBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0); |
334 | } |
335 | } |
336 | return myFaceBoundaryAspect; |
7fd59977 |
337 | } |
338 | |
6262338c |
339 | // ======================================================================= |
340 | // function : SetFaceBoundaryAspect |
341 | // purpose : |
342 | // ======================================================================= |
7fd59977 |
343 | |
6262338c |
344 | void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) |
345 | { |
346 | myFaceBoundaryAspect = theAspect; |
347 | myHasOwnFaceBoundaryAspect = !myFaceBoundaryAspect.IsNull(); |
7fd59977 |
348 | } |
349 | |
6262338c |
350 | // ======================================================================= |
351 | // function : SetFaceBoundaryDraw |
352 | // purpose : |
353 | // ======================================================================= |
7fd59977 |
354 | |
6262338c |
355 | void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled) |
356 | { |
357 | myHasOwnFaceBoundaryDraw = Standard_True; |
358 | myFaceBoundaryDraw = theIsEnabled; |
7fd59977 |
359 | } |
360 | |
6262338c |
361 | // ======================================================================= |
362 | // function : DimensionAspect |
363 | // purpose : |
364 | // ======================================================================= |
7fd59977 |
365 | |
6262338c |
366 | const Handle(Prs3d_DimensionAspect)& Prs3d_Drawer::DimensionAspect() |
367 | { |
368 | if (!HasOwnDimensionAspect()) |
369 | { |
370 | if (!myLink.IsNull()) |
371 | { |
372 | return myLink->DimensionAspect(); |
373 | } |
374 | if (myDimensionAspect.IsNull()) |
375 | { |
376 | myDimensionAspect = new Prs3d_DimensionAspect; |
377 | } |
378 | } |
379 | return myDimensionAspect; |
7fd59977 |
380 | } |
381 | |
6262338c |
382 | // ======================================================================= |
383 | // function : SetDimensionAspect |
384 | // purpose : |
385 | // ======================================================================= |
7fd59977 |
386 | |
6262338c |
387 | void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect) |
388 | { |
389 | myDimensionAspect = theAspect; |
390 | myHasOwnDimensionAspect = !myDimensionAspect.IsNull(); |
7fd59977 |
391 | } |
392 | |
6262338c |
393 | // ======================================================================= |
394 | // function : SetDimLengthModelUnits |
395 | // purpose : |
396 | // ======================================================================= |
7fd59977 |
397 | |
6262338c |
398 | void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits) |
399 | { |
400 | myHasOwnDimLengthModelUnits = Standard_True; |
401 | myDimensionModelUnits.SetLengthUnits (theUnits); |
7fd59977 |
402 | } |
403 | |
6262338c |
404 | // ======================================================================= |
405 | // function : SetDimAngleModelUnits |
406 | // purpose : |
407 | // ======================================================================= |
7fd59977 |
408 | |
6262338c |
409 | void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits) |
410 | { |
411 | myHasOwnDimAngleModelUnits = Standard_True; |
412 | myDimensionModelUnits.SetAngleUnits (theUnits); |
7fd59977 |
413 | } |
414 | |
6262338c |
415 | // ======================================================================= |
416 | // function : SetDimLengthDisplayUnits |
417 | // purpose : |
418 | // ======================================================================= |
419 | |
420 | void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits) |
421 | { |
422 | myHasOwnDimLengthDisplayUnits = Standard_True; |
423 | myDimensionDisplayUnits.SetLengthUnits (theUnits); |
7fd59977 |
424 | } |
425 | |
6262338c |
426 | // ======================================================================= |
427 | // function : SetDimAngleDisplayUnits |
428 | // purpose : |
429 | // ======================================================================= |
7fd59977 |
430 | |
6262338c |
431 | void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits) |
432 | { |
433 | myHasOwnDimAngleDisplayUnits = Standard_True; |
434 | myDimensionDisplayUnits.SetAngleUnits (theUnits); |
7fd59977 |
435 | } |
436 | |
6262338c |
437 | // ======================================================================= |
438 | // function : UIsoAspect |
439 | // purpose : |
440 | // ======================================================================= |
441 | |
442 | const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect() |
443 | { |
444 | if (!HasOwnUIsoAspect()) |
445 | { |
446 | if (!myLink.IsNull()) |
447 | { |
448 | return myLink->UIsoAspect(); |
449 | } |
450 | if (myUIsoAspect.IsNull()) |
451 | { |
452 | myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1); |
453 | } |
454 | } |
455 | return myUIsoAspect; |
7fd59977 |
456 | } |
457 | |
6262338c |
458 | // ======================================================================= |
459 | // function : SetUIsoAspect |
460 | // purpose : |
461 | // ======================================================================= |
7fd59977 |
462 | |
6262338c |
463 | void Prs3d_Drawer::SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect) |
464 | { |
465 | myUIsoAspect = theAspect; |
466 | myHasOwnUIsoAspect = !myUIsoAspect.IsNull(); |
7fd59977 |
467 | } |
468 | |
6262338c |
469 | // ======================================================================= |
470 | // function : VIsoAspect |
471 | // purpose : |
472 | // ======================================================================= |
7fd59977 |
473 | |
6262338c |
474 | const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect() |
475 | { |
476 | if (!HasOwnVIsoAspect()) |
477 | { |
478 | if (!myLink.IsNull()) |
479 | { |
480 | return myLink->VIsoAspect(); |
481 | } |
482 | if (myVIsoAspect.IsNull()) |
483 | { |
484 | myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1); |
485 | } |
486 | } |
487 | return myVIsoAspect; |
7fd59977 |
488 | } |
489 | |
6262338c |
490 | // ======================================================================= |
491 | // function : SetVIsoAspect |
492 | // purpose : |
493 | // ======================================================================= |
7fd59977 |
494 | |
6262338c |
495 | void Prs3d_Drawer::SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect) |
496 | { |
497 | myVIsoAspect = theAspect; |
498 | myHasOwnVIsoAspect= !myVIsoAspect.IsNull(); |
7fd59977 |
499 | } |
7fd59977 |
500 | |
6262338c |
501 | // ======================================================================= |
502 | // function : WireAspect |
503 | // purpose : |
504 | // ======================================================================= |
505 | |
506 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::WireAspect() |
507 | { |
508 | if (!HasOwnWireAspect()) |
509 | { |
510 | if (!myLink.IsNull()) |
511 | { |
512 | return myLink->WireAspect(); |
513 | } |
514 | if (myWireAspect.IsNull()) |
515 | { |
516 | myWireAspect = new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0); |
517 | } |
518 | } |
519 | return myWireAspect; |
7fd59977 |
520 | } |
521 | |
6262338c |
522 | // ======================================================================= |
523 | // function : SetWireAspect |
524 | // purpose : |
525 | // ======================================================================= |
7fd59977 |
526 | |
6262338c |
527 | void Prs3d_Drawer::SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect) |
528 | { |
529 | myWireAspect = theAspect; |
530 | myHasOwnWireAspect = !myWireAspect.IsNull(); |
7fd59977 |
531 | } |
532 | |
6262338c |
533 | // ======================================================================= |
534 | // function : SetWireDraw |
535 | // purpose : |
536 | // ======================================================================= |
537 | |
538 | void Prs3d_Drawer::SetWireDraw (const Standard_Boolean theIsEnabled) |
539 | { |
540 | myHasOwnWireDraw = Standard_True; |
541 | myWireDraw = theIsEnabled; |
7fd59977 |
542 | } |
543 | |
6262338c |
544 | // ======================================================================= |
545 | // function : PointAspect |
546 | // purpose : |
547 | // ======================================================================= |
7fd59977 |
548 | |
6262338c |
549 | const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect() |
550 | { |
551 | if (!HasOwnPointAspect()) |
552 | { |
553 | if (!myLink.IsNull()) |
554 | { |
555 | return myLink->PointAspect(); |
556 | } |
557 | if (myPointAspect.IsNull()) |
558 | { |
559 | myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0); |
560 | } |
561 | } |
7fd59977 |
562 | return myPointAspect; |
563 | } |
564 | |
6262338c |
565 | // ======================================================================= |
566 | // function : SetPointAspect |
567 | // purpose : |
568 | // ======================================================================= |
7fd59977 |
569 | |
6262338c |
570 | void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) |
53b15292 |
571 | { |
6262338c |
572 | myPointAspect = theAspect; |
573 | myHasOwnPointAspect = !myPointAspect.IsNull(); |
53b15292 |
574 | } |
575 | |
6262338c |
576 | // ======================================================================= |
577 | // function : LineAspect |
578 | // purpose : |
579 | // ======================================================================= |
580 | |
581 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect() |
53b15292 |
582 | { |
6262338c |
583 | if (!HasOwnLineAspect()) |
584 | { |
585 | if (!myLink.IsNull()) |
586 | { |
587 | return myLink->LineAspect(); |
588 | } |
589 | if (myLineAspect.IsNull()) |
590 | { |
591 | myLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0); |
592 | } |
593 | } |
594 | return myLineAspect; |
53b15292 |
595 | } |
596 | |
6262338c |
597 | // ======================================================================= |
598 | // function : SetLineAspect |
599 | // purpose : |
600 | // ======================================================================= |
7fd59977 |
601 | |
6262338c |
602 | void Prs3d_Drawer::SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect) |
603 | { |
604 | myLineAspect = theAspect; |
605 | myHasOwnLineAspect = !myLineAspect.IsNull(); |
7fd59977 |
606 | } |
607 | |
6262338c |
608 | // ======================================================================= |
609 | // function : TextAspect |
610 | // purpose : |
611 | // ======================================================================= |
7fd59977 |
612 | |
6262338c |
613 | const Handle(Prs3d_TextAspect)& Prs3d_Drawer::TextAspect() |
614 | { |
615 | if (!HasOwnTextAspect()) |
616 | { |
617 | if (!myLink.IsNull()) |
618 | { |
619 | return myLink->TextAspect(); |
620 | } |
621 | if (myTextAspect.IsNull()) |
622 | { |
623 | myTextAspect = new Prs3d_TextAspect(); |
624 | } |
625 | } |
626 | return myTextAspect; |
7fd59977 |
627 | } |
628 | |
6262338c |
629 | // ======================================================================= |
630 | // function : SetTextAspect |
631 | // purpose : |
632 | // ======================================================================= |
7fd59977 |
633 | |
6262338c |
634 | void Prs3d_Drawer::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect) |
635 | { |
636 | myTextAspect = theAspect; |
637 | myHasOwnTextAspect = !myTextAspect.IsNull(); |
7fd59977 |
638 | } |
639 | |
6262338c |
640 | // ======================================================================= |
641 | // function : ShadingAspect |
642 | // purpose : |
643 | // ======================================================================= |
644 | |
645 | const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect() |
646 | { |
647 | if (!HasOwnShadingAspect()) |
648 | { |
649 | if (!myLink.IsNull()) |
650 | { |
651 | return myLink->ShadingAspect(); |
652 | } |
653 | if (myShadingAspect.IsNull()) |
654 | { |
655 | myShadingAspect = new Prs3d_ShadingAspect(); |
656 | } |
657 | } |
658 | return myShadingAspect; |
7fd59977 |
659 | } |
660 | |
6262338c |
661 | // ======================================================================= |
662 | // function : SetShadingAspect |
663 | // purpose : |
664 | // ======================================================================= |
7fd59977 |
665 | |
6262338c |
666 | void Prs3d_Drawer::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect) |
667 | { |
668 | myShadingAspect = theAspect; |
669 | myHasOwnShadingAspect = !myShadingAspect.IsNull(); |
7fd59977 |
670 | } |
671 | |
6262338c |
672 | // ======================================================================= |
673 | // function : SetShadingAspectGlobal |
674 | // purpose : |
675 | // ======================================================================= |
676 | |
677 | void Prs3d_Drawer::SetShadingAspectGlobal (const Standard_Boolean theValue) |
678 | { |
679 | myHasOwnShadingAspectGlobal = Standard_True; |
680 | myShadingAspectGlobal = theValue; |
7fd59977 |
681 | } |
682 | |
6262338c |
683 | // ======================================================================= |
684 | // function : PlaneAspect |
685 | // purpose : |
686 | // ======================================================================= |
7fd59977 |
687 | |
6262338c |
688 | const Handle(Prs3d_PlaneAspect)& Prs3d_Drawer::PlaneAspect() |
689 | { |
690 | if (!HasOwnPlaneAspect()) |
691 | { |
692 | if (!myLink.IsNull()) |
693 | { |
694 | return myLink->PlaneAspect(); |
695 | } |
696 | if (myPlaneAspect.IsNull()) |
697 | { |
698 | myPlaneAspect = new Prs3d_PlaneAspect(); |
699 | } |
700 | } |
7fd59977 |
701 | return myPlaneAspect; |
702 | } |
703 | |
6262338c |
704 | // ======================================================================= |
705 | // function : SetPlaneAspect |
706 | // purpose : |
707 | // ======================================================================= |
708 | |
709 | void Prs3d_Drawer::SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect) |
710 | { |
711 | myPlaneAspect = theAspect; |
712 | myHasOwnPlaneAspect = !myPlaneAspect.IsNull(); |
7fd59977 |
713 | } |
714 | |
60bf98ae |
715 | // ======================================================================= |
6262338c |
716 | // function : SeenLineAspect |
60bf98ae |
717 | // purpose : |
718 | // ======================================================================= |
6262338c |
719 | |
720 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect() |
a6eb515f |
721 | { |
6262338c |
722 | if (!HasOwnSeenLineAspect()) |
60bf98ae |
723 | { |
6262338c |
724 | if (!myLink.IsNull()) |
725 | { |
726 | return myLink->SeenLineAspect(); |
727 | } |
728 | if (mySeenLineAspect.IsNull()) |
729 | { |
730 | mySeenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0); |
731 | } |
60bf98ae |
732 | } |
6262338c |
733 | return mySeenLineAspect; |
7fd59977 |
734 | } |
735 | |
60bf98ae |
736 | // ======================================================================= |
6262338c |
737 | // function : SetSeenLineAspect |
60bf98ae |
738 | // purpose : |
739 | // ======================================================================= |
6262338c |
740 | |
741 | void Prs3d_Drawer::SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) |
60bf98ae |
742 | { |
6262338c |
743 | mySeenLineAspect = theAspect; |
744 | myHasOwnSeenLineAspect = !mySeenLineAspect.IsNull(); |
60bf98ae |
745 | } |
746 | |
747 | // ======================================================================= |
6262338c |
748 | // function : ArrowAspect |
60bf98ae |
749 | // purpose : |
750 | // ======================================================================= |
6262338c |
751 | |
752 | const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect() |
60bf98ae |
753 | { |
6262338c |
754 | if (!HasOwnArrowAspect()) |
755 | { |
756 | if (!myLink.IsNull()) |
757 | { |
758 | return myLink->ArrowAspect(); |
759 | } |
760 | if (myArrowAspect.IsNull()) |
761 | { |
762 | myArrowAspect = new Prs3d_ArrowAspect(); |
763 | } |
764 | } |
765 | return myArrowAspect; |
60bf98ae |
766 | } |
767 | |
768 | // ======================================================================= |
6262338c |
769 | // function : SetArrowAspect |
60bf98ae |
770 | // purpose : |
771 | // ======================================================================= |
6262338c |
772 | |
773 | void Prs3d_Drawer::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) |
60bf98ae |
774 | { |
6262338c |
775 | myArrowAspect = theAspect; |
776 | myHasOwnArrowAspect = !myArrowAspect.IsNull(); |
60bf98ae |
777 | } |
778 | |
779 | // ======================================================================= |
6262338c |
780 | // function : SetLineArrowDraw |
60bf98ae |
781 | // purpose : |
782 | // ======================================================================= |
6262338c |
783 | |
784 | void Prs3d_Drawer::SetLineArrowDraw (const Standard_Boolean theIsEnabled) |
60bf98ae |
785 | { |
6262338c |
786 | myHasOwnLineArrowDraw = Standard_True; |
787 | myLineArrowDraw = theIsEnabled; |
60bf98ae |
788 | } |
789 | |
790 | // ======================================================================= |
6262338c |
791 | // function : HiddenLineAspect |
60bf98ae |
792 | // purpose : |
793 | // ======================================================================= |
6262338c |
794 | |
795 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect() |
60bf98ae |
796 | { |
6262338c |
797 | if (!HasOwnHiddenLineAspect()) |
798 | { |
799 | if (!myLink.IsNull()) |
800 | { |
801 | return myLink->HiddenLineAspect(); |
802 | } |
803 | if (myHiddenLineAspect.IsNull()) |
804 | { |
805 | myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 0.5); |
806 | } |
807 | } |
808 | return myHiddenLineAspect; |
60bf98ae |
809 | } |
810 | |
811 | // ======================================================================= |
6262338c |
812 | // function : SetHiddenLineAspect |
60bf98ae |
813 | // purpose : |
814 | // ======================================================================= |
6262338c |
815 | |
816 | void Prs3d_Drawer::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) |
60bf98ae |
817 | { |
6262338c |
818 | myHiddenLineAspect = theAspect; |
819 | myHasOwnHiddenLineAspect = !myHiddenLineAspect.IsNull(); |
60bf98ae |
820 | } |
821 | |
822 | // ======================================================================= |
6262338c |
823 | // function : EnableDrawHiddenLineDraw |
60bf98ae |
824 | // purpose : |
825 | // ======================================================================= |
6262338c |
826 | |
827 | void Prs3d_Drawer::EnableDrawHiddenLine() |
60bf98ae |
828 | { |
6262338c |
829 | myHasOwnDrawHiddenLine = Standard_True; |
830 | myDrawHiddenLine = Standard_True; |
60bf98ae |
831 | } |
832 | |
833 | // ======================================================================= |
6262338c |
834 | // function : DisableDrawHiddenLine |
60bf98ae |
835 | // purpose : |
836 | // ======================================================================= |
6262338c |
837 | |
838 | void Prs3d_Drawer::DisableDrawHiddenLine() |
a6eb515f |
839 | { |
6262338c |
840 | myHasOwnDrawHiddenLine = Standard_True; |
841 | myDrawHiddenLine = Standard_False; |
7fd59977 |
842 | } |
843 | |
60bf98ae |
844 | // ======================================================================= |
6262338c |
845 | // function : VectorAspect |
60bf98ae |
846 | // purpose : |
847 | // ======================================================================= |
6262338c |
848 | |
849 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect() |
60bf98ae |
850 | { |
6262338c |
851 | if (!HasOwnVectorAspect()) |
852 | { |
853 | if (!myLink.IsNull()) |
854 | { |
855 | return myLink->VectorAspect(); |
856 | } |
857 | if (myVectorAspect.IsNull()) |
858 | { |
859 | myVectorAspect = new Prs3d_LineAspect (Quantity_NOC_SKYBLUE, Aspect_TOL_SOLID, 1.0); |
860 | } |
861 | } |
862 | return myVectorAspect; |
60bf98ae |
863 | } |
7fd59977 |
864 | |
60bf98ae |
865 | // ======================================================================= |
6262338c |
866 | // function : SetVectorAspect |
60bf98ae |
867 | // purpose : |
868 | // ======================================================================= |
7fd59977 |
869 | |
6262338c |
870 | void Prs3d_Drawer::SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect) |
871 | { |
872 | myVectorAspect = theAspect; |
873 | myHasOwnVectorAspect = !myVectorAspect.IsNull(); |
7fd59977 |
874 | } |
875 | |
60bf98ae |
876 | // ======================================================================= |
6262338c |
877 | // function : SetVertexDrawMode |
60bf98ae |
878 | // purpose : |
879 | // ======================================================================= |
6262338c |
880 | |
881 | void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode) |
60bf98ae |
882 | { |
6262338c |
883 | // Prs3d_VDM_Inherited is default value and means |
884 | // that correct value should be taken from the Link if it exists. |
885 | myVertexDrawMode = theMode; |
7fd59977 |
886 | } |
a2d5ab2e |
887 | |
888 | // ======================================================================= |
6262338c |
889 | // function : VertexDrawMode |
a2d5ab2e |
890 | // purpose : |
891 | // ======================================================================= |
6262338c |
892 | |
893 | Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode() |
a2d5ab2e |
894 | { |
6262338c |
895 | if (!HasOwnVertexDrawMode()) |
896 | { |
897 | if (!myLink.IsNull()) |
898 | { |
899 | return myLink->VertexDrawMode(); |
900 | } |
901 | // Prs3d_VDM_Isolated is default value for this setting. |
902 | myVertexDrawMode = Prs3d_VDM_Isolated; |
903 | } |
904 | return myVertexDrawMode; |
a2d5ab2e |
905 | } |
906 | |
907 | // ======================================================================= |
6262338c |
908 | // function : DatumAspect |
a2d5ab2e |
909 | // purpose : |
910 | // ======================================================================= |
6262338c |
911 | |
912 | const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect() |
a2d5ab2e |
913 | { |
6262338c |
914 | if (!HasOwnDatumAspect()) |
915 | { |
916 | if (!myLink.IsNull()) |
917 | { |
918 | return myLink->DatumAspect(); |
919 | } |
920 | if (myDatumAspect.IsNull()) |
921 | { |
922 | myDatumAspect = new Prs3d_DatumAspect(); |
923 | } |
924 | } |
925 | return myDatumAspect; |
a2d5ab2e |
926 | } |
927 | |
928 | // ======================================================================= |
6262338c |
929 | // function : SetDatumAspect |
a2d5ab2e |
930 | // purpose : |
931 | // ======================================================================= |
6262338c |
932 | |
933 | void Prs3d_Drawer::SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect) |
a2d5ab2e |
934 | { |
6262338c |
935 | myDatumAspect = theAspect; |
936 | myHasOwnDatumAspect = !myDatumAspect.IsNull(); |
a2d5ab2e |
937 | } |
938 | |
939 | // ======================================================================= |
6262338c |
940 | // function : SectionAspect |
a2d5ab2e |
941 | // purpose : |
942 | // ======================================================================= |
6262338c |
943 | |
944 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect() |
a2d5ab2e |
945 | { |
6262338c |
946 | if (!HasOwnSectionAspect()) |
a2d5ab2e |
947 | { |
6262338c |
948 | if (!myLink.IsNull()) |
949 | { |
950 | return myLink->SectionAspect(); |
951 | } |
952 | if (mySectionAspect.IsNull()) |
953 | { |
954 | mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0); |
955 | } |
a2d5ab2e |
956 | } |
6262338c |
957 | return mySectionAspect; |
a2d5ab2e |
958 | } |
0a768f56 |
959 | |
960 | // ======================================================================= |
6262338c |
961 | // function : SetSectionAspect |
962 | // purpose : |
0a768f56 |
963 | // ======================================================================= |
6262338c |
964 | |
965 | void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect) |
0a768f56 |
966 | { |
6262338c |
967 | mySectionAspect = theAspect; |
968 | myHasOwnSectionAspect = !mySectionAspect.IsNull(); |
0a768f56 |
969 | } |
970 | |
971 | // ======================================================================= |
6262338c |
972 | // function : SetSectionAspect |
973 | // purpose : |
0a768f56 |
974 | // ======================================================================= |
6262338c |
975 | |
976 | void Prs3d_Drawer::ClearLocalAttributes() |
0a768f56 |
977 | { |
6262338c |
978 | if (myLink.IsNull()) |
979 | { |
980 | return; |
981 | } |
982 | |
983 | myUIsoAspect.Nullify(); |
984 | myVIsoAspect.Nullify(); |
985 | myFreeBoundaryAspect.Nullify(); |
986 | myUnFreeBoundaryAspect.Nullify(); |
987 | myFaceBoundaryAspect.Nullify(); |
988 | myWireAspect.Nullify(); |
989 | myLineAspect.Nullify(); |
990 | myTextAspect.Nullify(); |
991 | myShadingAspect.Nullify(); |
992 | myPointAspect.Nullify(); |
993 | myPlaneAspect.Nullify(); |
994 | myArrowAspect.Nullify(); |
995 | myHiddenLineAspect.Nullify(); |
996 | mySeenLineAspect.Nullify(); |
997 | myVectorAspect .Nullify(); |
998 | myDatumAspect.Nullify(); |
999 | myDimensionAspect.Nullify(); |
1000 | mySectionAspect.Nullify(); |
1001 | |
1002 | myHasOwnUIsoAspect = Standard_False; |
1003 | myHasOwnVIsoAspect = Standard_False; |
1004 | myHasOwnWireAspect = Standard_False; |
1005 | myHasOwnPointAspect = Standard_False; |
1006 | myHasOwnLineAspect = Standard_False; |
1007 | myHasOwnTextAspect = Standard_False; |
1008 | myHasOwnShadingAspect = Standard_False; |
1009 | myHasOwnPlaneAspect = Standard_False; |
1010 | myHasOwnSeenLineAspect = Standard_False; |
1011 | myHasOwnArrowAspect = Standard_False; |
1012 | myHasOwnHiddenLineAspect = Standard_False; |
1013 | myHasOwnVectorAspect = Standard_False; |
1014 | myHasOwnDatumAspect = Standard_False; |
1015 | myHasOwnSectionAspect = Standard_False; |
1016 | myHasOwnFreeBoundaryAspect = Standard_False; |
1017 | myHasOwnUnFreeBoundaryAspect = Standard_False; |
1018 | myHasOwnFaceBoundaryAspect = Standard_False; |
1019 | myHasOwnDimensionAspect = Standard_False; |
1020 | |
1021 | myHasOwnNbPoints = Standard_False; |
1022 | myHasOwnMaximalParameterValue = Standard_False; |
1023 | myHasOwnTypeOfDeflection = Standard_False; |
1024 | myHasOwnChordialDeviation = Standard_False; |
1025 | myHasOwnDeviationCoefficient = Standard_False; |
1026 | myHasOwnHLRDeviationCoefficient = Standard_False; |
1027 | myHasOwnDeviationAngle = Standard_False; |
1028 | myHasOwnHLRDeviationAngle = Standard_False; |
1029 | myHasOwnIsoOnPlane = Standard_False; |
1030 | myHasOwnWireDraw = Standard_False; |
1031 | myHasOwnShadingAspectGlobal = Standard_False; |
1032 | myHasOwnLineArrowDraw = Standard_False; |
1033 | myHasOwnDrawHiddenLine = Standard_False; |
1034 | myHasOwnFreeBoundaryDraw = Standard_False; |
1035 | myHasOwnUnFreeBoundaryDraw = Standard_False; |
1036 | myHasOwnFaceBoundaryDraw = Standard_False; |
1037 | myHasOwnDimLengthModelUnits = Standard_False; |
1038 | myHasOwnDimLengthDisplayUnits = Standard_False; |
1039 | myHasOwnDimAngleModelUnits = Standard_False; |
1040 | myHasOwnDimAngleDisplayUnits = Standard_False; |
1041 | |
1042 | myVertexDrawMode = Prs3d_VDM_Inherited; |
1043 | myTypeOfHLR = Prs3d_TOH_NotSet; |
0a768f56 |
1044 | } |