From a6ffa7fc4287bc9476bfa6153a17830ec95c1b23 Mon Sep 17 00:00:00 2001 From: Balleux Benjamin Date: Tue, 9 May 2017 14:40:23 +0200 Subject: [PATCH] Fix : fill the storey property of an Element with NULL when we don't find any IfcBuildingStorey parent --- src/ifcconvert/ColladaSerializer.cpp | 4 ++-- src/ifcconvert/ColladaSerializer.h | 4 ++-- src/ifcgeom/IfcGeomIterator.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ifcconvert/ColladaSerializer.cpp b/src/ifcconvert/ColladaSerializer.cpp index 8fea20fa6e..7097b6febd 100644 --- a/src/ifcconvert/ColladaSerializer.cpp +++ b/src/ifcconvert/ColladaSerializer.cpp @@ -363,8 +363,8 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme material_references.push_back(material_name); } - DeferredObject defered = (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) ? - DeferredObject(name, representation_id, o->type(), o->transformation().matrix().data(), mesh.verts(), mesh.normals(), + DeferredObject defered = (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) && o->storey() != NULL ? + DeferredObject(name, representation_id, o->type(), o->transformation().matrix().data(), mesh.verts(), mesh.normals(), mesh.faces(), mesh.edges(), mesh.material_ids(), mesh.materials(), material_references, mesh.uvs(), *(o->storey())) : DeferredObject(name, representation_id, o->type(), o->transformation().matrix().data(), mesh.verts(), mesh.normals(), mesh.faces(), mesh.edges(), mesh.material_ids(), mesh.materials(), material_references, mesh.uvs())); diff --git a/src/ifcconvert/ColladaSerializer.h b/src/ifcconvert/ColladaSerializer.h index 15bf6f84b8..fe7ac48765 100644 --- a/src/ifcconvert/ColladaSerializer.h +++ b/src/ifcconvert/ColladaSerializer.h @@ -132,12 +132,12 @@ private: if (parent1 == NULL || parent2 == NULL) { - bool res = (def_obj1.unique_id < def_obj2.unique_id ? true : false); + bool res = (parent1 == NULL) ? true : false; return res; } else { - bool res = parent1->name() < parent2->name() ? true : false; + bool res = parent1->name().compare(parent2->name()) > 0 ? true : false; return res; } } diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index 8b90046e69..223704bb6a 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -604,6 +604,7 @@ namespace IfcGeom { } if (hasParent) { ret->SetFloor(parent_object); } + else { ret->SetFloor(NULL); } // Set it so null in order to know that we didn't found any IfcBuildingStorey type parent } }