mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
#1153 svg subtraction settings
This commit is contained in:
@@ -926,7 +926,18 @@ void SvgSerializer::write(const geometry_data& data) {
|
|||||||
|
|
||||||
TopoDS_Shape* compound_to_hlr = &compound_to_use;
|
TopoDS_Shape* compound_to_hlr = &compound_to_use;
|
||||||
TopoDS_Shape subtracted_shape;
|
TopoDS_Shape subtracted_shape;
|
||||||
if (any_in_front && any_behind && data.product->declaration().is("IfcSlab") && is_floor_plan_) {
|
|
||||||
|
bool should_subtract = false;
|
||||||
|
|
||||||
|
if (subtraction_settings_ == ON_SLABS_AT_FLOORPLANS) {
|
||||||
|
should_subtract = data.product->declaration().is("IfcSlab") && is_floor_plan_;
|
||||||
|
} else if (subtraction_settings_ == ON_SLABS_AND_WALLS) {
|
||||||
|
should_subtract = data.product->declaration().is("IfcSlab") || data.product->declaration().is("IfcWall");
|
||||||
|
} else if (subtraction_settings_ == ALWAYS) {
|
||||||
|
should_subtract = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (any_in_front && any_behind && should_subtract) {
|
||||||
// This is currently only for slanted roof slabs on floor plans
|
// This is currently only for slanted roof slabs on floor plans
|
||||||
bool should_cut = false;
|
bool should_cut = false;
|
||||||
TopExp_Explorer exp(compound_to_use, TopAbs_FACE);
|
TopExp_Explorer exp(compound_to_use, TopAbs_FACE);
|
||||||
|
|||||||
@@ -123,6 +123,12 @@ struct drawing_meta {
|
|||||||
std::array<std::array<double, 3>, 3> matrix_3;
|
std::array<std::array<double, 3>, 3> matrix_3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum subtract_before_project {
|
||||||
|
ON_SLABS_AT_FLOORPLANS,
|
||||||
|
ON_SLABS_AND_WALLS,
|
||||||
|
ALWAYS
|
||||||
|
};
|
||||||
|
|
||||||
typedef boost::variant<
|
typedef boost::variant<
|
||||||
boost::blank,
|
boost::blank,
|
||||||
Handle(HLRBRep_Algo),
|
Handle(HLRBRep_Algo),
|
||||||
@@ -182,6 +188,8 @@ protected:
|
|||||||
|
|
||||||
void draw_hlr(const gp_Pln& pln, const drawing_key& drawing_name);
|
void draw_hlr(const gp_Pln& pln, const drawing_key& drawing_name);
|
||||||
|
|
||||||
|
subtract_before_project subtraction_settings_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SvgSerializer(const stream_or_filename& out_filename, const SerializerSettings& settings)
|
SvgSerializer(const stream_or_filename& out_filename, const SerializerSettings& settings)
|
||||||
: WriteOnlyGeometrySerializer(settings)
|
: WriteOnlyGeometrySerializer(settings)
|
||||||
@@ -210,6 +218,7 @@ public:
|
|||||||
, ycoords_begin(0)
|
, ycoords_begin(0)
|
||||||
, radii_begin(0)
|
, radii_begin(0)
|
||||||
, namespace_prefix_("data-")
|
, namespace_prefix_("data-")
|
||||||
|
, subtraction_settings_(ON_SLABS_AT_FLOORPLANS)
|
||||||
{}
|
{}
|
||||||
void addXCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
|
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); }
|
void addYCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
|
||||||
@@ -309,6 +318,14 @@ public:
|
|||||||
deferred_section_data_->push_back(vertical_section{ gp_Pln(gp_Ax3(pos, dir, ref)), name, include_projection });
|
deferred_section_data_->push_back(vertical_section{ gp_Pln(gp_Ax3(pos, dir, ref)), name, include_projection });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSubtractionSettings(subtract_before_project sbp) {
|
||||||
|
subtraction_settings_ = sbp;
|
||||||
|
}
|
||||||
|
|
||||||
|
subtract_before_project getSubtractionSettings() const {
|
||||||
|
return subtraction_settings_;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string writeMetadata(const drawing_meta& m);
|
std::string writeMetadata(const drawing_meta& m);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user