3333#include < cmath>
3434
3535using namespace IfcSchema ;
36- using namespace boost ::numeric::ublas;
3736
38- static void collada_id (std::string & s)
37+ static std::string& collada_id (std::string& s)
3938{
4039 IfcUtil::sanitate_material_name (s);
4140 IfcUtil::escape_xml (s);
41+ return s;
4242}
4343
4444void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource (const std::string& mesh_id,
@@ -270,6 +270,7 @@ void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::
270270 } else {
271271 name = parent.unique_id ();
272272 }
273+ collada_id (name);
273274
274275 const std::string& id = name;
275276
@@ -396,10 +397,18 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
396397 slabSuffix = differentiateSlabTypes (o);
397398 }
398399
399- const std::string name = serializer->settings ().get (SerializerSettings::USE_ELEMENT_GUIDS) ?
400- o->guid () : (serializer->settings ().get (SerializerSettings::USE_ELEMENT_NAMES) ?
401- o->name () : (serializer->settings ().get (SerializerSettings::USE_ELEMENT_TYPES) ? o->type () + slabSuffix : o->unique_id ()));
402- const std::string representation_id = " representation-" + o->geometry ().id ();
400+ std::string name = serializer->settings ().get (SerializerSettings::USE_ELEMENT_GUIDS)
401+ ? o->guid ()
402+ : (serializer->settings ().get (SerializerSettings::USE_ELEMENT_NAMES)
403+ ? o->name ()
404+ : (serializer->settings ().get (SerializerSettings::USE_ELEMENT_TYPES)
405+ ? (o->type () + slabSuffix)
406+ : o->unique_id ()));
407+ collada_id (name);
408+
409+ std::string representation_id = " representation-" + o->geometry ().id ();
410+ collada_id (representation_id);
411+
403412 std::vector<std::string> material_references;
404413 foreach (const IfcGeom::Material& material, mesh.materials ()) {
405414 if (!materials.contains (material)) {
@@ -423,28 +432,31 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
423432
424433std::string ColladaSerializer::ColladaExporter::differentiateSlabTypes (const IfcGeom::TriangulationElement<real_t >* o) {
425434 IfcSlab* slab = (IfcSlab*)o->product ();
435+ std::string result;
426436 switch (slab->PredefinedType ())
427437 {
428438 case (IfcSlabTypeEnum::IfcSlabType_FLOOR):
429- return " _Floor" ;
439+ result = " _Floor" ;
430440 break ;
431441 case (IfcSlabTypeEnum::IfcSlabType_ROOF):
432- return " _Roof" ;
442+ result = " _Roof" ;
433443 break ;
434444 case (IfcSlabTypeEnum::IfcSlabType_LANDING):
435- return " _Landing" ;
445+ result = " _Landing" ;
436446 break ;
437447 case (IfcSlabTypeEnum::IfcSlabType_BASESLAB):
438- return " _BaseSlab" ;
448+ result = " _BaseSlab" ;
439449 break ;
440450 case (IfcSlabTypeEnum::IfcSlabType_NOTDEFINED):
441- return " _NotDefined" ;
451+ result = " _NotDefined" ;
442452 break ;
443453 default :
444- if (slab->hasObjectType ()) { return " _" + slab->ObjectType (); }
445- else { return " _Unknown" ; }
454+ if (slab->hasObjectType ()) { result = " _" + slab->ObjectType (); }
455+ else { result = " _Unknown" ; }
446456 break ;
447457 }
458+ collada_id (result);
459+ return result;
448460}
449461
450462void ColladaSerializer::ColladaExporter::endDocument () {
@@ -532,7 +544,6 @@ void ColladaSerializer::write(const IfcGeom::TriangulationElement<real_t>* o) {
532544 exporter.write (o);
533545}
534546
535-
536547void ColladaSerializer::finalize () {
537548 exporter.endDocument ();
538549}
0 commit comments