mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 11:24:19 +00:00
Move macro logic into template function; mark failures as intended #4915
This commit is contained in:
@@ -26,6 +26,16 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* inst) {
|
||||
|
||||
auto items = map_to_collection(this, inst->Items());
|
||||
if (!items) {
|
||||
auto its = inst->Items();
|
||||
bool empty_on_purpose = true;
|
||||
for (auto& itm : *its) {
|
||||
if (failed_on_purpose_.find(itm) == failed_on_purpose_.end()) {
|
||||
empty_on_purpose = false;
|
||||
}
|
||||
}
|
||||
if (empty_on_purpose) {
|
||||
failed_on_purpose_.insert(inst);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -53,37 +63,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* inst) {
|
||||
});
|
||||
|
||||
if (filtered->children.empty()) {
|
||||
failed_on_purpose_.insert(inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
/*
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* l, ConversionResults& shapes) {
|
||||
IfcSchema::IfcRepresentationItem::list::ptr items = inst->Items();
|
||||
bool part_succes = false;
|
||||
if ( items->size() ) {
|
||||
for ( IfcSchema::IfcRepresentationItem::list::it it = items->begin(); it != items->end(); ++ it ) {
|
||||
IfcSchema::IfcRepresentationptr representation_item = *it;
|
||||
if ( shape_type(representation_item) == ST_SHAPELIST ) {
|
||||
part_succes |= convert_shapes(*it, shapes);
|
||||
} else {
|
||||
TopoDS_Shape s;
|
||||
if (convert_shape(representation_item, s)) {
|
||||
if (s.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(s).More() && TopoDS_Iterator(s).Value().ShapeType() == TopAbs_SOLID) {
|
||||
TopoDS_Iterator topo_it(s);
|
||||
for (; topo_it.More(); topo_it.Next()) {
|
||||
shapes.push_back(ConversionResult(representation_item->data().id(), topo_it.Value(), get_style(representation_item)));
|
||||
}
|
||||
} else {
|
||||
shapes.push_back(ConversionResult(representation_item->data().id(), s, get_style(representation_item)));
|
||||
}
|
||||
part_succes |= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return part_succes;
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user