mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 20:22:09 +00:00
Pass around non-static logger instances and programmatic access to messages in-memory
This commit is contained in:
@@ -28,7 +28,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis1Placement* inst) {
|
||||
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
|
||||
P = *v->components_;
|
||||
} catch (const std::exception&) {
|
||||
Logger::Warning("GEO", 232, "Placement with invalid Location:", inst);
|
||||
logger_.Warning("GEO", 232, "Placement with invalid Location:", inst);
|
||||
}
|
||||
const bool hasAxis = inst->Axis();
|
||||
if (hasAxis) {
|
||||
|
||||
@@ -29,7 +29,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement2D* inst) {
|
||||
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
|
||||
P = *v->components_;
|
||||
} catch (const std::exception&) {
|
||||
Logger::Warning("GEO", 233, "Placement with invalid Location:", inst);
|
||||
logger_.Warning("GEO", 233, "Placement with invalid Location:", inst);
|
||||
}
|
||||
const bool hasRef = !!inst->RefDirection();
|
||||
if (hasRef) {
|
||||
|
||||
@@ -29,13 +29,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement3D* inst) {
|
||||
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
|
||||
o = *v->components_;
|
||||
} catch (const std::exception&) {
|
||||
Logger::Warning("GEO", 234, "Placement with invalid Location:", inst);
|
||||
logger_.Warning("GEO", 234, "Placement with invalid Location:", inst);
|
||||
}
|
||||
const bool hasAxis = !!inst->Axis();
|
||||
const bool hasRef = !!inst->RefDirection();
|
||||
|
||||
if (hasAxis != hasRef) {
|
||||
Logger::Warning("GEO", 235, "Axis and RefDirection should be specified together", inst);
|
||||
logger_.Warning("GEO", 235, "Axis and RefDirection should be specified together", inst);
|
||||
}
|
||||
|
||||
if (hasAxis) {
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear* inst) {
|
||||
|
||||
if (!inst->Location()->as<IfcSchema::IfcPointByDistanceExpression>()) {
|
||||
Logger::Error("GEO", 236, std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
|
||||
logger_.Error("GEO", 236, std::runtime_error("Location must be IfcPointByDistanceExpression for IfcAxis2PlacementLinear"));
|
||||
}
|
||||
|
||||
Eigen::Vector3d o, axis(0, 0, 1), refDirection;
|
||||
|
||||
@@ -43,7 +43,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCShapeProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if ( x < tol || y < tol || d1 < tol || d2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 241, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 241, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle* inst) {
|
||||
const double r = inst->Radius() * length_unit_;
|
||||
if (r < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* inst) {
|
||||
|
||||
for (auto& segment : *segments) {
|
||||
if (segment->as<IfcSchema::IfcCompositeCurveSegment>() && segment->as<IfcSchema::IfcCompositeCurveSegment>()->ParentCurve()->as<IfcSchema::IfcLine>()) {
|
||||
Logger::Notice("GEO", 238, "Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
|
||||
logger_.Notice("GEO", 238, "Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment);
|
||||
double u0 = 0.0;
|
||||
double u1 = segment->as<IfcSchema::IfcCompositeCurveSegment>()->ParentCurve()->as<IfcSchema::IfcLine>()->Dir()->Magnitude() * length_unit_;
|
||||
if (u1 < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Warning("GEO", 239, "Segment length below tolerance", segment);
|
||||
logger_.Warning("GEO", 239, "Segment length below tolerance", segment);
|
||||
}
|
||||
|
||||
auto e = taxonomy::make<taxonomy::edge>();
|
||||
@@ -70,7 +70,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* inst) {
|
||||
e->end = 2.0 * boost::math::constants::pi<double>();
|
||||
loop->children.push_back(e);
|
||||
} else {
|
||||
Logger::Warning("GEO", 240, "Unexpected segment type", segment);
|
||||
logger_.Warning("GEO", 240, "Unexpected segment type", segment);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ class curve_segment_evaluator {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger::Warning("GEO", 242, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
logger_.Warning("GEO", 242, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ class curve_segment_evaluator {
|
||||
if ((is_horizontal + is_vertical + is_cant) != 1) {
|
||||
// We have to choose the correct functor based on usage. We can't
|
||||
// support multiple, because we don't know the caller at this point.
|
||||
Logger::Error("UNS", 10, std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
|
||||
logger_.Error("UNS", 10, std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
|
||||
}
|
||||
|
||||
segment_type_ = is_horizontal ? ST_HORIZONTAL : is_vertical ? ST_VERTICAL : is_cant ? ST_CANT : ST_HORIZONTAL;
|
||||
@@ -321,7 +321,7 @@ class curve_segment_evaluator {
|
||||
end_point = segmented_reference_curve->EndPoint();
|
||||
}
|
||||
} else {
|
||||
Logger::Warning("GEO", 243, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
|
||||
logger_.Warning("GEO", 243, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
|
||||
}
|
||||
if (end_point) {
|
||||
next_segment_placement_ = taxonomy::cast<taxonomy::matrix4>(mapping_->map(end_point))->ccomponents();
|
||||
@@ -343,7 +343,7 @@ class curve_segment_evaluator {
|
||||
|
||||
taxonomy::ptr get_segment_curve_function() {
|
||||
if (!parent_curve_fn_ || !parent_curve_start_point_) {
|
||||
Logger::Error("UNS", 11, std::runtime_error(inst_->ParentCurve()->declaration().name() + " not implemented"), inst_);
|
||||
logger_.Error("UNS", 11, std::runtime_error(inst_->ParentCurve()->declaration().name() + " not implemented"), inst_);
|
||||
}
|
||||
|
||||
auto length = fabs(this->length());
|
||||
@@ -476,13 +476,13 @@ class curve_segment_evaluator {
|
||||
projected_length_ = length_;
|
||||
}
|
||||
} else if (segment_type_ == ST_CANT) {
|
||||
Logger::Error("GEO", 244, std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here"));
|
||||
logger_.Error("GEO", 244, std::runtime_error("Unexpected segment type encountered - cant is handled in set_cant_spiral_function - should never get here"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
);
|
||||
} else {
|
||||
Logger::Error("GEO", 245, std::runtime_error("Unexpected segment type encountered"));
|
||||
logger_.Error("GEO", 245, std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
@@ -643,13 +643,13 @@ class curve_segment_evaluator {
|
||||
|
||||
set_cant_spiral_function(*super, *slope, cant);
|
||||
} else if (segment_type_ == ST_VERTICAL) {
|
||||
Logger::Error("GEO", 246, std::runtime_error("IfcCosineSpiral cannot be used for vertical alignment"));
|
||||
logger_.Error("GEO", 246, std::runtime_error("IfcCosineSpiral cannot be used for vertical alignment"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
);
|
||||
} else {
|
||||
Logger::Error("GEO", 247, std::runtime_error("Unexpected segment type encountered"));
|
||||
logger_.Error("GEO", 247, std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }
|
||||
@@ -712,12 +712,12 @@ class curve_segment_evaluator {
|
||||
|
||||
set_cant_spiral_function(*super, *slope, cant);
|
||||
} else if (segment_type_ == ST_VERTICAL) {
|
||||
Logger::Error("GEO", 248, std::runtime_error("IfcSineSpiral cannot be used for vertical alignment"));
|
||||
logger_.Error("GEO", 248, std::runtime_error("IfcSineSpiral cannot be used for vertical alignment"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
} else {
|
||||
Logger::Error("GEO", 249, std::runtime_error("Unexpected segment type encountered"));
|
||||
logger_.Error("GEO", 249, std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
@@ -976,12 +976,12 @@ class curve_segment_evaluator {
|
||||
}
|
||||
|
||||
} else if (segment_type_ == ST_CANT) {
|
||||
Logger::Warning("UNS", 12, std::runtime_error("Use of IfcCircle for cant is not supported"));
|
||||
logger_.Warning("UNS", 12, std::runtime_error("Use of IfcCircle for cant is not supported"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
} else {
|
||||
Logger::Error("GEO", 250, std::runtime_error("Unexpected segment type encountered"));
|
||||
logger_.Error("GEO", 250, std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
@@ -1067,7 +1067,7 @@ class curve_segment_evaluator {
|
||||
|
||||
parent_curve_start_point_ = (*parent_curve_fn_)(start_);
|
||||
} else {
|
||||
Logger::Warning("GEO", 251, std::runtime_error("Unexpected segment type encountered"));
|
||||
logger_.Warning("GEO", 251, std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
@@ -1081,7 +1081,7 @@ class curve_segment_evaluator {
|
||||
auto coeffY = pc->CoefficientsY().get_value_or(std::vector<double>());
|
||||
auto coeffZ = pc->CoefficientsZ().get_value_or(std::vector<double>());
|
||||
if (!coeffZ.empty()) {
|
||||
Logger::Warning("GEO", 252, "Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
|
||||
logger_.Warning("GEO", 252, "Expected IfcPolynomialCurve.CoefficientsZ to be undefined for alignment geometry. Coefficients ignored.", pc);
|
||||
}
|
||||
|
||||
if (segment_type_ == ST_HORIZONTAL || segment_type_ == ST_VERTICAL) {
|
||||
@@ -1147,7 +1147,7 @@ class curve_segment_evaluator {
|
||||
auto result = boost::math::tools::bracket_and_solve_root(f, x, 2.0, true, tol, max_iter);
|
||||
x = result.first;
|
||||
} catch (...) {
|
||||
Logger::Warning("GEO", 253, "root solver failed");
|
||||
logger_.Warning("GEO", 253, "root solver failed");
|
||||
}
|
||||
return x;
|
||||
};
|
||||
@@ -1208,12 +1208,12 @@ class curve_segment_evaluator {
|
||||
|
||||
parent_curve_start_point_ = (*parent_curve_fn_)(0.0); // start is added to u in parent_curve_fn_, so use 0.0 here
|
||||
} else if (segment_type_ == ST_CANT) {
|
||||
Logger::Warning("UNS", 13, std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
|
||||
logger_.Warning("UNS", 13, std::runtime_error("Use of IfcPolynomialCurve for cant is not supported"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
} else {
|
||||
Logger::Error("GEO", 254, std::runtime_error("Unexpected segment type encountered"));
|
||||
logger_.Error("GEO", 254, std::runtime_error("Unexpected segment type encountered"));
|
||||
parent_curve_fn_ = std::make_shared<parent_curve_function>(
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); },
|
||||
[](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); });
|
||||
|
||||
@@ -23,14 +23,14 @@ using namespace ifcopenshell::geometry;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEdge* inst) {
|
||||
if (!inst->EdgeStart()->declaration().is(IfcSchema::IfcVertexPoint::Class()) || !inst->EdgeEnd()->declaration().is(IfcSchema::IfcVertexPoint::Class())) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 255, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 255, "Only IfcVertexPoints are supported for EdgeStart and -End", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IfcSchema::IfcPoint* pnt1 = ((IfcSchema::IfcVertexPoint*) inst->EdgeStart())->VertexGeometry();
|
||||
IfcSchema::IfcPoint* pnt2 = ((IfcSchema::IfcVertexPoint*) inst->EdgeEnd())->VertexGeometry();
|
||||
if (!pnt1->declaration().is(IfcSchema::IfcCartesianPoint::Class()) || !pnt2->declaration().is(IfcSchema::IfcCartesianPoint::Class())) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 256, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 256, "Only IfcCartesianPoints are supported for VertexGeometry", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse* inst) {
|
||||
double y = inst->SemiAxis2() * length_unit_;
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 257, "Radius not greater than zero for:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 257, "Radius not greater than zero for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef* inst) {
|
||||
double ry = inst->SemiAxis2() * length_unit_;
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
if (rx < tol || ry < tol) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 258, "Radius not greater than zero for:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 258, "Radius not greater than zero for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid* inst) {
|
||||
const double height = inst->Depth() * length_unit_;
|
||||
if (height < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 259, "Non-positive extrusion height encountered for:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst);
|
||||
#ifndef PERMISSIVE_EXTRUSION
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered* inst) {
|
||||
const double height = inst->Depth() * length_unit_;
|
||||
if (height < settings_.get<settings::Precision>().get()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 260, "Non-positive extrusion height encountered for:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace ifcopenshell::geometry;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve* inst) {
|
||||
if (!inst->BaseCurve()->as<IfcSchema::IfcCompositeCurve>())
|
||||
Logger::Warning("GEO", 261, "Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
|
||||
logger_.Warning("GEO", 261, "Expected IfcGradientCurve.BaseCurve to be IfcCompositeCurve", inst); // CT 4.1.7.1.1.2
|
||||
|
||||
auto segments = inst->Segments();
|
||||
|
||||
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve* inst) {
|
||||
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
|
||||
spans.push_back(fi);
|
||||
} else {
|
||||
Logger::Error("UNS", 14, "Unsupported");
|
||||
logger_.Error("UNS", 14, "Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
Logger::Error("UNS", 15, "Unsupported");
|
||||
logger_.Error("UNS", 15, "Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve* inst) {
|
||||
|
||||
// check to see if there is valid overlap of the horizontal and vertical domains
|
||||
if (!(0 < gradient_function->length())) {
|
||||
Logger::Error("GEO", 262, "IfcGradientCurve does not have a common domain with BaseCurve");
|
||||
logger_.Error("GEO", 262, "IfcGradientCurve does not have a common domain with BaseCurve");
|
||||
gradient_function = nullptr; // not valid
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcHalfSpaceSolid* inst) {
|
||||
IfcSchema::IfcSurface* surface = inst->BaseSurface();
|
||||
if (!surface->declaration().is(IfcSchema::IfcPlane::Class())) {
|
||||
Logger::Message(Logger::LOG_ERROR, "UNS", 16, "Unsupported BaseSurface:", surface);
|
||||
logger_.Message(Logger::LOG_ERROR, "UNS", 16, "Unsupported BaseSurface:", surface);
|
||||
return nullptr;
|
||||
}
|
||||
auto p = taxonomy::make<taxonomy::plane>();
|
||||
|
||||
@@ -81,7 +81,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIShapeProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x1 < tol || x2 < tol || y < tol || d1 < tol || ft1 < tol || ft2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve* inst) {
|
||||
e->basis = circ;
|
||||
loop->children.push_back(e);
|
||||
} else {
|
||||
Logger::Warning("GEO", 263, "Ignoring segment on", inst);
|
||||
logger_.Warning("GEO", 263, "Ignoring segment on", inst);
|
||||
}
|
||||
} else {
|
||||
throw IfcParse::IfcException("Unexpected IfcIndexedPolyCurve segment of type " + segment->as<IfcUtil::IfcBaseClass>()->declaration().name());
|
||||
|
||||
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if ( x < tol || y < tol || d < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 265, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 265, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef* inst) {
|
||||
const double det = a1*b2 - a2*b1;
|
||||
|
||||
if (std::fabs(det) < 1.e-5) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 266, "Legs do not intersect for:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 266, "Legs do not intersect for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement* inst) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
Logger::Warning("GEO", 267, "Using --site-local-placement or --building-local-placement on IFC4.2 might have issues");
|
||||
logger_.Warning("GEO", 267, "Using --site-local-placement or --building-local-placement on IFC4.2 might have issues");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement* inst) {
|
||||
if (fallback) {
|
||||
auto mapped_fallback = taxonomy::cast<taxonomy::matrix4>(map(fallback));
|
||||
if (!result->ccomponents().isApprox(mapped_fallback->ccomponents())) {
|
||||
Logger::Warning("GEO", 268, "Computed placement differs from fallback", inst);
|
||||
logger_.Warning("GEO", 268, "Computed placement differs from fallback", inst);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement* inst) {
|
||||
|
||||
auto abs_det = std::abs(result->ccomponents().determinant());
|
||||
if (abs_det < 1.e-7) {
|
||||
Logger::Warning("GEO", 269, "Ignoring singular matrix:", inst);
|
||||
logger_.Warning("GEO", 269, "Ignoring singular matrix:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ using namespace ifcopenshell::geometry;
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances* inst) {
|
||||
auto offset_values = inst->OffsetValues();
|
||||
if (offset_values->size() == 0) {
|
||||
Logger::Error("GEO", 270, "IfcOffsetCurveByDistances must have at least one offset value");
|
||||
logger_.Error("GEO", 270, "IfcOffsetCurveByDistances must have at least one offset value");
|
||||
}
|
||||
|
||||
auto first_offset_value = *(offset_values->begin());
|
||||
@@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances* inst
|
||||
auto basis_curve_fn = taxonomy::dcast<taxonomy::function_item>(map(basis_curve));
|
||||
if (!basis_curve_fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("GEO", 271, "IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
|
||||
logger_.Warning("GEO", 271, "IfcOffsetCurveByDistances is only implemented for BasisCurves curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances* inst
|
||||
first_distance *= length_unit_;
|
||||
|
||||
if (first_distance < 0.0) {
|
||||
Logger::Warning("GEO", 272, "IfcOffsetCurveByDistance first offset value is before the start of the curve.");
|
||||
logger_.Warning("GEO", 272, "IfcOffsetCurveByDistance first offset value is before the start of the curve.");
|
||||
}
|
||||
|
||||
if(0.0 < first_distance)
|
||||
@@ -110,7 +110,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances* inst
|
||||
|
||||
if (dn < dp) // next is before previous
|
||||
{
|
||||
Logger::Warning("GEO", 273, "IfcOffsetCurveByDistance offset value is out of bounds.");
|
||||
logger_.Warning("GEO", 273, "IfcOffsetCurveByDistance offset value is out of bounds.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ const double PI = boost::math::constants::pi<double>();
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef* inst) {
|
||||
if (inst->ProfileType() != IfcSchema::IfcProfileTypeEnum::IfcProfileType_CURVE) {
|
||||
Logger::Warning("GEO", 274, "Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
|
||||
logger_.Warning("GEO", 274, "Expected IfcOpenCrossProfileDef.ProfileType to be CURVE", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef* inst) {
|
||||
auto angles = inst->Slopes(); // these are actually angles, but the attribute is called Slopes
|
||||
|
||||
if (widths.size() != angles.size()) {
|
||||
Logger::Warning("GEO", 275, "Expected Widths and Slopes to be equal length, but got " + std::to_string(widths.size()) + " and " + std::to_string(angles.size()) + " respectively", inst);
|
||||
logger_.Warning("GEO", 275, "Expected Widths and Slopes to be equal length, but got " + std::to_string(widths.size()) + " and " + std::to_string(angles.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop* inst) {
|
||||
// A loop should consist of at least three vertices
|
||||
int original_count = polygon.size();
|
||||
if (original_count < 3) {
|
||||
Logger::Message(Logger::LOG_WARNING, "GEO", 278, "Not enough edges for:", inst);
|
||||
logger_.Message(Logger::LOG_WARNING, "GEO", 278, "Not enough edges for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -45,17 +45,17 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop* inst) {
|
||||
auto previous_size = polygon.size();
|
||||
remove_duplicate_points_from_loop(polygon, true, eps);
|
||||
if (polygon.size() != previous_size) {
|
||||
Logger::Warning("GEO", 279, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
logger_.Warning("GEO", 279, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
}
|
||||
|
||||
int count = polygon.size();
|
||||
if (original_count - count != 0) {
|
||||
std::stringstream ss; ss << (original_count - count) << " edges removed for:";
|
||||
Logger::Message(Logger::LOG_WARNING, "GEO", 280, ss.str(), inst);
|
||||
logger_.Message(Logger::LOG_WARNING, "GEO", 280, ss.str(), inst);
|
||||
}
|
||||
|
||||
if (count < 3) {
|
||||
Logger::Message(Logger::LOG_WARNING, "GEO", 281, "Not enough edges for:", inst);
|
||||
logger_.Message(Logger::LOG_WARNING, "GEO", 281, "Not enough edges for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyline* inst) {
|
||||
auto previous_size = polygon.size();
|
||||
remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps);
|
||||
if (polygon.size() != previous_size) {
|
||||
Logger::Warning("GEO", 276, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
logger_.Warning("GEO", 276, "Removed " + std::to_string(previous_size - polygon.size()) + " (near) duplicate points from:", inst);
|
||||
}
|
||||
|
||||
if (polygon.size() < 2) {
|
||||
// We somehow need to signal we fail this curve on purpose not to trigger an error.
|
||||
Logger::Warning("GEO", 277, "Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
|
||||
logger_.Warning("GEO", 277, "Invalid polyline with " + std::to_string(polygon.size()) + " points:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef* i
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 282, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 282, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 283, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 283, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRoundedRectangleProfileDef*
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 284, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 284, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal* in
|
||||
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
|
||||
if (!fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("GEO", 285, "IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
logger_.Warning("GEO", 285, "IfcSectionedSolidHorizontal is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal* in
|
||||
profile_rotations.push_back(rot);
|
||||
}
|
||||
if (faces.size() != profile_offsets.size()) {
|
||||
Logger::Warning("GEO", 286, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
logger_.Warning("GEO", 286, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
}
|
||||
if (faces.size() < 2) {
|
||||
Logger::Warning("GEO", 287, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
logger_.Warning("GEO", 287, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface* inst) {
|
||||
auto fn = taxonomy::dcast<taxonomy::function_item>(dir);
|
||||
if (!fn) {
|
||||
// Only implement on alignment curves
|
||||
Logger::Warning("GEO", 288, "IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
logger_.Warning("GEO", 288, "IfcSectionedSurface is only implemented for Directrix curves based on taxonomy::function_item", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -79,11 +79,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface* inst) {
|
||||
return nullptr;
|
||||
#endif
|
||||
if (faces.size() != profile_offsets.size()) {
|
||||
Logger::Warning("GEO", 289, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
logger_.Warning("GEO", 289, "Expected CrossSections and CrossSectionPositions to be equal length, but got " + std::to_string(faces.size()) + " and " + std::to_string(profile_offsets.size()) + " respectively", inst);
|
||||
return nullptr;
|
||||
}
|
||||
if (faces.size() < 2) {
|
||||
Logger::Warning("GEO", 290, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
logger_.Warning("GEO", 290, "Expected at least two cross sections, but got " + std::to_string(faces.size()), inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace ifcopenshell::geometry;
|
||||
|
||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* inst) {
|
||||
if (!inst->BaseCurve()->as<IfcSchema::IfcGradientCurve>())
|
||||
Logger::Warning("GEO", 291, "Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
|
||||
logger_.Warning("GEO", 291, "Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3
|
||||
|
||||
auto segments = inst->Segments();
|
||||
|
||||
@@ -41,11 +41,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* ins
|
||||
// for this reason, a dynamic cast is used and if crv is a function_item it is added to the span
|
||||
spans.push_back(fi);
|
||||
} else {
|
||||
Logger::Error("UNS", 17, "Unsupported");
|
||||
logger_.Error("UNS", 17, "Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
Logger::Error("UNS", 18, "Unsupported");
|
||||
logger_.Error("UNS", 18, "Unsupported");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve* ins
|
||||
|
||||
auto cant_function = taxonomy::make<taxonomy::cant_function>(gradient, cant, inst);
|
||||
if (!(0 < cant_function->length())) {
|
||||
Logger::Error("GEO", 292, "IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
|
||||
logger_.Error("GEO", 292, "IfcSegmentedReferenceCurve does not have a common domain with BaseCurve");
|
||||
cant_function = nullptr;
|
||||
}
|
||||
return cant_function;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file is part of IfcOpenShell. *
|
||||
* *
|
||||
@@ -62,7 +62,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid* inst) {
|
||||
sp = inst->StartParam();
|
||||
ep = inst->EndParam();
|
||||
} catch (const IfcParse::IfcException& e) {
|
||||
Logger::Warning("GEO", 293, e);
|
||||
logger_.Warning("GEO", 293, e);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol || d1 < tol || d2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 296, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 296, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef* inst) {
|
||||
const double det = a1*b2 - a2*b1;
|
||||
|
||||
if (std::fabs(det) < 1.e-5) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 297, "Web and flange do not intersect for:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 297, "Web and flange do not intersect for:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrapeziumProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x1 < tol || w < tol || y < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 294, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 294, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve* inst) {
|
||||
bool trim_cartesian_failed = !trim_cartesian;
|
||||
if (trim_cartesian) {
|
||||
if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) {
|
||||
Logger::Message(Logger::LOG_WARNING, "GEO", 295, "Skipping segment with length below tolerance level:", inst);
|
||||
logger_.Message(Logger::LOG_WARNING, "GEO", 295, "Skipping segment with length below tolerance level:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
tc->start = pnts[0];
|
||||
|
||||
@@ -54,7 +54,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcUShapeProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol || d1 < tol || d2 < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 298, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 298, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcZShapeProfileDef* inst) {
|
||||
const double tol = settings_.get<settings::Precision>().get();
|
||||
|
||||
if (x < tol || y < tol || dx < tol || dy < tol) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "GEO", 299, "Skipping zero sized profile:", inst);
|
||||
logger_.Message(Logger::LOG_NOTICE, "GEO", 299, "Skipping zero sized profile:", inst);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************
|
||||
/********************************************************************************
|
||||
* *
|
||||
* This file is part of IfcOpenShell. *
|
||||
* *
|
||||
@@ -32,8 +32,8 @@ using namespace IfcGeom;
|
||||
|
||||
namespace {
|
||||
struct POSTFIX_SCHEMA(factory_t) {
|
||||
abstract_mapping* operator()(IfcParse::IfcFile* file, Settings& settings) const {
|
||||
ifcopenshell::geometry::POSTFIX_SCHEMA(mapping)* m = new ifcopenshell::geometry::POSTFIX_SCHEMA(mapping)(file, settings);
|
||||
abstract_mapping* operator()(IfcParse::IfcFile* file, Settings& settings, Logger& logger) const {
|
||||
ifcopenshell::geometry::POSTFIX_SCHEMA(mapping)* m = new ifcopenshell::geometry::POSTFIX_SCHEMA(mapping)(file, settings, logger);
|
||||
return m;
|
||||
}
|
||||
};
|
||||
@@ -83,7 +83,7 @@ IfcSchema::IfcProduct::list::ptr mapping::products_represented_by(const IfcSchem
|
||||
try {
|
||||
target = taxonomy::cast<taxonomy::matrix4>(map(item->MappingTarget()));
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error("GEO", 300, e);
|
||||
logger_.Error("GEO", 300, e);
|
||||
continue;
|
||||
}
|
||||
if (!target->is_identity()) {
|
||||
@@ -332,7 +332,7 @@ const IfcUtil::IfcBaseEntity* mapping::get_single_material_association(const Ifc
|
||||
try {
|
||||
associated_material = (*associated_materials->begin())->RelatingMaterial();
|
||||
} catch(IfcParse::IfcException& e) {
|
||||
Logger::Error("GEO", 301, e.what());
|
||||
logger_.Error("GEO", 301, e.what());
|
||||
}
|
||||
|
||||
if (associated_material) {
|
||||
@@ -344,7 +344,7 @@ const IfcUtil::IfcBaseEntity* mapping::get_single_material_association(const Ifc
|
||||
IfcSchema::IfcMaterialLayerSet* layerset;
|
||||
if (auto *m = associated_material->as<IfcSchema::IfcMaterialLayerSetUsage>()) {
|
||||
if (m->get("ForLayerSet").isNull()) {
|
||||
Logger::Warning("GEO", 302, "Missing ForLayerSet for:", m);
|
||||
logger_.Warning("GEO", 302, "Missing ForLayerSet for:", m);
|
||||
return nullptr;
|
||||
}
|
||||
layerset = m->ForLayerSet();
|
||||
@@ -363,7 +363,7 @@ const IfcUtil::IfcBaseEntity* mapping::get_single_material_association(const Ifc
|
||||
IfcSchema::IfcMaterialProfileSet* profileset;
|
||||
if (auto* m = associated_material->as<IfcSchema::IfcMaterialProfileSetUsage>()) {
|
||||
if (m->get("ForProfileSet").isNull()) {
|
||||
Logger::Warning("GEO", 303, "Missing ForProfileSet for:", m);
|
||||
logger_.Warning("GEO", 303, "Missing ForProfileSet for:", m);
|
||||
return nullptr;
|
||||
}
|
||||
profileset = m->ForProfileSet();
|
||||
@@ -408,7 +408,7 @@ IfcSchema::IfcRepresentation* mapping::representation_mapped_to(const IfcSchema:
|
||||
try {
|
||||
target = taxonomy::cast<taxonomy::matrix4>(map(mapped_item->MappingTarget()));
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error("GEO", 304, e);
|
||||
logger_.Error("GEO", 304, e);
|
||||
}
|
||||
if (target && target->is_identity()) {
|
||||
IfcSchema::IfcRepresentationMap* rmap = mapped_item->MappingSource();
|
||||
@@ -571,7 +571,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcMaterial* material) {
|
||||
failed_on_purpose_.insert(material);
|
||||
return nullptr;
|
||||
}
|
||||
Logger::Warning("UNS", 19, "Skipping unsupported material style for material: ", material);
|
||||
logger_.Warning("UNS", 19, "Skipping unsupported material style for material: ", material);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcStyledItem* inst) {
|
||||
|
||||
if (style == nullptr) {
|
||||
// E.g. IfcCurveStyle is skipped as unsupported.
|
||||
Logger::Warning("GEO", 305, "Only IfcSurfaceStyle is supported, couldn't find it in IfcStyledItem: ", inst);
|
||||
logger_.Warning("GEO", 305, "Only IfcSurfaceStyle is supported, couldn't find it in IfcStyledItem: ", inst);
|
||||
failed_on_purpose_.insert(inst);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceStyle* style) {
|
||||
|
||||
taxonomy::ptr mapping::map(const IfcBaseInterface* inst) {
|
||||
if (inst == nullptr) {
|
||||
Logger::Error("GEO", 306, "Warning nullptr passed to map() function");
|
||||
logger_.Error("GEO", 306, "Warning nullptr passed to map() function");
|
||||
return nullptr;
|
||||
}
|
||||
auto iden = inst->as<IfcUtil::IfcBaseClass>()->identity();
|
||||
@@ -727,7 +727,7 @@ taxonomy::ptr mapping::map(const IfcBaseInterface* inst) {
|
||||
cache_.insert({iden, item});
|
||||
}
|
||||
} else if (!matched) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 307, "No operation defined for:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 307, "No operation defined for:", inst);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@@ -833,10 +833,10 @@ void mapping::initialize_units_() {
|
||||
auto* project = *projects->begin();
|
||||
unit_assignment = project->UnitsInContext();
|
||||
} else {
|
||||
Logger::Warning("GEO", 308, "Not a single project or context in file");
|
||||
logger_.Warning("GEO", 308, "Not a single project or context in file");
|
||||
}
|
||||
if (unit_assignment == nullptr) {
|
||||
Logger::Warning("GEO", 309, "Unable to detect unit information");
|
||||
logger_.Warning("GEO", 309, "Unable to detect unit information");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ void mapping::initialize_units_() {
|
||||
try {
|
||||
auto units = unit_assignment->Units();
|
||||
if (!units || !units->size()) {
|
||||
Logger::Warning("GEO", 310, "No unit information found");
|
||||
logger_.Warning("GEO", 310, "No unit information found");
|
||||
} else {
|
||||
for (auto it = units->begin(); it != units->end(); ++it) {
|
||||
IfcSchema::IfcUnit* base = *it;
|
||||
@@ -882,15 +882,15 @@ void mapping::initialize_units_() {
|
||||
} catch (const IfcParse::IfcException& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to determine unit information '" << ex.what() << "'";
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 311, ss.str());
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 311, ss.str());
|
||||
}
|
||||
|
||||
if (!length_unit_encountered) {
|
||||
Logger::Warning("GEO", 312, "No length unit encountered");
|
||||
logger_.Warning("GEO", 312, "No length unit encountered");
|
||||
}
|
||||
|
||||
if (!angle_unit_encountered) {
|
||||
Logger::Warning("GEO", 313, "No plane angle unit encountered");
|
||||
logger_.Warning("GEO", 313, "No plane angle unit encountered");
|
||||
}
|
||||
|
||||
// @todo move to a more descriptive function
|
||||
@@ -907,7 +907,7 @@ void mapping::initialize_units_() {
|
||||
if (vs.size() == 3) {
|
||||
offset_and_rotation_ *= Eigen::Affine3d(Eigen::Translation3d(vs[0], vs[1], vs[2])).matrix();
|
||||
} else {
|
||||
Logger::Error("SYS", 31, "Expected 3 values for model-offset setting");
|
||||
logger_.Error("SYS", 31, "Expected 3 values for model-offset setting");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ void mapping::initialize_units_() {
|
||||
m4 << m3;
|
||||
offset_and_rotation_ *= m4;
|
||||
} else {
|
||||
Logger::Error("SYS", 32, "Expected 4 values for model-rotation setting");
|
||||
logger_.Error("SYS", 32, "Expected 4 values for model-rotation setting");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -970,7 +970,7 @@ void mapping::initialize_settings() {
|
||||
|
||||
if (any_precision_encountered) {
|
||||
if (lowest_precision_encountered < 1.e-7) {
|
||||
Logger::Message(Logger::LOG_WARNING, "SYS", 33, "Precision lower than 0.0000001 meter not enforced");
|
||||
logger_.Message(Logger::LOG_WARNING, "SYS", 33, "Precision lower than 0.0000001 meter not enforced");
|
||||
precision_to_set = 1.e-7;
|
||||
} else {
|
||||
precision_to_set = lowest_precision_encountered;
|
||||
@@ -1007,7 +1007,7 @@ bool mapping::get_layerset_information(const IfcUtil::IfcBaseInterface* p, layer
|
||||
IfcSchema::IfcRepresentation* body_representation = find_representation(product, "Body");
|
||||
|
||||
if (!body_representation) {
|
||||
Logger::Warning("GEO", 314, "No body representation for product", product);
|
||||
logger_.Warning("GEO", 314, "No body representation for product", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ bool mapping::get_layerset_information(const IfcUtil::IfcBaseInterface* p, layer
|
||||
IfcSchema::IfcRepresentation* axis_representation = find_representation(product, "Axis");
|
||||
|
||||
if (!axis_representation) {
|
||||
Logger::Message(Logger::LOG_WARNING, "GEO", 315, "No axis representation for:", product);
|
||||
logger_.Message(Logger::LOG_WARNING, "GEO", 315, "No axis representation for:", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1090,7 +1090,7 @@ bool mapping::get_layerset_information(const IfcUtil::IfcBaseInterface* p, layer
|
||||
IfcSchema::IfcExtrudedAreaSolid::list::ptr extrusions = IfcParse::traverse(body_representation)->as<IfcSchema::IfcExtrudedAreaSolid>();
|
||||
|
||||
if (extrusions->size() != 1) {
|
||||
Logger::Message(Logger::LOG_WARNING, "GEO", 316, "No single extrusion found in body representation for:", product);
|
||||
logger_.Message(Logger::LOG_WARNING, "GEO", 316, "No single extrusion found in body representation for:", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,7 @@ bool mapping::get_layerset_information(const IfcUtil::IfcBaseInterface* p, layer
|
||||
if (has_position) {
|
||||
auto m4 = taxonomy::cast<taxonomy::matrix4>(map(extrusion->Position()));
|
||||
if (!m4) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 317, "Failed to convert placement for extrusion of:", product);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 317, "Failed to convert placement for extrusion of:", product);
|
||||
return false;
|
||||
} else {
|
||||
extrusion_position = m4;
|
||||
@@ -1115,7 +1115,7 @@ bool mapping::get_layerset_information(const IfcUtil::IfcBaseInterface* p, layer
|
||||
taxonomy::direction3::ptr extrusion_direction = taxonomy::cast<taxonomy::direction3>(map(extrusion->ExtrudedDirection()));
|
||||
|
||||
if (!extrusion_direction) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 318, "Failed to convert direction for extrusion of:", product);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 318, "Failed to convert direction for extrusion of:", product);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1189,12 +1189,12 @@ void mapping::addRepresentationsFromContextIds(IfcSchema::IfcRepresentation::lis
|
||||
try {
|
||||
context = file_->instance_by_id(context_id)->as<IfcSchema::IfcGeometricRepresentationContext>();
|
||||
} catch (IfcParse::IfcException& e) {
|
||||
Logger::Error("GEO", 319, e);
|
||||
logger_.Error("GEO", 319, e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!context) {
|
||||
Logger::Error("GEO", 320, "Failed to process context ID " + std::to_string(context_id));
|
||||
logger_.Error("GEO", 320, "Failed to process context ID " + std::to_string(context_id));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1243,14 +1243,14 @@ void mapping::addRepresentationsFromDefaultContexts(IfcSchema::IfcRepresentation
|
||||
boost::to_lower(context_type);
|
||||
|
||||
if (allowed_context_types.find(context_type) == allowed_context_types.end()) {
|
||||
Logger::Warning("GEO", 321, std::string("ContextType '") + *context->ContextType() + "' not allowed:", context);
|
||||
logger_.Warning("GEO", 321, std::string("ContextType '") + *context->ContextType() + "' not allowed:", context);
|
||||
}
|
||||
if (context_types.find(context_type) != context_types.end()) {
|
||||
filtered_contexts->push(context);
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error("GEO", 322, e);
|
||||
logger_.Error("GEO", 322, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1280,7 +1280,7 @@ void mapping::addRepresentationsFromDefaultContexts(IfcSchema::IfcRepresentation
|
||||
}
|
||||
|
||||
if (representations->size() == 0) {
|
||||
Logger::Warning("GEO", 323, "No representations encountered in relevant contexts, using all");
|
||||
logger_.Warning("GEO", 323, "No representations encountered in relevant contexts, using all");
|
||||
representations->push(file_->instances_by_type<IfcSchema::IfcRepresentation>());
|
||||
}
|
||||
}
|
||||
@@ -1326,7 +1326,7 @@ IfcUtil::IfcBaseEntity* mapping::representation_of(const IfcUtil::IfcBaseEntity*
|
||||
intersection_no_box->push(r);
|
||||
}
|
||||
if (intersection_no_box->size() > 1) {
|
||||
Logger::Warning("GEO", 324, "Multiple applicable representations found for element, selecting arbitrary");
|
||||
logger_.Warning("GEO", 324, "Multiple applicable representations found for element, selecting arbitrary");
|
||||
}
|
||||
if (intersection_no_box->size()) {
|
||||
return (*intersection_no_box->begin())->as<IfcUtil::IfcBaseEntity>();
|
||||
|
||||
@@ -67,19 +67,19 @@ namespace geometry {
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 325, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 325, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
}
|
||||
} else if (failed_on_purpose_.find(inst) == failed_on_purpose_.end()) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 326, "Failed to convert:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 326, "Failed to convert:", inst);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Message(Logger::LOG_ERROR, "GEO", 327, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
logger_.Message(Logger::LOG_ERROR, "GEO", 327, std::string(e.what()) + "\nFailed to convert:", inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
const IfcSchema::IfcStyledItem* find_style(const IfcSchema::IfcRepresentationItem*);
|
||||
public:
|
||||
POSTFIX_SCHEMA(mapping)(IfcParse::IfcFile* file, Settings& settings) : abstract_mapping(settings), file_(file), placement_rel_to_type_(0), placement_rel_to_instance_(0) {
|
||||
POSTFIX_SCHEMA(mapping)(IfcParse::IfcFile* file, Settings& settings, Logger& logger = Logger::Root()) : abstract_mapping(settings, logger), file_(file), placement_rel_to_type_(0), placement_rel_to_instance_(0) {
|
||||
initialize_units_();
|
||||
}
|
||||
virtual ifcopenshell::geometry::taxonomy::ptr map(const IfcUtil::IfcBaseInterface*);
|
||||
@@ -153,4 +153,4 @@ namespace geometry {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user