mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 16:22:53 +00:00
After-merge clean-ups
This commit is contained in:
@@ -99,7 +99,5 @@ install(FILES ${SERIALIZERS_H_FILES}
|
||||
install(FILES ${SERIALIZERS_S_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/serializers/schema_dependent
|
||||
)
|
||||
install(TARGETS Serializers EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
set(document_serializer_libraries ${document_serializer_libraries} PARENT_SCOPE)
|
||||
set(geometry_serializer_libraries ${geometry_serializer_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -219,7 +219,7 @@ private:
|
||||
std::string unit_name;
|
||||
float unit_magnitude;
|
||||
public:
|
||||
ColladaSerializer(const std::string& dae_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root())
|
||||
ColladaSerializer(const std::string& dae_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root())
|
||||
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
|
||||
, exporter("IfcOpenShell", dae_filename, this, settings.get<ifcopenshell::geometry::settings::FloatingPointDigits>().get() >= 15)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ static const uint32_t PRIM_TRIANGLE_FAN = 6;
|
||||
static const uint32_t ELEMENT_ARRAY_BUFFER = 34963;
|
||||
static const uint32_t ARRAY_BUFFER = 34962;
|
||||
|
||||
GltfSerializer::GltfSerializer(const std::string& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger)
|
||||
GltfSerializer::GltfSerializer(const std::string& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger)
|
||||
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
|
||||
, filename_(filename)
|
||||
, tmp_filename1_(filename + ".indices.tmp")
|
||||
@@ -523,9 +523,9 @@ namespace {
|
||||
}
|
||||
|
||||
void proj_log(void* data, int, const char* c) {
|
||||
auto logger = static_cast<Logger*>(data);
|
||||
auto logger = static_cast<::logger*>(data);
|
||||
if (logger) {
|
||||
logger->Error("SER", 1, "PROJ: " + std::string(c));
|
||||
logger->error("SER", 1, "PROJ: " + std::string(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -655,7 +655,7 @@ void GltfSerializer::setFile(ifcopenshell::file* f) {
|
||||
NULL);
|
||||
|
||||
if (!P) {
|
||||
logger_.Error("SER", 2, "Failed to create PROJ transformation object");
|
||||
logger_.error("SER", 2, "Failed to create PROJ transformation object");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ void GltfSerializer::setFile(ifcopenshell::file* f) {
|
||||
|
||||
wgs84_point = proj_trans(P, PJ_FWD, a);
|
||||
|
||||
logger_.Notice("SER", 3, "Calculated latitude: " + std::to_string(wgs84_point.lp.lam) + " longitude: " + std::to_string(wgs84_point.lp.phi));
|
||||
logger_.notice("SER", 3, "Calculated latitude: " + std::to_string(wgs84_point.lp.lam) + " longitude: " + std::to_string(wgs84_point.lp.phi));
|
||||
}
|
||||
|
||||
std::swap(wgs84_point.lp.phi, wgs84_point.lp.lam);
|
||||
@@ -692,7 +692,7 @@ void GltfSerializer::setFile(ifcopenshell::file* f) {
|
||||
PJ *ellipsoid_crs = proj_create(C, ellipsoid_def);
|
||||
|
||||
if (!ellipsoid_crs) {
|
||||
logger_.Error("SER", 4, "Failed to create ellipsoid CRS");
|
||||
logger_.error("SER", 4, "Failed to create ellipsoid CRS");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
|
||||
int writeMaterial(const ifcopenshell::geometry::taxonomy::style::ptr style);
|
||||
public:
|
||||
GltfSerializer(const std::string& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root());
|
||||
GltfSerializer(const std::string& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root());
|
||||
virtual ~GltfSerializer();
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
public:
|
||||
/// @note IGESControl_Controller::Init() must be called prior to instantiating IgesSerializer.
|
||||
/// See http://tracker.dev.opencascade.org/view.php?id=23679 for more information.
|
||||
IgesSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root())
|
||||
IgesSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root())
|
||||
: OpenCascadeBasedSerializer(out_filename, geometry_settings, settings, logger)
|
||||
{}
|
||||
virtual ~IgesSerializer() {}
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
const char* symbol = getSymbolForUnitMagnitude(magnitude);
|
||||
if (symbol) {
|
||||
#ifdef HAVE_CONFIG_H
|
||||
logger_.Warning("SER", 5, "Setting IGES units not supported on OCE");
|
||||
logger_.warning("SER", 5, "Setting IGES units not supported on OCE");
|
||||
#else
|
||||
Interface_Static::SetCVal("xstep.cascade.unit", symbol);
|
||||
Interface_Static::SetCVal("write.iges.unit", symbol);
|
||||
|
||||
@@ -24,7 +24,7 @@ class JsonSerializer : public Serializer {
|
||||
Dialect dialect_;
|
||||
|
||||
public:
|
||||
JsonSerializer(ifcopenshell::file* file, const std::string& json_filename, Dialect dialect = Dialect::JSON_DIALECT_CREOOX, Logger& logger = Logger::Root())
|
||||
JsonSerializer(ifcopenshell::file* file, const std::string& json_filename, Dialect dialect = Dialect::JSON_DIALECT_CREOOX, ::logger& logger = ::logger::root())
|
||||
: json_filename(json_filename)
|
||||
, dialect_(dialect)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ protected:
|
||||
const std::string out_filename;
|
||||
const char* getSymbolForUnitMagnitude(float mag);
|
||||
public:
|
||||
explicit OpenCascadeBasedSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root())
|
||||
explicit OpenCascadeBasedSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root())
|
||||
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
|
||||
, out_filename(out_filename)
|
||||
{}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "../ifcparse/logger.h"
|
||||
|
||||
RocksDbSerializer::RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector<std::string>& skip_supertypes, Logger& logger)
|
||||
RocksDbSerializer::RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector<std::string>& skip_supertypes, ::logger& logger)
|
||||
: input_filename_(input_filename)
|
||||
, rocksdb_filename_(rocksdb_filename)
|
||||
, skip_supertypes_(skip_supertypes)
|
||||
|
||||
@@ -16,7 +16,7 @@ private:
|
||||
|
||||
void write_streaming_();
|
||||
public:
|
||||
RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector<std::string>& skip_supertypes = {}, Logger& logger = Logger::Root());
|
||||
RocksDbSerializer(const std::string& input_filename, const std::string& rocksdb_filename, const std::vector<std::string>& skip_supertypes = {}, ::logger& logger = ::logger::root());
|
||||
|
||||
virtual ~RocksDbSerializer() {}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class StepSerializer : public OpenCascadeBasedSerializer
|
||||
private:
|
||||
STEPControl_Writer writer;
|
||||
public:
|
||||
explicit StepSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& serializer_settings, Logger& logger = Logger::Root())
|
||||
explicit StepSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& serializer_settings, ::logger& logger = ::logger::root())
|
||||
: OpenCascadeBasedSerializer(out_filename, geometry_settings, serializer_settings, logger)
|
||||
{}
|
||||
virtual ~StepSerializer() {}
|
||||
|
||||
@@ -288,13 +288,13 @@ void SvgSerializer::write(path_object& p, const TopoDS_Shape& comp_or_wire, std:
|
||||
BRep_Tool::CurveOnSurface(edge, curve2d, surf, loc, u1, u2);
|
||||
|
||||
if (curve2d.IsNull()) {
|
||||
logger_.Error("SER", 20, "Failed to obtain 2d and 3d curve from edge");
|
||||
logger().error("SER", 20, "Failed to obtain 2d and 3d curve from edge");
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Standard_Type) sty = surf->DynamicType();
|
||||
if (sty != STANDARD_TYPE(Geom_Plane)) {
|
||||
logger_.Error("SER", 21, "Non-planar p-curves are not supported by this serializer");
|
||||
logger().error("SER", 21, "Non-planar p-curves are not supported by this serializer");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ void SvgSerializer::write(path_object& p, const TopoDS_Shape& comp_or_wire, std:
|
||||
std::stringstream ss;
|
||||
ss << "Skipping full circle/ellipse inside aggregated <path> (id "
|
||||
<< p.first << ")";
|
||||
logger_.Warning("SER", 22, ss.str());
|
||||
logger().warning("SER", 22, ss.str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,7 +798,7 @@ void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) {
|
||||
BRepBndLib::AddOBB(compound_unmirrored, *view_box_3d_, false, false, false);
|
||||
#endif
|
||||
} else {
|
||||
logger_.Error("SER", 23, "Failed to box or edge from drawing annotation");
|
||||
logger().error("SER", 23, "Failed to box or edge from drawing annotation");
|
||||
}
|
||||
|
||||
std::vector<string_property> props;
|
||||
@@ -945,7 +945,7 @@ void SvgSerializer::write(const geometry_data& data) {
|
||||
if (data.storey) {
|
||||
section_heights_storage.push_back(horizontal_plan{ data.storey, data.storey_elevation, +1. });
|
||||
} else {
|
||||
logger_.Warning("SER", 24, "No global section height and unable to determine building storey for:", data.product);
|
||||
logger().warning("SER", 24, "No global section height and unable to determine building storey for:", data.product);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -960,7 +960,7 @@ void SvgSerializer::write(const geometry_data& data) {
|
||||
Bnd_OBB obb;
|
||||
BRepBndLib::AddOBB(compound_unmirrored, obb, false, false, false);
|
||||
if (view_box_3d_->IsOut(obb)) {
|
||||
logger_.Notice("SER", 25, "Not including element due to viewBox", data.product);
|
||||
logger().notice("SER", 25, "Not including element due to viewBox", data.product);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1007,7 +1007,7 @@ void SvgSerializer::write(const geometry_data& data) {
|
||||
}
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
logger_.Error("SER", 26, e);
|
||||
logger().error("SER", 26, e);
|
||||
}
|
||||
|
||||
if (operation_type && ((*operation_type == "SINGLE_SWING_LEFT") || (*operation_type == "SINGLE_SWING_RIGHT"))) {
|
||||
@@ -1260,7 +1260,7 @@ void SvgSerializer::write(const geometry_data& data) {
|
||||
|
||||
compound_to_hlr = &subtracted_shape;
|
||||
} catch (...) {
|
||||
logger_.Error("SER", 27, "Failed to cut element for HLR", data.product);
|
||||
logger().error("SER", 27, "Failed to cut element for HLR", data.product);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1352,11 +1352,11 @@ void SvgSerializer::write(const geometry_data& data) {
|
||||
if (storey) {
|
||||
auto it = storey_hlr.find(storey);
|
||||
if (it == storey_hlr.end()) {
|
||||
it = storey_hlr.insert({ storey, hlr_t(logger_, use_prefiltering_, use_hlr_poly_, segment_projection_, projection_plane) }).first;
|
||||
it = storey_hlr.insert({ storey, hlr_t(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, projection_plane) }).first;
|
||||
}
|
||||
it->second.add(*compound_to_hlr, data.product);
|
||||
} else {
|
||||
logger_.Warning("SER", 28, "Unable to invoke HLR due to absence of storey containment", data.product);
|
||||
logger().warning("SER", 28, "Unable to invoke HLR due to absence of storey containment", data.product);
|
||||
}
|
||||
} else if (hlr) {
|
||||
hlr->add(*compound_to_hlr, data.product);
|
||||
@@ -1834,7 +1834,7 @@ void SvgSerializer::write(const geometry_data& data) {
|
||||
}
|
||||
|
||||
if (!emitted) {
|
||||
logger_.Warning("SER", 29, "Element not written to SVG due to section heights", data.product);
|
||||
logger().warning("SER", 29, "Element not written to SVG due to section heights", data.product);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2014,7 +2014,7 @@ void SvgSerializer::addTextAnnotations(const drawing_key& k) {
|
||||
auto desc = (std::string) ds;
|
||||
|
||||
if (object_type == "Text") {
|
||||
auto mapping = ifcopenshell::geometry::impl::mapping_implementations().construct(file, geometry_settings_, logger_);
|
||||
auto mapping = ifcopenshell::geometry::impl::mapping_implementations().construct(file, geometry_settings_, logger());
|
||||
auto item = mapping->map(pl);
|
||||
auto matrix = ifcopenshell::geometry::taxonomy::cast<ifcopenshell::geometry::taxonomy::matrix4>(item);
|
||||
delete mapping;
|
||||
@@ -2217,7 +2217,7 @@ void SvgSerializer::finalize() {
|
||||
|
||||
// @todo do we have always have pln here?
|
||||
if (use_hlr && pln) {
|
||||
hlr = new hlr_t(logger_, use_prefiltering_, use_hlr_poly_, segment_projection_, *pln);
|
||||
hlr = new hlr_t(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, *pln);
|
||||
}
|
||||
|
||||
section_data_ = std::vector<section_data>{ sd };
|
||||
@@ -2479,7 +2479,7 @@ void SvgSerializer::setFile(ifcopenshell::file* f) {
|
||||
|
||||
auto storeys = f->instances_by_type("IfcBuildingStorey");
|
||||
if (storeys.empty()) {
|
||||
auto mapping = ifcopenshell::geometry::impl::mapping_implementations().construct(file, geometry_settings_, logger_);
|
||||
auto mapping = ifcopenshell::geometry::impl::mapping_implementations().construct(file, geometry_settings_, logger());
|
||||
|
||||
std::vector<const ifcopenshell::declaration*> to_derive_from;
|
||||
to_derive_from.push_back(f->schema()->declaration_by_name("IfcBuilding"));
|
||||
@@ -2498,9 +2498,9 @@ void SvgSerializer::setFile(ifcopenshell::file* f) {
|
||||
#ifdef TAXONOMY_USE_NAKED_PTR
|
||||
delete matrix;
|
||||
#endif
|
||||
logger_.Warning("SER", 30, "No building storeys encountered, used for reference:", product);
|
||||
return;
|
||||
}
|
||||
delete mapping;
|
||||
logger().warning("SER", 30, "No building storeys encountered, used for reference:", product);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2508,7 +2508,7 @@ void SvgSerializer::setFile(ifcopenshell::file* f) {
|
||||
|
||||
delete mapping;
|
||||
|
||||
logger_.Warning("SER", 31, "No building storeys encountered, output might be invalid or missing");
|
||||
logger().warning("SER", 31, "No building storeys encountered, output might be invalid or missing");
|
||||
}
|
||||
|
||||
apply_section_heights_from_storeys();
|
||||
@@ -2521,7 +2521,7 @@ void SvgSerializer::setSectionHeight(double h, express::Base storey) {
|
||||
|
||||
void SvgSerializer::setSectionHeightsFromStoreys(double offset) {
|
||||
if (!file) {
|
||||
logger_.Error("SER", 32, "No file specified");
|
||||
logger().error("SER", 32, "No file specified");
|
||||
return;
|
||||
}
|
||||
with_section_heights_from_storey_ = true;
|
||||
@@ -2536,7 +2536,7 @@ void SvgSerializer::setSectionHeightsFromStoreys(double offset) {
|
||||
try {
|
||||
elev = attr_value;
|
||||
} catch (std::exception& e) {
|
||||
logger_.Error("SER", 33, e);
|
||||
logger().error("SER", 33, e);
|
||||
continue;
|
||||
}
|
||||
if (!section_data_->empty()) {
|
||||
|
||||
@@ -368,11 +368,11 @@ namespace {
|
||||
std::multimap<double, face_info> large_ortho_faces_;
|
||||
std::list<std::pair<express::Base, TopoDS_Shape>> items_;
|
||||
|
||||
Logger& logger_;
|
||||
::logger& logger_;
|
||||
|
||||
public:
|
||||
|
||||
prefiltered_hlr(Logger& logger, bool use_prefiltering, bool use_hlr_poly, bool segment_projection, const gp_Pln& view_direction)
|
||||
prefiltered_hlr(::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)
|
||||
@@ -471,7 +471,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
logger_.Notice("SER", 34, "Included " + std::to_string(n_faces_included) + " faces out of " + std::to_string(n_total) + " after prefiltering");
|
||||
logger_.notice("SER", 34, "Included " + std::to_string(n_faces_included) + " faces out of " + std::to_string(n_total) + " after prefiltering");
|
||||
|
||||
auto it = items_.insert(items_.end(), { product, C });
|
||||
|
||||
@@ -520,7 +520,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
if (use_prefiltering_) {
|
||||
logger_.Notice("SER", 35, "Included " + std::to_string(n_included) + " elements out of " + std::to_string(items_.size()) + " after prefiltering");
|
||||
logger_.notice("SER", 35, "Included " + std::to_string(n_included) + " elements out of " + std::to_string(items_.size()) + " after prefiltering");
|
||||
}
|
||||
|
||||
hlr_calc vis(projector_);
|
||||
@@ -597,7 +597,7 @@ protected:
|
||||
subtract_before_project subtraction_settings_;
|
||||
|
||||
public:
|
||||
SvgSerializer(const stream_or_filename& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root())
|
||||
SvgSerializer(const stream_or_filename& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root())
|
||||
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
|
||||
, svg_file(out_filename)
|
||||
, xmin(+std::numeric_limits<double>::infinity())
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
TtlWktSerializer::TtlWktSerializer(const stream_or_filename& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger)
|
||||
TtlWktSerializer::TtlWktSerializer(const stream_or_filename& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger)
|
||||
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
|
||||
, filename_(filename)
|
||||
{
|
||||
@@ -488,11 +488,11 @@ void TtlWktSerializer::write(const IfcGeom::BRepElement* brep_obj) {
|
||||
if ((polygons_by_area.rbegin()->first > (0.6 * rectangle_area)) || (height < (1. + 1.e-5))) {
|
||||
// Found sufficiently large polygon
|
||||
if (emitted_warning) {
|
||||
logger_.Warning("SER", 36, "Found larger polygon area (" + std::to_string(polygons_by_area.rbegin()->first) + ").");
|
||||
logger().warning("SER", 36, "Found larger polygon area (" + std::to_string(polygons_by_area.rbegin()->first) + ").");
|
||||
}
|
||||
break;
|
||||
} else if (!emitted_warning) {
|
||||
logger_.Warning("SER", 37, "Section polygon area is small compared to bounding box area (" + std::to_string(polygons_by_area.rbegin()->first) + " < " + std::to_string(0.6 * rectangle_area) + "). Trying again with different section height.");
|
||||
logger().warning("SER", 37, "Section polygon area is small compared to bounding box area (" + std::to_string(polygons_by_area.rbegin()->first) + " < " + std::to_string(0.6 * rectangle_area) + "). Trying again with different section height.");
|
||||
emitted_warning = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class SERIALIZERS_API TtlWktSerializer : public WriteOnlyGeometrySerializer {
|
||||
private:
|
||||
stream_or_filename filename_;
|
||||
public:
|
||||
TtlWktSerializer(const stream_or_filename& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root());
|
||||
TtlWktSerializer(const stream_or_filename& filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root());
|
||||
virtual ~TtlWktSerializer() {}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
USDSerializer::USDSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger):
|
||||
USDSerializer::USDSerializer(const std::string& out_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger):
|
||||
WriteOnlyGeometrySerializer(geometry_settings, settings, logger),
|
||||
filename_(out_filename)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
std::set<std::string> emitted_names_;
|
||||
std::map<int, std::string> element_names_;
|
||||
public:
|
||||
USDSerializer(const std::string&, const ifcopenshell::geometry::Settings&, const ifcopenshell::geometry::SerializerSettings&, Logger& logger = Logger::Root());
|
||||
USDSerializer(const std::string&, const ifcopenshell::geometry::Settings&, const ifcopenshell::geometry::SerializerSettings&, ::logger& logger = ::logger::root());
|
||||
virtual ~USDSerializer();
|
||||
bool ready() { return ready_; }
|
||||
void writeHeader();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iomanip>
|
||||
|
||||
WaveFrontOBJSerializer::WaveFrontOBJSerializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger)
|
||||
WaveFrontOBJSerializer::WaveFrontOBJSerializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger)
|
||||
: WriteOnlyGeometrySerializer(geometry_settings, settings, logger)
|
||||
, obj_stream(obj_filename)
|
||||
, mtl_stream(mtl_filename)
|
||||
|
||||
@@ -35,7 +35,7 @@ private:
|
||||
size_t vcount_total, ncount_total;
|
||||
std::set<std::string> materials;
|
||||
public:
|
||||
WaveFrontOBJSerializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, Logger& logger = Logger::Root());
|
||||
WaveFrontOBJSerializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings, ::logger& logger = ::logger::root());
|
||||
virtual ~WaveFrontOBJSerializer() {}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
|
||||
@@ -19,7 +19,7 @@ protected:
|
||||
std::string xml_filename;
|
||||
|
||||
public:
|
||||
XmlSerializer(ifcopenshell::file* file, const std::string& xml_filename, Logger& logger = Logger::Root())
|
||||
XmlSerializer(ifcopenshell::file* file, const std::string& xml_filename, ::logger& logger = ::logger::root())
|
||||
: xml_filename(xml_filename)
|
||||
{
|
||||
if (!file) {
|
||||
|
||||
@@ -161,7 +161,7 @@ std::vector<ifcopenshell::serializers::document_serializer_info> ifcopenshell::s
|
||||
try {
|
||||
module = manager.load(path);
|
||||
} catch (const std::exception& e) {
|
||||
logger::error(e);
|
||||
::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::error(e);
|
||||
::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::error(e);
|
||||
::logger::root().error(e);
|
||||
continue;
|
||||
}
|
||||
if (module.meta().kind_ != ifcopenshell::plugin::kind::document_serializer ||
|
||||
|
||||
@@ -159,7 +159,7 @@ std::vector<ifcopenshell::serializers::geometry_serializer_info> ifcopenshell::s
|
||||
try {
|
||||
module = manager.load(path);
|
||||
} catch (const std::exception& e) {
|
||||
logger::error(e);
|
||||
::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::error(e);
|
||||
::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::error(e);
|
||||
::logger::root().error(e);
|
||||
continue;
|
||||
}
|
||||
if (module.meta().kind_ != ifcopenshell::plugin::kind::geometry_serializer ||
|
||||
|
||||
@@ -18,7 +18,6 @@ foreach(schema ${SCHEMA_VERSIONS})
|
||||
target_link_options(document_serializer_json_ifc${schema} PRIVATE "SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=0")
|
||||
endif()
|
||||
endif()
|
||||
install(TARGETS Serializers_ifc${schema} EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
endforeach()
|
||||
|
||||
set(document_serializer_libraries ${document_serializer_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -69,7 +69,7 @@ class get_type_visitor : public boost::static_visitor<std::string> {
|
||||
// Returns related entity instances using IFC's objectified relationship
|
||||
// model. The second and third argument require a member function pointer.
|
||||
template <typename T, typename U, typename V, typename F, typename G>
|
||||
auto get_related(T t, F f, G g) {
|
||||
auto get_related(::logger& log, T t, F f, G g) {
|
||||
auto li = (t.*f)();
|
||||
std::vector<V> acc;
|
||||
for (auto& u : li) {
|
||||
@@ -91,13 +91,13 @@ auto get_related(T t, F f, G g) {
|
||||
}
|
||||
}
|
||||
} catch (ifcopenshell::exception& e) {
|
||||
logger::error(e);
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
void format_entity_instance(express::Base instance, json& tree, express::Base parent = express::Base()) {
|
||||
void format_entity_instance(::logger& log, express::Base instance, json& tree, express::Base parent = express::Base()) {
|
||||
/*
|
||||
{
|
||||
"id" : string, // Element GUID (IFC GloballyUniqueId)
|
||||
@@ -151,7 +151,8 @@ void format_entity_instance(express::Base instance, json& tree, express::Base pa
|
||||
}
|
||||
|
||||
if (auto obj = instance.as<IfcSchema::IfcObject>()) {
|
||||
auto property_sets = get_related<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByProperties, IfcSchema::IfcPropertySetDefinition>(obj, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
auto property_sets = get_related<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByProperties, IfcSchema::IfcPropertySetDefinition>(
|
||||
log, obj, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
if (!property_sets.empty()) {
|
||||
child["propertySetIds"] = json::array();
|
||||
for (auto& pset : property_sets) {
|
||||
@@ -167,11 +168,11 @@ void format_entity_instance(express::Base instance, json& tree, express::Base pa
|
||||
// A function to be called recursively. Template specialization is used
|
||||
// to descend into decomposition, containment and property relationships.
|
||||
template <typename A>
|
||||
void descend(A instance, json& tree, express::Base parent = express::Base()) {
|
||||
void descend(::logger& log, A instance, json& tree, express::Base parent = express::Base()) {
|
||||
if (instance.declaration().is(IfcSchema::IfcObjectDefinition::Class())) {
|
||||
descend(instance.template as<IfcSchema::IfcObjectDefinition>(), tree, parent);
|
||||
descend(log, instance.template as<IfcSchema::IfcObjectDefinition>(), tree, parent);
|
||||
} else {
|
||||
format_entity_instance(instance, tree, logger);
|
||||
format_entity_instance(log, instance, tree);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ void descend(A instance, json& tree, express::Base parent = express::Base()) {
|
||||
// Descends into the tree by recursing into IfcRelContainedInSpatialStructure,
|
||||
// IfcRelDecomposes, IfcRelDefinesByType, IfcRelDefinesByProperties relations.
|
||||
template <>
|
||||
void descend(IfcSchema::IfcObjectDefinition product, json& tree, express::Base parent) {
|
||||
void descend(::logger& log, IfcSchema::IfcObjectDefinition product, json& tree, express::Base parent) {
|
||||
if (product.declaration().is(IfcSchema::IfcElement::Class())) {
|
||||
auto voids = product.as<IfcSchema::IfcElement>().FillsVoids();
|
||||
if (voids.size() == 1 && voids.front().RelatingOpeningElement() != parent) {
|
||||
@@ -189,46 +190,50 @@ void descend(IfcSchema::IfcObjectDefinition product, json& tree, express::Base p
|
||||
}
|
||||
}
|
||||
|
||||
format_entity_instance(product, tree, logger, parent);
|
||||
format_entity_instance(log, product, tree, parent);
|
||||
|
||||
if (auto opening = product.as<IfcSchema::IfcOpeningElement>()) {
|
||||
auto fills = get_related<IfcSchema::IfcOpeningElement, IfcSchema::IfcRelFillsElement, IfcSchema::IfcElement>(
|
||||
opening, &IfcSchema::IfcOpeningElement::HasFillings, &IfcSchema::IfcRelFillsElement::RelatedBuildingElement);
|
||||
log, opening, &IfcSchema::IfcOpeningElement::HasFillings, &IfcSchema::IfcRelFillsElement::RelatedBuildingElement);
|
||||
|
||||
for (auto& f : fills) {
|
||||
descend(f, tree, product);
|
||||
descend(log, f, tree, product);
|
||||
}
|
||||
}
|
||||
|
||||
if (auto structure = product.as<IfcSchema::IfcSpatialStructureElement>()) {
|
||||
auto elements = get_related<IfcSchema::IfcSpatialStructureElement, IfcSchema::IfcRelContainedInSpatialStructure, IfcSchema::IfcObjectDefinition>(structure, &IfcSchema::IfcSpatialStructureElement::ContainsElements, &IfcSchema::IfcRelContainedInSpatialStructure::RelatedElements);
|
||||
auto elements = get_related<IfcSchema::IfcSpatialStructureElement, IfcSchema::IfcRelContainedInSpatialStructure, IfcSchema::IfcObjectDefinition>(
|
||||
log, structure, &IfcSchema::IfcSpatialStructureElement::ContainsElements, &IfcSchema::IfcRelContainedInSpatialStructure::RelatedElements);
|
||||
|
||||
for (auto& el : elements) {
|
||||
descend(el, tree, product);
|
||||
descend(log, el, tree, product);
|
||||
}
|
||||
}
|
||||
|
||||
if (auto element = product.as<IfcSchema::IfcElement>()) {
|
||||
auto openings = get_related<IfcSchema::IfcElement, IfcSchema::IfcRelVoidsElement, IfcSchema::IfcOpeningElement>(
|
||||
element, &IfcSchema::IfcElement::HasOpenings, &IfcSchema::IfcRelVoidsElement::RelatedOpeningElement);
|
||||
log, element, &IfcSchema::IfcElement::HasOpenings, &IfcSchema::IfcRelVoidsElement::RelatedOpeningElement);
|
||||
|
||||
for (auto& op : openings) {
|
||||
descend(op, tree, product);
|
||||
descend(log, op, tree, product);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SCHEMA_IfcRelDecomposes_HAS_RelatedObjects
|
||||
auto structures = get_related<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelDecomposes, IfcSchema::IfcObjectDefinition>(product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelDecomposes::RelatedObjects);
|
||||
auto structures = get_related<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelDecomposes, IfcSchema::IfcObjectDefinition>(
|
||||
log, product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelDecomposes::RelatedObjects);
|
||||
#else
|
||||
auto structures = get_related<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelAggregates, IfcSchema::IfcObjectDefinition>(product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelAggregates::RelatedObjects);
|
||||
auto structures = get_related<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelAggregates, IfcSchema::IfcObjectDefinition>(
|
||||
log, product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelAggregates::RelatedObjects);
|
||||
|
||||
auto nested = get_related<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelNests, IfcSchema::IfcObjectDefinition>(product, &IfcSchema::IfcObjectDefinition::IsNestedBy, &IfcSchema::IfcRelNests::RelatedObjects);
|
||||
auto nested = get_related<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelNests, IfcSchema::IfcObjectDefinition>(
|
||||
log, product, &IfcSchema::IfcObjectDefinition::IsNestedBy, &IfcSchema::IfcRelNests::RelatedObjects);
|
||||
|
||||
structures.insert(structures.end(), nested.begin(), nested.end());
|
||||
#endif
|
||||
|
||||
for (auto& ob : structures) {
|
||||
descend(ob, tree, product);
|
||||
descend(log, ob, tree, product);
|
||||
}
|
||||
|
||||
// psets are handled as part of format_entity_instance()
|
||||
@@ -262,7 +267,7 @@ void POSTFIX_SCHEMA(JsonSerializer)::finalize() {
|
||||
|
||||
auto projects = file->instances_by_type<IfcSchema::IfcProject>();
|
||||
if (projects.size() != 1) {
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 7, "Expected a single IfcProject");
|
||||
logger().message(::logger::LOG_ERROR, "SER", 7, "Expected a single IfcProject");
|
||||
return;
|
||||
}
|
||||
IfcSchema::IfcProject project = projects.front();
|
||||
@@ -271,7 +276,7 @@ void POSTFIX_SCHEMA(JsonSerializer)::finalize() {
|
||||
try {
|
||||
return fn();
|
||||
} catch (const std::exception& e) {
|
||||
logger_.Error("SER", 8, e);
|
||||
logger().error("SER", 8, e);
|
||||
static std::invoke_result_t<decltype(fn)> v;
|
||||
return v;
|
||||
}
|
||||
@@ -576,7 +581,7 @@ void POSTFIX_SCHEMA(JsonSerializer)::finalize() {
|
||||
}
|
||||
*/
|
||||
|
||||
descend(project, output["metaObjects"], logger_);
|
||||
descend(logger(), project, output["metaObjects"]);
|
||||
|
||||
std::ofstream f(ifcopenshell::path::from_utf8(json_filename).c_str());
|
||||
f << output.dump(4);
|
||||
|
||||
@@ -41,7 +41,7 @@ class POSTFIX_SCHEMA(JsonSerializer) : public JsonSerializer {
|
||||
ifcopenshell::geometry::abstract_mapping* mapping_;
|
||||
|
||||
public:
|
||||
POSTFIX_SCHEMA(JsonSerializer)(ifcopenshell::file* file, const std::string& json_filename, JsonSerializer::Dialect dialect, Logger& logger = Logger::Root())
|
||||
POSTFIX_SCHEMA(JsonSerializer)(ifcopenshell::file* file, const std::string& json_filename, JsonSerializer::Dialect dialect, ::logger& logger = ::logger::root())
|
||||
: JsonSerializer(0, "", dialect), mapping_(ifcopenshell::geometry::impl::mapping_implementations().construct(file, settings_, logger))
|
||||
{
|
||||
this->file = file;
|
||||
|
||||
@@ -131,13 +131,13 @@ std::optional<std::string> format_attribute(ifcopenshell::geometry::abstract_map
|
||||
}
|
||||
|
||||
// Appends to a node with possibly existing attributes
|
||||
ptree* format_entity_instance(Logger& logger, ifcopenshell::geometry::abstract_mapping* mapping, const express::Base& instance, ptree& child, ptree& tree, bool as_link = false) {
|
||||
ptree* format_entity_instance(::logger& log, ifcopenshell::geometry::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 {
|
||||
instance.get_attribute_value(i);
|
||||
} catch (const std::exception&) {
|
||||
logger.Error("SER", 9, "Expected " + boost::lexical_cast<std::string>(n) + " attributes for:", instance);
|
||||
log.error("SER", 9, "Expected " + boost::lexical_cast<std::string>(n) + " attributes for:", instance);
|
||||
break;
|
||||
}
|
||||
auto argument = instance.get_attribute_value(i);
|
||||
@@ -156,7 +156,7 @@ ptree* format_entity_instance(Logger& logger, ifcopenshell::geometry::abstract_m
|
||||
try {
|
||||
value = format_attribute(mapping, argument, argument_type, qualified_name);
|
||||
} catch (const std::exception& e) {
|
||||
logger.Error("SER", 10, e);
|
||||
log.error("SER", 10, e);
|
||||
}
|
||||
|
||||
if (value) {
|
||||
@@ -176,9 +176,9 @@ ptree* format_entity_instance(Logger& logger, ifcopenshell::geometry::abstract_m
|
||||
|
||||
// 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& logger, ifcopenshell::geometry::abstract_mapping* mapping, const express::Base& instance, ptree& tree, bool as_link = false) {
|
||||
ptree* format_entity_instance(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, const express::Base& instance, ptree& tree, bool as_link = false) {
|
||||
ptree child;
|
||||
return format_entity_instance(logger, mapping, instance, child, tree, as_link);
|
||||
return format_entity_instance(log, mapping, instance, child, tree, as_link);
|
||||
}
|
||||
|
||||
std::string qualify_unrooted_instance(const express::Base& inst) {
|
||||
@@ -188,18 +188,18 @@ 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 <typename A>
|
||||
ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, A instance, ptree& tree, express::Base parent = express::Base()) {
|
||||
ptree* descend(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, A instance, ptree& tree, express::Base parent = express::Base()) {
|
||||
if (instance.declaration().is(IfcSchema::IfcObjectDefinition::Class())) {
|
||||
return descend(mapping, instance.template as<IfcSchema::IfcObjectDefinition>(), tree, parent);
|
||||
return descend(log, mapping, instance.template as<IfcSchema::IfcObjectDefinition>(), tree, parent);
|
||||
} else {
|
||||
return format_entity_instance(logger, mapping, instance, tree);
|
||||
return format_entity_instance(log, mapping, instance, tree);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns related entity instances using IFC's objectified relationship
|
||||
// model. The second and third argument require a member function pointer.
|
||||
template <typename T, typename U, typename V, typename F, typename G>
|
||||
auto get_related(T t, F f, G g) {
|
||||
auto get_related(::logger& log, T t, F f, G g) {
|
||||
auto li = (t.*f)();
|
||||
std::vector<V> acc;
|
||||
for (auto& u : li) {
|
||||
@@ -221,7 +221,7 @@ auto get_related(T t, F f, G g) {
|
||||
}
|
||||
}
|
||||
} catch (ifcopenshell::exception& e) {
|
||||
logger::error(e);
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
@@ -230,7 +230,7 @@ auto get_related(T t, F f, G g) {
|
||||
// Descends into the tree by recursing into IfcRelContainedInSpatialStructure,
|
||||
// IfcRelDecomposes, IfcRelDefinesByType, IfcRelDefinesByProperties relations.
|
||||
template <>
|
||||
ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::IfcObjectDefinition product, ptree& tree, express::Base parent) {
|
||||
ptree* descend(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::IfcObjectDefinition product, ptree& tree, express::Base parent) {
|
||||
if (product.declaration().is(IfcSchema::IfcElement::Class())) {
|
||||
auto voids = product.as<IfcSchema::IfcElement>().FillsVoids();
|
||||
if (voids.size() == 1 && voids.front().RelatingOpeningElement() != parent) {
|
||||
@@ -239,65 +239,65 @@ ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::Ifc
|
||||
}
|
||||
}
|
||||
|
||||
ptree& child = *format_entity_instance(logger, mapping, product, tree);
|
||||
ptree& child = *format_entity_instance(log, mapping, product, tree);
|
||||
|
||||
if (auto opening = product.as<IfcSchema::IfcOpeningElement>()) {
|
||||
auto fills = get_related<IfcSchema::IfcOpeningElement, IfcSchema::IfcRelFillsElement, IfcSchema::IfcElement>(
|
||||
opening, &IfcSchema::IfcOpeningElement::HasFillings, &IfcSchema::IfcRelFillsElement::RelatedBuildingElement);
|
||||
log, opening, &IfcSchema::IfcOpeningElement::HasFillings, &IfcSchema::IfcRelFillsElement::RelatedBuildingElement);
|
||||
|
||||
for (auto& f : fills) {
|
||||
descend(mapping, f, child, product);
|
||||
descend(log, mapping, f, child, product);
|
||||
}
|
||||
}
|
||||
|
||||
if (auto structure = product.as<IfcSchema::IfcSpatialStructureElement>()) {
|
||||
auto elements = get_related
|
||||
<IfcSchema::IfcSpatialStructureElement, IfcSchema::IfcRelContainedInSpatialStructure, IfcSchema::IfcObjectDefinition>
|
||||
(logger, structure, &IfcSchema::IfcSpatialStructureElement::ContainsElements, &IfcSchema::IfcRelContainedInSpatialStructure::RelatedElements);
|
||||
(log, structure, &IfcSchema::IfcSpatialStructureElement::ContainsElements, &IfcSchema::IfcRelContainedInSpatialStructure::RelatedElements);
|
||||
|
||||
for (auto& el : elements) {
|
||||
descend(mapping, el, child, product);
|
||||
descend(log, mapping, el, child, product);
|
||||
}
|
||||
}
|
||||
|
||||
if (auto element = product.as<IfcSchema::IfcElement>()) {
|
||||
auto openings = get_related<IfcSchema::IfcElement, IfcSchema::IfcRelVoidsElement, IfcSchema::IfcOpeningElement>(
|
||||
element, &IfcSchema::IfcElement::HasOpenings, &IfcSchema::IfcRelVoidsElement::RelatedOpeningElement);
|
||||
log, element, &IfcSchema::IfcElement::HasOpenings, &IfcSchema::IfcRelVoidsElement::RelatedOpeningElement);
|
||||
|
||||
for (auto& op : openings) {
|
||||
descend(mapping, op, child, product);
|
||||
descend(log, mapping, op, child, product);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SCHEMA_IfcRelDecomposes_HAS_RelatedObjects
|
||||
auto structures = get_related
|
||||
<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelDecomposes, IfcSchema::IfcObjectDefinition>
|
||||
(logger, product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelDecomposes::RelatedObjects);
|
||||
(log, product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelDecomposes::RelatedObjects);
|
||||
#else
|
||||
auto structures = get_related
|
||||
<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelAggregates, IfcSchema::IfcObjectDefinition>
|
||||
(logger, product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelAggregates::RelatedObjects);
|
||||
(log, product, &IfcSchema::IfcObjectDefinition::IsDecomposedBy, &IfcSchema::IfcRelAggregates::RelatedObjects);
|
||||
|
||||
auto nested = get_related
|
||||
<IfcSchema::IfcObjectDefinition, IfcSchema::IfcRelNests, IfcSchema::IfcObjectDefinition>
|
||||
(product, &IfcSchema::IfcObjectDefinition::IsNestedBy, &IfcSchema::IfcRelNests::RelatedObjects);
|
||||
(log, product, &IfcSchema::IfcObjectDefinition::IsNestedBy, &IfcSchema::IfcRelNests::RelatedObjects);
|
||||
|
||||
structures.insert(structures.end(), nested.begin(), nested.end());
|
||||
#endif
|
||||
|
||||
for (auto& ob : structures) {
|
||||
descend(mapping, ob, child, product);
|
||||
descend(log, mapping, ob, child, product);
|
||||
}
|
||||
|
||||
if (auto object = product.as<IfcSchema::IfcObject>()) {
|
||||
auto property_sets = get_related
|
||||
<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByProperties, IfcSchema::IfcPropertySetDefinition>
|
||||
(logger, object, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
(log, object, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
|
||||
#ifdef SCHEMAS_HAS_IfcPropertySetDefinitionSet
|
||||
auto property_set_sets = get_related
|
||||
<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByProperties, IfcSchema::IfcPropertySetDefinitionSet>
|
||||
(logger, object, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
(log, object, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
|
||||
for (auto& s : property_set_sets) {
|
||||
auto set_sets_value = (decltype(property_sets))s;
|
||||
@@ -307,24 +307,24 @@ ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::Ifc
|
||||
|
||||
for (auto& pset : property_sets) {
|
||||
if (pset.declaration().is(IfcSchema::IfcPropertySet::Class())) {
|
||||
format_entity_instance(mapping, pset, child, true);
|
||||
format_entity_instance(log, mapping, pset, child, true);
|
||||
} else if (pset.declaration().is(IfcSchema::IfcElementQuantity::Class())) {
|
||||
format_entity_instance(mapping, pset, child, true);
|
||||
format_entity_instance(log, mapping, pset, child, true);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SCHEMA_IfcObject_HAS_IsTypedBy
|
||||
auto types = get_related
|
||||
<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByType, IfcSchema::IfcTypeObject>
|
||||
(logger, object, &IfcSchema::IfcObject::IsTypedBy, &IfcSchema::IfcRelDefinesByType::RelatingType);
|
||||
(log, object, &IfcSchema::IfcObject::IsTypedBy, &IfcSchema::IfcRelDefinesByType::RelatingType);
|
||||
#else
|
||||
auto types = get_related
|
||||
<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByType, IfcSchema::IfcTypeObject>
|
||||
(logger, object, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByType::RelatingType);
|
||||
(log, object, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByType::RelatingType);
|
||||
#endif
|
||||
|
||||
for (auto& type : types) {
|
||||
format_entity_instance(mapping, type, child, true);
|
||||
format_entity_instance(log, mapping, type, child, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::Ifc
|
||||
// for the format_entity_instance() call.
|
||||
ptree node;
|
||||
node.put("<xmlattr>.xlink:href", "#" + p.first);
|
||||
format_entity_instance(mapping, p.second, node, child, true);
|
||||
format_entity_instance(log, mapping, p.second, node, child, true);
|
||||
}
|
||||
|
||||
auto associations = product.HasAssociations();
|
||||
@@ -345,7 +345,7 @@ ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::Ifc
|
||||
IfcSchema::IfcMaterialSelect mat = relmat.RelatingMaterial();
|
||||
ptree node;
|
||||
node.put("<xmlattr>.xlink:href", "#" + qualify_unrooted_instance(mat));
|
||||
format_entity_instance(mapping, mat.concrete(), node, child, true);
|
||||
format_entity_instance(log, mapping, mat.concrete(), node, child, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::Ifc
|
||||
#if defined(SCHEMA_HAS_IfcAlignmentSegment) && defined(SCHEMA_IfcAlignmentSegment_HAS_DesignParameters)
|
||||
if (auto als = product.as<IfcSchema::IfcAlignmentSegment>()) {
|
||||
ptree node;
|
||||
format_entity_instance(mapping, als.DesignParameters(), node, child, false);
|
||||
format_entity_instance(log, mapping, als.DesignParameters(), node, child, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -361,17 +361,17 @@ ptree* descend(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::Ifc
|
||||
}
|
||||
|
||||
// Format IfcProperty instances and insert into the DOM. IfcComplexProperties are flattened out.
|
||||
void format_properties(ifcopenshell::geometry::abstract_mapping* mapping, const std::vector<IfcSchema::IfcProperty>& properties, ptree& node) {
|
||||
void format_properties(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, const std::vector<IfcSchema::IfcProperty>& properties, ptree& node) {
|
||||
for (auto& p : properties) {
|
||||
if (auto complex = p.as<IfcSchema::IfcComplexProperty>()) {
|
||||
format_properties(mapping, complex.HasProperties(), node);
|
||||
format_properties(log, mapping, complex.HasProperties(), node);
|
||||
} else {
|
||||
format_entity_instance(logger, mapping, p, node);
|
||||
format_entity_instance(log, mapping, p, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void writeGroupToNode(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::IfcGroup group, ptree& node, std::set<std::string> notRootGroups) {
|
||||
void writeGroupToNode(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::IfcGroup group, ptree& node, std::set<std::string> notRootGroups) {
|
||||
// @todo tfk: instead of a set<string> shouldn't we just have a set<IfcGroup>, the current approach
|
||||
// might not work with non-unique or NIL group names.
|
||||
|
||||
@@ -384,44 +384,44 @@ void writeGroupToNode(ifcopenshell::geometry::abstract_mapping* mapping, IfcSche
|
||||
return;
|
||||
}
|
||||
// Write one group to root
|
||||
ptree* node2 = descend(mapping, group, node);
|
||||
ptree* node2 = descend(log, mapping, group, node);
|
||||
auto father = group.IsGroupedBy();
|
||||
for (auto& ii : father)
|
||||
{
|
||||
auto objs = ii.RelatedObjects();
|
||||
for (auto entity : objs) {
|
||||
if (entity.as<IfcSchema::IfcGroup>() && entity.Name()) {
|
||||
writeGroupToNode(mapping, entity.as<IfcSchema::IfcGroup>(), *node2, notRootGroups);
|
||||
writeGroupToNode(log, mapping, entity.as<IfcSchema::IfcGroup>(), *node2, notRootGroups);
|
||||
notRootGroups.emplace(*entity.Name());
|
||||
}
|
||||
else {
|
||||
// Write child to father group
|
||||
descend(logger, mapping, entity, *node2);
|
||||
descend(log, mapping, entity, *node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Format IfcElementQuantity instances and insert into the DOM.
|
||||
void format_quantities(ifcopenshell::geometry::abstract_mapping* mapping, const std::vector<IfcSchema::IfcPhysicalQuantity>& quantities, ptree& node) {
|
||||
void format_quantities(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, const std::vector<IfcSchema::IfcPhysicalQuantity>& quantities, ptree& node) {
|
||||
for (auto& p : quantities) {
|
||||
ptree* node2 = format_entity_instance(mapping, p, node);
|
||||
ptree* node2 = format_entity_instance(log, mapping, p, node);
|
||||
if (node2 && p.declaration().is(IfcSchema::IfcPhysicalComplexQuantity::Class())) {
|
||||
format_quantities(mapping, p.as<IfcSchema::IfcPhysicalComplexQuantity>().HasQuantities(), *node2);
|
||||
format_quantities(log, mapping, p.as<IfcSchema::IfcPhysicalComplexQuantity>().HasQuantities(), *node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Format IfcTask instances and insert into the DOM.
|
||||
void format_tasks(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::IfcTask task, ptree& node) {
|
||||
ptree* ntask = format_entity_instance(mapping, task, node);
|
||||
void format_tasks(::logger& log, ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::IfcTask task, ptree& node) {
|
||||
ptree* ntask = format_entity_instance(log, mapping, task, node);
|
||||
|
||||
if (ntask) {
|
||||
#ifdef SCHEMA_IfcTask_HAS_TaskTime
|
||||
IfcSchema::IfcTaskTime task_time = task.TaskTime();
|
||||
if (task_time)
|
||||
{
|
||||
format_entity_instance(logger, mapping, task_time, *ntask);
|
||||
format_entity_instance(log, mapping, task_time, *ntask);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -449,14 +449,14 @@ void format_tasks(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::
|
||||
|
||||
auto property_sets = get_related
|
||||
<IfcSchema::IfcObject, IfcSchema::IfcRelDefinesByProperties, IfcSchema::IfcPropertySetDefinition>
|
||||
(logger, task, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
(log, task, &IfcSchema::IfcObject::IsDefinedBy, &IfcSchema::IfcRelDefinesByProperties::RelatingPropertyDefinition);
|
||||
|
||||
for (auto& pset : property_sets) {
|
||||
if (pset.declaration().is(IfcSchema::IfcPropertySet::Class())) {
|
||||
format_entity_instance(mapping, pset, *ntask, true);
|
||||
format_entity_instance(log, mapping, pset, *ntask, true);
|
||||
}
|
||||
else if (pset.declaration().is(IfcSchema::IfcElementQuantity::Class())) {
|
||||
format_entity_instance(mapping, pset, *ntask, true);
|
||||
format_entity_instance(log, mapping, pset, *ntask, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ void format_tasks(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::
|
||||
for (auto& object : related_objects)
|
||||
{
|
||||
if (auto task2 = object.as<IfcSchema::IfcTask>()) {
|
||||
format_tasks(mapping, task2, *ntask);
|
||||
format_tasks(log, mapping, task2, *ntask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,21 +524,22 @@ void format_tasks(ifcopenshell::geometry::abstract_mapping* mapping, IfcSchema::
|
||||
|
||||
void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
POSTFIX_SCHEMA(argument_name_map).insert(std::make_pair("GlobalId", "id"));
|
||||
auto& log = logger();
|
||||
|
||||
auto projects = file->instances_by_type<IfcSchema::IfcProject>();
|
||||
if (projects.size() != 1) {
|
||||
logger::message(logger::LOG_ERROR, "Expected a single IfcProject");
|
||||
log.message(::logger::LOG_ERROR, "Expected a single IfcProject");
|
||||
return;
|
||||
}
|
||||
IfcSchema::IfcProject& project = projects.front();
|
||||
|
||||
ptree root, header, units, decomposition, properties, quantities, types, layers, materials, work, calendars, connections, groups;
|
||||
|
||||
auto catch_exceptions = [this](const auto& fn) {
|
||||
auto catch_exceptions = [this, &log](const auto& fn) {
|
||||
try {
|
||||
return fn();
|
||||
} catch(const std::exception& e) {
|
||||
logger_.Error("SER", 13, e);
|
||||
log.error("SER", 13, e);
|
||||
static std::invoke_result_t<decltype(fn)> v;
|
||||
return v;
|
||||
}
|
||||
@@ -563,7 +564,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to get ifc file header file_description implementation_level, error: '" << ex.what() << "'";
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 14, ss.str());
|
||||
log.message(::logger::LOG_ERROR, "SER", 14, ss.str());
|
||||
}
|
||||
try {
|
||||
header.put("file_name.name", file->header().file_name().name());
|
||||
@@ -571,7 +572,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to get ifc file header file_name name, error: '" << ex.what() << "'";
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 15, ss.str());
|
||||
log.message(::logger::LOG_ERROR, "SER", 15, ss.str());
|
||||
}
|
||||
try {
|
||||
header.put("file_name.time_stamp", file->header().file_name().time_stamp());
|
||||
@@ -579,7 +580,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to get ifc file header file_name time_stamp, error: '" << ex.what() << "'";
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 16, ss.str());
|
||||
log.message(::logger::LOG_ERROR, "SER", 16, ss.str());
|
||||
}
|
||||
try {
|
||||
header.put("file_name.preprocessor_version", file->header().file_name().preprocessor_version());
|
||||
@@ -587,7 +588,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to get ifc file header file_name preprocessor_version, error: '" << ex.what() << "'";
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 17, ss.str());
|
||||
log.message(::logger::LOG_ERROR, "SER", 17, ss.str());
|
||||
}
|
||||
try {
|
||||
header.put("file_name.originating_system", file->header().file_name().originating_system());
|
||||
@@ -595,7 +596,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to get ifc file header file_name originating_system, error: '" << ex.what() << "'";
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 18, ss.str());
|
||||
log.message(::logger::LOG_ERROR, "SER", 18, ss.str());
|
||||
}
|
||||
try {
|
||||
// @nb inconsistent spelling
|
||||
@@ -604,18 +605,18 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
catch (const ifcopenshell::exception& ex) {
|
||||
std::stringstream ss;
|
||||
ss << "Failed to get ifc file header file_name authorization, error: '" << ex.what() << "'";
|
||||
logger_.Message(Logger::LOG_ERROR, "SER", 19, ss.str());
|
||||
log.message(::logger::LOG_ERROR, "SER", 19, ss.str());
|
||||
}
|
||||
|
||||
// Descend into the decomposition structure of the IFC file.
|
||||
descend(logger_, mapping_, project, decomposition);
|
||||
descend(log, mapping_, project, decomposition);
|
||||
|
||||
// Write all property sets and values as XML nodes.
|
||||
auto psets = file->instances_by_type<IfcSchema::IfcPropertySet>();
|
||||
for (auto& pset : psets) {
|
||||
ptree* node = format_entity_instance(mapping_, pset, properties);
|
||||
ptree* node = format_entity_instance(log, mapping_, pset, properties);
|
||||
if (node) {
|
||||
format_properties(mapping_, pset.HasProperties(), *node);
|
||||
format_properties(log, mapping_, pset.HasProperties(), *node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +624,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
auto gsets = file->instances_by_type<IfcSchema::IfcGroup>();
|
||||
std::set<std::string> notRootGroups; //selfname, fathername
|
||||
for (auto& g : gsets) {
|
||||
writeGroupToNode(mapping_, g, groups, notRootGroups);
|
||||
writeGroupToNode(log, mapping_, g, groups, notRootGroups);
|
||||
}
|
||||
for (auto it = groups.begin(); it != groups.end();) {
|
||||
if (notRootGroups.find(it->second.get<std::string>("<xmlattr>.Name")) != notRootGroups.end()) {
|
||||
@@ -636,9 +637,9 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
// Write all quantities and values as XML nodes.
|
||||
auto qtosets = file->instances_by_type<IfcSchema::IfcElementQuantity>();
|
||||
for (auto& qto : qtosets) {
|
||||
ptree* node = format_entity_instance(mapping_, qto, quantities);
|
||||
ptree* node = format_entity_instance(log, mapping_, qto, quantities);
|
||||
if (node) {
|
||||
format_quantities(mapping_, qto.Quantities(), *node);
|
||||
format_quantities(log, mapping_, qto.Quantities(), *node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +647,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
ptree pwork_schedules;
|
||||
auto pschedules = file->instances_by_type<IfcSchema::IfcWorkSchedule>();
|
||||
for (auto& schedule : pschedules) {
|
||||
ptree* nschedule = format_entity_instance(mapping_, schedule, pwork_schedules);
|
||||
ptree* nschedule = format_entity_instance(log, mapping_, schedule, pwork_schedules);
|
||||
|
||||
if(nschedule) {
|
||||
auto controls = schedule.Controls();
|
||||
@@ -655,7 +656,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
for(auto& object : objects) {
|
||||
if (object && object.declaration().is(IfcSchema::IfcTask::Class())) {
|
||||
IfcSchema::IfcTask task = object.as<IfcSchema::IfcTask>();
|
||||
format_tasks(mapping_, task, *nschedule);
|
||||
format_tasks(log, mapping_, task, *nschedule);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -667,7 +668,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
ptree pwork_plans;
|
||||
auto pplans = file->instances_by_type<IfcSchema::IfcWorkPlan>();
|
||||
for (auto& plan : pplans) {
|
||||
ptree* nschedule = format_entity_instance(mapping_, plan, pwork_plans);
|
||||
ptree* nschedule = format_entity_instance(log, mapping_, plan, pwork_plans);
|
||||
|
||||
if (nschedule) {
|
||||
#ifdef SCHEMA_IfcObjectDefinition_HAS_IsDecomposedBy
|
||||
@@ -691,13 +692,13 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
#ifdef SCHEMA_HAS_IfcWorkCalendar
|
||||
auto pcalendars = file->instances_by_type<IfcSchema::IfcWorkCalendar>();
|
||||
for (auto& calendar : pcalendars) {
|
||||
ptree* ncalendar = format_entity_instance(mapping_, calendar, calendars);
|
||||
ptree* ncalendar = format_entity_instance(log, mapping_, calendar, calendars);
|
||||
|
||||
if (ncalendar) {
|
||||
auto working_times = calendar.WorkingTimes().value_or(std::vector<IfcSchema::IfcWorkTime>{});
|
||||
for (auto& working_time : working_times)
|
||||
{
|
||||
format_entity_instance(mapping_, working_time, *ncalendar);
|
||||
format_entity_instance(log, mapping_, working_time, *ncalendar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,13 +706,13 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
|
||||
auto pconnections = file->instances_by_type<IfcSchema::IfcRelConnectsElements>();
|
||||
for (auto& connection : pconnections) {
|
||||
ptree* nconnection = format_entity_instance(mapping_, connection, connections);
|
||||
ptree* nconnection = format_entity_instance(log, mapping_, connection, connections);
|
||||
|
||||
ptree nrelatedElement;
|
||||
ptree nrelatingElement;
|
||||
|
||||
format_entity_instance(mapping_,connection.RelatedElement(), nrelatedElement, true);
|
||||
format_entity_instance(mapping_,connection.RelatingElement(), nrelatingElement, true);
|
||||
format_entity_instance(log, mapping_, connection.RelatedElement(), nrelatedElement, true);
|
||||
format_entity_instance(log, mapping_, connection.RelatingElement(), nrelatingElement, true);
|
||||
|
||||
nconnection->add_child("RelatedElement", nrelatedElement);
|
||||
nconnection->add_child("RelatingElement", nrelatingElement);
|
||||
@@ -720,13 +721,13 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
// Write all type objects as XML nodes.
|
||||
auto type_objects = file->instances_by_type<IfcSchema::IfcTypeObject>();
|
||||
for (auto& type_object : type_objects) {
|
||||
ptree* node = descend(mapping_, type_object, types);
|
||||
ptree* node = descend(log, mapping_, type_object, types);
|
||||
|
||||
if (node && type_object.HasPropertySets()) {
|
||||
auto property_sets = *type_object.HasPropertySets();
|
||||
for (auto& pset : property_sets) {
|
||||
if (pset.declaration().is(IfcSchema::IfcPropertySet::Class())) {
|
||||
format_entity_instance(mapping_, pset, *node, true);
|
||||
format_entity_instance(log, mapping_, pset, *node, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -736,12 +737,12 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
auto unit_assignments = project.UnitsInContext().Units();
|
||||
for (auto& unit : unit_assignments) {
|
||||
if (auto named_unit = unit.as<IfcSchema::IfcNamedUnit>()) {
|
||||
ptree* node = format_entity_instance(mapping_, named_unit, units);
|
||||
ptree* node = format_entity_instance(log, mapping_, named_unit, units);
|
||||
if (node) {
|
||||
node->put("<xmlattr>.SI_equivalent", ifcopenshell::get_SI_equivalent<IfcSchema>(named_unit));
|
||||
}
|
||||
} else if (auto mon_unit = unit.as<IfcSchema::IfcMonetaryUnit>()) {
|
||||
format_entity_instance(mapping_, mon_unit, units);
|
||||
format_entity_instance(log, mapping_, mon_unit, units);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,7 +757,7 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
layer_names.insert(name);
|
||||
ptree node;
|
||||
node.put("<xmlattr>.id", name);
|
||||
format_entity_instance(mapping_, assignment, node, layers);
|
||||
format_entity_instance(log, mapping_, assignment, node, layers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,16 +784,16 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
||||
if (layer.Material()) {
|
||||
subnode.put("<xmlattr>.Name", layer.Material());
|
||||
}
|
||||
format_entity_instance(mapping_, layer, subnode, node);
|
||||
format_entity_instance(log, mapping_, layer, subnode, node);
|
||||
}
|
||||
} else if (auto matlist = mat.concrete().as<IfcSchema::IfcMaterialList>()) {
|
||||
auto mats = matlist.Materials();
|
||||
for (auto& mat : mats) {
|
||||
ptree subnode;
|
||||
format_entity_instance(mapping_, mat, subnode, node);
|
||||
format_entity_instance(log, mapping_, mat, subnode, node);
|
||||
}
|
||||
}
|
||||
format_entity_instance(mapping_, mat.concrete(), node, materials);
|
||||
format_entity_instance(log, mapping_, mat.concrete(), node, materials);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
ifcopenshell::geometry::abstract_mapping* mapping_;
|
||||
|
||||
public:
|
||||
POSTFIX_SCHEMA(XmlSerializer)(ifcopenshell::file* file, const std::string& xml_filename, Logger& logger = Logger::Root())
|
||||
POSTFIX_SCHEMA(XmlSerializer)(ifcopenshell::file* file, const std::string& xml_filename, ::logger& logger = ::logger::root())
|
||||
: XmlSerializer(0, "")
|
||||
, mapping_(ifcopenshell::geometry::impl::mapping_implementations().construct(file, settings_, logger))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user