From 02481b3247a060a5d103e7ba430f356815344be9 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 8 Aug 2026 13:58:39 +0200 Subject: [PATCH] Wrap more classes into ifcopenshell:: namespace --- src/bonsaiviewer/modules/models/Commands.cpp | 4 +- .../modules/models/SettingsView.cpp | 4 +- src/examples/IfcParseExamples.cpp | 4 +- src/helpers/element.cpp | 8 +-- src/helpers/placement.cpp | 2 +- src/helpers/pset.cpp | 6 +- src/ifcconvert/IfcConvert.cpp | 44 ++++++------- src/ifcconvert/validate_space_boundaries.cpp | 2 +- .../validate_storey_containment.cpp | 2 +- src/ifcconvert/validate_wall_connectivity.cpp | 2 +- src/ifcconvert/validation_utils.h | 2 +- src/ifcgeom/AbstractKernel.h | 12 ++-- src/ifcgeom/ConversionResult.cpp | 2 +- src/ifcgeom/ConversionResult.h | 4 +- src/ifcgeom/Converter.cpp | 26 ++++---- src/ifcgeom/Converter.h | 6 +- src/ifcgeom/GeometrySerializer.h | 10 ++- src/ifcgeom/IfcGeomElement.h | 2 +- src/ifcgeom/Iterator.cpp | 12 ++-- src/ifcgeom/Iterator.h | 12 ++-- src/ifcgeom/Serializer.h | 10 ++- src/ifcgeom/abstract_mapping.cpp | 4 +- src/ifcgeom/abstract_mapping.h | 12 ++-- src/ifcgeom/function_item_evaluator.h | 4 +- src/ifcgeom/hybrid_kernel.h | 4 +- src/ifcgeom/infra_sweep_helper.h | 2 +- .../kernels/cgal/CgalConversionResult.cpp | 18 ++--- .../kernels/cgal/CgalConversionResult.h | 6 +- src/ifcgeom/kernels/cgal/CgalKernel.cpp | 65 ++++++++++--------- src/ifcgeom/kernels/cgal/CgalKernel.h | 12 ++-- .../kernels/cgal/nef_to_halfspace_tree.h | 4 ++ .../manifold/ManifoldConversionResult.cpp | 2 +- .../manifold/ManifoldConversionResult.h | 2 +- .../kernels/manifold/ManifoldKernel.cpp | 46 ++++++------- src/ifcgeom/kernels/manifold/ManifoldKernel.h | 4 +- .../OpenCascadeConversionResult.cpp | 8 +-- .../opencascade/OpenCascadeConversionResult.h | 2 +- .../kernels/opencascade/OpenCascadeKernel.cpp | 58 ++++++++--------- .../kernels/opencascade/OpenCascadeKernel.h | 4 +- .../kernels/opencascade/base_utils.cpp | 26 ++++---- .../kernels/opencascade/boolean_result.cpp | 4 +- .../kernels/opencascade/boolean_utils.cpp | 10 +-- .../kernels/opencascade/boolean_utils.h | 10 +-- .../kernels/opencascade/clash_utils.cpp | 4 ++ src/ifcgeom/kernels/opencascade/clash_utils.h | 4 ++ src/ifcgeom/kernels/opencascade/extrusion.cpp | 4 +- src/ifcgeom/kernels/opencascade/face.cpp | 28 ++++---- .../kernels/opencascade/faceset_helper.cpp | 6 +- src/ifcgeom/kernels/opencascade/layerset.cpp | 12 ++-- src/ifcgeom/kernels/opencascade/loft.cpp | 8 +-- src/ifcgeom/kernels/opencascade/loop.cpp | 6 +- src/ifcgeom/kernels/opencascade/shell.cpp | 6 +- .../kernels/opencascade/sweep_along_curve.cpp | 2 +- .../kernels/opencascade/sweep_utils.cpp | 4 +- .../kernels/opencascade/wire_builder.cpp | 20 +++--- .../kernels/opencascade/wire_utils.cpp | 34 +++++----- .../PassthroughConversionResult.cpp | 2 +- .../passthrough/PassthroughConversionResult.h | 2 +- .../kernels/passthrough/PassthroughKernel.h | 4 +- .../mapping/IfcAsymmetricIShapeProfileDef.cpp | 2 +- .../mapping/IfcAxis2PlacementLinear.cpp | 2 +- src/ifcgeom/mapping/IfcCShapeProfileDef.cpp | 2 +- src/ifcgeom/mapping/IfcCircle.cpp | 2 +- src/ifcgeom/mapping/IfcCompositeCurve.cpp | 10 +-- src/ifcgeom/mapping/IfcEdge.cpp | 4 +- src/ifcgeom/mapping/IfcEllipse.cpp | 2 +- src/ifcgeom/mapping/IfcEllipseProfileDef.cpp | 2 +- src/ifcgeom/mapping/IfcExtrudedAreaSolid.cpp | 2 +- .../mapping/IfcExtrudedAreaSolidTapered.cpp | 2 +- .../IfcFixedReferenceSweptAreaSolid.cpp | 2 +- src/ifcgeom/mapping/IfcHalfSpaceSolid.cpp | 2 +- src/ifcgeom/mapping/IfcIShapeProfileDef.cpp | 2 +- src/ifcgeom/mapping/IfcLShapeProfileDef.cpp | 4 +- src/ifcgeom/mapping/IfcObjectPlacement.cpp | 6 +- src/ifcgeom/mapping/IfcPolyLoop.cpp | 6 +- .../mapping/IfcRectangleHollowProfileDef.cpp | 2 +- .../mapping/IfcRectangleProfileDef.cpp | 2 +- .../mapping/IfcRectangularTrimmedSurface.cpp | 2 +- src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp | 2 +- .../mapping/IfcRoundedRectangleProfileDef.cpp | 2 +- .../mapping/IfcSurfaceCurveSweptAreaSolid.cpp | 6 +- src/ifcgeom/mapping/IfcSweptDiskSolid.cpp | 12 ++-- src/ifcgeom/mapping/IfcTShapeProfileDef.cpp | 4 +- .../mapping/IfcTrapeziumProfileDef.cpp | 2 +- src/ifcgeom/mapping/IfcTrimmedCurve.cpp | 6 +- src/ifcgeom/mapping/IfcUShapeProfileDef.cpp | 2 +- src/ifcgeom/mapping/IfcZShapeProfileDef.cpp | 2 +- src/ifcgeom/mapping/mapping.cpp | 16 ++--- src/ifcgeom/mapping/mapping.h | 8 +-- src/ifcgeom/mapping/plugin.cpp | 2 +- src/ifcgeom/profile_helper.cpp | 2 +- src/ifcgeom/taxonomy.cpp | 4 +- src/ifcgeom/taxonomy.h | 2 +- src/ifcparse/alignment_helper.cpp | 8 +-- src/ifcparse/alignment_helper.h | 8 +-- src/ifcparse/character_decoder.h | 2 +- src/ifcparse/entity_instance_data.cpp | 36 +++++----- src/ifcparse/express.cpp | 4 +- src/ifcparse/express.h | 10 +-- src/ifcparse/file.h | 26 ++++---- src/ifcparse/global_id.cpp | 4 +- src/ifcparse/global_id.h | 4 +- src/ifcparse/hierarchy_helper.h | 4 +- src/ifcparse/hierarchy_helper.i | 2 +- src/ifcparse/instance_data.h | 50 ++++++++------ src/ifcparse/logger.cpp | 6 ++ src/ifcparse/logger.h | 10 ++- src/ifcparse/parse.cpp | 56 ++++++++-------- src/ifcparse/parse.h | 4 +- src/ifcparse/schema.h | 4 +- src/ifcparse/spf_header.cpp | 4 +- src/ifcparse/spf_header.h | 6 +- src/ifcparse/storage.h | 8 +-- src/ifcparse/utils.cpp | 6 +- src/ifcwrap/IfcGeomWrapper.i | 26 ++++---- src/ifcwrap/IfcParseWrapper.i | 22 +++---- src/serializers/ColladaSerializer.cpp | 2 +- src/serializers/ColladaSerializer.h | 6 +- src/serializers/GltfSerializer.cpp | 6 +- src/serializers/GltfSerializer.h | 4 +- src/serializers/IgesSerializer.h | 2 +- src/serializers/JsonSerializer.h | 6 +- src/serializers/OpenCascadeBasedSerializer.h | 6 +- src/serializers/RocksDbSerializer.cpp | 16 ++--- src/serializers/RocksDbSerializer.h | 4 +- src/serializers/StepSerializer.h | 2 +- src/serializers/SvgSerializer.cpp | 2 +- src/serializers/SvgSerializer.h | 14 ++-- src/serializers/TtlWktSerializer.cpp | 4 +- src/serializers/USDSerializer.cpp | 4 +- src/serializers/USDSerializer.h | 4 +- src/serializers/WavefrontObjSerializer.cpp | 4 +- src/serializers/WavefrontObjSerializer.h | 4 +- src/serializers/XmlSerializer.h | 6 +- src/serializers/document_rdb_plugin.cpp | 2 +- .../document_serializer_plugin.cpp | 8 +-- src/serializers/document_serializer_plugin.h | 2 + .../geometry_serializer_plugin.cpp | 8 +-- src/serializers/geometry_serializer_plugin.h | 2 + .../schema_dependent/JsonSerializer.cpp | 16 ++--- .../schema_dependent/JsonSerializer.h | 2 +- .../schema_dependent/XmlSerializer.cpp | 34 +++++----- .../schema_dependent/XmlSerializer.h | 2 +- .../schema_dependent/json_plugin.cpp | 2 +- .../schema_dependent/xml_plugin.cpp | 2 +- src/svgfill/src/arrange_polygons.cpp | 52 +++++++-------- .../src/linework_processing_facade.cpp | 2 +- src/svgfill/src/linework_processing_plugin.h | 2 +- src/svgfill/src/svgfill.h | 4 +- 149 files changed, 678 insertions(+), 627 deletions(-) diff --git a/src/bonsaiviewer/modules/models/Commands.cpp b/src/bonsaiviewer/modules/models/Commands.cpp index fcd7a02fea..557c034bd5 100644 --- a/src/bonsaiviewer/modules/models/Commands.cpp +++ b/src/bonsaiviewer/modules/models/Commands.cpp @@ -685,7 +685,7 @@ void convertIfcToDatabase(SessionState& session, QWidget& host) { throw ifcopenshell::exception("RDB serializer does not support streaming from an input filename"); } - boost::shared_ptr serializer = registry.create("rdb", context); + boost::shared_ptr serializer = registry.create("rdb", context); serializer->finalize(); } catch (const std::exception& e) { *error_message = QString::fromUtf8(e.what()); @@ -791,7 +791,7 @@ void exportGeometryDatabase(SessionState& session, QWidget& host) { throw ifcopenshell::exception("RDB serializer does not support streaming from an input filename"); } - boost::shared_ptr serializer = registry.create("rdb", context); + boost::shared_ptr serializer = registry.create("rdb", context); serializer->finalize(); serializer.reset(); diff --git a/src/bonsaiviewer/modules/models/SettingsView.cpp b/src/bonsaiviewer/modules/models/SettingsView.cpp index a181e767c3..01c22c8ab9 100644 --- a/src/bonsaiviewer/modules/models/SettingsView.cpp +++ b/src/bonsaiviewer/modules/models/SettingsView.cpp @@ -75,10 +75,10 @@ QString formatCachedUnitScale(double meters_per_unit) { return QString("Cached scale: 1 unit = %1 m").arg(formatNumber(meters_per_unit)); } -std::string enumString(const attribute_value& av) { +std::string enumString(const ifcopenshell::attribute_value& av) { if (av.isNull()) return {}; if (av.type() != ifcopenshell::Argument_ENUMERATION) return {}; - enumeration_reference enumeration = av; + ifcopenshell::enumeration_reference enumeration = av; return std::string(enumeration.value() ? enumeration.value() : ""); } diff --git a/src/examples/IfcParseExamples.cpp b/src/examples/IfcParseExamples.cpp index 4e86a8fe99..4ba4dea293 100644 --- a/src/examples/IfcParseExamples.cpp +++ b/src/examples/IfcParseExamples.cpp @@ -70,7 +70,7 @@ typedef IfcSchema::IfcBuildingElement element_t; typedef IfcSchema::IfcBuiltElement element_t; #endif -std::string format_string(const attribute_value& argument) { +std::string format_string(const ifcopenshell::attribute_value& argument) { // Argument is a runtime tagged variant for the various data types in a IFC model, // in this particular case we only care about flattening it to a string. // @todo mostly duplicated from XmlSerializer.cpp @@ -213,7 +213,7 @@ int main(int argc, char** argv) { #endif // Redirect the output (both progress and log) to stdout - ::logger::root().set_output(&std::cout, &std::cout); + ifcopenshell::logger::root().set_output(&std::cout, &std::cout); // Parse the IFC file provided in argv[1] ifcopenshell::file file(argv[1]); diff --git a/src/helpers/element.cpp b/src/helpers/element.cpp index 9485fcbf45..ef2ee77876 100644 --- a/src/helpers/element.cpp +++ b/src/helpers/element.cpp @@ -52,7 +52,7 @@ std::string schema_name(const express::base& instance) { // A primitive scalar attribute value formatted for display, or std::nullopt for // IFC null and for non-primitive values (entity references, aggregates/lists, // binary) — which the properties UI omits. -std::optional format_scalar(const attribute_value& value) { +std::optional format_scalar(const ifcopenshell::attribute_value& value) { if (value.isNull()) { return std::nullopt; } @@ -60,7 +60,7 @@ std::optional format_scalar(const attribute_value& value) { case ifcopenshell::Argument_STRING: return static_cast(value); case ifcopenshell::Argument_ENUMERATION: { - const enumeration_reference enumeration = value; + const ifcopenshell::enumeration_reference enumeration = value; return enumeration.value() ? std::string(enumeration.value()) : std::string(); } case ifcopenshell::Argument_INT: @@ -288,13 +288,13 @@ std::optional get_string_attribute(const express::base& element, if (index < 0) { return std::nullopt; } - const attribute_value value = element.get_attribute_value(static_cast(index)); + const ifcopenshell::attribute_value value = element.get_attribute_value(static_cast(index)); if (value.isNull()) { return std::nullopt; } switch (value.type()) { case ifcopenshell::Argument_ENUMERATION: { - const enumeration_reference enumeration = value; + const ifcopenshell::enumeration_reference enumeration = value; return enumeration.value() ? std::string(enumeration.value()) : std::string(); } case ifcopenshell::Argument_STRING: diff --git a/src/helpers/placement.cpp b/src/helpers/placement.cpp index be35216435..97729a2c11 100644 --- a/src/helpers/placement.cpp +++ b/src/helpers/placement.cpp @@ -144,7 +144,7 @@ double get_storey_elevation_s(const express::base& storey) { if (declaration != nullptr) { const std::ptrdiff_t index = declaration->attribute_index("Elevation"); if (index >= 0) { - const attribute_value value = storey.get_attribute_value(static_cast(index)); + const ifcopenshell::attribute_value value = storey.get_attribute_value(static_cast(index)); if (!value.isNull() && value.type() == ifcopenshell::Argument_DOUBLE) { return static_cast(value); } diff --git a/src/helpers/pset.cpp b/src/helpers/pset.cpp index 68be58550c..ecf64ca135 100644 --- a/src/helpers/pset.cpp +++ b/src/helpers/pset.cpp @@ -69,7 +69,7 @@ std::string schema_name(const express::base& instance) { throw ifcopenshell::exception("No helper implementation was built for schema " + name); } -property_value from_attribute(const attribute_value& value); +property_value from_attribute(const ifcopenshell::attribute_value& value); template property_list scalar_list(const std::vector& values) { @@ -81,7 +81,7 @@ property_list scalar_list(const std::vector& values) { return result; } -property_value from_attribute(const attribute_value& value) { +property_value from_attribute(const ifcopenshell::attribute_value& value) { if (value.isNull()) { return {}; } @@ -103,7 +103,7 @@ property_value from_attribute(const attribute_value& value) { case ifcopenshell::Argument_STRING: return static_cast(value); case ifcopenshell::Argument_ENUMERATION: { - const enumeration_reference enumeration = value; + const ifcopenshell::enumeration_reference enumeration = value; return enumeration.value() ? enumeration.value() : ""; } case ifcopenshell::Argument_BINARY: { diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 13329af81f..136031427f 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -219,7 +219,7 @@ bool file_exists(const std::string& filename) { static std::basic_stringstream log_stream; void write_log(bool); -void fix_quantities(ifcopenshell::file&, bool, bool, bool, logger& logger = ::logger::root()); +void fix_quantities(ifcopenshell::file&, bool, bool, bool, ifcopenshell::logger& logger = ifcopenshell::logger::root()); std::string format_duration(time_t start, time_t end); /// @todo make the filters non-global @@ -249,7 +249,7 @@ size_t read_filters_from_file(const std::string&, inclusion_filter&, inclusion_t void parse_filter(geom_filter &, const std::vector&); std::vector setup_filters(const std::vector&, const std::string&); -bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, logger& logger = ::logger::root()); +bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); // from https://stackoverflow.com/questions/31696328/boost-program-options-using-zero-parameter-options-multiple-times struct verbosity_counter { @@ -271,7 +271,7 @@ int main(int argc, char** argv) { typedef po::command_line_parser command_line_parser; typedef char char_t; #endif - logger logger; + ifcopenshell::logger logger; inclusion_filter include_filter; inclusion_traverse_filter include_traverse_filter; @@ -471,9 +471,9 @@ int main(int argc, char** argv) { if (vmap.count("log-format") == 1) { boost::to_lower(log_format); if (log_format == "plain") { - logger.output_format(::logger::FMT_PLAIN); + logger.output_format(ifcopenshell::logger::FMT_PLAIN); } else if (log_format == "json") { - logger.output_format(::logger::FMT_JSON); + logger.output_format(ifcopenshell::logger::FMT_JSON); } else { cerr_ << "[error] --log-format should be either plain or json" << std::endl; print_usage(); @@ -555,19 +555,19 @@ int main(int argc, char** argv) { switch (vcounter.count) { case 0: - logger.verbosity(::logger::LOG_ERROR); + logger.verbosity(ifcopenshell::logger::LOG_ERROR); break; case 1: - logger.verbosity(::logger::LOG_NOTICE); + logger.verbosity(ifcopenshell::logger::LOG_NOTICE); break; case 2: - logger.verbosity(::logger::LOG_DEBUG); + logger.verbosity(ifcopenshell::logger::LOG_DEBUG); break; case 3: - logger.verbosity(::logger::LOG_PERF); + logger.verbosity(ifcopenshell::logger::LOG_PERF); break; case 4: - logger.verbosity(::logger::LOG_PERF); + logger.verbosity(ifcopenshell::logger::LOG_PERF); logger.print_performance_stats_on_element(true); break; } @@ -618,7 +618,7 @@ int main(int argc, char** argv) { context.schema_name = ifc_file ? ifc_file->schema()->name() : document_serializer_info->schema_name; context.stream = use_input_filename; - boost::shared_ptr serializer = document_serializer_registry.create(output_extension_utf8, context); + boost::shared_ptr serializer = document_serializer_registry.create(output_extension_utf8, context); if (serializer->is_streaming() != use_input_filename) { throw ifcopenshell::exception("Selected document serializer streaming mode does not match its registry metadata"); } @@ -752,7 +752,7 @@ int main(int argc, char** argv) { settings }; - boost::shared_ptr serializer; /**< @todo use std::unique_ptr when possible */ + boost::shared_ptr serializer; /**< @todo use std::unique_ptr when possible */ try { geometry_serializer_registry.configure(output_extension_utf8, serializer_context); serializer = geometry_serializer_registry.create(output_extension_utf8, serializer_context); @@ -895,7 +895,7 @@ int main(int argc, char** argv) { context_iterator.reset(new ifcopenshell::geom::iterator(ifcopenshell::geom::kernels::construct(ifc_file, geometry_kernel, settings), settings, ifc_file, filter_funcs, num_threads, logger)); } - logger.message(::logger::LOG_PERF, "file geometry conversion"); + logger.message(ifcopenshell::logger::LOG_PERF, "file geometry conversion"); if (context_iterator && !context_iterator->initialize()) { /// @todo It would be nice to know and print separate error prints for a case where we found no entities @@ -965,7 +965,7 @@ int main(int argc, char** argv) { if (stderr_progress) cerr_ << std::flush; } else if (vcounter.count == 2) { - logger.message(::logger::LOG_DEBUG, "SYS", 23, "Progress " + boost::lexical_cast(progress)); + logger.message(ifcopenshell::logger::LOG_DEBUG, "SYS", 23, "Progress " + boost::lexical_cast(progress)); } else { progress = progress / 2; if (old_progress != progress) logger.progress_bar(progress); @@ -1005,7 +1005,7 @@ int main(int argc, char** argv) { // Make sure the dtor is explicitly run here (e.g. output files are closed before renaming them). serializer.reset(); - logger.message(::logger::LOG_PERF, "GEO", 26, "done file geometry conversion"); + logger.message(ifcopenshell::logger::LOG_PERF, "GEO", 26, "done file geometry conversion"); bool successful; if (geometry_serializer_info->writes_final_output) { @@ -1023,17 +1023,17 @@ int main(int argc, char** argv) { output_temp_filename << "' for the conversion result."; } - if (settings.get().get() && logger.max_severity() >= ::logger::LOG_ERROR) { + if (settings.get().get() && logger.max_severity() >= ifcopenshell::logger::LOG_ERROR) { logger.error("SYS", 24, "Errors encountered during processing."); successful = false; } - if (fail_on_error && logger.max_severity() >= ::logger::LOG_ERROR) { + if (fail_on_error && logger.max_severity() >= ifcopenshell::logger::LOG_ERROR) { logger.error("SYS", 26, "Errors encountered during processing, failing due to --fail-on-error."); successful = false; } - if (logger.verbosity() == ::logger::LOG_PERF) { + if (logger.verbosity() == ifcopenshell::logger::LOG_PERF) { logger.print_performance_stats(); } @@ -1080,7 +1080,7 @@ void write_log(bool header) { #include -bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties, logger& logger) { +bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties, ifcopenshell::logger& logger) { time_t start, end; // Prevent file::Init() prints by setting output to null temporarily @@ -1314,7 +1314,7 @@ namespace latebound_access { enum_type->enumeration_items().end(), t); - return set(inst, attr, enumeration_reference(enum_type, it - enum_type->enumeration_items().begin())); + return set(inst, attr, ifcopenshell::enumeration_reference(enum_type, it - enum_type->enumeration_items().begin())); } template @@ -1323,7 +1323,7 @@ namespace latebound_access { auto i = decl->attribute_index(attr); auto attr_type = decl->attribute_by_index(i)->type_of_attribute(); - if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same::value) { + if (attr_type->as_named_type() && attr_type->as_named_type()->declared_type()->as_enumeration_type() && !std::is_same::value) { set_enumeration(inst, attr, attr_type->as_named_type()->declared_type()->as_enumeration_type(), t); } else { inst.set_attribute_value(i, t); @@ -1336,7 +1336,7 @@ namespace latebound_access { } } -void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger) { +void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, ifcopenshell::logger& logger) { { auto delete_reversed = [&f](const std::vector& insts) { // Lists are traversed back to front as the list may be mutated when diff --git a/src/ifcconvert/validate_space_boundaries.cpp b/src/ifcconvert/validate_space_boundaries.cpp index bcc018aa12..5e4bf74331 100644 --- a/src/ifcconvert/validate_space_boundaries.cpp +++ b/src/ifcconvert/validate_space_boundaries.cpp @@ -18,7 +18,7 @@ typedef CGAL::AABB_traits Traits; typedef CGAL::AABB_tree Tree; typedef Tree::Point_and_primitive_id Point_and_primitive_id; -void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) { +void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, ifcopenshell::logger& logger = ifcopenshell::logger::root()) { intersection_validator v(f, { "IfcWall", "IfcSpace", "IfcSlab", "IfcCovering" }, 1.e-5, no_progress, quiet, stderr_progress, logger); auto rels = f.instances_by_type("IfcRelSpaceBoundary"); diff --git a/src/ifcconvert/validate_storey_containment.cpp b/src/ifcconvert/validate_storey_containment.cpp index 9d706b54d0..10e00169e8 100644 --- a/src/ifcconvert/validate_storey_containment.cpp +++ b/src/ifcconvert/validate_storey_containment.cpp @@ -9,7 +9,7 @@ #include -void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) { +void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, ifcopenshell::logger& logger = ifcopenshell::logger::root()) { ifcopenshell::geom::settings settings; settings.get().value = false; diff --git a/src/ifcconvert/validate_wall_connectivity.cpp b/src/ifcconvert/validate_wall_connectivity.cpp index e4e6674d25..423f5a7f66 100644 --- a/src/ifcconvert/validate_wall_connectivity.cpp +++ b/src/ifcconvert/validate_wall_connectivity.cpp @@ -9,7 +9,7 @@ using namespace ifcopenshell::geom; -void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) { +void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, bool stderr_progress, ifcopenshell::logger& logger = ifcopenshell::logger::root()) { intersection_validator v(f, { "IfcWall" }, 1.e-3, no_progress, quiet, stderr_progress, logger); ifcopenshell::geom::settings settings; diff --git a/src/ifcconvert/validation_utils.h b/src/ifcconvert/validation_utils.h index 0452079497..2924ba34e7 100644 --- a/src/ifcconvert/validation_utils.h +++ b/src/ifcconvert/validation_utils.h @@ -446,7 +446,7 @@ struct intersection_validator { std::set successfully_processed; - intersection_validator(ifcopenshell::file& f, std::initializer_list entities, double eps, bool no_progress, bool quiet, bool stderr_progress, logger& logger = ::logger::root()) { + intersection_validator(ifcopenshell::file& f, std::initializer_list entities, double eps, bool no_progress, bool quiet, bool stderr_progress, ifcopenshell::logger& logger = ifcopenshell::logger::root()) { ifcopenshell::geom::settings settings; settings.get().value = false; diff --git a/src/ifcgeom/AbstractKernel.h b/src/ifcgeom/AbstractKernel.h index f387afb595..9593e6b42b 100644 --- a/src/ifcgeom/AbstractKernel.h +++ b/src/ifcgeom/AbstractKernel.h @@ -66,12 +66,12 @@ namespace ifcopenshell { protected: std::string geometry_library_; ifcopenshell::geom::settings settings_; - ::logger& logger_; + ifcopenshell::logger& logger_; public: bool propagate_exceptions = false; bool partial_success_is_success = true; - abstract_kernel(const std::string& geometry_library, const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) + abstract_kernel(const std::string& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : geometry_library_(geometry_library) , settings_(settings) , logger_(logger) {} @@ -89,7 +89,7 @@ namespace ifcopenshell { virtual bool accepts(const ifcopenshell::geom::conversion_result_shape& shape) const { return shape.backend_id() == backend_id(); } - ::logger& logger() const { return logger_; } + ifcopenshell::logger& logger() const { return logger_; } virtual bool supports_boolean_operations() const = 0; @@ -137,7 +137,7 @@ namespace ifcopenshell { const ifcopenshell::geom::conversion_results& entity_shapes, const ifcopenshell::geom::taxonomy::matrix4& entity_trsf, ifcopenshell::geom::conversion_results& cut_shapes) = 0; virtual bool unify_shapes(const ifcopenshell::geom::conversion_results&, ifcopenshell::geom::conversion_results&) { throw not_implemented_error(); } - virtual abstract_kernel* clone(::logger& logger) const = 0; + virtual abstract_kernel* clone(ifcopenshell::logger& logger) const = 0; }; } } @@ -229,7 +229,7 @@ namespace { template struct dispatch_curve_creation { static bool dispatch(const ifcopenshell::geom::taxonomy::ptr& item, T&) { - ::logger::root().error("GEO", 28, "No conversion for " + std::to_string(item->kind())); + ifcopenshell::logger::root().error("GEO", 28, "No conversion for " + std::to_string(item->kind())); return false; } }; @@ -251,7 +251,7 @@ namespace { template struct dispatch_surface_creation { static bool dispatch(const ifcopenshell::geom::taxonomy::ptr& item, T&) { - ::logger::root().error("GEO", 29, "No conversion for " + std::to_string(item->kind())); + ifcopenshell::logger::root().error("GEO", 29, "No conversion for " + std::to_string(item->kind())); return false; } }; diff --git a/src/ifcgeom/ConversionResult.cpp b/src/ifcgeom/ConversionResult.cpp index fa7dc38d32..7817f14e38 100644 --- a/src/ifcgeom/ConversionResult.cpp +++ b/src/ifcgeom/ConversionResult.cpp @@ -1,7 +1,7 @@ #include "ConversionResult.h" #include "IfcGeomRepresentation.h" -ifcopenshell::geom::Representation::triangulation* ifcopenshell::geom::conversion_result_shape::Triangulate(const ifcopenshell::geom::settings& settings, ::logger& logger) const +ifcopenshell::geom::Representation::triangulation* ifcopenshell::geom::conversion_result_shape::Triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const { auto t = ifcopenshell::geom::Representation::triangulation::empty(settings); static ifcopenshell::geom::taxonomy::matrix4 iden; diff --git a/src/ifcgeom/ConversionResult.h b/src/ifcgeom/ConversionResult.h index 01421e52cd..78c4776da6 100644 --- a/src/ifcgeom/ConversionResult.h +++ b/src/ifcgeom/ConversionResult.h @@ -509,8 +509,8 @@ namespace ifcopenshell::geom { #else virtual std::string_view backend_id() const = 0; #endif - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const = 0; - ifcopenshell::geom::Representation::triangulation* Triangulate(const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const = 0; + ifcopenshell::geom::Representation::triangulation* Triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const = 0; virtual int surface_genus() const = 0; diff --git a/src/ifcgeom/Converter.cpp b/src/ifcgeom/Converter.cpp index ff35ce334f..2099b0da10 100644 --- a/src/ifcgeom/Converter.cpp +++ b/src/ifcgeom/Converter.cpp @@ -4,7 +4,7 @@ using namespace ifcopenshell::geom; -ifcopenshell::geom::converter::converter(std::unique_ptr&& geometry_library, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& logger) +ifcopenshell::geom::converter::converter(std::unique_ptr&& geometry_library, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) : kernel_(std::move(geometry_library)) , logger_(logger) { @@ -18,7 +18,7 @@ ifcopenshell::geom::converter::~converter() { } namespace { - void substitute_with_box_based_on_density(::logger& logger, ifcopenshell::geom::conversion_results& items, double& density) { + void substitute_with_box_based_on_density(ifcopenshell::logger& logger, ifcopenshell::geom::conversion_results& items, double& density) { int nv = 0; void* box = nullptr; double volume = 0.; @@ -102,7 +102,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for } if (!success) { - ::logger::root().error("Failed processing layerset"); + ifcopenshell::logger::root().error("Failed processing layerset"); } } } @@ -219,10 +219,10 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for kernel_->convert_openings(product, opening_items, shapes, *place, opened_shapes); } } catch (const std::exception& e) { - logger_.message(::logger::LOG_ERROR, "GEO", 33, std::string("Error processing openings for: ") + e.what() + ":", product); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 33, std::string("Error processing openings for: ") + e.what() + ":", product); caught_error = true; } catch (...) { - logger_.message(::logger::LOG_ERROR, "GEO", 34, "Error processing openings for:", product); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 34, "Error processing openings for:", product); } if (!(caught_error && opened_shapes.size() < shapes.size())) { @@ -306,12 +306,12 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for if (elem->geometry().calculate_surface_area(a_calc)) { double diff = std::abs(a_calc - a_file); if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) { - ::logger::root().error("Validation of surface area failed for:", product); + ifcopenshell::logger::root().error("Validation of surface area failed for:", product); } else { - ::logger::root().notice("Validation of surface area succeeded for:", product); + ifcopenshell::logger::root().notice("Validation of surface area succeeded for:", product); } } else { - ::logger::root().error("Validation of surface area failed for:", product); + ifcopenshell::logger::root().error("Validation of surface area failed for:", product); } } else if (q->as() && q->Name() == "Volume") { double v_calc; @@ -319,12 +319,12 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for if (elem->geometry().calculate_volume(v_calc)) { double diff = std::abs(v_calc - v_file); if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) { - ::logger::root().error("Validation of volume failed for:", product); + ifcopenshell::logger::root().error("Validation of volume failed for:", product); } else { - ::logger::root().notice("Validation of volume succeeded for:", product); + ifcopenshell::logger::root().notice("Validation of volume succeeded for:", product); } } else { - ::logger::root().error("Validation of volume failed for:", product); + ifcopenshell::logger::root().error("Validation of volume failed for:", product); } } else if (q->as() && q->Name() == "Shape Validation Properties") { auto qs2 = q->as()->HasQuantities(); @@ -343,9 +343,9 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for } } if (!all_succeeded) { - ::logger::root().error("Validation of surface genus failed for:", product); + ifcopenshell::logger::root().error("Validation of surface genus failed for:", product); } else { - ::logger::root().notice("Validation of surface genus succeeded for:", product); + ifcopenshell::logger::root().notice("Validation of surface genus succeeded for:", product); } } } diff --git a/src/ifcgeom/Converter.h b/src/ifcgeom/Converter.h index 32f26e23ac..cccfea4d16 100644 --- a/src/ifcgeom/Converter.h +++ b/src/ifcgeom/Converter.h @@ -21,17 +21,17 @@ namespace ifcopenshell { namespace geom { std::unique_ptr kernel_; ifcopenshell::geom::settings settings_; std::map cache_; - ::logger& logger_; + ifcopenshell::logger& logger_; public: ifcopenshell::geom::kernels::abstract_kernel* kernel() { return &*kernel_; } - converter(std::unique_ptr&& geometry_library, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()); + converter(std::unique_ptr&& geometry_library, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()); ~converter(); ifcopenshell::geom::abstract_mapping* mapping() const { return mapping_; } - ::logger& logger() const { return logger_; } + ifcopenshell::logger& logger() const { return logger_; } /* virtual NativeElement* convert( diff --git a/src/ifcgeom/GeometrySerializer.h b/src/ifcgeom/GeometrySerializer.h index 7505fe0fcc..67f7949154 100644 --- a/src/ifcgeom/GeometrySerializer.h +++ b/src/ifcgeom/GeometrySerializer.h @@ -62,12 +62,14 @@ public: } }; +namespace ifcopenshell::geom { + class IFC_GEOM_API geometry_serializer : public serializer { public: enum read_type { READ_BREP, READ_TRIANGULATION }; - geometry_serializer(const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) - : serializer(logger_or_root(logger)) + geometry_serializer(const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) + : serializer(ifcopenshell::logger_or_root(logger)) , settings_(settings) {} virtual ~geometry_serializer() {} @@ -96,11 +98,13 @@ protected: class IFC_GEOM_API write_only_geometry_serializer : public geometry_serializer { public: - write_only_geometry_serializer(const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) : geometry_serializer(settings, logger) {} + write_only_geometry_serializer(const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) : geometry_serializer(settings, logger) {} virtual ifcopenshell::geom::element* read(ifcopenshell::file&, const std::string&, const std::string&, read_type = READ_BREP) { throw std::runtime_error("Not supported"); }; }; +} // namespace ifcopenshell::geom + #endif diff --git a/src/ifcgeom/IfcGeomElement.h b/src/ifcgeom/IfcGeomElement.h index c454d1a4f6..00ad7b2d15 100644 --- a/src/ifcgeom/IfcGeomElement.h +++ b/src/ifcgeom/IfcGeomElement.h @@ -126,7 +126,7 @@ namespace ifcopenshell::geom { oss << "product-" << ifcopenshell::global_id(guid).formatted(); } catch (const std::exception& e) { oss << "product"; - ::logger::root().error("GEO", 39, e); + ifcopenshell::logger::root().error("GEO", 39, e); } } diff --git a/src/ifcgeom/Iterator.cpp b/src/ifcgeom/Iterator.cpp index 82a69a1601..bcfdd20046 100644 --- a/src/ifcgeom/Iterator.cpp +++ b/src/ifcgeom/Iterator.cpp @@ -204,11 +204,11 @@ void ifcopenshell::geom::iterator::process_concurrently() { worker_loggers_.reserve(conc_threads); for (unsigned i = 0; i < conc_threads; ++i) { worker_loggers_.emplace_back(std::make_unique()); - ::logger& worker_logger = *worker_loggers_.back(); + ifcopenshell::logger& worker_logger = *worker_loggers_.back(); worker_logger.verbosity(logger_.verbosity()); worker_logger.output_format(logger_.output_format()); worker_logger.print_performance_stats_on_element(logger_.print_performance_stats_on_element()); - if (worker_logger.output_format() != ::logger::FMT_INMEMORY) { + if (worker_logger.output_format() != ifcopenshell::logger::FMT_INMEMORY) { worker_logger.set_output(static_cast(nullptr), static_cast(nullptr)); } kernel_pool.push_back(new ifcopenshell::geom::converter(std::unique_ptr(converter_->kernel()->clone(worker_logger)), ifc_file, settings_, worker_logger)); @@ -362,7 +362,7 @@ express::base ifcopenshell::geom::iterator::create_shape_model_for_next_entity() void ifcopenshell::geom::iterator::create_element_(ifcopenshell::geom::converter* kernel, ifcopenshell::geom::settings settings, geometry_conversion_result* rep) { - ::logger& kernel_logger = kernel->logger(); + ifcopenshell::logger& kernel_logger = kernel->logger(); if (!settings_.get().get()) { rep->item = kernel->mapping()->map(rep->representation); @@ -422,13 +422,13 @@ void ifcopenshell::geom::iterator::create_element_(ifcopenshell::geom::converter kernel_logger.set_product(std::optional{}); } -ifcopenshell::geom::element* ifcopenshell::geom::iterator::process_based_on_settings(ifcopenshell::geom::settings settings, ifcopenshell::geom::brep_element* elem, ::logger& logger, ifcopenshell::geom::triangulation_element* previous) +ifcopenshell::geom::element* ifcopenshell::geom::iterator::process_based_on_settings(ifcopenshell::geom::settings settings, ifcopenshell::geom::brep_element* elem, ifcopenshell::logger& logger, ifcopenshell::geom::triangulation_element* previous) { if (settings.get().get() == ifcopenshell::geom::settings::SERIALIZED) { try { return new ifcopenshell::geom::serialized_element(*elem); } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 54, "Getting a serialized element from model failed."); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 54, "Getting a serialized element from model failed."); return nullptr; } } else if (settings.get().get() == ifcopenshell::geom::settings::TRIANGULATED) { @@ -440,7 +440,7 @@ ifcopenshell::geom::element* ifcopenshell::geom::iterator::process_based_on_sett return new triangulation_element(*elem, previous->geometry_pointer()); } } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 55, "Getting a triangulation element from model failed."); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 55, "Getting a triangulation element from model failed."); } return (triangulation_element*)nullptr; }); diff --git a/src/ifcgeom/Iterator.h b/src/ifcgeom/Iterator.h index ef1179155a..742f32f779 100644 --- a/src/ifcgeom/Iterator.h +++ b/src/ifcgeom/Iterator.h @@ -128,14 +128,14 @@ namespace ifcopenshell::geom { std::vector filters_; int num_threads_; std::string geometry_library_; - ::logger& logger_; + ifcopenshell::logger& logger_; // When single-threaded ifcopenshell::geom::converter* converter_; // When multi-threaded std::vector kernel_pool; - std::vector> worker_loggers_; + std::vector> worker_loggers_; // The object is fetched beforehand to be sure that get() returns a valid element triangulation_element* current_triangulation; @@ -170,7 +170,7 @@ namespace ifcopenshell::geom { ifcopenshell::geom::element* process_based_on_settings( ifcopenshell::geom::settings settings, ifcopenshell::geom::brep_element* elem, - ::logger& logger, + ifcopenshell::logger& logger, ifcopenshell::geom::triangulation_element* previous = nullptr); void flush_worker_log(ifcopenshell::geom::converter* kernel); @@ -183,7 +183,7 @@ namespace ifcopenshell::geom { ifcopenshell::geom::taxonomy::direction3::ptr remove_offset_(); public: - iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, const std::vector& filters, int num_threads, ::logger& logger = ::logger::root()) + iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, const std::vector& filters, int num_threads, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings) , ifc_file(file) , filters_(filters) @@ -195,7 +195,7 @@ namespace ifcopenshell::geom { { } - iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, ::logger& logger = ::logger::root()) + iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings) , ifc_file(file) , num_threads_(1) @@ -205,7 +205,7 @@ namespace ifcopenshell::geom { { } - iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, int num_threads, ::logger& logger = ::logger::root()) + iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, int num_threads, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings) , ifc_file(file) , num_threads_(num_threads) diff --git a/src/ifcgeom/Serializer.h b/src/ifcgeom/Serializer.h index 44631c851d..70be533075 100644 --- a/src/ifcgeom/Serializer.h +++ b/src/ifcgeom/Serializer.h @@ -23,13 +23,15 @@ #include "ifc_geom_api.h" #include "../ifcparse/file.h" +namespace ifcopenshell::geom { + class IFC_GEOM_API serializer { - ::logger& logger_; + ifcopenshell::logger& logger_; public: - explicit serializer(::logger& logger = ::logger::root()) : logger_(logger) {} + explicit serializer(ifcopenshell::logger& logger = ifcopenshell::logger::root()) : logger_(logger) {} virtual ~serializer() {} - ::logger& logger() const { return logger_; } + ifcopenshell::logger& logger() const { return logger_; } virtual bool ready() = 0; virtual bool is_streaming() const { return false; } @@ -38,4 +40,6 @@ public: virtual void setFile(ifcopenshell::file&) = 0; }; +} // namespace ifcopenshell::geom + #endif diff --git a/src/ifcgeom/abstract_mapping.cpp b/src/ifcgeom/abstract_mapping.cpp index 5139c02bd8..aff1a087ce 100644 --- a/src/ifcgeom/abstract_mapping.cpp +++ b/src/ifcgeom/abstract_mapping.cpp @@ -23,7 +23,7 @@ void ifcopenshell::geom::impl::mapping_registry::bind(const std::string& schema_ entry.module_ = module.meta().id.empty() ? plugin::module(mapping_plugin_metadata(schema_name)) : module; } -ifcopenshell::geom::abstract_mapping* ifcopenshell::geom::impl::mapping_registry::construct(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& log) { +ifcopenshell::geom::abstract_mapping* ifcopenshell::geom::impl::mapping_registry::construct(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& log) { const std::string schema_name_lower = boost::to_lower_copy(file->schema()->name()); auto it = entries_.find(schema_name_lower); if (it == entries_.end()) { @@ -56,6 +56,6 @@ void ifcopenshell::geom::impl::mapping_factory_implementation::bind(const std::s mapping_registry_instance().bind(schema_name, fn, plugin::module(mapping_plugin_metadata(schema_name))); } -ifcopenshell::geom::abstract_mapping* ifcopenshell::geom::impl::mapping_factory_implementation::construct(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& log) { +ifcopenshell::geom::abstract_mapping* ifcopenshell::geom::impl::mapping_factory_implementation::construct(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& log) { return mapping_registry_instance().construct(file, settings, log); } diff --git a/src/ifcgeom/abstract_mapping.h b/src/ifcgeom/abstract_mapping.h index 5912d52769..1b1d6b2826 100644 --- a/src/ifcgeom/abstract_mapping.h +++ b/src/ifcgeom/abstract_mapping.h @@ -49,12 +49,12 @@ namespace geom { class IFC_GEOM_API abstract_mapping { protected: ifcopenshell::geom::settings settings_; - ::logger& logger_; + ifcopenshell::logger& logger_; bool use_caching_ = true; public: - abstract_mapping(ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) : settings_(settings), logger_(logger) {} + abstract_mapping(ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings), logger_(logger) {} virtual ~abstract_mapping() {} virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&) = 0; @@ -73,19 +73,19 @@ namespace geom { const ifcopenshell::geom::settings& settings() const { return settings_; } ifcopenshell::geom::settings& settings() { return settings_; } - ::logger& logger() const { return logger_; } + ifcopenshell::logger& logger() const { return logger_; } bool use_caching() const { return use_caching_; } bool& use_caching() { return use_caching_; } }; namespace impl { - typedef boost::function3 mapping_fn; + typedef boost::function3 mapping_fn; class IFC_GEOM_API mapping_registry { public: void bind(const std::string& schema_name, mapping_fn fn, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module()); - abstract_mapping* construct(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()); + abstract_mapping* construct(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()); private: struct entry { @@ -102,7 +102,7 @@ namespace geom { public: mapping_factory_implementation(); void bind(const std::string& schema_name, mapping_fn); - abstract_mapping* construct(ifcopenshell::file*, ifcopenshell::geom::settings&, ::logger& logger = ::logger::root()); + abstract_mapping* construct(ifcopenshell::file*, ifcopenshell::geom::settings&, ifcopenshell::logger& logger = ifcopenshell::logger::root()); }; IFC_GEOM_API mapping_factory_implementation& mapping_implementations(); diff --git a/src/ifcgeom/function_item_evaluator.h b/src/ifcgeom/function_item_evaluator.h index 3aebdbb423..d0def47a1b 100644 --- a/src/ifcgeom/function_item_evaluator.h +++ b/src/ifcgeom/function_item_evaluator.h @@ -23,7 +23,7 @@ static taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop /// @brief Abstract class for evaluating a function_item. This class is specialized for each of the function_item types. struct IFC_GEOM_API fn_evaluator { - fn_evaluator(const ifcopenshell::geom::settings& settings, logger& logger = ::logger::root()) : settings_(settings), logger_(logger) { + fn_evaluator(const ifcopenshell::geom::settings& settings, logger& logger = ifcopenshell::logger::root()) : settings_(settings), logger_(logger) { } fn_evaluator(const fn_evaluator& other) = default; virtual ~fn_evaluator() = default; @@ -44,7 +44,7 @@ struct IFC_GEOM_API fn_evaluator { /// @brief utility class to evaluate function_item objects. class IFC_GEOM_API function_item_evaluator { public: - function_item_evaluator(const ifcopenshell::geom::settings& settings, taxonomy::function_item::const_ptr fn, logger& logger = ::logger::root()); + function_item_evaluator(const ifcopenshell::geom::settings& settings, taxonomy::function_item::const_ptr fn, logger& logger = ifcopenshell::logger::root()); function_item_evaluator(const function_item_evaluator& other); ~function_item_evaluator(); diff --git a/src/ifcgeom/hybrid_kernel.h b/src/ifcgeom/hybrid_kernel.h index 3df76be305..f62ec57c6a 100644 --- a/src/ifcgeom/hybrid_kernel.h +++ b/src/ifcgeom/hybrid_kernel.h @@ -32,7 +32,7 @@ namespace ifcopenshell { ifcopenshell::geom::abstract_mapping* mapping_; ifcopenshell::file* file_; public: - hybrid_kernel(const std::string& name, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, std::vector>&& kernels, ::logger& logger = ::logger::root()) + hybrid_kernel(const std::string& name, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, std::vector>&& kernels, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : abstract_kernel(name, settings, logger) , kernels_(std::move(kernels)) , mapping_(ifcopenshell::geom::impl::mapping_implementations().construct(file, settings, logger)) @@ -127,7 +127,7 @@ namespace ifcopenshell { } return false; } - virtual abstract_kernel* clone(::logger& logger) const + virtual abstract_kernel* clone(ifcopenshell::logger& logger) const { std::vector> ks; for (auto& k : kernels_) { diff --git a/src/ifcgeom/infra_sweep_helper.h b/src/ifcgeom/infra_sweep_helper.h index ff4aed4584..c449868b06 100644 --- a/src/ifcgeom/infra_sweep_helper.h +++ b/src/ifcgeom/infra_sweep_helper.h @@ -21,7 +21,7 @@ namespace ifcopenshell { } }; - IFC_GEOM_API taxonomy::loft::ptr make_loft(const ifcopenshell::geom::settings& settings, const express::base inst, const taxonomy::function_item::ptr& directrix, std::vector& cross_sections, logger& logger = ::logger::root()); + IFC_GEOM_API taxonomy::loft::ptr make_loft(const ifcopenshell::geom::settings& settings, const express::base inst, const taxonomy::function_item::ptr& directrix, std::vector& cross_sections, logger& logger = ifcopenshell::logger::root()); } } diff --git a/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp b/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp index 858966d4bc..be8219dc7d 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp +++ b/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp @@ -12,6 +12,8 @@ using ifcopenshell::geom::opaque_number; using ifcopenshell::geom::opaque_coordinate; using ifcopenshell::geom::conversion_result_shape; +using ifcopenshell::geom::normalized_plane_for_map; +using ifcopenshell::geom::plane_map; #ifdef IFOPSH_SIMPLE_KERNEL #define NumberType opaque_number @@ -266,7 +268,7 @@ namespace { } } -ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool convex, ::logger& logger) { +ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool convex, ifcopenshell::logger& logger) { shape_ = shape; convex_tag_ = convex; auto& poly = std::get(*shape_); @@ -362,7 +364,7 @@ void ifcopenshell::geom::cgal_shape::to_nef() const { } #endif -void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger) const { +void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { if (is_point() || is_wire()) { return; } @@ -415,7 +417,7 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se if (!all_triangles) { if (!shape_to_use->is_valid()) { - logger.message(::logger::LOG_ERROR, "GEO", 64, "Invalid Polyhedron_3 in object (before triangulation)"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 64, "Invalid Polyhedron_3 in object (before triangulation)"); return; } @@ -423,19 +425,19 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se try { success = CGAL::Polygon_mesh_processing::triangulate_faces(*shape_to_use); } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 65, "Triangulation crashed"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 65, "Triangulation crashed"); return; } CGAL::Polygon_mesh_processing::remove_degenerate_faces(*shape_to_use); if (!success) { - logger.message(::logger::LOG_ERROR, "GEO", 66, "Triangulation failed"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 66, "Triangulation failed"); return; } if (!shape_to_use->is_valid()) { - logger.message(::logger::LOG_ERROR, "GEO", 67, "Invalid Polyhedron_3 in object (after triangulation)"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 67, "Invalid Polyhedron_3 in object (after triangulation)"); return; } } @@ -464,7 +466,7 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se try { CGAL::Polygon_mesh_processing::compute_face_normals(*shape_to_use, face_normals_map); } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 68, "Face normal calculation failed"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 68, "Face normal calculation failed"); return; } @@ -1033,7 +1035,7 @@ bool ifcopenshell::geom::cgal_shape::surface_area_along_direction(double tol, co #ifndef IFOPSH_SIMPLE_KERNEL -void ifcopenshell::geom::cgal_shape_half_space_decomposition::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger) const { +void ifcopenshell::geom::cgal_shape_half_space_decomposition::Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger) const { throw std::runtime_error("Not implemented"); } diff --git a/src/ifcgeom/kernels/cgal/CgalConversionResult.h b/src/ifcgeom/kernels/cgal/CgalConversionResult.h index ec85c29d7b..dab7377ac8 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionResult.h +++ b/src/ifcgeom/kernels/cgal/CgalConversionResult.h @@ -188,7 +188,7 @@ namespace ifcopenshell { namespace geom { #endif public: - cgal_shape(const cgal_shape_t& shape, bool convex = false, ::logger& logger = ::logger::root()); + cgal_shape(const cgal_shape_t& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); cgal_shape(const cgal_point_t& point, bool convex = false); cgal_shape(const cgal_wire_t& wire, bool convex = false); @@ -226,7 +226,7 @@ namespace ifcopenshell { namespace geom { const cgal_point_t& point() const { return std::get(*shape_); } const cgal_wire_t& wire() const { return std::get(*shape_); } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual ifcopenshell::geom::conversion_result_shape* clone() const { @@ -319,7 +319,7 @@ namespace ifcopenshell { namespace geom { #endif } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual int surface_genus() const; diff --git a/src/ifcgeom/kernels/cgal/CgalKernel.cpp b/src/ifcgeom/kernels/cgal/CgalKernel.cpp index ade0217886..00219e855a 100644 --- a/src/ifcgeom/kernels/cgal/CgalKernel.cpp +++ b/src/ifcgeom/kernels/cgal/CgalKernel.cpp @@ -40,6 +40,7 @@ using namespace ifcopenshell::geom; using namespace ifcopenshell::geom::kernels; +using ifcopenshell::logger; namespace { struct polyhedron_builder : public CGAL::Modifier_base::HalfedgeDS> { @@ -48,7 +49,7 @@ namespace { logger& logger_; public: std::optional from_soup; - polyhedron_builder(std::list *face_list, logger& logger = ::logger::root()); + polyhedron_builder(std::list *face_list, logger& logger = ifcopenshell::logger::root()); void operator()(CGAL::Polyhedron_3::HalfedgeDS &hds); }; } @@ -76,7 +77,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_polyhedron(std::li polyhedron.normalize_border(); if (!polyhedron.is_valid(false, 1)) { - logger.message(::logger::LOG_ERROR, "GEO", 69, "create_polyhedron: Polyhedron not valid!"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 69, "create_polyhedron: Polyhedron not valid!"); // std::ofstream fresult; // fresult.open("/Users/ken/Desktop/invalid.off"); // fresult << polyhedron << std::endl; @@ -97,11 +98,11 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_polyhedron(const C nef_polyhedron.convert_to_polyhedron(polyhedron); return polyhedron; } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 70, "Conversion from Nef to polyhedron failed!"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 70, "Conversion from Nef to polyhedron failed!"); return CGAL::Polyhedron_3(); } } else { - logger.message(::logger::LOG_ERROR, "GEO", 71, "Nef polyhedron not simple: cannot create polyhedron!"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 71, "Nef polyhedron not simple: cannot create polyhedron!"); return CGAL::Polyhedron_3(); } } @@ -114,7 +115,7 @@ CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron); } } catch (CGAL::Failure_exception& e) { - logger.message(::logger::LOG_ERROR, "GEO", 72, e); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 72, e); } } CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron); @@ -122,7 +123,7 @@ CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron try { nef_polyhedron = CGAL::Nef_polyhedron_3(polyhedron); } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 73, "Conversion to Nef polyhedron failed!"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 73, "Conversion to Nef polyhedron failed!"); } return nef_polyhedron; } @@ -137,7 +138,7 @@ CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron); } } catch (CGAL::Failure_exception& e) { - logger.message(::logger::LOG_ERROR, "GEO", 74, e); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 74, e); } } @@ -148,11 +149,11 @@ CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron try { nef_polyhedron = CGAL::Nef_polyhedron_3(polyhedron); } catch (...) { - logger.message(::logger::LOG_ERROR, "GEO", 75, "Conversion to Nef polyhedron failed!"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 75, "Conversion to Nef polyhedron failed!"); } return nef_polyhedron; } else { - logger.message(::logger::LOG_ERROR, "GEO", 76, "Polyhedron not valid: cannot create Nef polyhedron!"); + logger.message(ifcopenshell::logger::LOG_ERROR, "GEO", 76, "Polyhedron not valid: cannot create Nef polyhedron!"); return CGAL::Nef_polyhedron_3(); } } @@ -215,10 +216,10 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) { if (!success) { if (this->partial_success_is_success) { - logger().message(::logger::LOG_WARNING, "Failed to convert face, skipping:", f->instance); + logger().message(ifcopenshell::logger::LOG_WARNING, "Failed to convert face, skipping:", f->instance); continue; } else { - logger().message(::logger::LOG_ERROR, "Failed to convert face:", f->instance); + logger().message(ifcopenshell::logger::LOG_ERROR, "Failed to convert face:", f->instance); return false; } } @@ -241,7 +242,7 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list } if (face->children.size() > 1 && num_outer_bounds > 1 && face->children.size() != num_outer_bounds) { - logger().message(::logger::LOG_ERROR, "GEO", 80, "Invalid configuration of boundaries for:", face->instance); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 80, "Invalid configuration of boundaries for:", face->instance); return false; } @@ -254,7 +255,7 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list cgal_wire_t wire; if (!convert(bound, wire)) { - logger().message(::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance); return false; } @@ -796,7 +797,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { } if (do_segments_intersect(segments)) { - logger().message(::logger::LOG_WARNING, "GEO", 86, "Skipping self-intersecting loop", loop->instance); + logger().message(ifcopenshell::logger::LOG_WARNING, "GEO", 86, "Skipping self-intersecting loop", loop->instance); return false; } @@ -824,7 +825,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { */ if (count < 3) { - logger().message(::logger::LOG_ERROR, "GEO", 87, "Not enough edges for:", loop->instance); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 87, "Not enough edges for:", loop->instance); return false; } @@ -1003,7 +1004,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b try { a.convert_to_polyhedron(a_poly); } catch (...) { - logger().message(::logger::LOG_ERROR, "GEO", 88, "Could not convert from Nef:", entity); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 88, "Could not convert from Nef:", entity); return false; } @@ -1202,7 +1203,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di try { nef_shape -= utils::create_nef_polyhedron(face_list); } catch (...) { - ::logger::root().message(::logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:"); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot subtract opening for:"); return false; } } @@ -1219,7 +1220,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di nef_shape.convert_to_polyhedron(shape); return true; } catch (...) { - ::logger::root().message(::logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:"); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "IfcExtrudedAreaSolid: cannot convert Nef to polyhedron for:"); return false; } */ @@ -1228,7 +1229,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t &shape) { const double& height = extrusion->depth; if (height < settings_.get().get()) { - logger().message(::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance); return false; } @@ -1364,13 +1365,13 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, cgal_shape_t shape = shape_const; if (!shape.is_valid()) { - logger().message(::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference); return false; } if (!shape.is_closed()) { // TODO: There can be substractions to remove parts of non-volumetric objects. Maybe iterate over all faces of an entity and put them in a Nef_polyhedron_3 through Boolean union? Highly inefficient but maybe desirable... - logger().message(::logger::LOG_ERROR, "UNS", 6, "Subtraction of openings not supported for non-closed geometry:", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "UNS", 6, "Subtraction of openings not supported for non-closed geometry:", log_reference); return false; } @@ -1380,17 +1381,17 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, success = CGAL::Polygon_mesh_processing::triangulate_faces(shape); } catch (CGAL::Failure_exception& e) { logger().notice("GEO", 91, e); - logger().message(::logger::LOG_ERROR, "GEO", 92, "Triangulation of geometry crashed:", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 92, "Triangulation of geometry crashed:", log_reference); return false; } if (!success) { - logger().message(::logger::LOG_ERROR, "GEO", 93, "Triangulation of geometry failed:", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 93, "Triangulation of geometry failed:", log_reference); return false; } if (CGAL::Polygon_mesh_processing::does_self_intersect(shape)) { - logger().message(::logger::LOG_ERROR, "GEO", 94, "Conversion to Nef will fail. Self-intersecting geometry:", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 94, "Conversion to Nef will fail. Self-intersecting geometry:", log_reference); return false; } @@ -1463,7 +1464,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, result = CGAL::Nef_polyhedron_3(shape); } catch (CGAL::Failure_exception& e) { logger().notice("GEO", 95, e); - logger().message(::logger::LOG_ERROR, "GEO", 96, "Could not convert geometry to Nef:", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 96, "Could not convert geometry to Nef:", log_reference); return false; } @@ -1536,7 +1537,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, result = CGAL::minkowski_sum_3(result, precision_cube_); } catch (CGAL::Failure_exception& e) { logger().notice("GEO", 97, e); - logger().message(::logger::LOG_ERROR, "GEO", 98, "Could not dilate boolean operand", log_reference); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 98, "Could not dilate boolean operand", log_reference); return false; } } @@ -1562,7 +1563,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, result.convert_to_polyhedron(convert_back); } catch (CGAL::Failure_exception& e) { logger().notice("GEO", 99, e); - logger().message(::logger::LOG_WARNING, "GEO", 100, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference); + logger().message(ifcopenshell::logger::LOG_WARNING, "GEO", 100, "Final conversion will likely fail. Could not convert geometry from Nef:", log_reference); } return true; @@ -2169,7 +2170,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio try { a.convert_to_polyhedron(a_poly); } catch (...) { - logger().message(::logger::LOG_ERROR, "GEO", 104, "Could not convert geometry with openings from Nef:", br->instance); + logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 104, "Could not convert geometry with openings from Nef:", br->instance); return false; } @@ -2260,7 +2261,7 @@ void polyhedron_builder::operator()(CGAL::Polyhedron_3::HalfedgeDS &hds // For now let's just skip over the triangle. We can also use // the Aff_transformation_3 stored in place to convert the 2d // coords back to 3d. - ::logger::root().warning("Ignoring triangulated facet with novel point likely due to self-intersections"); + ifcopenshell::logger::root().warning("Ignoring triangulated facet with novel point likely due to self-intersections"); logger_.warning("GEO", 105, "Ignoring triangulated facet with novel point likely due to self-intersections"); facet_vertices.erase(facet_vertices.end() - 1); break; @@ -2301,7 +2302,7 @@ void polyhedron_builder::operator()(CGAL::Polyhedron_3::HalfedgeDS &hds if (!CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(facet_vertices)) { // @todo seems to return false now, almost always? - // ::logger::root().warning("Reoriented polygonal surface"); + // ifcopenshell::logger::root().warning("Reoriented polygonal surface"); CGAL::Polygon_mesh_processing::orient_polygon_soup(unique_points_as_vector, facet_vertices); } CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(unique_points_as_vector, facet_vertices, *from_soup); @@ -2321,12 +2322,12 @@ void polyhedron_builder::operator()(CGAL::Polyhedron_3::HalfedgeDS &hds if (added_edges.find(p) != added_edges.end()) { if (reoriented) { facet_indices_to_delete.push_back(fi); - ::logger::root().notice("Removed facet"); + ifcopenshell::logger::root().notice("Removed facet"); valid = false; break; } else { std::reverse(f.begin(), f.end()); - ::logger::root().notice("Reversed facet"); + ifcopenshell::logger::root().notice("Reversed facet"); reoriented = true; goto check_edge_existence; } diff --git a/src/ifcgeom/kernels/cgal/CgalKernel.h b/src/ifcgeom/kernels/cgal/CgalKernel.h index e1a7b0dedf..b4b092b3aa 100644 --- a/src/ifcgeom/kernels/cgal/CgalKernel.h +++ b/src/ifcgeom/kernels/cgal/CgalKernel.h @@ -60,12 +60,12 @@ namespace ifcopenshell { namespace utils { IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_cube(double d); IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper); - IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(std::list &face_list, bool stitch_borders = false, logger& logger = ::logger::root()); + IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(std::list &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root()); #ifndef IFOPSH_SIMPLE_KERNEL - IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(const CGAL::Nef_polyhedron_3 &nef_polyhedron, logger& logger = ::logger::root()); - IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(std::list &face_list, logger& logger = ::logger::root()); - IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(CGAL::Polyhedron_3 &polyhedron, logger& logger = ::logger::root()); + IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(const CGAL::Nef_polyhedron_3 &nef_polyhedron, logger& logger = ifcopenshell::logger::root()); + IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(std::list &face_list, logger& logger = ifcopenshell::logger::root()); + IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(CGAL::Polyhedron_3 &polyhedron, logger& logger = ifcopenshell::logger::root()); #endif } @@ -93,11 +93,11 @@ namespace ifcopenshell { #endif public: - cgal_kernel(const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) + cgal_kernel(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : abstract_kernel("cgal", settings, logger) {} - virtual abstract_kernel* clone(::logger& logger) const { + virtual abstract_kernel* clone(ifcopenshell::logger& logger) const { return new cgal_kernel(settings(), logger); } diff --git a/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h b/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h index 92e49adc79..baf0c2004b 100644 --- a/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h +++ b/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h @@ -52,6 +52,8 @@ #include #include +namespace ifcopenshell::geom { + // Functor to lexicographically sort Plane_3 template struct plane_less { @@ -1378,4 +1380,6 @@ bool write_to_obj(const CGAL::Nef_polyhedron_3& a, std::ostream& ofs, si return volume_index == std::numeric_limits::max(); } +} // namespace ifcopenshell::geom + #endif diff --git a/src/ifcgeom/kernels/manifold/ManifoldConversionResult.cpp b/src/ifcgeom/kernels/manifold/ManifoldConversionResult.cpp index 0eb4ae042b..67053ded76 100644 --- a/src/ifcgeom/kernels/manifold/ManifoldConversionResult.cpp +++ b/src/ifcgeom/kernels/manifold/ManifoldConversionResult.cpp @@ -215,7 +215,7 @@ std::optional ifcopenshell::geom::manifold_shape::as_manifol return manifold::Manifold::BatchBoolean(solids, manifold::OpType::Add); } -void ifcopenshell::geom::manifold_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger&) const { +void ifcopenshell::geom::manifold_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger&) const { for (const auto& part : parts_) { auto mesh = transform_mesh(part.mesh, place); std::vector indices(mesh.NumVert()); diff --git a/src/ifcgeom/kernels/manifold/ManifoldConversionResult.h b/src/ifcgeom/kernels/manifold/ManifoldConversionResult.h index a8c7ab68a1..b51a8562f1 100644 --- a/src/ifcgeom/kernels/manifold/ManifoldConversionResult.h +++ b/src/ifcgeom/kernels/manifold/ManifoldConversionResult.h @@ -40,7 +40,7 @@ public: std::optional as_manifold() const; virtual std::string_view backend_id() const { return "manifold"; } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual int surface_genus() const; diff --git a/src/ifcgeom/kernels/manifold/ManifoldKernel.cpp b/src/ifcgeom/kernels/manifold/ManifoldKernel.cpp index 0b1a4765a6..b0e064daa8 100644 --- a/src/ifcgeom/kernels/manifold/ManifoldKernel.cpp +++ b/src/ifcgeom/kernels/manifold/ManifoldKernel.cpp @@ -769,16 +769,16 @@ namespace { const auto shell_info = diagnose_shell(shell); const auto before = diagnose_mesh(before_part.mesh, precision); const auto after = diagnose_mesh(after_mesh, precision); - ::logger::root().warning( + ifcopenshell::logger::root().warning( "Manifold kernel: solid shell manifold validation failed; before_transform=" + std::string(before_part.solid ? "solid" : "mesh-only") + " (" + manifold_error_string(before_status) + "), after_transform=(" + manifold_error_string(after_status) + ")", shell->instance); - ::logger::root().warning("Manifold kernel: solid shell diagnosis: " + solid_shell_failure_diagnosis(before_part, before, after, before_status, after_status), shell->instance); - ::logger::root().warning("Manifold kernel: solid shell input: " + shell_diagnostics_string(shell_info), shell->instance); - ::logger::root().warning("Manifold kernel: solid shell mesh before transform: " + mesh_diagnostics_string(before), shell->instance); - ::logger::root().warning("Manifold kernel: solid shell transform: " + matrix_diagnostics_string(place), shell->instance); - ::logger::root().warning("Manifold kernel: solid shell mesh after transform: " + mesh_diagnostics_string(after), shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: solid shell diagnosis: " + solid_shell_failure_diagnosis(before_part, before, after, before_status, after_status), shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: solid shell input: " + shell_diagnostics_string(shell_info), shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: solid shell mesh before transform: " + mesh_diagnostics_string(before), shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: solid shell transform: " + matrix_diagnostics_string(place), shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: solid shell mesh after transform: " + mesh_diagnostics_string(after), shell->instance); } double signed_area(const manifold::SimplePolygon& polygon) { @@ -1492,7 +1492,7 @@ namespace { bool manifold_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, ifcopenshell::geom::conversion_results& results) { auto part = part_from_extrusion(extrusion, settings_.get().get(), dilation_hack, settings_.get().get()); if (!part) { - ::logger::root().warning("Manifold kernel: failed to convert extrusion, requires planar bounds with line, circle or ellipse edges", extrusion->instance); + ifcopenshell::logger::root().warning("Manifold kernel: failed to convert extrusion, requires planar bounds with line, circle or ellipse edges", extrusion->instance); return false; } results.emplace_back(ifcopenshell::geom::conversion_result( @@ -1507,11 +1507,11 @@ bool manifold_kernel::convert_impl(const taxonomy::shell::ptr shell, ifcopenshel manifold::Manifold::Error status = manifold::Manifold::Error::NoError; auto part = part_from_shell(shell, settings_.get().get(), dilation_hack, &status); if (!part) { - ::logger::root().warning("Manifold kernel: failed to convert shell, requires planar polygonal faces with explicit vertices", shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: failed to convert shell, requires planar polygonal faces with explicit vertices", shell->instance); return false; } if (!part->solid) { - ::logger::root().notice("Manifold kernel: shell converted as mesh only (" + manifold_error_string(status) + ")", shell->instance); + ifcopenshell::logger::root().notice("Manifold kernel: shell converted as mesh only (" + manifold_error_string(status) + ")", shell->instance); } results.emplace_back(ifcopenshell::geom::conversion_result( shell->instance.id(), @@ -1528,7 +1528,7 @@ bool manifold_kernel::convert_impl(const taxonomy::solid::ptr solid, ifcopenshel manifold::Manifold::Error before_status = manifold::Manifold::Error::NoError; auto part = part_from_shell(shell, precision, dilation_hack, &before_status); if (!part) { - ::logger::root().warning("Manifold kernel: failed to convert solid shell, requires planar polygonal faces with explicit vertices", shell->instance); + ifcopenshell::logger::root().warning("Manifold kernel: failed to convert solid shell, requires planar polygonal faces with explicit vertices", shell->instance); return false; } auto place = shell->matrix ? shell->matrix : taxonomy::make(); @@ -1570,21 +1570,21 @@ bool manifold_kernel::convert_impl(const taxonomy::boolean_result::ptr br, ifcop dilation_hack = first ? 0. : precision * 10.; if (!first && br->operation == taxonomy::boolean_result::SUBTRACTION && face) { if (!first_bbox) { - ::logger::root().warning("Manifold kernel: cannot fit halfspace operand without a valid first operand bounds", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: cannot fit halfspace operand without a valid first operand bounds", child->instance); return false; } halfspace_build_state state; auto part = part_from_halfspace_solid(state, solid, face, *first_bbox, precision, dilation_hack); if (!part) { if (state.unchanged && br->operation == taxonomy::boolean_result::SUBTRACTION) { - ::logger::root().warning("Manifold kernel: halfspace subtraction yields unchanged volume", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: halfspace subtraction yields unchanged volume", child->instance); continue; } - ::logger::root().warning("Manifold kernel: failed to fit halfspace boolean operand to first operand bounds", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: failed to fit halfspace boolean operand to first operand bounds", child->instance); return false; } if (!part->solid) { - ::logger::root().warning("Manifold kernel: fitted halfspace operand is not a valid manifold solid", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: fitted halfspace operand is not a valid manifold solid", child->instance); return false; } operand = *part->solid; @@ -1594,12 +1594,12 @@ bool manifold_kernel::convert_impl(const taxonomy::boolean_result::ptr br, ifcop } else { ifcopenshell::geom::conversion_results converted; if (!abstract_kernel::convert(child, converted)) { - ::logger::root().warning("Manifold kernel: failed to convert boolean operand", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: failed to convert boolean operand", child->instance); return false; } operand = results_to_operand(converted); if (!operand) { - ::logger::root().warning("Manifold kernel: boolean operand is not a valid manifold solid", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: boolean operand is not a valid manifold solid", child->instance); return false; } if (!style) { @@ -1612,7 +1612,7 @@ bool manifold_kernel::convert_impl(const taxonomy::boolean_result::ptr br, ifcop if (first) { auto bbox = operand->BoundingBox(); if (!bbox.IsFinite()) { - ::logger::root().warning("Manifold kernel: first boolean operand has no valid bounds", child->instance); + ifcopenshell::logger::root().warning("Manifold kernel: first boolean operand has no valid bounds", child->instance); return false; } first_bbox = bbox; @@ -1623,7 +1623,7 @@ bool manifold_kernel::convert_impl(const taxonomy::boolean_result::ptr br, ifcop dilation_hack = 0.; auto result = boolean_result_from_operands(operands, br->operation); if (!result || result->IsEmpty()) { - ::logger::root().warning("Manifold kernel: boolean operation produced no result", br->instance); + ifcopenshell::logger::root().warning("Manifold kernel: boolean operation produced no result", br->instance); return false; } results.emplace_back(ifcopenshell::geom::conversion_result( @@ -1638,7 +1638,7 @@ bool manifold_kernel::convert_openings(const express::base&, const std::vector opening_operands; auto entity_bbox = results_bbox(entity_shapes); if (!entity_bbox) { - ::logger::root().warning("Manifold kernel: host shape has no valid bounds for halfspace fitting"); + ifcopenshell::logger::root().warning("Manifold kernel: host shape has no valid bounds for halfspace fitting"); return false; } dilation_hack = settings_.get().get() * 10.; @@ -1646,19 +1646,19 @@ bool manifold_kernel::convert_openings(const express::base&, const std::vector(entity_trsf.ccomponents().inverse() * opening.second.ccomponents()); ifcopenshell::geom::conversion_results converted; if (!abstract_kernel::convert(opening.first, converted)) { - ::logger::root().warning("Manifold kernel: failed to convert opening operand", opening.first->instance); + ifcopenshell::logger::root().warning("Manifold kernel: failed to convert opening operand", opening.first->instance); return false; } for (const auto& result : converted) { auto moved = std::unique_ptr(result.Shape()->moved(taxonomy::make(relative->ccomponents() * result.Placement()->ccomponents()))); auto* shape = dynamic_cast(moved.get()); if (!shape) { - ::logger::root().warning("Manifold kernel: opening result is not a manifold shape"); + ifcopenshell::logger::root().warning("Manifold kernel: opening result is not a manifold shape"); return false; } auto operand = shape->as_manifold(); if (!operand) { - ::logger::root().warning("Manifold kernel: opening result is not a valid manifold solid", opening.first->instance); + ifcopenshell::logger::root().warning("Manifold kernel: opening result is not a valid manifold solid", opening.first->instance); return false; } opening_operands.push_back(*operand); @@ -1672,7 +1672,7 @@ bool manifold_kernel::convert_openings(const express::base&, const std::vector().get(), false, settings.get().get()); } catch (...) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 183, "Failed to triangulate shape"); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 183, "Failed to triangulate shape"); return; } } @@ -134,7 +134,7 @@ void ifcopenshell::geom::open_cascade_shape::Triangulate(ifcopenshell::geom::set opencascade::handle tri = BRep_Tool::Triangulation(face, loc); if (tri.IsNull()) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face"); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face"); } else { // Keep track of the number of times an edge is used // Manifold edges (i.e. edges used twice) are deemed invisible @@ -640,7 +640,7 @@ namespace { try { BRepMesh_IncrementalMesh(s, tol); } catch (...) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 186, "Failed to triangulate shape"); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 186, "Failed to triangulate shape"); return; } meshed = true; diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h b/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h index 8cffa17dab..c2a7158d06 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h @@ -49,7 +49,7 @@ namespace ifcopenshell { operator const TopoDS_Shape& (); virtual std::string_view backend_id() const; - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual ifcopenshell::geom::conversion_result_shape* clone() const; diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp index 831c035cb6..cf3aaf82dd 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp @@ -190,7 +190,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_openings(const express::ba const auto& m = it3->Placement()->ccomponents(); // @todo // if (entity_shape_gtrsf.Form() == gp_Other) { - // ::logger::root().message(::logger::LOG_WARNING, "Applying non uniform transformation to:", entity); + // ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "Applying non uniform transformation to:", entity); // } gp_Trsf entity_shape_gtrsf; entity_shape_gtrsf.SetValues( @@ -217,7 +217,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_openings(const express::ba if (util::boolean_operation(bst, result, opening_list, BOPAlgo_CUT, intermediate_result)) { result = intermediate_result; } else { - logger_.message(::logger::LOG_ERROR, "GEO", 192, "Opening subtraction failed for " + boost::lexical_cast(std::distance(jt, it)) + " openings", entity); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 192, "Opening subtraction failed for " + boost::lexical_cast(std::distance(jt, it)) + " openings", entity); } jt = it; @@ -417,7 +417,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // // if (!success) { -// ::logger::root().error("Failed processing layerset"); +// ifcopenshell::logger::root().error("Failed processing layerset"); // } // } // } @@ -445,7 +445,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // if (some_items_without_style) { -// ::logger::root().warning("No material and surface styles for:", product); +// ifcopenshell::logger::root().warning("No material and surface styles for:", product); // } // } // @@ -472,7 +472,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // parent_id = parent_object->data().id(); // } // } catch (const std::exception& e) { -// ::logger::root().error(e); +// ifcopenshell::logger::root().error(e); // } // // const std::string name = product->Name().value_or(""); @@ -484,9 +484,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // convert(product->ObjectPlacement(), trsf); // } // } catch (const std::exception& e) { -// ::logger::root().error(e); +// ifcopenshell::logger::root().error(e); // } catch (...) { -// ::logger::root().error("Failed to construct placement"); +// ifcopenshell::logger::root().error("Failed to construct placement"); // } // // // Does the IfcElement have any IfcOpenings? @@ -507,10 +507,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // try { // convert_openings(product, openings, shapes, trsf, opened_shapes); // } catch (const std::exception& e) { -// ::logger::root().message(::logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product); +// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, std::string("error processing openings for: ") + e.what() + ":", product); // caught_error = true; // } catch (...) { -// ::logger::root().message(::logger::LOG_ERROR, "error processing openings for:", product); +// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "error processing openings for:", product); // } // // if (caught_error && opened_shapes.size() < shapes.size()) { @@ -575,12 +575,12 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // if (elem->geometry().calculate_surface_area(a_calc)) { // double diff = std::abs(a_calc - a_file); // if (diff / std::sqrt(a_file) > getValue(GV_PRECISION)) { -// ::logger::root().error("Validation of surface area failed for:", product); +// ifcopenshell::logger::root().error("Validation of surface area failed for:", product); // } else { -// ::logger::root().notice("Validation of surface area succeeded for:", product); +// ifcopenshell::logger::root().notice("Validation of surface area succeeded for:", product); // } // } else { -// ::logger::root().error("Validation of surface area failed for:", product); +// ifcopenshell::logger::root().error("Validation of surface area failed for:", product); // } // } else if (q->as() && q->Name() == "Volume") { // double v_calc; @@ -588,12 +588,12 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // if (elem->geometry().calculate_volume(v_calc)) { // double diff = std::abs(v_calc - v_file); // if (diff / std::sqrt(v_file) > getValue(GV_PRECISION)) { -// ::logger::root().error("Validation of volume failed for:", product); +// ifcopenshell::logger::root().error("Validation of volume failed for:", product); // } else { -// ::logger::root().notice("Validation of volume succeeded for:", product); +// ifcopenshell::logger::root().notice("Validation of volume succeeded for:", product); // } // } else { -// ::logger::root().error("Validation of volume failed for:", product); +// ifcopenshell::logger::root().error("Validation of volume failed for:", product); // } // } else if (q->as() && q->Name() == "Shape Validation Properties") { // auto qs2 = q->as()->HasQuantities(); @@ -612,9 +612,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // if (!all_succeeded) { -// ::logger::root().error("Validation of surface genus failed for:", product); +// ifcopenshell::logger::root().error("Validation of surface genus failed for:", product); // } else { -// ::logger::root().notice("Validation of surface genus succeeded for:", product); +// ifcopenshell::logger::root().notice("Validation of surface genus succeeded for:", product); // } // } // } @@ -646,7 +646,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } catch (const ifcopenshell::exception& e) { -// ::logger::root().error(e); +// ifcopenshell::logger::root().error(e); // // @todo reset representation_mapped_to to zero? // } // return representation_mapped_to; @@ -670,15 +670,15 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap(); // // if (products->size() && maps->size()) { -// ::logger::root().warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation); +// ifcopenshell::logger::root().warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation); // } // // if (prodreps->size() > 1) { -// ::logger::root().warning("Multiple IfcProductDefinitionShapes for representation", representation); +// ifcopenshell::logger::root().warning("Multiple IfcProductDefinitionShapes for representation", representation); // } // // if (maps->size() > 1) { -// ::logger::root().warning("Multiple IfcRepresentationMaps for representation", representation); +// ifcopenshell::logger::root().warning("Multiple IfcRepresentationMaps for representation", representation); // } // // if (maps->size() == 1) { @@ -721,7 +721,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // parent_id = parent_object->data().id(); // } // } catch (const std::exception& e) { -// ::logger::root().error(e); +// ifcopenshell::logger::root().error(e); // } // // const std::string name = product->Name().value_or(""); @@ -733,9 +733,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // convert(product->ObjectPlacement(), trsf); // } // } catch (const std::exception& e) { -// ::logger::root().error(e); +// ifcopenshell::logger::root().error(e); // } catch (...) { -// ::logger::root().error("Failed to construct placement"); +// ifcopenshell::logger::root().error("Failed to construct placement"); // } // // std::string context_string = ""; @@ -937,7 +937,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // // range. It's only a safeguard though, so can probably be approximated. // const double axis_length = own_axis_start.Distance(own_axis_end); // if (length_required > axis_length) { -// ::logger::root().warning("The wall axis is not long enough to accommodate the fold points"); +// ifcopenshell::logger::root().warning("The wall axis is not long enough to accommodate the fold points"); // return false; // } // @@ -957,7 +957,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // gp_Trsf other; // if (other_wall->ObjectPlacement()) { // if (!convert(other_wall->ObjectPlacement(), other)) { -// ::logger::root().error("Failed to convert placement", other_wall); +// ifcopenshell::logger::root().error("Failed to convert placement", other_wall); // continue; // } // } @@ -965,7 +965,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis"); // // if (!axis_representation) { -// ::logger::root().warning("Joined wall has no axis representation", other_wall); +// ifcopenshell::logger::root().warning("Joined wall has no axis representation", other_wall); // continue; // } // @@ -1059,7 +1059,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // Vs1.Cross(Vs2); // // if (Vs1.IsNormal(Vc, 1.e-5)) { -// ::logger::root().warning("Connected walls are parallel"); +// ifcopenshell::logger::root().warning("Connected walls are parallel"); // parallel = true; // } else if (w < axis_u1 || w > axis_u2) { // point_outside_param_range = p; @@ -1394,7 +1394,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // Handle_Geom_Circle axis_line = Handle_Geom_Circle::DownCast(axis_curve); // reference_surface = new Geom_CylindricalSurface(axis_li->Position(), axis_line->Radius()); // } else { -// ::logger::root().message(::logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product); +// ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product); // return false; // } // diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h index 07628e74d5..ce6e88b0b4 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h @@ -110,13 +110,13 @@ private: double precision_; public: - open_cascade_kernel(const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) + open_cascade_kernel(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : abstract_kernel("opencascade", settings, logger) , faceset_helper_(nullptr) , precision_(settings.get().get()) {} - virtual abstract_kernel* clone(::logger& logger) const { + virtual abstract_kernel* clone(ifcopenshell::logger& logger) const { return new open_cascade_kernel(settings(), logger); } diff --git a/src/ifcgeom/kernels/opencascade/base_utils.cpp b/src/ifcgeom/kernels/opencascade/base_utils.cpp index 6b22b56f13..7049b5abc5 100644 --- a/src/ifcgeom/kernels/opencascade/base_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/base_utils.cpp @@ -714,12 +714,12 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_List 0; } catch (const Standard_Failure& e) { if (e.GetMessageString() && strlen(e.GetMessageString())) { - ::logger::root().error("GEO", 106, e.GetMessageString()); + ifcopenshell::logger::root().error("GEO", 106, e.GetMessageString()); } else { - ::logger::root().error("GEO", 107, "Unknown error sewing shell"); + ifcopenshell::logger::root().error("GEO", 107, "Unknown error sewing shell"); } } catch (...) { - ::logger::root().error("GEO", 108, "Unknown error sewing shell"); + ifcopenshell::logger::root().error("GEO", 108, "Unknown error sewing shell"); } if (valid_shell) { @@ -747,22 +747,22 @@ bool ifcopenshell::geom::util::create_solid_from_faces(const NCollection_Listinstance); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 119, "Empty solid for:", c->instance); } } else { @@ -139,7 +139,7 @@ bool open_cascade_kernel::convert_impl(const taxonomy::boolean_result::ptr br, c // #2665 we also set a precision-independent threshold, because in the boolean op routine // the working fuzziness might still be increased. if (d < tol * 20. || d < 0.00002) { - logger_.message(::logger::LOG_WARNING, "GEO", 121, "Halfspace subtraction yields unchanged volume:", c->instance); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 121, "Halfspace subtraction yields unchanged volume:", c->instance); continue; } else { S = result; diff --git a/src/ifcgeom/kernels/opencascade/boolean_utils.cpp b/src/ifcgeom/kernels/opencascade/boolean_utils.cpp index 6dce79bd1d..6ee6b835e0 100644 --- a/src/ifcgeom/kernels/opencascade/boolean_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/boolean_utils.cpp @@ -405,7 +405,7 @@ bool ifcopenshell::geom::util::is_extrusion(const gp_Vec & v, const TopoDS_Shape return true; } -int ifcopenshell::geom::util::eliminate_narrow_operands(double prec, const NCollection_List& bs, NCollection_List & c, ::logger& logger) { +int ifcopenshell::geom::util::eliminate_narrow_operands(double prec, const NCollection_List& bs, NCollection_List & c, ifcopenshell::logger& logger) { int N = 0; NCollection_List::Iterator it(bs); for (; it.More(); it.Next()) { @@ -573,7 +573,7 @@ int ifcopenshell::geom::util::eliminate_touching_operands(double prec, const Top return N; } -bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_input, const NCollection_List & b_input, TopoDS_Shape & result, double eps, ::logger& logger) { +bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS_Shape & a_input, const NCollection_List & b_input, TopoDS_Shape & result, double eps, ifcopenshell::logger& logger) { ifcopenshell::geom::impl::tree edge_tree; NCollection_List ab_input = b_input; @@ -885,7 +885,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting a = unify(a_input, fuzziness * 1000.); settings.log().message( - ::logger::LOG_DEBUG, "GEO", 127, + ifcopenshell::logger::LOG_DEBUG, "GEO", 127, "Simplified operand A from "s + std::to_string(count(a_input, TopAbs_FACE)) + " to "s + @@ -897,7 +897,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting for (; it.More(); it.Next()) { b.Append(unify(it.Value(), fuzziness)); settings.log().message( - ::logger::LOG_DEBUG, "GEO", 128, + ifcopenshell::logger::LOG_DEBUG, "GEO", 128, "Simplified operand B from "s + std::to_string(count(it.Value(), TopAbs_FACE)) + " to "s + @@ -965,7 +965,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting return true; } - if (!is_2d && ::logger::LOG_NOTICE >= settings.log().verbosity()) { + if (!is_2d && ifcopenshell::logger::LOG_NOTICE >= settings.log().verbosity()) { PERF("preliminary manifoldness check"); if (!a.IsNull()) { diff --git a/src/ifcgeom/kernels/opencascade/boolean_utils.h b/src/ifcgeom/kernels/opencascade/boolean_utils.h index 90451d790b..7f17a7ed96 100644 --- a/src/ifcgeom/kernels/opencascade/boolean_utils.h +++ b/src/ifcgeom/kernels/opencascade/boolean_utils.h @@ -89,17 +89,17 @@ namespace ifcopenshell::geom { IFC_GEOMLIBRARY_API int eliminate_touching_operands(double prec, const TopoDS_Shape& a, const NCollection_List& bs, NCollection_List& c); - IFC_GEOMLIBRARY_API int eliminate_narrow_operands(double prec, const NCollection_List& bs, NCollection_List & c, ::logger& logger = ::logger::root()); + IFC_GEOMLIBRARY_API int eliminate_narrow_operands(double prec, const NCollection_List& bs, NCollection_List & c, ifcopenshell::logger& logger = ifcopenshell::logger::root()); - IFC_GEOMLIBRARY_API bool boolean_subtraction_2d_using_builder(const TopoDS_Shape& a_input, const NCollection_List& b_input, TopoDS_Shape& result, double eps, ::logger& logger = ::logger::root()); + IFC_GEOMLIBRARY_API bool boolean_subtraction_2d_using_builder(const TopoDS_Shape& a_input, const NCollection_List& b_input, TopoDS_Shape& result, double eps, ifcopenshell::logger& logger = ifcopenshell::logger::root()); struct boolean_settings { bool debug, attempt_2d; double precision; // Set by callers that carry a per-conversion logger (e.g. kernels deriving - // from abstract_kernel). Falls back to the global ::logger::root() singleton. - ::logger* logger = nullptr; - ::logger& log() const { return logger ? *logger : ::logger::root(); } + // from abstract_kernel). Falls back to the global ifcopenshell::logger::root() singleton. + ifcopenshell::logger* logger = nullptr; + ifcopenshell::logger& log() const { return logger ? *logger : ifcopenshell::logger::root(); } }; IFC_GEOMLIBRARY_API bool boolean_operation(const boolean_settings& settings, const TopoDS_Shape&, const NCollection_List&, BOPAlgo_Operation, TopoDS_Shape&, double fuzziness = -1.); diff --git a/src/ifcgeom/kernels/opencascade/clash_utils.cpp b/src/ifcgeom/kernels/opencascade/clash_utils.cpp index ff05ecf42b..8be0a4a6ae 100644 --- a/src/ifcgeom/kernels/opencascade/clash_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/clash_utils.cpp @@ -6,6 +6,8 @@ #define GU_CULLING_EPSILON_RAY_TRIANGLE FLT_EPSILON*FLT_EPSILON #define PX_MAX_F32 3.4028234663852885981170418348452e+38F +namespace ifcopenshell::geom { + typedef uint32_t px_u32; // Why can't I use std::clamp? @@ -588,3 +590,5 @@ bool trianglesIntersect(const gp_Vec& a1, const gp_Vec& b1, const gp_Vec& c1, co } return false; } + +} // namespace ifcopenshell::geom diff --git a/src/ifcgeom/kernels/opencascade/clash_utils.h b/src/ifcgeom/kernels/opencascade/clash_utils.h index f8a1cb677c..25e021bab3 100644 --- a/src/ifcgeom/kernels/opencascade/clash_utils.h +++ b/src/ifcgeom/kernels/opencascade/clash_utils.h @@ -5,6 +5,8 @@ #include "../ifc_geomlibrary_api.h" +namespace ifcopenshell::geom { + struct IFC_GEOMLIBRARY_API ray { float origin[3]; float dir[3]; @@ -29,3 +31,5 @@ IFC_GEOMLIBRARY_API void edgeEdgeDist(gp_Vec& x, gp_Vec& y, // closest points IFC_GEOMLIBRARY_API double distanceTriangleTriangleSquared(gp_Vec& cp, gp_Vec& cq, const std::array p, const std::array q); IFC_GEOMLIBRARY_API bool trianglesIntersect(const gp_Vec& a1, const gp_Vec& b1, const gp_Vec& c1, const gp_Vec& a2, const gp_Vec& b2, const gp_Vec& c2/*, Segment* intersection*/, gp_Vec& int1, gp_Vec& int2, bool ignoreCoplanar); + +} // namespace ifcopenshell::geom diff --git a/src/ifcgeom/kernels/opencascade/extrusion.cpp b/src/ifcgeom/kernels/opencascade/extrusion.cpp index e8697388a8..17ef47157e 100644 --- a/src/ifcgeom/kernels/opencascade/extrusion.cpp +++ b/src/ifcgeom/kernels/opencascade/extrusion.cpp @@ -9,7 +9,7 @@ bool open_cascade_kernel::convert(const taxonomy::extrusion::ptr extrusion, Topo const double& height = extrusion->depth; if (height < settings_.get().get()) { - ::logger::root().error("GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance); + ifcopenshell::logger::root().error("GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance); return false; } @@ -23,7 +23,7 @@ bool open_cascade_kernel::convert(const taxonomy::extrusion::ptr extrusion, Topo // move the TopoDS_Shape, but obviously not both. gp_GTrsf gtrsf; if (!convert(&extrusion->matrix, gtrsf)) { - ::logger::root().error("Unable to move extrusion"); + ifcopenshell::logger::root().error("Unable to move extrusion"); } auto trsf = gtrsf.Trsf(); */ diff --git a/src/ifcgeom/kernels/opencascade/face.cpp b/src/ifcgeom/kernels/opencascade/face.cpp index b702f61b8e..1212930121 100644 --- a/src/ifcgeom/kernels/opencascade/face.cpp +++ b/src/ifcgeom/kernels/opencascade/face.cpp @@ -174,7 +174,7 @@ namespace { } else if (crv_or_wire.index() == 2) { // @todo const double precision_ = 1.e-5; - ::logger::root().warning("GEO", 156, "Approximating BasisCurve due to possible discontinuities", i->instance); + ifcopenshell::logger::root().warning("GEO", 156, "Approximating BasisCurve due to possible discontinuities", i->instance); const auto& w = std::get(crv_or_wire); #if OCC_VERSION_HEX < 0x70600 BRepAdaptor_CompCurve cc(w, true); @@ -294,12 +294,12 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& // the face will still be processed as long as there are no holes. A compound of faces // is returned in that case. if (num_bounds > 1 && num_outer_bounds > 1 && num_bounds != num_outer_bounds) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 157, "Invalid configuration of boundaries for:", face->instance); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 157, "Invalid configuration of boundaries for:", face->instance); return false; } if (num_outer_bounds > 1) { - ::logger::root().message(::logger::LOG_WARNING, "GEO", 158, "Multiple outer boundaries for:", face->instance); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "GEO", 158, "Multiple outer boundaries for:", face->instance); fd.all_outer() = true; } @@ -320,11 +320,11 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& TopoDS_Wire wire; if (faceset_helper_ && bound->is_polyhedron()) { if (!faceset_helper_->wire(bound, wire)) { - ::logger::root().message(::logger::LOG_WARNING, "GEO", 159, "Face boundary loop not included", bound->instance); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "GEO", 159, "Face boundary loop not included", bound->instance); continue; } } else if (!convert(bound, wire)) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 160, "Failed to process face boundary loop", bound->instance); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 160, "Failed to process face boundary loop", bound->instance); return false; } @@ -341,7 +341,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& }; NCollection_List results; if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) { - ::logger::root().warning("GEO", 161, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); + ifcopenshell::logger::root().warning("GEO", 161, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); util::select_largest(results, wire); } @@ -352,7 +352,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& } if (fd.wires().empty()) { - ::logger::root().warning("GEO", 162, "Face with no boundaries", face->instance); + ifcopenshell::logger::root().warning("GEO", 162, "Face with no boundaries", face->instance); return false; } @@ -430,7 +430,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& if (fd.surface().IsNull()) { // The set of wires is triangulated in case no surface can be found - ::logger::root().message(::logger::LOG_WARNING, "GEO", 163, "Triangulating face boundaries for face", face->instance); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "GEO", 163, "Triangulating face boundaries for face", face->instance); if (fd.all_outer()) { for (const auto& w : fd.wires()) { @@ -483,7 +483,7 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& kt.Value().Original().ToUTF8CString(c); std::string message = c; delete[] c; - ::logger::root().warning("GEO", 164, message, face->instance); + ifcopenshell::logger::root().warning("GEO", 164, message, face->instance); } } @@ -495,17 +495,17 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& if (it.Value().ShapeType() == TopAbs_FACE) { face_list.Append(it.Value()); } else { - ::logger::root().error("UNS", 7, "Unsupported output from face healing"); + ifcopenshell::logger::root().error("UNS", 7, "Unsupported output from face healing"); } } } else { - ::logger::root().error("UNS", 8, "Unsupported output from face healing"); + ifcopenshell::logger::root().error("UNS", 8, "Unsupported output from face healing"); } } else { face_list.Append(f); } } else { - ::logger::root().error("GEO", 165, "Internal error in face creation"); + ifcopenshell::logger::root().error("GEO", 165, "Internal error in face creation"); return false; } } else { @@ -546,14 +546,14 @@ bool open_cascade_kernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& delete[] c; #if OCC_VERSION_MAJOR==7 && OCC_VERSION_MINOR >= 7 if (!reversed_surface && !fd.surface().IsNull() && fd.surface()->IsUPeriodic() && message == "Unknown message invoked with the keyword FixAdvFace.FixOrientation.MSG0") { - ::logger::root().notice("GEO", 166, "Detected reversed wire, reattempting with reversed basis surface"); + ifcopenshell::logger::root().notice("GEO", 166, "Detected reversed wire, reattempting with reversed basis surface"); TopoDS_Face reversed_result; convert(face, reversed_result, true); result = reversed_result; return true; } else #endif - ::logger::root().warning("GEO", 167, message, face->instance); + ifcopenshell::logger::root().warning("GEO", 167, message, face->instance); } } } diff --git a/src/ifcgeom/kernels/opencascade/faceset_helper.cpp b/src/ifcgeom/kernels/opencascade/faceset_helper.cpp index 3fe43777e8..098aa5d84d 100644 --- a/src/ifcgeom/kernels/opencascade/faceset_helper.cpp +++ b/src/ifcgeom/kernels/opencascade/faceset_helper.cpp @@ -149,7 +149,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper( auto num_retained = std::count(retained.begin(), retained.end(), true); if (unique.size() != num_retained) { - ::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained)); + ifcopenshell::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained)); } typedef std::array edge_t; @@ -206,7 +206,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper( } if (duplicates_.size() || loops_removed || (non_manifold && shell->closed.value_or(false))) { - ::logger::root().warning("GEO", 169, boost::lexical_cast(duplicate_faces) + " duplicate faces removed, " + boost::lexical_cast(loops_removed) + " degenerate loops eliminated and " + boost::lexical_cast(non_manifold) + " non-manifold edges"); + ifcopenshell::logger::root().warning("GEO", 169, boost::lexical_cast(duplicate_faces) + " duplicate faces removed, " + boost::lexical_cast(loops_removed) + " degenerate loops eliminated and " + boost::lexical_cast(non_manifold) + " non-manifold edges"); } } @@ -277,7 +277,7 @@ bool ifcopenshell::geom::open_cascade_kernel::faceset_helper::wires(const ifcope !kernel_->settings().get().get(), 0., kernel_->settings().get().get()})) { - ::logger::root().warning("GEO", 170, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); + ifcopenshell::logger::root().warning("GEO", 170, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); non_manifold_ = true; wires = results; } else { diff --git a/src/ifcgeom/kernels/opencascade/layerset.cpp b/src/ifcgeom/kernels/opencascade/layerset.cpp index 668c5d16a5..52d48d1eee 100644 --- a/src/ifcgeom/kernels/opencascade/layerset.cpp +++ b/src/ifcgeom/kernels/opencascade/layerset.cpp @@ -132,7 +132,7 @@ namespace { } } - ::logger::root().error("GEO", 171, "Unable to map layer geometry to material index"); + ifcopenshell::logger::root().error("GEO", 171, "Unable to map layer geometry to material index"); return false; } } @@ -237,7 +237,7 @@ bool ifcopenshell::geom::util::apply_folded_layerset(const conversion_results& i if (s.ShapeType() == TopAbs_SHELL) { shells.Append(TopoDS::Shell(s)); } else { - ::logger::root().error("GEO", 172, "Expected shell type in layerset processing"); + ifcopenshell::logger::root().error("GEO", 172, "Expected shell type in layerset processing"); return false; } } @@ -436,12 +436,12 @@ bool ifcopenshell::geom::util::split_solid_by_shell(const TopoDS_Shape& input, c } } catch (const Standard_Failure& e) { if (e.GetMessageString() && strlen(e.GetMessageString())) { - ::logger::root().error("GEO", 173, e.GetMessageString()); + ifcopenshell::logger::root().error("GEO", 173, e.GetMessageString()); } else { - ::logger::root().error("GEO", 174, "Unknown error performing fixes"); + ifcopenshell::logger::root().error("GEO", 174, "Unknown error performing fixes"); } } catch (...) { - ::logger::root().error("GEO", 175, "Unknown error performing fixes"); + ifcopenshell::logger::root().error("GEO", 175, "Unknown error performing fixes"); } BRepCheck_Analyzer analyser(shape); bool is_valid = analyser.IsValid() != 0; @@ -451,7 +451,7 @@ bool ifcopenshell::geom::util::split_solid_by_shell(const TopoDS_Shape& input, c } if (is_null[0] || is_null[1]) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 176, "Null result obtained from layerset slicing"); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 176, "Null result obtained from layerset slicing"); if (is_null[0] && is_null[1]) { return false; } diff --git a/src/ifcgeom/kernels/opencascade/loft.cpp b/src/ifcgeom/kernels/opencascade/loft.cpp index 14a2ad0568..4880e0ef09 100644 --- a/src/ifcgeom/kernels/opencascade/loft.cpp +++ b/src/ifcgeom/kernels/opencascade/loft.cpp @@ -82,7 +82,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& if (non_polygonal) { if (loft->children.size() < 2) { - ::logger::root().error("GEO", 177, "Not enough sections to loft"); + ifcopenshell::logger::root().error("GEO", 177, "Not enough sections to loft"); return false; } @@ -122,7 +122,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& auto first_wire_count = sections.front().size(); for (auto& section : sections) { if (section.size() != first_wire_count) { - ::logger::root().error("GEO", 178, "Inconsistent number of wires in sections"); + ifcopenshell::logger::root().error("GEO", 178, "Inconsistent number of wires in sections"); return false; } } @@ -159,7 +159,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& return true; } else { - ::logger::root().error("Lofting more than two sections is not supported"); + ifcopenshell::logger::root().error("Lofting more than two sections is not supported"); return false; } } @@ -275,7 +275,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& */ if (shps.size() < 2) { - ::logger::root().error("GEO", 179, "Not enough sections to loft"); + ifcopenshell::logger::root().error("GEO", 179, "Not enough sections to loft"); return false; } diff --git a/src/ifcgeom/kernels/opencascade/loop.cpp b/src/ifcgeom/kernels/opencascade/loop.cpp index 6259ce1f46..2732efceb2 100644 --- a/src/ifcgeom/kernels/opencascade/loop.cpp +++ b/src/ifcgeom/kernels/opencascade/loop.cpp @@ -129,7 +129,7 @@ namespace { } else { // @todo const double precision_ = 1.e-5; - ::logger::root().warning("GEO", 180, "Approximating BasisCurve due to possible discontinuities", e->instance); + ifcopenshell::logger::root().warning("GEO", 180, "Approximating BasisCurve due to possible discontinuities", e->instance); const auto& w = std::get(crv_or_wire); #if OCC_VERSION_HEX < 0x70600 BRepAdaptor_CompCurve cc(w, true); @@ -283,7 +283,7 @@ bool open_cascade_kernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& w } if (converted_segments.Extent() == 0) { - ::logger::root().message(::logger::LOG_ERROR, "GEO", 181, "No segment successfully converted:", loop->instance); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "GEO", 181, "No segment successfully converted:", loop->instance); return false; } @@ -348,7 +348,7 @@ bool open_cascade_kernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& w if (ang < 0.0314) { edges_to_tesselate.Add(crv1->DynamicType() == STANDARD_TYPE(Geom_Circle) ? edges.First() : edges.Last()); - ::logger::root().notice("GEO", 182, "Sharp circular corner detecting, substituting with linear approximation"); + ifcopenshell::logger::root().notice("GEO", 182, "Sharp circular corner detecting, substituting with linear approximation"); } } } diff --git a/src/ifcgeom/kernels/opencascade/shell.cpp b/src/ifcgeom/kernels/opencascade/shell.cpp index 38f01727a3..bfb7f950f1 100644 --- a/src/ifcgeom/kernels/opencascade/shell.cpp +++ b/src/ifcgeom/kernels/opencascade/shell.cpp @@ -57,7 +57,7 @@ bool open_cascade_kernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& sh } if (!success) { - logger_.message(::logger::LOG_WARNING, "GEO", 198, "Failed to convert face:", face->instance); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 198, "Failed to convert face:", face->instance); continue; } @@ -70,7 +70,7 @@ bool open_cascade_kernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& sh if (face_area(triangle) > min_face_area) { face_list.Append(triangle); } else { - logger_.message(::logger::LOG_WARNING, "GEO", 199, "Degenerate face:", face->instance); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 199, "Degenerate face:", face->instance); } } } @@ -78,7 +78,7 @@ bool open_cascade_kernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& sh if (face_area(occ_face) > min_face_area) { face_list.Append(occ_face); } else { - logger_.message(::logger::LOG_WARNING, "GEO", 200, "Degenerate face:", face->instance); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 200, "Degenerate face:", face->instance); } } } diff --git a/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp b/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp index 8ab4339764..0a40539df2 100644 --- a/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp +++ b/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp @@ -182,7 +182,7 @@ bool open_cascade_kernel::convert(const taxonomy::sweep_along_curve::ptr scs, To for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) { if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) { directrix_on_plane = false; - logger_.message(::logger::LOG_WARNING, "GEO", 202, "The Directrix does not lie on the ReferenceSurface", scs->instance); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 202, "The Directrix does not lie on the ReferenceSurface", scs->instance); break; } } diff --git a/src/ifcgeom/kernels/opencascade/sweep_utils.cpp b/src/ifcgeom/kernels/opencascade/sweep_utils.cpp index 3b4d7c36d6..a6d8e2d1b0 100644 --- a/src/ifcgeom/kernels/opencascade/sweep_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/sweep_utils.cpp @@ -97,7 +97,7 @@ bool ifcopenshell::geom::util::wire_to_ax(const TopoDS_Wire & wire, gp_Ax2 & dir Handle(Geom_Curve) crv = BRep_Tool::Curve(edge, u0, u1); crv->D1(u0, directrix_origin, directrix_tangent); } else { - ::logger::root().error("GEO", 203, "Unable to locate first edge"); + ifcopenshell::logger::root().error("GEO", 203, "Unable to locate first edge"); return false; } @@ -187,7 +187,7 @@ void ifcopenshell::geom::util::sort_edges(const TopoDS_Wire & wire, std::vector< for (int i = 1; i <= map.Extent(); ++i) { if (map.FindFromIndex(i).Extent() > 2) { - ::logger::root().warning("GEO", 204, "Self-intersecting Directrix"); + ifcopenshell::logger::root().warning("GEO", 204, "Self-intersecting Directrix"); } } diff --git a/src/ifcgeom/kernels/opencascade/wire_builder.cpp b/src/ifcgeom/kernels/opencascade/wire_builder.cpp index d82e1f851f..a9c53d8ea9 100644 --- a/src/ifcgeom/kernels/opencascade/wire_builder.cpp +++ b/src/ifcgeom/kernels/opencascade/wire_builder.cpp @@ -117,12 +117,12 @@ bool ifcopenshell::geom::util::create_edge_over_curve_with_log_messages(const op } } if (dmin == std::numeric_limits::infinity()) { - ::logger::root().error("GEO", 205, "No extrema for point"); + ifcopenshell::logger::root().error("GEO", 205, "No extrema for point"); } else if (dmin > eps2) { - ::logger::root().error("GEO", 206, "Distance of " + boost::lexical_cast(std::sqrt(dmin)) + " exceeds tolerance"); + ifcopenshell::logger::root().error("GEO", 206, "Distance of " + boost::lexical_cast(std::sqrt(dmin)) + " exceeds tolerance"); } } else { - ::logger::root().error("GEO", 207, "Failed to calculate extrema for point"); + ifcopenshell::logger::root().error("GEO", 207, "Failed to calculate extrema for point"); } } } @@ -172,7 +172,7 @@ void ifcopenshell::geom::util::wire_builder::operator()(const TopoDS_Shape& a, c if (dist > 1000. * p_) { mw_.Add(w1); mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2)); - ::logger::root().warning("GEO", 208, "Added additional segment to close gap with length " + boost::lexical_cast(dist) + " to:", inst_); + ifcopenshell::logger::root().warning("GEO", 208, "Added additional segment to close gap with length " + boost::lexical_cast(dist) + " to:", inst_); goto check; } @@ -200,28 +200,28 @@ void ifcopenshell::geom::util::wire_builder::operator()(const TopoDS_Shape& a, c // Preferably adjust the segment that is linear if (is_line1 || (is_circle1 && !is_line2)) { mw_.Add(adjust(w1, w12, p2)); - ::logger::root().notice("GEO", 209, "Adjusted edge end-point with distance " + boost::lexical_cast(dist) + " on:", inst_); + ifcopenshell::logger::root().notice("GEO", 209, "Adjusted edge end-point with distance " + boost::lexical_cast(dist) + " on:", inst_); } else if ((is_line2 || is_circle2) && !last) { mw_.Add(w1); override_next_ = true; next_override_ = p1; - ::logger::root().notice("GEO", 210, "Adjusted edge end-point with distance " + boost::lexical_cast(dist) + " on:", inst_); + ifcopenshell::logger::root().notice("GEO", 210, "Adjusted edge end-point with distance " + boost::lexical_cast(dist) + " on:", inst_); } else { // In all other cases an edge is added mw_.Add(w1); mw_.Add(BRepBuilderAPI_MakeEdge(p1, p2)); - ::logger::root().warning("GEO", 211, "Added additional segment to close gap with length " + boost::lexical_cast(dist) + " to:", inst_); + ifcopenshell::logger::root().warning("GEO", 211, "Added additional segment to close gap with length " + boost::lexical_cast(dist) + " to:", inst_); } } else { - ::logger::root().error("GEO", 212, "Internal error, inconsistent wire segments", inst_); + ifcopenshell::logger::root().error("GEO", 212, "Internal error, inconsistent wire segments", inst_); mw_.Add(w1); } } check: if (mw_.Error() == BRepBuilderAPI_NonManifoldWire) { - ::logger::root().error("GEO", 213, "Non-manifold curve segments:", inst_); + ifcopenshell::logger::root().error("GEO", 213, "Non-manifold curve segments:", inst_); } else if (mw_.Error() == BRepBuilderAPI_DisconnectedWire) { - ::logger::root().error("GEO", 214, "Failed to join curve segments:", inst_); + ifcopenshell::logger::root().error("GEO", 214, "Failed to join curve segments:", inst_); } } diff --git a/src/ifcgeom/kernels/opencascade/wire_utils.cpp b/src/ifcgeom/kernels/opencascade/wire_utils.cpp index 67d2fb7db0..3c8fb1eb0b 100644 --- a/src/ifcgeom/kernels/opencascade/wire_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/wire_utils.cpp @@ -90,7 +90,7 @@ bool ifcopenshell::geom::util::approximate_plane_through_wire(const TopoDS_Wire& // obtaining a 2d points for the Delaunay, infinity is passed here, so this // can't for assessing degenerativeness. if (v.Magnitude() < 1.e-7) { - ::logger::root().warning("GEO", 215, "Degenerate face boundary in normal estimation"); + ifcopenshell::logger::root().warning("GEO", 215, "Degenerate face boundary in normal estimation"); return false; } @@ -237,7 +237,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria auto it = mapping.find(uvnodes[k]); if (it == mapping.end()) { - ::logger::root().error("GEO", 216, "Internal error: unable to unproject uv-mesh"); + ifcopenshell::logger::root().error("GEO", 216, "Internal error: unable to unproject uv-mesh"); return TRIANGULATE_WIRE_FAIL; } @@ -281,7 +281,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria } faces.Append(triangle_face); } else { - ::logger::root().error("GEO", 217, "Internal error: missing face"); + ifcopenshell::logger::root().error("GEO", 217, "Internal error: missing face"); return TRIANGULATE_WIRE_FAIL; } } @@ -312,7 +312,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria if (!contains) { #endif // All existing edges need to exist in the new faces - ::logger::root().error("GEO", 218, "Internal error, missing edge from triangulation"); + ifcopenshell::logger::root().error("GEO", 218, "Internal error, missing edge from triangulation"); non_manifold = true; } } @@ -323,7 +323,7 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria // Existing edges are boundaries with use 1 // New edges are internal with use 2 if (n != (mape.Contains(v) ? 1 : 2)) { - ::logger::root().error("GEO", 219, "Internal error, non-manifold result from triangulation"); + ifcopenshell::logger::root().error("GEO", 219, "Internal error, non-manifold result from triangulation"); non_manifold = true; } } @@ -794,12 +794,12 @@ bool ifcopenshell::geom::util::fill_nonmanifold_wires_with_planar_faces(TopoDS_S shape = solid.SolidFromShell(TopoDS::Shell(shape)); } catch (const Standard_Failure& e) { if (e.GetMessageString() && strlen(e.GetMessageString())) { - ::logger::root().error("GEO", 220, e.GetMessageString()); + ifcopenshell::logger::root().error("GEO", 220, e.GetMessageString()); } else { - ::logger::root().error("GEO", 221, "Unknown error creating solid"); + ifcopenshell::logger::root().error("GEO", 221, "Unknown error creating solid"); } } catch (...) { - ::logger::root().error("GEO", 222, "Unknown error creating solid"); + ifcopenshell::logger::root().error("GEO", 222, "Unknown error creating solid"); } return true; @@ -812,12 +812,12 @@ bool ifcopenshell::geom::util::convert_curve_to_wire(const opencascade::handle results; if (settings.use_wire_intersection_check && util::wire_intersections(wire, results, settings)) { - ::logger::root().warning("GEO", 227, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); + ifcopenshell::logger::root().warning("GEO", 227, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); util::select_largest(results, wire); } @@ -879,7 +879,7 @@ bool ifcopenshell::geom::util::convert_wire_to_face(const TopoDS_Wire& w, TopoDS BRepBuilderAPI_FaceError er = mf.Error(); if (er != BRepBuilderAPI_FaceDone) { - ::logger::root().error("GEO", 228, "Failed to create face."); + ifcopenshell::logger::root().error("GEO", 228, "Failed to create face."); return false; } face = mf.Face(); @@ -906,7 +906,7 @@ bool ifcopenshell::geom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoD NCollection_List results; if (settings.use_wire_intersection_check && util::wire_intersections(w, results, settings)) { - ::logger::root().warning("GEO", 229, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); + ifcopenshell::logger::root().warning("GEO", 229, "Self-intersections with " + boost::lexical_cast(results.Extent()) + " cycles detected"); } else { results.Clear(); results.Append(w); @@ -932,7 +932,7 @@ bool ifcopenshell::geom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoD BRepBuilderAPI_FaceError er = mf.Error(); if (er != BRepBuilderAPI_FaceDone) { - ::logger::root().error("GEO", 230, "Failed to create face."); + ifcopenshell::logger::root().error("GEO", 230, "Failed to create face."); continue; } @@ -949,7 +949,7 @@ bool ifcopenshell::geom::util::convert_wire_to_faces(const TopoDS_Wire& w, TopoD if (p.first >= max_area / 10.) { B.Add(faces, p.second); } else { - ::logger::root().warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast(p.first)); + ifcopenshell::logger::root().warning("GEO", 231, "Ignoring self-intersection loop with area " + boost::lexical_cast(p.first)); } } diff --git a/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.cpp b/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.cpp index 526b688465..02ef66f535 100644 --- a/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.cpp +++ b/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.cpp @@ -286,7 +286,7 @@ ifcopenshell::geom::passthrough_shape::passthrough_shape(const std::vector&& parts) : parts_(normalize_parts(parts)) {} -void ifcopenshell::geom::passthrough_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger&) const { +void ifcopenshell::geom::passthrough_shape::Triangulate(ifcopenshell::geom::settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger&) const { auto mesh = build_mesh(parts_, &place); std::vector indices(mesh.vertices.size()); for (size_t i = 0; i < mesh.vertices.size(); ++i) { diff --git a/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.h b/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.h index 348e49fa06..02157abefd 100644 --- a/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.h +++ b/src/ifcgeom/kernels/passthrough/PassthroughConversionResult.h @@ -24,7 +24,7 @@ public: const std::vector& parts() const { return parts_; } virtual std::string_view backend_id() const { return "passthrough"; } - virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ::logger& logger = ::logger::root()) const; + virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual int surface_genus() const; diff --git a/src/ifcgeom/kernels/passthrough/PassthroughKernel.h b/src/ifcgeom/kernels/passthrough/PassthroughKernel.h index d072118b4c..c1351ea1ed 100644 --- a/src/ifcgeom/kernels/passthrough/PassthroughKernel.h +++ b/src/ifcgeom/kernels/passthrough/PassthroughKernel.h @@ -11,10 +11,10 @@ namespace kernels { class IFC_GEOMLIBRARY_API passthrough_kernel : public abstract_kernel { public: - passthrough_kernel(const ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) + passthrough_kernel(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : abstract_kernel("passthrough", settings, logger) {} - virtual abstract_kernel* clone(::logger& logger) const { + virtual abstract_kernel* clone(ifcopenshell::logger& logger) const { return new passthrough_kernel(settings(), logger); } diff --git a/src/ifcgeom/mapping/IfcAsymmetricIShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcAsymmetricIShapeProfileDef.cpp index 9063d83115..1decdf7ec8 100644 --- a/src/ifcgeom/mapping/IfcAsymmetricIShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcAsymmetricIShapeProfileDef.cpp @@ -58,7 +58,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAsymmetricIShapeProfileDef& const double tol = settings_.get().get(); if (xb < tol || xt < tol || y < tol || d1 < tol || ftb < tol || ftt < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcAxis2PlacementLinear.cpp b/src/ifcgeom/mapping/IfcAxis2PlacementLinear.cpp index 330e65c0d4..5e2e0f72f9 100644 --- a/src/ifcgeom/mapping/IfcAxis2PlacementLinear.cpp +++ b/src/ifcgeom/mapping/IfcAxis2PlacementLinear.cpp @@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2PlacementLinear& inst) /* if (hasAxis != hasRef) { - ::logger::root().warning("Axis and RefDirection should be specified together", inst); + ifcopenshell::logger::root().warning("Axis and RefDirection should be specified together", inst); } */ diff --git a/src/ifcgeom/mapping/IfcCShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcCShapeProfileDef.cpp index 0f41ce1e4b..5986b37d50 100644 --- a/src/ifcgeom/mapping/IfcCShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcCShapeProfileDef.cpp @@ -43,7 +43,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCShapeProfileDef& inst) { const double tol = settings_.get().get(); if ( x < tol || y < tol || d1 < tol || d2 < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 241, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 241, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcCircle.cpp b/src/ifcgeom/mapping/IfcCircle.cpp index 5cf9adef5e..c895669ef6 100644 --- a/src/ifcgeom/mapping/IfcCircle.cpp +++ b/src/ifcgeom/mapping/IfcCircle.cpp @@ -24,7 +24,7 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) { const double r = inst.Radius() * length_unit_; if (r < settings_.get().get()) { - logger_.message(::logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcCompositeCurve.cpp b/src/ifcgeom/mapping/IfcCompositeCurve.cpp index cbe3dffcd0..3f770d8c6a 100644 --- a/src/ifcgeom/mapping/IfcCompositeCurve.cpp +++ b/src/ifcgeom/mapping/IfcCompositeCurve.cpp @@ -128,7 +128,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi for (auto it = segments->begin(); it != segments->end(); ++it) { if (!(*it)->declaration().is(IfcSchema::IfcCompositeCurveSegment::Class())) { - ::logger::root().error("Not implemented", *it); + ifcopenshell::logger::root().error("Not implemented", *it); return false; } @@ -141,13 +141,13 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi TopoDS_Wire segment; if (curve->as()) { - ::logger::root().notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it); + ifcopenshell::logger::root().notice("Infinite IfcLine used as ParentCurve of segment, treating as a segment", *it); Handle_Geom_Curve handle; convert_curve(curve, handle); double u0 = 0.0; double u1 = curve->as()->Dir()->Magnitude() * length_unit_; if (u1 < getValue(GV_PRECISION)) { - ::logger::root().warning("Segment length below tolerance", *it); + ifcopenshell::logger::root().warning("Segment length below tolerance", *it); } BRepBuilderAPI_MakeEdge me(handle, u0, u1); if (me.IsDone()) { @@ -157,7 +157,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi } } else if (!convert_wire(curve, segment)) { const bool failed_on_purpose = curve->as() && !segment.IsNull(); - ::logger::root().message(failed_on_purpose ? ::logger::LOG_WARNING : ::logger::LOG_ERROR, "Failed to convert curve:", curve); + ifcopenshell::logger::root().message(failed_on_purpose ? ifcopenshell::logger::LOG_WARNING : ifcopenshell::logger::LOG_ERROR, "Failed to convert curve:", curve); continue; } @@ -173,7 +173,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve* l, TopoDS_Wi } if (converted_segments.Extent() == 0) { - ::logger::root().message(::logger::LOG_ERROR, "No segment successfully converted:", l); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "No segment successfully converted:", l); return false; } diff --git a/src/ifcgeom/mapping/IfcEdge.cpp b/src/ifcgeom/mapping/IfcEdge.cpp index fed2926670..2bb829e70e 100644 --- a/src/ifcgeom/mapping/IfcEdge.cpp +++ b/src/ifcgeom/mapping/IfcEdge.cpp @@ -25,14 +25,14 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEdge& inst) { auto v1 = inst.EdgeStart().as(); auto v2 = inst.EdgeEnd().as(); if (!v1 || !v2) { - logger_.message(::logger::LOG_ERROR, "GEO", 255, "Only IfcVertexPoints are supported for EdgeStart and -End", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 255, "Only IfcVertexPoints are supported for EdgeStart and -End", inst); return nullptr; } auto pnt1 = v1.VertexGeometry(); auto pnt2 = v2.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(ifcopenshell::logger::LOG_ERROR, "GEO", 256, "Only IfcCartesianPoints are supported for VertexGeometry", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcEllipse.cpp b/src/ifcgeom/mapping/IfcEllipse.cpp index dc91e77c7b..d1ff3eda87 100644 --- a/src/ifcgeom/mapping/IfcEllipse.cpp +++ b/src/ifcgeom/mapping/IfcEllipse.cpp @@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipse& inst) { double y = inst.SemiAxis2() * length_unit_; const double tol = settings_.get().get(); if (x < tol || y < tol) { - logger_.message(::logger::LOG_ERROR, "GEO", 257, "Radius not greater than zero for:", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 257, "Radius not greater than zero for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp b/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp index 04afa75e04..77d5eca129 100644 --- a/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcEllipseProfileDef.cpp @@ -26,7 +26,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcEllipseProfileDef& inst) { double ry = inst.SemiAxis2() * length_unit_; const double tol = settings_.get().get(); if (rx < tol || ry < tol) { - logger_.message(::logger::LOG_ERROR, "GEO", 258, "Radius not greater than zero for:", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 258, "Radius not greater than zero for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcExtrudedAreaSolid.cpp b/src/ifcgeom/mapping/IfcExtrudedAreaSolid.cpp index 8fb31ce122..abcc1aa011 100644 --- a/src/ifcgeom/mapping/IfcExtrudedAreaSolid.cpp +++ b/src/ifcgeom/mapping/IfcExtrudedAreaSolid.cpp @@ -27,7 +27,7 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolid& inst) { const double height = inst.Depth() * length_unit_; if (height < settings_.get().get()) { - logger_.message(::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst); #ifndef PERMISSIVE_EXTRUSION return nullptr; #endif diff --git a/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp b/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp index 9e05e1edf1..e734da4ecb 100644 --- a/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp +++ b/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp @@ -27,7 +27,7 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& inst) { const double height = inst.Depth() * length_unit_; if (height < settings_.get().get()) { - logger_.message(::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcFixedReferenceSweptAreaSolid.cpp b/src/ifcgeom/mapping/IfcFixedReferenceSweptAreaSolid.cpp index 3bed9cc374..90322ddbcf 100644 --- a/src/ifcgeom/mapping/IfcFixedReferenceSweptAreaSolid.cpp +++ b/src/ifcgeom/mapping/IfcFixedReferenceSweptAreaSolid.cpp @@ -98,7 +98,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid auto condition_number = svd.singularValues()(0) / svd.singularValues()(svd.singularValues().size() - 1); if (condition_number > 1.e10) { - ::logger::root().error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail."); + ifcopenshell::logger::root().error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail."); } */ } diff --git a/src/ifcgeom/mapping/IfcHalfSpaceSolid.cpp b/src/ifcgeom/mapping/IfcHalfSpaceSolid.cpp index c9d0963a19..bca1881bd0 100644 --- a/src/ifcgeom/mapping/IfcHalfSpaceSolid.cpp +++ b/src/ifcgeom/mapping/IfcHalfSpaceSolid.cpp @@ -25,7 +25,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcHalfSpaceSolid& inst) { auto surface = inst.BaseSurface(); auto plane = surface.as(); if (!plane) { - logger_.message(::logger::LOG_ERROR, "UNS", 16, "Unsupported BaseSurface:", surface); + logger_.message(ifcopenshell::logger::LOG_ERROR, "UNS", 16, "Unsupported BaseSurface:", surface); return nullptr; } auto p = taxonomy::make(); diff --git a/src/ifcgeom/mapping/IfcIShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcIShapeProfileDef.cpp index 73c75a7b80..78747f5b0e 100644 --- a/src/ifcgeom/mapping/IfcIShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcIShapeProfileDef.cpp @@ -80,7 +80,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIShapeProfileDef& inst) { const double tol = settings_.get().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(ifcopenshell::logger::LOG_NOTICE, "GEO", 264, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp index 4dd7ddd543..d0047fa2ce 100644 --- a/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp @@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) { const double tol = settings_.get().get(); if ( x < tol || y < tol || d < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 265, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::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(ifcopenshell::logger::LOG_NOTICE, "GEO", 266, "Legs do not intersect for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcObjectPlacement.cpp b/src/ifcgeom/mapping/IfcObjectPlacement.cpp index b4b9da53af..d729795dbe 100644 --- a/src/ifcgeom/mapping/IfcObjectPlacement.cpp +++ b/src/ifcgeom/mapping/IfcObjectPlacement.cpp @@ -53,7 +53,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) { } } #else - ::logger::root().warning("Using --site-local-placement or --building-local-placement on IFC4.2 might have issues"); + ifcopenshell::logger::root().warning("Using --site-local-placement or --building-local-placement on IFC4.2 might have issues"); #endif } } @@ -126,7 +126,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) { if (fallback) { auto mapped_fallback = taxonomy::cast(map(fallback)); if (!result->ccomponents().isApprox(mapped_fallback->ccomponents())) { - ::logger::root().warning("Computed placement differs from fallback", inst); + ifcopenshell::logger::root().warning("Computed placement differs from fallback", inst); } } @@ -134,7 +134,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::root().warning("Ignoring singular matrix:", inst); + ifcopenshell::logger::root().warning("Ignoring singular matrix:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcPolyLoop.cpp b/src/ifcgeom/mapping/IfcPolyLoop.cpp index 67724f8fcf..ca203d77f6 100644 --- a/src/ifcgeom/mapping/IfcPolyLoop.cpp +++ b/src/ifcgeom/mapping/IfcPolyLoop.cpp @@ -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(ifcopenshell::logger::LOG_WARNING, "GEO", 278, "Not enough edges for:", inst); return nullptr; } @@ -51,11 +51,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& 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(ifcopenshell::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(ifcopenshell::logger::LOG_WARNING, "GEO", 281, "Not enough edges for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp b/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp index 797365cf76..cc9d485aed 100644 --- a/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp @@ -37,7 +37,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef& i const double tol = settings_.get().get(); if (x < tol || y < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 282, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 282, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp b/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp index a4fe40903a..324a19a55b 100644 --- a/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp @@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef& inst) { const double tol = settings_.get().get(); if (x < tol || y < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 283, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 283, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcRectangularTrimmedSurface.cpp b/src/ifcgeom/mapping/IfcRectangularTrimmedSurface.cpp index a05c364d42..0ab5b62e42 100644 --- a/src/ifcgeom/mapping/IfcRectangularTrimmedSurface.cpp +++ b/src/ifcgeom/mapping/IfcRectangularTrimmedSurface.cpp @@ -27,7 +27,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& i /* if (!inst.BasisSurface()->declaration().is(IfcSchema::IfcPlane::Class())) { - ::logger::root().message(::logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface()); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "Unsupported BasisSurface:", inst.BasisSurface()); return false; } gp_Pln pln; diff --git a/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp b/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp index efd51bc204..e4dfdc92fd 100644 --- a/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp +++ b/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp @@ -86,7 +86,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid& inst) { } if (intersecting) { - ::logger::root().warning("Warning Axis and SweptArea intersecting", l); + ifcopenshell::logger::root().warning("Warning Axis and SweptArea intersecting", l); } } */ diff --git a/src/ifcgeom/mapping/IfcRoundedRectangleProfileDef.cpp b/src/ifcgeom/mapping/IfcRoundedRectangleProfileDef.cpp index 521371a05b..b68e01144e 100644 --- a/src/ifcgeom/mapping/IfcRoundedRectangleProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcRoundedRectangleProfileDef.cpp @@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRoundedRectangleProfileDef& const double tol = settings_.get().get(); if (x < tol || y < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 284, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 284, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcSurfaceCurveSweptAreaSolid.cpp b/src/ifcgeom/mapping/IfcSurfaceCurveSweptAreaSolid.cpp index cce8dc61d6..2c94263320 100644 --- a/src/ifcgeom/mapping/IfcSurfaceCurveSweptAreaSolid.cpp +++ b/src/ifcgeom/mapping/IfcSurfaceCurveSweptAreaSolid.cpp @@ -49,11 +49,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid& if (!is_plane) { TopoDS_Shape surface_shell; if (!convert_shape(inst.ReferenceSurface(), surface_shell)) { - ::logger::root().error("Failed to convert reference surface", l); + ifcopenshell::logger::root().error("Failed to convert reference surface", l); return false; } if (util::count(surface_shell, TopAbs_FACE) != 1) { - ::logger::root().error("Non-continuous reference surface", l); + ifcopenshell::logger::root().error("Non-continuous reference surface", l); return false; } surface_face = TopoDS::Face(TopExp_Explorer(surface_shell, TopAbs_FACE).Current()); @@ -76,7 +76,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceCurveSweptAreaSolid& for (TopExp_Explorer exp(wire, TopAbs_VERTEX); exp.More(); exp.Next()) { if (pln.Distance(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current()))) > ALMOST_ZERO) { directrix_on_plane = false; - ::logger::root().message(::logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "The Directrix does not lie on the ReferenceSurface", l); break; } } diff --git a/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp b/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp index ff0d1c0a67..10ba2c1f5b 100644 --- a/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp +++ b/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp @@ -241,19 +241,19 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { i += 1; j += 1; } else { - ::logger::root().error("Unexpected amount of fillet edges generated"); + ifcopenshell::logger::root().error("Unexpected amount of fillet edges generated"); } } else { - ::logger::root().error("Unable to build fillet, probably edge too short"); + ifcopenshell::logger::root().error("Unable to build fillet, probably edge too short"); } } else { - ::logger::root().error("Colinear edges, not applying fillet"); + ifcopenshell::logger::root().error("Colinear edges, not applying fillet"); } i++; j++; } } else { - ::logger::root().error("Not enough edges for applying fillet"); + ifcopenshell::logger::root().error("Not enough edges for applying fillet"); } TopoDS_Wire new_wire; @@ -266,7 +266,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { wire = new_wire; } else { - ::logger::root().error("Directrix is not polyhedral, ignoring FilletRadius"); + ifcopenshell::logger::root().error("Directrix is not polyhedral, ignoring FilletRadius"); } } @@ -317,7 +317,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { } if (!is_valid) { - ::logger::root().message(::logger::LOG_WARNING, "Failed to subtract inner radius void for:", l); + ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_WARNING, "Failed to subtract inner radius void for:", l); } } diff --git a/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp index e4e433057a..a3058016b8 100644 --- a/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp @@ -40,7 +40,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) { const double tol = settings_.get().get(); if (x < tol || y < tol || d1 < tol || d2 < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 296, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::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(ifcopenshell::logger::LOG_NOTICE, "GEO", 297, "Web and flange do not intersect for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcTrapeziumProfileDef.cpp b/src/ifcgeom/mapping/IfcTrapeziumProfileDef.cpp index c15264433b..ec2dd48f75 100644 --- a/src/ifcgeom/mapping/IfcTrapeziumProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcTrapeziumProfileDef.cpp @@ -36,7 +36,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrapeziumProfileDef& inst) { const double tol = settings_.get().get(); if (x1 < tol || w < tol || y < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 294, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 294, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcTrimmedCurve.cpp b/src/ifcgeom/mapping/IfcTrimmedCurve.cpp index 664c338f60..02cb0abe08 100644 --- a/src/ifcgeom/mapping/IfcTrimmedCurve.cpp +++ b/src/ifcgeom/mapping/IfcTrimmedCurve.cpp @@ -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(ifcopenshell::logger::LOG_WARNING, "GEO", 295, "Skipping segment with length below tolerance level:", inst); return nullptr; } tc->start = pnts[0]; @@ -140,7 +140,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) { TopoDS_Vertex v0, v1; TopExp::Vertices(e, v0, v1); if (v0.IsSame(v1)) { - ::logger::root().warning("Skipping degenerate segment", l); + ifcopenshell::logger::root().warning("Skipping degenerate segment", l); return false; } } @@ -168,7 +168,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) { TopoDS_Vertex v0, v1; TopExp::Vertices(e, v0, v1); e = TopoDS::Edge(BRepBuilderAPI_MakeEdge(v0, v1).Edge().Oriented(e.Orientation())); - ::logger::root().warning("Substituted edge with linear approximation", l); + ifcopenshell::logger::root().warning("Substituted edge with linear approximation", l); } } diff --git a/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp index 48674ee36a..7fbae0105c 100644 --- a/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp @@ -54,7 +54,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcUShapeProfileDef& inst) { const double tol = settings_.get().get(); if (x < tol || y < tol || d1 < tol || d2 < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 298, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 298, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp index 19f0ebf2e4..298870a379 100644 --- a/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp @@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcZShapeProfileDef& inst) { const double tol = settings_.get().get(); if (x < tol || y < tol || dx < tol || dy < tol) { - logger_.message(::logger::LOG_NOTICE, "GEO", 299, "Skipping zero sized profile:", inst); + logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 299, "Skipping zero sized profile:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 63acf01bc4..275aab97eb 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -40,7 +40,7 @@ using namespace ifcopenshell::geom; namespace { struct POSTFIX_SCHEMA(factory_t) { - abstract_mapping* operator()(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& logger) const { + abstract_mapping* operator()(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const { ifcopenshell::geom::POSTFIX_SCHEMA(mapping)* m = new ifcopenshell::geom::POSTFIX_SCHEMA(mapping)(file, settings, logger); return m; } @@ -774,7 +774,7 @@ taxonomy::ptr mapping::map(const express::base& inst) { cache_.insert({iden, item}); } } else if (!matched) { - logger_.message(::logger::LOG_ERROR, "GEO", 307, "No operation defined for:", inst); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 307, "No operation defined for:", inst); } return item; } @@ -927,7 +927,7 @@ void mapping::initialize_units_() { } catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to determine unit information '" << ex.what() << "'"; - logger_.message(::logger::LOG_ERROR, "GEO", 311, ss.str()); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 311, ss.str()); } if (!length_unit_encountered) { @@ -1012,7 +1012,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(ifcopenshell::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; @@ -1063,7 +1063,7 @@ bool mapping::get_layerset_information(const express::base& p, layerset_informat 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(ifcopenshell::logger::LOG_WARNING, "GEO", 315, "No axis representation for:", product); return false; } @@ -1138,7 +1138,7 @@ bool mapping::get_layerset_information(const express::base& p, layerset_informat } if (extrusions.size() != 1) { - logger_.message(::logger::LOG_WARNING, "GEO", 316, "No single extrusion found in body representation for:", product); + logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 316, "No single extrusion found in body representation for:", product); return false; } @@ -1153,7 +1153,7 @@ bool mapping::get_layerset_information(const express::base& p, layerset_informat if (has_position) { auto m4 = taxonomy::cast(map(extrusion.Position())); if (!m4) { - logger_.message(::logger::LOG_ERROR, "GEO", 317, "Failed to convert placement for extrusion of:", product); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 317, "Failed to convert placement for extrusion of:", product); return false; } else { extrusion_position = m4; @@ -1163,7 +1163,7 @@ bool mapping::get_layerset_information(const express::base& p, layerset_informat taxonomy::direction3::ptr extrusion_direction = taxonomy::cast(map(extrusion.ExtrudedDirection())); if (!extrusion_direction) { - logger_.message(::logger::LOG_ERROR, "GEO", 318, "Failed to convert direction for extrusion of:", product); + logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 318, "Failed to convert direction for extrusion of:", product); return false; } diff --git a/src/ifcgeom/mapping/mapping.h b/src/ifcgeom/mapping/mapping.h index 631575525d..512eb78d13 100644 --- a/src/ifcgeom/mapping/mapping.h +++ b/src/ifcgeom/mapping/mapping.h @@ -75,19 +75,19 @@ namespace geom { } } } catch (const std::exception& e) { - logger_.message(::logger::LOG_ERROR, "GEO", 325, std::string(e.what()) + "\nFailed to convert:", inst); + logger_.message(ifcopenshell::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(ifcopenshell::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(ifcopenshell::logger::LOG_ERROR, "GEO", 327, std::string(e.what()) + "\nFailed to convert:", inst); } } } IfcSchema::IfcStyledItem find_style(const IfcSchema::IfcRepresentationItem&); public: - POSTFIX_SCHEMA(mapping)(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& logger = ::logger::root()) : abstract_mapping(settings, logger), file_(file), placement_rel_to_type_(nullptr) { + POSTFIX_SCHEMA(mapping)(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : abstract_mapping(settings, logger), file_(file), placement_rel_to_type_(nullptr) { initialize_units_(); } virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&); diff --git a/src/ifcgeom/mapping/plugin.cpp b/src/ifcgeom/mapping/plugin.cpp index 4d6710e837..175fffa597 100644 --- a/src/ifcgeom/mapping/plugin.cpp +++ b/src/ifcgeom/mapping/plugin.cpp @@ -29,7 +29,7 @@ namespace ifcopenshell { namespace { struct POSTFIX_SCHEMA(factory_t) { - abstract_mapping* operator()(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ::logger& logger) const { + abstract_mapping* operator()(ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const { return new POSTFIX_SCHEMA(mapping)(file, settings, logger); } }; diff --git a/src/ifcgeom/profile_helper.cpp b/src/ifcgeom/profile_helper.cpp index e33e1d846c..c57b94d3f5 100644 --- a/src/ifcgeom/profile_helper.cpp +++ b/src/ifcgeom/profile_helper.cpp @@ -120,7 +120,7 @@ taxonomy::loop::ptr ifcopenshell::geom::profile_helper(const taxonomy::matrix4:: if (fillet.IsDone()) { face = TopoDS::Face(fillet.Shape()); } else { - ::logger::root().error("Failed to process profile fillets"); + ifcopenshell::logger::root().error("Failed to process profile fillets"); } } */ diff --git a/src/ifcgeom/taxonomy.cpp b/src/ifcgeom/taxonomy.cpp index 25718cbe02..3efbd3f111 100644 --- a/src/ifcgeom/taxonomy.cpp +++ b/src/ifcgeom/taxonomy.cpp @@ -861,7 +861,7 @@ std::optional ifcopenshell::geom::taxonomy::loop_to_function spans.emplace_back(taxonomy::make(l, fn)); } else if (edge_->start.index() == 1 && edge_->end.index() == 1) { if (edge_->basis && edge_->basis->kind() != LINE) { - ::logger::root().message(::logger::severity::LOG_WARNING, "UNS", 20, "Basis curve not supported - edge is treated as a straight line edge"); + ifcopenshell::logger::root().message(ifcopenshell::logger::severity::LOG_WARNING, "UNS", 20, "Basis curve not supported - edge is treated as a straight line edge"); } const auto& s = std::get(edge_->start)->ccomponents(); const auto& e = std::get(edge_->end)->ccomponents(); @@ -876,7 +876,7 @@ std::optional ifcopenshell::geom::taxonomy::loop_to_function }; spans.emplace_back(taxonomy::make(l, fn)); } else { - ::logger::root().message(::logger::severity::LOG_ERROR, "UNS", 21, "Basis curve not supported"); + ifcopenshell::logger::root().message(ifcopenshell::logger::severity::LOG_ERROR, "UNS", 21, "Basis curve not supported"); return std::nullopt; } } diff --git a/src/ifcgeom/taxonomy.h b/src/ifcgeom/taxonomy.h index 0545804d03..5c8183168d 100644 --- a/src/ifcgeom/taxonomy.h +++ b/src/ifcgeom/taxonomy.h @@ -37,7 +37,7 @@ // @todo don't do std::less but use hashing and cache hash values. -namespace boost { inline std::size_t hash_value(const blank&) { return 0; } } +namespace boost { inline std::size_t hash_value(const boost::blank&) { return 0; } } namespace ifcopenshell { diff --git a/src/ifcparse/alignment_helper.cpp b/src/ifcparse/alignment_helper.cpp index 50565c7cb3..78f988cb69 100644 --- a/src/ifcparse/alignment_helper.cpp +++ b/src/ifcparse/alignment_helper.cpp @@ -488,7 +488,7 @@ Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper& file, cons return alignment; } -std::pair mapAlignmentSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentSegment& segment, logger& logger) { +std::pair mapAlignmentSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentSegment& segment, ifcopenshell::logger& logger) { std::pair result; auto design_parameters = segment.DesignParameters(); auto horizontal = design_parameters.as(); @@ -514,7 +514,7 @@ Ifc4x3_add2::IfcLengthMeasure create_length(hierarchy_helper& file, } } -std::pair mapAlignmentHorizontalSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment, logger& logger) { +std::pair mapAlignmentHorizontalSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment, ifcopenshell::logger& logger) { std::pair result; auto start_point = segment.StartPoint(); auto start_direction = segment.StartDirection(); @@ -770,7 +770,7 @@ std::pair mapAlignme return result; } -std::pair mapAlignmentVerticalSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment, logger& logger) { +std::pair mapAlignmentVerticalSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment, ifcopenshell::logger& logger) { std::pair result; auto start_distance_along = segment.StartDistAlong(); auto horizontal_length = segment.HorizontalLength(); @@ -862,7 +862,7 @@ std::pair mapAlignme return result; } -std::pair mapAlignmentCantSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, logger& logger) { +std::pair mapAlignmentCantSegment(hierarchy_helper& file, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, ifcopenshell::logger& logger) { std::pair result; auto type = segment.PredefinedType(); if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_BLOSSCURVE) { diff --git a/src/ifcparse/alignment_helper.h b/src/ifcparse/alignment_helper.h index f95c5f5683..c686f4985a 100644 --- a/src/ifcparse/alignment_helper.h +++ b/src/ifcparse/alignment_helper.h @@ -45,10 +45,10 @@ IFC_SCHEMA_API Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper mapAlignmentSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentSegment& segment, logger& logger = ::logger::root()); -IFC_SCHEMA_API std::pair mapAlignmentHorizontalSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment, logger& logger = ::logger::root()); -IFC_SCHEMA_API std::pair mapAlignmentVerticalSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment, logger& logger = ::logger::root()); -IFC_SCHEMA_API std::pair mapAlignmentCantSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, logger& logger = ::logger::root()); +IFC_SCHEMA_API std::pair mapAlignmentSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentSegment& segment, ifcopenshell::logger& logger = ifcopenshell::logger::root()); +IFC_SCHEMA_API std::pair mapAlignmentHorizontalSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment, ifcopenshell::logger& logger = ifcopenshell::logger::root()); +IFC_SCHEMA_API std::pair mapAlignmentVerticalSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment, ifcopenshell::logger& logger = ifcopenshell::logger::root()); +IFC_SCHEMA_API std::pair mapAlignmentCantSegment(hierarchy_helper& model, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, ifcopenshell::logger& logger = ifcopenshell::logger::root()); #endif diff --git a/src/ifcparse/character_decoder.h b/src/ifcparse/character_decoder.h index 8d1f26460d..3426d92af7 100644 --- a/src/ifcparse/character_decoder.h +++ b/src/ifcparse/character_decoder.h @@ -57,7 +57,7 @@ class IFC_PARSE_API character_decoder { inline static ConversionMode mode = UTF8; inline static char substitution_character = '_'; - character_decoder(Reader* stream, logger& logger = ::logger::root()); + character_decoder(Reader* stream, logger& logger = ifcopenshell::logger::root()); ~character_decoder(); // Gets a decoded string representation at the token stream // read pointer and advances the underlying token stream. diff --git a/src/ifcparse/entity_instance_data.cpp b/src/ifcparse/entity_instance_data.cpp index 0df6b8ec51..d238efe7a6 100644 --- a/src/ifcparse/entity_instance_data.cpp +++ b/src/ifcparse/entity_instance_data.cpp @@ -3,6 +3,8 @@ #include "exception.h" #include "file.h" +using namespace ifcopenshell; + // @todo is size() still needed? class size_visitor { public: @@ -37,7 +39,7 @@ namespace { if (storage_model_ == 0) { try { return array_.storage_ptr->get(index_); - } catch (const impl::storage_type_mismatch& e) { + } catch (const ::impl::storage_type_mismatch& e) { throw ifcopenshell::exception( // entity_or_type not passed, but in v0.9 this is beginning to make sense (entity_or_type @@ -66,7 +68,7 @@ namespace { (is_header ? "h|" : (entity_or_type->as_entity() ? "i|" : "t|")) + (is_header ? entity_or_type->name() : std::to_string(instance_name_)) + "|" + std::to_string(index_), &str); - impl::deserialize(array_.db_ptr, str, val); + ::impl::deserialize(array_.db_ptr, str, val); } else { static_assert( std::is_same_v || @@ -287,7 +289,7 @@ ifcopenshell::argument_type attribute_value::type() const #ifdef IFOPSH_WITH_ROCKSDB -bool impl::serialize(std::string& val, const express::base& t) +bool ::impl::serialize(std::string& val, const express::base& t) { auto s = sizeof(size_t); val.resize(s + 2); @@ -300,7 +302,7 @@ bool impl::serialize(std::string& val, const express::base& t) return true; } -bool impl::serialize(std::string& val, const enumeration_reference& v) +bool ::impl::serialize(std::string& val, const enumeration_reference& v) { auto s = sizeof(size_t); val.resize(s * 2 + 1); @@ -312,7 +314,7 @@ bool impl::serialize(std::string& val, const enumeration_reference& v) return true; } -bool impl::serialize(std::string& val, const std::vector& t) +bool ::impl::serialize(std::string& val, const std::vector& t) { // no attempt at alignment val.resize(t.size() * (sizeof(size_t) + 1) + 1); @@ -328,7 +330,7 @@ bool impl::serialize(std::string& val, const std::vector& t) return true; } -bool impl::serialize(std::string& val, const std::vector>& t) +bool ::impl::serialize(std::string& val, const std::vector>& t) { std::ostringstream oss; oss.put(type_encoder::encode_type>>()); @@ -363,35 +365,35 @@ bool impl::serialize(std::string& val, const std::vector(); return true; } -bool impl::serialize(std::string& val, const derived&) +bool ::impl::serialize(std::string& val, const derived&) { val.resize(1); val[0] = type_encoder::encode_type(); return true; } -bool impl::serialize(std::string& val, const empty_aggregate_t&) +bool ::impl::serialize(std::string& val, const empty_aggregate_t&) { val.resize(1); val[0] = type_encoder::encode_type(); return true; } -bool impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t&) +bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t&) { val.resize(1); val[0] = type_encoder::encode_type(); return true; } -bool impl::serialize(std::string& val, const boost::logic::tribool& t) +bool ::impl::serialize(std::string& val, const boost::logic::tribool& t) { char tt = t == boost::logic::indeterminate ? 2 : t ? 1 : 0; val.resize(sizeof(char) + 1); @@ -400,7 +402,7 @@ bool impl::serialize(std::string& val, const boost::logic::tribool& t) return true; } -bool impl::serialize(std::string& val, const boost::dynamic_bitset<>& t) +bool ::impl::serialize(std::string& val, const boost::dynamic_bitset<>& t) { std::string tmp; boost::to_string(t, tmp); @@ -408,7 +410,7 @@ bool impl::serialize(std::string& val, const boost::dynamic_bitset<>& t) return true; } -bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, boost::logic::tribool& t) { +bool ::impl::deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, boost::logic::tribool& t) { if (val[0] != type_encoder::encode_type()) { return false; } @@ -424,7 +426,7 @@ bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::st return true; } -bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, boost::dynamic_bitset<>& t) { +bool ::impl::deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::string& val, boost::dynamic_bitset<>& t) { if (val[0] != type_encoder::encode_type>()) { return false; } @@ -432,7 +434,7 @@ bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage*, const std::st return true; } -bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& val, std::vector& t) { +bool ::impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& val, std::vector& t) { auto n = (val.size() - 1) / (sizeof(size_t) + 1); for (int i = 0; i < n; ++i) { auto ptr = val.data() + 1 + (sizeof(size_t) + 1) * i; @@ -451,7 +453,7 @@ bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const return true; } -bool impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& val, std::vector>& t) { +bool ::impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& val, std::vector>& t) { char const* ptr = val.data() + 1; // size_t outer_size; @@ -514,7 +516,7 @@ void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declarat const bool is_header = decl->schema() == &Header_section_schema::get_schema(); ifcopenshell::impl::rocks_db_file_storage* rdb_storage = (ifcopenshell::impl::rocks_db_file_storage*)storage; std::string v; - impl::serialize(v, value); + ::impl::serialize(v, value); rdb_storage->db->Put( rdb_storage->wopts, (is_header ? "h|" : (decl->as_entity() ? "i|" : "t|")) + diff --git a/src/ifcparse/express.cpp b/src/ifcparse/express.cpp index 71ad0cb3b7..0df64878cd 100644 --- a/src/ifcparse/express.cpp +++ b/src/ifcparse/express.cpp @@ -8,7 +8,7 @@ uint32_t express::base::identity() const { return data()->identity(); } uint32_t express::base::id() const { return data()->id(); } -const instance_data* express::base::data() const { +const ifcopenshell::instance_data* express::base::data() const { #ifdef IFOPSH_SAFE_INSTANCE auto sp = data_.lock(); if (sp) { @@ -21,7 +21,7 @@ const instance_data* express::base::data() const { #endif } -instance_data* express::base::data() { +ifcopenshell::instance_data* express::base::data() { #ifdef IFOPSH_SAFE_INSTANCE auto sp = data_.lock(); if (sp) { diff --git a/src/ifcparse/express.h b/src/ifcparse/express.h index 47f9459b19..2e4c0fca78 100644 --- a/src/ifcparse/express.h +++ b/src/ifcparse/express.h @@ -54,8 +54,10 @@ struct in_memory_file_storage; } } // namespace ifcopenshell +namespace ifcopenshell { class instance_data; class attribute_value; +} namespace express { @@ -67,8 +69,8 @@ class declared_type; class IFC_PARSE_API base { protected: ifcopenshell::pointer_type data_; - const instance_data* data() const; - instance_data* data(); + const ifcopenshell::instance_data* data() const; + ifcopenshell::instance_data* data(); public: operator bool() const { #ifdef IFOPSH_SAFE_INSTANCE @@ -120,7 +122,7 @@ class IFC_PARSE_API base { void unset_attribute_value(size_t attribute_index); - attribute_value get_attribute_value(size_t attribute_index) const; + ifcopenshell::attribute_value get_attribute_value(size_t attribute_index) const; uint32_t identity() const; @@ -160,7 +162,7 @@ class IFC_PARSE_API entity : public base { public: using base::base; - attribute_value get(const std::string& attribute_name) const; + ifcopenshell::attribute_value get(const std::string& attribute_name) const; template T get_value(const std::string& attribute_name) const; diff --git a/src/ifcparse/file.h b/src/ifcparse/file.h index 3a6f3f4f65..16e65cb882 100644 --- a/src/ifcparse/file.h +++ b/src/ifcparse/file.h @@ -102,7 +102,7 @@ private: const ifcopenshell::schema_definition* schema_; ifcopenshell::impl::in_memory_file_storage storage_; ifcopenshell::file_open_status good_ = ifcopenshell::file_open_status::SUCCESS; - std::reference_wrapper<::logger> logger_; + std::reference_wrapper logger_; int progress_; ifcopenshell::unresolved_references references_to_resolve_; int yielded_header_instances_ = 0; @@ -156,13 +156,13 @@ private: void push_page(const std::string& page_data); - instance_streamer(ifcopenshell::file* owner_file = nullptr, ::logger& logger = ::logger::root()); + instance_streamer(ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()); - instance_streamer(const std::string& path, bool use_mmap = false, ifcopenshell::file* owner_file = nullptr, ::logger& logger = ::logger::root()); + instance_streamer(const std::string& path, bool use_mmap = false, ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()); - instance_streamer(void* data, int data_size, ifcopenshell::file* owner_file = nullptr, ::logger& logger = ::logger::root()); + instance_streamer(void* data, int data_size, ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()); - instance_streamer(Reader* stream, ifcopenshell::file* owner_file = nullptr, ::logger& logger = ::logger::root()); + instance_streamer(Reader* stream, ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()); void bypass_types(const std::set& type_names); @@ -210,7 +210,7 @@ public: private: file_open_status good_ = file_open_status::SUCCESS; - std::reference_wrapper<::logger> logger_; + std::reference_wrapper logger_; const ifcopenshell::schema_definition* schema_; const ifcopenshell::declaration* ifcroot_type_; @@ -241,7 +241,7 @@ public: /// /// UTF-8 file path to an IFC-SPF file /// Whether to use memory-mapped I/O - file(const std::string& path, bool use_mmap, ::logger& logger = ::logger::root()); + file(const std::string& path, bool use_mmap, ifcopenshell::logger& logger = ifcopenshell::logger::root()); #endif /// /// Constructs an file object from a file path, supports IFC-SPF and the IfcOpenShell-specific RocksDB format. @@ -250,17 +250,17 @@ public: /// File type of the path /// Whether to open in read-only mode, only supported on RocksDB databases /// Logger used while opening the file - file(const std::string& path, filetype type = FT_AUTODETECT, bool read_only = false, ::logger& logger = ::logger::root()); + file(const std::string& path, filetype type = FT_AUTODETECT, bool read_only = false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); /// /// Constructs an file object from a stream containing IFC-SPF data. /// - file(std::istream& stream, int data_size, ::logger& logger = ::logger::root()); + file(std::istream& stream, int data_size, ifcopenshell::logger& logger = ifcopenshell::logger::root()); /// /// Constructs an file object from a memory buffer containing IFC-SPF data. /// - file(void* data, int data_size, ::logger& logger = ::logger::root()); + file(void* data, int data_size, ifcopenshell::logger& logger = ifcopenshell::logger::root()); /// /// Constructs an file object with the specified schema, file type, and file path. @@ -270,12 +270,12 @@ public: /// The file type to use for the file. Defaults to FT_AUTODETECT. /// The file system path to the IFC file. Defaults to an empty string. /// Logger used while creating the file. - file(const ifcopenshell::schema_definition* schema = ifcopenshell::schema_by_name("IFC4"), filetype type = FT_AUTODETECT, const std::string& path = "", ::logger& logger = ::logger::root()); + file(const ifcopenshell::schema_definition* schema = ifcopenshell::schema_by_name("IFC4"), filetype type = FT_AUTODETECT, const std::string& path = "", ifcopenshell::logger& logger = ifcopenshell::logger::root()); /// /// Constructs an unitialized file object. Call initialize() later on. Allows to specify which types to bypass during load. /// - file(const uninitialized_tag& tag, ::logger& logger = ::logger::root()); + file(const uninitialized_tag& tag, ifcopenshell::logger& logger = ifcopenshell::logger::root()); bool initialize(const std::string& path, filetype type = FT_AUTODETECT, bool read_only = false); #ifdef USE_MMAP @@ -289,7 +289,7 @@ public: ~file(); ifcopenshell::file_open_status good() const { return good_; } - ::logger& logger() const { return logger_.get(); } + ifcopenshell::logger& logger() const { return logger_.get(); } /// Returns the first entity in the range of instances contained in the model, /// in arbitrary order diff --git a/src/ifcparse/global_id.cpp b/src/ifcparse/global_id.cpp index e26753a4c6..1e987150c5 100644 --- a/src/ifcparse/global_id.cpp +++ b/src/ifcparse/global_id.cpp @@ -111,7 +111,7 @@ ifcopenshell::global_id::global_id(logger& logger) { boost::uuids::uuid test_uuid; std::copy(test_vector.begin(), test_vector.end(), test_uuid.begin()); if (uuid_data_ != test_uuid) { - logger.message(::logger::LOG_ERROR, "SYS", 34, "Internal error generating GlobalId"); + logger.message(ifcopenshell::logger::LOG_ERROR, "SYS", 34, "Internal error generating GlobalId"); } #endif } @@ -130,7 +130,7 @@ ifcopenshell::global_id::global_id(const std::string& string, logger& logger) #ifndef NDEBUG const std::string test_string = compress(&uuid_data_.data[0]); if (string_data_ != test_string) { - logger.message(::logger::LOG_ERROR, "SYS", 35, "Internal error generating GlobalId"); + logger.message(ifcopenshell::logger::LOG_ERROR, "SYS", 35, "Internal error generating GlobalId"); } #endif } diff --git a/src/ifcparse/global_id.h b/src/ifcparse/global_id.h index b2be0f4d24..5dcb4c09d2 100644 --- a/src/ifcparse/global_id.h +++ b/src/ifcparse/global_id.h @@ -37,8 +37,8 @@ class IFC_PARSE_API global_id { public: static const unsigned int length = 22; - global_id(logger& logger = ::logger::root()); - global_id(const std::string& value, logger& logger = ::logger::root()); + global_id(logger& logger = ifcopenshell::logger::root()); + global_id(const std::string& value, logger& logger = ifcopenshell::logger::root()); operator const std::string&() const; operator const boost::uuids::uuid&() const; const std::string& formatted() const; diff --git a/src/ifcparse/hierarchy_helper.h b/src/ifcparse/hierarchy_helper.h index a740d88f06..6205a3c1d9 100644 --- a/src/ifcparse/hierarchy_helper.h +++ b/src/ifcparse/hierarchy_helper.h @@ -180,9 +180,9 @@ class IFC_SCHEMA_API hierarchy_helper : public ifcopenshell::file { break; } } catch (std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); } catch (...) { - ::logger::root().error("Unknown error in addRelatedObject()"); + ifcopenshell::logger::root().error("Unknown error in addRelatedObject()"); } } if (!found) { diff --git a/src/ifcparse/hierarchy_helper.i b/src/ifcparse/hierarchy_helper.i index a9257d2b54..c6ba3b2b92 100644 --- a/src/ifcparse/hierarchy_helper.i +++ b/src/ifcparse/hierarchy_helper.i @@ -174,7 +174,7 @@ void hierarchy_helper::relatePlacements(typename Schema::IfcProduct pare if (local_place != parent.ObjectPlacement()) { local_place.setPlacementRelTo(parent.ObjectPlacement()); } else { - ::logger::root().notice("Placement cannot be relative to self"); + ifcopenshell::logger::root().notice("Placement cannot be relative to self"); } } } diff --git a/src/ifcparse/instance_data.h b/src/ifcparse/instance_data.h index 883eadc5c9..e1fb131d19 100644 --- a/src/ifcparse/instance_data.h +++ b/src/ifcparse/instance_data.h @@ -45,6 +45,8 @@ #include #include +namespace ifcopenshell { + class IFC_PARSE_API enumeration_reference { private: const ifcopenshell::enumeration_type* enumeration_; @@ -73,14 +75,16 @@ class IFC_PARSE_API derived {}; class IFC_PARSE_API empty_aggregate_t {}; class IFC_PARSE_API empty_aggregate_of_aggregate_t {}; +} // namespace ifcopenshell + namespace impl { template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "null"; } }; template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "derived"; } }; @@ -120,7 +124,7 @@ namespace impl { }; template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "enumeration"; } }; @@ -130,7 +134,7 @@ namespace impl { }; template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "aggregate"; } }; @@ -140,11 +144,13 @@ namespace impl { }; template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "aggregate of aggregate"; } }; } +namespace ifcopenshell { + template struct parameter_pack { static constexpr size_t size = sizeof...(Args); @@ -239,12 +245,12 @@ class IFC_PARSE_API mutable_attribute_value { uint8_t index_; }; -namespace ifcopenshell { - namespace impl { - class IFC_PARSE_API rocks_db_file_storage; - } +namespace impl { + class IFC_PARSE_API rocks_db_file_storage; } +} // namespace ifcopenshell + #ifdef IFOPSH_WITH_ROCKSDB namespace impl { @@ -261,14 +267,14 @@ namespace impl { bool serialize(std::string& buffer, const T& value) { auto byte_count = sizeof(typename T::value_type) * value.size(); buffer.resize(byte_count + 1); - buffer[0] = type_encoder::encode_type(); + buffer[0] = ifcopenshell::type_encoder::encode_type(); memcpy(buffer.data() + 1, value.data(), byte_count); return true; } template ::value&& is_contiguous_container::value, int>::type = 0> bool serialize(std::string& buffer, const T& value) { - buffer = std::string(1, type_encoder::encode_type()); + buffer = std::string(1, ifcopenshell::type_encoder::encode_type()); for (auto& nested_value : value) { std::string nested_buffer; serialize(nested_buffer, nested_value); @@ -285,16 +291,16 @@ namespace impl { template || std::is_floating_point_v, int>::type = 0> bool serialize(std::string& buffer, const T& value) { buffer.resize(sizeof(T) + 1); - buffer[0] = type_encoder::encode_type(); + buffer[0] = ifcopenshell::type_encoder::encode_type(); memcpy(buffer.data() + 1, &value, sizeof(T)); return true; } - bool serialize(std::string& buffer, const blank& value); + bool serialize(std::string& buffer, const ifcopenshell::blank& value); - bool serialize(std::string& buffer, const derived& value); - bool serialize(std::string& buffer, const empty_aggregate_t& value); - bool serialize(std::string& buffer, const empty_aggregate_of_aggregate_t& value); + bool serialize(std::string& buffer, const ifcopenshell::derived& value); + bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_t& value); + bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate_t& value); bool serialize(std::string& buffer, const boost::logic::tribool& value); @@ -302,7 +308,7 @@ namespace impl { bool serialize(std::string& buffer, const express::base& value); - bool serialize(std::string& buffer, const enumeration_reference& value); + bool serialize(std::string& buffer, const ifcopenshell::enumeration_reference& value); bool serialize(std::string& buffer, const std::vector& value); @@ -311,7 +317,7 @@ namespace impl { template ::value && !is_contiguous_container::value, int>::type = 0> bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, T& value, bool has_type_prefix = true) { static_cast(storage); - if (has_type_prefix && buffer[0] != type_encoder::encode_type()) { + if (has_type_prefix && buffer[0] != ifcopenshell::type_encoder::encode_type()) { return false; } auto element_count = (buffer.size() - (has_type_prefix ? 1 : 0)) / sizeof(typename T::value_type); @@ -324,7 +330,7 @@ namespace impl { bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, T& value) { // @todo auto ptr = buffer.data(); - if (*ptr != type_encoder::encode_type()) { + if (*ptr != ifcopenshell::type_encoder::encode_type()) { return false; } ptr++; @@ -345,7 +351,7 @@ namespace impl { template || std::is_floating_point_v, int>::type = 0> bool deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, const std::string& buffer, T& value) { static_cast(storage); - if (buffer[0] != type_encoder::encode_type()) { + if (buffer[0] != ifcopenshell::type_encoder::encode_type()) { return false; } memcpy(&value, buffer.data() + 1, sizeof(T)); @@ -363,6 +369,8 @@ namespace impl { #endif +namespace ifcopenshell { + // short lived class IFC_PARSE_API attribute_value { uint8_t index_; @@ -594,4 +602,6 @@ class IFC_PARSE_API instance_data { void to_string(std::ostream& stream, bool uppercase = false) const; }; +} // namespace ifcopenshell + #endif diff --git a/src/ifcparse/logger.cpp b/src/ifcparse/logger.cpp index 8fc27460dc..e3f348d202 100644 --- a/src/ifcparse/logger.cpp +++ b/src/ifcparse/logger.cpp @@ -32,6 +32,8 @@ #include #include +using ifcopenshell::logger; + namespace { std::string get_time(bool with_milliseconds = false) { @@ -141,6 +143,8 @@ void json_message(T& out, const express::base& current_product, logger::severity } // namespace +namespace ifcopenshell { + log_message::log_message( int severity, const std::string& code, @@ -378,3 +382,5 @@ void logger::output_format(format format) { logger::format logger::output_format() const { return format_; } + +} // namespace ifcopenshell diff --git a/src/ifcparse/logger.h b/src/ifcparse/logger.h index af111059db..b2ba557b2b 100644 --- a/src/ifcparse/logger.h +++ b/src/ifcparse/logger.h @@ -34,6 +34,8 @@ #include #include +namespace ifcopenshell { + class IFC_PARSE_API log_message { public: char code[7]; @@ -152,14 +154,16 @@ class IFC_PARSE_API logger { // Using `logger* = nullptr` instead of `logger& = logger::root()` helps, // since `nullptr` is convertable Python's `None`. // `logger_or_root` is just covering the boilerplate for this pattern. -inline logger& logger_or_root(logger* logger) { return logger ? *logger : ::logger::root(); } +inline logger& logger_or_root(logger* logger) { return logger ? *logger : logger::root(); } + +} // namespace ifcopenshell #define PERF(x) \ \ - ::logger::root().message(::logger::LOG_PERF, x); \ + ::ifcopenshell::logger::root().message(::ifcopenshell::logger::LOG_PERF, x); \ \ BOOST_SCOPE_EXIT(void) { \ - ::logger::root().message(::logger::LOG_PERF, "done " + std::string(x)); \ + ::ifcopenshell::logger::root().message(::ifcopenshell::logger::LOG_PERF, "done " + std::string(x)); \ } \ BOOST_SCOPE_EXIT_END diff --git a/src/ifcparse/parse.cpp b/src/ifcparse/parse.cpp index aab635a458..6e1170760a 100644 --- a/src/ifcparse/parse.cpp +++ b/src/ifcparse/parse.cpp @@ -61,7 +61,7 @@ using namespace ifcopenshell; template -spf_lexer::spf_lexer(Reader* stream_, ::logger& log) +spf_lexer::spf_lexer(Reader* stream_, ifcopenshell::logger& log) : decoder_(nullptr) , logger_(log) { stream = stream_; @@ -638,7 +638,7 @@ void warn_attribute_count( std::optional instance_name, size_t expected_size, size_t actual_size, - ::logger& logger + ifcopenshell::logger& logger ) { if (!declaration || expected_size == actual_size) { return; @@ -700,9 +700,9 @@ struct direct_aggregate { direct_aggregate_storage storage; size_t pending_empty_aggregates = 0; size_t values = 0; - ::logger& logger_; + ifcopenshell::logger& logger_; - explicit direct_aggregate(::logger& logger) + explicit direct_aggregate(ifcopenshell::logger& logger) : logger_(logger) {} template @@ -873,7 +873,7 @@ void set_direct_attribute( if constexpr (std::is_same_v, ifcopenshell::reference_or_simple_type>) { if (instance_name && references_to_resolve) { references_to_resolve->push_back(std::make_pair( - mutable_attribute_value{(uint32_t) *instance_name, resolve_reference_index == -1 ? (uint8_t) attribute_index : (uint8_t) resolve_reference_index}, + ifcopenshell::mutable_attribute_value{(uint32_t) *instance_name, resolve_reference_index == -1 ? (uint8_t) attribute_index : (uint8_t) resolve_reference_index}, value )); } @@ -914,7 +914,7 @@ direct_aggregate read_direct_aggregate( const ifcopenshell::entity* entity, int attribute_index, const ifcopenshell::aggregation_type* aggregate_type, - ::logger& logger + ifcopenshell::logger& logger ) { direct_aggregate aggregate(logger); token next = tokens->next(); @@ -1021,7 +1021,7 @@ shared_pointer_type ifcopenshell::impl::in_memory_file_storage::load( skip_aggregate(tokens); } } catch (exception& e) { - logger_.get().message(::logger::LOG_ERROR, std::string(e.what()) + " at offset " + std::to_string(next.start_pos)); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, std::string(e.what()) + " at offset " + std::to_string(next.start_pos)); --values_read; } } else { @@ -1654,7 +1654,7 @@ express::base::set_attribute_value(const std::string& s, const T& t) // Creates the maps // #ifdef USE_MMAP -file::file(const std::string& fn, bool mmap, ::logger& log) +file::file(const std::string& fn, bool mmap, ifcopenshell::logger& log) : logger_(log) , schema_(nullptr) , ifcroot_type_(nullptr) @@ -1687,7 +1687,7 @@ bool ifcopenshell::file::initialize(const std::string& fn, bool mmap) { } #endif -file::file(const uninitialized_tag&, ::logger& log) +file::file(const uninitialized_tag&, ifcopenshell::logger& log) : good_(file_open_status::UNKNOWN), logger_(log), schema_(nullptr), ifcroot_type_(nullptr), max_id_(0), header_(nullptr) {} bool ifcopenshell::file::initialize(const std::string& path, filetype ty, bool readonly) { @@ -1744,7 +1744,7 @@ void ifcopenshell::file::bypass_type(const std::string& type_name) { types_to_bypass_loading_.insert(type_name); } -file::file(const std::string& path, filetype ty, bool readonly, ::logger& log) +file::file(const std::string& path, filetype ty, bool readonly, ifcopenshell::logger& log) : logger_(log) , schema_(nullptr) , ifcroot_type_(nullptr) @@ -1753,7 +1753,7 @@ file::file(const std::string& path, filetype ty, bool readonly, ::logger& log) initialize(path, ty, readonly); } -file::file(std::istream& stream, int length, ::logger& log) +file::file(std::istream& stream, int length, ifcopenshell::logger& log) : logger_(log) , schema_(nullptr) , ifcroot_type_(nullptr) @@ -1778,7 +1778,7 @@ file::file(std::istream& stream, int length, ::logger& log) } -file::file(void* data, int length, ::logger& log) +file::file(void* data, int length, ifcopenshell::logger& log) : logger_(log) , schema_(nullptr) , ifcroot_type_(nullptr) @@ -1798,7 +1798,7 @@ file::file(void* data, int length, ::logger& log) } -file::file(const ifcopenshell::schema_definition* schema, filetype ty, const std::string& path, ::logger& log) +file::file(const ifcopenshell::schema_definition* schema, filetype ty, const std::string& path, ifcopenshell::logger& log) : logger_(log) , schema_(schema) , ifcroot_type_(schema_->declaration_by_name("IfcRoot")) @@ -2017,7 +2017,7 @@ void ifcopenshell::instance_streamer::push_page(const std::string& page) } template -ifcopenshell::instance_streamer::instance_streamer(ifcopenshell::file* f, ::logger& log) +ifcopenshell::instance_streamer::instance_streamer(ifcopenshell::file* f, ifcopenshell::logger& log) : stream_(nullptr) , owner_(f) , token_stream_(3, token{}) @@ -2042,7 +2042,7 @@ ifcopenshell::instance_streamer::instance_streamer(ifcopenshell::file* f } template -ifcopenshell::instance_streamer::instance_streamer(const std::string& fn, bool mmap, ifcopenshell::file* f, ::logger& log) +ifcopenshell::instance_streamer::instance_streamer(const std::string& fn, bool mmap, ifcopenshell::file* f, ifcopenshell::logger& log) : stream_(nullptr) , owner_(f) , token_stream_(3, token{}) @@ -2070,7 +2070,7 @@ ifcopenshell::instance_streamer::instance_streamer(const std::string& fn } template -ifcopenshell::instance_streamer::instance_streamer(void* data, int length, ifcopenshell::file* f, ::logger& log) +ifcopenshell::instance_streamer::instance_streamer(void* data, int length, ifcopenshell::file* f, ifcopenshell::logger& log) : stream_(nullptr) , owner_(f) , token_stream_(3, token{}) @@ -2094,7 +2094,7 @@ ifcopenshell::instance_streamer::instance_streamer(void* data, int lengt } template -ifcopenshell::instance_streamer::instance_streamer(Reader* stream, ifcopenshell::file* f, ::logger& log) +ifcopenshell::instance_streamer::instance_streamer(Reader* stream, ifcopenshell::file* f, ifcopenshell::logger& log) : stream_(stream) , owner_(f) , token_stream_(3, token{}) @@ -2168,13 +2168,13 @@ std::optionaldeclaration_by_name(token_stream_[2].as_string()); } catch (const exception& ex) { - logger_.get().message(::logger::LOG_ERROR, std::string(ex.what()) + " at offset " + std::to_string(token_stream_[2].start_pos)); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, std::string(ex.what()) + " at offset " + std::to_string(token_stream_[2].start_pos)); current_id = 0; goto advance; } if (entity_type->as_entity() == nullptr) { - logger_.get().message(::logger::LOG_ERROR, "Non-entity type " + entity_type->name() + " at offset " + std::to_string(token_stream_[2].start_pos)); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, "Non-entity type " + entity_type->name() + " at offset " + std::to_string(token_stream_[2].start_pos)); current_id = 0; goto advance; } @@ -2210,9 +2210,9 @@ std::optionalnext(); } catch (const exception& e) { - logger_.get().message(::logger::LOG_ERROR, std::string(e.what()) + ". Parsing terminated"); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, std::string(e.what()) + ". Parsing terminated"); } catch (...) { - logger_.get().message(::logger::LOG_ERROR, "Parsing terminated"); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, "Parsing terminated"); } if (!lexer_->stream->eof() && !next_token) { @@ -2268,7 +2268,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con } else { good_ = file_open_status::UNSUPPORTED_SCHEMA; } - logger_.get().message(::logger::LOG_ERROR, "No support for file schema encountered (" + boost::algorithm::join(schemas, ", ") + ")"); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, "No support for file schema encountered (" + boost::algorithm::join(schemas, ", ") + ")"); return; } @@ -2293,11 +2293,11 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con if (byguid_.find(guid) != byguid_.end()) { std::stringstream ss; ss << "Instance encountered with non-unique GlobalId " << guid; - logger_.get().message(::logger::LOG_WARNING, ss.str()); + logger_.get().message(ifcopenshell::logger::LOG_WARNING, ss.str()); } byguid_[guid] = instance; } catch (const exception& ex) { - logger_.get().message(::logger::LOG_ERROR, ex.what()); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, ex.what()); } } @@ -2307,7 +2307,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con if (byid_.find(current_id) != byid_.end()) { std::stringstream ss; ss << "Overwriting instance with name #" << current_id; - logger_.get().message(::logger::LOG_WARNING, ss.str()); + logger_.get().message(ifcopenshell::logger::LOG_WARNING, ss.str()); } byid_.insert({(uint32_t)current_id, std::get<2>(*inst)}); @@ -2600,7 +2600,7 @@ express::base file::add_entity(const express::base& entity, int id) { } } } catch (...) { - logger_.get().message(::logger::LOG_ERROR, "Failed to visit forward references of", entity); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, "Failed to visit forward references of", entity); } // An instance is being added from another file. A copy of the @@ -2729,11 +2729,11 @@ express::base file::add_entity(const express::base& entity, int id) { if (byguid_.find(guid) != byguid_.end()) { std::stringstream ss; ss << "Overwriting entity with guid " << guid; - logger_.get().message(::logger::LOG_WARNING, ss.str()); + logger_.get().message(ifcopenshell::logger::LOG_WARNING, ss.str()); } byguid_.insert({ guid, new_entity }); } catch (const std::exception& ex) { - logger_.get().message(::logger::LOG_ERROR, ex.what()); + logger_.get().message(ifcopenshell::logger::LOG_ERROR, ex.what()); } } */ diff --git a/src/ifcparse/parse.h b/src/ifcparse/parse.h index e1c944b316..50736b302a 100644 --- a/src/ifcparse/parse.h +++ b/src/ifcparse/parse.h @@ -52,7 +52,7 @@ template class IFC_PARSE_API spf_lexer { private: character_decoder* decoder_; - ::logger& logger_; + ifcopenshell::logger& logger_; size_t skip_whitespace() const; size_t skip_comment() const; @@ -77,7 +77,7 @@ class IFC_PARSE_API spf_lexer { Reader* stream; // file* file; - spf_lexer(Reader* stream, ::logger& logger = ::logger::root()); + spf_lexer(Reader* stream, ifcopenshell::logger& logger = ifcopenshell::logger::root()); token next(); ~spf_lexer(); // void TokenString(size_t offset, std::string& result); diff --git a/src/ifcparse/schema.h b/src/ifcparse/schema.h index 6011042d6d..90b70fcebb 100644 --- a/src/ifcparse/schema.h +++ b/src/ifcparse/schema.h @@ -36,10 +36,10 @@ #include // Forward declarations -class instance_data; - namespace ifcopenshell { +class instance_data; + class declaration; class type_declaration; diff --git a/src/ifcparse/spf_header.cpp b/src/ifcparse/spf_header.cpp index 791655dd9d..6af743880e 100644 --- a/src/ifcparse/spf_header.cpp +++ b/src/ifcparse/spf_header.cpp @@ -12,7 +12,7 @@ using namespace ifcopenshell; namespace { -shared_pointer_type make_header_entity(ifcopenshell::file* file, const ifcopenshell::entity& decl, ::logger& logger) { +shared_pointer_type make_header_entity(ifcopenshell::file* file, const ifcopenshell::entity& decl, ifcopenshell::logger& logger) { static_cast(logger); const bool in_memory = file == nullptr || std::visit([](auto& storage) { return std::is_same_v, ifcopenshell::impl::in_memory_file_storage>; @@ -27,7 +27,7 @@ shared_pointer_type make_header_entity(ifcopenshell::file* file, const ifcopensh } // namespace -ifcopenshell::spf_header::spf_header(ifcopenshell::file* file, ::logger* logger) +ifcopenshell::spf_header::spf_header(ifcopenshell::file* file, ifcopenshell::logger* logger) : file_(file) , logger_(logger_or_root(logger)) { Header_section_schema::get_schema(); diff --git a/src/ifcparse/spf_header.h b/src/ifcparse/spf_header.h index e25ee6ce1a..d2c403cbff 100644 --- a/src/ifcparse/spf_header.h +++ b/src/ifcparse/spf_header.h @@ -32,19 +32,19 @@ class file; class IFC_PARSE_API spf_header { private: ifcopenshell::file* file_; - std::reference_wrapper<::logger> logger_; + std::reference_wrapper logger_; std::array header_entities_; public: - explicit spf_header(ifcopenshell::file* file = nullptr, ::logger* logger = nullptr); + explicit spf_header(ifcopenshell::file* file = nullptr, ifcopenshell::logger* logger = nullptr); ~spf_header(); void write(std::ostream& stream) const; ifcopenshell::file* owner_file() { return file_; } void owner_file(ifcopenshell::file* file); - ::logger& logger() const { return logger_.get(); } + ifcopenshell::logger& logger() const { return logger_.get(); } void set_file_description(const shared_pointer_type& description_data); void set_file_name(const shared_pointer_type& name_data); diff --git a/src/ifcparse/storage.h b/src/ifcparse/storage.h index 73ae671166..a32f618bdc 100644 --- a/src/ifcparse/storage.h +++ b/src/ifcparse/storage.h @@ -123,10 +123,10 @@ private: #endif -class mutable_attribute_value; - namespace ifcopenshell { + class mutable_attribute_value; + struct IFC_PARSE_API instance_reference { int v; size_t file_offset; @@ -412,7 +412,7 @@ namespace ifcopenshell { return std::move(read_simple_type_instances); } - std::reference_wrapper<::logger> logger_; + std::reference_wrapper logger_; // IfcParse::FileReader* stream; // Either one of these needs to be set @@ -429,7 +429,7 @@ namespace ifcopenshell { typedef inverse_index entities_by_ref_t; typedef entity_instance_by_name_t::iterator iterator; - in_memory_file_storage(ifcopenshell::file* owner_file = nullptr, ::logger& logger = ::logger::root()) : logger_(logger), file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const shared_pointer_type& data) { return express::base(data); }) {}; + in_memory_file_storage(ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : logger_(logger), file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const shared_pointer_type& data) { return express::base(data); }) {}; in_memory_file_storage(const in_memory_file_storage& other) = delete; in_memory_file_storage(const in_memory_file_storage&& other) = delete; diff --git a/src/ifcparse/utils.cpp b/src/ifcparse/utils.cpp index 837437aed0..ac42923f9f 100644 --- a/src/ifcparse/utils.cpp +++ b/src/ifcparse/utils.cpp @@ -131,19 +131,19 @@ void ifcopenshell::unescape_xml(std::string& str) { boost::replace_all(str, ">", ">"); } -void instance_data::populate_derived_() { +void ifcopenshell::instance_data::populate_derived_() { if (auto* ent = declaration_->as_entity()) { for (auto it = ent->derived().begin(); it != ent->derived().end(); ++it) { if (*it) { set_attribute_value( std::distance(ent->derived().begin(), it), - derived{}); + ifcopenshell::derived{}); } } } } -attribute_value express::entity::get(const std::string& name) const { +ifcopenshell::attribute_value express::entity::get(const std::string& name) const { auto attrs = declaration().as_entity()->all_attributes(); auto iter = attrs.begin(); size_t idx = 0; diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index eed6168f7e..4cfddab0d4 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -730,20 +730,20 @@ struct shape_rtti : public boost::static_visitor // I couldn't get the vector typemap to be applied when %extending Iterator constructor. // anyway it does not matter as SWIG generates C code without actual constructors - ifcopenshell::geom::iterator* construct_iterator(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, int num_threads, logger* logger = nullptr) { - ::logger& logger_ = logger_or_root(logger); + ifcopenshell::geom::iterator* construct_iterator(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, int num_threads, ifcopenshell::logger* logger = nullptr) { + ifcopenshell::logger& logger_ = ifcopenshell::logger_or_root(logger); return new ifcopenshell::geom::iterator(ifcopenshell::geom::kernels::construct(file, geometry_library, settings), settings, file, num_threads, logger_); } - ifcopenshell::geom::iterator* construct_iterator_with_include_exclude(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, std::vector elems, bool include, int num_threads, logger* logger = nullptr) { - ::logger& logger_ = logger_or_root(logger); + ifcopenshell::geom::iterator* construct_iterator_with_include_exclude(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, std::vector elems, bool include, int num_threads, ifcopenshell::logger* logger = nullptr) { + ifcopenshell::logger& logger_ = ifcopenshell::logger_or_root(logger); std::set elems_set(elems.begin(), elems.end()); ifcopenshell::geom::entity_filter ef{ include, false, elems_set }; return new ifcopenshell::geom::iterator(ifcopenshell::geom::kernels::construct(file, geometry_library, settings), settings, file, {ef}, num_threads, logger_); } - ifcopenshell::geom::iterator* construct_iterator_with_include_exclude_globalid(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, std::vector elems, bool include, int num_threads, logger* logger = nullptr) { - ::logger& logger_ = logger_or_root(logger); + ifcopenshell::geom::iterator* construct_iterator_with_include_exclude_globalid(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, std::vector elems, bool include, int num_threads, ifcopenshell::logger* logger = nullptr) { + ifcopenshell::logger& logger_ = ifcopenshell::logger_or_root(logger); std::set elems_set(elems.begin(), elems.end()); ifcopenshell::geom::attribute_filter af; af.attribute_name = "GlobalId"; @@ -752,8 +752,8 @@ struct shape_rtti : public boost::static_visitor return new ifcopenshell::geom::iterator(ifcopenshell::geom::kernels::construct(file, geometry_library, settings), settings, file, {af}, num_threads, logger_); } - ifcopenshell::geom::iterator* construct_iterator_with_include_exclude_id(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, std::vector elems, bool include, int num_threads, logger* logger = nullptr) { - ::logger& logger_ = logger_or_root(logger); + ifcopenshell::geom::iterator* construct_iterator_with_include_exclude_id(const std::string& geometry_library, ifcopenshell::geom::settings settings, ifcopenshell::file* file, std::vector elems, bool include, int num_threads, ifcopenshell::logger* logger = nullptr) { + ifcopenshell::logger& logger_ = ifcopenshell::logger_or_root(logger); std::set elems_set(elems.begin(), elems.end()); ifcopenshell::geom::instance_id_filter af(include, false, elems_set); return new ifcopenshell::geom::iterator(ifcopenshell::geom::kernels::construct(file, geometry_library, settings), settings, file, {af}, num_threads, logger_); @@ -1077,12 +1077,12 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf %} %inline %{ - static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const express::base& representation, const char* const geometry_library="opencascade", logger* logger = nullptr) { - return helper_fn_create_shape(logger_or_root(logger), geometry_library, settings, instance, representation); + static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const express::base& representation, const char* const geometry_library="opencascade", ifcopenshell::logger* logger = nullptr) { + return helper_fn_create_shape(ifcopenshell::logger_or_root(logger), geometry_library, settings, instance, representation); } // Manual definition of overload without representation argument - static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const char* const geometry_library="opencascade", logger* logger = nullptr) { + static std::variant create_shape(ifcopenshell::geom::settings& settings, const express::base& instance, const char* const geometry_library="opencascade", ifcopenshell::logger* logger = nullptr) { return create_shape(settings, instance, express::base(), geometry_library, logger); } %} @@ -1342,9 +1342,9 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf } } - std::vector arrange_polygons(svgfill::arrange_polygon_settings settings, const std::vector& polygons, logger* logger = nullptr) { + std::vector arrange_polygons(svgfill::arrange_polygon_settings settings, const std::vector& polygons, ifcopenshell::logger* logger = nullptr) { std::vector r; - if (svgfill::arrange_polygons(settings, polygons, r, logger_or_root(logger))) { + if (svgfill::arrange_polygons(settings, polygons, r, ifcopenshell::logger_or_root(logger))) { return r; } else { throw std::runtime_error("Failed to arrange polygons"); diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index dbb56a0f9c..fc54705371 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -291,8 +291,8 @@ private: return new ifcopenshell::file(ifcopenshell::schema_by_name(schema)); } - static ifcopenshell::file* create_uninitialized(logger* logger=nullptr) { - return new ifcopenshell::file(ifcopenshell::uninitialized_tag{}, logger_or_root(logger)); + static ifcopenshell::file* create_uninitialized(ifcopenshell::logger* logger=nullptr) { + return new ifcopenshell::file(ifcopenshell::uninitialized_tag{}, ifcopenshell::logger_or_root(logger)); } std::vector _get_inverse(const express::base& e) { @@ -991,10 +991,10 @@ from .entity_instance import entity_instance_mixin %newobject stream_from_string; %inline %{ - ifcopenshell::file* open(const std::string& fn, bool readonly=false, logger* logger=nullptr) { + ifcopenshell::file* open(const std::string& fn, bool readonly=false, ifcopenshell::logger* logger=nullptr) { ifcopenshell::file* f; Py_BEGIN_ALLOW_THREADS; - f = new ifcopenshell::file(fn, ifcopenshell::FT_AUTODETECT, readonly, logger_or_root(logger)); + f = new ifcopenshell::file(fn, ifcopenshell::FT_AUTODETECT, readonly, ifcopenshell::logger_or_root(logger)); Py_END_ALLOW_THREADS; return f; } @@ -1152,7 +1152,7 @@ from .entity_instance import entity_instance_mixin static std::stringstream ifcopenshell_log_stream; %} %init %{ - ::logger::root().set_output(0, &ifcopenshell_log_stream); + ifcopenshell::logger::root().set_output(0, &ifcopenshell_log_stream); %} %inline %{ std::string get_log() { @@ -1161,20 +1161,20 @@ from .entity_instance import entity_instance_mixin return log; } void turn_on_detailed_logging() { - ::logger::root().set_output(&std::cout, &std::cout); - ::logger::root().verbosity(::logger::LOG_DEBUG); + ifcopenshell::logger::root().set_output(&std::cout, &std::cout); + ifcopenshell::logger::root().verbosity(ifcopenshell::logger::LOG_DEBUG); } void turn_off_detailed_logging() { - ::logger::root().set_output(0, &ifcopenshell_log_stream); - ::logger::root().verbosity(::logger::LOG_WARNING); + ifcopenshell::logger::root().set_output(0, &ifcopenshell_log_stream); + ifcopenshell::logger::root().verbosity(ifcopenshell::logger::LOG_WARNING); } void set_log_format_json() { ifcopenshell_log_stream.str(""); - ::logger::root().output_format(::logger::FMT_JSON); + ifcopenshell::logger::root().output_format(ifcopenshell::logger::FMT_JSON); } void set_log_format_text() { ifcopenshell_log_stream.str(""); - ::logger::root().output_format(::logger::FMT_PLAIN); + ifcopenshell::logger::root().output_format(ifcopenshell::logger::FMT_PLAIN); } %} diff --git a/src/serializers/ColladaSerializer.cpp b/src/serializers/ColladaSerializer.cpp index c93c68bcc1..f1507ac14f 100644 --- a/src/serializers/ColladaSerializer.cpp +++ b/src/serializers/ColladaSerializer.cpp @@ -453,7 +453,7 @@ std::string collada_serializer::object_id(const ifcopenshell::geom::element* o) : ""; return o->type() + slabSuffix; } - return geometry_serializer::object_id(o); + return ifcopenshell::geom::geometry_serializer::object_id(o); } void collada_serializer::collada_exporter::endDocument() { diff --git a/src/serializers/ColladaSerializer.h b/src/serializers/ColladaSerializer.h index 56101c0844..f707036482 100644 --- a/src/serializers/ColladaSerializer.h +++ b/src/serializers/ColladaSerializer.h @@ -50,7 +50,7 @@ #include -class SERIALIZERS_API collada_serializer : public write_only_geometry_serializer +class SERIALIZERS_API collada_serializer : public ifcopenshell::geom::write_only_geometry_serializer { // TODO The vast amount of implement details of collada_serializer could be hidden to the cpp file. private: @@ -219,8 +219,8 @@ private: std::string unit_name; float unit_magnitude; public: - collada_serializer(const std::string& dae_filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) - : write_only_geometry_serializer(settings, logger) + collada_serializer(const std::string& dae_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) + : ifcopenshell::geom::write_only_geometry_serializer(settings, logger) , exporter("IfcOpenShell", dae_filename, this, settings.get().get() >= 15) { exporter.serializer = this; diff --git a/src/serializers/GltfSerializer.cpp b/src/serializers/GltfSerializer.cpp index cc48ca756e..4f13b8c9b2 100644 --- a/src/serializers/GltfSerializer.cpp +++ b/src/serializers/GltfSerializer.cpp @@ -53,8 +53,8 @@ static const uint32_t PRIM_TRIANGLE_FAN = 6; static const uint32_t ELEMENT_ARRAY_BUFFER = 34963; static const uint32_t ARRAY_BUFFER = 34962; -gltf_serializer::gltf_serializer(const std::string& filename, const ifcopenshell::geom::settings& settings, ::logger* logger) - : write_only_geometry_serializer(settings, logger) +gltf_serializer::gltf_serializer(const std::string& filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger) + : ifcopenshell::geom::write_only_geometry_serializer(settings, logger) , filename_(filename) , tmp_filename1_(filename + ".indices.tmp") , tmp_filename2_(filename + ".vertices.tmp") @@ -523,7 +523,7 @@ namespace { } void proj_log(void* data, int, const char* c) { - auto logger = static_cast<::logger*>(data); + auto logger = static_cast(data); if (logger) { logger->error("SER", 1, "PROJ: " + std::string(c)); } diff --git a/src/serializers/GltfSerializer.h b/src/serializers/GltfSerializer.h index 0807b8d711..5a17e21419 100644 --- a/src/serializers/GltfSerializer.h +++ b/src/serializers/GltfSerializer.h @@ -30,7 +30,7 @@ using json = nlohmann::json; #include -class SERIALIZERS_API gltf_serializer : public write_only_geometry_serializer { +class SERIALIZERS_API gltf_serializer : public ifcopenshell::geom::write_only_geometry_serializer { private: std::string filename_, tmp_filename1_, tmp_filename2_; std::ofstream fstream_, tmp_fstream1_, tmp_fstream2_; @@ -43,7 +43,7 @@ private: int writeMaterial(const ifcopenshell::geom::taxonomy::style::ptr style); public: - gltf_serializer(const std::string& filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr); + gltf_serializer(const std::string& filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr); virtual ~gltf_serializer(); bool ready(); void writeHeader(); diff --git a/src/serializers/IgesSerializer.h b/src/serializers/IgesSerializer.h index 84004e2edc..ab20637e7f 100644 --- a/src/serializers/IgesSerializer.h +++ b/src/serializers/IgesSerializer.h @@ -40,7 +40,7 @@ private: public: /// @note IGESControl_Controller::Init() must be called prior to instantiating iges_serializer. /// See http://tracker.dev.opencascade.org/view.php?id=23679 for more information. - iges_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) + iges_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) : open_cascade_based_serializer(out_filename, settings, logger) {} virtual ~iges_serializer() {} diff --git a/src/serializers/JsonSerializer.h b/src/serializers/JsonSerializer.h index e34fd3a5ba..e07682f970 100644 --- a/src/serializers/JsonSerializer.h +++ b/src/serializers/JsonSerializer.h @@ -11,20 +11,20 @@ #include -class json_serializer : public serializer { +class json_serializer : public ifcopenshell::geom::serializer { public: enum Dialect { JSON_DIALECT_CREOOX }; private: - boost::shared_ptr implementation_; + boost::shared_ptr implementation_; protected: std::string json_filename; Dialect dialect_; public: - json_serializer(ifcopenshell::file* file, const std::string& json_filename, Dialect dialect = Dialect::JSON_DIALECT_CREOOX, ::logger& logger = ::logger::root()) + json_serializer(ifcopenshell::file* file, const std::string& json_filename, Dialect dialect = Dialect::JSON_DIALECT_CREOOX, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : json_filename(json_filename) , dialect_(dialect) { diff --git a/src/serializers/OpenCascadeBasedSerializer.h b/src/serializers/OpenCascadeBasedSerializer.h index cc2dfac2de..c03642e760 100644 --- a/src/serializers/OpenCascadeBasedSerializer.h +++ b/src/serializers/OpenCascadeBasedSerializer.h @@ -29,15 +29,15 @@ #include -class SERIALIZERS_API open_cascade_based_serializer : public write_only_geometry_serializer { +class SERIALIZERS_API open_cascade_based_serializer : public ifcopenshell::geom::write_only_geometry_serializer { open_cascade_based_serializer(const open_cascade_based_serializer&); //N/A open_cascade_based_serializer& operator =(const open_cascade_based_serializer&); //N/A protected: const std::string out_filename; const char* getSymbolForUnitMagnitude(float mag); public: - explicit open_cascade_based_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) - : write_only_geometry_serializer(settings, logger) + explicit open_cascade_based_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) + : ifcopenshell::geom::write_only_geometry_serializer(settings, logger) , out_filename(out_filename) {} virtual ~open_cascade_based_serializer() {} diff --git a/src/serializers/RocksDbSerializer.cpp b/src/serializers/RocksDbSerializer.cpp index f92a6b8e56..5eca4a7320 100644 --- a/src/serializers/RocksDbSerializer.cpp +++ b/src/serializers/RocksDbSerializer.cpp @@ -9,7 +9,7 @@ #include "../ifcparse/logger.h" -RocksDbSerializer::RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector& skip_supertypes, ::logger* logger) +RocksDbSerializer::RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector& skip_supertypes, ifcopenshell::logger* logger) : input_filename_(input_filename) , rocksdb_filename_(rocksdb_filename) , skip_supertypes_(skip_supertypes) @@ -22,7 +22,7 @@ namespace { { auto s = sizeof(size_t); val.resize(s + 2); - val[0] = type_encoder::encode_type(); + val[0] = ifcopenshell::type_encoder::encode_type(); // 1 = entity - stored by id (entity name) // 2 = type - stored by identity (internal counter in class) val[1] = t.index() == 0 ? 'i' : 't'; @@ -40,7 +40,7 @@ namespace { { // no attempt at alignment val.resize(t.size() * (sizeof(size_t) + 1) + 1); - val[0] = type_encoder::encode_type>(); + val[0] = ifcopenshell::type_encoder::encode_type>(); char* ptr = val.data() + 1; for (auto it = t.begin(); it != t.end(); ++it) { *ptr = it->index() == 0 ? 'i' : 't'; @@ -60,7 +60,7 @@ namespace { bool serialize(std::string& val, const std::vector>& t) { std::ostringstream oss; - oss.put(type_encoder::encode_type>>()); + oss.put(ifcopenshell::type_encoder::encode_type>>()); auto write_size = [&oss](size_t sz) { std::string size_str; @@ -160,7 +160,7 @@ void RocksDbSerializer::write_streaming_() { // references simple_type_instances.push_back(t); } - rocks_db_attribute_storage{}.set(&storage, decl, name, i, t); + ifcopenshell::rocks_db_attribute_storage{}.set(&storage, decl, name, i, t); }); } @@ -174,7 +174,7 @@ void RocksDbSerializer::write_streaming_() { (is_header ? decl->name() : std::to_string(p.first.name_)) + "|" + std::to_string(index); - if (storage.db->Get(storage.ropts, key, &tmp) == rocksdb::Status::OK() && tmp.size() == (sizeof(size_t) + 2) && tmp[0] == type_encoder::encode_type() && tmp[1] == 't') + if (storage.db->Get(storage.ropts, key, &tmp) == rocksdb::Status::OK() && tmp.size() == (sizeof(size_t) + 2) && tmp[0] == ifcopenshell::type_encoder::encode_type() && tmp[1] == 't') { size_t iden; memcpy(&iden, tmp.data() + 2, sizeof(size_t)); @@ -259,7 +259,7 @@ void RocksDbSerializer::write_streaming_() { // @todo if statement? // if (val.array_.storage_ptr->size() > 0) { val.apply_visitor([&](const auto& t) { - rocks_db_attribute_storage{}.set(&storage, &inst.declaration(), inst.identity(), 0, t); + ifcopenshell::rocks_db_attribute_storage{}.set(&storage, &inst.declaration(), inst.identity(), 0, t); }); // } @@ -298,7 +298,7 @@ void RocksDbSerializer::write_streaming_() { memcpy(s.data(), &v, sizeof(size_t)); storage.db->Put(storage.wopts, "g|" + (std::string)data->get_attribute_value(0), s); } else { - ::logger::root().error("Instance #" + std::to_string(name) + " has no GlobalId, omitted from guid index"); + ifcopenshell::logger::root().error("Instance #" + std::to_string(name) + " has no GlobalId, omitted from guid index"); } } } diff --git a/src/serializers/RocksDbSerializer.h b/src/serializers/RocksDbSerializer.h index 6c4f0cd921..b8a1bf94d4 100644 --- a/src/serializers/RocksDbSerializer.h +++ b/src/serializers/RocksDbSerializer.h @@ -8,7 +8,7 @@ #include #include -class SERIALIZERS_API RocksDbSerializer : public serializer { +class SERIALIZERS_API RocksDbSerializer : public ifcopenshell::geom::serializer { private: std::string input_filename_; std::string rocksdb_filename_; @@ -16,7 +16,7 @@ private: void write_streaming_(); public: - RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector& skip_supertypes = {}, ::logger* logger = nullptr); + RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector& skip_supertypes = {}, ifcopenshell::logger* logger = nullptr); virtual ~RocksDbSerializer() {} diff --git a/src/serializers/StepSerializer.h b/src/serializers/StepSerializer.h index 3a2e0c9ad7..4e0ad4cc33 100644 --- a/src/serializers/StepSerializer.h +++ b/src/serializers/StepSerializer.h @@ -34,7 +34,7 @@ class step_serializer : public open_cascade_based_serializer private: STEPControl_Writer writer; public: - explicit step_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) + explicit step_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) : open_cascade_based_serializer(out_filename, settings, logger) {} virtual ~step_serializer() {} diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index fbbc3e5b52..0ef6c23084 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -2753,7 +2753,7 @@ std::string svg_serializer::nameElement(express::base storey, const ifcopenshell ifcopenshell::escape_xml(n); return nameElement_({ - {"id", with_section_heights_from_storey_ ? object_id(storey, elem) : geometry_serializer::object_id(elem)}, + {"id", with_section_heights_from_storey_ ? object_id(storey, elem) : ifcopenshell::geom::geometry_serializer::object_id(elem)}, {"class", elem->type()}, {namespace_prefix_ + "name", n}, {namespace_prefix_ + "guid", elem->guid()} diff --git a/src/serializers/SvgSerializer.h b/src/serializers/SvgSerializer.h index 61a656fb9d..26e33cf219 100644 --- a/src/serializers/SvgSerializer.h +++ b/src/serializers/SvgSerializer.h @@ -380,11 +380,11 @@ namespace { // SVG edge classification (issue #3668): see add_classified_edges(). std::list> classified_items_; - ::logger& logger_; + ifcopenshell::logger& logger_; public: - prefiltered_hlr(::logger& logger, bool use_prefiltering, bool use_hlr_poly, bool segment_projection, const gp_Pln& view_direction) + prefiltered_hlr(ifcopenshell::logger& logger, bool use_prefiltering, bool use_hlr_poly, bool segment_projection, const gp_Pln& view_direction) : logger_(logger) , use_prefiltering_(use_prefiltering) , use_hlr_poly_(use_hlr_poly) @@ -554,7 +554,7 @@ namespace { typedef prefiltered_hlr hlr_t; -class SERIALIZERS_API svg_serializer : public write_only_geometry_serializer { +class SERIALIZERS_API svg_serializer : public ifcopenshell::geom::write_only_geometry_serializer { public: typedef std::pair > path_object; typedef std::vector< boost::shared_ptr > float_item_list; @@ -625,8 +625,8 @@ protected: subtract_before_project subtraction_settings_; public: - svg_serializer(const stream_or_filename& out_filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr) - : write_only_geometry_serializer(settings, logger) + svg_serializer(const stream_or_filename& out_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) + : ifcopenshell::geom::write_only_geometry_serializer(settings, logger) , svg_file(out_filename) , xmin(+std::numeric_limits::infinity()) , ymin(+std::numeric_limits::infinity()) @@ -787,9 +787,9 @@ public: std::string idElement(express::base elem); std::string object_id(express::base storey, const ifcopenshell::geom::element* o) { if (storey) { - return idElement(storey) + "-" + geometry_serializer::object_id(o); + return idElement(storey) + "-" + ifcopenshell::geom::geometry_serializer::object_id(o); } else { - return geometry_serializer::object_id(o); + return ifcopenshell::geom::geometry_serializer::object_id(o); } } diff --git a/src/serializers/TtlWktSerializer.cpp b/src/serializers/TtlWktSerializer.cpp index 1f3f4f38b6..c6e6c295e9 100644 --- a/src/serializers/TtlWktSerializer.cpp +++ b/src/serializers/TtlWktSerializer.cpp @@ -233,8 +233,8 @@ namespace { } } -ttl_wkt_serializer::ttl_wkt_serializer(const stream_or_filename& filename, const ifcopenshell::geom::settings& settings, ::logger* logger) - : write_only_geometry_serializer(settings, logger) +ttl_wkt_serializer::ttl_wkt_serializer(const stream_or_filename& filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger) + : ifcopenshell::geom::write_only_geometry_serializer(settings, logger) , filename_(filename) { const auto& tri_setting = settings.get().get(); diff --git a/src/serializers/USDSerializer.cpp b/src/serializers/USDSerializer.cpp index fcb6314238..f331086bc6 100644 --- a/src/serializers/USDSerializer.cpp +++ b/src/serializers/USDSerializer.cpp @@ -36,8 +36,8 @@ #include -usd_serializer::usd_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ::logger* logger): - write_only_geometry_serializer(settings, logger), +usd_serializer::usd_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger): + ifcopenshell::geom::write_only_geometry_serializer(settings, logger), filename_(out_filename) { std::size_t found = filename_.find_last_of("/\\"); diff --git a/src/serializers/USDSerializer.h b/src/serializers/USDSerializer.h index 0415997647..ce61523d40 100644 --- a/src/serializers/USDSerializer.h +++ b/src/serializers/USDSerializer.h @@ -66,7 +66,7 @@ namespace usd_utils { } } -class SERIALIZERS_API usd_serializer : public write_only_geometry_serializer { +class SERIALIZERS_API usd_serializer : public ifcopenshell::geom::write_only_geometry_serializer { private: bool ready_ = false; const std::string filename_; @@ -86,7 +86,7 @@ private: std::set emitted_names_; std::map element_names_; public: - usd_serializer(const std::string&, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr); + usd_serializer(const std::string&, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr); virtual ~usd_serializer(); bool ready() { return ready_; } void writeHeader(); diff --git a/src/serializers/WavefrontObjSerializer.cpp b/src/serializers/WavefrontObjSerializer.cpp index 70d5552dc1..49dae4ba76 100644 --- a/src/serializers/WavefrontObjSerializer.cpp +++ b/src/serializers/WavefrontObjSerializer.cpp @@ -27,8 +27,8 @@ #include #include -wavefront_obj_serializer::wavefront_obj_serializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geom::settings& settings, ::logger* logger) - : write_only_geometry_serializer(settings, logger) +wavefront_obj_serializer::wavefront_obj_serializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger) + : ifcopenshell::geom::write_only_geometry_serializer(settings, logger) , obj_stream(obj_filename) , mtl_stream(mtl_filename) , vcount_total(1) diff --git a/src/serializers/WavefrontObjSerializer.h b/src/serializers/WavefrontObjSerializer.h index cd2ecefa8f..12ae07adaf 100644 --- a/src/serializers/WavefrontObjSerializer.h +++ b/src/serializers/WavefrontObjSerializer.h @@ -28,14 +28,14 @@ #include "../ifcgeom/GeometrySerializer.h" // http://people.sc.fsu.edu/~jburkardt/txt/obj_format.txt -class SERIALIZERS_API wavefront_obj_serializer : public write_only_geometry_serializer { +class SERIALIZERS_API wavefront_obj_serializer : public ifcopenshell::geom::write_only_geometry_serializer { private: stream_or_filename obj_stream; stream_or_filename mtl_stream; size_t vcount_total, ncount_total; std::set materials; public: - wavefront_obj_serializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geom::settings& settings, ::logger* logger = nullptr); + wavefront_obj_serializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr); virtual ~wavefront_obj_serializer() {} bool ready(); void writeHeader(); diff --git a/src/serializers/XmlSerializer.h b/src/serializers/XmlSerializer.h index b09b6211fe..759027e2fd 100644 --- a/src/serializers/XmlSerializer.h +++ b/src/serializers/XmlSerializer.h @@ -11,15 +11,15 @@ #include -class xml_serializer : public serializer { +class xml_serializer : public ifcopenshell::geom::serializer { private: - boost::shared_ptr implementation_; + boost::shared_ptr implementation_; protected: std::string xml_filename; public: - xml_serializer(ifcopenshell::file* file, const std::string& xml_filename, ::logger& logger = ::logger::root()) + xml_serializer(ifcopenshell::file* file, const std::string& xml_filename, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : xml_filename(xml_filename) { if (!file) { diff --git a/src/serializers/document_rdb_plugin.cpp b/src/serializers/document_rdb_plugin.cpp index 67a8f8eea8..f47172f7f4 100644 --- a/src/serializers/document_rdb_plugin.cpp +++ b/src/serializers/document_rdb_plugin.cpp @@ -27,7 +27,7 @@ namespace { -boost::shared_ptr create_serializer(const ifcopenshell::serializers::document_serializer_context& context) { +boost::shared_ptr create_serializer(const ifcopenshell::serializers::document_serializer_context& context) { if (context.input_filename.empty()) { throw ifcopenshell::exception("RocksDB document serializer requires an input filename"); } diff --git a/src/serializers/document_serializer_plugin.cpp b/src/serializers/document_serializer_plugin.cpp index 02e7288e64..b19b4bc19a 100644 --- a/src/serializers/document_serializer_plugin.cpp +++ b/src/serializers/document_serializer_plugin.cpp @@ -125,7 +125,7 @@ const ifcopenshell::serializers::document_serializer_info* ifcopenshell::seriali return entry ? &entry->info_ : nullptr; } -boost::shared_ptr ifcopenshell::serializers::document_serializer_registry::create(const std::string& format, const document_serializer_context& context) const { +boost::shared_ptr ifcopenshell::serializers::document_serializer_registry::create(const std::string& format, const document_serializer_context& context) const { const auto schema_name = !context.schema_name.empty() ? context.schema_name : (context.file ? context.file->schema()->name() : std::string()); auto* registry = const_cast(this); @@ -161,7 +161,7 @@ std::vector ifcopenshell::s try { module = manager.load(path); } catch (const std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); continue; } if (module.meta().kind_ != ifcopenshell::plugin::kind::document_serializer) { @@ -214,7 +214,7 @@ void ifcopenshell::serializers::load_document_serializer_plugins(document_serial try { module = manager.load(path); } catch (const std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); continue; } if (module.meta().kind_ != ifcopenshell::plugin::kind::document_serializer) { @@ -246,7 +246,7 @@ bool ifcopenshell::serializers::load_document_serializer_plugin(document_seriali try { module = manager.load(path); } catch (const std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); continue; } if (module.meta().kind_ != ifcopenshell::plugin::kind::document_serializer || diff --git a/src/serializers/document_serializer_plugin.h b/src/serializers/document_serializer_plugin.h index 49b1730630..d6e630e78a 100644 --- a/src/serializers/document_serializer_plugin.h +++ b/src/serializers/document_serializer_plugin.h @@ -36,6 +36,8 @@ namespace ifcopenshell { namespace serializers { +using ifcopenshell::geom::serializer; + struct SERIALIZERS_API document_serializer_info { std::string format; std::string name; diff --git a/src/serializers/geometry_serializer_plugin.cpp b/src/serializers/geometry_serializer_plugin.cpp index 9cf5711c18..4e118482d0 100644 --- a/src/serializers/geometry_serializer_plugin.cpp +++ b/src/serializers/geometry_serializer_plugin.cpp @@ -130,7 +130,7 @@ void ifcopenshell::serializers::geometry_serializer_registry::configure(const st } } -boost::shared_ptr ifcopenshell::serializers::geometry_serializer_registry::create(const std::string& extension, const geometry_serializer_context& context) const { +boost::shared_ptr ifcopenshell::serializers::geometry_serializer_registry::create(const std::string& extension, const geometry_serializer_context& context) const { const auto key = geometry_serializer_key(extension); if (entries_.find(key) == entries_.end()) { load_geometry_serializer_plugin(const_cast(*this), extension); @@ -159,7 +159,7 @@ std::vector ifcopenshell::s try { module = manager.load(path); } catch (const std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); continue; } if (module.meta().kind_ != ifcopenshell::plugin::kind::geometry_serializer) { @@ -204,7 +204,7 @@ void ifcopenshell::serializers::load_geometry_serializer_plugins(geometry_serial try { module = manager.load(path); } catch (const std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); continue; } if (module.meta().kind_ != ifcopenshell::plugin::kind::geometry_serializer) { @@ -230,7 +230,7 @@ bool ifcopenshell::serializers::load_geometry_serializer_plugin(geometry_seriali try { module = manager.load(path); } catch (const std::exception& e) { - ::logger::root().error(e); + ifcopenshell::logger::root().error(e); continue; } if (module.meta().kind_ != ifcopenshell::plugin::kind::geometry_serializer || diff --git a/src/serializers/geometry_serializer_plugin.h b/src/serializers/geometry_serializer_plugin.h index 49677c20d2..9fc26e3cc8 100644 --- a/src/serializers/geometry_serializer_plugin.h +++ b/src/serializers/geometry_serializer_plugin.h @@ -35,6 +35,8 @@ namespace ifcopenshell { namespace serializers { +using ifcopenshell::geom::geometry_serializer; + struct SERIALIZERS_API geometry_serializer_info { std::string format; std::string name; diff --git a/src/serializers/schema_dependent/JsonSerializer.cpp b/src/serializers/schema_dependent/JsonSerializer.cpp index 11cd4d8c99..6ac93fbbdc 100644 --- a/src/serializers/schema_dependent/JsonSerializer.cpp +++ b/src/serializers/schema_dependent/JsonSerializer.cpp @@ -40,14 +40,14 @@ class format_value_visitor : public boost::static_visitor { template json operator()(const T& t) const { - if constexpr (std::is_same_v, derived> || std::is_same_v, boost::dynamic_bitset<>> || std::is_same_v, express::base> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, empty_aggregate_t> || std::is_same_v, empty_aggregate_of_aggregate_t> || std::is_same_v, blank>) { + if constexpr (std::is_same_v, ifcopenshell::derived> || std::is_same_v, boost::dynamic_bitset<>> || std::is_same_v, express::base> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, ifcopenshell::empty_aggregate_t> || std::is_same_v, ifcopenshell::empty_aggregate_of_aggregate_t> || std::is_same_v, ifcopenshell::blank>) { return ""; } else if constexpr (std::is_same_v, boost::logic::tribool>) { // @todo handle indeterminate return ""; } else if constexpr (std::is_same_v, std::string>) { return t; - } else if constexpr (std::is_same_v, enumeration_reference>) { + } else if constexpr (std::is_same_v, ifcopenshell::enumeration_reference>) { return t.value(); } else { return t; @@ -69,7 +69,7 @@ class get_type_visitor : public boost::static_visitor { // Returns related entity instances using IFC's objectified relationship // model. The second and third argument require a member function pointer. template -auto get_related(::logger& log, T t, F f, G g) { +auto get_related(ifcopenshell::logger& log, T t, F f, G g) { auto li = (t.*f)(); std::vector acc; for (auto& u : li) { @@ -97,7 +97,7 @@ auto get_related(::logger& log, T t, F f, G g) { return acc; } -void format_entity_instance(::logger& log, express::base instance, json& tree, express::base parent = express::base()) { +void format_entity_instance(ifcopenshell::logger& log, express::base instance, json& tree, express::base parent = express::base()) { /* { "id" : string, // Element GUID (IFC GloballyUniqueId) @@ -119,7 +119,7 @@ void format_entity_instance(::logger& log, express::base instance, json& tree, e json child; auto write_to_json = [&](const std::string& keyJson, const std::string& keyIfc) { - attribute_value val; + ifcopenshell::attribute_value val; try { val = instance.as().get(keyIfc); } catch (const ifcopenshell::exception&) { @@ -168,7 +168,7 @@ void format_entity_instance(::logger& log, express::base instance, json& tree, e // A function to be called recursively. Template specialization is used // to descend into decomposition, containment and property relationships. template -void descend(::logger& log, A instance, json& tree, express::base parent = express::base()) { +void descend(ifcopenshell::logger& log, A instance, json& tree, express::base parent = express::base()) { if (instance.declaration().is(IfcSchema::IfcObjectDefinition::Class())) { descend(log, instance.template as(), tree, parent); } else { @@ -181,7 +181,7 @@ void descend(::logger& log, A instance, json& tree, express::base parent = expre // Descends into the tree by recursing into IfcRelContainedInSpatialStructure, // IfcRelDecomposes, IfcRelDefinesByType, IfcRelDefinesByProperties relations. template <> -void descend(::logger& log, IfcSchema::IfcObjectDefinition product, json& tree, express::base parent) { +void descend(ifcopenshell::logger& log, IfcSchema::IfcObjectDefinition product, json& tree, express::base parent) { if (product.declaration().is(IfcSchema::IfcElement::Class())) { auto voids = product.as().FillsVoids(); if (voids.size() == 1 && voids.front().RelatingOpeningElement() != parent) { @@ -267,7 +267,7 @@ void POSTFIX_SCHEMA(json_serializer)::finalize() { auto projects = file->instances_by_type(); if (projects.size() != 1) { - logger().message(::logger::LOG_ERROR, "SER", 7, "Expected a single IfcProject"); + logger().message(ifcopenshell::logger::LOG_ERROR, "SER", 7, "Expected a single IfcProject"); return; } IfcSchema::IfcProject project = projects.front(); diff --git a/src/serializers/schema_dependent/JsonSerializer.h b/src/serializers/schema_dependent/JsonSerializer.h index 1b83699759..c0e54056af 100644 --- a/src/serializers/schema_dependent/JsonSerializer.h +++ b/src/serializers/schema_dependent/JsonSerializer.h @@ -41,7 +41,7 @@ class POSTFIX_SCHEMA(json_serializer) : public json_serializer { ifcopenshell::geom::abstract_mapping* mapping_; public: - POSTFIX_SCHEMA(json_serializer)(ifcopenshell::file* file, const std::string& json_filename, json_serializer::Dialect dialect, ::logger& logger = ::logger::root()) + POSTFIX_SCHEMA(json_serializer)(ifcopenshell::file* file, const std::string& json_filename, json_serializer::Dialect dialect, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : json_serializer(0, "", dialect), mapping_(ifcopenshell::geom::impl::mapping_implementations().construct(file, settings_, logger)) { this->file = file; diff --git a/src/serializers/schema_dependent/XmlSerializer.cpp b/src/serializers/schema_dependent/XmlSerializer.cpp index 61876e10c9..9b7b69f81f 100644 --- a/src/serializers/schema_dependent/XmlSerializer.cpp +++ b/src/serializers/schema_dependent/XmlSerializer.cpp @@ -39,7 +39,7 @@ std::map POSTFIX_SCHEMA(argument_name_map); // Format an IFC attribute and maybe returns as string. Only literal scalar // values are converted. Things like entity instances and lists are omitted. -std::optional format_attribute(ifcopenshell::geom::abstract_mapping* mapping, attribute_value argument, ifcopenshell::argument_type argument_type, const std::string& argument_name) { +std::optional format_attribute(ifcopenshell::geom::abstract_mapping* mapping, ifcopenshell::attribute_value argument, ifcopenshell::argument_type argument_type, const std::string& argument_name) { std::optional value; // Hard-code lat-lon as it represents an array @@ -131,7 +131,7 @@ std::optional format_attribute(ifcopenshell::geom::abstract_mapping } // Appends to a node with possibly existing attributes -ptree* format_entity_instance(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const express::base& instance, ptree& child, ptree& tree, bool as_link = false) { +ptree* format_entity_instance(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const express::base& instance, ptree& child, ptree& tree, bool as_link = false) { const unsigned n = instance.declaration().as_entity()->attribute_count(); for (unsigned i = 0; i < n; ++i) { try { @@ -176,7 +176,7 @@ ptree* format_entity_instance(::logger& log, ifcopenshell::geom::abstract_mappin // Formats an entity instances as a ptree node, and insert into the DOM. Recurses // over the entity attributes and writes them as xml attributes of the node. -ptree* format_entity_instance(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const express::base& instance, ptree& tree, bool as_link = false) { +ptree* format_entity_instance(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const express::base& instance, ptree& tree, bool as_link = false) { ptree child; return format_entity_instance(log, mapping, instance, child, tree, as_link); } @@ -188,7 +188,7 @@ std::string qualify_unrooted_instance(const express::base& inst) { // A function to be called recursively. Template specialization is used // to descend into decomposition, containment and property relationships. template -ptree* descend(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, A instance, ptree& tree, express::base parent = express::base()) { +ptree* descend(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, A instance, ptree& tree, express::base parent = express::base()) { if (instance.declaration().is(IfcSchema::IfcObjectDefinition::Class())) { return descend(log, mapping, instance.template as(), tree, parent); } else { @@ -199,7 +199,7 @@ ptree* descend(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, A i // Returns related entity instances using IFC's objectified relationship // model. The second and third argument require a member function pointer. template -auto get_related(::logger& log, T t, F f, G g) { +auto get_related(ifcopenshell::logger& log, T t, F f, G g) { auto li = (t.*f)(); std::vector acc; for (auto& u : li) { @@ -230,7 +230,7 @@ auto get_related(::logger& log, T t, F f, G g) { // Descends into the tree by recursing into IfcRelContainedInSpatialStructure, // IfcRelDecomposes, IfcRelDefinesByType, IfcRelDefinesByProperties relations. template <> -ptree* descend(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, IfcSchema::IfcObjectDefinition product, ptree& tree, express::base parent) { +ptree* descend(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, IfcSchema::IfcObjectDefinition product, ptree& tree, express::base parent) { if (product.declaration().is(IfcSchema::IfcElement::Class())) { auto voids = product.as().FillsVoids(); if (voids.size() == 1 && voids.front().RelatingOpeningElement() != parent) { @@ -365,7 +365,7 @@ ptree* descend(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, Ifc } // Format IfcProperty instances and insert into the DOM. IfcComplexProperties are flattened out. -void format_properties(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const std::vector& properties, ptree& node) { +void format_properties(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const std::vector& properties, ptree& node) { for (auto& p : properties) { if (auto complex = p.as()) { format_properties(log, mapping, complex.HasProperties(), node); @@ -375,7 +375,7 @@ void format_properties(::logger& log, ifcopenshell::geom::abstract_mapping* mapp } } -void writeGroupToNode(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, IfcSchema::IfcGroup group, ptree& node, std::set notRootGroups) { +void writeGroupToNode(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, IfcSchema::IfcGroup group, ptree& node, std::set notRootGroups) { // @todo tfk: instead of a set shouldn't we just have a set, the current approach // might not work with non-unique or NIL group names. @@ -407,7 +407,7 @@ void writeGroupToNode(::logger& log, ifcopenshell::geom::abstract_mapping* mappi } // Format IfcElementQuantity instances and insert into the DOM. -void format_quantities(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const std::vector& quantities, ptree& node) { +void format_quantities(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, const std::vector& quantities, ptree& node) { for (auto& p : quantities) { ptree* node2 = format_entity_instance(log, mapping, p, node); if (node2 && p.declaration().is(IfcSchema::IfcPhysicalComplexQuantity::Class())) { @@ -417,7 +417,7 @@ void format_quantities(::logger& log, ifcopenshell::geom::abstract_mapping* mapp } // Format IfcTask instances and insert into the DOM. -void format_tasks(::logger& log, ifcopenshell::geom::abstract_mapping* mapping, IfcSchema::IfcTask task, ptree& node) { +void format_tasks(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, IfcSchema::IfcTask task, ptree& node) { ptree* ntask = format_entity_instance(log, mapping, task, node); if (ntask) { @@ -532,7 +532,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { auto projects = file->instances_by_type(); if (projects.size() != 1) { - log.message(::logger::LOG_ERROR, "Expected a single IfcProject"); + log.message(ifcopenshell::logger::LOG_ERROR, "Expected a single IfcProject"); return; } IfcSchema::IfcProject& project = projects.front(); @@ -568,7 +568,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to get ifc file header file_description implementation_level, error: '" << ex.what() << "'"; - log.message(::logger::LOG_ERROR, "SER", 14, ss.str()); + log.message(ifcopenshell::logger::LOG_ERROR, "SER", 14, ss.str()); } try { header.put("file_name.name", file->header().file_name().name()); @@ -576,7 +576,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to get ifc file header file_name name, error: '" << ex.what() << "'"; - log.message(::logger::LOG_ERROR, "SER", 15, ss.str()); + log.message(ifcopenshell::logger::LOG_ERROR, "SER", 15, ss.str()); } try { header.put("file_name.time_stamp", file->header().file_name().time_stamp()); @@ -584,7 +584,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to get ifc file header file_name time_stamp, error: '" << ex.what() << "'"; - log.message(::logger::LOG_ERROR, "SER", 16, ss.str()); + log.message(ifcopenshell::logger::LOG_ERROR, "SER", 16, ss.str()); } try { header.put("file_name.preprocessor_version", file->header().file_name().preprocessor_version()); @@ -592,7 +592,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to get ifc file header file_name preprocessor_version, error: '" << ex.what() << "'"; - log.message(::logger::LOG_ERROR, "SER", 17, ss.str()); + log.message(ifcopenshell::logger::LOG_ERROR, "SER", 17, ss.str()); } try { header.put("file_name.originating_system", file->header().file_name().originating_system()); @@ -600,7 +600,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to get ifc file header file_name originating_system, error: '" << ex.what() << "'"; - log.message(::logger::LOG_ERROR, "SER", 18, ss.str()); + log.message(ifcopenshell::logger::LOG_ERROR, "SER", 18, ss.str()); } try { // @nb inconsistent spelling @@ -609,7 +609,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { catch (const ifcopenshell::exception& ex) { std::stringstream ss; ss << "Failed to get ifc file header file_name authorization, error: '" << ex.what() << "'"; - log.message(::logger::LOG_ERROR, "SER", 19, ss.str()); + log.message(ifcopenshell::logger::LOG_ERROR, "SER", 19, ss.str()); } // Descend into the decomposition structure of the IFC file. diff --git a/src/serializers/schema_dependent/XmlSerializer.h b/src/serializers/schema_dependent/XmlSerializer.h index 7b6add4fc5..22824c2abb 100644 --- a/src/serializers/schema_dependent/XmlSerializer.h +++ b/src/serializers/schema_dependent/XmlSerializer.h @@ -39,7 +39,7 @@ private: ifcopenshell::geom::abstract_mapping* mapping_; public: - POSTFIX_SCHEMA(xml_serializer)(ifcopenshell::file* file, const std::string& xml_filename, ::logger& logger = ::logger::root()) + POSTFIX_SCHEMA(xml_serializer)(ifcopenshell::file* file, const std::string& xml_filename, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : xml_serializer(0, "") , mapping_(ifcopenshell::geom::impl::mapping_implementations().construct(file, settings_, logger)) { diff --git a/src/serializers/schema_dependent/json_plugin.cpp b/src/serializers/schema_dependent/json_plugin.cpp index ba4180cea9..cc1d4bab9c 100644 --- a/src/serializers/schema_dependent/json_plugin.cpp +++ b/src/serializers/schema_dependent/json_plugin.cpp @@ -29,7 +29,7 @@ namespace { -boost::shared_ptr create_serializer(const ifcopenshell::serializers::document_serializer_context& context) { +boost::shared_ptr create_serializer(const ifcopenshell::serializers::document_serializer_context& context) { return boost::make_shared( context.file, context.output_filename, diff --git a/src/serializers/schema_dependent/xml_plugin.cpp b/src/serializers/schema_dependent/xml_plugin.cpp index 9d8631c67f..6a7ad68687 100644 --- a/src/serializers/schema_dependent/xml_plugin.cpp +++ b/src/serializers/schema_dependent/xml_plugin.cpp @@ -27,7 +27,7 @@ namespace { -boost::shared_ptr create_serializer(const ifcopenshell::serializers::document_serializer_context& context) { +boost::shared_ptr create_serializer(const ifcopenshell::serializers::document_serializer_context& context) { return boost::make_shared(context.file, context.output_filename); } diff --git a/src/svgfill/src/arrange_polygons.cpp b/src/svgfill/src/arrange_polygons.cpp index 4281571f26..8eb0461841 100644 --- a/src/svgfill/src/arrange_polygons.cpp +++ b/src/svgfill/src/arrange_polygons.cpp @@ -1606,7 +1606,7 @@ std::map> snap_points_to_box_axes( const CenterLineGraphData& graph, const std::vector& boxes, const K::FT& max_projection_distance, - logger& logger) { + ifcopenshell::logger& logger) { std::vector snapped_points(graph.points.size()); for (size_t i = 0; i < graph.points.size(); ++i) { @@ -1693,7 +1693,7 @@ std::map> snap_points_to_box_axes( message << "Snapping distance exceeds maximum distance: " << std::sqrt(CGAL::to_double((snapped_points[i] - best.projection).squared_length())) << " > " << max_projection_distance; - logger.message(::logger::LOG_WARNING, "ARR", 1, message.str()); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 1, message.str()); } } @@ -1720,7 +1720,7 @@ Graph2D join_segment_runs( const std::map>& line_graph, const std::map>& midpoint_to_segment, const K::FT& max_projection_distance, - logger& logger) { + ifcopenshell::logger& logger) { auto graph = make_center_line_graph_data(line_graph, midpoint_to_segment); auto runs = runs_from_graph(graph); runs.erase(std::remove_if(runs.begin(), runs.end(), [](const LineRun& run) { @@ -2250,7 +2250,7 @@ extend_end_vertices_based_on_input_simple( const Polygon_list& outer_perimiter, const K::FT& max_projection_distance, int pass, - logger& logger) + ifcopenshell::logger& logger) { auto max_intersection_distance = max_projection_distance / 4; @@ -2400,9 +2400,9 @@ extend_end_vertices_based_on_input_simple( } } if (within_any_perimeter) { - logger.message(::logger::LOG_WARNING, "ARR", 2, "Within boundary but no projection or intersection solution was found"); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 2, "Within boundary but no projection or intersection solution was found"); } else { - logger.message(::logger::LOG_WARNING, "ARR", 3, "Point is outside all boundaries"); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 3, "Point is outside all boundaries"); } return std::optional{}; }; @@ -2417,7 +2417,7 @@ extend_end_vertices_based_on_input_simple( if (*result == M) { std::ostringstream message; message << "Point is already on perimeter (" << M.x() << " " << M.y() << ")"; - logger.message(::logger::LOG_NOTICE, "ARR", 4, message.str()); + logger.message(ifcopenshell::logger::LOG_NOTICE, "ARR", 4, message.str()); continue; } auto d = (M - *result).squared_length(); @@ -2426,7 +2426,7 @@ extend_end_vertices_based_on_input_simple( std::ostringstream message; message << "Unable to find projection or intersection point for interior boundary pass " << pass << " [round 1] (" << M.x() << " " << M.y() << ")"; - logger.message(::logger::LOG_WARNING, "ARR", 5, message.str()); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 5, message.str()); } } } @@ -2442,7 +2442,7 @@ extend_end_vertices_based_on_input_simple( auto d = CGAL::squared_distance(point, *result); std::ostringstream message; message << "Projection or intersection distance: " << std::sqrt(CGAL::to_double(d)); - logger.message(::logger::LOG_DEBUG, "ARR", 6, message.str()); + logger.message(ifcopenshell::logger::LOG_DEBUG, "ARR", 6, message.str()); validation_segments.emplace_back(to_3d(point), to_3d(*result)); auto inserted_it = std::prev(validation_segments.end()); validation_tree.insert(inserted_it, validation_segments.end()); @@ -2450,7 +2450,7 @@ extend_end_vertices_based_on_input_simple( std::ostringstream message; message << "Unable to find projection or intersection point for interior boundary pass " << pass << " [round 2] (" << point.x() << " " << point.y() << ")"; - logger.message(::logger::LOG_WARNING, "ARR", 7, message.str()); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 7, message.str()); } } @@ -2549,7 +2549,7 @@ class Segment_2_less { } }; -std::vector arrangement_cell_iou(DebugWriter& debug_output, Arrangement_2& left, Arrangement_2& right, logger& logger) { +std::vector arrangement_cell_iou(DebugWriter& debug_output, Arrangement_2& left, Arrangement_2& right, ifcopenshell::logger& logger) { using Walk_pl = CGAL::Arr_walk_along_line_point_location; Walk_pl walk_pl(right); @@ -2631,7 +2631,7 @@ std::vector arrangement_cell_iou(DebugWriter& debug_output, Arrangement_2 if (visited_faces_on_right.count(*v) > 0) { // Maybe we should be more permissive, try some other points etc. return_values.push_back(0); - logger.message(::logger::LOG_WARNING, "ARR", 8, "Already visited face on right; skipping point"); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 8, "Already visited face on right; skipping point"); } else { // convert arr facet to polygon with holes auto polygon_exterior = circ_to_poly((*v)->outer_ccb()); @@ -2669,7 +2669,7 @@ std::vector arrangement_cell_iou(DebugWriter& debug_output, Arrangement_2 max_deviation_poly_pair = {pwh.outer_boundary(), pwh_right.outer_boundary()}; } } else { - logger.message(::logger::LOG_WARNING, "ARR", 9, "No intersection; skipping point"); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 9, "No intersection; skipping point"); return_values.push_back(0); } } @@ -2691,7 +2691,7 @@ std::vector arrangement_cell_iou(DebugWriter& debug_output, Arrangement_2 return return_values; } -void clean_noisy_paths(DebugWriter& debug_output, Arrangement_2& arr, SegmentLookup& segment_lookup, double& threshold, logger& logger) { +void clean_noisy_paths(DebugWriter& debug_output, Arrangement_2& arr, SegmentLookup& segment_lookup, double& threshold, ifcopenshell::logger& logger) { using SK = CGAL::Simple_cartesian; CGAL::Cartesian_converter C{}; @@ -2907,7 +2907,7 @@ void clean_noisy_paths(DebugWriter& debug_output, Arrangement_2& arr, SegmentLoo } } if (!removed) { - logger.message(::logger::LOG_WARNING, "ARR", 10, "Unable to locate edge for removal; skipping"); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 10, "Unable to locate edge for removal; skipping"); } } @@ -3328,7 +3328,7 @@ class timer { entry( std::map::const_iterator start_it, - logger& logger) + ifcopenshell::logger& logger) : start_it(start_it) , logger_(&logger) {} @@ -3338,16 +3338,16 @@ class timer { auto duration = std::chrono::duration(end - start_it.value()->second).count(); std::ostringstream message; message << "Timing for " << start_it.value()->first << ": " << duration << " ms"; - logger_->message(::logger::LOG_PERF, "ARR", 11, message.str()); + logger_->message(ifcopenshell::logger::LOG_PERF, "ARR", 11, message.str()); } } private: std::optional::const_iterator> start_it; - logger* logger_; + ifcopenshell::logger* logger_; }; - timer(logger& logger, bool enabled = true) + timer(ifcopenshell::logger& logger, bool enabled = true) : logger_(logger) , enabled_(enabled) {} @@ -3365,7 +3365,7 @@ class timer { std::chrono::high_resolution_clock::time_point> timings_; - logger& logger_; + ifcopenshell::logger& logger_; bool enabled_; }; @@ -3385,7 +3385,7 @@ void arrange_cgal_polygons( svgfill::arrange_polygon_settings settings, const std::vector& input_polygons_, std::vector& output_polygons, - logger& logger, + ifcopenshell::logger& logger, double polygon_offset_distance = -1.) { static const double OVERLAP_RESOLUTION_DISTANCE = 1.e-1; @@ -3613,7 +3613,7 @@ void arrange_cgal_polygons( for (int i = 0; i < 2; ++i) { auto it = line_graph.find(e.first); if (it == line_graph.end()) { - logger.message(::logger::LOG_WARNING, "ARR", 12, "Unable to locate vertex for elimination; skipping"); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 12, "Unable to locate vertex for elimination; skipping"); continue; } auto& neighbours = it->second; @@ -3717,7 +3717,7 @@ void arrange_cgal_polygons( std::ostringstream message; message << "Significant difference between cleaned and original arrangement; using original for topology reconstruction: " << *it; - logger.message(::logger::LOG_WARNING, "ARR", 13, message.str()); + logger.message(ifcopenshell::logger::LOG_WARNING, "ARR", 13, message.str()); fallback_to_line_cleaning_algo_1 = true; apply_line_cleaning_algo_1(); } else { @@ -3815,7 +3815,7 @@ bool svgfill::arrange_polygons( arrange_polygon_settings settings, const std::vector& polygons, std::vector& arranged, - logger& logger) { + ifcopenshell::logger& logger) { std::vector cgal_polygons, cgal_polygons_out; std::transform(polygons.begin(), polygons.end(), std::back_inserter(cgal_polygons), [](auto& poly) { Polygon_2 result; @@ -3856,7 +3856,7 @@ int main(int argc, char** argv) { std::vector input_polygons, output; logger logger; logger.set_output(&std::cout, &std::cerr); - logger.verbosity(::logger::LOG_PERF); + logger.verbosity(ifcopenshell::logger::LOG_PERF); if (argc == 2) { using json = nlohmann::json; @@ -3865,7 +3865,7 @@ int main(int argc, char** argv) { file >> jsonData; size_t i = 0; for (const auto& item : jsonData.items()) { - logger.message(::logger::LOG_NOTICE, "ARR", 14, "Processing arrangement " + std::to_string(i)); + logger.message(ifcopenshell::logger::LOG_NOTICE, "ARR", 14, "Processing arrangement " + std::to_string(i)); i++; input_polygons.clear(); const auto& polygonsData = item.value(); diff --git a/src/svgfill/src/linework_processing_facade.cpp b/src/svgfill/src/linework_processing_facade.cpp index 6db12aa3ab..cfc9ae0274 100644 --- a/src/svgfill/src/linework_processing_facade.cpp +++ b/src/svgfill/src/linework_processing_facade.cpp @@ -137,7 +137,7 @@ bool svgfill::arrange_polygons( arrange_polygon_settings settings, const std::vector& polygons, std::vector& arranged, - logger& logger) + ifcopenshell::logger& logger) { return provider().api.arrange_polygons(settings, polygons, arranged, logger); } diff --git a/src/svgfill/src/linework_processing_plugin.h b/src/svgfill/src/linework_processing_plugin.h index 96a0571c0f..04c1a4c464 100644 --- a/src/svgfill/src/linework_processing_plugin.h +++ b/src/svgfill/src/linework_processing_plugin.h @@ -56,7 +56,7 @@ struct api { const std::string&, const std::optional&, std::vector&) = nullptr; - bool (*arrange_polygons)(arrange_polygon_settings, const std::vector&, std::vector&, logger&) = nullptr; + bool (*arrange_polygons)(arrange_polygon_settings, const std::vector&, std::vector&, ifcopenshell::logger&) = nullptr; abstract_arrangement* (*create_arrangement)(solver) = nullptr; void (*destroy_arrangement)(abstract_arrangement*) = nullptr; }; diff --git a/src/svgfill/src/svgfill.h b/src/svgfill/src/svgfill.h index 3b5e851bc6..ac2b294c9d 100644 --- a/src/svgfill/src/svgfill.h +++ b/src/svgfill/src/svgfill.h @@ -41,7 +41,7 @@ #include #include -class logger; +namespace ifcopenshell { class logger; } namespace svgfill { typedef std::array point_2; @@ -134,7 +134,7 @@ namespace svgfill { double subdivision_factor = 16.; }; - SVGFILL_API bool arrange_polygons(arrange_polygon_settings settings, const std::vector& polygons, std::vector& arranged, logger& logger); + SVGFILL_API bool arrange_polygons(arrange_polygon_settings settings, const std::vector& polygons, std::vector& arranged, ifcopenshell::logger& logger); } #endif