update to pcb2gcode-2.5.0 plus an upstream patch to unbreak with newer geos

master
sthen 2023-07-10 12:09:54 +00:00
parent c2147bb7cb
commit 7165167bde
4 changed files with 43 additions and 54 deletions

View File

@ -1,10 +1,9 @@
COMMENT = tool for isolation, routing, and drilling of PCBs
V = 2.4.0
V = 2.5.0
GH_ACCOUNT = pcb2gcode
GH_PROJECT = pcb2gcode
GH_TAGNAME = v${V}
REVISION = 2
CATEGORIES = cad

View File

@ -1,2 +1,2 @@
SHA256 (pcb2gcode-2.4.0.tar.gz) = XU8G9wQf4UoQh4C9uVOqUg9+VWdzp7n7hDXpuS/vYU0=
SIZE (pcb2gcode-2.4.0.tar.gz) = 7456824
SHA256 (pcb2gcode-2.5.0.tar.gz) = lvGxtP1Y6G8VK2kSAqFVk4FZSdySUPq5qwLyNG9cLFI=
SIZE (pcb2gcode-2.5.0.tar.gz) = 7654793

View File

@ -1,42 +0,0 @@
backport https://github.com/pcb2gcode/pcb2gcode/pull/594 to fix build with geos 3.10
Index: bg_operators.cpp
--- bg_operators.cpp.orig
+++ bg_operators.cpp
@@ -2,8 +2,8 @@
#include "geometry_int.hpp"
#include "bg_helpers.hpp"
#ifdef GEOS_VERSION
-#include <geos/operation/union/CascadedUnion.h>
#include <geos/util/TopologyException.h>
+#include <geos/geom/GeometryFactory.h>
#include "geos_helpers.hpp"
#endif // GEOS_VERSION
@@ -245,7 +245,6 @@ multi_polygon_type_fp sum(const std::vector<multi_poly
return mpolys[0];
}
#ifdef GEOS_VERSION
- std::vector<geos::geom::Geometry*> geos_mpolys;
std::vector<std::unique_ptr<geos::geom::Geometry>> geos_mpolys_tmp;
for (const auto& mpoly : mpolys) {
if (bg::area(mpoly) == 0) {
@@ -254,14 +253,15 @@ multi_polygon_type_fp sum(const std::vector<multi_poly
auto mpoly_temp = mpoly;
round(mpoly_temp);
geos_mpolys_tmp.push_back(to_geos(mpoly_temp));
- geos_mpolys.push_back(geos_mpolys_tmp.back().get());
}
- if (geos_mpolys.size() == 0) {
+ auto geos_factory = geos::geom::GeometryFactory::create();
+ auto geos_collection = geos_factory->buildGeometry(std::move(geos_mpolys_tmp));
+ if (geos_collection->isEmpty()) {
return {};
}
try {
std::unique_ptr<geos::geom::Geometry> geos_out(
- geos::operation::geounion::CascadedUnion::Union(&geos_mpolys));
+ geos_collection->Union());
return from_geos<multi_polygon_type_fp>(geos_out);
} catch (const geos::util::TopologyException& e) {
std::cerr << "\nError: Internal error with libgeos. Upgrading geos may help." << std::endl;

View File

@ -1,21 +1,53 @@
fix build with geos 3.11.
From a7c2ec216cb50fa4f01d61c358cb93e7a17b01d1 Mon Sep 17 00:00:00 2001
From: eyal0 <109809+eyal0@users.noreply.github.com>
Date: Wed, 7 Dec 2022 22:09:53 -0700
Subject: [PATCH] fix: Don't use the CoordinateSequenceFactory.
https://github.com/pcb2gcode/pcb2gcode/commit/f7b93da36eb607f92b4d35ea576658ae008ca6a5
It's not used anymore in geos since geos commit
https://github.com/libgeos/geos/commit/d463bcb6df8fc1f01f276b27719ee8ccfb2d788a .
Index: geos_helpers.cpp
--- geos_helpers.cpp.orig
+++ geos_helpers.cpp
@@ -3,13 +3,10 @@
#include "geos_helpers.hpp"
@@ -4,11 +4,20 @@
#include "geometry.hpp"
#include <geos/io/WKTReader.h>
-#include <geos/io/WKTReader.inl>
#include <geos/io/WKTWriter.h>
#include <geos/geom/CoordinateSequenceFactory.h>
-#include <geos/geom/CoordinateSequenceFactory.h>
#include <geos/geom/Coordinate.h>
-#include <geos/geom/Coordinate.inl>
#include <geos/geom/GeometryFactory.h>
-#include <geos/geom/GeometryFactory.inl>
#include <boost/pointer_cast.hpp>
+#include <geos/version.h>
+#include <geos/util.h>
+#if ((GEOS_VERSION_MAJOR > 3) || \
+ (GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR > 11))
+ #define CoordinateArraySequence CoordinateSequence
+ #include <geos/geom/CoordinateSequence.h>
+#else
+ #include <geos/geom/CoordinateArraySequence.h>
+#endif
+
linestring_type_fp from_geos(const geos::geom::LineString* ls) {
linestring_type_fp ret;
ret.reserve(ls->getNumPoints());
@@ -86,8 +95,7 @@ multi_polygon_type_fp from_geos(const std::unique_ptr<
std::unique_ptr<geos::geom::LineString> to_geos(
const linestring_type_fp& ls) {
auto geom_factory = geos::geom::GeometryFactory::create();
- auto coord_factory = geom_factory->getCoordinateSequenceFactory();
- auto coords = coord_factory->create(ls.size(), 2 /* dimensions */);
+ auto coords = geos::detail::make_unique<geos::geom::CoordinateArraySequence>(ls.size(), 2 /* dimensions */);
for (size_t i = 0; i < ls.size(); i++) {
coords->setAt(geos::geom::Coordinate(ls[i].x(), ls[i].y()), i);
}
@@ -96,8 +104,7 @@ std::unique_ptr<geos::geom::LineString> to_geos(
std::unique_ptr<geos::geom::LinearRing> to_geos(const ring_type_fp& ring) {
auto geom_factory = geos::geom::GeometryFactory::create();
- auto coord_factory = geom_factory->getCoordinateSequenceFactory();
- auto coords = coord_factory->create(ring.size(), 2 /* dimensions */);
+ auto coords = geos::detail::make_unique<geos::geom::CoordinateArraySequence>(ring.size(), 2 /* dimensions */);
for (size_t i = 0; i < ring.size(); i++) {
// reverse rings for geos.
coords->setAt(geos::geom::Coordinate(ring[i].x(), ring[i].y()), i);