SVG --storey-height-line-length

This commit is contained in:
Thomas Krijnen
2021-03-28 21:38:29 +02:00
parent 1ee488b148
commit f1d7cf1dfb
3 changed files with 14 additions and 2 deletions
+7
View File
@@ -386,6 +386,8 @@ int main(int argc, char** argv) {
("draw-storey-heights",
po::value<std::string>(&storey_height_display)->default_value("none")->implicit_value("full"),
"Draws a horizontal line at the height of building storeys in vertical drawings")
("storey-height-line-length", po::value<double>(),
"Length of the line when --draw-storey-heights=left")
("svg-xmlns",
"Stores name and guid in a separate namespace as opposed to data-name, data-guid")
("svg-poly",
@@ -1008,6 +1010,11 @@ int main(int argc, char** argv) {
if (relative_center_x && relative_center_y) {
static_cast<SvgSerializer*>(serializer.get())->setDrawingCenter(*relative_center_x, *relative_center_y);
}
if (vmap.count("storey-height-line-length")) {
static_cast<SvgSerializer*>(serializer.get())->setStoreyHeightLineLength(
vmap["storey-height-line-length"].as<double>()
);
}
}
if (convert_back_units) {
+5 -2
View File
@@ -1236,7 +1236,8 @@ void SvgSerializer::write(const geometry_data& data) {
auto d = (p1.XYZ() - p0.XYZ());
d.Normalize();
d *= 3;
const double shll = storey_height_line_length_.get_value_or(2.);
d *= shll;
gp_Pnt p1x(p0.XYZ() + d);
wire = BRepBuilderAPI_MakePolygon(p0, p1x).Wire();
@@ -1681,7 +1682,9 @@ void SvgSerializer::finalize() {
double x0, y0, z0, x1, y1, z1;
bnd_.Get(x0, y0, z0, x1, y1, z1);
BRepBuilderAPI_MakeFace mf(elev_pln, x0 - 1., x1 + 1., y0 - 1., y1 + 1.);
const double shll = storey_height_line_length_.get_value_or(2.);
BRepBuilderAPI_MakeFace mf(elev_pln, x0 - shll, x1 + shll, y0 - shll, y1 + shll);
gp_Trsf trsf;
TopoDS_Compound C;
BRep_Builder B;
+2
View File
@@ -137,6 +137,7 @@ protected:
boost::optional<std::vector<section_data>> section_data_;
boost::optional<std::vector<section_data>> deferred_section_data_;
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_;
bool with_section_heights_from_storey_, print_space_names_, print_space_areas_;
@@ -216,6 +217,7 @@ public:
void setPrintSpaceAreas(bool b) { print_space_areas_ = b; }
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; }
std::array<std::array<double, 3>, 3> resize();
void resetScale();