]> gerrit.simantics Code Review - simantics/3d.git/blob - org.jcae.opencascade/src/Poly.i
PipeRun reverse action
[simantics/3d.git] / org.jcae.opencascade / src / Poly.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 %{#include <Poly_Triangulation.hxx>%}
22
23 %typemap(jni) Poly_Array1OfTriangle&  "jintArray"
24 %typemap(jtype) Poly_Array1OfTriangle& "int[]"
25 %typemap(jstype) Poly_Array1OfTriangle& "int[]"
26 %typemap(javaout) Poly_Array1OfTriangle&
27 {
28         return $jnicall;
29 }
30
31 %typemap(out) const Poly_Array1OfTriangle&
32 {
33     int i,j,s;
34     const Poly_Array1OfTriangle &Triangles  = *$1;
35     s=Triangles.Length()*3;
36     jint * iarray=new jint[s];
37     Standard_Integer n1,n2,n3;
38
39     for(j=0,i=Triangles.Lower();i<=Triangles.Upper();j+=3,i++)
40     {
41         Triangles(i).Get(n1,n2,n3);
42         iarray[j]=n1-1;
43         iarray[j+1]=n2-1;
44         iarray[j+2]=n3-1;
45     }
46
47     jintArray array=JCALL1(NewIntArray, jenv, s);
48         JCALL4(SetIntArrayRegion, jenv, array, 0, s, iarray);
49     delete[] iarray;
50     $result=array;
51 }
52
53 class Poly_Triangulation
54 {
55         %rename(deflection) Deflection;
56         %rename(removeUVNodes) RemoveUVNodes;
57         %rename(nbNodes) NbNodes;
58         %rename(hasUVNodes) HasUVNodes;
59         %rename(nbTriangles) NbTriangles;
60         %rename(triangles) Triangles;
61         %rename(nodes) Nodes;
62         %rename(uvNodes) UVNodes;
63         
64         public:
65         Poly_Triangulation(const Standard_Integer nbNodes,
66                 const Standard_Integer nbTriangles,const Standard_Boolean UVNodes);
67         Standard_Real Deflection() const;
68         void Deflection(const Standard_Real D) ;
69         void RemoveUVNodes() ;
70         Standard_Integer NbNodes() const;
71         Standard_Integer NbTriangles() const;
72         Standard_Boolean HasUVNodes() const;
73         const Poly_Array1OfTriangle& Triangles() const;
74         const TColgp_Array1OfPnt& Nodes() const;
75         const TColgp_Array1OfPnt2d& UVNodes() const;
76 };