diff --git a/src/ifcconvert/ColladaSerializer.cpp b/src/ifcconvert/ColladaSerializer.cpp index d5fb37c211..9b12842e59 100644 --- a/src/ifcconvert/ColladaSerializer.cpp +++ b/src/ifcconvert/ColladaSerializer.cpp @@ -251,7 +251,7 @@ void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom:: } void ColladaSerializer::ColladaExporter::ColladaScene::closeParent(){ - if (current_node != NULL) { std::cout << "current node is not null\n"; current_node->end(); } + if (current_node != NULL) { current_node->end(); } } void ColladaSerializer::ColladaExporter::ColladaScene::write() { @@ -340,7 +340,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme const IfcGeom::Representation::Triangulation& mesh = o->geometry(); const std::string name = serializer->settings().get(SerializerSettings::USE_ELEMENT_GUIDS) ? o->guid() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_NAMES) ? - o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() + "_" + o->name() : o->unique_id())); + o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() : o->unique_id())); const std::string representation_id = "representation-" + boost::lexical_cast(o->geometry().id()); std::vector material_references; foreach(const IfcGeom::Material& material, mesh.materials()) { @@ -364,7 +364,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme const IfcGeom::Representation::Triangulation& mesh = o->geometry(); const std::string name = serializer->settings().get(SerializerSettings::USE_ELEMENT_GUIDS) ? o->guid() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_NAMES) ? - o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() + "_" + o->name() : o->unique_id())); + o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() : o->unique_id())); const std::string representation_id = "representation-" + boost::lexical_cast(o->geometry().id()); std::vector material_references; foreach(const IfcGeom::Material& material, mesh.materials()) { @@ -389,12 +389,9 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme void ColladaSerializer::ColladaExporter::endDocument() { // In fact due the XML based nature of Collada and its dependency on library nodes, // only at this point all objects are written to the stream. - std::cout << "starting end document\n"; materials.write(); std::set geometries_written; - std::cout << "sorting defered list...\n"; std::sort(deferreds.begin(), deferreds.end()); - std::cout << "done\n"; for (std::vector::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it) { if (geometries_written.find(it->representation_id) != geometries_written.end()) { continue; @@ -408,34 +405,21 @@ void ColladaSerializer::ColladaExporter::endDocument() { for (std::vector::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it) { const std::string object_name = it->unique_id; - //std::cout << "working on " << it->unique_id; - //std::cout << (it->parent == NULL ? " parent is null\n" : "parent is not null\n"); + if (it->parent != NULL && parent_id != it->parent->id()) { - std::cout << "parent description : \n --- Type : " << it->parent->type() << " \n --- Name : " << it->parent->name() << "\n"; - //std::cout << "parent is not null. Id : " << it->parent->id() << '\n'; - //std::cout << "test if parent is empty ... \n"; if (!is_parent_empty) { - //std::cout << "close parent1 ... \n"; scene.closeParent(); - //std::cout << "done\n"; } - //std::cout << "get parent id .. \n"; parent_id = it->parent->id(); - //std::cout << "add parent to scene .. \n"; scene.addParent(*it->parent); - //std::cout << "done \n"; is_parent_empty = false; } - //std::cout << "add node to scene ... \n"; /// @todo redundant information using ID as both ID and Name, maybe omit Name or allow specifying what would be used as the name scene.add(object_name, object_name, it->representation_id, it->material_references, it->matrix); - //std::cout << "done \n"; } - std::cout << "close parent2 : \n"; if (!is_parent_empty) scene.closeParent(); - std::cout << "write : \n"; scene.write(); stream.endDocument(); } diff --git a/src/ifcconvert/GeometrySerializer.h b/src/ifcconvert/GeometrySerializer.h index 33345b4ad1..4a84a50322 100644 --- a/src/ifcconvert/GeometrySerializer.h +++ b/src/ifcconvert/GeometrySerializer.h @@ -43,7 +43,7 @@ public: /// Use material names instead of unique IDs for naming materials. /// Applicable for OBJ and DAE output. USE_MATERIAL_NAMES = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 3), - /// Use element types and names instead of unique IDs for naming elements. + /// Use element types instead of unique IDs for naming elements. /// Applicable for DAE output. USE_ELEMENT_TYPES = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 4), /// Order the elements using their IfcBuildingStorey parent diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index d2f720661a..d5dc39f06f 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -268,7 +268,7 @@ int main(int argc, char** argv) "Use material names instead of unique IDs for naming materials upon serialization. " "Applicable for OBJ and DAE output.") ("use-element-types", - "Use element types and names instead of unique IDs for naming elements upon serialization. " + "Use element types instead of unique IDs for naming elements upon serialization. " "Applicable for DAE output.") ("use-element-hierarchy", "Order the elements using their IfcBuildingStorey parent. " @@ -596,7 +596,6 @@ int main(int argc, char** argv) try { parent_object = context_iterator.getObject(geom_object->parent_id()); } catch (std::exception e) { - std::cout << e.what() << '\n'; hasParent = false; } @@ -605,15 +604,11 @@ int main(int argc, char** argv) try { parent_object = context_iterator.getObject(parent_object->parent_id()); } catch (std::exception e) { - std::cout << e.what() << '\n'; hasParent = false; } hasParent = hasParent && parent_object->parent_id() != 1; } - //Debug - //if (parent_object != NULL) std::cout << '\n' << "obj " << geom_object->unique_id() << " parent = " << parent_object->name() << " of type " << parent_object->type() << '\n'; - //else std::cout << "No parent found : " << geom_object->unique_id() << " of type : " << geom_object->type(); if (parent_object != NULL) serializer->write(static_cast*>(geom_object), parent_object); else serializer->write(static_cast*>(geom_object));