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> |
fb66bb28 |
16 | |
17 | #include <Graphic3d_AspectFillArea3d.hxx> |
18 | #include <Graphic3d_AspectMarker3d.hxx> |
19 | #include <Graphic3d_AspectText3d.hxx> |
6262338c |
20 | #include <Prs3d_ArrowAspect.hxx> |
21 | #include <Prs3d_DatumAspect.hxx> |
22 | #include <Prs3d_DimensionAspect.hxx> |
23 | #include <Prs3d_IsoAspect.hxx> |
24 | #include <Prs3d_LineAspect.hxx> |
25 | #include <Prs3d_PlaneAspect.hxx> |
26 | #include <Prs3d_PointAspect.hxx> |
27 | #include <Prs3d_ShadingAspect.hxx> |
28 | #include <Prs3d_TextAspect.hxx> |
29 | |
f838dac4 |
30 | IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes) |
92efcf78 |
31 | |
2a332745 |
32 | namespace |
33 | { |
34 | static const Quantity_NameOfColor THE_DEF_COLOR_FreeBoundary = Quantity_NOC_GREEN; |
35 | static const Quantity_NameOfColor THE_DEF_COLOR_UnFreeBoundary = Quantity_NOC_YELLOW; |
36 | static const Quantity_NameOfColor THE_DEF_COLOR_FaceBoundary = Quantity_NOC_BLACK; |
37 | static const Quantity_NameOfColor THE_DEF_COLOR_Wire = Quantity_NOC_RED; |
38 | static const Quantity_NameOfColor THE_DEF_COLOR_Line = Quantity_NOC_YELLOW; |
39 | static const Quantity_NameOfColor THE_DEF_COLOR_SeenLine = Quantity_NOC_YELLOW; |
40 | static const Quantity_NameOfColor THE_DEF_COLOR_HiddenLine = Quantity_NOC_YELLOW; |
41 | static const Quantity_NameOfColor THE_DEF_COLOR_Vector = Quantity_NOC_SKYBLUE; |
42 | static const Quantity_NameOfColor THE_DEF_COLOR_Section = Quantity_NOC_ORANGE; |
43 | } |
44 | |
60bf98ae |
45 | // ======================================================================= |
46 | // function : Prs3d_Drawer |
47 | // purpose : |
48 | // ======================================================================= |
49 | Prs3d_Drawer::Prs3d_Drawer() |
6262338c |
50 | : myNbPoints (30), |
51 | myHasOwnNbPoints (Standard_False), |
52 | myMaximalParameterValue (500000.), |
53 | myHasOwnMaximalParameterValue (Standard_False), |
54 | myChordialDeviation (0.0001), |
55 | myHasOwnChordialDeviation (Standard_False), |
56 | myTypeOfDeflection (Aspect_TOD_RELATIVE), |
57 | myHasOwnTypeOfDeflection (Standard_False), |
58 | myTypeOfHLR (Prs3d_TOH_NotSet), |
59 | myDeviationCoefficient (0.001), |
60 | myHasOwnDeviationCoefficient (Standard_False), |
61 | myHLRDeviationCoefficient (0.02), |
62 | myHasOwnHLRDeviationCoefficient (Standard_False), |
63 | myDeviationAngle (12.0 * M_PI / 180.0), |
64 | myHasOwnDeviationAngle (Standard_False), |
65 | myHLRAngle (20.0 * M_PI / 180.0), |
66 | myHasOwnHLRDeviationAngle (Standard_False), |
67 | myIsoOnPlane (Standard_False), |
68 | myHasOwnIsoOnPlane (Standard_False), |
5ad8c033 |
69 | myIsoOnTriangulation (Standard_False), |
70 | myHasOwnIsoOnTriangulation (Standard_False), |
4c513386 |
71 | myIsAutoTriangulated (Standard_True), |
72 | myHasOwnIsAutoTriangulated (Standard_False), |
6262338c |
73 | |
74 | myHasOwnUIsoAspect (Standard_False), |
75 | myHasOwnVIsoAspect (Standard_False), |
76 | myHasOwnWireAspect (Standard_False), |
77 | myWireDraw (Standard_True), |
78 | myHasOwnWireDraw (Standard_False), |
79 | myHasOwnPointAspect (Standard_False), |
80 | myHasOwnLineAspect (Standard_False), |
81 | myHasOwnTextAspect (Standard_False), |
82 | myHasOwnShadingAspect (Standard_False), |
6262338c |
83 | myHasOwnPlaneAspect (Standard_False), |
84 | myHasOwnSeenLineAspect (Standard_False), |
85 | myHasOwnArrowAspect (Standard_False), |
86 | myLineArrowDraw (Standard_False), |
87 | myHasOwnLineArrowDraw (Standard_False), |
88 | myHasOwnHiddenLineAspect (Standard_False), |
89 | myDrawHiddenLine (Standard_False), |
90 | myHasOwnDrawHiddenLine (Standard_False), |
91 | myHasOwnVectorAspect (Standard_False), |
92 | myVertexDrawMode (Prs3d_VDM_Inherited), |
93 | myHasOwnDatumAspect (Standard_False), |
94 | myHasOwnSectionAspect (Standard_False), |
95 | |
96 | myHasOwnFreeBoundaryAspect (Standard_False), |
97 | myFreeBoundaryDraw (Standard_True), |
98 | myHasOwnFreeBoundaryDraw (Standard_False), |
99 | myHasOwnUnFreeBoundaryAspect (Standard_False), |
100 | myUnFreeBoundaryDraw (Standard_True), |
101 | myHasOwnUnFreeBoundaryDraw (Standard_False), |
102 | myHasOwnFaceBoundaryAspect (Standard_False), |
103 | myFaceBoundaryDraw (Standard_False), |
104 | myHasOwnFaceBoundaryDraw (Standard_False), |
105 | |
106 | myHasOwnDimensionAspect (Standard_False), |
107 | myHasOwnDimLengthModelUnits (Standard_False), |
108 | myHasOwnDimAngleModelUnits (Standard_False), |
109 | myHasOwnDimLengthDisplayUnits (Standard_False), |
f838dac4 |
110 | myHasOwnDimAngleDisplayUnits (Standard_False) |
7fd59977 |
111 | { |
60bf98ae |
112 | myDimensionModelUnits.SetLengthUnits ("m"); |
113 | myDimensionModelUnits.SetAngleUnits ("rad"); |
114 | myDimensionDisplayUnits.SetLengthUnits ("m"); |
115 | myDimensionDisplayUnits.SetAngleUnits ("deg"); |
116 | } |
7fd59977 |
117 | |
6262338c |
118 | // ======================================================================= |
119 | // function : SetTypeOfDeflection |
120 | // purpose : |
121 | // ======================================================================= |
7fd59977 |
122 | |
6262338c |
123 | void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection) |
7fd59977 |
124 | { |
6262338c |
125 | myHasOwnTypeOfDeflection = Standard_True; |
126 | myTypeOfDeflection = theTypeOfDeflection; |
7fd59977 |
127 | } |
128 | |
6262338c |
129 | // ======================================================================= |
130 | // function : SetMaximalChordialDeviation |
131 | // purpose : |
132 | // ======================================================================= |
133 | |
ee2be2a8 |
134 | void Prs3d_Drawer::SetMaximalChordialDeviation (const Standard_Real theChordialDeviation) |
7fd59977 |
135 | { |
6262338c |
136 | myHasOwnChordialDeviation = Standard_True; |
137 | myChordialDeviation = theChordialDeviation; |
7fd59977 |
138 | } |
139 | |
6262338c |
140 | // ======================================================================= |
141 | // function : SetTypeOfHLR |
142 | // purpose : set type of HLR algorithm |
143 | // ======================================================================= |
7fd59977 |
144 | |
6262338c |
145 | void Prs3d_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) |
7fd59977 |
146 | { |
6262338c |
147 | myTypeOfHLR = theTypeOfHLR; |
7fd59977 |
148 | } |
149 | |
6262338c |
150 | // ======================================================================= |
151 | // function : TypeOfHLR |
152 | // purpose : gets type of HLR algorithm |
153 | // ======================================================================= |
7fd59977 |
154 | |
6262338c |
155 | Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR() |
7fd59977 |
156 | { |
6262338c |
157 | if (!HasOwnTypeOfHLR()) |
158 | { |
159 | if (!myLink.IsNull()) |
160 | { |
161 | return myLink->TypeOfHLR(); |
162 | } |
163 | // Prs3d_TOH_PolyAlgo is default value for this setting. |
164 | myTypeOfHLR = Prs3d_TOH_PolyAlgo; |
165 | } |
166 | return myTypeOfHLR; |
7fd59977 |
167 | } |
168 | |
5ad8c033 |
169 | // ======================================================================= |
170 | // function : SetIsoOnTriangulation |
171 | // purpose : |
172 | // ======================================================================= |
173 | void Prs3d_Drawer::SetIsoOnTriangulation (const Standard_Boolean theToEnable) |
174 | { |
175 | myHasOwnIsoOnTriangulation = Standard_True; |
176 | myIsoOnTriangulation = theToEnable; |
177 | } |
178 | |
6262338c |
179 | // ======================================================================= |
180 | // function : SetMaximalParameterValue |
181 | // purpose : |
182 | // ======================================================================= |
7fd59977 |
183 | |
6262338c |
184 | void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real theValue) |
185 | { |
186 | myHasOwnMaximalParameterValue = Standard_True; |
187 | myMaximalParameterValue = theValue; |
7fd59977 |
188 | } |
189 | |
6262338c |
190 | // ======================================================================= |
191 | // function : SetIsoOnPlane |
192 | // purpose : |
193 | // ======================================================================= |
7fd59977 |
194 | |
6262338c |
195 | void Prs3d_Drawer::SetIsoOnPlane (const Standard_Boolean theIsEnabled) |
196 | { |
197 | myHasOwnIsoOnPlane = Standard_True; |
198 | myIsoOnPlane = theIsEnabled; |
199 | } |
7fd59977 |
200 | |
6262338c |
201 | // ======================================================================= |
202 | // function : SetDiscretisation |
203 | // purpose : |
204 | // ======================================================================= |
7fd59977 |
205 | |
6262338c |
206 | void Prs3d_Drawer::SetDiscretisation (const Standard_Integer theValue) |
207 | { |
208 | myHasOwnNbPoints = Standard_True; |
209 | myNbPoints = theValue; |
7fd59977 |
210 | } |
211 | |
212 | //======================================================================= |
6262338c |
213 | //function : SetDeviationCoefficient |
7fd59977 |
214 | //purpose : |
215 | //======================================================================= |
216 | |
6262338c |
217 | void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real theCoefficient) |
218 | { |
219 | myPreviousDeviationCoefficient = DeviationCoefficient(); |
220 | myDeviationCoefficient = theCoefficient; |
221 | myHasOwnDeviationCoefficient = Standard_True; |
7fd59977 |
222 | } |
223 | |
224 | //======================================================================= |
225 | //function : SetHLRDeviationCoefficient |
226 | //purpose : |
227 | //======================================================================= |
228 | |
6262338c |
229 | void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real theCoefficient) |
230 | { |
231 | myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient(); |
232 | myHLRDeviationCoefficient = theCoefficient; |
233 | myHasOwnHLRDeviationCoefficient = Standard_True; |
7fd59977 |
234 | } |
235 | |
236 | //======================================================================= |
6262338c |
237 | //function : SetDeviationAngle |
7fd59977 |
238 | //purpose : |
239 | //======================================================================= |
240 | |
6262338c |
241 | void Prs3d_Drawer::SetDeviationAngle (const Standard_Real theAngle) |
242 | { |
243 | myPreviousDeviationAngle = DeviationAngle(); |
244 | myDeviationAngle = theAngle; |
245 | myHasOwnDeviationAngle = Standard_True; |
7fd59977 |
246 | } |
247 | |
248 | //======================================================================= |
249 | //function : SetHLRAngle |
250 | //purpose : |
251 | //======================================================================= |
252 | |
6262338c |
253 | void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle) |
254 | { |
255 | myPreviousHLRDeviationAngle = HLRAngle(); |
256 | myHLRAngle = theAngle; |
257 | myHasOwnHLRDeviationAngle = Standard_True; |
7fd59977 |
258 | } |
259 | |
4c513386 |
260 | // ======================================================================= |
261 | // function : SetAutoTriangulation |
262 | // purpose : |
263 | // ======================================================================= |
264 | |
265 | void Prs3d_Drawer::SetAutoTriangulation (const Standard_Boolean theIsEnabled) |
266 | { |
267 | myHasOwnIsAutoTriangulated = Standard_True; |
268 | myIsAutoTriangulated = theIsEnabled; |
269 | } |
270 | |
6262338c |
271 | // ======================================================================= |
272 | // function : FreeBoundaryAspect |
273 | // purpose : |
274 | // ======================================================================= |
7fd59977 |
275 | |
6262338c |
276 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FreeBoundaryAspect() |
277 | { |
278 | if (!HasOwnFreeBoundaryAspect()) |
279 | { |
280 | if (!myLink.IsNull()) |
281 | { |
282 | return myLink->FreeBoundaryAspect(); |
283 | } |
284 | if (myFreeBoundaryAspect.IsNull()) |
285 | { |
2a332745 |
286 | myFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FreeBoundary, Aspect_TOL_SOLID, 1.0); |
6262338c |
287 | } |
288 | } |
289 | return myFreeBoundaryAspect; |
7fd59977 |
290 | } |
291 | |
6262338c |
292 | // ======================================================================= |
293 | // function : FreeBoundaryAspect |
294 | // purpose : |
295 | // ======================================================================= |
7fd59977 |
296 | |
6262338c |
297 | void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) |
7fd59977 |
298 | { |
6262338c |
299 | myFreeBoundaryAspect = theAspect; |
300 | myHasOwnFreeBoundaryAspect = !myFreeBoundaryAspect.IsNull(); |
7fd59977 |
301 | } |
302 | |
6262338c |
303 | // ======================================================================= |
304 | // function : SetFreeBoundaryDraw |
305 | // purpose : |
306 | // ======================================================================= |
7fd59977 |
307 | |
6262338c |
308 | void Prs3d_Drawer::SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled) |
7fd59977 |
309 | { |
6262338c |
310 | myHasOwnFreeBoundaryDraw = Standard_True; |
311 | myFreeBoundaryDraw = theIsEnabled; |
7fd59977 |
312 | } |
313 | |
6262338c |
314 | // ======================================================================= |
315 | // function : UnFreeBoundaryAspect |
316 | // purpose : |
317 | // ======================================================================= |
7fd59977 |
318 | |
6262338c |
319 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::UnFreeBoundaryAspect() |
320 | { |
321 | if (!HasOwnUnFreeBoundaryAspect()) |
322 | { |
323 | if (!myLink.IsNull()) |
324 | { |
325 | return myLink->UnFreeBoundaryAspect(); |
326 | } |
327 | if (myUnFreeBoundaryAspect.IsNull()) |
328 | { |
2a332745 |
329 | myUnFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_UnFreeBoundary, Aspect_TOL_SOLID, 1.0); |
6262338c |
330 | } |
331 | } |
332 | return myUnFreeBoundaryAspect; |
7fd59977 |
333 | } |
334 | |
6262338c |
335 | // ======================================================================= |
336 | // function : SetUnFreeBoundaryAspect |
337 | // purpose : |
338 | // ======================================================================= |
7fd59977 |
339 | |
6262338c |
340 | void Prs3d_Drawer::SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) |
341 | { |
342 | myUnFreeBoundaryAspect = theAspect; |
343 | myHasOwnUnFreeBoundaryAspect = !myUnFreeBoundaryAspect.IsNull(); |
7fd59977 |
344 | } |
345 | |
6262338c |
346 | // ======================================================================= |
347 | // function : SetUnFreeBoundaryDraw |
348 | // purpose : |
349 | // ======================================================================= |
7fd59977 |
350 | |
6262338c |
351 | void Prs3d_Drawer::SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled) |
352 | { |
353 | myHasOwnUnFreeBoundaryDraw = Standard_True; |
354 | myUnFreeBoundaryDraw = theIsEnabled; |
7fd59977 |
355 | } |
356 | |
6262338c |
357 | // ======================================================================= |
358 | // function : FaceBoundaryAspect |
359 | // purpose : |
360 | // ======================================================================= |
7fd59977 |
361 | |
6262338c |
362 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FaceBoundaryAspect() |
363 | { |
364 | if (!HasOwnFaceBoundaryAspect()) |
365 | { |
366 | if (!myLink.IsNull()) |
367 | { |
368 | return myLink->FaceBoundaryAspect(); |
369 | } |
370 | if (myFaceBoundaryAspect.IsNull()) |
371 | { |
2a332745 |
372 | myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0); |
6262338c |
373 | } |
374 | } |
375 | return myFaceBoundaryAspect; |
7fd59977 |
376 | } |
377 | |
6262338c |
378 | // ======================================================================= |
379 | // function : SetFaceBoundaryAspect |
380 | // purpose : |
381 | // ======================================================================= |
7fd59977 |
382 | |
6262338c |
383 | void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) |
384 | { |
385 | myFaceBoundaryAspect = theAspect; |
386 | myHasOwnFaceBoundaryAspect = !myFaceBoundaryAspect.IsNull(); |
7fd59977 |
387 | } |
388 | |
6262338c |
389 | // ======================================================================= |
390 | // function : SetFaceBoundaryDraw |
391 | // purpose : |
392 | // ======================================================================= |
7fd59977 |
393 | |
6262338c |
394 | void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled) |
395 | { |
396 | myHasOwnFaceBoundaryDraw = Standard_True; |
397 | myFaceBoundaryDraw = theIsEnabled; |
7fd59977 |
398 | } |
399 | |
6262338c |
400 | // ======================================================================= |
401 | // function : DimensionAspect |
402 | // purpose : |
403 | // ======================================================================= |
7fd59977 |
404 | |
6262338c |
405 | const Handle(Prs3d_DimensionAspect)& Prs3d_Drawer::DimensionAspect() |
406 | { |
407 | if (!HasOwnDimensionAspect()) |
408 | { |
409 | if (!myLink.IsNull()) |
410 | { |
411 | return myLink->DimensionAspect(); |
412 | } |
413 | if (myDimensionAspect.IsNull()) |
414 | { |
415 | myDimensionAspect = new Prs3d_DimensionAspect; |
416 | } |
417 | } |
418 | return myDimensionAspect; |
7fd59977 |
419 | } |
420 | |
6262338c |
421 | // ======================================================================= |
422 | // function : SetDimensionAspect |
423 | // purpose : |
424 | // ======================================================================= |
7fd59977 |
425 | |
6262338c |
426 | void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect) |
427 | { |
428 | myDimensionAspect = theAspect; |
429 | myHasOwnDimensionAspect = !myDimensionAspect.IsNull(); |
7fd59977 |
430 | } |
431 | |
6262338c |
432 | // ======================================================================= |
433 | // function : SetDimLengthModelUnits |
434 | // purpose : |
435 | // ======================================================================= |
7fd59977 |
436 | |
6262338c |
437 | void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits) |
438 | { |
439 | myHasOwnDimLengthModelUnits = Standard_True; |
440 | myDimensionModelUnits.SetLengthUnits (theUnits); |
7fd59977 |
441 | } |
442 | |
6262338c |
443 | // ======================================================================= |
444 | // function : SetDimAngleModelUnits |
445 | // purpose : |
446 | // ======================================================================= |
7fd59977 |
447 | |
6262338c |
448 | void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits) |
449 | { |
450 | myHasOwnDimAngleModelUnits = Standard_True; |
451 | myDimensionModelUnits.SetAngleUnits (theUnits); |
7fd59977 |
452 | } |
453 | |
6262338c |
454 | // ======================================================================= |
455 | // function : SetDimLengthDisplayUnits |
456 | // purpose : |
457 | // ======================================================================= |
458 | |
459 | void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits) |
460 | { |
461 | myHasOwnDimLengthDisplayUnits = Standard_True; |
462 | myDimensionDisplayUnits.SetLengthUnits (theUnits); |
7fd59977 |
463 | } |
464 | |
6262338c |
465 | // ======================================================================= |
466 | // function : SetDimAngleDisplayUnits |
467 | // purpose : |
468 | // ======================================================================= |
7fd59977 |
469 | |
6262338c |
470 | void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits) |
471 | { |
472 | myHasOwnDimAngleDisplayUnits = Standard_True; |
473 | myDimensionDisplayUnits.SetAngleUnits (theUnits); |
7fd59977 |
474 | } |
475 | |
6262338c |
476 | // ======================================================================= |
477 | // function : UIsoAspect |
478 | // purpose : |
479 | // ======================================================================= |
480 | |
481 | const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect() |
482 | { |
483 | if (!HasOwnUIsoAspect()) |
484 | { |
485 | if (!myLink.IsNull()) |
486 | { |
487 | return myLink->UIsoAspect(); |
488 | } |
489 | if (myUIsoAspect.IsNull()) |
490 | { |
1b9f5d95 |
491 | myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1); |
6262338c |
492 | } |
493 | } |
494 | return myUIsoAspect; |
7fd59977 |
495 | } |
496 | |
6262338c |
497 | // ======================================================================= |
498 | // function : SetUIsoAspect |
499 | // purpose : |
500 | // ======================================================================= |
7fd59977 |
501 | |
6262338c |
502 | void Prs3d_Drawer::SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect) |
503 | { |
504 | myUIsoAspect = theAspect; |
505 | myHasOwnUIsoAspect = !myUIsoAspect.IsNull(); |
7fd59977 |
506 | } |
507 | |
6262338c |
508 | // ======================================================================= |
509 | // function : VIsoAspect |
510 | // purpose : |
511 | // ======================================================================= |
7fd59977 |
512 | |
6262338c |
513 | const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect() |
514 | { |
515 | if (!HasOwnVIsoAspect()) |
516 | { |
517 | if (!myLink.IsNull()) |
518 | { |
519 | return myLink->VIsoAspect(); |
520 | } |
521 | if (myVIsoAspect.IsNull()) |
522 | { |
1b9f5d95 |
523 | myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1); |
6262338c |
524 | } |
525 | } |
526 | return myVIsoAspect; |
7fd59977 |
527 | } |
528 | |
6262338c |
529 | // ======================================================================= |
530 | // function : SetVIsoAspect |
531 | // purpose : |
532 | // ======================================================================= |
7fd59977 |
533 | |
6262338c |
534 | void Prs3d_Drawer::SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect) |
535 | { |
536 | myVIsoAspect = theAspect; |
537 | myHasOwnVIsoAspect= !myVIsoAspect.IsNull(); |
7fd59977 |
538 | } |
7fd59977 |
539 | |
6262338c |
540 | // ======================================================================= |
541 | // function : WireAspect |
542 | // purpose : |
543 | // ======================================================================= |
544 | |
545 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::WireAspect() |
546 | { |
547 | if (!HasOwnWireAspect()) |
548 | { |
549 | if (!myLink.IsNull()) |
550 | { |
551 | return myLink->WireAspect(); |
552 | } |
553 | if (myWireAspect.IsNull()) |
554 | { |
2a332745 |
555 | myWireAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Wire, Aspect_TOL_SOLID, 1.0); |
6262338c |
556 | } |
557 | } |
558 | return myWireAspect; |
7fd59977 |
559 | } |
560 | |
6262338c |
561 | // ======================================================================= |
562 | // function : SetWireAspect |
563 | // purpose : |
564 | // ======================================================================= |
7fd59977 |
565 | |
6262338c |
566 | void Prs3d_Drawer::SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect) |
567 | { |
568 | myWireAspect = theAspect; |
569 | myHasOwnWireAspect = !myWireAspect.IsNull(); |
7fd59977 |
570 | } |
571 | |
6262338c |
572 | // ======================================================================= |
573 | // function : SetWireDraw |
574 | // purpose : |
575 | // ======================================================================= |
576 | |
577 | void Prs3d_Drawer::SetWireDraw (const Standard_Boolean theIsEnabled) |
578 | { |
579 | myHasOwnWireDraw = Standard_True; |
580 | myWireDraw = theIsEnabled; |
7fd59977 |
581 | } |
582 | |
6262338c |
583 | // ======================================================================= |
584 | // function : PointAspect |
585 | // purpose : |
586 | // ======================================================================= |
7fd59977 |
587 | |
6262338c |
588 | const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect() |
589 | { |
590 | if (!HasOwnPointAspect()) |
591 | { |
592 | if (!myLink.IsNull()) |
593 | { |
594 | return myLink->PointAspect(); |
595 | } |
596 | if (myPointAspect.IsNull()) |
597 | { |
598 | myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0); |
599 | } |
600 | } |
7fd59977 |
601 | return myPointAspect; |
602 | } |
603 | |
2a332745 |
604 | // ======================================================================= |
605 | // function : SetupOwnPointAspect |
606 | // purpose : |
607 | // ======================================================================= |
608 | Standard_Boolean Prs3d_Drawer::SetupOwnPointAspect (const Handle(Prs3d_Drawer)& theDefaults) |
609 | { |
610 | if (myHasOwnPointAspect) |
611 | { |
612 | return Standard_False; |
613 | } |
614 | |
615 | myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0); |
616 | if (!theDefaults.IsNull() && theDefaults != this) |
617 | { |
618 | *myPointAspect->Aspect() = *theDefaults->PointAspect()->Aspect(); |
619 | } |
620 | else if (!myLink.IsNull()) |
621 | { |
622 | *myPointAspect->Aspect() = *myLink->PointAspect()->Aspect(); |
623 | } |
624 | myHasOwnPointAspect = Standard_True; |
625 | return Standard_True; |
626 | } |
627 | |
6262338c |
628 | // ======================================================================= |
629 | // function : SetPointAspect |
630 | // purpose : |
631 | // ======================================================================= |
7fd59977 |
632 | |
6262338c |
633 | void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) |
53b15292 |
634 | { |
6262338c |
635 | myPointAspect = theAspect; |
636 | myHasOwnPointAspect = !myPointAspect.IsNull(); |
53b15292 |
637 | } |
638 | |
6262338c |
639 | // ======================================================================= |
640 | // function : LineAspect |
641 | // purpose : |
642 | // ======================================================================= |
643 | |
644 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect() |
53b15292 |
645 | { |
6262338c |
646 | if (!HasOwnLineAspect()) |
647 | { |
648 | if (!myLink.IsNull()) |
649 | { |
650 | return myLink->LineAspect(); |
651 | } |
652 | if (myLineAspect.IsNull()) |
653 | { |
2a332745 |
654 | myLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Line, Aspect_TOL_SOLID, 1.0); |
6262338c |
655 | } |
656 | } |
657 | return myLineAspect; |
53b15292 |
658 | } |
659 | |
6262338c |
660 | // ======================================================================= |
661 | // function : SetLineAspect |
662 | // purpose : |
663 | // ======================================================================= |
7fd59977 |
664 | |
6262338c |
665 | void Prs3d_Drawer::SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect) |
666 | { |
667 | myLineAspect = theAspect; |
668 | myHasOwnLineAspect = !myLineAspect.IsNull(); |
7fd59977 |
669 | } |
670 | |
6262338c |
671 | // ======================================================================= |
672 | // function : TextAspect |
673 | // purpose : |
674 | // ======================================================================= |
7fd59977 |
675 | |
6262338c |
676 | const Handle(Prs3d_TextAspect)& Prs3d_Drawer::TextAspect() |
677 | { |
678 | if (!HasOwnTextAspect()) |
679 | { |
680 | if (!myLink.IsNull()) |
681 | { |
682 | return myLink->TextAspect(); |
683 | } |
684 | if (myTextAspect.IsNull()) |
685 | { |
686 | myTextAspect = new Prs3d_TextAspect(); |
687 | } |
688 | } |
689 | return myTextAspect; |
7fd59977 |
690 | } |
691 | |
6262338c |
692 | // ======================================================================= |
693 | // function : SetTextAspect |
694 | // purpose : |
695 | // ======================================================================= |
7fd59977 |
696 | |
6262338c |
697 | void Prs3d_Drawer::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect) |
698 | { |
699 | myTextAspect = theAspect; |
700 | myHasOwnTextAspect = !myTextAspect.IsNull(); |
7fd59977 |
701 | } |
702 | |
6262338c |
703 | // ======================================================================= |
704 | // function : ShadingAspect |
705 | // purpose : |
706 | // ======================================================================= |
707 | |
708 | const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect() |
709 | { |
710 | if (!HasOwnShadingAspect()) |
711 | { |
712 | if (!myLink.IsNull()) |
713 | { |
714 | return myLink->ShadingAspect(); |
715 | } |
716 | if (myShadingAspect.IsNull()) |
717 | { |
718 | myShadingAspect = new Prs3d_ShadingAspect(); |
719 | } |
720 | } |
721 | return myShadingAspect; |
7fd59977 |
722 | } |
723 | |
2a332745 |
724 | // ======================================================================= |
725 | // function : SetupOwnShadingAspect |
726 | // purpose : |
727 | // ======================================================================= |
728 | Standard_Boolean Prs3d_Drawer::SetupOwnShadingAspect (const Handle(Prs3d_Drawer)& theDefaults) |
729 | { |
730 | if (myHasOwnShadingAspect) |
731 | { |
732 | return Standard_False; |
733 | } |
734 | |
735 | myShadingAspect = new Prs3d_ShadingAspect(); |
736 | if (!theDefaults.IsNull() && theDefaults != this) |
737 | { |
738 | *myShadingAspect->Aspect() = *theDefaults->ShadingAspect()->Aspect(); |
739 | } |
740 | else if (!myLink.IsNull()) |
741 | { |
742 | *myShadingAspect->Aspect() = *myLink->ShadingAspect()->Aspect(); |
743 | } |
744 | myHasOwnShadingAspect = Standard_True; |
745 | return Standard_True; |
746 | } |
747 | |
6262338c |
748 | // ======================================================================= |
749 | // function : SetShadingAspect |
750 | // purpose : |
751 | // ======================================================================= |
7fd59977 |
752 | |
6262338c |
753 | void Prs3d_Drawer::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect) |
754 | { |
755 | myShadingAspect = theAspect; |
756 | myHasOwnShadingAspect = !myShadingAspect.IsNull(); |
7fd59977 |
757 | } |
758 | |
6262338c |
759 | // ======================================================================= |
760 | // function : PlaneAspect |
761 | // purpose : |
762 | // ======================================================================= |
7fd59977 |
763 | |
6262338c |
764 | const Handle(Prs3d_PlaneAspect)& Prs3d_Drawer::PlaneAspect() |
765 | { |
766 | if (!HasOwnPlaneAspect()) |
767 | { |
768 | if (!myLink.IsNull()) |
769 | { |
770 | return myLink->PlaneAspect(); |
771 | } |
772 | if (myPlaneAspect.IsNull()) |
773 | { |
774 | myPlaneAspect = new Prs3d_PlaneAspect(); |
775 | } |
776 | } |
7fd59977 |
777 | return myPlaneAspect; |
778 | } |
779 | |
6262338c |
780 | // ======================================================================= |
781 | // function : SetPlaneAspect |
782 | // purpose : |
783 | // ======================================================================= |
784 | |
785 | void Prs3d_Drawer::SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect) |
786 | { |
787 | myPlaneAspect = theAspect; |
788 | myHasOwnPlaneAspect = !myPlaneAspect.IsNull(); |
7fd59977 |
789 | } |
790 | |
60bf98ae |
791 | // ======================================================================= |
6262338c |
792 | // function : SeenLineAspect |
60bf98ae |
793 | // purpose : |
794 | // ======================================================================= |
6262338c |
795 | |
796 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect() |
a6eb515f |
797 | { |
6262338c |
798 | if (!HasOwnSeenLineAspect()) |
60bf98ae |
799 | { |
6262338c |
800 | if (!myLink.IsNull()) |
801 | { |
802 | return myLink->SeenLineAspect(); |
803 | } |
804 | if (mySeenLineAspect.IsNull()) |
805 | { |
2a332745 |
806 | mySeenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_SeenLine, Aspect_TOL_SOLID, 1.0); |
6262338c |
807 | } |
60bf98ae |
808 | } |
6262338c |
809 | return mySeenLineAspect; |
7fd59977 |
810 | } |
811 | |
60bf98ae |
812 | // ======================================================================= |
6262338c |
813 | // function : SetSeenLineAspect |
60bf98ae |
814 | // purpose : |
815 | // ======================================================================= |
6262338c |
816 | |
817 | void Prs3d_Drawer::SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) |
60bf98ae |
818 | { |
6262338c |
819 | mySeenLineAspect = theAspect; |
820 | myHasOwnSeenLineAspect = !mySeenLineAspect.IsNull(); |
60bf98ae |
821 | } |
822 | |
823 | // ======================================================================= |
6262338c |
824 | // function : ArrowAspect |
60bf98ae |
825 | // purpose : |
826 | // ======================================================================= |
6262338c |
827 | |
828 | const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect() |
60bf98ae |
829 | { |
6262338c |
830 | if (!HasOwnArrowAspect()) |
831 | { |
832 | if (!myLink.IsNull()) |
833 | { |
834 | return myLink->ArrowAspect(); |
835 | } |
836 | if (myArrowAspect.IsNull()) |
837 | { |
838 | myArrowAspect = new Prs3d_ArrowAspect(); |
839 | } |
840 | } |
841 | return myArrowAspect; |
60bf98ae |
842 | } |
843 | |
844 | // ======================================================================= |
6262338c |
845 | // function : SetArrowAspect |
60bf98ae |
846 | // purpose : |
847 | // ======================================================================= |
6262338c |
848 | |
849 | void Prs3d_Drawer::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) |
60bf98ae |
850 | { |
6262338c |
851 | myArrowAspect = theAspect; |
852 | myHasOwnArrowAspect = !myArrowAspect.IsNull(); |
60bf98ae |
853 | } |
854 | |
855 | // ======================================================================= |
6262338c |
856 | // function : SetLineArrowDraw |
60bf98ae |
857 | // purpose : |
858 | // ======================================================================= |
6262338c |
859 | |
860 | void Prs3d_Drawer::SetLineArrowDraw (const Standard_Boolean theIsEnabled) |
60bf98ae |
861 | { |
6262338c |
862 | myHasOwnLineArrowDraw = Standard_True; |
863 | myLineArrowDraw = theIsEnabled; |
60bf98ae |
864 | } |
865 | |
866 | // ======================================================================= |
6262338c |
867 | // function : HiddenLineAspect |
60bf98ae |
868 | // purpose : |
869 | // ======================================================================= |
6262338c |
870 | |
871 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect() |
60bf98ae |
872 | { |
6262338c |
873 | if (!HasOwnHiddenLineAspect()) |
874 | { |
875 | if (!myLink.IsNull()) |
876 | { |
877 | return myLink->HiddenLineAspect(); |
878 | } |
879 | if (myHiddenLineAspect.IsNull()) |
880 | { |
2a332745 |
881 | myHiddenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_HiddenLine, Aspect_TOL_DASH, 1.0); |
6262338c |
882 | } |
883 | } |
884 | return myHiddenLineAspect; |
60bf98ae |
885 | } |
886 | |
887 | // ======================================================================= |
6262338c |
888 | // function : SetHiddenLineAspect |
60bf98ae |
889 | // purpose : |
890 | // ======================================================================= |
6262338c |
891 | |
892 | void Prs3d_Drawer::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) |
60bf98ae |
893 | { |
6262338c |
894 | myHiddenLineAspect = theAspect; |
895 | myHasOwnHiddenLineAspect = !myHiddenLineAspect.IsNull(); |
60bf98ae |
896 | } |
897 | |
898 | // ======================================================================= |
6262338c |
899 | // function : EnableDrawHiddenLineDraw |
60bf98ae |
900 | // purpose : |
901 | // ======================================================================= |
6262338c |
902 | |
903 | void Prs3d_Drawer::EnableDrawHiddenLine() |
60bf98ae |
904 | { |
6262338c |
905 | myHasOwnDrawHiddenLine = Standard_True; |
906 | myDrawHiddenLine = Standard_True; |
60bf98ae |
907 | } |
908 | |
909 | // ======================================================================= |
6262338c |
910 | // function : DisableDrawHiddenLine |
60bf98ae |
911 | // purpose : |
912 | // ======================================================================= |
6262338c |
913 | |
914 | void Prs3d_Drawer::DisableDrawHiddenLine() |
a6eb515f |
915 | { |
6262338c |
916 | myHasOwnDrawHiddenLine = Standard_True; |
917 | myDrawHiddenLine = Standard_False; |
7fd59977 |
918 | } |
919 | |
60bf98ae |
920 | // ======================================================================= |
6262338c |
921 | // function : VectorAspect |
60bf98ae |
922 | // purpose : |
923 | // ======================================================================= |
6262338c |
924 | |
925 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect() |
60bf98ae |
926 | { |
6262338c |
927 | if (!HasOwnVectorAspect()) |
928 | { |
929 | if (!myLink.IsNull()) |
930 | { |
931 | return myLink->VectorAspect(); |
932 | } |
933 | if (myVectorAspect.IsNull()) |
934 | { |
2a332745 |
935 | myVectorAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Vector, Aspect_TOL_SOLID, 1.0); |
6262338c |
936 | } |
937 | } |
938 | return myVectorAspect; |
60bf98ae |
939 | } |
7fd59977 |
940 | |
60bf98ae |
941 | // ======================================================================= |
6262338c |
942 | // function : SetVectorAspect |
60bf98ae |
943 | // purpose : |
944 | // ======================================================================= |
7fd59977 |
945 | |
6262338c |
946 | void Prs3d_Drawer::SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect) |
947 | { |
948 | myVectorAspect = theAspect; |
949 | myHasOwnVectorAspect = !myVectorAspect.IsNull(); |
7fd59977 |
950 | } |
951 | |
60bf98ae |
952 | // ======================================================================= |
6262338c |
953 | // function : SetVertexDrawMode |
60bf98ae |
954 | // purpose : |
955 | // ======================================================================= |
6262338c |
956 | |
957 | void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode) |
60bf98ae |
958 | { |
6262338c |
959 | // Prs3d_VDM_Inherited is default value and means |
960 | // that correct value should be taken from the Link if it exists. |
961 | myVertexDrawMode = theMode; |
7fd59977 |
962 | } |
a2d5ab2e |
963 | |
964 | // ======================================================================= |
6262338c |
965 | // function : VertexDrawMode |
a2d5ab2e |
966 | // purpose : |
967 | // ======================================================================= |
6262338c |
968 | |
969 | Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode() |
a2d5ab2e |
970 | { |
6262338c |
971 | if (!HasOwnVertexDrawMode()) |
972 | { |
973 | if (!myLink.IsNull()) |
974 | { |
975 | return myLink->VertexDrawMode(); |
976 | } |
977 | // Prs3d_VDM_Isolated is default value for this setting. |
978 | myVertexDrawMode = Prs3d_VDM_Isolated; |
979 | } |
980 | return myVertexDrawMode; |
a2d5ab2e |
981 | } |
982 | |
983 | // ======================================================================= |
6262338c |
984 | // function : DatumAspect |
a2d5ab2e |
985 | // purpose : |
986 | // ======================================================================= |
6262338c |
987 | |
988 | const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect() |
a2d5ab2e |
989 | { |
6262338c |
990 | if (!HasOwnDatumAspect()) |
991 | { |
992 | if (!myLink.IsNull()) |
993 | { |
994 | return myLink->DatumAspect(); |
995 | } |
996 | if (myDatumAspect.IsNull()) |
997 | { |
998 | myDatumAspect = new Prs3d_DatumAspect(); |
999 | } |
1000 | } |
1001 | return myDatumAspect; |
a2d5ab2e |
1002 | } |
1003 | |
1004 | // ======================================================================= |
6262338c |
1005 | // function : SetDatumAspect |
a2d5ab2e |
1006 | // purpose : |
1007 | // ======================================================================= |
6262338c |
1008 | |
1009 | void Prs3d_Drawer::SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect) |
a2d5ab2e |
1010 | { |
6262338c |
1011 | myDatumAspect = theAspect; |
1012 | myHasOwnDatumAspect = !myDatumAspect.IsNull(); |
a2d5ab2e |
1013 | } |
1014 | |
1015 | // ======================================================================= |
6262338c |
1016 | // function : SectionAspect |
a2d5ab2e |
1017 | // purpose : |
1018 | // ======================================================================= |
6262338c |
1019 | |
1020 | const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect() |
a2d5ab2e |
1021 | { |
6262338c |
1022 | if (!HasOwnSectionAspect()) |
a2d5ab2e |
1023 | { |
6262338c |
1024 | if (!myLink.IsNull()) |
1025 | { |
1026 | return myLink->SectionAspect(); |
1027 | } |
1028 | if (mySectionAspect.IsNull()) |
1029 | { |
2a332745 |
1030 | mySectionAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Section, Aspect_TOL_SOLID, 1.0); |
6262338c |
1031 | } |
a2d5ab2e |
1032 | } |
6262338c |
1033 | return mySectionAspect; |
a2d5ab2e |
1034 | } |
0a768f56 |
1035 | |
1036 | // ======================================================================= |
6262338c |
1037 | // function : SetSectionAspect |
1038 | // purpose : |
0a768f56 |
1039 | // ======================================================================= |
6262338c |
1040 | |
1041 | void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect) |
0a768f56 |
1042 | { |
6262338c |
1043 | mySectionAspect = theAspect; |
1044 | myHasOwnSectionAspect = !mySectionAspect.IsNull(); |
0a768f56 |
1045 | } |
1046 | |
1047 | // ======================================================================= |
6262338c |
1048 | // function : SetSectionAspect |
1049 | // purpose : |
0a768f56 |
1050 | // ======================================================================= |
6262338c |
1051 | |
1052 | void Prs3d_Drawer::ClearLocalAttributes() |
0a768f56 |
1053 | { |
6262338c |
1054 | if (myLink.IsNull()) |
1055 | { |
1056 | return; |
1057 | } |
1058 | |
1059 | myUIsoAspect.Nullify(); |
1060 | myVIsoAspect.Nullify(); |
1061 | myFreeBoundaryAspect.Nullify(); |
1062 | myUnFreeBoundaryAspect.Nullify(); |
1063 | myFaceBoundaryAspect.Nullify(); |
1064 | myWireAspect.Nullify(); |
1065 | myLineAspect.Nullify(); |
1066 | myTextAspect.Nullify(); |
1067 | myShadingAspect.Nullify(); |
1068 | myPointAspect.Nullify(); |
1069 | myPlaneAspect.Nullify(); |
1070 | myArrowAspect.Nullify(); |
1071 | myHiddenLineAspect.Nullify(); |
1072 | mySeenLineAspect.Nullify(); |
1073 | myVectorAspect .Nullify(); |
1074 | myDatumAspect.Nullify(); |
1075 | myDimensionAspect.Nullify(); |
1076 | mySectionAspect.Nullify(); |
1077 | |
1078 | myHasOwnUIsoAspect = Standard_False; |
1079 | myHasOwnVIsoAspect = Standard_False; |
1080 | myHasOwnWireAspect = Standard_False; |
1081 | myHasOwnPointAspect = Standard_False; |
1082 | myHasOwnLineAspect = Standard_False; |
1083 | myHasOwnTextAspect = Standard_False; |
1084 | myHasOwnShadingAspect = Standard_False; |
1085 | myHasOwnPlaneAspect = Standard_False; |
1086 | myHasOwnSeenLineAspect = Standard_False; |
1087 | myHasOwnArrowAspect = Standard_False; |
1088 | myHasOwnHiddenLineAspect = Standard_False; |
1089 | myHasOwnVectorAspect = Standard_False; |
1090 | myHasOwnDatumAspect = Standard_False; |
1091 | myHasOwnSectionAspect = Standard_False; |
1092 | myHasOwnFreeBoundaryAspect = Standard_False; |
1093 | myHasOwnUnFreeBoundaryAspect = Standard_False; |
1094 | myHasOwnFaceBoundaryAspect = Standard_False; |
1095 | myHasOwnDimensionAspect = Standard_False; |
1096 | |
1097 | myHasOwnNbPoints = Standard_False; |
1098 | myHasOwnMaximalParameterValue = Standard_False; |
1099 | myHasOwnTypeOfDeflection = Standard_False; |
1100 | myHasOwnChordialDeviation = Standard_False; |
1101 | myHasOwnDeviationCoefficient = Standard_False; |
1102 | myHasOwnHLRDeviationCoefficient = Standard_False; |
1103 | myHasOwnDeviationAngle = Standard_False; |
1104 | myHasOwnHLRDeviationAngle = Standard_False; |
1105 | myHasOwnIsoOnPlane = Standard_False; |
5ad8c033 |
1106 | myHasOwnIsoOnTriangulation = Standard_False; |
4c513386 |
1107 | myHasOwnIsAutoTriangulated = Standard_False; |
6262338c |
1108 | myHasOwnWireDraw = Standard_False; |
6262338c |
1109 | myHasOwnLineArrowDraw = Standard_False; |
1110 | myHasOwnDrawHiddenLine = Standard_False; |
1111 | myHasOwnFreeBoundaryDraw = Standard_False; |
1112 | myHasOwnUnFreeBoundaryDraw = Standard_False; |
1113 | myHasOwnFaceBoundaryDraw = Standard_False; |
1114 | myHasOwnDimLengthModelUnits = Standard_False; |
1115 | myHasOwnDimLengthDisplayUnits = Standard_False; |
1116 | myHasOwnDimAngleModelUnits = Standard_False; |
1117 | myHasOwnDimAngleDisplayUnits = Standard_False; |
1118 | |
1119 | myVertexDrawMode = Prs3d_VDM_Inherited; |
1120 | myTypeOfHLR = Prs3d_TOH_NotSet; |
0a768f56 |
1121 | } |
fb66bb28 |
1122 | |
2a332745 |
1123 | // ======================================================================= |
1124 | // function : SetOwnLineAspects |
1125 | // purpose : |
1126 | // ======================================================================= |
1127 | Standard_Boolean Prs3d_Drawer::SetOwnLineAspects (const Handle(Prs3d_Drawer)& theDefaults) |
1128 | { |
1129 | bool isUpdateNeeded = false; |
1130 | const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink; |
1131 | if (!myHasOwnUIsoAspect) |
1132 | { |
1133 | isUpdateNeeded = true; |
1134 | myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1); |
1135 | if (!aLink.IsNull()) |
1136 | { |
1137 | *myUIsoAspect->Aspect() = *aLink->UIsoAspect()->Aspect(); |
1138 | myUIsoAspect->SetNumber (aLink->UIsoAspect()->Number()); |
1139 | } |
1140 | myHasOwnUIsoAspect = true; |
1141 | } |
1142 | if (!myHasOwnVIsoAspect) |
1143 | { |
1144 | isUpdateNeeded = true; |
1145 | myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1); |
1146 | if (!aLink.IsNull()) |
1147 | { |
1148 | *myVIsoAspect->Aspect() = *aLink->VIsoAspect()->Aspect(); |
1149 | myUIsoAspect->SetNumber (aLink->VIsoAspect()->Number()); |
1150 | } |
1151 | myHasOwnVIsoAspect = true; |
1152 | } |
1153 | if (!myHasOwnWireAspect) |
1154 | { |
1155 | isUpdateNeeded = true; |
1156 | myWireAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Wire, Aspect_TOL_SOLID, 1.0); |
1157 | myHasOwnWireAspect = true; |
1158 | if (!aLink.IsNull()) |
1159 | { |
1160 | *myWireAspect->Aspect() = *aLink->WireAspect()->Aspect(); |
1161 | } |
1162 | } |
1163 | if (!myHasOwnLineAspect) |
1164 | { |
1165 | isUpdateNeeded = true; |
1166 | myLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Line, Aspect_TOL_SOLID, 1.0); |
1167 | myHasOwnLineAspect = true; |
1168 | if (!aLink.IsNull()) |
1169 | { |
1170 | *myLineAspect->Aspect() = *aLink->LineAspect()->Aspect(); |
1171 | } |
1172 | } |
1173 | if (!myHasOwnSeenLineAspect) |
1174 | { |
1175 | isUpdateNeeded = true; |
1176 | mySeenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_SeenLine, Aspect_TOL_SOLID, 1.0); |
1177 | myHasOwnSeenLineAspect = true; |
1178 | if (!aLink.IsNull()) |
1179 | { |
1180 | *mySeenLineAspect->Aspect() = *aLink->SeenLineAspect()->Aspect(); |
1181 | } |
1182 | } |
1183 | if (!myHasOwnHiddenLineAspect) |
1184 | { |
1185 | isUpdateNeeded = true; |
1186 | myHiddenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_HiddenLine, Aspect_TOL_DASH, 1.0); |
1187 | myHasOwnHiddenLineAspect = true; |
1188 | if (!aLink.IsNull()) |
1189 | { |
1190 | *myHiddenLineAspect->Aspect() = *aLink->HiddenLineAspect()->Aspect(); |
1191 | } |
1192 | } |
1193 | if (!myHasOwnFreeBoundaryAspect) |
1194 | { |
1195 | isUpdateNeeded = true; |
1196 | myFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FreeBoundary, Aspect_TOL_SOLID, 1.0); |
1197 | myHasOwnFreeBoundaryAspect = true; |
1198 | if (!aLink.IsNull()) |
1199 | { |
1200 | *myFreeBoundaryAspect->Aspect() = *aLink->FreeBoundaryAspect()->Aspect(); |
1201 | } |
1202 | } |
1203 | if (!myHasOwnUnFreeBoundaryAspect) |
1204 | { |
1205 | isUpdateNeeded = true; |
1206 | myUnFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_UnFreeBoundary, Aspect_TOL_SOLID, 1.0); |
1207 | myHasOwnUnFreeBoundaryAspect = true; |
1208 | if (!aLink.IsNull()) |
1209 | { |
1210 | *myUnFreeBoundaryAspect->Aspect() = *aLink->UnFreeBoundaryAspect()->Aspect(); |
1211 | } |
1212 | } |
1213 | if (!myHasOwnFaceBoundaryAspect) |
1214 | { |
1215 | isUpdateNeeded = true; |
1216 | myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0); |
1217 | myHasOwnFaceBoundaryAspect = true; |
1218 | if (!aLink.IsNull()) |
1219 | { |
1220 | *myFaceBoundaryAspect->Aspect() = *aLink->FaceBoundaryAspect()->Aspect(); |
1221 | } |
1222 | } |
1223 | return isUpdateNeeded; |
1224 | } |
1225 | |
1226 | // ======================================================================= |
1227 | // function : SetOwnDatumAspects |
1228 | // purpose : |
1229 | // ======================================================================= |
1230 | Standard_Boolean Prs3d_Drawer::SetOwnDatumAspects (const Handle(Prs3d_Drawer)& theDefaults) |
fb66bb28 |
1231 | { |
2a332745 |
1232 | bool isUpdateNeeded = false; |
1233 | const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink; |
1234 | if (!myHasOwnVectorAspect) |
1235 | { |
1236 | isUpdateNeeded = true; |
1237 | myVectorAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Vector, Aspect_TOL_SOLID, 1.0); |
1238 | myHasOwnVectorAspect = true; |
1239 | if (!aLink.IsNull()) |
1240 | { |
1241 | *myVectorAspect->Aspect() = *aLink->VectorAspect()->Aspect(); |
1242 | } |
1243 | } |
1244 | if (!myHasOwnSectionAspect) |
1245 | { |
1246 | isUpdateNeeded = true; |
1247 | mySectionAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Section, Aspect_TOL_SOLID, 1.0); |
1248 | myHasOwnSectionAspect = true; |
1249 | if (!aLink.IsNull()) |
1250 | { |
1251 | *mySectionAspect->Aspect() = *aLink->SectionAspect()->Aspect(); |
1252 | } |
1253 | } |
1254 | if (!myHasOwnPlaneAspect) |
1255 | { |
1256 | isUpdateNeeded = true; |
1257 | myPlaneAspect = new Prs3d_PlaneAspect(); |
1258 | myHasOwnPlaneAspect = true; |
1259 | } |
1260 | if (!myHasOwnArrowAspect) |
1261 | { |
1262 | isUpdateNeeded = true; |
1263 | myArrowAspect = new Prs3d_ArrowAspect(); |
1264 | myHasOwnArrowAspect = true; |
1265 | } |
1266 | if (!myHasOwnDatumAspect) |
fb66bb28 |
1267 | { |
2a332745 |
1268 | isUpdateNeeded = true; |
1269 | myDatumAspect = new Prs3d_DatumAspect(); |
1270 | myHasOwnDatumAspect = true; |
fb66bb28 |
1271 | } |
2a332745 |
1272 | return isUpdateNeeded; |
fb66bb28 |
1273 | } |
1274 | |
1275 | //! Assign the shader program. |
1276 | template <typename T> |
1277 | inline void setAspectProgram (const Handle(Graphic3d_ShaderProgram)& theProgram, |
6ca8b614 |
1278 | bool theHasAspect, |
fb66bb28 |
1279 | T thePrsAspect) |
1280 | { |
6ca8b614 |
1281 | if (!thePrsAspect.IsNull() |
1282 | && theHasAspect) |
fb66bb28 |
1283 | { |
1284 | thePrsAspect->Aspect()->SetShaderProgram (theProgram); |
1285 | } |
1286 | } |
1287 | |
1288 | // ======================================================================= |
1289 | // function : SetShaderProgram |
1290 | // purpose : |
1291 | // ======================================================================= |
8e0a2b19 |
1292 | bool Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram, |
fb66bb28 |
1293 | const Graphic3d_GroupAspect theAspect, |
1294 | const bool theToOverrideDefaults) |
1295 | { |
8e0a2b19 |
1296 | bool isUpdateNeeded = false; |
fb66bb28 |
1297 | switch (theAspect) |
1298 | { |
1299 | case Graphic3d_ASPECT_LINE: |
1300 | { |
1301 | if (theToOverrideDefaults) |
1302 | { |
2a332745 |
1303 | isUpdateNeeded = SetOwnLineAspects() || isUpdateNeeded; |
1304 | isUpdateNeeded = SetOwnDatumAspects() || isUpdateNeeded; |
fb66bb28 |
1305 | } |
1306 | |
6ca8b614 |
1307 | setAspectProgram (theProgram, myHasOwnUIsoAspect, myUIsoAspect); |
1308 | setAspectProgram (theProgram, myHasOwnVIsoAspect, myVIsoAspect); |
1309 | setAspectProgram (theProgram, myHasOwnWireAspect, myWireAspect); |
1310 | setAspectProgram (theProgram, myHasOwnLineAspect, myLineAspect); |
1311 | setAspectProgram (theProgram, myHasOwnSeenLineAspect, mySeenLineAspect); |
1312 | setAspectProgram (theProgram, myHasOwnHiddenLineAspect, myHiddenLineAspect); |
1313 | setAspectProgram (theProgram, myHasOwnVectorAspect, myVectorAspect); |
1314 | setAspectProgram (theProgram, myHasOwnSectionAspect, mySectionAspect); |
1315 | setAspectProgram (theProgram, myHasOwnFreeBoundaryAspect, myFreeBoundaryAspect); |
1316 | setAspectProgram (theProgram, myHasOwnUnFreeBoundaryAspect, myUnFreeBoundaryAspect); |
1317 | setAspectProgram (theProgram, myHasOwnFaceBoundaryAspect, myFaceBoundaryAspect); |
1318 | if (myHasOwnPlaneAspect) |
fb66bb28 |
1319 | { |
6ca8b614 |
1320 | setAspectProgram (theProgram, true, myPlaneAspect->EdgesAspect()); |
1321 | setAspectProgram (theProgram, true, myPlaneAspect->IsoAspect()); |
1322 | setAspectProgram (theProgram, true, myPlaneAspect->ArrowAspect()); |
fb66bb28 |
1323 | } |
6ca8b614 |
1324 | if (myHasOwnDatumAspect) |
fb66bb28 |
1325 | { |
6ca8b614 |
1326 | setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_XAxis)); |
1327 | setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_YAxis)); |
1328 | setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_ZAxis)); |
fb66bb28 |
1329 | } |
6ca8b614 |
1330 | setAspectProgram (theProgram, myHasOwnArrowAspect, myArrowAspect); |
8e0a2b19 |
1331 | return isUpdateNeeded; |
fb66bb28 |
1332 | } |
1333 | case Graphic3d_ASPECT_TEXT: |
1334 | { |
1335 | if (theToOverrideDefaults |
6ca8b614 |
1336 | && !myHasOwnTextAspect) |
fb66bb28 |
1337 | { |
8e0a2b19 |
1338 | isUpdateNeeded = true; |
fb66bb28 |
1339 | myTextAspect = new Prs3d_TextAspect(); |
6ca8b614 |
1340 | myHasOwnTextAspect = true; |
fb66bb28 |
1341 | if (!myLink.IsNull()) |
1342 | { |
1343 | *myTextAspect->Aspect() = *myLink->TextAspect()->Aspect(); |
1344 | } |
1345 | } |
1346 | |
6ca8b614 |
1347 | setAspectProgram (theProgram, myHasOwnTextAspect, myTextAspect); |
8e0a2b19 |
1348 | return isUpdateNeeded; |
fb66bb28 |
1349 | } |
1350 | case Graphic3d_ASPECT_MARKER: |
1351 | { |
1352 | if (theToOverrideDefaults |
2a332745 |
1353 | && SetupOwnPointAspect()) |
fb66bb28 |
1354 | { |
8e0a2b19 |
1355 | isUpdateNeeded = true; |
fb66bb28 |
1356 | } |
1357 | |
6ca8b614 |
1358 | setAspectProgram (theProgram, myHasOwnPointAspect, myPointAspect); |
8e0a2b19 |
1359 | return isUpdateNeeded; |
fb66bb28 |
1360 | } |
1361 | case Graphic3d_ASPECT_FILL_AREA: |
1362 | { |
6ca8b614 |
1363 | if (theToOverrideDefaults |
2a332745 |
1364 | && SetupOwnShadingAspect()) |
fb66bb28 |
1365 | { |
8e0a2b19 |
1366 | isUpdateNeeded = true; |
fb66bb28 |
1367 | } |
6ca8b614 |
1368 | setAspectProgram (theProgram, myHasOwnShadingAspect, myShadingAspect); |
8e0a2b19 |
1369 | return isUpdateNeeded; |
fb66bb28 |
1370 | } |
1371 | } |
8e0a2b19 |
1372 | return false; |
fb66bb28 |
1373 | } |
dc89236f |
1374 | |
1375 | // ======================================================================= |
1376 | // function : SetShadingModel |
1377 | // purpose : |
1378 | // ======================================================================= |
1379 | bool Prs3d_Drawer::SetShadingModel (Graphic3d_TypeOfShadingModel theModel, |
1380 | bool theToOverrideDefaults) |
1381 | { |
1382 | bool isUpdateNeeded = false; |
1383 | |
1384 | if (theToOverrideDefaults |
2a332745 |
1385 | && SetupOwnShadingAspect()) |
dc89236f |
1386 | { |
1387 | isUpdateNeeded = true; |
dc89236f |
1388 | } |
1389 | |
1390 | if (!myShadingAspect.IsNull() |
1391 | && myHasOwnShadingAspect) |
1392 | { |
1393 | myShadingAspect->Aspect()->SetShadingModel (theModel); |
1394 | } |
1395 | |
1396 | return isUpdateNeeded; |
1397 | } |