]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI.i
Salome HOME
Improve code coverage for elliptic arcs.
[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_map.i"
33 %include "std_set.i"
34 %include "std_shared_ptr.i"
35 %include "std_string.i"
36
37 // shared pointers
38 %shared_ptr(GeomAPI_AISObject)
39 %shared_ptr(GeomAPI_Angle)
40 %shared_ptr(GeomAPI_Angle2d)
41 %shared_ptr(GeomAPI_Ax1)
42 %shared_ptr(GeomAPI_Ax2)
43 %shared_ptr(GeomAPI_Ax3)
44 %shared_ptr(GeomAPI_Box)
45 %shared_ptr(GeomAPI_Circ)
46 %shared_ptr(GeomAPI_Circ2d)
47 %shared_ptr(GeomAPI_Cone)
48 %shared_ptr(GeomAPI_Curve)
49 %shared_ptr(GeomAPI_Cylinder)
50 %shared_ptr(GeomAPI_DataMapOfShapeMapOfShapes)
51 %shared_ptr(GeomAPI_DataMapOfShapeShape)
52 %shared_ptr(GeomAPI_Dir)
53 %shared_ptr(GeomAPI_Dir2d)
54 %shared_ptr(GeomAPI_Edge)
55 %shared_ptr(GeomAPI_Ellipse)
56 %shared_ptr(GeomAPI_Ellipse2d)
57 %shared_ptr(GeomAPI_Face)
58 %shared_ptr(GeomAPI_ICustomPrs)
59 %shared_ptr(GeomAPI_Interface)
60 %shared_ptr(GeomAPI_IPresentable)
61 %shared_ptr(GeomAPI_Lin)
62 %shared_ptr(GeomAPI_Lin2d)
63 %shared_ptr(GeomAPI_PlanarEdges)
64 %shared_ptr(GeomAPI_Pln)
65 %shared_ptr(GeomAPI_Pnt)
66 %shared_ptr(GeomAPI_Pnt2d)
67 %shared_ptr(GeomAPI_Shape)
68 %shared_ptr(GeomAPI_ShapeExplorer)
69 %shared_ptr(GeomAPI_ShapeIterator)
70 %shared_ptr(GeomAPI_Shell)
71 %shared_ptr(GeomAPI_Solid)
72 %shared_ptr(GeomAPI_Sphere)
73 %shared_ptr(GeomAPI_Torus)
74 %shared_ptr(GeomAPI_Trsf)
75 %shared_ptr(GeomAPI_Vertex)
76 %shared_ptr(GeomAPI_Wire)
77 %shared_ptr(GeomAPI_XY)
78 %shared_ptr(GeomAPI_XYZ)
79
80
81 %typemap(in) std::list<std::shared_ptr<GeomAPI_Pnt> > &thePoints (std::list<std::shared_ptr<GeomAPI_Pnt> > temp) {
82   std::shared_ptr<GeomAPI_Pnt> * temp_pnt;
83   int newmem = 0;
84   if (PySequence_Check($input)) {
85     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
86       PyObject * item = PySequence_GetItem($input, i);
87       if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pnt, $descriptor(std::shared_ptr<GeomAPI_Pnt> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
88         if (!temp_pnt) {
89           PyErr_SetString(PyExc_TypeError, "argument must be list of GeomAPI_Pnt.");
90           return NULL;
91        }
92         temp.push_back(*temp_pnt);
93         if (newmem & SWIG_CAST_NEW_MEMORY) {
94           delete temp_pnt;
95         }
96       }
97       Py_DECREF(item);
98     }
99     $1 = &temp;
100   } else {
101     PyErr_SetString(PyExc_ValueError, "argument must be list of GeomAPI_Pnt.");
102     return NULL;
103   }
104 }
105
106 %typemap(in) double & (double temp) {
107   if (PyLong_Check($input)) {
108     temp = PyLong_AsLong($input);
109     $1 = &temp;
110   }
111 }
112
113 %typemap(argout) double & {
114   $result = PyFloat_FromDouble(*$1);
115 }
116
117
118 // all supported interfaces
119 %include "GeomAPI_Interface.h"
120 %include "GeomAPI_Shape.h"
121 %include "GeomAPI_AISObject.h"
122 %include "GeomAPI_Angle.h"
123 %include "GeomAPI_Angle2d.h"
124 %include "GeomAPI_Ax1.h"
125 %include "GeomAPI_Ax2.h"
126 %include "GeomAPI_Ax3.h"
127 %include "GeomAPI_Box.h"
128 %include "GeomAPI_Circ.h"
129 %include "GeomAPI_Circ2d.h"
130 %include "GeomAPI_Cone.h"
131 %include "GeomAPI_Curve.h"
132 %include "GeomAPI_Cylinder.h"
133 %include "GeomAPI_DataMapOfShapeMapOfShapes.h"
134 %include "GeomAPI_DataMapOfShapeShape.h"
135 %include "GeomAPI_Dir.h"
136 %include "GeomAPI_Dir2d.h"
137 %include "GeomAPI_Edge.h"
138 %include "GeomAPI_Ellipse.h"
139 %include "GeomAPI_Ellipse2d.h"
140 %include "GeomAPI_Face.h"
141 %include "GeomAPI_ICustomPrs.h"
142 %include "GeomAPI_IPresentable.h"
143 %include "GeomAPI_Lin.h"
144 %include "GeomAPI_Lin2d.h"
145 %include "GeomAPI_PlanarEdges.h"
146 %include "GeomAPI_Pln.h"
147 %include "GeomAPI_Pnt.h"
148 %include "GeomAPI_Pnt2d.h"
149 %include "GeomAPI_ShapeExplorer.h"
150 %include "GeomAPI_ShapeIterator.h"
151 %include "GeomAPI_Shell.h"
152 %include "GeomAPI_Solid.h"
153 %include "GeomAPI_Sphere.h"
154 %include "GeomAPI_Torus.h"
155 %include "GeomAPI_Trsf.h"
156 %include "GeomAPI_Vertex.h"
157 %include "GeomAPI_Wire.h"
158 %include "GeomAPI_XY.h"
159 %include "GeomAPI_XYZ.h"
160
161 // std::list -> []
162 %template(PointList) std::list<std::shared_ptr<GeomAPI_Pnt> >;
163 %template(ShapeList) std::list<std::shared_ptr<GeomAPI_Shape> >;
164 // std::set -> []
165 %template(ShapeSet) std::set<std::shared_ptr<GeomAPI_Shape>, GeomAPI_Shape::Comparator>;
166 %template(OriShapeSet) std::set<std::shared_ptr<GeomAPI_Shape>, GeomAPI_Shape::ComparatorWithOri>;
167 // std::map -> {}
168 %template(ShapeToShapesMap) std::map<std::shared_ptr<GeomAPI_Shape>, std::set<std::shared_ptr<GeomAPI_Shape>, GeomAPI_Shape::ComparatorWithOri>, GeomAPI_Shape::Comparator>;