diff --git a/src/ifcconvert/SvgSerializer.cpp b/src/ifcconvert/SvgSerializer.cpp index e3e0a68b9a..7821cf519b 100644 --- a/src/ifcconvert/SvgSerializer.cpp +++ b/src/ifcconvert/SvgSerializer.cpp @@ -282,7 +282,7 @@ SvgSerializer::path_object& SvgSerializer::start_path(IfcSchema::IfcBuildingStor void SvgSerializer::write(const IfcGeom::BRepElement* o) { - IfcSchema::IfcBuildingStorey* storey = 0; + IfcSchema::IfcBuildingStorey* storey = storey_; boost::optional storey_elevation = boost::none; IfcSchema::IfcObjectDefinition* obdef = static_cast(file->entityById(o->id())); @@ -292,7 +292,7 @@ void SvgSerializer::write(const IfcGeom::BRepElement* o) typedef IfcSchema::IfcRelAggregates decomposition_element; #endif - for (;;) { + for (; storey == 0;) { // Iterate over the decomposing element to find the parent IfcBuildingStorey decomposition_element::list::ptr decomposes = obdef->Decomposes(); if (!decomposes->size()) { diff --git a/src/ifcconvert/SvgSerializer.h b/src/ifcconvert/SvgSerializer.h index 21de0107f7..8b242aaca3 100644 --- a/src/ifcconvert/SvgSerializer.h +++ b/src/ifcconvert/SvgSerializer.h @@ -42,6 +42,7 @@ protected: std::vector< boost::shared_ptr > ycoords; std::vector< boost::shared_ptr > radii; IfcParse::IfcFile* file; + IfcSchema::IfcBuildingStorey* storey_; public: SvgSerializer(const std::string& out_filename, const SerializerSettings& settings) : GeometrySerializer(settings) @@ -52,6 +53,7 @@ public: , ymax(-std::numeric_limits::infinity()) , rescale(false) , file(0) + , storey_(0) {} void addXCoordinate(const boost::shared_ptr& fi) { xcoords.push_back(fi); } void addYCoordinate(const boost::shared_ptr& fi) { ycoords.push_back(fi); } @@ -68,7 +70,7 @@ public: void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {} void setFile(IfcParse::IfcFile* f); void setBoundingRectangle(double width, double height); - void setSectionHeight(double h) { section_height = h; } + void setSectionHeight(double h, IfcSchema::IfcBuildingStorey* storey = 0) { section_height = h; storey_ = storey; } std::string nameElement(const IfcGeom::Element* elem); std::string nameElement(const IfcSchema::IfcProduct* elem); };