]> gerrit.simantics Code Review - simantics/3d.git/blob - org.jcae.opencascade/src/Geom.i
Updated OpenCASCADE to 7.3.0
[simantics/3d.git] / org.jcae.opencascade / src / Geom.i
1 /*
2  * Project Info:  http://jcae.sourceforge.net
3  * 
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)
7  * any later version.
8  *
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
12  * details.
13  *
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.
17  *
18  * (C) Copyright 2005, by EADS CRC
19  */
20
21 %{
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>
30 %}
31
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
41 {
42         Handle_Geom_Geometry()=0;
43 };
44
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
48 {
49         Handle_Geom_Curve()=0;
50         
51         Handle_Geom_Curve downcast() {
52            return (*self);
53         }       
54 };
55
56 %extend Handle_Geom_Curve
57 {
58         Standard_Real firstParameter()
59         {
60                 return (*self)->FirstParameter();
61         }
62         
63         Standard_Real lastParameter()
64         {
65                 return (*self)->LastParameter();
66         }
67         
68         Standard_Boolean isClosed()
69         {
70                 return (*self)->IsClosed();
71         }
72         
73         Standard_Boolean isPeriodic()
74         {
75                 return (*self)->IsPeriodic();
76         }
77         
78         Standard_Real period()
79         {
80                 return (*self)->Period();
81         }
82 }
83
84 //FIXME: 7.3.0
85 //class Handle_Geom_Surface: public Handle_Geom_Geometry
86 class Handle_Geom_Surface
87 {
88         Handle_Geom_Surface()=0;
89         
90         Handle_Geom_Curve downcast() {
91            return (*self);
92         }       
93 };
94
95 %extend Handle_Geom_Surface
96 {
97         gp_Pnt value(const Standard_Real U,const Standard_Real V) const
98         {
99                 return (*self)->Value(U, V);
100         }
101
102         %javamethodmodifiers bounds(double bounds[4]) const "
103         /**
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}
106          */
107         public";
108         void bounds(double bounds[4]) const
109         {
110                 (*self)->Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
111         }
112         
113         %javamethodmodifiers bounds(Standard_Real&, Standard_Real&, Standard_Real&, Standard_Real&) const "
114         /**
115          * @deprecated use bounds(double[]) , it do not need to allocate 4 arrays.
116          */
117         public";
118         void bounds(Standard_Real& U1,Standard_Real& U2,Standard_Real& V1,Standard_Real& V2) const
119         {
120                 (*self)->Bounds(U1,U2,V1,V2);
121         }
122         
123         Standard_Boolean isUClosed() const
124         {
125                 return (*self)->IsUClosed();
126         }
127         
128         Standard_Boolean isVClosed() const
129         {
130                 return (*self)->IsVClosed();
131         }
132         
133         Handle_Geom_Curve uIso(const Standard_Real U) const
134         {
135                 return (*self)->UIso(U);
136         }
137         
138         Handle_Geom_Curve vIso(const Standard_Real V) const
139         {
140                 return (*self)->VIso(V);
141         }
142 }
143
144 class Handle_Geom2d_Geometry
145 {
146         Handle_Geom2d_Geometry()=0;
147 };
148
149 //FIXME: 7.3.0
150 //class Handle_Geom2d_Curve: public Handle_Geom2d_Geometry
151 class Handle_Geom2d_Curve
152 {
153         Handle_Geom2d_Curve()=0;
154         
155         Handle_Geom2d_Geometry downcast() {
156            return (*self);
157         }       
158 };
159
160 //FIXME: 7.3.0
161 //class Handle_Geom_BoundedCurve : public Handle_Geom_Curve
162 class Handle_Geom_BoundedCurve
163 {
164         Handle_Geom_BoundedCurve()=0;
165         
166         Handle_Geom_Curve downcast() {
167            return (*self);
168         }       
169 };
170
171 //FIXME: 7.3.0
172 //class Handle_Geom_BSplineCurve : public Handle_Geom_BoundedCurve
173 class Handle_Geom_BSplineCurve
174 {
175         Handle_Geom_BSplineCurve()=0;
176         
177         Handle_Geom_BoundedCurve downcast() {
178            return (*self);
179         }       
180 };
181
182 %extend Handle_Geom_BSplineCurve
183 {
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));
191         }
192
193   void setKnot(const Standard_Integer Index,const Standard_Real K)
194   {
195     (*self)->SetKnot(Index,K);
196   }
197   
198   void setKnot(const Standard_Integer Index,const Standard_Real K,const Standard_Integer M)
199   {
200     (*self)->SetKnot(Index,K,M);
201   }
202
203   void setPeriodic()
204   {
205     (*self)->SetPeriodic();
206   }
207   
208   void setNotPeriodic()
209   {
210     (*self)->SetNotPeriodic();
211   }
212   
213   void setOrigin(const Standard_Integer Index)
214   {
215      (*self)->SetOrigin(Index);
216   }
217
218   void setOrigin(const Standard_Real U,const Standard_Real Tol)
219   {
220      (*self)->SetOrigin(U,Tol);
221   }
222   
223   void setPole(const Standard_Integer Index,const gp_Pnt& P)
224   {
225     (*self)->SetPole(Index,P);
226   }
227   
228   void setPole(const Standard_Integer Index,const gp_Pnt& P,const Standard_Real Weight)
229   {
230     (*self)->SetPole(Index,P,Weight);
231   }
232   
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)
234   {
235     (*self)->MovePoint(U,P,Index1,Index2,FirstModifiedPole,LastModifiedPole);
236   }
237
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)
239   {
240     Standard_Integer ErrorStatus =0;
241         (*self)->MovePointAndTangent(U,P,Tangent,Tolerance,StartingCondition,EndingCondition,ErrorStatus);
242   }
243   
244   Standard_Boolean isClosed() const
245   {
246     return (*self)->IsClosed();
247   }
248   
249   Standard_Boolean isPeriodic() const
250   {
251     return (*self)->IsPeriodic();
252   }
253   
254   Standard_Boolean isRational() const
255   {
256     return (*self)->IsRational();
257   }
258   
259   GeomAbs_Shape continuity() const
260   {
261     return (*self)->Continuity();
262   }
263   
264   Standard_Integer Degree() const
265   {
266     return (*self)->Degree();
267   }
268   
269   /*
270   gp_Vec dN(const Standard_Real U,const Standard_Integer N) const
271   {
272     return (*self)->DN(U,N);
273   }
274   */
275   
276   gp_Pnt localValue(const Standard_Real U,const Standard_Integer FromK1,const Standard_Integer ToK2) const
277   {
278     return (*self)->LocalValue(U,FromK1,ToK2);
279   }
280   
281   gp_Pnt endPoint() const
282   {
283     return (*self)->EndPoint();
284   }
285   
286   gp_Pnt startPoint() const
287   {
288     return (*self)->StartPoint();
289   }
290   
291   Standard_Integer nbKnots() const
292   {
293     return (*self)->NbKnots();
294   }
295   
296   Standard_Integer nbPoles() const
297   {
298     return (*self)->NbPoles();
299   }
300   
301   gp_Pnt pole(const Standard_Integer Index) const
302   {
303     return (*self)->Pole(Index);
304   }
305   
306   Standard_Real weight(const Standard_Integer Index) const
307   {
308     return (*self)->Weight(Index);
309   }
310   
311 }
312
313 //FIXME: 7.3.0
314 //class Handle_Geom_TrimmedCurve : public Handle_Geom_BoundedCurve
315 class Handle_Geom_TrimmedCurve
316 {
317         Handle_Geom_TrimmedCurve()=0;
318         
319         Handle_Geom_BoundedCurve downcast() {
320            return (*self);
321         }       
322 };