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