[Git][debian-gis-team/sfcgal][master] Cherry-pick upstream patch for CGAL6 support. (closes: #1074382)
Christoph Berg (@myon)
gitlab at salsa.debian.org
Wed Sep 11 13:19:55 BST 2024
Christoph Berg pushed to branch master at Debian GIS Project / sfcgal
Commits:
d4854352 by Christoph Berg at 2024-09-11T12:19:47+00:00
Cherry-pick upstream patch for CGAL6 support. (closes: #1074382)
- - - - -
3 changed files:
- debian/changelog
- + debian/patches/cgal6.diff
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,7 +1,11 @@
sfcgal (1.5.2-2) UNRELEASED; urgency=medium
+ [ Bas Couwenberg ]
* Bump Standards-Version to 4.7.0, no changes.
+ [ Christoph Berg ]
+ * Cherry-pick upstream patch for CGAL6 support. (closes: #1074382)
+
-- Bas Couwenberg <sebastic at debian.org> Sun, 28 Jul 2024 20:03:16 +0200
sfcgal (1.5.2-1) unstable; urgency=medium
=====================================
debian/patches/cgal6.diff
=====================================
@@ -0,0 +1,241 @@
+Source: https://gitlab.com/sfcgal/SFCGAL/-/merge_requests/325
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1d9affa4424ac87b5a6080db8329c457313486fd..d2c9241ba7bc7d7794daa00da0a4f5f651d20e44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -78,10 +78,6 @@ message( STATUS "CGAL ${CGAL_VERSION} found" )
+ include_directories( ${CMAKE_BINARY_DIR}/include )
+
+ #-- BOOST --------------------------------------------------
+-if( NOT CGAL_USE_GMPXX )
+- add_definitions( "-DCGAL_DO_NOT_USE_BOOST_MP" )
+-endif()
+-
+ option( Boost_USE_AUTO_LINK "boost use autolink" OFF )
+ if( NOT ${Boost_USE_AUTO_LINK} )
+ add_definitions( "-DBOOST_ALL_NO_LIB" )
+diff --git a/src/algorithm/offset.cpp b/src/algorithm/offset.cpp
+index 113d6fc1de566f18ae7c5ec6511a4429468d759f..20403abee41678ed636060f1545b651c893f9a7c 100644
+--- a/src/algorithm/offset.cpp
++++ b/src/algorithm/offset.cpp
+@@ -169,6 +169,7 @@ circleToPolygon(const Kernel::Circle_2 &circle) -> Offset_polygon_2
+ Gps_traits_2 const traits;
+ Offset_curve_2 const curve(circle);
+
++#if CGAL_VERSION_MAJOR < 6
+ std::list<CGAL::Object> parts;
+ traits.make_x_monotone_2_object()(curve, std::back_inserter(parts));
+ BOOST_ASSERT(parts.size() == 2U);
+@@ -181,6 +182,13 @@ circleToPolygon(const Kernel::Circle_2 &circle) -> Offset_polygon_2
+ CGAL::assign(arc, part);
+ result.push_back(arc);
+ }
++#else
++ Offset_polygon_2 result;
++
++ traits.make_x_monotone_2_object()(
++ curve, CGAL::dispatch_or_drop_output<Offset_x_monotone_curve_2>(
++ std::back_inserter(result)));
++#endif
+
+ return result;
+ }
+diff --git a/src/algorithm/straightSkeleton.cpp b/src/algorithm/straightSkeleton.cpp
+index 13eb427011a93fa109bff18a618296526877981c..42095f0f34435b677fa5213e2fe8e2578e13aa9d 100644
+--- a/src/algorithm/straightSkeleton.cpp
++++ b/src/algorithm/straightSkeleton.cpp
+@@ -38,6 +38,14 @@ using Polygon_with_holes_2 = CGAL::Polygon_with_holes_2<Kernel>;
+ using Straight_skeleton_2 = CGAL::Straight_skeleton_2<Kernel>;
+ using Mesh = CGAL::Surface_mesh<Point_3>;
+
++#if CGAL_VERSION_MAJOR < 6
++template <class T>
++using SHARED_PTR = boost::shared_ptr<T>;
++#else
++template <class T>
++using SHARED_PTR = std::shared_ptr<T>;
++#endif
++
+ namespace { // anonymous
+
+ template <class K, bool outputDistanceInM>
+@@ -181,14 +189,14 @@ straightSkeletonToMedialAxis(const CGAL::Straight_skeleton_2<K> &ss,
+
+ auto
+ straightSkeleton(const Polygon_with_holes_2 &poly)
+- -> boost::shared_ptr<Straight_skeleton_2>
++ -> SHARED_PTR<Straight_skeleton_2>
+ {
+- boost::shared_ptr<CGAL::Straight_skeleton_2<CGAL::Epick>> const sk =
++ SHARED_PTR<CGAL::Straight_skeleton_2<CGAL::Epick>> const sk =
+ CGAL::create_interior_straight_skeleton_2(
+ poly.outer_boundary().vertices_begin(),
+ poly.outer_boundary().vertices_end(), poly.holes_begin(),
+ poly.holes_end(), CGAL::Epick());
+- boost::shared_ptr<Straight_skeleton_2> ret;
++ SHARED_PTR<Straight_skeleton_2> ret;
+ if (sk) {
+ ret = CGAL::convert_straight_skeleton_2<Straight_skeleton_2>(*sk);
+ }
+@@ -316,10 +324,9 @@ straightSkeleton(const Polygon &g, bool /*autoOrientation*/, bool innerOnly,
+ return result;
+ }
+
+- Kernel::Vector_2 trans;
+- Polygon_with_holes_2 const polygon = preparePolygon(g, trans);
+- boost::shared_ptr<Straight_skeleton_2> const skeleton =
+- straightSkeleton(polygon);
++ Kernel::Vector_2 trans;
++ Polygon_with_holes_2 const polygon = preparePolygon(g, trans);
++ SHARED_PTR<Straight_skeleton_2> const skeleton = straightSkeleton(polygon);
+
+ if (skeleton == nullptr) {
+ BOOST_THROW_EXCEPTION(Exception("CGAL failed to create straightSkeleton"));
+@@ -348,8 +355,7 @@ straightSkeleton(const MultiPolygon &g, bool /*autoOrientation*/,
+ for (size_t i = 0; i < g.numGeometries(); i++) {
+ Kernel::Vector_2 trans;
+ Polygon_with_holes_2 const polygon = preparePolygon(g.polygonN(i), trans);
+- boost::shared_ptr<Straight_skeleton_2> const skeleton =
+- straightSkeleton(polygon);
++ SHARED_PTR<Straight_skeleton_2> const skeleton = straightSkeleton(polygon);
+
+ if (skeleton == nullptr) {
+ BOOST_THROW_EXCEPTION(
+@@ -379,10 +385,9 @@ approximateMedialAxis(const Geometry &g) -> std::unique_ptr<MultiLineString>
+ extractPolygons(g, polys);
+
+ for (auto &poly : polys) {
+- Kernel::Vector_2 trans;
+- Polygon_with_holes_2 const polygon = preparePolygon(poly, trans);
+- boost::shared_ptr<Straight_skeleton_2> const skeleton =
+- straightSkeleton(polygon);
++ Kernel::Vector_2 trans;
++ Polygon_with_holes_2 const polygon = preparePolygon(poly, trans);
++ SHARED_PTR<Straight_skeleton_2> const skeleton = straightSkeleton(polygon);
+
+ if (skeleton == nullptr) {
+ BOOST_THROW_EXCEPTION(
+diff --git a/src/algorithm/visibility.cpp b/src/algorithm/visibility.cpp
+index a99eaf19a6da2bca48cc18dfc3cc48ee02142c7e..9da4f09fbaa8b61ffcc1567f7c46480aab2ec2b2 100644
+--- a/src/algorithm/visibility.cpp
++++ b/src/algorithm/visibility.cpp
+@@ -98,7 +98,6 @@ visibility(const Geometry &polygon, const Geometry &point,
+ }
+
+ // Find the face
+- Arrangement_2::Face_const_handle *face;
+ CGAL::Arr_naive_point_location<Arrangement_2> const pl(arr);
+ CGAL::Arr_point_location_result<Arrangement_2>::Type obj =
+ pl.locate(queryPoint);
+@@ -108,9 +107,13 @@ visibility(const Geometry &polygon, const Geometry &point,
+
+ // Create Triangular Expansion Visibility object.
+ TEV const tev(arr);
+-
+- if (obj.which() == 0) {
+-
++#if CGAL_VERSION_MAJOR < 6
++ switch (obj.which())
++#else
++ switch (obj.index())
++#endif
++ {
++ case 0: {
+ Halfedge_const_handle he = Halfedge_const_handle();
+
+ // If the point is in a boundary segment, find the corresponding half edge
+@@ -135,23 +138,38 @@ visibility(const Geometry &polygon, const Geometry &point,
+
+ // Use the half edge to compute the visibility
+ fh = tev.compute_visibility(queryPoint, he, output_arr);
+-
+- } else if (obj.which() == 1) {
++ break;
++ }
++ case 1: {
+ Halfedge_const_handle *he =
++#if CGAL_VERSION_MAJOR < 6
+ boost::get<Arrangement_2::Halfedge_const_handle>(&obj);
++#else
++ std::get_if<Arrangement_2::Halfedge_const_handle>(&obj);
++#endif
+ if (he != nullptr) {
+ fh = tev.compute_visibility(queryPoint, *he, output_arr);
+ } else {
+ BOOST_THROW_EXCEPTION(Exception("Can not find corresponding hedge."));
+ }
+- } else if (obj.which() == 2) {
++ break;
++ }
++ case 2: {
+ Face_const_handle *face =
++#if CGAL_VERSION_MAJOR < 6
+ boost::get<Arrangement_2::Face_const_handle>(&obj);
++#else
++ std::get_if<Arrangement_2::Face_const_handle>(&obj);
++#endif
+ if ((face != nullptr) && !((*face)->is_unbounded())) {
+ fh = tev.compute_visibility(queryPoint, *face, output_arr);
+ } else {
+ BOOST_THROW_EXCEPTION(Exception("Can not find corresponding face."));
+ }
++ break;
++ }
++ default:
++ break;
+ }
+
+ return query_visibility(fh, fh->outer_ccb());
+diff --git a/src/config.h.cmake b/src/config.h.cmake
+index 5c4555dcbeaa695d99dbcb00b5e2f3a9bee13af7..abb2eab51c5d4dd7005a9e6b5bc62ad4e8bbd3a2 100644
+--- a/src/config.h.cmake
++++ b/src/config.h.cmake
+@@ -8,19 +8,22 @@
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+- *
++ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+
+ * You should have received a copy of the GNU Library General Public
+- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
++ * License along with this library; if not, see
++ <http://www.gnu.org/licenses/>.
+ */
+ #ifndef _SFCGAL_CONFIG_H_
+ #define _SFCGAL_CONFIG_H_
+
+-#define CGAL_DO_NOT_USE_BOOST_MP 1
++#ifndef CGAL_USE_GMPXX
++#define CMAKE_OVERRIDDEN_DEFAULT_ENT_BACKEND 0 // GMP
++#endif
+
+ #include "SFCGAL/export.h"
+
+@@ -30,4 +33,3 @@
+ #cmakedefine SFCGAL_WITH_OSG
+
+ #endif
+-
+diff --git a/src/detail/generator/building.cpp b/src/detail/generator/building.cpp
+index 93a3efde55f2c92b4d2e1638f5fffe47018d975f..0fb2651565af10e3cddc10401ff2c15226f0fd51 100644
+--- a/src/detail/generator/building.cpp
++++ b/src/detail/generator/building.cpp
+@@ -75,8 +75,11 @@ building(const Polygon &g, const Kernel::FT &wallHeight,
+
+ // fix orientation
+ algorithm::makeValidOrientation(polygon);
+-
++#if CGAL_VERSION_MAJOR < 6
+ boost::shared_ptr<Straight_skeleton_2> const skeleton =
++#else
++ std::shared_ptr<Straight_skeleton_2> const skeleton =
++#endif
+ create_interior_straight_skeleton_2(
+ polygon.outer_boundary().vertices_begin(),
+ polygon.outer_boundary().vertices_end(), polygon.holes_begin(),
=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
sfcgal-config.patch
+cgal6.diff
View it on GitLab: https://salsa.debian.org/debian-gis-team/sfcgal/-/commit/d4854352134e7f4bd261dbdd4986ebf686b0ead0
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/sfcgal/-/commit/d4854352134e7f4bd261dbdd4986ebf686b0ead0
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240911/6a22300b/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list