Merge branch 'feature/hierarchyDevelop' into feature/hierarchy

This commit is contained in:
Balleux Benjamin
2017-05-11 11:22:11 +02:00
3 changed files with 46 additions and 18 deletions
+25 -15
View File
@@ -363,7 +363,7 @@ 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(),
@@ -373,20 +373,30 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
std::string ColladaSerializer::ColladaExporter::differentiateSlabTypes(const IfcGeom::TriangulationElement<real_t>* o) { std::string ColladaSerializer::ColladaExporter::differentiateSlabTypes(const IfcGeom::TriangulationElement<real_t>* o) {
IfcSlab* slab = (IfcSlab*)o->product(); IfcSlab* slab = (IfcSlab*)o->product();
switch (slab->PredefinedType()){ switch (slab->PredefinedType())
case (IfcSlabTypeEnum::IfcSlabType_ROOF): {
return "_Roof"; case (IfcSlabTypeEnum::IfcSlabType_FLOOR):
break; return "_Floor";
case (IfcSlabTypeEnum::IfcSlabType_LANDING): break;
return "_Landing"; case (IfcSlabTypeEnum::IfcSlabType_ROOF):
break; return "_Roof";
case (IfcSlabTypeEnum::IfcSlabType_BASESLAB): break;
return "_BasesLab"; case (IfcSlabTypeEnum::IfcSlabType_LANDING):
break; return "_Landing";
default: break;
return "_Unknown"; case (IfcSlabTypeEnum::IfcSlabType_BASESLAB):
break; return "_BaseSlab";
} break;
case (IfcSlabTypeEnum::IfcSlabType_USERDEFINED):
return "_" + slab->ObjectType();
break;
case (IfcSlabTypeEnum::IfcSlabType_NOTDEFINED):
return "_NotDefined";
break;
default:
return "_Unknown";
break;
}
} }
void ColladaSerializer::ColladaExporter::endDocument() { void ColladaSerializer::ColladaExporter::endDocument() {
+19 -2
View File
@@ -127,17 +127,34 @@ private:
class DeferredObject { class DeferredObject {
friend bool operator < (const DeferredObject & def_obj1, const DeferredObject & def_obj2) friend bool operator < (const DeferredObject & def_obj1, const DeferredObject & def_obj2)
{ {
// Retrieve the parents of the objects to compare
const IfcGeom::Element<real_t>* parent1 = def_obj1.parent; const IfcGeom::Element<real_t>* parent1 = def_obj1.parent;
const IfcGeom::Element<real_t>* parent2 = def_obj2.parent; const IfcGeom::Element<real_t>* parent2 = def_obj2.parent;
// If a parent is null
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;
} }
// If both parent are not null
else else
{ {
bool res = parent1->name() < parent2->name() ? true : false; // Retrieve the IfcBuildingStorey
Ifc2x3::IfcBuildingStorey* storey1 = (Ifc2x3::IfcBuildingStorey*)parent1->product();
Ifc2x3::IfcBuildingStorey* storey2 = (Ifc2x3::IfcBuildingStorey*)parent2->product();
bool res = true;
// Check if the storeys both have an elevation value
if (storey1->hasElevation() && storey2->hasElevation())
{
// Use the elevation in order to sort
res = storey1->Elevation() > storey2->Elevation() ? true : false;
}
// If the evelations are not set, use the names to sort
else { 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
} }
} }