7fd59977 |
1 | #include <AIS_Drawer.ixx> |
2 | #include <Standard_ProgramError.hxx> |
3 | |
4 | AIS_Drawer::AIS_Drawer(): |
5 | myLink(new Prs3d_Drawer()), |
6 | hasLocalAttributes(Standard_False), |
7 | myhasOwnDeviationCoefficient(Standard_False), |
8 | myPreviousDeviationCoefficient(0.1), |
9 | myhasOwnHLRDeviationCoefficient (Standard_False), |
10 | myhasOwnDeviationAngle (Standard_False), |
11 | myhasOwnHLRDeviationAngle (Standard_False) |
12 | { |
13 | SetMaximalParameterValue(500000.); |
14 | myLink->SetMaximalParameterValue(500000.); |
15 | } |
16 | |
17 | |
18 | Aspect_TypeOfDeflection AIS_Drawer::TypeOfDeflection () const |
19 | { |
20 | return myLink->TypeOfDeflection(); |
21 | } |
22 | |
23 | Standard_Boolean AIS_Drawer::IsoOnPlane() const |
24 | { |
25 | return myLink->IsoOnPlane(); |
26 | } |
27 | |
28 | Standard_Integer AIS_Drawer::Discretisation() const |
29 | { |
30 | return myLink->Discretisation(); |
31 | } |
32 | |
33 | Quantity_Length AIS_Drawer::MaximalChordialDeviation() const |
34 | { |
35 | return myLink->MaximalChordialDeviation(); |
36 | } |
37 | |
38 | |
39 | //======================================================================= |
40 | //function : SetDeviationCoefficient |
41 | //purpose : |
42 | //======================================================================= |
43 | |
44 | void AIS_Drawer::SetDeviationCoefficient ( const Standard_Real aCoefficient ) |
45 | { |
46 | myPreviousDeviationCoefficient = DeviationCoefficient() ; |
47 | myOwnDeviationCoefficient = aCoefficient ; |
48 | myhasOwnDeviationCoefficient = Standard_True; |
49 | } |
50 | |
51 | |
52 | //======================================================================= |
53 | //function : SetHLRDeviationCoefficient |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | void AIS_Drawer::SetHLRDeviationCoefficient ( const Standard_Real aCoefficient ) |
58 | { |
59 | myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient() ; |
60 | myOwnHLRDeviationCoefficient = aCoefficient ; |
61 | myhasOwnHLRDeviationCoefficient = Standard_True; |
62 | } |
63 | |
64 | //======================================================================= |
65 | //function : SetDeviationAngle |
66 | //purpose : |
67 | //======================================================================= |
68 | |
69 | void AIS_Drawer::SetDeviationAngle ( const Standard_Real anAngle ) |
70 | { |
71 | myPreviousDeviationAngle = DeviationAngle() ; |
72 | myOwnDeviationAngle = anAngle ; |
73 | myhasOwnDeviationAngle = Standard_True; |
74 | } |
75 | |
76 | //======================================================================= |
77 | //function : SetHLRAngle |
78 | //purpose : |
79 | //======================================================================= |
80 | |
81 | void AIS_Drawer::SetHLRAngle ( const Standard_Real anAngle ) |
82 | { |
83 | myPreviousHLRDeviationAngle = HLRAngle() ; |
84 | myOwnHLRDeviationAngle = anAngle ; |
85 | myhasOwnHLRDeviationAngle = Standard_True; |
86 | } |
87 | |
88 | |
89 | /////// Get |
90 | //======================================================================= |
91 | //function : DeviationCoefficient |
92 | //purpose : |
93 | //======================================================================= |
94 | |
95 | Standard_Real AIS_Drawer::DeviationCoefficient () const |
96 | { |
97 | return myhasOwnDeviationCoefficient? myOwnDeviationCoefficient :myLink->DeviationCoefficient(); |
98 | } |
99 | |
100 | //======================================================================= |
101 | //function : HLRDeviationCoefficient |
102 | //purpose : |
103 | //======================================================================= |
104 | |
105 | Standard_Real AIS_Drawer::HLRDeviationCoefficient () const |
106 | { |
107 | return myhasOwnHLRDeviationCoefficient?myOwnHLRDeviationCoefficient : myLink->HLRDeviationCoefficient() ; |
108 | } |
109 | |
110 | //======================================================================= |
111 | //function : DeviationAngle |
112 | //purpose : |
113 | //======================================================================= |
114 | |
115 | Standard_Real AIS_Drawer::DeviationAngle () const |
116 | { |
117 | return myhasOwnDeviationAngle ? myOwnDeviationAngle : myLink->DeviationAngle(); |
118 | } |
119 | |
120 | //======================================================================= |
121 | //function : HLRAngle |
122 | //purpose : |
123 | //======================================================================= |
124 | |
125 | Standard_Real AIS_Drawer::HLRAngle () const |
126 | { |
127 | |
128 | return myhasOwnHLRDeviationAngle ? myOwnHLRDeviationAngle : myLink->HLRAngle(); |
129 | } |
130 | |
131 | Standard_Real AIS_Drawer::MaximalParameterValue () const |
132 | { return myLink->MaximalParameterValue();} |
133 | |
134 | Handle (Prs3d_IsoAspect) AIS_Drawer::UIsoAspect () |
135 | { return myUIsoAspect.IsNull() ? myLink->UIsoAspect (): myUIsoAspect;} |
136 | |
137 | Handle (Prs3d_IsoAspect) AIS_Drawer::VIsoAspect () |
138 | { return myVIsoAspect.IsNull() ? myLink->VIsoAspect (): myVIsoAspect;} |
139 | |
140 | Handle (Prs3d_LineAspect) AIS_Drawer::FreeBoundaryAspect () |
141 | {return myFreeBoundaryAspect.IsNull() ? myLink->FreeBoundaryAspect (): myFreeBoundaryAspect;} |
142 | |
143 | Standard_Boolean AIS_Drawer::FreeBoundaryDraw () const |
144 | {return myLink->FreeBoundaryDraw();} |
145 | |
146 | Handle (Prs3d_LineAspect) AIS_Drawer::UnFreeBoundaryAspect () |
147 | {return myUnFreeBoundaryAspect.IsNull() ? myLink->UnFreeBoundaryAspect (): myUnFreeBoundaryAspect;} |
148 | |
149 | Standard_Boolean AIS_Drawer::UnFreeBoundaryDraw () const |
150 | {return myLink->UnFreeBoundaryDraw ();} |
151 | |
152 | Handle (Prs3d_LineAspect) AIS_Drawer::WireAspect () |
153 | { return myWireAspect.IsNull()? myLink->WireAspect (): myWireAspect;} |
154 | |
155 | Standard_Boolean AIS_Drawer::WireDraw () const |
156 | { return myLink->WireDraw();} |
157 | |
158 | Handle (Prs3d_LineAspect) AIS_Drawer::LineAspect () |
159 | { return myLineAspect.IsNull() ? myLink->LineAspect (): myLineAspect;} |
160 | |
161 | Handle (Prs3d_TextAspect) AIS_Drawer::TextAspect () |
162 | { return myTextAspect.IsNull() ? myLink->TextAspect () : myTextAspect ;} |
163 | |
164 | Handle (Prs3d_ShadingAspect) AIS_Drawer::ShadingAspect () |
165 | { |
166 | return myShadingAspect.IsNull() ? myLink->ShadingAspect () : myShadingAspect ; |
167 | } |
168 | |
169 | Standard_Boolean AIS_Drawer::ShadingAspectGlobal() const |
170 | { return myLink->ShadingAspectGlobal();} |
171 | |
172 | |
173 | Standard_Boolean AIS_Drawer::LineArrowDraw () const |
174 | { return myLink->LineArrowDraw();} |
175 | |
176 | Handle (Prs3d_ArrowAspect) AIS_Drawer::ArrowAspect() |
177 | {return myArrowAspect.IsNull()? myLink->ArrowAspect () : myArrowAspect;} |
178 | |
179 | Handle (Prs3d_PointAspect) AIS_Drawer::PointAspect() |
180 | {return myPointAspect.IsNull()? myLink->PointAspect () : myPointAspect;} |
181 | |
182 | Standard_Boolean AIS_Drawer::DrawHiddenLine () const |
183 | {return myLink->DrawHiddenLine();} |
184 | |
185 | Handle (Prs3d_LineAspect) AIS_Drawer::HiddenLineAspect () |
186 | {return myHiddenLineAspect.IsNull()? myLink->HiddenLineAspect () : myHiddenLineAspect;} |
187 | |
188 | Handle (Prs3d_LineAspect) AIS_Drawer::SeenLineAspect () |
189 | { return mySeenLineAspect.IsNull() ? myLink->SeenLineAspect (): mySeenLineAspect ;} |
190 | |
191 | Handle (Prs3d_LineAspect) AIS_Drawer::VectorAspect () |
192 | {return myVectorAspect.IsNull()? myLink->VectorAspect () : myVectorAspect;} |
193 | |
194 | Handle (Prs3d_DatumAspect) AIS_Drawer::DatumAspect () |
195 | {return myDatumAspect.IsNull()? myLink->DatumAspect () : myDatumAspect; } |
196 | |
197 | Handle (Prs3d_PlaneAspect) AIS_Drawer::PlaneAspect () |
198 | {return myPlaneAspect.IsNull() ? myLink->PlaneAspect (): myPlaneAspect;} |
199 | |
200 | Handle (Prs3d_LengthAspect) AIS_Drawer::LengthAspect () |
201 | {return myLengthAspect.IsNull()? myLink->LengthAspect () : myLengthAspect ;} |
202 | |
203 | |
204 | Handle (Prs3d_AngleAspect) AIS_Drawer::AngleAspect () |
205 | {return myAngleAspect.IsNull()? myLink->AngleAspect () :myAngleAspect ;} |
206 | |
207 | |
208 | Handle (Prs3d_RadiusAspect) AIS_Drawer::RadiusAspect () const |
209 | {return myRadiusAspect.IsNull()? myLink->RadiusAspect():myRadiusAspect; } |
210 | |
211 | |
212 | Handle (Prs3d_LineAspect) AIS_Drawer::SectionAspect () |
213 | {return mySectionAspect.IsNull()? myLink->SectionAspect (): mySectionAspect;} |
214 | |
215 | const Handle (Prs3d_Drawer)& AIS_Drawer::Link() |
216 | { |
217 | if(myLink.IsNull()) myLink = new Prs3d_Drawer(); |
218 | return myLink; |
219 | } |
220 | |
221 | void AIS_Drawer::ClearLocalAttributes() |
222 | { |
223 | if(myLink.IsNull()) return; |
224 | // attention pas beau.... |
225 | // The Handles |
226 | |
227 | if(!myUIsoAspect.IsNull()) myUIsoAspect.Nullify(); |
228 | if(!myVIsoAspect.IsNull()) myVIsoAspect.Nullify(); |
229 | if(!myFreeBoundaryAspect.IsNull()) myFreeBoundaryAspect.Nullify(); |
230 | if(!myUnFreeBoundaryAspect.IsNull()) myUnFreeBoundaryAspect.Nullify(); |
231 | if(!myWireAspect.IsNull()) myWireAspect.Nullify(); |
232 | if(!myLineAspect.IsNull()) myLineAspect.Nullify(); |
233 | if(!myTextAspect.IsNull()) myTextAspect.Nullify(); |
234 | if(!myShadingAspect.IsNull()) myShadingAspect.Nullify(); |
235 | if(!myPointAspect.IsNull()) myPointAspect.Nullify(); |
236 | if(!myPlaneAspect.IsNull()) myPlaneAspect.Nullify(); |
237 | if(!myArrowAspect.IsNull()) myArrowAspect.Nullify(); |
238 | if(!myHiddenLineAspect.IsNull()) myHiddenLineAspect.Nullify(); |
239 | if(!mySeenLineAspect.IsNull()) mySeenLineAspect.Nullify(); |
240 | if(!myVectorAspect.IsNull()) myVectorAspect .Nullify(); |
241 | if(!myDatumAspect.IsNull()) myDatumAspect.Nullify(); |
242 | if(!myLengthAspect.IsNull()) myLengthAspect.Nullify(); |
243 | if(!myAngleAspect.IsNull()) myAngleAspect.Nullify(); |
244 | if(!myRadiusAspect.IsNull()) myRadiusAspect.Nullify(); |
245 | if(!mySectionAspect.IsNull()) mySectionAspect.Nullify(); |
246 | if( myhasOwnHLRDeviationCoefficient ) myhasOwnHLRDeviationCoefficient = Standard_False; |
247 | if(myhasOwnHLRDeviationAngle ) myhasOwnHLRDeviationAngle = Standard_False; |
248 | |
249 | hasLocalAttributes = Standard_False; |
250 | |
251 | } |
252 | |
253 | |