Fix : fill the storey property of an Element with NULL when we don't find any IfcBuildingStorey parent

This commit is contained in:
Balleux Benjamin
2017-05-09 14:40:23 +02:00
parent e3e4fba63a
commit a6ffa7fc42
3 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -363,8 +363,8 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
material_references.push_back(material_name); material_references.push_back(material_name);
} }
DeferredObject defered = (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) ? 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(), 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())) : 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(), 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())); mesh.faces(), mesh.edges(), mesh.material_ids(), mesh.materials(), material_references, mesh.uvs()));
+2 -2
View File
@@ -132,12 +132,12 @@ private:
if (parent1 == NULL || parent2 == NULL) 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; return res;
} }
else else
{ {
bool res = parent1->name() < parent2->name() ? true : false; bool res = parent1->name().compare(parent2->name()) > 0 ? true : false;
return res; return res;
} }
} }
+1
View File
@@ -604,6 +604,7 @@ namespace IfcGeom {
} }
if (hasParent) { ret->SetFloor(parent_object); } 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
} }
} }