--elevation-ref-guid setElevationRefGuid

This commit is contained in:
Thomas Krijnen
2021-08-08 18:06:58 +02:00
parent 7abccbd713
commit 2213b4e212
3 changed files with 22 additions and 5 deletions
+8 -3
View File
@@ -354,7 +354,7 @@ int main(int argc, char** argv) {
short precision;
double section_height;
std::string svg_scale, svg_center;
std::string section_ref, elevation_ref;
std::string section_ref, elevation_ref, elevation_ref_guid;
// "none", "full" or "left"
std::string storey_height_display;
SvgSerializer::storey_height_display_types svg_storey_height_display = SvgSerializer::SH_NONE;
@@ -376,9 +376,11 @@ int main(int argc, char** argv) {
"When using --scale, specifies the location in the range [0 1]x[0 1] around which"
"to center the drawings. Example 0.5x0.5 (default).")
("section-ref", po::value<std::string>(&section_ref),
"Element at which vertical cross sections should be created")
"Element at which cross sections should be created")
("elevation-ref", po::value<std::string>(&elevation_ref),
"Element at which vertical elevations should be created")
"Element at which drawings should be created")
("elevation-ref-guid", po::value<std::string>(&elevation_ref_guid),
"Element guids at which drawings should be created")
("auto-section",
"Creates SVG cross section drawings automatically based on model extents")
("auto-elevation",
@@ -1003,6 +1005,9 @@ int main(int argc, char** argv) {
if (vmap.count("elevation-ref")) {
static_cast<SvgSerializer*>(serializer.get())->setElevationRef(elevation_ref);
}
if (vmap.count("elevation-ref-guid")) {
static_cast<SvgSerializer*>(serializer.get())->setElevationRefGuid(elevation_ref_guid);
}
if (vmap.count("auto-section")) {
static_cast<SvgSerializer*>(serializer.get())->setAutoSection(true);
}
+6 -1
View File
@@ -543,7 +543,12 @@ void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* brep_obj) {
const gp_Trsf& trsf = brep_obj->transformation().data();
const bool is_section = (section_ref_ && object_type && *section_ref_ == *object_type);
const bool is_elevation = (elevation_ref_ && object_type && *elevation_ref_ == *object_type);
bool is_elevation = false;
if (elevation_ref_ && object_type) {
is_elevation = *elevation_ref_ == *object_type;
} else if (elevation_ref_guid_) {
is_elevation = *elevation_ref_guid_ == brep_obj->guid();
}
if (is_section || is_elevation) {
BRepBuilderAPI_Transform make_transform_global(compound_local, trsf, true);
+8 -1
View File
@@ -167,7 +167,7 @@ protected:
float_item_list xcoords, ycoords, radii;
size_t xcoords_begin, ycoords_begin, radii_begin;
boost::optional<std::string> section_ref_, elevation_ref_;
boost::optional<std::string> section_ref_, elevation_ref_, elevation_ref_guid_;
std::list<geometry_data> element_buffer_;
@@ -242,8 +242,15 @@ public:
void setSectionRef(const boost::optional<std::string>& s) {
section_ref_ = s;
}
void setElevationRef(const boost::optional<std::string>& s) {
elevation_ref_ = s;
elevation_ref_guid_ = boost::none;
}
void setElevationRefGuid(const boost::optional<std::string>& s) {
elevation_ref_ = boost::none;
elevation_ref_guid_ = s;
}
void setAutoSection(bool b) {