Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
os: [ubuntu, macos, windows]
boost: ['1_66', 'latest']
geos: ['3.11.0', 'none']
geos: ['3.9.0', 'main', 'none']
compiler: ['g++', 'g++-10', 'clang++']
exclude:
- os: macos # Temporarily disable until fixed
Expand All @@ -38,7 +38,7 @@ jobs:
- os: ubuntu
boost: 1_66
compiler: g++-10
geos: '3.11.0'
geos: 'main'
code_coverage: "--enable-code-coverage"
#- os: windows
# shell: msys2 {0}
Expand Down Expand Up @@ -169,11 +169,11 @@ jobs:
- name: Build and install geos
if: matrix.os != 'macos' && matrix.geos != 'none'
run: |
if ! test -d "${LOCAL_INSTALL_PATH}/include/geos" || ! test -f ${LOCAL_INSTALL_PATH}/bin/geos.version || ! grep -qx "$(git ls-remote https://github.com/libgeos/geos.git heads/main)" ${LOCAL_INSTALL_PATH}/bin/geos.version; then
git ls-remote https://github.com/libgeos/geos.git heads/main > ${LOCAL_INSTALL_PATH}/bin/geos.version
if ! test -d "${LOCAL_INSTALL_PATH}/include/geos" || ! test -f ${LOCAL_INSTALL_PATH}/bin/geos.version || ! grep -qx "$(git ls-remote https://github.com/libgeos/geos.git ${{ matrix.geos }} )" ${LOCAL_INSTALL_PATH}/bin/geos.version; then
git ls-remote https://github.com/libgeos/geos.git ${{ matrix.geos }} > ${LOCAL_INSTALL_PATH}/bin/geos.version
echo "UPDATE_CACHE=true" >> $GITHUB_ENV
pushd ~
git clone --depth 1 --branch main https://github.com/libgeos/geos.git
git clone --depth 1 --branch ${{ matrix.geos }} https://github.com/libgeos/geos.git
pushd geos
mkdir build
pushd build
Expand Down Expand Up @@ -301,7 +301,7 @@ jobs:
run: make -j ${NUM_CPUS} check-valgrind || (cat mem-test-suite.log && false)

- name: Run integration tests
if: matrix.boost == '1_66' && matrix.geos == '3.11.0'
if: matrix.boost == '1_66' && matrix.geos == 'main'
run: |
sudo apt-get install python3-setuptools
pip3 install --user wheel colour_runner unittest2 termcolor concurrencytest in_place
Expand All @@ -326,8 +326,8 @@ jobs:
if [[ -e ${LOCAL_INSTALL_PATH}/lib/libgerbv.so.1 ]]; then
cp -L ${LOCAL_INSTALL_PATH}/lib/libgerbv.so.1 pcb2gcode-$(./pcb2gcode --version | head -1)/.libs;
fi
if [[ -e ${LOCAL_INSTALL_PATH}/lib/libgeos-3.11.0.so ]]; then
cp -L ${LOCAL_INSTALL_PATH}/lib/libgeos-3.11.0.so pcb2gcode-$(./pcb2gcode --version | head -1)/.libs;
if ls "${LOCAL_INSTALL_PATH}/lib/libgeos*" ]]; then
cp -L "${LOCAL_INSTALL_PATH}/lib/libgeos*" pcb2gcode-$(./pcb2gcode --version | head -1)/.libs;
fi

cat > pcb2gcode-$(./pcb2gcode --version | head -1)/pcb2gcode.sh << EOF
Expand Down
17 changes: 12 additions & 5 deletions geos_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@
#include "geometry.hpp"
#include <geos/io/WKTReader.h>
#include <geos/io/WKTWriter.h>
#include <geos/geom/CoordinateSequenceFactory.h>
#include <geos/geom/Coordinate.h>
#include <geos/geom/GeometryFactory.h>
#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;
Expand Down Expand Up @@ -86,8 +95,7 @@ multi_polygon_type_fp from_geos(const std::unique_ptr<geos::geom::Geometry>& g)
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);
}
Expand All @@ -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);
Expand Down