mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
Merge remote-tracking branch 'origin/v0.8.0' into ifcviewer-wgpu
This commit is contained in:
@@ -66,13 +66,15 @@ namespace ifcopenshell {
|
||||
protected:
|
||||
std::string geometry_library_;
|
||||
Settings settings_;
|
||||
Logger& logger_;
|
||||
public:
|
||||
bool propagate_exceptions = false;
|
||||
bool partial_success_is_success = true;
|
||||
|
||||
AbstractKernel(const std::string& geometry_library, const Settings& settings)
|
||||
AbstractKernel(const std::string& geometry_library, const Settings& settings, Logger& logger = Logger::Root())
|
||||
: geometry_library_(geometry_library)
|
||||
, settings_(settings) {}
|
||||
, settings_(settings)
|
||||
, logger_(logger) {}
|
||||
|
||||
virtual ~AbstractKernel() = default;
|
||||
|
||||
@@ -87,6 +89,7 @@ namespace ifcopenshell {
|
||||
virtual bool accepts(const IfcGeom::ConversionResultShape& shape) const {
|
||||
return shape.backend_id() == backend_id();
|
||||
}
|
||||
Logger& logger() const { return logger_; }
|
||||
|
||||
virtual bool supports_boolean_operations() const = 0;
|
||||
|
||||
@@ -134,7 +137,7 @@ namespace ifcopenshell {
|
||||
const IfcGeom::ConversionResults& entity_shapes, const ifcopenshell::geometry::taxonomy::matrix4& entity_trsf, IfcGeom::ConversionResults& cut_shapes) = 0;
|
||||
virtual bool unify_shapes(const IfcGeom::ConversionResults&, IfcGeom::ConversionResults&) { throw not_implemented_error(); }
|
||||
|
||||
virtual AbstractKernel* clone() const = 0;
|
||||
virtual AbstractKernel* clone(Logger& logger) const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -157,13 +160,13 @@ namespace {
|
||||
|
||||
template <>
|
||||
struct dispatch_conversion<ifcopenshell::geometry::taxonomy::type_by_kind::max> {
|
||||
static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel* kernel, ifcopenshell::geometry::taxonomy::kinds, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) {
|
||||
if (kernel->partial_success_is_success) {
|
||||
static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel* kernel, ifcopenshell::geometry::taxonomy::kinds, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) {
|
||||
if (kernel->partial_success_is_success) {
|
||||
std::string created_from;
|
||||
if (item->instance) {
|
||||
created_from = " (created from " + item->instance.declaration().name() + ")";
|
||||
created_from = " (created from " + item->instance->declaration().name() + ")";
|
||||
}
|
||||
logger::error("No support for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
|
||||
kernel->logger().Error("UNS", 1, "No support for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -184,12 +187,12 @@ namespace {
|
||||
template <>
|
||||
struct dispatch_with_upgrade<ifcopenshell::geometry::taxonomy::upgrades::max> {
|
||||
static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel* kernel, const ifcopenshell::geometry::taxonomy::ptr& item, IfcGeom::ConversionResults&) {
|
||||
if (kernel->partial_success_is_success) {
|
||||
if (kernel->partial_success_is_success) {
|
||||
std::string created_from;
|
||||
if (item->instance) {
|
||||
created_from = " (created from " + item->instance.declaration().name() + ")";
|
||||
created_from = " (created from " + item->instance->declaration().name() + ")";
|
||||
}
|
||||
logger::error("No support (after considering item upgrade) for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
|
||||
kernel->logger().Error("UNS", 2, "No support (after considering item upgrade) for " + ifcopenshell::geometry::taxonomy::kind_to_string(item->kind()) + created_from + " in kernel " + kernel->geometry_library());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -226,7 +229,7 @@ namespace {
|
||||
template <typename T>
|
||||
struct dispatch_curve_creation<T, ifcopenshell::geometry::taxonomy::curves::max> {
|
||||
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
|
||||
logger::error("No conversion for " + std::to_string(item->kind()));
|
||||
Logger::Root().Error("GEO", 28, "No conversion for " + std::to_string(item->kind()));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -248,7 +251,7 @@ namespace {
|
||||
template <typename T>
|
||||
struct dispatch_surface_creation<T, ifcopenshell::geometry::taxonomy::surfaces::max> {
|
||||
static bool dispatch(const ifcopenshell::geometry::taxonomy::ptr& item, T&) {
|
||||
logger::error("No conversion for " + std::to_string(item->kind()));
|
||||
Logger::Root().Error("GEO", 29, "No conversion for " + std::to_string(item->kind()));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user