2 * Project Info: http://jcae.sourceforge.net
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18 * (C) Copyright 2005, by EADS CRC
22 #include <Geom_Curve.hxx>
23 #include <Geom_Surface.hxx>
24 #include <Geom2d_Curve.hxx>
25 #include <Geom_Geometry.hxx>
26 #include <Geom2d_Geometry.hxx>
27 #include <Geom_BoundedCurve.hxx>
28 #include <Geom_BSplineCurve.hxx>
29 #include <Geom_TrimmedCurve.hxx>
32 %rename(Geom_Geometry) Handle_Geom_Geometry;
33 %rename(Geom_Curve) Handle_Geom_Curve;
34 %rename(Geom_Surface) Handle_Geom_Surface;
35 %rename(Geom2d_Geometry) Handle_Geom2d_Geometry;
36 %rename(Geom2d_Curve) Handle_Geom2d_Curve;
37 %rename(Geom_BoundedCurve) Handle_Geom_BoundedCurve;
38 %rename(Geom_BSplineCurve) Handle_Geom_BSplineCurve;
39 %rename(Geom_TrimmedCurve) Handle_Geom_TrimmedCurve;
40 class Handle_Geom_Geometry
42 Handle_Geom_Geometry()=0;
45 //FIXME: 7.3.0: this is a major flaw, handles cannot be directly casted. I've now added downcast() methods without testing..
46 //class Handle_Geom_Curve: public Handle_Geom_Geometry
47 class Handle_Geom_Curve
49 Handle_Geom_Curve()=0;
51 Handle_Geom_Curve downcast() {
56 %extend Handle_Geom_Curve
58 Standard_Real firstParameter()
60 return (*self)->FirstParameter();
63 Standard_Real lastParameter()
65 return (*self)->LastParameter();
68 Standard_Boolean isClosed()
70 return (*self)->IsClosed();
73 Standard_Boolean isPeriodic()
75 return (*self)->IsPeriodic();
78 Standard_Real period()
80 return (*self)->Period();
85 //class Handle_Geom_Surface: public Handle_Geom_Geometry
86 class Handle_Geom_Surface
88 Handle_Geom_Surface()=0;
90 Handle_Geom_Curve downcast() {
95 %extend Handle_Geom_Surface
97 gp_Pnt value(const Standard_Real U,const Standard_Real V) const
99 return (*self)->Value(U, V);
102 %javamethodmodifiers bounds(double bounds[4]) const "
104 * Return the bounds of the parameters of the surface.
105 * @param bounds an array of size 4 which will receive {Umin, Umax, Vmin, Vmax}
108 void bounds(double bounds[4]) const
110 (*self)->Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
113 %javamethodmodifiers bounds(Standard_Real&, Standard_Real&, Standard_Real&, Standard_Real&) const "
115 * @deprecated use bounds(double[]) , it do not need to allocate 4 arrays.
118 void bounds(Standard_Real& U1,Standard_Real& U2,Standard_Real& V1,Standard_Real& V2) const
120 (*self)->Bounds(U1,U2,V1,V2);
123 Standard_Boolean isUClosed() const
125 return (*self)->IsUClosed();
128 Standard_Boolean isVClosed() const
130 return (*self)->IsVClosed();
133 Handle_Geom_Curve uIso(const Standard_Real U) const
135 return (*self)->UIso(U);
138 Handle_Geom_Curve vIso(const Standard_Real V) const
140 return (*self)->VIso(V);
144 class Handle_Geom2d_Geometry
146 Handle_Geom2d_Geometry()=0;
150 //class Handle_Geom2d_Curve: public Handle_Geom2d_Geometry
151 class Handle_Geom2d_Curve
153 Handle_Geom2d_Curve()=0;
155 Handle_Geom2d_Geometry downcast() {
161 //class Handle_Geom_BoundedCurve : public Handle_Geom_Curve
162 class Handle_Geom_BoundedCurve
164 Handle_Geom_BoundedCurve()=0;
166 Handle_Geom_Curve downcast() {
172 //class Handle_Geom_BSplineCurve : public Handle_Geom_BoundedCurve
173 class Handle_Geom_BSplineCurve
175 Handle_Geom_BSplineCurve()=0;
177 Handle_Geom_BoundedCurve downcast() {
182 %extend Handle_Geom_BSplineCurve
184 //TODO check that this is not a big memory leak
185 Handle_Geom_BSplineCurve(const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights,
186 const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Multiplicities,
187 const Standard_Integer Degree, const Standard_Boolean Periodic = Standard_False,
188 const Standard_Boolean CheckRational = Standard_True){
189 return new Handle_Geom_BSplineCurve(new Geom_BSplineCurve(
190 Poles, Weights, Knots, Multiplicities, Degree, Periodic, CheckRational));
193 void setKnot(const Standard_Integer Index,const Standard_Real K)
195 (*self)->SetKnot(Index,K);
198 void setKnot(const Standard_Integer Index,const Standard_Real K,const Standard_Integer M)
200 (*self)->SetKnot(Index,K,M);
205 (*self)->SetPeriodic();
208 void setNotPeriodic()
210 (*self)->SetNotPeriodic();
213 void setOrigin(const Standard_Integer Index)
215 (*self)->SetOrigin(Index);
218 void setOrigin(const Standard_Real U,const Standard_Real Tol)
220 (*self)->SetOrigin(U,Tol);
223 void setPole(const Standard_Integer Index,const gp_Pnt& P)
225 (*self)->SetPole(Index,P);
228 void setPole(const Standard_Integer Index,const gp_Pnt& P,const Standard_Real Weight)
230 (*self)->SetPole(Index,P,Weight);
233 void movePoint(const Standard_Real U,const gp_Pnt& P,const Standard_Integer Index1,const Standard_Integer Index2,Standard_Integer& FirstModifiedPole,Standard_Integer& LastModifiedPole)
235 (*self)->MovePoint(U,P,Index1,Index2,FirstModifiedPole,LastModifiedPole);
238 void movePointAndTangent(const Standard_Real U,const gp_Pnt& P,const gp_Vec& Tangent,const Standard_Real Tolerance,const Standard_Integer StartingCondition,const Standard_Integer EndingCondition)
240 Standard_Integer ErrorStatus =0;
241 (*self)->MovePointAndTangent(U,P,Tangent,Tolerance,StartingCondition,EndingCondition,ErrorStatus);
244 Standard_Boolean isClosed() const
246 return (*self)->IsClosed();
249 Standard_Boolean isPeriodic() const
251 return (*self)->IsPeriodic();
254 Standard_Boolean isRational() const
256 return (*self)->IsRational();
259 GeomAbs_Shape continuity() const
261 return (*self)->Continuity();
264 Standard_Integer Degree() const
266 return (*self)->Degree();
270 gp_Vec dN(const Standard_Real U,const Standard_Integer N) const
272 return (*self)->DN(U,N);
276 gp_Pnt localValue(const Standard_Real U,const Standard_Integer FromK1,const Standard_Integer ToK2) const
278 return (*self)->LocalValue(U,FromK1,ToK2);
281 gp_Pnt endPoint() const
283 return (*self)->EndPoint();
286 gp_Pnt startPoint() const
288 return (*self)->StartPoint();
291 Standard_Integer nbKnots() const
293 return (*self)->NbKnots();
296 Standard_Integer nbPoles() const
298 return (*self)->NbPoles();
301 gp_Pnt pole(const Standard_Integer Index) const
303 return (*self)->Pole(Index);
306 Standard_Real weight(const Standard_Integer Index) const
308 return (*self)->Weight(Index);
314 //class Handle_Geom_TrimmedCurve : public Handle_Geom_BoundedCurve
315 class Handle_Geom_TrimmedCurve
317 Handle_Geom_TrimmedCurve()=0;
319 Handle_Geom_BoundedCurve downcast() {