From 7a2810cd907187462ab0273288fd6c7eae58cd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Pa=C4=91en?= <49401914+ipadjen@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:05:48 +0200 Subject: [PATCH] Update core and roofer to cgal60 --- src/Building.cpp | 8 ++++---- src/PointCloud.cpp | 7 +++---- src/Terrain.cpp | 4 ++-- .../roofer/src/reconstruction/ArrangementBase.hpp | 12 ++++++------ .../roofer/src/reconstruction/ArrangementBuilder.cpp | 2 +- .../src/reconstruction/ArrangementExtruder.cpp | 4 ++-- .../roofer/src/reconstruction/ArrangementSnapper.cpp | 4 ++-- .../src/reconstruction/LineRegulariserBase.hpp | 2 +- .../roofer/src/reconstruction/PlaneIntersector.cpp | 3 ++- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Building.cpp b/src/Building.cpp index 974b048a..0fcd8395 100644 --- a/src/Building.cpp +++ b/src/Building.cpp @@ -296,10 +296,10 @@ void Building::get_cityjson_info(nlohmann::json& b) const { void Building::get_cityjson_semantics(nlohmann::json& g) const { // Temp for checking CGAL mesh properties Face_property semantics; - bool foundProperty; - boost::tie(semantics, foundProperty) = m_mesh.property_map("f:semantics"); - // auto semantics = m_mesh.property_map("f:semantics"); - if (!foundProperty) throw city4cfd_error("Semantic property map not found!"); + auto semanticsMap = m_mesh.property_map("f:semantics"); + if (semanticsMap.has_value()) { + semantics = semanticsMap.value(); + } else throw city4cfd_error("Semantic property map not found!"); std::unordered_map surfaceId; surfaceId["RoofSurface"] = 0; g["semantics"]["surfaces"][0]["type"] = "RoofSurface"; diff --git a/src/PointCloud.cpp b/src/PointCloud.cpp index e1cb3439..01eb4d57 100644 --- a/src/PointCloud.cpp +++ b/src/PointCloud.cpp @@ -33,7 +33,6 @@ #include "Building.h" #include "Quadtree/Quadtree.h" -#include #include #include #include @@ -241,7 +240,7 @@ void PointCloud::buffer_flat_edges(const PolyFeaturesPtr& avgFeatures, typedef CGAL::Polygon_offset_builder_traits_2 OffsetBuilderTraits; typedef CGAL::Polygon_offset_builder_2 OffsetBuilder; - typedef boost::shared_ptr ContourPtr; + typedef std::shared_ptr ContourPtr; typedef std::vector ContourSequence; // get info using the original point cloud // std::vector offsets{0.001, 0.2}; @@ -252,7 +251,7 @@ void PointCloud::buffer_flat_edges(const PolyFeaturesPtr& avgFeatures, //for (auto& f: avgFeatures) { // MSVC doesn't like range loop with OMP auto& poly = avgFeatures[i]->get_poly().outer_boundary(); // set the frame - boost::optional margin = CGAL::compute_outer_frame_margin(poly.begin(), poly.end(), offsets.back()); + auto margin = CGAL::compute_outer_frame_margin(poly.begin(), poly.end(), offsets.back()); CGAL::Bbox_2 bbox = CGAL::bbox_2(poly.begin(), poly.end()); // Compute the boundaries of the frame double fxmin = bbox.xmin() - *margin; @@ -271,7 +270,7 @@ void PointCloud::buffer_flat_edges(const PolyFeaturesPtr& avgFeatures, poly.reverse_orientation(); ssb.enter_contour(poly.begin(), poly.end()); // Construct the skeleton - boost::shared_ptr ss = ssb.construct_skeleton(); + auto ss = ssb.construct_skeleton(); // Proceed only if the skeleton was correctly constructed. if (ss) { for (auto& offset: offsets) { diff --git a/src/Terrain.cpp b/src/Terrain.cpp index b14ee94b..7c19a14f 100644 --- a/src/Terrain.cpp +++ b/src/Terrain.cpp @@ -35,12 +35,12 @@ Terrain::Terrain() : TopoFeature(0), m_cdt(), m_surfaceLayersTerrain(), m_constrainedPolys(), m_vertexFaceMap(), m_extraConstrainedEdges(), - m_searchTree(Config::get().searchtree_bucket_size) {} + m_searchTree() {} Terrain::Terrain(int pid) : TopoFeature(pid), m_cdt(), m_surfaceLayersTerrain(), m_constrainedPolys(), m_vertexFaceMap(), m_extraConstrainedEdges(), - m_searchTree(Config::get().searchtree_bucket_size) {} + m_searchTree() {} Terrain::~Terrain() = default; diff --git a/thirdparty/roofer/src/reconstruction/ArrangementBase.hpp b/thirdparty/roofer/src/reconstruction/ArrangementBase.hpp index bc37f693..42ba12b8 100644 --- a/thirdparty/roofer/src/reconstruction/ArrangementBase.hpp +++ b/thirdparty/roofer/src/reconstruction/ArrangementBase.hpp @@ -82,7 +82,7 @@ typedef CGAL::Arr_face_overlay_traits +class Face_index_observer : public CGAL::Arr_observer { private: int n_faces; // The current number of faces. @@ -91,8 +91,8 @@ class Face_index_observer : public CGAL::Arr_observer float elevation=0; Plane plane; public: - Face_index_observer (Arrangement_2& arr, bool is_footprint, size_t pid, float elevation, Plane plane) : - CGAL::Arr_observer (arr), + Face_index_observer (roofer::Arrangement_2& arr, bool is_footprint, size_t pid, float elevation, Plane plane) : + CGAL::Arr_observer (arr), n_faces (0), in_footprint(is_footprint), plane_id(pid), elevation(elevation), plane(plane) { CGAL_precondition (arr.is_empty()); @@ -111,14 +111,14 @@ class Face_index_observer : public CGAL::Arr_observer n_faces++; } }; -class Face_split_observer : public CGAL::Arr_observer +class Face_split_observer : public CGAL::Arr_observer { private: int n_faces; // The current number of faces. bool hole_mode=false; public: - Face_split_observer (Arrangement_2& arr) : - CGAL::Arr_observer (arr), + Face_split_observer (roofer::Arrangement_2& arr) : + CGAL::Arr_observer (arr), n_faces (0) { CGAL_precondition (arr.is_empty()); diff --git a/thirdparty/roofer/src/reconstruction/ArrangementBuilder.cpp b/thirdparty/roofer/src/reconstruction/ArrangementBuilder.cpp index 70ab2f6c..36c2b09c 100644 --- a/thirdparty/roofer/src/reconstruction/ArrangementBuilder.cpp +++ b/thirdparty/roofer/src/reconstruction/ArrangementBuilder.cpp @@ -21,7 +21,7 @@ namespace roofer::detection { // arr_common_face(edge->source(), edge->target(), common_face); auto result = CGAL::intersection(Segment_2(e_source, e_target), segment); if (result) { - if (auto p = boost::get(&*result)) { + if (auto p = std::get_if(&*result)) { // std::cout << "\tp " << *p << std::endl; // std::cout << "\tp (geo) " << CGAL::to_double(p->x())+CGAL::to_double(geo_p.x()) << ", " << CGAL::to_double(p->y())+CGAL::to_double(geo_p.y()) << std::endl; // check if point of intersection is practically at the same coordinates of one of the edge's end points diff --git a/thirdparty/roofer/src/reconstruction/ArrangementExtruder.cpp b/thirdparty/roofer/src/reconstruction/ArrangementExtruder.cpp index 117f3b53..67581a85 100644 --- a/thirdparty/roofer/src/reconstruction/ArrangementExtruder.cpp +++ b/thirdparty/roofer/src/reconstruction/ArrangementExtruder.cpp @@ -296,7 +296,7 @@ namespace roofer::detection { auto l_a = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1a), EPECK::Point_3(p2.x(), p2.y(), h2a)); auto l_b = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1b), EPECK::Point_3(p2.x(), p2.y(), h2b)); auto result = CGAL::intersection(l_a, l_b); - auto px = boost::get(&*result); + auto px = std::get_if(&*result); // TODO: check if distance from px to p1 and p2 is longer than snap_tolerance? @@ -334,7 +334,7 @@ namespace roofer::detection { auto l_a = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1a), EPECK::Point_3(p2.x(), p2.y(), h2a)); auto l_b = EPECK::Line_3(EPECK::Point_3(p1.x(), p1.y(), h1b), EPECK::Point_3(p2.x(), p2.y(), h2b)); auto result = CGAL::intersection(l_a, l_b); - auto px = boost::get(&*result); + auto px = std::get_if(&*result); // TODO: check if distance from px to p1 and p2 is longer than snap_tolerance? diff --git a/thirdparty/roofer/src/reconstruction/ArrangementSnapper.cpp b/thirdparty/roofer/src/reconstruction/ArrangementSnapper.cpp index 3f963891..749cf10a 100644 --- a/thirdparty/roofer/src/reconstruction/ArrangementSnapper.cpp +++ b/thirdparty/roofer/src/reconstruction/ArrangementSnapper.cpp @@ -210,7 +210,7 @@ namespace arragementsnapper { auto obj = walk_pl.locate( Walk_pl::Arrangement_2::Point_2(p.x(), p.y()) ); // std::cout << "The point (" << p << ") is located "; - if (auto f = boost::get(&obj)) { // located inside a face + if (auto f = std::get_if(&obj)) { // located inside a face // std::cout << "inside " // << (((*f)->is_unbounded()) ? "the unbounded" : "a bounded") // << " face." << std::endl; @@ -476,7 +476,7 @@ namespace arragementsnapper { auto obj = walk_pl.locate( Walk_pl::Arrangement_2::Point_2(p.x(), p.y()) ); - if (auto f = boost::get(&obj)) { // located inside a face + if (auto f = std::get_if(&obj)) { // located inside a face // arrFace->data() = (*f)->data(); canidate_faces[arr.non_const_handle(*f)] += cdt.triangle(fit).area(); } diff --git a/thirdparty/roofer/src/reconstruction/LineRegulariserBase.hpp b/thirdparty/roofer/src/reconstruction/LineRegulariserBase.hpp index b2958eee..0ed4fe06 100644 --- a/thirdparty/roofer/src/reconstruction/LineRegulariserBase.hpp +++ b/thirdparty/roofer/src/reconstruction/LineRegulariserBase.hpp @@ -233,7 +233,7 @@ namespace linereg { Segment_2 s(a_2d.target(), b_2d.source()); auto result = CGAL::intersection(l_a, l_b); if (result) { - if (auto p = std::get(&*result)) { + if (auto p = std::get_if(&*result)) { if (CGAL::squared_distance(*p, s) < snap_threshold) { double z = -plane.a()/plane.c() * p->x() - plane.b()/plane.c()*p->y() - plane.d()/plane.c(); ring_pts.push_back( Point_3(p->x(), p->y(), z) ); diff --git a/thirdparty/roofer/src/reconstruction/PlaneIntersector.cpp b/thirdparty/roofer/src/reconstruction/PlaneIntersector.cpp index 1a7e6f84..4fc2e32b 100644 --- a/thirdparty/roofer/src/reconstruction/PlaneIntersector.cpp +++ b/thirdparty/roofer/src/reconstruction/PlaneIntersector.cpp @@ -1,6 +1,7 @@ #include "PlaneIntersector.hpp" #include +#include namespace roofer::detection { @@ -72,7 +73,7 @@ namespace roofer::detection { auto result = CGAL::intersection(plane_hi, plane_lo); if (result) { // bound the line to extend of one plane's inliers - if (auto l = boost::get(&*result)) { + if (auto l = std::get_if(&*result)) { Point pmin_lo, pmax_lo; Point pmin_hi, pmax_hi; double dmin_lo, dmax_lo;