SVG --space-name-transform

This commit is contained in:
Thomas Krijnen
2021-03-28 22:16:58 +02:00
parent f1d7cf1dfb
commit 08ec3fc73f
3 changed files with 14 additions and 1 deletions
+7
View File
@@ -428,6 +428,8 @@ int main(int argc, char** argv) {
" and any other value means that 6 or 7 decimals are used.")
("print-space-names", "Prints IfcSpace LongName and Name in the geometry output. Applicable for SVG output")
("print-space-areas", "Prints calculated IfcSpace areas in square meters. Applicable for SVG output")
("space-name-transform", po::value<std::string>(),
"Additional transform to the space labels in SVG")
("edge-arrows", "Adds arrow heads to edge segments to signify edge direction")
;
@@ -1015,6 +1017,11 @@ int main(int argc, char** argv) {
vmap["storey-height-line-length"].as<double>()
);
}
if (vmap.count("space-name-transform")) {
static_cast<SvgSerializer*>(serializer.get())->setSpaceNameTransform(
vmap["space-name-transform"].as<std::string>()
);
}
}
if (convert_back_units) {
+5 -1
View File
@@ -1345,7 +1345,11 @@ void SvgSerializer::write(const geometry_data& data) {
xcoords.push_back(path.add(center_point->X()));
path.add("\" y=\"");
ycoords.push_back(path.add(center_point->Y()));
path.add("\">");
path.add("\"");
if (space_name_transform_) {
path.add(" transform=\"" + *space_name_transform_ + "\"");
}
path.add(">");
for (auto lit = labels.begin(); lit != labels.end(); ++lit) {
const auto& l = *lit;
double dy = labels.begin() == lit
+2
View File
@@ -139,6 +139,7 @@ protected:
boost::optional<double> scale_, calculated_scale_, center_x_, center_y_, scale_backup_;
boost::optional<double> storey_height_line_length_;
boost::optional<std::pair<double, double>> size_, size_backup_;
boost::optional<std::string> space_name_transform_;
bool with_section_heights_from_storey_, print_space_names_, print_space_areas_;
storey_height_display_types storey_height_display_;
@@ -218,6 +219,7 @@ public:
void setDrawStoreyHeights(storey_height_display_types sh) { storey_height_display_ = sh; }
void setDrawDoorArcs(bool b) { draw_door_arcs_ = b; }
void setStoreyHeightLineLength(double d) { storey_height_line_length_ = d; }
void setSpaceNameTransform(const std::string& v) { space_name_transform_ = v; }
std::array<std::array<double, 3>, 3> resize();
void resetScale();