2 * Project Info: http://jcae.sourceforge.net
\r
4 * This program is free software; you can redistribute it and/or modify it under
\r
5 * the terms of the GNU Lesser General Public License as published by the Free
\r
6 * Software Foundation; either version 2.1 of the License, or (at your option)
\r
9 * This program is distributed in the hope that it will be useful, but WITHOUT
\r
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
\r
14 * You should have received a copy of the GNU Lesser General Public License
\r
15 * along with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
\r
18 * (C) Copyright 2005, by EADS CRC
\r
22 jdoubleArray XYZtoDoubleArray(JNIEnv* jenv, const gp_XYZ & xyz)
\r
24 jdouble nativeArray[]={xyz.X(), xyz.Y(), xyz.Z()};
\r
25 jdoubleArray toReturn=jenv->NewDoubleArray(3);
\r
26 jenv->SetDoubleArrayRegion(toReturn, 0, 3, nativeArray);
\r
35 %typemap(jni) gp_Pnt, const gp_Pnt& "jdoubleArray"
\r
36 %typemap(jtype) gp_Pnt, const gp_Pnt& "double[]"
\r
37 %typemap(jstype) gp_Pnt, const gp_Pnt& "double[]"
\r
39 %typemap(in) gp_Pnt, const gp_Pnt&
\r
41 if(JCALL1(GetArrayLength, jenv, $input)!=3)
\r
42 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 3");
\r
43 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
44 $1=new gp_Pnt(naxe[0],naxe[1],naxe[2]);
\r
47 %typemap(out) const gp_Pnt&
\r
49 $result=XYZtoDoubleArray(jenv, $1->XYZ());
\r
52 %typemap(out) gp_Pnt
\r
54 $result=XYZtoDoubleArray(jenv, $1.XYZ());
\r
57 %typemap(freearg) gp_Pnt, const gp_Pnt&
\r
62 %typemap(javain) gp_Pnt, const gp_Pnt& "$javainput"
\r
63 %typemap(javaout) gp_Pnt, const gp_Pnt&
\r
72 %typemap(jni) gp_Pnt2d, const gp_Pnt2d& "jdoubleArray"
\r
73 %typemap(jtype) gp_Pnt2d, const gp_Pnt2d& "double[]"
\r
74 %typemap(jstype) gp_Pnt2d, const gp_Pnt2d& "double[]"
\r
76 %typemap(in) gp_Pnt2d, const gp_Pnt2d&
\r
78 if(JCALL1(GetArrayLength, jenv, $input)!=2)
\r
79 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 2");
\r
80 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
81 $1=new gp_Pnt2d(naxe[0],naxe[1]);
\r
84 %typemap(freearg) gp_Pnt2d, const gp_Pnt2d&
\r
89 %typemap(javain) gp_Pnt2d, const gp_Pnt2d& "$javainput"
\r
90 %typemap(javaout) gp_Pnt2d, const gp_Pnt2d&
\r
95 %typemap(out) gp_Pnt2d, const gp_Pnt2d&
\r
97 jdouble nativeArray[]={$1.X(), $1.Y()};
\r
98 jdoubleArray toReturn=JCALL1(NewDoubleArray, jenv, 2);
\r
99 JCALL4(SetDoubleArrayRegion, jenv, toReturn, 0, 2, nativeArray);
\r
105 %typemap(jni) gp_Pln, const gp_Pln& "jdoubleArray"
\r
106 %typemap(jtype) gp_Pln, const gp_Pln& "double[]"
\r
107 %typemap(jstype) gp_Pln, const gp_Pln& "double[]"
\r
109 %typemap(in) gp_Pln, const gp_Pln&
\r
111 if(JCALL1(GetArrayLength, jenv, $input)!=4)
\r
112 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 4");
\r
113 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
114 $1=new gp_Pln(naxe[0],naxe[1],naxe[2],naxe[4]);
\r
117 %typemap(freearg) gp_Pln, const gp_Pln&
\r
122 %typemap(javain) gp_Pln, const gp_Pln& "$javainput"
\r
123 %typemap(javaout) gp_Pln, const gp_Pln&
\r
128 %typemap(out) gp_Pln, const gp_Pln &
\r
131 $1.Coefficients(a, b, c, d);
\r
132 jdouble nativeArray[] = {a, b, c, d};
\r
133 jdoubleArray toReturn = JCALL1(NewDoubleArray, jenv, 4);
\r
134 JCALL4(SetDoubleArrayRegion, jenv, toReturn, 0, 4, nativeArray);
\r
141 %typemap(jni) gp_Vec, const gp_Vec& "jdoubleArray"
\r
142 %typemap(jtype) gp_Vec, const gp_Vec& "double[]"
\r
143 %typemap(jstype) gp_Vec, const gp_Vec& "double[]"
\r
145 %typemap(in) gp_Vec, const gp_Vec&
\r
147 if(JCALL1(GetArrayLength, jenv, $input)!=3)
\r
148 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 3");
\r
149 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
150 $1=new gp_Vec(naxe[0],naxe[1],naxe[2]);
\r
153 %typemap(freearg) gp_Vec, const gp_Vec&
\r
158 %typemap(javain) gp_Vec, const gp_Vec& "$javainput"
\r
159 %typemap(javaout) gp_Vec, const gp_Vec&
\r
164 %typemap(out) gp_Vec, const gp_Vec&
\r
166 $result=XYZtoDoubleArray(jenv, $1->XYZ());
\r
172 %typemap(jni) gp_Dir, const gp_Dir&, gp_Dir& "jdoubleArray"
\r
173 %typemap(jtype) gp_Dir, const gp_Dir&, gp_Dir& "double[]"
\r
174 %typemap(jstype) gp_Dir, const gp_Dir&, gp_Dir& "double[]"
\r
176 %typemap(in) gp_Dir, const gp_Dir&
\r
178 if(JCALL1(GetArrayLength, jenv, $input)!=3)
\r
179 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 3");
\r
180 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
181 $1=new gp_Dir(naxe[0],naxe[1],naxe[2]);
\r
184 %typemap(freearg) gp_Dir, const gp_Dir&
\r
189 %typemap(out) const gp_Dir&
\r
191 $result=XYZtoDoubleArray(jenv, $1->XYZ());
\r
194 %typemap(out) gp_Dir
\r
196 $result=XYZtoDoubleArray(jenv, $1.XYZ());
\r
199 %typemap(javain) gp_Dir, const gp_Dir&, gp_Dir& "$javainput"
\r
200 %typemap(javaout) gp_Dir, const gp_Dir&, gp_Dir&
\r
208 %typemap(jni) gp_Ax2, const gp_Ax2& "jdoubleArray"
\r
209 %typemap(jtype) gp_Ax2, const gp_Ax2& "double[]"
\r
210 %typemap(jstype) gp_Ax2, const gp_Ax2& "double[]"
\r
212 %typemap(in) gp_Ax2, const gp_Ax2&
\r
214 int len = JCALL1(GetArrayLength, jenv, $input);
\r
215 if(len !=6 && len != 9)
\r
216 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 6 or 9");
\r
217 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
219 $1=new gp_Ax2(gp_Pnt(naxe[0],naxe[1],naxe[2]), gp_Dir(naxe[3], naxe[4], naxe[5]));
\r
221 $1=new gp_Ax2(gp_Pnt(naxe[0],naxe[1],naxe[2]), gp_Dir(naxe[3], naxe[4], naxe[5]), gp_Dir(naxe[6], naxe[7], naxe[8]));
\r
224 %typemap(freearg) gp_Ax2, const gp_Ax2&
\r
229 %typemap(out) gp_Ax2, const gp_Ax2&
\r
234 %typemap(javain) gp_Ax2, const gp_Ax2& "$javainput"
\r
235 %typemap(javaout) gp_Ax2, const gp_Ax2&
\r
243 %typemap(jni) gp_Ax1, const gp_Ax1& "jdoubleArray"
\r
244 %typemap(jtype) gp_Ax1, const gp_Ax1& "double[]"
\r
245 %typemap(jstype) gp_Ax1, const gp_Ax1& "double[]"
\r
247 %typemap(in) gp_Ax1, const gp_Ax1&
\r
249 if(JCALL1(GetArrayLength, jenv, $input)!=6)
\r
250 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 6");
\r
251 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
252 $1=new gp_Ax1(gp_Pnt(naxe[0],naxe[1],naxe[2]), gp_Dir(naxe[3], naxe[4], naxe[5]));
\r
255 %typemap(freearg) gp_Ax1, const gp_Ax1&
\r
260 %typemap(out) gp_Ax1, const gp_Ax1&
\r
265 %typemap(javain) gp_Ax1, const gp_Ax1& "$javainput"
\r
266 %typemap(javaout) gp_Ax1, const gp_Ax1&
\r
274 %{#include <gp_Trsf.hxx>%}
\r
276 %rename(GP_Trsf) gp_Trsf;
\r
278 %typemap(javacode) gp_Trsf
\r
280 public void setValues(double[] matrix, double tolAng, double tolDist)
\r
282 if(matrix.length!=12)
\r
283 throw new IllegalArgumentException("matrix length must be 12");
\r
285 matrix[0], matrix[1], matrix[2], matrix[3],
\r
286 matrix[4], matrix[5], matrix[6], matrix[7],
\r
287 matrix[8], matrix[9], matrix[10], matrix[11],
\r
294 %rename(setRotation) SetRotation;
\r
295 %rename(setTranslation) SetTranslation;
\r
296 %rename(setValues) SetValues;
\r
299 void SetRotation(const gp_Ax1& A1,const Standard_Real Ang) ;
\r
300 void SetTranslation(const gp_Vec& V) ;
\r
301 void SetValues(const Standard_Real a11,const Standard_Real a12,
\r
302 const Standard_Real a13,const Standard_Real a14,const Standard_Real a21,
\r
303 const Standard_Real a22,const Standard_Real a23,const Standard_Real a24,
\r
304 const Standard_Real a31,const Standard_Real a32,const Standard_Real a33,
\r
305 const Standard_Real a34,const Standard_Real Tolang,
\r
306 const Standard_Real TolDist);
\r
311 /** Easy to use with javax.vecmath.Matrix4D */
\r
312 void getValues(double matrix[16])
\r
315 for(int i=1; i<=3; i++)
\r
316 for(int j=1; j<=4; j++)
\r
317 matrix[k++]=self->Value(i,j);
\r
328 %{#include <gp_Circ.hxx>%}
\r
329 %rename(GP_Circ) gp_Circ;
\r
333 gp_Circ(const gp_Ax2& axis, const Standard_Real radius);
\r
339 %{#include <gp_Parab.hxx>%}
\r
340 %rename(GP_Parab) gp_Parab;
\r
344 gp_Parab(const gp_Ax2& A2,const Standard_Real Focal);
\r
345 gp_Parab(const gp_Ax1& D,const gp_Pnt& F);
\r
349 /*******************************************************************
\r
353 *******************************************************************/
\r
358 %{#include <gp_Elips.hxx>%}
\r
360 %rename(GP_Elips) gp_Elips;
\r
366 gp_Elips(const gp_Ax2& A2,const Standard_Real MajorRadius,const Standard_Real MinorRadius);
\r
373 %{#include <gp_Lin.hxx>%}
\r
375 %rename(GP_Lin) gp_Lin;
\r
380 gp_Lin(const gp_Ax1& A1);
\r
387 %{#include <gp_Mat.hxx>%}
\r
388 %typemap(jni) gp_Mat, const gp_Mat& "jdoubleArray"
\r
389 %typemap(jtype) gp_Mat, const gp_Mat& "double[]"
\r
390 %typemap(jstype) gp_Mat, const gp_Mat& "double[]"
\r
392 %typemap(in) gp_Mat, const gp_Mat&
\r
394 if(JCALL1(GetArrayLength, jenv, $input)!=9)
\r
395 SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "array length must be 9");
\r
396 jdouble * naxe=JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
\r
397 $1=new gp_Mat(naxe[0],naxe[1],naxe[2],naxe[3],naxe[4],naxe[5],naxe[6],naxe[7],naxe[8]);
\r
400 %typemap(freearg) gp_Mat, const gp_Mat&
\r
405 %typemap(javain) gp_Mat, const gp_Mat& "$javainput"
\r
406 %typemap(javaout) gp_Mat, const gp_Mat&
\r
412 jdoubleArray MatToDoubleArray(JNIEnv* jenv, const gp_Mat & mat)
\r
414 jdouble nativeArray[]={mat.Value(1,1), mat.Value(1,2), mat.Value(1,3),
\r
415 mat.Value(2,1), mat.Value(2,2), mat.Value(2,3),
\r
416 mat.Value(3,1), mat.Value(3,2), mat.Value(3,3)};
\r
417 jdoubleArray toReturn=jenv->NewDoubleArray(9);
\r
418 jenv->SetDoubleArrayRegion(toReturn, 0, 9, nativeArray);
\r
423 %typemap(out) gp_Mat, const gp_Mat&
\r
425 $result=MatToDoubleArray(jenv, $1);
\r