Salome HOME
Update copyrights
[modules/shaper.git] / src / GeomAPI / GeomAPI.i
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 /* GeomAPI.i */
21 %module GeomAPI
22 %{
23   #include "GeomAPI_swig.h"
24 %}
25
26 // to avoid error on this
27 #define GEOMAPI_EXPORT
28
29 // standard definitions
30 %include "typemaps.i"
31 %include "std_list.i"
32 %include "std_string.i"
33 %include "std_shared_ptr.i"
34
35 // shared pointers
36 %shared_ptr(GeomAPI_AISObject)
37 %shared_ptr(GeomAPI_Angle)
38 %shared_ptr(GeomAPI_Angle2d)
39 %shared_ptr(GeomAPI_Ax1)
40 %shared_ptr(GeomAPI_Ax2)
41 %shared_ptr(GeomAPI_Ax3)
42 %shared_ptr(GeomAPI_Box)
43 %shared_ptr(GeomAPI_Circ)
44 %shared_ptr(GeomAPI_Circ2d)
45 %shared_ptr(GeomAPI_Cone)
46 %shared_ptr(GeomAPI_Curve)
47 %shared_ptr(GeomAPI_Cylinder)
48 %shared_ptr(GeomAPI_DataMapOfShapeMapOfShapes)
49 %shared_ptr(GeomAPI_DataMapOfShapeShape)
50 %shared_ptr(GeomAPI_Dir)
51 %shared_ptr(GeomAPI_Dir2d)
52 %shared_ptr(GeomAPI_Edge)
53 %shared_ptr(GeomAPI_Ellipse)
54 %shared_ptr(GeomAPI_Ellipse2d)
55 %shared_ptr(GeomAPI_Face)
56 %shared_ptr(GeomAPI_ICustomPrs)
57 %shared_ptr(GeomAPI_Interface)
58 %shared_ptr(GeomAPI_IPresentable)
59 %shared_ptr(GeomAPI_Lin)
60 %shared_ptr(GeomAPI_Lin2d)
61 %shared_ptr(GeomAPI_PlanarEdges)
62 %shared_ptr(GeomAPI_Pln)
63 %shared_ptr(GeomAPI_Pnt)
64 %shared_ptr(GeomAPI_Pnt2d)
65 %shared_ptr(GeomAPI_Shape)
66 %shared_ptr(GeomAPI_ShapeExplorer)
67 %shared_ptr(GeomAPI_ShapeIterator)
68 %shared_ptr(GeomAPI_Shell)
69 %shared_ptr(GeomAPI_Solid)
70 %shared_ptr(GeomAPI_Sphere)
71 %shared_ptr(GeomAPI_Torus)
72 %shared_ptr(GeomAPI_Trsf)
73 %shared_ptr(GeomAPI_Vertex)
74 %shared_ptr(GeomAPI_Wire)
75 %shared_ptr(GeomAPI_XY)
76 %shared_ptr(GeomAPI_XYZ)
77
78
79 %typemap(in) std::list<std::shared_ptr<GeomAPI_Pnt> > &thePoints (std::list<std::shared_ptr<GeomAPI_Pnt> > temp) {
80   std::shared_ptr<GeomAPI_Pnt> * temp_pnt;
81   int newmem = 0;
82   if (PySequence_Check($input)) {
83     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
84       PyObject * item = PySequence_GetItem($input, i);
85       if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pnt, $descriptor(std::shared_ptr<GeomAPI_Pnt> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
86         if (!temp_pnt) {
87           PyErr_SetString(PyExc_TypeError, "argument must be list of GeomAPI_Pnt.");
88           return NULL;
89        }
90         temp.push_back(*temp_pnt);
91         if (newmem & SWIG_CAST_NEW_MEMORY) {
92           delete temp_pnt;
93         }
94       }
95       Py_DECREF(item);
96     }
97     $1 = &temp;
98   } else {
99     PyErr_SetString(PyExc_ValueError, "argument must be list of GeomAPI_Pnt.");
100     return NULL;
101   }
102 }
103
104
105 // all supported interfaces
106 %include "GeomAPI_Interface.h"
107 %include "GeomAPI_Shape.h"
108 %include "GeomAPI_AISObject.h"
109 %include "GeomAPI_Angle.h"
110 %include "GeomAPI_Angle2d.h"
111 %include "GeomAPI_Ax1.h"
112 %include "GeomAPI_Ax2.h"
113 %include "GeomAPI_Ax3.h"
114 %include "GeomAPI_Box.h"
115 %include "GeomAPI_Circ.h"
116 %include "GeomAPI_Circ2d.h"
117 %include "GeomAPI_Cone.h"
118 %include "GeomAPI_Curve.h"
119 %include "GeomAPI_Cylinder.h"
120 %include "GeomAPI_DataMapOfShapeMapOfShapes.h"
121 %include "GeomAPI_DataMapOfShapeShape.h"
122 %include "GeomAPI_Dir.h"
123 %include "GeomAPI_Dir2d.h"
124 %include "GeomAPI_Edge.h"
125 %include "GeomAPI_Ellipse.h"
126 %include "GeomAPI_Ellipse2d.h"
127 %include "GeomAPI_Face.h"
128 %include "GeomAPI_ICustomPrs.h"
129 %include "GeomAPI_IPresentable.h"
130 %include "GeomAPI_Lin.h"
131 %include "GeomAPI_Lin2d.h"
132 %include "GeomAPI_PlanarEdges.h"
133 %include "GeomAPI_Pln.h"
134 %include "GeomAPI_Pnt.h"
135 %include "GeomAPI_Pnt2d.h"
136 %include "GeomAPI_ShapeExplorer.h"
137 %include "GeomAPI_ShapeIterator.h"
138 %include "GeomAPI_Shell.h"
139 %include "GeomAPI_Solid.h"
140 %include "GeomAPI_Sphere.h"
141 %include "GeomAPI_Torus.h"
142 %include "GeomAPI_Trsf.h"
143 %include "GeomAPI_Vertex.h"
144 %include "GeomAPI_Wire.h"
145 %include "GeomAPI_XY.h"
146 %include "GeomAPI_XYZ.h"
147
148 // std::list -> []
149 %template(PointList) std::list<std::shared_ptr<GeomAPI_Pnt> >;
150 %template(ShapeList) std::list<std::shared_ptr<GeomAPI_Shape> >;