|
93 | 93 | %ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, void*, int); |
94 | 94 | %ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, std::istream&, int); |
95 | 95 |
|
| 96 | +// Ignore the std::vector accessors and replace them to pairs that will |
| 97 | +// be expanded to Python tuples by means of typemaps. This in order to |
| 98 | +// minimize passing STL objects across dynamic library boundaries. |
| 99 | +%ignore IfcGeom::Representation::Triangulation::verts; |
| 100 | +%ignore IfcGeom::Representation::Triangulation::faces; |
| 101 | +%ignore IfcGeom::Representation::Triangulation::edges; |
| 102 | +%ignore IfcGeom::Representation::Triangulation::normals; |
| 103 | +%ignore IfcGeom::Representation::Triangulation::material_ids; |
| 104 | +%ignore IfcGeom::Representation::Triangulation::materials; |
| 105 | +%extend IfcGeom::Representation::Triangulation { |
| 106 | + std::pair<const int*, unsigned> get_faces() { |
| 107 | + return std::make_pair(&$self->faces()[0], $self->faces().size()); |
| 108 | + } |
| 109 | + std::pair<const int*, unsigned> get_edges() { |
| 110 | + return std::make_pair(&$self->edges()[0], $self->edges().size()); |
| 111 | + } |
| 112 | + std::pair<const int*, unsigned> get_material_ids() { |
| 113 | + return std::make_pair(&$self->material_ids()[0], $self->material_ids().size()); |
| 114 | + } |
| 115 | + std::pair<const IfcGeom::Material*, unsigned> get_materials() { |
| 116 | + return std::make_pair(&$self->materials()[0], $self->materials().size()); |
| 117 | + } |
| 118 | +} |
| 119 | +%extend IfcGeom::Representation::Triangulation<float> { |
| 120 | + std::pair<const float*, unsigned> get_verts() { |
| 121 | + return std::make_pair(&$self->verts()[0], $self->verts().size()); |
| 122 | + } |
| 123 | + std::pair<const float*, unsigned> get_normals() { |
| 124 | + return std::make_pair(&$self->normals()[0], $self->normals().size()); |
| 125 | + } |
| 126 | +} |
| 127 | +%extend IfcGeom::Representation::Triangulation<double> { |
| 128 | + std::pair<const double*, unsigned> get_verts() { |
| 129 | + return std::make_pair(&$self->verts()[0], $self->verts().size()); |
| 130 | + } |
| 131 | + std::pair<const double*, unsigned> get_normals() { |
| 132 | + return std::make_pair(&$self->normals()[0], $self->normals().size()); |
| 133 | + } |
| 134 | +} |
| 135 | + |
| 136 | + |
96 | 137 | %extend IfcGeom::IteratorSettings { |
97 | 138 | %pythoncode %{ |
98 | 139 | attrs = ("convert_back_units", "deflection_tolerance", "disable_opening_subtractions", "disable_triangulation", "faster_booleans", "sew_shells", "use_brep_data", "use_world_coords", "weld_vertices") |
|
114 | 155 | }; |
115 | 156 |
|
116 | 157 | %extend IfcGeom::Representation::Triangulation { |
117 | | - %pythoncode %{ |
| 158 | + %pythoncode %{ |
118 | 159 | if _newclass: |
119 | 160 | # Hide the getters with read-only property implementations |
120 | 161 | id = property(id) |
121 | | - verts = property(verts) |
122 | | - faces = property(faces) |
123 | | - edges = property(edges) |
124 | | - normals = property(normals) |
125 | | - material_ids = property(material_ids) |
126 | | - materials = property(materials) |
127 | | - %} |
| 162 | + faces = property(get_faces) |
| 163 | + edges = property(get_edges) |
| 164 | + material_ids = property(get_material_ids) |
| 165 | + materials = property(get_materials) |
| 166 | + %} |
| 167 | +}; |
| 168 | + |
| 169 | +// Specialized accessors follow later, for otherwise property definitions |
| 170 | +// would appear before templated getter functions are defined. |
| 171 | +%extend IfcGeom::Representation::Triangulation<float> { |
| 172 | + %pythoncode %{ |
| 173 | + if _newclass: |
| 174 | + # Hide the getters with read-only property implementations |
| 175 | + verts = property(get_verts) |
| 176 | + normals = property(get_normals) |
| 177 | + %} |
| 178 | +}; |
| 179 | +%extend IfcGeom::Representation::Triangulation<double> { |
| 180 | + %pythoncode %{ |
| 181 | + if _newclass: |
| 182 | + # Hide the getters with read-only property implementations |
| 183 | + verts = property(get_verts) |
| 184 | + normals = property(get_normals) |
| 185 | + %} |
128 | 186 | }; |
129 | 187 |
|
130 | 188 | %extend IfcGeom::Representation::Serialization { |
|
133 | 191 | # Hide the getters with read-only property implementations |
134 | 192 | id = property(id) |
135 | 193 | brep_data = property(brep_data) |
136 | | - %} |
| 194 | + %} |
137 | 195 | }; |
138 | 196 |
|
139 | 197 | %extend IfcGeom::Element { |
|
148 | 206 | context = property(context) |
149 | 207 | unique_id = property(unique_id) |
150 | 208 | transformation = property(transformation) |
151 | | - %} |
| 209 | + %} |
152 | 210 | }; |
153 | 211 |
|
154 | 212 | %extend IfcGeom::TriangulationElement { |
155 | 213 | %pythoncode %{ |
156 | 214 | if _newclass: |
157 | 215 | # Hide the getters with read-only property implementations |
158 | 216 | geometry = property(geometry) |
159 | | - %} |
| 217 | + %} |
160 | 218 | }; |
161 | 219 |
|
162 | 220 | %extend IfcGeom::SerializedElement { |
163 | 221 | %pythoncode %{ |
164 | 222 | if _newclass: |
165 | 223 | # Hide the getters with read-only property implementations |
166 | 224 | geometry = property(geometry) |
167 | | - %} |
| 225 | + %} |
168 | 226 | }; |
169 | 227 |
|
170 | 228 | %extend IfcGeom::Material { |
|
180 | 238 | transparency = property(transparency) |
181 | 239 | specularity = property(specularity) |
182 | 240 | name = property(name) |
183 | | - %} |
| 241 | + %} |
184 | 242 | }; |
185 | 243 |
|
186 | 244 | %extend IfcGeom::Transformation { |
187 | 245 | %pythoncode %{ |
188 | 246 | if _newclass: |
189 | 247 | # Hide the getters with read-only property implementations |
190 | 248 | matrix = property(matrix) |
191 | | - %} |
| 249 | + %} |
192 | 250 | }; |
193 | 251 |
|
194 | 252 | %extend IfcGeom::Matrix { |
195 | 253 | %pythoncode %{ |
196 | 254 | if _newclass: |
197 | 255 | # Hide the getters with read-only property implementations |
198 | 256 | data = property(data) |
199 | | - %} |
| 257 | + %} |
200 | 258 | }; |
201 | 259 |
|
202 | 260 | %inline %{ |
|
0 commit comments