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
+26 -16
View File
@@ -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()));
@@ -373,20 +373,30 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
std::string ColladaSerializer::ColladaExporter::differentiateSlabTypes(const IfcGeom::TriangulationElement<real_t>* o) {
IfcSlab* slab = (IfcSlab*)o->product();
switch (slab->PredefinedType()){
case (IfcSlabTypeEnum::IfcSlabType_ROOF):
return "_Roof";
break;
case (IfcSlabTypeEnum::IfcSlabType_LANDING):
return "_Landing";
break;
case (IfcSlabTypeEnum::IfcSlabType_BASESLAB):
return "_BasesLab";
break;
default:
return "_Unknown";
break;
}
switch (slab->PredefinedType())
{
case (IfcSlabTypeEnum::IfcSlabType_FLOOR):
return "_Floor";
break;
case (IfcSlabTypeEnum::IfcSlabType_ROOF):
return "_Roof";
break;
case (IfcSlabTypeEnum::IfcSlabType_LANDING):
return "_Landing";
break;
case (IfcSlabTypeEnum::IfcSlabType_BASESLAB):
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() {
+19 -2
View File
@@ -127,17 +127,34 @@ private:
class DeferredObject {
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>* parent2 = def_obj2.parent;
// If a parent is 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;
}
// If both parent are not null
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;
}
}
+1
View File
@@ -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
}
}