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 %typemap(jni) const TopTools_ListOfShape& "jlongArray"
23 %typemap(jtype) const TopTools_ListOfShape& "long[]"
24 %typemap(jstype) const TopTools_ListOfShape& "TopoDS_Shape[]"
26 %typemap(javain) const TopTools_ListOfShape& "TopoDS_Shape.cArrayUnwrap($javainput)"
27 %typemap(javaout) const TopTools_ListOfShape&
29 return TopoDS_Shape.cArrayWrap($jnicall);
31 %typemap(in) const TopTools_ListOfShape& (jlong *jarr, jsize sz)
36 SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
39 sz = JCALL1(GetArrayLength, jenv, $input);
40 jarr = JCALL2(GetLongArrayElements, jenv, $input, 0);
45 $1 = new TopTools_ListOfShape();
48 $1->Append(*(TopoDS_Shape*)jarr[i]);
52 %typemap(freearg) const TopTools_ListOfShape&
57 %{#include <TopTools_ListIteratorOfListOfShape.hxx>%}
58 %typemap(out) const TopTools_ListOfShape&
61 const TopTools_ListOfShape& l = *$1;
63 jlong * as=(jlong*) malloc (sizeof(jlong) * n * 2);
64 TopTools_ListIteratorOfListOfShape it(l);
68 const TopoDS_Shape & s=it.Value();
69 TopoDS_Shape * tsp=new TopoDS_Shape();
70 tsp->TShape(s.TShape());
71 tsp->Location(s.Location());
72 tsp->Orientation(s.Orientation());
74 as[j++]=s.ShapeType();
77 jlongArray jarray=JCALL1(NewLongArray, jenv, n*2);
78 JCALL4(SetLongArrayRegion, jenv, jarray, 0, n*2, as);