Fixes from code review.

This commit is contained in:
Dion Moult
2021-09-22 20:04:40 +10:00
committed by Thomas Krijnen
parent 02fed24745
commit 0f73c43638
+16 -2
View File
@@ -497,11 +497,25 @@ namespace IfcGeom {
void addRepresentationsFromContextIds() { void addRepresentationsFromContextIds() {
for (auto context_id : settings.context_ids()) { for (auto context_id : settings.context_ids()) {
IfcSchema::IfcGeometricRepresentationContext* context = ifc_file->instance_by_id(context_id)->as<IfcSchema::IfcGeometricRepresentationContext>(); IfcSchema::IfcGeometricRepresentationContext* context = ifc_file->instance_by_id(context_id)->as<IfcSchema::IfcGeometricRepresentationContext>();
if (!context) {
Logger::Error("Failed to process context ID " + std::to_string(context_id));
continue;
}
representations->push(context->RepresentationsInContext()); representations->push(context->RepresentationsInContext());
try { try {
if (context->Precision() && *context->Precision() < lowest_precision_encountered) { double precision;
lowest_precision_encountered = *context->Precision();
if (context->as<IfcSchema::IfcGeometricRepresentationSubContext>()) {
precision = *context->as<IfcSchema::IfcGeometricRepresentationSubContext>()->ParentContext()->Precision();
} else {
precision = *context->Precision();
}
if (precision && precision < lowest_precision_encountered) {
lowest_precision_encountered = precision;
any_precision_encountered = true; any_precision_encountered = true;
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {