mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 19:09:07 +00:00
Proceed with merge
This commit is contained in:
@@ -17,57 +17,10 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include "../ifcgeom/IfcGeom.h"
|
||||
#include <memory>
|
||||
#include "mapping.h"
|
||||
#define mapping POSTFIX_SCHEMA(mapping)
|
||||
using namespace ifcopenshell::geometry;
|
||||
|
||||
#define Kernel MAKE_TYPE_NAME(Kernel)
|
||||
|
||||
bool IfcGeom::Kernel::convert(const IfcSchema::IfcGeometricSet* l, IfcRepresentationShapeItems& shapes) {
|
||||
// @nb the selection is partly duplicated from convert_curves() but it's needed as a
|
||||
// geometric set by it's static class definition does not inform us of the type of elements.
|
||||
// @todo handle this better so that this doesn't log an error.
|
||||
const bool include_curves = getValue(GV_DIMENSIONALITY) != +1;
|
||||
const bool include_solids_and_surfaces = getValue(GV_DIMENSIONALITY) != -1;
|
||||
|
||||
aggregate_of_instance::ptr elements = l->Elements();
|
||||
if ( !elements->size() ) return false;
|
||||
bool part_succes = false;
|
||||
auto parent_style = get_style(l);
|
||||
for (aggregate_of_instance::it it = elements->begin(); it != elements->end(); ++it) {
|
||||
auto element = *it;
|
||||
TopoDS_Shape s;
|
||||
if (shape_type(element) == ST_SHAPELIST) {
|
||||
IfcRepresentationShapeItems items;
|
||||
if (!(convert_shapes(element, items) && util::flatten_shape_list(items, s, false, getValue(GV_PRECISION)))) {
|
||||
continue;
|
||||
}
|
||||
} else if (shape_type(element) == ST_SHAPE && include_solids_and_surfaces) {
|
||||
if (!convert_shape(element, s)) {
|
||||
continue;
|
||||
}
|
||||
} else if ((shape_type(element) == ST_WIRE || shape_type(element) == ST_CURVE) && include_curves) {
|
||||
TopoDS_Wire w;
|
||||
if (!convert_wire(element, w)) {
|
||||
continue;
|
||||
}
|
||||
s = w;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
part_succes = true;
|
||||
decltype(parent_style) style = 0;
|
||||
if (element->declaration().is(IfcSchema::IfcPoint::Class())) {
|
||||
style = get_style((IfcSchema::IfcPoint*) element);
|
||||
}
|
||||
else if (element->declaration().is(IfcSchema::IfcCurve::Class())) {
|
||||
style = get_style((IfcSchema::IfcCurve*) element);
|
||||
}
|
||||
else if (element->declaration().is(IfcSchema::IfcSurface::Class())) {
|
||||
style = get_style((IfcSchema::IfcSurface*) element);
|
||||
}
|
||||
shapes.push_back(IfcRepresentationShapeItem(l->data().id(), s, style ? style : parent_style));
|
||||
}
|
||||
return part_succes;
|
||||
taxonomy::item* mapping::map_impl(const IfcSchema::IfcGeometricSet* inst) {
|
||||
return map_to_collection(this, inst->Elements());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user