optional building storey argument added to setSectionHeight()

This commit is contained in:
Thomas Krijnen
2017-12-11 11:19:15 +01:00
parent ce782cc784
commit be5bd2e735
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -282,7 +282,7 @@ SvgSerializer::path_object& SvgSerializer::start_path(IfcSchema::IfcBuildingStor
void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* o)
{
IfcSchema::IfcBuildingStorey* storey = 0;
IfcSchema::IfcBuildingStorey* storey = storey_;
boost::optional<double> storey_elevation = boost::none;
IfcSchema::IfcObjectDefinition* obdef = static_cast<IfcSchema::IfcObjectDefinition*>(file->entityById(o->id()));
@@ -292,7 +292,7 @@ void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* 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()) {
+3 -1
View File
@@ -42,6 +42,7 @@ protected:
std::vector< boost::shared_ptr<util::string_buffer::float_item> > ycoords;
std::vector< boost::shared_ptr<util::string_buffer::float_item> > 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<double>::infinity())
, rescale(false)
, file(0)
, storey_(0)
{}
void addXCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
void addYCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& 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<real_t>* elem);
std::string nameElement(const IfcSchema::IfcProduct* elem);
};