mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
Use custom typemaps for geometry related classes as well
This commit is contained in:
+5
-41
@@ -17,7 +17,6 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
%include "std_vector.i"
|
||||
%include "std_string.i"
|
||||
%include "exception.i"
|
||||
|
||||
@@ -49,46 +48,11 @@
|
||||
#endif
|
||||
%}
|
||||
|
||||
// The following typemaps are an alternative for the read-only std::vector
|
||||
// implementations provided by SWIG, as passing STL objects across dynamic
|
||||
// library boundaries can be problematic.
|
||||
%typemap(out) std::pair<const float*, unsigned> {
|
||||
$result = PyTuple_New($1.second);
|
||||
for (unsigned i = 0; i < $1.second; ++i) {
|
||||
PyTuple_SetItem($result, i, PyFloat_FromDouble($1.first[i]));
|
||||
}
|
||||
}
|
||||
%typemap(out) std::pair<const double*, unsigned> {
|
||||
$result = PyTuple_New($1.second);
|
||||
for (unsigned i = 0; i < $1.second; ++i) {
|
||||
PyTuple_SetItem($result, i, PyFloat_FromDouble($1.first[i]));
|
||||
}
|
||||
}
|
||||
%typemap(out) std::pair<const int*, unsigned> {
|
||||
$result = PyTuple_New($1.second);
|
||||
for (unsigned i = 0; i < $1.second; ++i) {
|
||||
PyTuple_SetItem($result, i, PyLong_FromLong($1.first[i]));
|
||||
}
|
||||
}
|
||||
%typemap(out) std::pair<const std::string*, unsigned> {
|
||||
$result = PyTuple_New($1.second);
|
||||
for (unsigned i = 0; i < $1.second; ++i) {
|
||||
PyTuple_SetItem($result, i, PyUnicode_FromString($1.first[i]->c_str()));
|
||||
}
|
||||
}
|
||||
%typemap(out) std::pair<const IfcGeom::Material*, unsigned> {
|
||||
$result = PyTuple_New($1.second);
|
||||
for (unsigned i = 0; i < $1.second; ++i) {
|
||||
PyTuple_SetItem($result, i, SWIG_NewPointerObj(SWIG_as_voidptr(&$1.first[i]), SWIGTYPE_p_IfcGeom__Material, 0));
|
||||
}
|
||||
}
|
||||
%typemap(out) std::vector<unsigned> {
|
||||
$result = PyTuple_New($1.size());
|
||||
unsigned i = 0;
|
||||
for (std::vector<unsigned>::const_iterator it = $1.begin(); it != $1.end(); ++it) {
|
||||
PyTuple_SetItem($result, i++, PyLong_FromLong(*it));
|
||||
}
|
||||
}
|
||||
%include "utils/type_conversion.i"
|
||||
|
||||
%include "utils/typemaps_in.i"
|
||||
|
||||
%include "utils/typemaps_out.i"
|
||||
|
||||
%include "IfcGeomWrapper.i"
|
||||
%include "IfcParseWrapper.i"
|
||||
|
||||
Reference in New Issue
Block a user