From bd3118b4a3dfb79b1a4931eb1cc09d9360b06305 Mon Sep 17 00:00:00 2001 From: Xavier Lamorlette Date: Tue, 29 Jan 2019 10:35:12 +0100 Subject: [PATCH 1/3] Fix a "declaration of 'identifier' hides class member" warning --- src/ifcgeom/IfcRepresentationShapeItem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcRepresentationShapeItem.h b/src/ifcgeom/IfcRepresentationShapeItem.h index 29d5ca264b..c06ecdd4b8 100644 --- a/src/ifcgeom/IfcRepresentationShapeItem.h +++ b/src/ifcgeom/IfcRepresentationShapeItem.h @@ -46,7 +46,7 @@ namespace IfcGeom { const gp_GTrsf& Placement() const { return placement; } bool hasStyle() const { return style != 0; } const SurfaceStyle& Style() const { return *style; } - void setStyle(const SurfaceStyle* style) { this->style = style; } + void setStyle(const SurfaceStyle* newStyle) { style = newStyle; } }; typedef std::vector IfcRepresentationShapeItems; } From 3e041a1fb22aadd70932d4552c1286ab1bae2b71 Mon Sep 17 00:00:00 2001 From: Xavier Lamorlette Date: Tue, 29 Jan 2019 12:02:49 +0100 Subject: [PATCH 2/3] Migrate deprecated bind1st and mem_fun to C++11 bind --- src/ifcgeom/IfcGeomFilter.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ifcgeom/IfcGeomFilter.h b/src/ifcgeom/IfcGeomFilter.h index d766f2b463..4fbeca2726 100644 --- a/src/ifcgeom/IfcGeomFilter.h +++ b/src/ifcgeom/IfcGeomFilter.h @@ -171,8 +171,7 @@ namespace IfcGeom bool operator()(IfcSchema::IfcProduct* prod) const { - // @note bind1st() and mem_fun() deprecated in C++11, use bind() and mem_fn() when migrating to C++11. - return filter::match(prod, std::bind1st(std::mem_fun(&string_arg_filter::match), this)); + return filter::match(prod, std::bind(&string_arg_filter::match, this, std::placeholders::_1)); } void update_description() @@ -219,7 +218,7 @@ namespace IfcGeom bool operator()(IfcSchema::IfcProduct* prod) const { - return filter::match(prod, std::bind1st(std::mem_fun(&layer_filter::match), this)); + return filter::match(prod, std::bind(&layer_filter::match, this, std::placeholders::_1)); } struct wildcards_match @@ -285,7 +284,7 @@ namespace IfcGeom bool operator()(IfcSchema::IfcProduct* prod) const { - return filter::match(prod, std::bind1st(std::mem_fun(&entity_filter::match), this)); + return filter::match(prod, std::bind(&entity_filter::match, this, std::placeholders::_1)); } void update_description() From 81f978f1010f7fdd779136317f21cb461daccb1d Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 6 Feb 2019 12:18:10 +0100 Subject: [PATCH 3/3] Changes to Axis with missing refDirection --- src/ifcgeom/IfcGeomHelpers.cpp | 41 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/ifcgeom/IfcGeomHelpers.cpp b/src/ifcgeom/IfcGeomHelpers.cpp index cf440772ab..0e772b64c2 100644 --- a/src/ifcgeom/IfcGeomHelpers.cpp +++ b/src/ifcgeom/IfcGeomHelpers.cpp @@ -158,15 +158,38 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcVector* l, gp_Vec& v) { } bool IfcGeom::Kernel::convert(const IfcSchema::IfcAxis2Placement3D* l, gp_Trsf& trsf) { - IN_CACHE(IfcAxis2Placement3D,l,gp_Trsf,trsf) - gp_Pnt o;gp_Dir axis = gp_Dir(0,0,1);gp_Dir refDirection; - IfcGeom::Kernel::convert(l->Location(),o); - bool hasRef = l->hasRefDirection(); - if ( l->hasAxis() ) IfcGeom::Kernel::convert(l->Axis(),axis); - if ( hasRef ) IfcGeom::Kernel::convert(l->RefDirection(),refDirection); - gp_Ax3 ax3; - if ( hasRef ) ax3 = gp_Ax3(o,axis,refDirection); - else ax3 = gp_Ax3(o,axis); + IN_CACHE(IfcAxis2Placement3D, l, gp_Trsf, trsf) + + gp_Pnt o; + gp_Dir axis(0, 0, 1); + gp_Dir refDirection; + + IfcGeom::Kernel::convert(l->Location(), o); + const bool hasAxis = l->hasAxis(); + const bool hasRef = l->hasRefDirection(); + + if (hasAxis != hasRef) { + Logger::Warning("Axis and RefDirection should be specified together", l); + } + + if (hasAxis) { + IfcGeom::Kernel::convert(l->Axis(), axis); + } + + if (hasRef) { + IfcGeom::Kernel::convert(l->RefDirection(), refDirection); + } else { + if (!axis.IsParallel(gp::DX(), 1.e-5)) { + refDirection = gp::DX(); + } else { + refDirection = gp::DZ(); + } + gp_Vec Xvec = axis.Dot(refDirection) * axis; + gp_Vec Xaxis = refDirection.XYZ() - Xvec.XYZ(); + refDirection = Xaxis; + } + + gp_Ax3 ax3(o, axis, refDirection); if (!axis_equal(ax3, (gp_Ax3) gp::XOY(), getValue(GV_PRECISION))) { trsf.SetTransformation(ax3, gp::XOY());