]> gerrit.simantics Code Review - simantics/3d.git/blob - org.jcae.opencascade/src/Geom.i
Include old 64-bit versions of org.jcae.opencascade and vtk bundles
[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 class Handle_Geom_Curve: public Handle_Geom_Geometry
46 {
47         Handle_Geom_Curve()=0;  
48 };
49
50 %extend Handle_Geom_Curve
51 {
52         Standard_Real firstParameter()
53         {
54                 return (*self)->FirstParameter();
55         }
56         
57         Standard_Real lastParameter()
58         {
59                 return (*self)->LastParameter();
60         }
61         
62         Standard_Boolean isClosed()
63         {
64                 return (*self)->IsClosed();
65         }
66         
67         Standard_Boolean isPeriodic()
68         {
69                 return (*self)->IsPeriodic();
70         }
71         
72         Standard_Real period()
73         {
74                 return (*self)->Period();
75         }
76 }
77
78 class Handle_Geom_Surface: public Handle_Geom_Geometry
79 {
80         Handle_Geom_Surface()=0;
81 };
82
83 %extend Handle_Geom_Surface
84 {
85         gp_Pnt value(const Standard_Real U,const Standard_Real V) const
86         {
87                 return (*self)->Value(U, V);
88         }
89
90         %javamethodmodifiers bounds(double bounds[4]) const "
91         /**
92          * Return the bounds of the parameters of the surface.
93          * @param bounds  an array of size 4 which will receive {Umin, Umax, Vmin, Vmax}
94          */
95         public";
96         void bounds(double bounds[4]) const
97         {
98                 (*self)->Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
99         }
100         
101         %javamethodmodifiers bounds(Standard_Real&, Standard_Real&, Standard_Real&, Standard_Real&) const "
102         /**
103          * @deprecated use bounds(double[]) , it do not need to allocate 4 arrays.
104          */
105         public";
106         void bounds(Standard_Real& U1,Standard_Real& U2,Standard_Real& V1,Standard_Real& V2) const
107         {
108                 (*self)->Bounds(U1,U2,V1,V2);
109         }
110         
111         Standard_Boolean isUClosed() const
112         {
113                 return (*self)->IsUClosed();
114         }
115         
116         Standard_Boolean isVClosed() const
117         {
118                 return (*self)->IsVClosed();
119         }
120         
121         Handle_Geom_Curve uIso(const Standard_Real U) const
122         {
123                 return (*self)->UIso(U);
124         }
125         
126         Handle_Geom_Curve vIso(const Standard_Real V) const
127         {
128                 return (*self)->VIso(V);
129         }
130 }
131
132 class Handle_Geom2d_Geometry
133 {
134         Handle_Geom2d_Geometry()=0;
135 };
136
137 class Handle_Geom2d_Curve: public Handle_Geom2d_Geometry
138 {
139         Handle_Geom2d_Curve()=0;
140 };
141
142 class Handle_Geom_BoundedCurve : public Handle_Geom_Curve {
143         Handle_Geom_BoundedCurve()=0;
144 };
145
146 class Handle_Geom_BSplineCurve : public Handle_Geom_BoundedCurve {
147         Handle_Geom_BSplineCurve()=0;
148 };
149
150 %extend Handle_Geom_BSplineCurve
151 {
152         //TODO check that this is not a big memory leak
153         Handle_Geom_BSplineCurve(const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights,
154                 const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Multiplicities,
155                 const Standard_Integer Degree, const Standard_Boolean Periodic = Standard_False,
156                 const Standard_Boolean CheckRational = Standard_True){
157                 return new Handle_Geom_BSplineCurve(new Geom_BSplineCurve(
158                         Poles, Weights, Knots, Multiplicities, Degree, Periodic, CheckRational));
159         }
160
161   void setKnot(const Standard_Integer Index,const Standard_Real K)
162   {
163     (*self)->SetKnot(Index,K);
164   }
165   
166   void setKnot(const Standard_Integer Index,const Standard_Real K,const Standard_Integer M)
167   {
168     (*self)->SetKnot(Index,K,M);
169   }
170
171   void setPeriodic()
172   {
173     (*self)->SetPeriodic();
174   }
175   
176   void setNotPeriodic()
177   {
178     (*self)->SetNotPeriodic();
179   }
180   
181   void setOrigin(const Standard_Integer Index)
182   {
183      (*self)->SetOrigin(Index);
184   }
185
186   void setOrigin(const Standard_Real U,const Standard_Real Tol)
187   {
188      (*self)->SetOrigin(U,Tol);
189   }
190   
191   void setPole(const Standard_Integer Index,const gp_Pnt& P)
192   {
193     (*self)->SetPole(Index,P);
194   }
195   
196   void setPole(const Standard_Integer Index,const gp_Pnt& P,const Standard_Real Weight)
197   {
198     (*self)->SetPole(Index,P,Weight);
199   }
200   
201   void movePoint(const Standard_Real U,const gp_Pnt& P,const Standard_Integer Index1,const Standard_Integer Index2,Standard_Integer& FirstModifiedPole,Standard_Integer& LastModifiedPole)
202   {
203     (*self)->MovePoint(U,P,Index1,Index2,FirstModifiedPole,LastModifiedPole);
204   }
205
206   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)
207   {
208     Standard_Integer ErrorStatus =0;
209         (*self)->MovePointAndTangent(U,P,Tangent,Tolerance,StartingCondition,EndingCondition,ErrorStatus);
210   }
211   
212   Standard_Boolean isClosed() const
213   {
214     return (*self)->IsClosed();
215   }
216   
217   Standard_Boolean isPeriodic() const
218   {
219     return (*self)->IsPeriodic();
220   }
221   
222   Standard_Boolean isRational() const
223   {
224     return (*self)->IsRational();
225   }
226   
227   GeomAbs_Shape continuity() const
228   {
229     return (*self)->Continuity();
230   }
231   
232   Standard_Integer Degree() const
233   {
234     return (*self)->Degree();
235   }
236   
237   /*
238   gp_Vec dN(const Standard_Real U,const Standard_Integer N) const
239   {
240     return (*self)->DN(U,N);
241   }
242   */
243   
244   gp_Pnt localValue(const Standard_Real U,const Standard_Integer FromK1,const Standard_Integer ToK2) const
245   {
246     return (*self)->LocalValue(U,FromK1,ToK2);
247   }
248   
249   gp_Pnt endPoint() const
250   {
251     return (*self)->EndPoint();
252   }
253   
254   gp_Pnt startPoint() const
255   {
256     return (*self)->StartPoint();
257   }
258   
259   Standard_Integer nbKnots() const
260   {
261     return (*self)->NbKnots();
262   }
263   
264   Standard_Integer nbPoles() const
265   {
266     return (*self)->NbPoles();
267   }
268   
269   gp_Pnt pole(const Standard_Integer Index) const
270   {
271     return (*self)->Pole(Index);
272   }
273   
274   Standard_Real weight(const Standard_Integer Index) const
275   {
276     return (*self)->Weight(Index);
277   }
278   
279 }
280
281 class Handle_Geom_TrimmedCurve : public Handle_Geom_BoundedCurve {
282         Handle_Geom_TrimmedCurve()=0;
283 };