Clean : remove debug lines

Find the floor of an element in the IfcGeomIterator class
This commit is contained in:
Balleux Benjamin
2017-04-21 15:49:34 +02:00
parent 7ce795def3
commit 95acd4c517
10 changed files with 243 additions and 51 deletions
+3 -8
View File
@@ -335,7 +335,7 @@ void ColladaSerializer::ColladaExporter::startDocument(const std::string& unit_n
asset.add();
}
void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* parent)
void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement<real_t>* o)
{
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
const std::string name = serializer->settings().get(SerializerSettings::USE_ELEMENT_GUIDS) ?
@@ -355,7 +355,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
DeferredObject defered = (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) ?
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(), *parent) :
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()));
deferreds.push_back(defered);
@@ -409,12 +409,7 @@ void ColladaSerializer::writeHeader() {
}
void ColladaSerializer::write(const IfcGeom::TriangulationElement<real_t>* o) {
exporter.write(o, NULL);
}
void ColladaSerializer::write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* parent)
{
exporter.write(o, parent);
exporter.write(o);
}
+1 -6
View File
@@ -129,18 +129,15 @@ private:
{
const IfcGeom::Element<real_t>* parent1 = def_obj1.parent;
const IfcGeom::Element<real_t>* parent2 = def_obj2.parent;
std::cout << "comparing..\n";
if (parent1 == NULL || parent2 == NULL)
{
bool res = (def_obj1.unique_id < def_obj2.unique_id ? true : false);
std::cout << "done\n";
return res;
}
else
{
bool res = parent1->name() < parent2->name() ? true : false;
std::cout << "done\n";
return res;
}
}
@@ -219,8 +216,7 @@ private:
std::vector<DeferredObject> deferreds;
virtual ~ColladaExporter() {}
void startDocument(const std::string& unit_name, float unit_magnitude);
void write(const IfcGeom::TriangulationElement<real_t>* o) {};
void write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* parent);
void write(const IfcGeom::TriangulationElement<real_t>* o);
void endDocument();
};
ColladaExporter exporter;
@@ -239,7 +235,6 @@ public:
bool ready();
void writeHeader();
void write(const IfcGeom::TriangulationElement<real_t>* o);
void write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* parent);
void write(const IfcGeom::BRepElement<real_t>* /*o*/) {}
void finalize();
bool isTesselated() const { return true; }
-1
View File
@@ -76,7 +76,6 @@ public:
virtual bool isTesselated() const = 0;
virtual void write(const IfcGeom::TriangulationElement<real_t>* o) = 0;
virtual void write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* element) = 0;
virtual void write(const IfcGeom::BRepElement<real_t>* o) = 0;
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0;
+4 -33
View File
@@ -467,6 +467,7 @@ int main(int argc, char** argv)
settings.set(IfcGeom::IteratorSettings::APPLY_LAYERSETS, enable_layerset_slicing);
settings.set(IfcGeom::IteratorSettings::NO_NORMALS, no_normals);
settings.set(IfcGeom::IteratorSettings::GENERATE_UVS, generate_uvs);
settings.set(IfcGeom::IteratorSettings::SEARCH_FLOOR, use_element_hierarchy);
settings.set(SerializerSettings::USE_ELEMENT_NAMES, use_element_names);
settings.set(SerializerSettings::USE_ELEMENT_GUIDS, use_element_guids);
@@ -588,43 +589,13 @@ int main(int argc, char** argv)
do {
IfcGeom::Element<real_t> *geom_object = context_iterator.get();
// if the target is a .dae file, get the parent of the object
if (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) && output_extension == ".dae" && geom_object->parent_id() != -1)
if (is_tesselated)
{
const IfcGeom::Element<real_t> *parent_object = NULL;
bool hasParent = true;
try { parent_object = context_iterator.getObject(geom_object->parent_id()); }
catch (std::exception e)
{
hasParent = false;
}
while (parent_object != NULL && parent_object->type() != "IfcBuildingStorey" && hasParent)
{
try { parent_object = context_iterator.getObject(parent_object->parent_id()); }
catch (std::exception e)
{
hasParent = false;
}
hasParent = hasParent && parent_object->parent_id() != 1;
}
serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object), parent_object);
//delete parent_object;
//parent_object = NULL;
serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object));
}
else
{
if (is_tesselated)
{
serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object));
}
else
{
serializer->write(static_cast<const IfcGeom::BRepElement<real_t>*>(geom_object));
}
serializer->write(static_cast<const IfcGeom::BRepElement<real_t>*>(geom_object));
}
const int progress = context_iterator.progress() / 2;
@@ -40,7 +40,6 @@ public:
bool ready();
virtual void writeShape(const TopoDS_Shape& shape) = 0;
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
void write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* parent) {}
void write(const IfcGeom::BRepElement<real_t>* o);
bool isTesselated() const { return false; }
void setFile(IfcParse::IfcFile*) {}
-1
View File
@@ -60,7 +60,6 @@ public:
void writeHeader();
bool ready();
void write(const IfcGeom::TriangulationElement<real_t>* /*o*/) {}
void write(const IfcGeom::TriangulationElement<real_t>* o, const IfcGeom::Element<real_t>* parent) {}
void write(const IfcGeom::BRepElement<real_t>* o);
void write(path_object& p, const TopoDS_Wire& wire);
path_object& start_path(IfcSchema::IfcBuildingStorey* storey, const std::string& id);