Feature : Retrieve the full hierarchy. Fix the placement of the objects.

Check slab->HasObjectType before using slab->ObjectType
This commit is contained in:
Balleux Benjamin
2017-05-16 14:27:36 +02:00
parent 45ec08f840
commit 942d34ee39
2 changed files with 37 additions and 36 deletions
+14 -2
View File
@@ -86,13 +86,25 @@ namespace IfcGeom {
friend bool operator == (const Element<P> & element1, const Element<P> & element2)
{
//std::cout << " //// Compare == " << element1.name() << element1.id() << " | " << element1.type() << " and " << element2.name() << element2.id() << " | " << element2.type() << "\n";
return element1.id() == element2.id();
}
// Use the id to compare, or the elevation is the elements are IfcBuildingStoreys and the elevation is set
friend bool operator < (const Element<P> & element1, const Element<P> & element2)
{
//std::cout << " //// Compare < " << element1.name() << element1.id() << " | " << element1.type() << " and " << element2.name() << element2.id() << " | " << element2.type() << "\n";
if (element1.type() == "IfcBuildingStorey" && element2.type() == "IfcBuildingStorey")
{
IfcSchema::IfcBuildingStorey* storey1 = NULL;
IfcSchema::IfcBuildingStorey* storey2 = NULL;
storey1 = (IfcSchema::IfcBuildingStorey*)element1.product();
storey2 = (IfcSchema::IfcBuildingStorey*)element2.product();
if (storey1 != NULL && storey2 != NULL && storey1->hasElevation() && storey2->hasElevation())
{
return storey1->Elevation() < storey2->Elevation();
}
}
return element1.id() < element2.id();
}