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
18 * Handle_TColgp_HArray1OfBoolean
20 %{#include <TColStd_HArray1OfBoolean.hxx>%}
21 class Handle_TColStd_HArray1OfBoolean
23 Handle_TColStd_HArray1OfBoolean()=0;
26 %typemap(jni) Handle_TColStd_HArray1OfBoolean, const Handle_TColStd_HArray1OfBoolean& "jbooleanArray"
27 %typemap(jtype) Handle_TColStd_HArray1OfBoolean, const Handle_TColStd_HArray1OfBoolean& "boolean[]"
28 %typemap(jstype) Handle_TColStd_HArray1OfBoolean, const Handle_TColStd_HArray1OfBoolean& "boolean[]"
29 %typemap(javain) Handle_TColStd_HArray1OfBoolean, const Handle_TColStd_HArray1OfBoolean& "$javainput"
31 %typemap(in) Handle_TColStd_HArray1OfBoolean, const Handle_TColStd_HArray1OfBoolean&, Handle_TColStd_HArray1OfBoolean&
36 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
39 jsize sz = JCALL1(GetArrayLength, jenv, $input);
40 jboolean* jarr = JCALL2(GetBooleanArrayElements, jenv, $input, NULL);
44 //sinn? - modulo test 3
45 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array (2)");
48 TColStd_HArray1OfBoolean *a = new TColStd_HArray1OfBoolean(1,sz);
49 for (i=1,j=0; i<=sz; i++,j++) {
50 a->SetValue(i,Standard_Boolean(jarr[j]));
53 Handle_TColStd_HArray1OfBoolean *c = new Handle_TColStd_HArray1OfBoolean(a);
54 $1 = *(Handle_TColStd_HArray1OfBoolean **)&c;
58 %typemap(freearg) TColgp_Array1OfBoolean, const TColgp_Array1OfBoolean&
64 * Handle_TColgp_HArray1OfPnt
66 %{#include <TColgp_HArray1OfPnt.hxx>%}
67 /*class TColgp_HArray1OfPnt {
70 TColgp_HArray1OfPnt(const Standard_Integer Low,const Standard_Integer Up);
71 void SetValue(const Standard_Integer Index,const gp_Pnt& Value);
73 %rename(TColgp_HArray1OfPnt) Handle_TColgp_HArray1OfPnt;
75 class Handle_TColgp_HArray1OfPnt
77 Handle_TColgp_HArray1OfPnt()=0;
80 %typemap(jni) Handle_TColgp_HArray1OfPnt, const Handle_TColgp_HArray1OfPnt& "jdoubleArray"
81 %typemap(jtype) Handle_TColgp_HArray1OfPnt, const Handle_TColgp_HArray1OfPnt& "double[]"
82 %typemap(jstype) Handle_TColgp_HArray1OfPnt, const Handle_TColgp_HArray1OfPnt& "double[]"
83 %typemap(javain)Handle_TColgp_HArray1OfPnt, const Handle_TColgp_HArray1OfPnt& "$javainput"
84 %typemap(in) Handle_TColgp_HArray1OfPnt, const Handle_TColgp_HArray1OfPnt, const Handle_TColgp_HArray1OfPnt&, Handle_TColgp_HArray1OfPnt&
89 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
92 jsize sz = JCALL1(GetArrayLength, jenv, $input);
93 jdouble* jarr = JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
97 //sinn? - modulo test 3
98 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array (2)");
101 //Handle(TColgp_HArray1OfPnt) b = new TColgp_HArray1OfPnt(1,sz/3);
102 //TODO: this is a leak!
103 TColgp_HArray1OfPnt *a = new TColgp_HArray1OfPnt(1,sz/3);
104 //Handle(TColgp_HArray1OfPnt) a = new TColgp_HArray1OfPnt(1,sz/3);
106 for (i=1,j=0; i<=sz/3; i++,j=j+3) {
107 a->SetValue(i,gp_Pnt(jarr[j],jarr[j+1],jarr[j+2]));
110 Handle_TColgp_HArray1OfPnt *c = new Handle_TColgp_HArray1OfPnt(a);
111 $1 = *(Handle_TColgp_HArray1OfPnt **)&c;
115 arg1 = *(TColgp_HArray1OfPnt **)&jarg1;
117 TColgp_HArray1OfPnt $1 = a;*/
118 //Handle_TColgp_HArray1OfPnt $1 = Handle(a);
126 %{#include <TColgp_Array1OfVec.hxx>%}
127 %typemap(jni) TColgp_Array1OfVec, const TColgp_Array1OfVec& "jdoubleArray"
128 %typemap(jtype) TColgp_Array1OfVec, const TColgp_Array1OfVec& "double[]"
129 %typemap(jstype) TColgp_Array1OfVec, const TColgp_Array1OfVec& "double[]"
130 %typemap(javain)TColgp_Array1OfVec, const TColgp_Array1OfVec& "$javainput"
132 %typemap(in) TColgp_Array1OfVec, const TColgp_Array1OfVec&, TColgp_Array1OfVec&
137 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
140 jsize sz = JCALL1(GetArrayLength, jenv, $input);
141 jdouble* jarr = JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
145 //sinn? - modulo test 3
146 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array (2)");
149 $1 = new TColgp_Array1OfVec(1,sz/3);
150 for (i=1,j=0; i<=sz/3; i++,j=j+3) {
151 $1->SetValue(i,gp_Vec(gp_Dir(jarr[j],jarr[j+1],jarr[j+2])));
156 %typemap(freearg) TColgp_Array1OfVec, const TColgp_Array1OfVec&
165 %{#include <TColgp_Array1OfPnt.hxx>%}
166 %typemap(jni) TColgp_Array1OfPnt, const TColgp_Array1OfPnt& "jdoubleArray"
167 %typemap(jtype) TColgp_Array1OfPnt, const TColgp_Array1OfPnt& "double[]"
168 %typemap(jstype) TColgp_Array1OfPnt, const TColgp_Array1OfPnt& "double[]"
169 %typemap(javain)TColgp_Array1OfPnt, const TColgp_Array1OfPnt& "$javainput"
170 %typemap(javaout)TColgp_Array1OfPnt, const TColgp_Array1OfPnt&
175 %typemap(out) TColgp_Array1OfPnt&
177 const TColgp_Array1OfPnt &Nodes = *$1;
180 jdouble * ns=(jdouble *)malloc(sizeof(jdouble)*s);
181 for(j=0,i=Nodes.Lower();i<=Nodes.Upper();j+=3,i++)
184 ns[j+1]=Nodes(i).Y();
185 ns[j+2]=Nodes(i).Z();
187 jdoubleArray jarray=JCALL1(NewDoubleArray, jenv, s);
188 JCALL4(SetDoubleArrayRegion, jenv, jarray, 0, s, ns);
194 * @author Jens Schmidt
197 %typemap(in) TColgp_Array1OfPnt, const TColgp_Array1OfPnt&, TColgp_Array1OfPnt& /*(jdouble *jarr, jsize sz)*/
202 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
205 jsize sz = JCALL1(GetArrayLength, jenv, $input);
206 jdouble* jarr = JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
210 //sinn? - modulo test 3
211 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array (2)");
214 $1 = new TColgp_Array1OfPnt(1,sz/3);
215 for (i=1,j=0; i<=sz/3; i++,j=j+3) {
216 $1->SetValue(i,gp_Pnt(jarr[j],jarr[j+1],jarr[j+2]));
221 %typemap(freearg) TColgp_Array1OfPnt, const TColgp_Array1OfPnt&
227 * TColgp_Array1OfPnt2d
229 %{#include <TColgp_Array1OfPnt2d.hxx>%}
230 %typemap(jni) TColgp_Array1OfPnt2d& "jdoubleArray"
231 %typemap(jtype) TColgp_Array1OfPnt2d& "double[]"
232 %typemap(jstype) TColgp_Array1OfPnt2d& "double[]"
233 %typemap(javaout) TColgp_Array1OfPnt2d&
238 %typemap(out) TColgp_Array1OfPnt2d&
240 const TColgp_Array1OfPnt2d &Nodes2d = *$1;
242 s=Nodes2d.Length()*2;
243 jdouble * ns=(jdouble *)malloc(sizeof(jdouble)*s);
244 for(j=0,i=Nodes2d.Lower();i<=Nodes2d.Upper();j+=2,i++)
246 ns[j]=Nodes2d(i).X();
247 ns[j+1]=Nodes2d(i).Y();
249 jdoubleArray jarray=JCALL1(NewDoubleArray, jenv, s);
250 JCALL4(SetDoubleArrayRegion, jenv, jarray, 0, s, ns);
257 * TColStd_Array1OfReal
259 %{#include <TColStd_Array1OfReal.hxx>%}
260 %typemap(jni) TColStd_Array1OfReal, const TColStd_Array1OfReal& "jdoubleArray"
261 %typemap(jtype) TColStd_Array1OfReal, const TColStd_Array1OfReal& "double[]"
262 %typemap(jstype) TColStd_Array1OfReal, const TColStd_Array1OfReal& "double[]"
263 %typemap(javain) TColStd_Array1OfReal, const TColStd_Array1OfReal& "$javainput"
264 %typemap(javaout) TColStd_Array1OfReal, const TColStd_Array1OfReal&
269 %typemap(out) TColStd_Array1OfReal, const TColStd_Array1OfReal&
272 const TColgp_Array1OfReal &Reals = *$1;
275 jdouble * ns=(jdouble *)malloc(sizeof(jdouble)*s);
276 for(j=0,i=Reals.Lower();i<=reals.Upper();j+=2,i++)
280 ns[j+1]=Reals(i).Y();
282 jdoubleArray jarray=JCALL1(NewDoubleArray, jenv, s);
283 JCALL4(SetDoubleArrayRegion, jenv, jarray, 0, s, ns);
288 %typemap(in) TColStd_Array1OfReal, const TColStd_Array1OfReal&
293 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
296 jsize sz = JCALL1(GetArrayLength, jenv, $input);
297 jdouble* jarr = JCALL2(GetDoubleArrayElements, jenv, $input, NULL);
299 $1 = new TColStd_Array1OfReal(1,sz);
300 for (i=1,j=0; i<=sz; i++,j++) {
301 $1->SetValue(i,Standard_Real(jarr[j]));
306 %typemap(freearg) TColStd_Array1OfReal, const TColStd_Array1OfReal&