Integration of OCCT 6.5.0 from SVN
[occt.git] / src / AIS / AIS_Drawer.cxx
CommitLineData
7fd59977 1#include <AIS_Drawer.ixx>
2#include <Standard_ProgramError.hxx>
3
4AIS_Drawer::AIS_Drawer():
5myLink(new Prs3d_Drawer()),
6hasLocalAttributes(Standard_False),
7myhasOwnDeviationCoefficient(Standard_False),
8myPreviousDeviationCoefficient(0.1),
9myhasOwnHLRDeviationCoefficient (Standard_False),
10myhasOwnDeviationAngle (Standard_False),
11myhasOwnHLRDeviationAngle (Standard_False)
12{
13 SetMaximalParameterValue(500000.);
14 myLink->SetMaximalParameterValue(500000.);
15}
16
17
18Aspect_TypeOfDeflection AIS_Drawer::TypeOfDeflection () const
19{
20 return myLink->TypeOfDeflection();
21}
22
23Standard_Boolean AIS_Drawer::IsoOnPlane() const
24{
25 return myLink->IsoOnPlane();
26}
27
28Standard_Integer AIS_Drawer::Discretisation() const
29{
30 return myLink->Discretisation();
31}
32
33Quantity_Length AIS_Drawer::MaximalChordialDeviation() const
34{
35 return myLink->MaximalChordialDeviation();
36}
37
38
39//=======================================================================
40//function : SetDeviationCoefficient
41//purpose :
42//=======================================================================
43
44void 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
57void 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
69void 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
81void 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
95Standard_Real AIS_Drawer::DeviationCoefficient () const
96{
97 return myhasOwnDeviationCoefficient? myOwnDeviationCoefficient :myLink->DeviationCoefficient();
98}
99
100//=======================================================================
101//function : HLRDeviationCoefficient
102//purpose :
103//=======================================================================
104
105Standard_Real AIS_Drawer::HLRDeviationCoefficient () const
106{
107 return myhasOwnHLRDeviationCoefficient?myOwnHLRDeviationCoefficient : myLink->HLRDeviationCoefficient() ;
108}
109
110//=======================================================================
111//function : DeviationAngle
112//purpose :
113//=======================================================================
114
115Standard_Real AIS_Drawer::DeviationAngle () const
116{
117 return myhasOwnDeviationAngle ? myOwnDeviationAngle : myLink->DeviationAngle();
118}
119
120//=======================================================================
121//function : HLRAngle
122//purpose :
123//=======================================================================
124
125Standard_Real AIS_Drawer::HLRAngle () const
126{
127
128 return myhasOwnHLRDeviationAngle ? myOwnHLRDeviationAngle : myLink->HLRAngle();
129}
130
131Standard_Real AIS_Drawer::MaximalParameterValue () const
132{ return myLink->MaximalParameterValue();}
133
134Handle (Prs3d_IsoAspect) AIS_Drawer::UIsoAspect ()
135{ return myUIsoAspect.IsNull() ? myLink->UIsoAspect (): myUIsoAspect;}
136
137Handle (Prs3d_IsoAspect) AIS_Drawer::VIsoAspect ()
138{ return myVIsoAspect.IsNull() ? myLink->VIsoAspect (): myVIsoAspect;}
139
140Handle (Prs3d_LineAspect) AIS_Drawer::FreeBoundaryAspect ()
141{return myFreeBoundaryAspect.IsNull() ? myLink->FreeBoundaryAspect (): myFreeBoundaryAspect;}
142
143Standard_Boolean AIS_Drawer::FreeBoundaryDraw () const
144{return myLink->FreeBoundaryDraw();}
145
146Handle (Prs3d_LineAspect) AIS_Drawer::UnFreeBoundaryAspect ()
147{return myUnFreeBoundaryAspect.IsNull() ? myLink->UnFreeBoundaryAspect (): myUnFreeBoundaryAspect;}
148
149Standard_Boolean AIS_Drawer::UnFreeBoundaryDraw () const
150{return myLink->UnFreeBoundaryDraw ();}
151
152Handle (Prs3d_LineAspect) AIS_Drawer::WireAspect ()
153{ return myWireAspect.IsNull()? myLink->WireAspect (): myWireAspect;}
154
155Standard_Boolean AIS_Drawer::WireDraw () const
156{ return myLink->WireDraw();}
157
158Handle (Prs3d_LineAspect) AIS_Drawer::LineAspect ()
159{ return myLineAspect.IsNull() ? myLink->LineAspect (): myLineAspect;}
160
161Handle (Prs3d_TextAspect) AIS_Drawer::TextAspect ()
162{ return myTextAspect.IsNull() ? myLink->TextAspect () : myTextAspect ;}
163
164Handle (Prs3d_ShadingAspect) AIS_Drawer::ShadingAspect ()
165{
166return myShadingAspect.IsNull() ? myLink->ShadingAspect () : myShadingAspect ;
167}
168
169Standard_Boolean AIS_Drawer::ShadingAspectGlobal() const
170{ return myLink->ShadingAspectGlobal();}
171
172
173Standard_Boolean AIS_Drawer::LineArrowDraw () const
174{ return myLink->LineArrowDraw();}
175
176Handle (Prs3d_ArrowAspect) AIS_Drawer::ArrowAspect()
177{return myArrowAspect.IsNull()? myLink->ArrowAspect () : myArrowAspect;}
178
179Handle (Prs3d_PointAspect) AIS_Drawer::PointAspect()
180{return myPointAspect.IsNull()? myLink->PointAspect () : myPointAspect;}
181
182Standard_Boolean AIS_Drawer::DrawHiddenLine () const
183{return myLink->DrawHiddenLine();}
184
185Handle (Prs3d_LineAspect) AIS_Drawer::HiddenLineAspect ()
186{return myHiddenLineAspect.IsNull()? myLink->HiddenLineAspect () : myHiddenLineAspect;}
187
188Handle (Prs3d_LineAspect) AIS_Drawer::SeenLineAspect ()
189{ return mySeenLineAspect.IsNull() ? myLink->SeenLineAspect (): mySeenLineAspect ;}
190
191Handle (Prs3d_LineAspect) AIS_Drawer::VectorAspect ()
192{return myVectorAspect.IsNull()? myLink->VectorAspect () : myVectorAspect;}
193
194Handle (Prs3d_DatumAspect) AIS_Drawer::DatumAspect ()
195{return myDatumAspect.IsNull()? myLink->DatumAspect () : myDatumAspect; }
196
197Handle (Prs3d_PlaneAspect) AIS_Drawer::PlaneAspect ()
198{return myPlaneAspect.IsNull() ? myLink->PlaneAspect (): myPlaneAspect;}
199
200Handle (Prs3d_LengthAspect) AIS_Drawer::LengthAspect ()
201{return myLengthAspect.IsNull()? myLink->LengthAspect () : myLengthAspect ;}
202
203
204Handle (Prs3d_AngleAspect) AIS_Drawer::AngleAspect ()
205{return myAngleAspect.IsNull()? myLink->AngleAspect () :myAngleAspect ;}
206
207
208Handle (Prs3d_RadiusAspect) AIS_Drawer::RadiusAspect () const
209{return myRadiusAspect.IsNull()? myLink->RadiusAspect():myRadiusAspect; }
210
211
212Handle (Prs3d_LineAspect) AIS_Drawer::SectionAspect ()
213{return mySectionAspect.IsNull()? myLink->SectionAspect (): mySectionAspect;}
214
215const Handle (Prs3d_Drawer)& AIS_Drawer::Link()
216{
217 if(myLink.IsNull()) myLink = new Prs3d_Drawer();
218 return myLink;
219 }
220
221void 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