From 236f470ae60894531b36166cf8a7ea2c307b4b6e Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 22 Mar 2023 09:28:02 +0100 Subject: [PATCH] Update geom server --- src/ifcgeom/Iterator.h | 9 +++++++ src/ifcgeomserver/IfcGeomServer.cpp | 39 +++++++++++++++++------------ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/ifcgeom/Iterator.h b/src/ifcgeom/Iterator.h index c34713dabf..08d3a6fd45 100644 --- a/src/ifcgeom/Iterator.h +++ b/src/ifcgeom/Iterator.h @@ -735,6 +735,15 @@ namespace IfcGeom { { } + Iterator(const IteratorSettings& settings, IfcParse::IfcFile* file) + : settings_(settings) + , ifc_file(file) + , owns_ifc_file(false) + , num_threads_(1) + , geometry_library_("opencascade") + { + } + ~Iterator() { if (owns_ifc_file) { delete ifc_file; diff --git a/src/ifcgeomserver/IfcGeomServer.cpp b/src/ifcgeomserver/IfcGeomServer.cpp index c30d04b8c8..aedda4bd38 100644 --- a/src/ifcgeomserver/IfcGeomServer.cpp +++ b/src/ifcgeomserver/IfcGeomServer.cpp @@ -24,6 +24,9 @@ * * ********************************************************************************/ +#include +#include + #include #include @@ -38,11 +41,13 @@ #include #endif -#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h" -#include "../ifcgeom_schema_agnostic/IfcGeomElement.h" +#include "../ifcgeom/Iterator.h" +#include "../ifcgeom/IfcGeomElement.h" #include "../ifcparse/IfcFile.h" #include "../ifcparse/IfcLogger.h" +#include "../ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h" + #if USE_VLD #include #endif @@ -298,12 +303,12 @@ protected: swrite(s, geom->name()); swrite(s, geom->type()); swrite(s, geom->parent_id()); - const std::vector& m = geom->transformation().matrix().data(); + const auto& m = geom->transformation().data().ccomponents(); const double matrix_array[16] = { - m[0], m[3], m[6], m[ 9], - m[1], m[4], m[7], m[10], - m[2], m[5], m[8], m[11], - 0, 0, 0, 1 + m(0,0), m(0,1), m(0,2), m(0,3), + m(1,0), m(1,1), m(1,2), m(1,3), + m(2,0), m(2,1), m(2,2), m(2,3), + m(3,0), m(3,1), m(3,2), m(3,3) }; swrite(s, std::string((char*)matrix_array, 16 * sizeof(double))); @@ -347,15 +352,15 @@ protected: { // We remove the blanks here from the material array. I.e. materials without a diffuse color std::vector > > diffuse_color_array; - for (std::vector::const_iterator it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) { - const IfcGeom::Material& mat = *it; - if (mat.hasDiffuse()) { - const double* color = mat.diffuse(); + for (auto it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) { + const auto& mat = *it; + if (mat.diffuse) { + const auto& color = mat.diffuse.ccomponents(); diffuse_color_array.push_back(std::array{ - static_cast(color[0]), - static_cast(color[1]), - static_cast(color[2]), - mat.hasTransparency() ? static_cast(1. - mat.transparency()) : 1.f + static_cast(color(0)), + static_cast(color(1)), + static_cast(color(2)), + mat.transparency == mat.transparency ? static_cast(1. - mat.transparency) : 1.f }); } else { diffuse_color_array.emplace_back(); @@ -500,7 +505,9 @@ public: boost::optional largest_face_dir; { - TopoDS_Compound compound = elem_->geometry().as_compound(true); + auto shp = elem_->geometry().as_compound(true); + auto compound = ((ifcopenshell::geometry::OpenCascadeShape*)shp)->shape(); + delete shp; TopExp_Explorer exp(compound, TopAbs_FACE); for (; exp.More(); exp.Next()) { GProp_GProps prop;