Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / GeomAPI / GeomAPI.i
1 // Copyright (C) 2014-2017  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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 /* GeomAPI.i */
22 %module GeomAPI
23 %{
24   #include "GeomAPI_swig.h"
25 %}
26
27 // to avoid error on this
28 #define GEOMAPI_EXPORT
29
30 // standard definitions
31 %include "typemaps.i"
32 %include "std_list.i"
33 %include "std_string.i"
34 %include "std_shared_ptr.i"
35
36 // shared pointers
37 %shared_ptr(GeomAPI_AISObject)
38 %shared_ptr(GeomAPI_Angle)
39 %shared_ptr(GeomAPI_Angle2d)
40 %shared_ptr(GeomAPI_Ax1)
41 %shared_ptr(GeomAPI_Ax2)
42 %shared_ptr(GeomAPI_Ax3)
43 %shared_ptr(GeomAPI_Box)
44 %shared_ptr(GeomAPI_Circ)
45 %shared_ptr(GeomAPI_Circ2d)
46 %shared_ptr(GeomAPI_Cone)
47 %shared_ptr(GeomAPI_Curve)
48 %shared_ptr(GeomAPI_Cylinder)
49 %shared_ptr(GeomAPI_DataMapOfShapeMapOfShapes)
50 %shared_ptr(GeomAPI_DataMapOfShapeShape)
51 %shared_ptr(GeomAPI_Dir)
52 %shared_ptr(GeomAPI_Dir2d)
53 %shared_ptr(GeomAPI_Edge)
54 %shared_ptr(GeomAPI_Ellipse)
55 %shared_ptr(GeomAPI_Ellipse2d)
56 %shared_ptr(GeomAPI_Face)
57 %shared_ptr(GeomAPI_ICustomPrs)
58 %shared_ptr(GeomAPI_Interface)
59 %shared_ptr(GeomAPI_IPresentable)
60 %shared_ptr(GeomAPI_Lin)
61 %shared_ptr(GeomAPI_Lin2d)
62 %shared_ptr(GeomAPI_PlanarEdges)
63 %shared_ptr(GeomAPI_Pln)
64 %shared_ptr(GeomAPI_Pnt)
65 %shared_ptr(GeomAPI_Pnt2d)
66 %shared_ptr(GeomAPI_Shape)
67 %shared_ptr(GeomAPI_ShapeExplorer)
68 %shared_ptr(GeomAPI_ShapeIterator)
69 %shared_ptr(GeomAPI_Shell)
70 %shared_ptr(GeomAPI_Solid)
71 %shared_ptr(GeomAPI_Sphere)
72 %shared_ptr(GeomAPI_Torus)
73 %shared_ptr(GeomAPI_Trsf)
74 %shared_ptr(GeomAPI_Vertex)
75 %shared_ptr(GeomAPI_Wire)
76 %shared_ptr(GeomAPI_XY)
77 %shared_ptr(GeomAPI_XYZ)
78
79
80 %typemap(in) std::list<std::shared_ptr<GeomAPI_Pnt> > &thePoints (std::list<std::shared_ptr<GeomAPI_Pnt> > temp) {
81   std::shared_ptr<GeomAPI_Pnt> * temp_pnt;
82   int newmem = 0;
83   if (PySequence_Check($input)) {
84     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
85       PyObject * item = PySequence_GetItem($input, i);
86       if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pnt, $descriptor(std::shared_ptr<GeomAPI_Pnt> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
87         if (!temp_pnt) {
88           PyErr_SetString(PyExc_TypeError, "argument must be list of GeomAPI_Pnt.");
89           return NULL;
90        }
91         temp.push_back(*temp_pnt);
92         if (newmem & SWIG_CAST_NEW_MEMORY) {
93           delete temp_pnt;
94         }
95       }
96       Py_DECREF(item);
97     }
98     $1 = &temp;
99   } else {
100     PyErr_SetString(PyExc_ValueError, "argument must be list of GeomAPI_Pnt.");
101     return NULL;
102   }
103 }
104
105
106 // all supported interfaces
107 %include "GeomAPI_Interface.h"
108 %include "GeomAPI_Shape.h"
109 %include "GeomAPI_AISObject.h"
110 %include "GeomAPI_Angle.h"
111 %include "GeomAPI_Angle2d.h"
112 %include "GeomAPI_Ax1.h"
113 %include "GeomAPI_Ax2.h"
114 %include "GeomAPI_Ax3.h"
115 %include "GeomAPI_Box.h"
116 %include "GeomAPI_Circ.h"
117 %include "GeomAPI_Circ2d.h"
118 %include "GeomAPI_Cone.h"
119 %include "GeomAPI_Curve.h"
120 %include "GeomAPI_Cylinder.h"
121 %include "GeomAPI_DataMapOfShapeMapOfShapes.h"
122 %include "GeomAPI_DataMapOfShapeShape.h"
123 %include "GeomAPI_Dir.h"
124 %include "GeomAPI_Dir2d.h"
125 %include "GeomAPI_Edge.h"
126 %include "GeomAPI_Ellipse.h"
127 %include "GeomAPI_Ellipse2d.h"
128 %include "GeomAPI_Face.h"
129 %include "GeomAPI_ICustomPrs.h"
130 %include "GeomAPI_IPresentable.h"
131 %include "GeomAPI_Lin.h"
132 %include "GeomAPI_Lin2d.h"
133 %include "GeomAPI_PlanarEdges.h"
134 %include "GeomAPI_Pln.h"
135 %include "GeomAPI_Pnt.h"
136 %include "GeomAPI_Pnt2d.h"
137 %include "GeomAPI_ShapeExplorer.h"
138 %include "GeomAPI_ShapeIterator.h"
139 %include "GeomAPI_Shell.h"
140 %include "GeomAPI_Solid.h"
141 %include "GeomAPI_Sphere.h"
142 %include "GeomAPI_Torus.h"
143 %include "GeomAPI_Trsf.h"
144 %include "GeomAPI_Vertex.h"
145 %include "GeomAPI_Wire.h"
146 %include "GeomAPI_XY.h"
147 %include "GeomAPI_XYZ.h"
148
149 // std::list -> []
150 %template(PointList) std::list<std::shared_ptr<GeomAPI_Pnt> >;
151 %template(ShapeList) std::list<std::shared_ptr<GeomAPI_Shape> >;