Silence remaining compiler warnings

Generated with the assistance of an AI coding tool.
This commit is contained in:
Thomas Krijnen
2026-08-09 09:04:28 +02:00
parent dcfc22e29e
commit 28c9c1d34d
24 changed files with 140 additions and 213 deletions
+7 -9
View File
@@ -396,8 +396,6 @@ int main(int argc, char** argv) {
#ifdef HAVE_ICU #ifdef HAVE_ICU
std::string unicode_mode; std::string unicode_mode;
#endif #endif
short precision;
po::options_description serializer_options("Serialization options"); po::options_description serializer_options("Serialization options");
serializer_options.add_options() serializer_options.add_options()
#ifdef HAVE_ICU #ifdef HAVE_ICU
@@ -807,7 +805,7 @@ int main(int argc, char** argv) {
if (model_rotation) { if (model_rotation) {
std::vector<double> rotation(4); std::vector<double> rotation(4);
int n = 0; int n = 0;
if (sscanf(rotation_str.c_str(), "%lf;%lf;%lf;%lf %n", &rotation[0], &rotation[1], &rotation[2], &rotation[3], &n) != 4 || n != rotation_str.size()) { if (sscanf(rotation_str.c_str(), "%lf;%lf;%lf;%lf %n", &rotation[0], &rotation[1], &rotation[2], &rotation[3], &n) != 4 || static_cast<std::size_t>(n) != rotation_str.size()) {
cerr_ << "[error] Invalid use of --model-rotation\n"; cerr_ << "[error] Invalid use of --model-rotation\n";
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
print_options(serializer_options); print_options(serializer_options);
@@ -828,7 +826,7 @@ int main(int argc, char** argv) {
if (model_offset && !(center_model || center_model_geometry)) { if (model_offset && !(center_model || center_model_geometry)) {
std::vector<double> offset(3); std::vector<double> offset(3);
int n = 0; int n = 0;
if (sscanf(offset_str.c_str(), "%lf;%lf;%lf %n", &offset[0], &offset[1], &offset[2], &n) != 3 || n != offset_str.size()) { if (sscanf(offset_str.c_str(), "%lf;%lf;%lf %n", &offset[0], &offset[1], &offset[2], &n) != 3 || static_cast<std::size_t>(n) != offset_str.size()) {
cerr_ << "[error] Invalid use of --model-offset\n"; cerr_ << "[error] Invalid use of --model-offset\n";
ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename)); ifcopenshell::path::delete_file(ifcopenshell::path::to_utf8(output_temp_filename));
print_options(serializer_options); print_options(serializer_options);
@@ -847,8 +845,8 @@ int main(int argc, char** argv) {
ifcopenshell::geom::iterator tmp_context_iterator(ifcopenshell::geom::kernels::construct(ifc_file, geometry_kernel, settings), settings, ifc_file, filter_funcs, num_threads, logger); ifcopenshell::geom::iterator tmp_context_iterator(ifcopenshell::geom::kernels::construct(ifc_file, geometry_kernel, settings), settings, ifc_file, filter_funcs, num_threads, logger);
time_t start, end; time_t bounds_start, bounds_end;
time(&start); time(&bounds_start);
if (!quiet) logger.status("Computing bounds..."); if (!quiet) logger.status("Computing bounds...");
if (center_model_geometry) { if (center_model_geometry) {
@@ -865,8 +863,8 @@ int main(int argc, char** argv) {
tmp_context_iterator.compute_bounds(center_model_geometry); tmp_context_iterator.compute_bounds(center_model_geometry);
time(&end); time(&bounds_end);
if (!quiet) logger.status("Done ! Bounds computed in " + format_duration(start, end)); if (!quiet) logger.status("Done ! Bounds computed in " + format_duration(bounds_start, bounds_end));
auto center = (tmp_context_iterator.bounds_min().ccomponents() + tmp_context_iterator.bounds_max().ccomponents()) * 0.5; auto center = (tmp_context_iterator.bounds_min().ccomponents() + tmp_context_iterator.bounds_max().ccomponents()) * 0.5;
offset[0] = -center(0); offset[0] = -center(0);
@@ -1204,7 +1202,7 @@ void parse_filter(geom_filter &filter, const std::vector<std::string>& values)
filter.values.insert(values.begin() + (filter.type == geom_filter::ENTITY_ARG ? 2 : 1), values.end()); filter.values.insert(values.begin() + (filter.type == geom_filter::ENTITY_ARG ? 2 : 1), values.end());
} }
void validate(boost::any& v, const std::vector<std::string>& values, verbosity_counter*, long) { void validate(boost::any& v, const std::vector<std::string>&, verbosity_counter*, long) {
if (v.empty()) v = verbosity_counter{ 1 }; if (v.empty()) v = verbosity_counter{ 1 };
else ++boost::any_cast<verbosity_counter&>(v).count; else ++boost::any_cast<verbosity_counter&>(v).count;
} }
@@ -6,46 +6,6 @@
using namespace ifcopenshell::geom; using namespace ifcopenshell::geom;
using namespace ifcopenshell::geom::kernels; using namespace ifcopenshell::geom::kernels;
// @todo should we reapply the technique to apply openings in batches?
namespace {
struct opening_sorter {
bool operator()(const std::pair<double, TopoDS_Shape>& a, const std::pair<double, TopoDS_Shape>& b) const {
return a.first > b.first;
}
};
bool apply_in_batches(ifcopenshell::geom::util::boolean_settings bst, const TopoDS_Shape& first_operand, std::vector< std::pair<double, TopoDS_Shape> >& opening_vector, BOPAlgo_Operation occ_op, TopoDS_Shape& result) {
auto it = opening_vector.begin();
auto jt = it;
result = first_operand;
for (;; ++it) {
if (it == opening_vector.end() || jt->first / it->first > 10.) {
NCollection_List<TopoDS_Shape> opening_list;
for (auto kt = jt; kt < it; ++kt) {
opening_list.Append(kt->second);
}
TopoDS_Shape intermediate_result;
if (ifcopenshell::geom::util::boolean_operation(bst, result, opening_list, occ_op, intermediate_result)) {
result = intermediate_result;
} else {
return false;
}
jt = it;
}
if (it == opening_vector.end()) {
break;
}
}
return true;
}
}
namespace { namespace {
BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_type t) { BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_type t) {
switch (t) { switch (t) {
@@ -53,6 +13,7 @@ namespace {
case taxonomy::boolean_result::INTERSECTION: return BOPAlgo_COMMON; case taxonomy::boolean_result::INTERSECTION: return BOPAlgo_COMMON;
case taxonomy::boolean_result::SUBTRACTION: return BOPAlgo_CUT; case taxonomy::boolean_result::SUBTRACTION: return BOPAlgo_CUT;
} }
throw std::invalid_argument("Unsupported boolean operation");
} }
bool get_single_child(const TopoDS_Shape& s, TopoDS_Shape& child) { bool get_single_child(const TopoDS_Shape& s, TopoDS_Shape& child) {
@@ -310,13 +310,13 @@ bool ifcopenshell::geom::util::is_extrusion(const gp_Vec & v, const TopoDS_Shape
// top face. When neither of these categories the shape is not a extrusion // top face. When neither of these categories the shape is not a extrusion
// or the extrusion direction is not orthogonal to its basis. // or the extrusion direction is not orthogonal to its basis.
for (int i = 1; i < mapping.Extent(); ++i) { for (int i = 1; i < mapping.Extent(); ++i) {
auto& s = mapping.FindKey(i); auto& shape = mapping.FindKey(i);
if (s.ShapeType() != TopAbs_EDGE) { if (shape.ShapeType() != TopAbs_EDGE) {
continue; continue;
} }
// @todo use a linear tolernace and the face extrimities, see #2218 // @todo use a linear tolernace and the face extrimities, see #2218
const TopoDS_Edge& e = TopoDS::Edge(s); const TopoDS_Edge& e = TopoDS::Edge(shape);
if (!get_edge_axis(e, ax)) { if (!get_edge_axis(e, ax)) {
// curved // curved
curved_orthogonal.Add(e); curved_orthogonal.Add(e);
@@ -585,7 +585,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
std::map<int, int> edge_index_to_shape_index; std::map<int, int> edge_index_to_shape_index;
std::vector<TopoDS_Shape> shapes; std::vector<TopoDS_Shape> shapes;
std::vector<std::pair<size_t, TopoDS_Edge>> edges; std::vector<std::pair<int, TopoDS_Edge>> edges;
// First is the outer wire // First is the outer wire
std::vector<TopoDS_Wire> wires; std::vector<TopoDS_Wire> wires;
@@ -646,19 +646,19 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
BRepBndLib::Add(exp.Current(), b); BRepBndLib::Add(exp.Current(), b);
b.Enlarge(eps); b.Enlarge(eps);
for (auto& i : edge_tree.select_box(b)) { for (auto& candidate_index : edge_tree.select_box(b)) {
if (i == edge_index) { if (candidate_index == edge_index) {
// Skip self-selection // Skip self-selection
continue; continue;
} }
if (edges[i].first == shape_index) { if (edges[candidate_index].first == shape_index) {
// Skip edges of the same operand // Skip edges of the same operand
continue; continue;
} }
const TopoDS_Edge& e0 = TopoDS::Edge(exp.Current()); const TopoDS_Edge& e0 = TopoDS::Edge(exp.Current());
const TopoDS_Edge& e1 = edges[i].second; const TopoDS_Edge& e1 = edges[candidate_index].second;
double u11, u12, u21, u22, U1, U2; double u11, u12, u21, u22, U1, U2;
@@ -670,9 +670,9 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
if (!ecc.Extrema().IsParallel() && ecc.NbExtrema() >= 1) { if (!ecc.Extrema().IsParallel() && ecc.NbExtrema() >= 1) {
// @todo: extend this to work in case of multiple extrema and curved segments. // @todo: extend this to work in case of multiple extrema and curved segments.
for (int i = 1; i <= ecc.NbExtrema(); ++i) { for (int extrema_index = 1; extrema_index <= ecc.NbExtrema(); ++extrema_index) {
gp_Pnt p1, p2; gp_Pnt p1, p2;
ecc.Points(i, p1, p2); ecc.Points(extrema_index, p1, p2);
// #3616 Only take into account orthogonal distance between closest points on curve // #3616 Only take into account orthogonal distance between closest points on curve
// to see whether inside tolerance. Current DY is hardcoded. The sensible default // to see whether inside tolerance. Current DY is hardcoded. The sensible default
@@ -685,7 +685,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
const bool unbounded_intersects = ortho_distance < eps; const bool unbounded_intersects = ortho_distance < eps;
if (unbounded_intersects) { if (unbounded_intersects) {
ecc.Parameters(i, U1, U2); ecc.Parameters(extrema_index, U1, U2);
if (u11 > u12) { if (u11 > u12) {
std::swap(u11, u12); std::swap(u11, u12);
@@ -734,10 +734,10 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
} }
// First check for containment in outer wire // First check for containment in outer wire
for (auto it = ++wires.begin(); it != wires.end(); ++it) { for (auto wire_it = ++wires.begin(); wire_it != wires.end(); ++wire_it) {
// Considering a single vertex is sufficient because we have already // Considering a single vertex is sufficient because we have already
// guaranteed that the edges of different operands do not cross. // guaranteed that the edges of different operands do not cross.
TopoDS_Iterator it_ed(*it); TopoDS_Iterator it_ed(*wire_it);
auto& ed = it_ed.Value(); auto& ed = it_ed.Value();
TopoDS_Iterator it_v(ed); TopoDS_Iterator it_v(ed);
@@ -749,7 +749,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
// A wire is not contained in the outer wire, it's a subtraction without // A wire is not contained in the outer wire, it's a subtraction without
// any effect and marked as redundant. Feeding it to the builder algo // any effect and marked as redundant. Feeding it to the builder algo
// will likely cause problems. // will likely cause problems.
redundant[std::distance(wires.begin(), it)] = true; redundant[std::distance(wires.begin(), wire_it)] = true;
logger.notice("GEO", 124, "Subtraction operand outside of outer bound"); logger.notice("GEO", 124, "Subtraction operand outside of outer bound");
} }
} }
@@ -758,7 +758,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
// NB first wire is *not* in this tree // NB first wire is *not* in this tree
ifcopenshell::geom::impl::tree<int> wire_tree; ifcopenshell::geom::impl::tree<int> wire_tree;
for (size_t wire_index = 1; wire_index < wires.size(); ++wire_index) { for (size_t wire_index = 1; wire_index < wires.size(); ++wire_index) {
wire_tree.add(wire_index, wires[wire_index]); wire_tree.add(static_cast<int>(wire_index), wires[wire_index]);
} }
for (size_t wire_index = 1; wire_index < wires.size(); ++wire_index) { for (size_t wire_index = 1; wire_index < wires.size(); ++wire_index) {
@@ -775,7 +775,7 @@ bool ifcopenshell::geom::util::boolean_subtraction_2d_using_builder(const TopoDS
// than the second element. // than the second element.
for (auto& other_index : wire_tree.select_box(b, true)) { for (auto& other_index : wire_tree.select_box(b, true)) {
// other_index is fully contained in wire_index // other_index is fully contained in wire_index
if (wire_index == other_index) { if (wire_index == static_cast<size_t>(other_index)) {
continue; continue;
} }
@@ -1144,21 +1144,7 @@ bool ifcopenshell::geom::util::boolean_operation(const boolean_settings& setting
builder->Build(); builder->Build();
} }
if (builder->IsDone()) { if (builder->IsDone()) {
if (false && builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection))) { if (builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
settings.log().notice("GEO", 144, "Builder reports self-intersection in output");
success = false;
/*
const auto& ws = builder->DSFiller()->GetReport()->GetAlerts(Message_Warning);
for (const auto& w : ws) {
if (w->DynamicType() == STANDARD_TYPE(BOPAlgo_AlertAcquiredSelfIntersection)) {
const auto& x = Handle(BOPAlgo_AlertAcquiredSelfIntersection)::DownCast(w)->GetShape();
BRepTools::Write(x, "debug_x.brep");
BRepTools::Write(*builder, "debug_r.brep");
}
}
*/
} else if(builder->DSFiller()->HasWarning(STANDARD_TYPE(BOPAlgo_AlertBadPositioning)) && !TopoDS_Iterator(*builder).More()) {
settings.log().notice("GEO", 145, "Builder reports bad positioning and result is empty"); settings.log().notice("GEO", 145, "Builder reports bad positioning and result is empty");
success = false; success = false;
} else { } else {
+1 -1
View File
@@ -27,7 +27,7 @@
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS_iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <ShapeFix_Shape.hxx> #include <ShapeFix_Shape.hxx>
#include <ShapeFix_ShapeTolerance.hxx> #include <ShapeFix_ShapeTolerance.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@@ -3,7 +3,7 @@
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <Geom_Line.hxx> #include <Geom_Line.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <TopoDS_iterator.hxx> #include <TopoDS_Iterator.hxx>
/* Returns whether wire conforms to a polyhedron, i.e. only edges with linear curves*/ /* Returns whether wire conforms to a polyhedron, i.e. only edges with linear curves*/
bool ifcopenshell::geom::util::is_polyhedron(const TopoDS_Wire & wire) { bool ifcopenshell::geom::util::is_polyhedron(const TopoDS_Wire & wire) {
@@ -65,7 +65,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper(
gp_Pnt* p = new gp_Pnt(convert_xyz<gp_Pnt>(*points[i])); gp_Pnt* p = new gp_Pnt(convert_xyz<gp_Pnt>(*points[i]));
pnts[i].reset(p); pnts[i].reset(p);
B.MakeVertex(vertices[i], *p, ::Precision::Confusion()); B.MakeVertex(vertices[i], *p, ::Precision::Confusion());
tree.add(i, vertices[i]); tree.add(static_cast<int>(i), vertices[i]);
box.Add(*p); box.Add(*p);
} }
@@ -148,7 +148,7 @@ ifcopenshell::geom::open_cascade_kernel::faceset_helper::faceset_helper(
auto num_retained = std::count(retained.begin(), retained.end(), true); auto num_retained = std::count(retained.begin(), retained.end(), true);
if (unique.size() != num_retained) { if (unique.size() != static_cast<size_t>(num_retained)) {
ifcopenshell::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained)); ifcopenshell::logger::root().notice("GEO", 168, "Collapsed vertices from " + std::to_string(pnts.size()) + " (" + std::to_string(unique.size()) + " unique) to " + std::to_string(num_retained));
} }
+1 -1
View File
@@ -11,7 +11,7 @@
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Solid.hxx> #include <TopoDS_Solid.hxx>
#include <TopoDS_Shell.hxx> #include <TopoDS_Shell.hxx>
#include <TopoDS_iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
+49 -49
View File
@@ -151,9 +151,9 @@ namespace ifcopenshell::geom {
bool should_check_again = false bool should_check_again = false
) const { ) const {
ray v_ray; ray v_ray;
v_ray.origin[0] = v.X(); v_ray.origin[0] = static_cast<float>(v.X());
v_ray.origin[1] = v.Y(); v_ray.origin[1] = static_cast<float>(v.Y());
v_ray.origin[2] = v.Z(); v_ray.origin[2] = static_cast<float>(v.Z());
if (should_check_again) { if (should_check_again) {
// The first check may be incorrect if it intersects // The first check may be incorrect if it intersects
@@ -194,12 +194,12 @@ namespace ifcopenshell::geom {
box box; box box;
// + 1e-5 for tolerance // + 1e-5 for tolerance
box.corners[0][0] = min_point[0] - 1e-5; box.corners[0][0] = static_cast<float>(min_point[0] - 1e-5);
box.corners[0][1] = min_point[1] - 1e-5; box.corners[0][1] = static_cast<float>(min_point[1] - 1e-5);
box.corners[0][2] = min_point[2] - 1e-5; box.corners[0][2] = static_cast<float>(min_point[2] - 1e-5);
box.corners[1][0] = max_point[0] + 1e-5; box.corners[1][0] = static_cast<float>(max_point[0] + 1e-5);
box.corners[1][1] = max_point[1] + 1e-5; box.corners[1][1] = static_cast<float>(max_point[1] + 1e-5);
box.corners[1][2] = max_point[2] + 1e-5; box.corners[1][2] = static_cast<float>(max_point[2] + 1e-5);
/* /*
std::cout << "Ray " std::cout << "Ray "
<< v_ray.origin[0] << " " << v_ray.origin[0] << " "
@@ -273,22 +273,22 @@ namespace ifcopenshell::geom {
gp_Vec ray_vector = e2 - e1; gp_Vec ray_vector = e2 - e1;
double edge_length = ray_vector.Magnitude(); double edge_length = ray_vector.Magnitude();
std::array<double, 3> min_int; std::array<double, 3> min_int{};
std::array<double, 3> max_int; std::array<double, 3> max_int{};
ray_vector.Normalize(); ray_vector.Normalize();
ray v_ray; ray v_ray;
v_ray.origin[0] = ray_origin.X(); v_ray.origin[0] = static_cast<float>(ray_origin.X());
v_ray.origin[1] = ray_origin.Y(); v_ray.origin[1] = static_cast<float>(ray_origin.Y());
v_ray.origin[2] = ray_origin.Z(); v_ray.origin[2] = static_cast<float>(ray_origin.Z());
v_ray.dir[0] = ray_vector.X(); v_ray.dir[0] = static_cast<float>(ray_vector.X());
v_ray.dir[1] = ray_vector.Y(); v_ray.dir[1] = static_cast<float>(ray_vector.Y());
v_ray.dir[2] = ray_vector.Z(); v_ray.dir[2] = static_cast<float>(ray_vector.Z());
v_ray.dir_inv[0] = 1.0f / ray_vector.X(); v_ray.dir_inv[0] = static_cast<float>(1.0 / ray_vector.X());
v_ray.dir_inv[1] = 1.0f / ray_vector.Y(); v_ray.dir_inv[1] = static_cast<float>(1.0 / ray_vector.Y());
v_ray.dir_inv[2] = 1.0f / ray_vector.Z(); v_ray.dir_inv[2] = static_cast<float>(1.0 / ray_vector.Z());
double min_distance = std::numeric_limits<double>::infinity(); double min_distance = std::numeric_limits<double>::infinity();
double max_distance = -std::numeric_limits<double>::infinity(); double max_distance = -std::numeric_limits<double>::infinity();
@@ -305,12 +305,12 @@ namespace ifcopenshell::geom {
box box; box box;
// + 1e-5 for tolerance // + 1e-5 for tolerance
box.corners[0][0] = min_point[0] - 1e-5; box.corners[0][0] = static_cast<float>(min_point[0] - 1e-5);
box.corners[0][1] = min_point[1] - 1e-5; box.corners[0][1] = static_cast<float>(min_point[1] - 1e-5);
box.corners[0][2] = min_point[2] - 1e-5; box.corners[0][2] = static_cast<float>(min_point[2] - 1e-5);
box.corners[1][0] = max_point[0] + 1e-5; box.corners[1][0] = static_cast<float>(max_point[0] + 1e-5);
box.corners[1][1] = max_point[1] + 1e-5; box.corners[1][1] = static_cast<float>(max_point[1] + 1e-5);
box.corners[1][2] = max_point[2] + 1e-5; box.corners[1][2] = static_cast<float>(max_point[2] + 1e-5);
if ( ! is_intersect_ray_box(&v_ray, &box)) { if ( ! is_intersect_ray_box(&v_ray, &box)) {
continue; continue;
@@ -491,12 +491,12 @@ namespace ifcopenshell::geom {
std::unordered_set<int> points_not_in_b_cache; std::unordered_set<int> points_not_in_b_cache;
double protrusion = -std::numeric_limits<double>::infinity(); double protrusion = -std::numeric_limits<double>::infinity();
std::array<double, 3> protrusion_point; std::array<double, 3> protrusion_point{};
std::array<double, 3> surface_point; std::array<double, 3> surface_point{};
double pierce = -std::numeric_limits<double>::infinity(); double pierce = -std::numeric_limits<double>::infinity();
std::array<double, 3> pierce_point1; std::array<double, 3> pierce_point1{};
std::array<double, 3> pierce_point2; std::array<double, 3> pierce_point2{};
for (const auto& pair : bvh_clashes) { for (const auto& pair : bvh_clashes) {
const int bvh_a_i = pair.first; const int bvh_a_i = pair.first;
@@ -573,14 +573,14 @@ namespace ifcopenshell::geom {
const gp_Vec& normal_a = normals_a[i]; const gp_Vec& normal_a = normals_a[i];
double v_protrusion = std::numeric_limits<double>::infinity(); double v_protrusion = std::numeric_limits<double>::infinity();
std::array<double, 3> v_protrusion_point; std::array<double, 3> v_protrusion_point{};
std::array<double, 3> v_surface_point; std::array<double, 3> v_surface_point{};
// Check for protrusions. // Check for protrusions.
for (const auto& bvh_b_i : bvh_b_is) { for (const auto& bvh_b_i : bvh_b_is) {
for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) { for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) {
const std::array<int, 3>& tri = tris_b[j]; const std::array<int, 3>& tri_b = tris_b[j];
const gp_Vec& normal_b = normals_b[j]; const gp_Vec& normal_b = normals_b[j];
tri_count_++; tri_count_++;
@@ -591,9 +591,9 @@ namespace ifcopenshell::geom {
continue; continue;
} }
gp_Vec ta(verts_b[tri[0]].XYZ()); gp_Vec ta(verts_b[tri_b[0]].XYZ());
gp_Vec tb(verts_b[tri[1]].XYZ()); gp_Vec tb(verts_b[tri_b[1]].XYZ());
gp_Vec tc(verts_b[tri[2]].XYZ()); gp_Vec tc(verts_b[tri_b[2]].XYZ());
for (const auto& v : points_in_b) { for (const auto& v : points_in_b) {
gp_Vec ray_origin(v.XYZ()); gp_Vec ray_origin(v.XYZ());
@@ -688,10 +688,10 @@ namespace ifcopenshell::geom {
for (const auto& bvh_b_i : bvh_b_is) { for (const auto& bvh_b_i : bvh_b_is) {
for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) { for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) {
const std::array<int, 3>& tri = tris_b[j]; const std::array<int, 3>& tri_b = tris_b[j];
const gp_Pnt& v1_b_pnt = verts_b[tri[0]]; const gp_Pnt& v1_b_pnt = verts_b[tri_b[0]];
const gp_Pnt& v2_b_pnt = verts_b[tri[1]]; const gp_Pnt& v2_b_pnt = verts_b[tri_b[1]];
const gp_Pnt& v3_b_pnt = verts_b[tri[2]]; const gp_Pnt& v3_b_pnt = verts_b[tri_b[2]];
const gp_Vec& normal_b = normals_b[j]; const gp_Vec& normal_b = normals_b[j];
tri_count_++; tri_count_++;
@@ -795,8 +795,8 @@ namespace ifcopenshell::geom {
const std::vector<gp_Pnt>& verts_b = verts_.find(tB)->second; const std::vector<gp_Pnt>& verts_b = verts_.find(tB)->second;
double min_clearance = std::numeric_limits<double>::infinity(); double min_clearance = std::numeric_limits<double>::infinity();
std::array<double, 3> clearance_point1; std::array<double, 3> clearance_point1{};
std::array<double, 3> clearance_point2; std::array<double, 3> clearance_point2{};
for (const auto& pair : bvh_clashes) { for (const auto& pair : bvh_clashes) {
const int bvh_a_i = pair.first; const int bvh_a_i = pair.first;
@@ -816,10 +816,10 @@ namespace ifcopenshell::geom {
for (const auto& bvh_b_i : bvh_b_is) { for (const auto& bvh_b_i : bvh_b_is) {
for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) { for (int j=bvh_b->BegPrimitive(bvh_b_i); j<=bvh_b->EndPrimitive(bvh_b_i); ++j) {
const std::array<int, 3>& tri = tris_b[j]; const std::array<int, 3>& tri_b = tris_b[j];
const gp_Pnt& v1_b_pnt = verts_b[tri[0]]; const gp_Pnt& v1_b_pnt = verts_b[tri_b[0]];
const gp_Pnt& v2_b_pnt = verts_b[tri[1]]; const gp_Pnt& v2_b_pnt = verts_b[tri_b[1]];
const gp_Pnt& v3_b_pnt = verts_b[tri[2]]; const gp_Pnt& v3_b_pnt = verts_b[tri_b[2]];
tri_count_++; tri_count_++;
@@ -1690,7 +1690,7 @@ namespace ifcopenshell::geom {
const auto builder = new BVH_LinearBuilder<double, 3>(BVH_Constants_LeafNodeSizeDefault, BVH_Constants_MaxTreeDepth); const auto builder = new BVH_LinearBuilder<double, 3>(BVH_Constants_LeafNodeSizeDefault, BVH_Constants_MaxTreeDepth);
BVH_Triangulation<double, 3> triangulation(builder); BVH_Triangulation<double, 3> triangulation(builder);
for (int i = 0; i < elem_verts.size(); i += 3) { for (size_t i = 0; i < elem_verts.size(); i += 3) {
#if OCC_VERSION_HEX >= 0x80000 #if OCC_VERSION_HEX >= 0x80000
triangulation.Vertices.Append(BVH_Vec3d(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2])); triangulation.Vertices.Append(BVH_Vec3d(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
#else #else
@@ -1699,7 +1699,7 @@ namespace ifcopenshell::geom {
verts.push_back(gp_Pnt(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2])); verts.push_back(gp_Pnt(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
} }
for (int i = 0; i < elem_faces.size(); i += 3) { for (size_t i = 0; i < elem_faces.size(); i += 3) {
const auto& v1_pnt = verts[elem_faces[i]]; const auto& v1_pnt = verts[elem_faces[i]];
const auto& v2_pnt = verts[elem_faces[i + 1]]; const auto& v2_pnt = verts[elem_faces[i + 1]];
const auto& v3_pnt = verts[elem_faces[i + 2]]; const auto& v3_pnt = verts[elem_faces[i + 2]];
@@ -9,7 +9,7 @@
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <ShapeFix_Wire.hxx> #include <ShapeFix_Wire.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepTools_WireExplorer.hxx> #include <BRepTools_WireExplorer.hxx>
@@ -218,11 +218,11 @@ ifcopenshell::geom::util::triangulate_wire_result ifcopenshell::geom::util::tria
if (!tri.IsNull()) { if (!tri.IsNull()) {
const NCollection_Array1<Poly_Triangle>& triangles = tri->Triangles(); for (int i = 1; i <= tri->NbTriangles(); ++i) {
for (int i = 1; i <= triangles.Length(); ++i) { const Poly_Triangle& triangle = tri->Triangle(i);
if (face.Orientation() == TopAbs_REVERSED) if (face.Orientation() == TopAbs_REVERSED)
triangles(i).Get(n123[2], n123[1], n123[0]); triangle.Get(n123[2], n123[1], n123[0]);
else triangles(i).Get(n123[0], n123[1], n123[2]); else triangle.Get(n123[0], n123[1], n123[2]);
// Create polygons from the mesh vertices // Create polygons from the mesh vertices
BRepBuilderAPI_MakeWire mp2; BRepBuilderAPI_MakeWire mp2;
@@ -77,13 +77,6 @@ namespace {
return a < b ? edge_key{ a, b } : edge_key{ b, a }; return a < b ? edge_key{ a, b } : edge_key{ b, a };
} }
Eigen::Matrix4d item_matrix(const taxonomy::geom_item::ptr& item) {
if (item && item->matrix) {
return item->matrix->ccomponents();
}
return Eigen::Matrix4d::Identity();
}
Eigen::Vector3d transform_point(const Eigen::Matrix4d& m, const Eigen::Vector3d& p) { Eigen::Vector3d transform_point(const Eigen::Matrix4d& m, const Eigen::Vector3d& p) {
Eigen::Vector4d v(p(0), p(1), p(2), 1.); Eigen::Vector4d v(p(0), p(1), p(2), 1.);
return (m * v).head<3>(); return (m * v).head<3>();
@@ -155,7 +148,7 @@ namespace {
if (!face_points(face, points)) { if (!face_points(face, points)) {
continue; continue;
} }
auto total = external * part_matrix; // *item_matrix(face) * item_matrix(face->children.front()); auto total = external * part_matrix;
std::vector<int> indices; std::vector<int> indices;
indices.reserve(points.size()); indices.reserve(points.size());
for (const auto& point : points) { for (const auto& point : points) {
@@ -21,7 +21,7 @@
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
using namespace ifcopenshell::geom; using namespace ifcopenshell::geom;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangularTrimmedSurface&) {
// @todo we'll need to add support for p-curves at some point, but not now. // @todo we'll need to add support for p-curves at some point, but not now.
return nullptr; return nullptr;
+1 -1
View File
@@ -21,7 +21,7 @@
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
using namespace ifcopenshell::geom; using namespace ifcopenshell::geom;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCone& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCone&) {
// @todo // @todo
return nullptr; return nullptr;
/* /*
@@ -21,7 +21,7 @@
#define mapping POSTFIX_SCHEMA(mapping) #define mapping POSTFIX_SCHEMA(mapping)
using namespace ifcopenshell::geom; using namespace ifcopenshell::geom;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCylinder& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCylinder&) {
// @todo // @todo
return nullptr; return nullptr;
/* /*
+1 -1
View File
@@ -23,7 +23,7 @@ using namespace ifcopenshell::geom;
#ifdef SCHEMA_HAS_IfcSphericalSurface #ifdef SCHEMA_HAS_IfcSphericalSurface
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSphericalSurface& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSphericalSurface&) {
return nullptr; return nullptr;
/* /*
+1 -16
View File
@@ -52,23 +52,8 @@ namespace {
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) {
auto loop = taxonomy::cast<taxonomy::loop>(map(inst.Directrix())); auto loop = taxonomy::cast<taxonomy::loop>(map(inst.Directrix()));
// Start- EndParam became optional in IFC4
#ifdef SCHEMA_IfcSweptDiskSolid_StartParam_IS_OPTIONAL
auto sp = inst.StartParam();
auto ep = inst.EndParam();
#else
std::optional<double> sp, ep;
try {
sp = inst.StartParam();
ep = inst.EndParam();
} catch (const ifcopenshell::exception& e) {
logger_.warning("GEO", 293, e);
}
#endif
const double tol = settings_.get<settings::Precision>().get();
#ifdef SCHEMA_HAS_IfcSweptDiskSolidPolygonal #ifdef SCHEMA_HAS_IfcSweptDiskSolidPolygonal
const double tol = settings_.get<settings::Precision>().get();
if (inst.as<IfcSchema::IfcSweptDiskSolidPolygonal>()) { if (inst.as<IfcSchema::IfcSweptDiskSolidPolygonal>()) {
auto fr = inst.as<IfcSchema::IfcSweptDiskSolidPolygonal>().FilletRadius(); auto fr = inst.as<IfcSchema::IfcSweptDiskSolidPolygonal>().FilletRadius();
if (fr && *fr > tol) { if (fr && *fr > tol) {
-1
View File
@@ -73,7 +73,6 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) {
const double tol = settings_.get<settings::Precision>().get(); const double tol = settings_.get<settings::Precision>().get();
trim_cartesian &= has_pnts[0] && has_pnts[1]; trim_cartesian &= has_pnts[0] && has_pnts[1];
bool trim_cartesian_failed = !trim_cartesian;
if (trim_cartesian) { if (trim_cartesian) {
if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) { if ((pnts[0]->ccomponents() - pnts[1]->ccomponents()).norm() < (2 * tol)) {
logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 295, "Skipping segment with length below tolerance level:", inst); logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 295, "Skipping segment with length below tolerance level:", inst);
+2 -2
View File
@@ -665,7 +665,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSurfaceStyle& style) {
auto styles = style.Styles(); auto styles = style.Styles();
IfcSchema::IfcSurfaceStyleShading shading; IfcSchema::IfcSurfaceStyleShading shading;
for (auto& s : styles) { for (auto& s : styles) {
if (shading = s.as<IfcSchema::IfcSurfaceStyleShading>()) { if ((shading = s.as<IfcSchema::IfcSurfaceStyleShading>())) {
break; break;
} }
} }
@@ -989,7 +989,7 @@ void mapping::initialize_settings() {
bool selected_sub_context = false; bool selected_sub_context = false;
auto subs = context.HasSubContexts(); auto subs = context.HasSubContexts();
for (auto& sub : subs) { for (auto& sub : subs) {
if (cids.find(context.id()) != cids.end()) { if (cids.find(sub.id()) != cids.end()) {
selected_sub_context = true; selected_sub_context = true;
break; break;
} }
+4 -4
View File
@@ -372,12 +372,12 @@ protected:
int new_index = 0; int new_index = 0;
for (size_t orig = 0; orig < diffuse_color_array.size(); ++orig) { for (size_t orig = 0; orig < diffuse_color_array.size(); ++orig) {
auto& m = diffuse_color_array[orig]; auto& material = diffuse_color_array[orig];
if (m) { if (material) {
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
diffuse_color_array_condensed.push_back((*m)[i]); diffuse_color_array_condensed.push_back((*material)[i]);
} }
orig_to_condensed_index_map[orig] = new_index++; orig_to_condensed_index_map[static_cast<int>(orig)] = new_index++;
} }
} }
+1 -3
View File
@@ -777,8 +777,6 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
auto start_height = segment.StartHeight(); auto start_height = segment.StartHeight();
auto start_gradient = segment.StartGradient(); auto start_gradient = segment.StartGradient();
auto end_gradient = segment.EndGradient(); auto end_gradient = segment.EndGradient();
auto radius_of_curvature = segment.RadiusOfCurvature();
auto type = segment.PredefinedType(); auto type = segment.PredefinedType();
if (type == Ifc4x3_add2::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CONSTANTGRADIENT) { if (type == Ifc4x3_add2::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CONSTANTGRADIENT) {
@@ -862,7 +860,7 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
return result; return result;
} }
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentCantSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, ifcopenshell::logger& logger) { std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentCantSegment(hierarchy_helper<Ifc4x3_add2>&, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, ifcopenshell::logger& logger) {
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> result; std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> result;
auto type = segment.PredefinedType(); auto type = segment.PredefinedType();
if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_BLOSSCURVE) { if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_BLOSSCURVE) {
+21 -9
View File
@@ -23,7 +23,6 @@
#include "ifc_parse_api.h" #include "ifc_parse_api.h"
#include "express.h" #include "express.h"
#include <boost/scope_exit.hpp>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <exception> #include <exception>
@@ -156,15 +155,28 @@ class IFC_PARSE_API logger {
// `logger_or_root` is just covering the boilerplate for this pattern. // `logger_or_root` is just covering the boilerplate for this pattern.
inline logger& logger_or_root(logger* logger) { return logger ? *logger : logger::root(); } inline logger& logger_or_root(logger* logger) { return logger ? *logger : logger::root(); }
namespace detail {
class performance_scope {
std::string label_;
public:
explicit performance_scope(const std::string& label) : label_(label) {
logger::root().message(logger::LOG_PERF, label_);
}
~performance_scope() {
logger::root().message(logger::LOG_PERF, "done " + label_);
}
performance_scope(const performance_scope&) = delete;
performance_scope& operator=(const performance_scope&) = delete;
};
} // namespace detail
} // namespace ifcopenshell } // namespace ifcopenshell
#define PERF(x) \ #define IFCOPENSHELL_PERF_NAME_IMPL(line) ifcopenshell_performance_scope_##line
\ #define IFCOPENSHELL_PERF_NAME(line) IFCOPENSHELL_PERF_NAME_IMPL(line)
::ifcopenshell::logger::root().message(::ifcopenshell::logger::LOG_PERF, x); \ #define PERF(x) ::ifcopenshell::detail::performance_scope IFCOPENSHELL_PERF_NAME(__LINE__)(x)
\
BOOST_SCOPE_EXIT(void) { \
::ifcopenshell::logger::root().message(::ifcopenshell::logger::LOG_PERF, "done " + std::string(x)); \
} \
BOOST_SCOPE_EXIT_END
#endif #endif
+1 -3
View File
@@ -25,9 +25,7 @@
#include "macros.h" #include "macros.h"
#include "si_prefix.h" #include "si_prefix.h"
#define INCLUDE_SCHEMA(x) STRINGIFY(schemas/x.h) #include INCLUDE_SCHEMA(schemas, IfcSchema)
#include INCLUDE_SCHEMA(IfcSchema)
#undef INCLUDE_SCHEMA
#define CAT(a, b) a##b #define CAT(a, b) a##b
#define EXPAND_AND_CAT(a, b) CAT(a, b) #define EXPAND_AND_CAT(a, b) CAT(a, b)
+7 -10
View File
@@ -857,7 +857,6 @@ void svg_serializer::write(const ifcopenshell::geom::native_element* brep_obj) {
double pu, pv; double pu, pv;
Extrema_ExtPElS ext; Extrema_ExtPElS ext;
ext.Perform(gp::Origin(), *pln, 1.e-5); ext.Perform(gp::Origin(), *pln, 1.e-5);
auto P0 = pln->Location();
pln->SetLocation(ext.Point(1).Value()); pln->SetLocation(ext.Point(1).Value());
ext.Point(1).Parameter(pu, pv); ext.Point(1).Parameter(pu, pv);
@@ -896,7 +895,6 @@ void svg_serializer::write(const ifcopenshell::geom::native_element* brep_obj) {
} }
{ {
bool any_wires_converted_to_face = false;
BRep_Builder BB; BRep_Builder BB;
TopoDS_Compound comp2; TopoDS_Compound comp2;
BB.MakeCompound(comp2); BB.MakeCompound(comp2);
@@ -908,7 +906,6 @@ void svg_serializer::write(const ifcopenshell::geom::native_element* brep_obj) {
TopoDS_Compound faces; TopoDS_Compound faces;
ifcopenshell::geom::util::convert_wire_to_faces(TopoDS::Wire(s), faces, wts); ifcopenshell::geom::util::convert_wire_to_faces(TopoDS::Wire(s), faces, wts);
BB.Add(comp2, faces); BB.Add(comp2, faces);
any_wires_converted_to_face = true;
} else { } else {
BB.Add(comp2, s); BB.Add(comp2, s);
} }
@@ -1132,7 +1129,7 @@ void svg_serializer::write(const geometry_data& data) {
section_heights_used = section_data_ ? std::addressof(*section_data_) : nullptr; section_heights_used = section_data_ ? std::addressof(*section_data_) : nullptr;
} else { } else {
if (data.storey) { if (data.storey) {
section_heights_storage.push_back(horizontal_plan{ data.storey, data.storey_elevation, +1. }); section_heights_storage.push_back(horizontal_plan{ data.storey, data.storey_elevation, +1., std::numeric_limits<double>::infinity() });
} else { } else {
logger().warning("SER", 24, "No global section height and unable to determine building storey for:", data.product); logger().warning("SER", 24, "No global section height and unable to determine building storey for:", data.product);
return; return;
@@ -2456,14 +2453,14 @@ void svg_serializer::finalize() {
gp_Pnt((xmin + xmax) / 2., (ymin + ymax) / 2., 0.), gp_Pnt((xmin + xmax) / 2., (ymin + ymax) / 2., 0.),
gp_Dir(-1, 0, 0), gp_Dir(-1, 0, 0),
gp_Dir(0, -1, 0))); gp_Dir(0, -1, 0)));
deferred_section_data_->push_back(vertical_section{ pln , "Section North South", true }); deferred_section_data_->push_back(vertical_section{ pln , "Section North South", true, std::nullopt, std::nullopt });
} }
{ {
gp_Pln pln(gp_Ax3( gp_Pln pln(gp_Ax3(
gp_Pnt((xmin + xmax) / 2., (ymin + ymax) / -2., 0.), gp_Pnt((xmin + xmax) / 2., (ymin + ymax) / -2., 0.),
gp_Dir(0, -1, 0), gp_Dir(0, -1, 0),
gp_Dir(1, 0, 0))); gp_Dir(1, 0, 0)));
deferred_section_data_->push_back(vertical_section{ pln , "Section East West", true }); deferred_section_data_->push_back(vertical_section{ pln , "Section East West", true, std::nullopt, std::nullopt });
} }
} }
@@ -2473,28 +2470,28 @@ void svg_serializer::finalize() {
gp_Pnt(0., -(ymin - 0.1), 0.), gp_Pnt(0., -(ymin - 0.1), 0.),
gp_Dir(0, 1, 0), gp_Dir(0, 1, 0),
gp_Dir(-1, 0, 0))); gp_Dir(-1, 0, 0)));
deferred_section_data_->push_back(vertical_section{ pln , "Elevation South", true }); deferred_section_data_->push_back(vertical_section{ pln , "Elevation South", true, std::nullopt, std::nullopt });
} }
{ {
gp_Pln pln(gp_Ax3( gp_Pln pln(gp_Ax3(
gp_Pnt(xmax + 0.1, 0., 0.), gp_Pnt(xmax + 0.1, 0., 0.),
gp_Dir(1, 0, 0), gp_Dir(1, 0, 0),
gp_Dir(0, 1, 0))); gp_Dir(0, 1, 0)));
deferred_section_data_->push_back(vertical_section{ pln , "Elevation East", true }); deferred_section_data_->push_back(vertical_section{ pln , "Elevation East", true, std::nullopt, std::nullopt });
} }
{ {
gp_Pln pln(gp_Ax3( gp_Pln pln(gp_Ax3(
gp_Pnt(0., -(ymax + 0.1), 0.), gp_Pnt(0., -(ymax + 0.1), 0.),
gp_Dir(0, -1, 0), gp_Dir(0, -1, 0),
gp_Dir(1, 0, 0))); gp_Dir(1, 0, 0)));
deferred_section_data_->push_back(vertical_section{ pln , "Elevation North", true }); deferred_section_data_->push_back(vertical_section{ pln , "Elevation North", true, std::nullopt, std::nullopt });
} }
{ {
gp_Pln pln(gp_Ax3( gp_Pln pln(gp_Ax3(
gp_Pnt(xmin - 0.1, 0., 0.), gp_Pnt(xmin - 0.1, 0., 0.),
gp_Dir(-1, 0, 0), gp_Dir(-1, 0, 0),
gp_Dir(0, -1, 0))); gp_Dir(0, -1, 0)));
deferred_section_data_->push_back(vertical_section{ pln , "Elevation West", true }); deferred_section_data_->push_back(vertical_section{ pln , "Elevation West", true, std::nullopt, std::nullopt });
} }
} }
+5 -5
View File
@@ -385,12 +385,12 @@ namespace {
public: public:
prefiltered_hlr(ifcopenshell::logger& logger, bool use_prefiltering, bool use_hlr_poly, bool segment_projection, const gp_Pln& view_direction) prefiltered_hlr(ifcopenshell::logger& logger, bool use_prefiltering, bool use_hlr_poly, bool segment_projection, const gp_Pln& view_direction)
: logger_(logger) : use_prefiltering_(use_prefiltering)
, use_prefiltering_(use_prefiltering)
, use_hlr_poly_(use_hlr_poly) , use_hlr_poly_(use_hlr_poly)
, segment_projection_(segment_projection) , segment_projection_(segment_projection)
// @nb negative z in accordance with occt projector convention (and opengl) // @nb negative z in accordance with occt projector convention (and opengl)
, view_direction_(view_direction.Axis()) , view_direction_(view_direction.Axis())
, logger_(logger)
{ {
if (use_hlr_poly_) { if (use_hlr_poly_) {
engine_ = new HLRBRep_PolyAlgo; engine_ = new HLRBRep_PolyAlgo;
@@ -648,9 +648,9 @@ public:
, polygonal_(false) , polygonal_(false)
, emit_building_storeys_(true) , emit_building_storeys_(true)
, no_css_(false) , no_css_(false)
, unify_inputs_(false)
, mirror_y_(false) , mirror_y_(false)
, mirror_x_(false) , mirror_x_(false)
, unify_inputs_(false)
, profile_threshold_(-1) , profile_threshold_(-1)
, svg_ridge_angle_min_deg_(45.) , svg_ridge_angle_min_deg_(45.)
, svg_valley_angle_min_deg_(12.) , svg_valley_angle_min_deg_(12.)
@@ -774,7 +774,7 @@ public:
only_valid_ = b; only_valid_ = b;
} }
bool getOnlyValid(bool b) const { bool getOnlyValid(bool) const {
return only_valid_; return only_valid_;
} }
@@ -795,7 +795,7 @@ public:
void addDrawing(const gp_Pnt& pos, const gp_Dir& dir, const gp_Dir& ref, const std::string& name, bool include_projection) { void addDrawing(const gp_Pnt& pos, const gp_Dir& dir, const gp_Dir& ref, const std::string& name, bool include_projection) {
deferred_section_data_.emplace(); deferred_section_data_.emplace();
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, std::nullopt, std::nullopt });
} }
void setSubtractionSettings(subtract_before_project sbp) { void setSubtractionSettings(subtract_before_project sbp) {
+9 -9
View File
@@ -215,7 +215,7 @@ namespace {
<< std::hex << std::setw(4) << std::setfill('0') << std::hex << std::setw(4) << std::setfill('0')
<< (c & 0xFFFF); << (c & 0xFFFF);
} else { } else {
escaped.put(c); escaped.put(static_cast<char>(c));
} }
break; break;
} }
@@ -339,7 +339,7 @@ void ttl_wkt_serializer::write(const ifcopenshell::geom::triangulation_element*
} else { } else {
filename_.stream << ttl_object_id(o, "_geometry") << " a geo:Geometry ;\n"; filename_.stream << ttl_object_id(o, "_geometry") << " a geo:Geometry ;\n";
bool force_2d = true; bool force_2d = true;
double z_value; double z_value = 0.;
for (size_t i = 2; i < o->geometry().verts().size(); i += 3) { for (size_t i = 2; i < o->geometry().verts().size(); i += 3) {
const auto& cur = o->geometry().verts()[i]; const auto& cur = o->geometry().verts()[i];
if (i == 2) { if (i == 2) {
@@ -457,18 +457,18 @@ void ttl_wkt_serializer::write(const ifcopenshell::geom::native_element* brep_ob
BRepGProp::SurfaceProperties(face, props); BRepGProp::SurfaceProperties(face, props);
auto area = props.Mass(); auto area = props.Mass();
BRepTools_WireExplorer it(wire); BRepTools_WireExplorer wire_it(wire);
std::vector<double> loop_coords; std::vector<double> loop_coords;
for (; it.More(); it.Next()) { for (; wire_it.More(); wire_it.Next()) {
const auto& v = it.CurrentVertex(); const auto& v = wire_it.CurrentVertex();
auto pnt = BRep_Tool::Pnt(v); auto pnt = BRep_Tool::Pnt(v);
loop_coords.push_back(pnt.X()); loop_coords.push_back(pnt.X());
loop_coords.push_back(pnt.Y()); loop_coords.push_back(pnt.Y());
loop_coords.push_back(pnt.Z()); loop_coords.push_back(pnt.Z());
} }
std::vector<int> loop_idxs(loop_coords.size() / 3); std::vector<int> loop_idxs(loop_coords.size() / 3);
for (int i = 0; i < loop_idxs.size(); ++i) { for (std::size_t loop_index = 0; loop_index < loop_idxs.size(); ++loop_index) {
loop_idxs[i] = i; loop_idxs[loop_index] = static_cast<int>(loop_index);
} }
std::string postfix = "_section_geometry_" + std::to_string(N++); std::string postfix = "_section_geometry_" + std::to_string(N++);
@@ -509,7 +509,7 @@ std::string ttl_wkt_serializer::ttl_object_id(const ifcopenshell::geom::element*
{ {
auto oid = boost::replace_all_copy(object_id(o), "-", "_"); auto oid = boost::replace_all_copy(object_id(o), "-", "_");
if (oid.find('$') == std::string::npos) { if (oid.find('$') == std::string::npos) {
return "base:" + oid + (postfix ? postfix : (const char* const)""); return "base:" + oid + (postfix ? postfix : "");
} else { } else {
std::string base; std::string base;
if (settings_.get<ifcopenshell::geom::settings::BaseUri>().has()) { if (settings_.get<ifcopenshell::geom::settings::BaseUri>().has()) {
@@ -517,7 +517,7 @@ std::string ttl_wkt_serializer::ttl_object_id(const ifcopenshell::geom::element*
} else { } else {
base = "http://example.org/"; base = "http://example.org/";
} }
return "<" + base + oid + (postfix ? postfix : (const char* const)"") + ">"; return "<" + base + oid + (postfix ? postfix : "") + ">";
} }
} }