Skip to content
Commits on Source (62)
......@@ -35,7 +35,7 @@ Developers:
Mateusz Loskot (mateusz@loskot.net) - Unit testing
Regina Obe (lr@pcorp.us) - QA / Windows
Paul Ramsey (pramsey@refractions.net) - Coordination / Build
Sandro Santilli (strk@keybit.net) - Bug Fixing / Maintenance
Sandro Santilli (strk@kbt.io) - Bug Fixing / Maintenance
Frank Warmerdam (warmerdam@pobox.com) - VStudio porting
In Active:
......
......@@ -10,16 +10,32 @@
# See the COPYING file for more information.
#
#################################################################################
project(GEOS)
cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 3.1.3)
if(NOT CMAKE_VERSION)
set(CMAKE_VERSION
"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
endif()
# Location of custom CMake modules with macros used by GEOS
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
#################################################################################
# Set GEOS project
#################################################################################
project(GEOS VERSION 3.7.0 LANGUAGES C CXX)
# Add custom GEOS modules for CMake
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
#################################################################################
# Set C++ standard
#################################################################################
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "Setting C++ requirement to C++${CMAKE_CXX_STANDARD}")
#################################################################################
# Setup GEOS version
......@@ -27,19 +43,24 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
# GEOS release version
# GEOS C++ library SONAME will use these encoding ABI break at every release
set(VERSION_MAJOR 3)
set(VERSION_MINOR 6)
set(VERSION_PATCH 2)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set(GEOS_VERSION_PATCH "${GEOS_VERSION_PATCH}dev")
set(GEOS_VERSION "${GEOS_VERSION_MAJOR}.${GEOS_VERSION_MINOR}.${GEOS_VERSION_PATCH}")
set(VERSION "${GEOS_VERSION}")
# Copy version components into different variable names to match those used
# by autotools for *.h.in files
set(VERSION_MAJOR ${GEOS_VERSION_MAJOR})
set(VERSION_MINOR ${GEOS_VERSION_MINOR})
set(VERSION_PATCH ${GEOS_VERSION_PATCH})
# JTS_PORT is the version of JTS this release is bound to
set(JTS_PORT 1.13.0)
message(STATUS "Setting GEOS version ${VERSION} as port of JTS ${JTS_PORT}")
# GEOS C API version
set(CAPI_INTERFACE_CURRENT 11)
set(CAPI_INTERFACE_REVISION 2)
set(CAPI_INTERFACE_AGE 10)
set(CAPI_INTERFACE_CURRENT 12)
set(CAPI_INTERFACE_REVISION 0)
set(CAPI_INTERFACE_AGE 11)
math(EXPR CAPI_VERSION_MAJOR "${CAPI_INTERFACE_CURRENT} - ${CAPI_INTERFACE_AGE}")
set(CAPI_VERSION_MINOR ${CAPI_INTERFACE_AGE})
......@@ -55,9 +76,6 @@ endif()
# Check custom global options
#################################################################################
option(GEOS_ENABLE_TESTS
"Set to OFF|ON (default) to control build of GEOS tests package" ON)
option(GEOS_ENABLE_INLINE
"Set to OFF|ON (default) to control GEOS compilation with small functions inlining" ON)
......@@ -66,6 +84,12 @@ if(NOT MSVC)
"Set to ON|OFF (default) to build GEOS with assert() macro enabled" OFF)
endif()
option(GEOS_ENABLE_TESTS
"Set to OFF|ON (default) to control build of GEOS tests package" ON)
option(GEOS_ENABLE_TESTS_UNIT2_ONLY
"Set to ON|OFF (default) to enable only new tests based on Catch (WIP: experimental)." OFF)
option(GEOS_BUILD_STATIC
"Set to OFF|ON (default) to build GEOS static libraries" ON)
......@@ -87,9 +111,6 @@ endif()
#################################################################################
# Setup C/C++ compiler options
#################################################################################
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT MSVC_IDE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
......@@ -102,10 +123,12 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-D_DEBUG)
endif()
add_definitions(-DUSE_UNSTABLE_GEOS_CPP_API)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# General options
set(CMAKE_CXX_FLAGS "-pedantic -ansi ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "-pedantic -ansi ${CMAKE_C_FLAGS}")
# Numerical stability
if(GEOS_ENABLE_FLOATSTORE)
......@@ -116,10 +139,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
"Forcing IEEE 754 using flag -ffloat-store - ${GEOS_ENABLE_FLOATSTORE}")
# Warnings specification
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -fno-implicit-inline-templates -Wconversion -pedantic -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion")
# Turn on Position Independent Code generation for GEOS C shared library
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wconversion -pedantic -Wmissing-prototypes -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion")
# Enable glibc ISO C99 features (macros isfinite, isnan)
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_ISOC99_SOURCE=1")
......@@ -130,16 +153,8 @@ elseif(MSVC)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if(NOT (MSVC_VERSION LESS 1400)) # Visual Studio 2005 or later
# Option is to enable the /MP switch for Visual Studio 2005 or later
option(GEOS_MSVC_ENABLE_MP
"Set to ON to build GEOS with the /MP option (Visual Studio 2005 and above)." ON)
mark_as_advanced(GEOS_MSVC_ENABLE_MP)
if(GEOS_MSVC_ENABLE_MP)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
message(STATUS "Setting Visual Studio 2005+ option /MP to ${GEOS_MSVC_ENABLE_MP}")
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
......@@ -249,62 +264,27 @@ include_directories(${PROJECT_BINARY_DIR})
#################################################################################
# Setup checks and generate config headers
#################################################################################
#################################################################################
# MACRO: GET_SVN_REVISION
#
# DESCRIPTION:
# MACRO FOR GETTING THE SVN revision for this build
#################################################################################
MACRO (GET_SVN_REVISION)
FIND_PACKAGE(Subversion)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
ENDIF()
ENDMACRO(GET_SVN_REVISION)
# Determine SVN/Git revision
# Determine SVN/Git revision
if(EXISTS "${PROJECT_SOURCE_DIR}/.svn")
GET_SVN_REVISION()
endif()
# geos_revision.h does not exists in source or binary directory, we generate it
if( NOT EXISTS "${PROJECT_SOURCE_DIR}/geos_revision.h" AND
NOT EXISTS "${PROJECT_BINARY_DIR}/geos_revision.h")
message(STATUS "Generating GEOS revision header in ${PROJECT_BINARY_DIR}/geos_revision.h")
# CI builds (Travis CI, AppVeyor, etc.) perform git clone, not svn checkout.
# So, CI environment needs a dummy revision to generate the required header.
if (DEFINED ENV{CI})
set(Project_WC_REVISION 999999)
endif()
if ( NOT ${Project_WC_REVISION} EQUAL 0 )
set( GEOS_REVISION ${Project_WC_REVISION} )
configure_file (
"${PROJECT_SOURCE_DIR}/tools/geos_revision_cmake.h.in"
"${PROJECT_BINARY_DIR}/geos_revision.h" )
else()
find_program(SH sh)
if(SH)
execute_process(COMMAND ${SH} -c
"cd ${PROJECT_SOURCE_DIR} && ${PROJECT_SOURCE_DIR}/tools/repo_revision.sh")
file(RENAME "${PROJECT_SOURCE_DIR}/geos_revision.h"
"${PROJECT_BINARY_DIR}/geos_revision.h")
else()
message("*** sh-compatible command not found, cannot create geos_revision.h")
message("*** Check SVN revision and create revision header manually:")
message("*** echo '#define GEOS_REVISION XYZ' > ${PROJECT_SOURCE_DIR}/geos_revision.h")
endif()
endif()
endif()
# End: Determine SVN/Git revision
find_package(Git)
message(STATUS "Generating GEOS ${PROJECT_BINARY_DIR}/geos_revision.h")
file(WRITE ${CMAKE_BINARY_DIR}/geos_revision.h.in "\#define GEOS_REVISION \"@GEOS_REVISION@\"\n")
file(WRITE ${CMAKE_BINARY_DIR}/geos_revision.cmake
"
execute_process(COMMAND \${GIT} describe --tags --always
WORKING_DIRECTORY \${CWD}
OUTPUT_VARIABLE GEOS_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(\${SRC} \${DST} @ONLY)
")
add_custom_target(geos_revision
COMMAND ${CMAKE_COMMAND}
-D CWD=${CMAKE_CURRENT_SOURCE_DIR}
-D GIT=${GIT_EXECUTABLE}
-D SRC=${PROJECT_BINARY_DIR}/geos_revision.h.in
-D DST=${PROJECT_BINARY_DIR}/geos_revision.h
-P ${PROJECT_BINARY_DIR}/geos_revision.cmake)
if(EXISTS ${PROJECT_SOURCE_DIR}/include/geos/platform.h)
message(STATUS "Disabling existing ${PROJECT_SOURCE_DIR}/include/geos/platform.h")
......@@ -338,17 +318,31 @@ configure_file(${PROJECT_SOURCE_DIR}/capi/geos_c.h.in
# Configure tests
#################################################################################
if(GEOS_ENABLE_TESTS)
if(GEOS_ENABLE_TESTS OR GEOS_ENABLE_TESTS_UNIT2_ONLY)
enable_testing()
# Define "make check" as alias for "make test"
add_custom_target(check COMMAND ctest)
endif()
#################################################################################
# Configure subdirectories
# IDE specifics
#################################################################################
if (MSVC_IDE)
# Visual Studio 2017 supports .editorconfig, copy it next to generated .sln
message(STATUS "Copying .editorconfig file to ${PROJECT_BINARY_DIR}")
file(COPY "${PROJECT_SOURCE_DIR}/.editorconfig"
DESTINATION "${PROJECT_BINARY_DIR}")
endif()
include(GenerateSourceGroups)
# Enable target debugging for CMake Tools in Visual Studio Code
# https://github.com/vector-of-bool/vscode-cmake-tools
include(CMakeToolsHelpers OPTIONAL)
#################################################################################
# Configure subdirectories
#################################################################################
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(capi)
......
This diff is collapsed.
......@@ -27,6 +27,7 @@ BUILT_SOURCES = geos_revision.h
EXTRA_DIST = acsite.m4 makefile.vc nmake.opt autogen.bat CMakeLists.txt \
cmake/modules/CheckPrototypeExists.cmake \
cmake/modules/COPYING-CMAKE-SCRIPTS \
cmake/modules/GenerateSourceGroups.cmake \
cmake/cmake_uninstall.cmake.in geos_revision.h
ACLOCAL_AMFLAGS = -I macros
......@@ -41,10 +42,7 @@ gen-ChangeLog:
elif test -d .svn; then \
svn2cl --authors=authors.svn -i -o $${owd}/ChangeLog; \
elif test -f ChangeLog; then \
echo "NOTE: distributing ChangeLog found in source dir"; \
cp ChangeLog $${owd}/ChangeLog; \
else \
echo "WARNING: could not find a ChangeLog" >&2; \
fi
apidoc doxygen:
......@@ -65,3 +63,8 @@ valgrindcheck:
$(VALGRIND) tests/unit/geos_unit
.PHONY: geos_revision.h
check-local:
! find . -name '*.cpp' -o -name '*.h' | \
grep -v ^./tests/xmltester/tinyxml | \
xargs grep -n '[[:space:]]$$'
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -102,6 +102,9 @@ subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/macros/ac_pkg_swig.m4 \
$(top_srcdir)/macros/ac_python_devel.m4 \
$(top_srcdir)/macros/ax_check_compile_flag.m4 \
$(top_srcdir)/macros/ax_cxx_compile_stdcxx.m4 \
$(top_srcdir)/macros/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/macros/libtool.m4 \
$(top_srcdir)/macros/ltoptions.m4 \
$(top_srcdir)/macros/ltsugar.m4 \
......@@ -177,8 +180,8 @@ CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING INSTALL NEWS \
README TODO compile config.guess config.sub install-sh \
ltmain.sh missing py-compile
TODO compile config.guess config.sub install-sh ltmain.sh \
missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
......@@ -262,6 +265,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX11 = @HAVE_CXX11@
INLINE_FLAGS = @INLINE_FLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
......@@ -410,6 +414,7 @@ BUILT_SOURCES = geos_revision.h
EXTRA_DIST = acsite.m4 makefile.vc nmake.opt autogen.bat CMakeLists.txt \
cmake/modules/CheckPrototypeExists.cmake \
cmake/modules/COPYING-CMAKE-SCRIPTS \
cmake/modules/GenerateSourceGroups.cmake \
cmake/cmake_uninstall.cmake.in geos_revision.h
ACLOCAL_AMFLAGS = -I macros
......@@ -635,7 +640,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
......@@ -661,7 +666,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
......@@ -679,7 +684,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
......@@ -689,7 +694,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
......@@ -759,6 +764,7 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile
......@@ -866,15 +872,15 @@ ps-am:
uninstall-am:
.MAKE: $(am__recursive_targets) all check install install-am \
.MAKE: $(am__recursive_targets) all check check-am install install-am \
install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
dist-tarZ dist-xz dist-zip distcheck distclean \
distclean-generic distclean-libtool distclean-tags \
am--refresh check check-am check-local clean clean-cscope \
clean-generic clean-libtool cscope cscopelist-am ctags \
ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \
dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \
distclean distclean-generic distclean-libtool distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
......@@ -899,10 +905,7 @@ gen-ChangeLog:
elif test -d .svn; then \
svn2cl --authors=authors.svn -i -o $${owd}/ChangeLog; \
elif test -f ChangeLog; then \
echo "NOTE: distributing ChangeLog found in source dir"; \
cp ChangeLog $${owd}/ChangeLog; \
else \
echo "WARNING: could not find a ChangeLog" >&2; \
fi
apidoc doxygen:
......@@ -922,6 +925,11 @@ valgrindcheck:
.PHONY: geos_revision.h
check-local:
! find . -name '*.cpp' -o -name '*.h' | \
grep -v ^./tests/xmltester/tinyxml | \
xargs grep -n '[[:space:]]$$'
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
Changes in 3.6.2
2017-07-25
Changes in 3.7.0alpha
2018-06-DD
- Bug fixes / improvements
- Fix exception in UnaryUnion of collection of touching polygons (#837)
- Allow building against python 3 (#774)
- Fix build with android-ndk and other compilers (#799)
- Allows compiling with -Wpointer-bool-conversion (#638)
- Fix unhandled exception on invalid fp operation (#811)
- Fix overloaded virtual print in DirectedEdge* (#812)
- AppVeyor CI build added (#813)
- Clean up numerous MSVC warnings, notably C4275 and C4589 (#814)
- Bump CMake version to 3.0.0 (#817)
- Fix leaks in WKT parser (#830)
- New things:
- CAPI: GEOSDistanceIndexed (#795, Dan Baston)
- CAPI: GEOSCoordSeq_isCCW (#870, Dan Baston)
- CAPI: GEOSGeom_getXMin, GEOSGeom_getXMax,
GEOSGeom_getYMin, GEOSGeom_getYMax (#871, Dan Baston)
- CAPI: GEOSFrechetDistance (#797, Shinichi SUGIYAMA)
- CAPI: GEOSReverse (#872, Dan Baston)
- Improvements
- Interruptible snap operation (Paul Ramsey)
- C++ API changes:
- Require defining USE_UNSTABLE_GEOS_CPP_API for use without
warnings.
Changes in 3.6.1
2016-12-24
......
GEOS -- Geometry Engine, Open Source
====================================
Project homepage: http://geos.osgeo.org/
## Build status
| branch / CI | Debbie | Winnie | Dronie | Travis CI | GitLab CI | AppVeyor |
|:--- |:--- |:--- |:--- |:--- |:--- |:--- |
| svn-trunk | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Trunk)](https://debbie.postgis.net/view/GEOS/job/GEOS_Trunk/) | [![winnie](https://debbie.postgis.net:444/view/GEOS/job/GEOS_matrix_trunk/badge/icon)](https://debbie.postgis.net:444/view/GEOS/job/GEOS_matrix_trunk/) | [![dronie](https://drone.osgeo.org/api/badges/geos/geos/status.svg?branch=svn-trunk)](https://drone.osgeo.org/geos/geos?branch=svn-trunk) | [![travis](https://travis-ci.org/OSGeo/geos.svg?branch=svn-trunk)](https://travis-ci.org/OSGeo/geos?branch=svn-trunk) | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/svn-trunk/build.svg)](https://gitlab.com/geos/libgeos/commits/svn-trunk) | [![appveyor](https://ci.appveyor.com/api/projects/status/ao909hwpsb1yu062/branch/svn-trunk?svg=true)](https://ci.appveyor.com/project/OSGeo/geos/branch/svn-trunk) |
| svn-3.6 | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Branch_3.6)](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.6/) | [![winnie](https://debbie.postgis.net:444/view/GEOS/job/GEOS_matrix_branch_3.6/badge/icon)](https://debbie.postgis.net:444/view/GEOS/job/GEOS_matrix_branch_3.6/) | [![dronie](https://drone.osgeo.org/api/badges/geos/geos/status.svg?branch=svn-3.6)](https://drone.osgeo.org/geos/geos?branch=svn-3.6) | [![travis](https://travis-ci.org/OSGeo/geos.svg?branch=svn-3.6)](https://travis-ci.org/OSGeo/geos?branch=svn-3.6) | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/svn-3.6/build.svg)](https://gitlab.com/geos/libgeos/commits/svn-3.6) | [![appveyor](https://ci.appveyor.com/api/projects/status/ao909hwpsb1yu062/branch/svn-3.6?svg=true)](https://ci.appveyor.com/project/OSGeo/geos/branch/svn-3.6) |
More on: https://trac.osgeo.org/geos#BuildandInstall
## Building, testing, installing
### Unix
Using Autotools:
./autogen.sh # in ${srcdir}, if obtained from SVN or GIT
${srcdir}/configure # in build dir
Using CMake:
cmake ${srcdir} # in build dir
Now, all versions:
make
make check
make install # as root
ldconfig # as root
### Microsoft Windows
If you use Microsoft Visual C++ (7.1 or later) compiler, you can build
GEOS using NMAKE program and provided `makefile.vc` files.
If you are building from SVN or GIT checkout, first run: `autogen.bat`
Then:
nmake /f makefile.vc MSVC_VER=1400
where 1400 is version number of Visual C++ compiler, here Visual C++ 8.0
from Visual Studio 2005 (supported versions are 1300, 1310, 1400, 1500,
1600, 1700, 1800 and 1900).
The bootstrap.bat step is required to generate a couple of header files.
In order to build debug configuration of GEOS, additional flag `DEBUG=1`
is required:
nmake /f makefile.vc MSVC_VER=1400 DEBUG=1
## Client applications
### Using the C interface (recommended)
To compile programs against the C lib (recommended):
CFLAGS += `geos-config --cflags`
LDFLAGS += `geos-config --ldflags` -lgeos_c
#include <geos_c.h>
Example usage:
capi/geostest.c contains basic usage examples.
### Using the C++ interface (discouraged)
NB: The C++ interface should not be used directly; the GEOS project
views it as a bug for another program to use the C++ interface or even
to directly link against the C++ library. The C++ library name will
change on every minor release because it is too hard to know if there
have been ABI changes. (The C library uses the C++ interface, but the
C library follows normal ABI-change-sensitive versioning, so programs
that link only against the C library should work without relinking
when GEOS is upgraded.)
To compile programs against the C++ lib:
CFLAGS += `geos-config --cflags`
LDFLAGS += `geos-config --ldflags` -lgeos
#include <geos.h>
Basic usage examples can be found in `doc/example.cpp`.
### Scripting language bindings
Ruby bindings are fully supported. To build, use the `--enable-ruby` option
when configuring:
./configure ... --enable-ruby
Since version 3.6.0 PHP bindings are not included in the core
library anymore but available as a separate project:
https://git.osgeo.org/gogs/geos/php-geos
Since version 3.0, the Python bindings are unsupported. Recommended options:
1. Become or recruit a new maintainer.
2. Use [Shapely](http://pypi.python.org/pypi/Shapely) with Python
versions 2.4 or greater.
3. Simply call functions from `libgeos_c` via Python ctypes.
## Documentation
To build Doxygen documentation:
cd doc
make doxygen-html
# generated automatically by aclocal 1.15 -*- Autoconf -*-
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2014 Free Software Foundation, Inc.
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.15], [],
m4_if([$1], [1.15.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
......@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.15])dnl
[AM_AUTOMAKE_VERSION([1.15.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -408,7 +408,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -605,7 +605,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -626,7 +626,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -648,7 +648,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -683,7 +683,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -733,7 +733,7 @@ rm -f confinc confmf
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2014 Free Software Foundation, Inc.
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -772,7 +772,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -801,7 +801,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -848,7 +848,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -867,7 +867,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -948,7 +948,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1008,7 +1008,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2014 Free Software Foundation, Inc.
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1036,7 +1036,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2014 Free Software Foundation, Inc.
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1055,7 +1055,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2014 Free Software Foundation, Inc.
# Copyright (C) 2004-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -1188,6 +1188,9 @@ AC_SUBST([am__untar])
m4_include([macros/ac_pkg_swig.m4])
m4_include([macros/ac_python_devel.m4])
m4_include([macros/ax_check_compile_flag.m4])
m4_include([macros/ax_cxx_compile_stdcxx.m4])
m4_include([macros/ax_cxx_compile_stdcxx_11.m4])
m4_include([macros/libtool.m4])
m4_include([macros/ltoptions.m4])
m4_include([macros/ltsugar.m4])
......
......@@ -14,4 +14,5 @@ set GEOS_HEADERS=include\geos
COPY %GEOS_HEADERS%\version.h.vc %GEOS_HEADERS%\version.h
COPY %GEOS_HEADERS%\platform.h.vc %GEOS_HEADERS%\platform.h
COPY capi\geos_c.h.in capi\geos_c.h
@ECHO #define GEOS_REVISION "0" > geos_revision.h
REM Empty string as dummy git SHA-1
@ECHO #define GEOS_REVISION "" > geos_revision.h
......@@ -42,6 +42,8 @@ if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK)
endif()
add_dependencies(geos_c geos_revision)
#################################################################################
# Installation
#################################################################################
......
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -94,6 +94,9 @@ subdir = capi
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/macros/ac_pkg_swig.m4 \
$(top_srcdir)/macros/ac_python_devel.m4 \
$(top_srcdir)/macros/ax_check_compile_flag.m4 \
$(top_srcdir)/macros/ax_cxx_compile_stdcxx.m4 \
$(top_srcdir)/macros/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/macros/libtool.m4 \
$(top_srcdir)/macros/ltoptions.m4 \
$(top_srcdir)/macros/ltsugar.m4 \
......@@ -254,6 +257,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX11 = @HAVE_CXX11@
INLINE_FLAGS = @INLINE_FLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
......
......@@ -3,7 +3,7 @@
*
* C-Wrapper for GEOS library
*
* Copyright (C) 2010 2011 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2010 2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2005-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
......@@ -11,7 +11,7 @@
* by the Free Software Foundation.
* See the COPYING file for more information.
*
* Author: Sandro Santilli <strk@keybit.net>
* Author: Sandro Santilli <strk@kbt.io>
*
***********************************************************************/
......@@ -21,10 +21,10 @@
#include <geos/io/WKBReader.h>
#include <geos/io/WKTWriter.h>
#include <geos/io/WKBWriter.h>
#include <geos/io/CLocalizer.h>
#include <geos/operation/overlay/OverlayOp.h>
#include <geos/operation/union/CascadedPolygonUnion.h>
#include <geos/algorithm/distance/DiscreteHausdorffDistance.h>
#include <geos/algorithm/distance/DiscreteFrechetDistance.h>
#include <geos/util/Interrupt.h>
#include <stdexcept>
......@@ -73,7 +73,6 @@ using geos::io::WKTReader;
using geos::io::WKTWriter;
using geos::io::WKBReader;
using geos::io::WKBWriter;
using geos::io::CLocalizer;
using geos::index::strtree::STRtree;
......@@ -81,7 +80,7 @@ using geos::operation::overlay::OverlayOp;
using geos::operation::overlay::overlayOp;
using geos::operation::geounion::CascadedPolygonUnion;
typedef std::auto_ptr<Geometry> GeomAutoPtr;
typedef std::unique_ptr<Geometry> GeomPtr;
//## GLOBALS ################################################
......@@ -278,6 +277,12 @@ GEOSDistance(const Geometry *g1, const Geometry *g2, double *dist)
return GEOSDistance_r( handle, g1, g2, dist );
}
int
GEOSDistanceIndexed(const Geometry *g1, const Geometry *g2, double *dist)
{
return GEOSDistanceIndexed_r( handle, g1, g2, dist );
}
int
GEOSHausdorffDistance(const Geometry *g1, const Geometry *g2, double *dist)
{
......@@ -290,6 +295,18 @@ GEOSHausdorffDistanceDensify(const Geometry *g1, const Geometry *g2, double dens
return GEOSHausdorffDistanceDensify_r( handle, g1, g2, densifyFrac, dist );
}
int
GEOSFrechetDistance(const Geometry *g1, const Geometry *g2, double *dist)
{
return GEOSFrechetDistance_r( handle, g1, g2, dist );
}
int
GEOSFrechetDistanceDensify(const Geometry *g1, const Geometry *g2, double densifyFrac, double *dist)
{
return GEOSFrechetDistanceDensify_r( handle, g1, g2, densifyFrac, dist );
}
int
GEOSArea(const Geometry *g, double *area)
{
......@@ -705,6 +722,12 @@ GEOSLineMerge(const Geometry *g)
return GEOSLineMerge_r( handle, g );
}
Geometry *
GEOSReverse(const Geometry *g)
{
return GEOSReverse_r( handle, g );
}
int
GEOSGetSRID(const Geometry *g)
{
......@@ -832,6 +855,12 @@ GEOSCoordSeq_getDimensions(const CoordinateSequence *s, unsigned int *dims)
return GEOSCoordSeq_getDimensions_r( handle, s, dims );
}
int
GEOSCoordSeq_isCCW(const CoordinateSequence *s, char *is_ccw)
{
return GEOSCoordSeq_isCCW_r(handle, s, is_ccw);
}
void
GEOSCoordSeq_destroy(CoordinateSequence *s)
{
......@@ -898,6 +927,26 @@ GEOSGeom_getCoordinateDimension(const Geometry *g)
return GEOSGeom_getCoordinateDimension_r( handle, g );
}
int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value)
{
return GEOSGeom_getXMin_r(handle, g, value);
}
int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value)
{
return GEOSGeom_getYMin_r(handle, g, value);
}
int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value)
{
return GEOSGeom_getXMax_r(handle, g, value);
}
int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value)
{
return GEOSGeom_getYMax_r(handle, g, value);
}
Geometry *
GEOSSimplify(const Geometry *g, double tolerance)
{
......@@ -1345,4 +1394,15 @@ GEOSVoronoiDiagram(const Geometry *g, const Geometry *env, double tolerance, int
return GEOSVoronoiDiagram_r(handle, g, env, tolerance, onlyEdges);
}
int
GEOSSegmentIntersection(double ax0, double ay0, double ax1, double ay1,
double bx0, double by0, double bx1, double by1,
double* cx, double* cy)
{
return GEOSSegmentIntersection_r(handle,
ax0, ay0, ax1, ay1,
bx0, by0, bx1, by1,
cx, cy);
}
} /* extern "C" */
......@@ -3,7 +3,7 @@
*
* C-Wrapper for GEOS library
*
* Copyright (C) 2010 2011 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2010 2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2005 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
......@@ -11,7 +11,7 @@
* by the Free Software Foundation.
* See the COPYING file for more information.
*
* Author: Sandro Santilli <strk@keybit.net>
* Author: Sandro Santilli <strk@kbt.io>
*
***********************************************************************
*
......@@ -59,30 +59,30 @@ extern "C" {
#if defined(_MSC_VER)
#include <geos/version.h>
#define GEOS_CAPI_VERSION_MAJOR 1
#define GEOS_CAPI_VERSION_MINOR 10
#define GEOS_CAPI_VERSION_PATCH 2
#define GEOS_CAPI_VERSION "3.6.2-CAPI-1.10.2"
#define GEOS_CAPI_VERSION_MINOR 11
#define GEOS_CAPI_VERSION_PATCH 0
#define GEOS_CAPI_VERSION "3.7.0-CAPI-1.11.0"
#else
#ifndef GEOS_VERSION_MAJOR
#define GEOS_VERSION_MAJOR 3
#endif
#ifndef GEOS_VERSION_MINOR
#define GEOS_VERSION_MINOR 6
#define GEOS_VERSION_MINOR 7
#endif
#ifndef GEOS_VERSION_PATCH
#define GEOS_VERSION_PATCH 2
#define GEOS_VERSION_PATCH 0alpha
#endif
#ifndef GEOS_VERSION
#define GEOS_VERSION "3.6.2"
#define GEOS_VERSION "3.7.0alpha"
#endif
#ifndef GEOS_JTS_PORT
#define GEOS_JTS_PORT "1.13.0"
#endif
#define GEOS_CAPI_VERSION_MAJOR 1
#define GEOS_CAPI_VERSION_MINOR 10
#define GEOS_CAPI_VERSION_PATCH 2
#define GEOS_CAPI_VERSION "3.6.2-CAPI-1.10.2"
#define GEOS_CAPI_VERSION_MINOR 11
#define GEOS_CAPI_VERSION_PATCH 0
#define GEOS_CAPI_VERSION "3.7.0alpha-CAPI-1.11.0"
#endif
#define GEOS_CAPI_FIRST_INTERFACE GEOS_CAPI_VERSION_MAJOR
......@@ -346,6 +346,14 @@ extern int GEOS_DLL GEOSCoordSeq_getSize_r(GEOSContextHandle_t handle,
extern int GEOS_DLL GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t handle,
const GEOSCoordSequence* s,
unsigned int *dims);
/*
* Check orientation of a CoordinateSequence and set 'is_ccw' to 1
* if it has counter-clockwise orientation, 0 otherwise.
* Return 0 on exception, 1 on success.
*/
extern int GEOS_DLL GEOSCoordSeq_isCCW_r(GEOSContextHandle_t handle,
const GEOSCoordSequence* s,
char* is_ccw);
/************************************************************************
*
......@@ -638,6 +646,8 @@ extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full_r(GEOSContextHandle_t handle,
extern GEOSGeometry GEOS_DLL *GEOSLineMerge_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSReverse_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSSimplify_r(GEOSContextHandle_t handle,
const GEOSGeometry* g,
double tolerance);
......@@ -711,6 +721,30 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram_r(
double tolerance,
int onlyEdges);
/*
* Computes the coordinate where two line segments intersect, if any
*
* @param ax0 x-coordinate of first point in first segment
* @param ay0 y-coordinate of first point in first segment
* @param ax1 x-coordinate of second point in first segment
* @param ay1 y-coordinate of second point in first segment
* @param bx0 x-coordinate of first point in second segment
* @param by0 y-coordinate of first point in second segment
* @param bx1 x-coordinate of second point in second segment
* @param by1 y-coordinate of second point in second segment
* @param cx x-coordinate of intersection point
* @param cy y-coordinate of intersection point
*
* @return 0 on error, 1 on success, -1 if segments do not intersect
*/
extern int GEOS_DLL GEOSSegmentIntersection_r(
GEOSContextHandle_t extHandle,
double ax0, double ay0,
double ax1, double ay1,
double bx0, double by0,
double bx1, double by1,
double* cx, double* cy);
/************************************************************************
*
......@@ -1077,6 +1111,13 @@ extern int GEOS_DLL GEOSGeom_getDimensions_r(GEOSContextHandle_t handle,
*/
extern int GEOS_DLL GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
/*
* Return 0 on exception
*/
extern int GEOS_DLL GEOSGeom_getXMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getXMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
/*
* Return NULL on exception.
......@@ -1100,6 +1141,9 @@ extern int GEOS_DLL GEOSLength_r(GEOSContextHandle_t handle,
extern int GEOS_DLL GEOSDistance_r(GEOSContextHandle_t handle,
const GEOSGeometry* g1,
const GEOSGeometry* g2, double *dist);
extern int GEOS_DLL GEOSDistanceIndexed_r(GEOSContextHandle_t handle,
const GEOSGeometry* g1,
const GEOSGeometry* g2, double *dist);
extern int GEOS_DLL GEOSHausdorffDistance_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
......@@ -1108,6 +1152,14 @@ extern int GEOS_DLL GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
double densifyFrac, double *dist);
extern int GEOS_DLL GEOSFrechetDistance_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
double *dist);
extern int GEOS_DLL GEOSFrechetDistanceDensify_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
double densifyFrac, double *dist);
extern int GEOS_DLL GEOSGeomGetLength_r(GEOSContextHandle_t handle,
const GEOSGeometry *g, double *length);
......@@ -1352,6 +1404,13 @@ extern int GEOS_DLL GEOSCoordSeq_getSize(const GEOSCoordSequence* s,
extern int GEOS_DLL GEOSCoordSeq_getDimensions(const GEOSCoordSequence* s,
unsigned int *dims);
/*
* Check orientation of a CoordinateSequence and set 'is_ccw' to 1
* if it has counter-clockwise orientation, 0 otherwise.
* Return 0 on exception, 1 on success.
*/
extern int GEOS_DLL GEOSCoordSeq_isCCW(const GEOSCoordSequence* s, char* is_ccw);
/************************************************************************
*
* Linear referencing functions -- there are more, but these are
......@@ -1585,6 +1644,7 @@ extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full(const GEOSGeometry* input,
GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid);
extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSReverse(const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSSimplify(const GEOSGeometry* g, double tolerance);
extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify(const GEOSGeometry* g,
double tolerance);
......@@ -1651,6 +1711,29 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram(
const GEOSGeometry *env,
double tolerance,
int onlyEdges);
/*
* Computes the coordinate where two line segments intersect, if any
*
* @param ax0 x-coordinate of first point in first segment
* @param ay0 y-coordinate of first point in first segment
* @param ax1 x-coordinate of second point in first segment
* @param ay1 y-coordinate of second point in first segment
* @param bx0 x-coordinate of first point in second segment
* @param by0 y-coordinate of first point in second segment
* @param bx1 x-coordinate of second point in second segment
* @param by1 y-coordinate of second point in second segment
* @param cx x-coordinate of intersection point
* @param cy y-coordinate of intersection point
*
* @return 0 on error, 1 on success, -1 if segments do not intersect
*/
extern int GEOS_DLL GEOSSegmentIntersection(
double ax0, double ay0,
double ax1, double ay1,
double bx0, double by0,
double bx1, double by1,
double* cx, double* cy);
/************************************************************************
*
......@@ -1944,6 +2027,14 @@ extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g);
*/
extern int GEOS_DLL GEOSGeom_getCoordinateDimension(const GEOSGeometry* g);
/*
* Return 0 on exception
*/
extern int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value);
/*
* Return NULL on exception.
* Must be LineString and must be freed by called.
......@@ -1963,10 +2054,16 @@ extern int GEOS_DLL GEOSArea(const GEOSGeometry* g, double *area);
extern int GEOS_DLL GEOSLength(const GEOSGeometry* g, double *length);
extern int GEOS_DLL GEOSDistance(const GEOSGeometry* g1, const GEOSGeometry* g2,
double *dist);
extern int GEOS_DLL GEOSDistanceIndexed(const GEOSGeometry* g1, const GEOSGeometry* g2,
double *dist);
extern int GEOS_DLL GEOSHausdorffDistance(const GEOSGeometry *g1,
const GEOSGeometry *g2, double *dist);
extern int GEOS_DLL GEOSHausdorffDistanceDensify(const GEOSGeometry *g1,
const GEOSGeometry *g2, double densifyFrac, double *dist);
extern int GEOS_DLL GEOSFrechetDistance(const GEOSGeometry *g1,
const GEOSGeometry *g2, double *dist);
extern int GEOS_DLL GEOSFrechetDistanceDensify(const GEOSGeometry *g1,
const GEOSGeometry *g2, double densifyFrac, double *dist);
extern int GEOS_DLL GEOSGeomGetLength(const GEOSGeometry *g, double *length);
/* Return 0 on exception, the closest points of the two geometries otherwise.
......
......@@ -3,7 +3,7 @@
*
* C-Wrapper for GEOS library
*
* Copyright (C) 2010 2011 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2010 2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2005 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
......@@ -11,7 +11,7 @@
* by the Free Software Foundation.
* See the COPYING file for more information.
*
* Author: Sandro Santilli <strk@keybit.net>
* Author: Sandro Santilli <strk@kbt.io>
*
***********************************************************************
*
......@@ -59,9 +59,9 @@ extern "C" {
#if defined(_MSC_VER)
#include <geos/version.h>
#define GEOS_CAPI_VERSION_MAJOR 1
#define GEOS_CAPI_VERSION_MINOR 10
#define GEOS_CAPI_VERSION_PATCH 2
#define GEOS_CAPI_VERSION "3.6.2-CAPI-1.10.2"
#define GEOS_CAPI_VERSION_MINOR 11
#define GEOS_CAPI_VERSION_PATCH 0
#define GEOS_CAPI_VERSION "3.7.0-CAPI-1.11.0"
#else
#ifndef GEOS_VERSION_MAJOR
#define GEOS_VERSION_MAJOR @VERSION_MAJOR@
......@@ -346,6 +346,14 @@ extern int GEOS_DLL GEOSCoordSeq_getSize_r(GEOSContextHandle_t handle,
extern int GEOS_DLL GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t handle,
const GEOSCoordSequence* s,
unsigned int *dims);
/*
* Check orientation of a CoordinateSequence and set 'is_ccw' to 1
* if it has counter-clockwise orientation, 0 otherwise.
* Return 0 on exception, 1 on success.
*/
extern int GEOS_DLL GEOSCoordSeq_isCCW_r(GEOSContextHandle_t handle,
const GEOSCoordSequence* s,
char* is_ccw);
/************************************************************************
*
......@@ -638,6 +646,8 @@ extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full_r(GEOSContextHandle_t handle,
extern GEOSGeometry GEOS_DLL *GEOSLineMerge_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSReverse_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSSimplify_r(GEOSContextHandle_t handle,
const GEOSGeometry* g,
double tolerance);
......@@ -711,6 +721,30 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram_r(
double tolerance,
int onlyEdges);
/*
* Computes the coordinate where two line segments intersect, if any
*
* @param ax0 x-coordinate of first point in first segment
* @param ay0 y-coordinate of first point in first segment
* @param ax1 x-coordinate of second point in first segment
* @param ay1 y-coordinate of second point in first segment
* @param bx0 x-coordinate of first point in second segment
* @param by0 y-coordinate of first point in second segment
* @param bx1 x-coordinate of second point in second segment
* @param by1 y-coordinate of second point in second segment
* @param cx x-coordinate of intersection point
* @param cy y-coordinate of intersection point
*
* @return 0 on error, 1 on success, -1 if segments do not intersect
*/
extern int GEOS_DLL GEOSSegmentIntersection_r(
GEOSContextHandle_t extHandle,
double ax0, double ay0,
double ax1, double ay1,
double bx0, double by0,
double bx1, double by1,
double* cx, double* cy);
/************************************************************************
*
......@@ -1077,6 +1111,13 @@ extern int GEOS_DLL GEOSGeom_getDimensions_r(GEOSContextHandle_t handle,
*/
extern int GEOS_DLL GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t handle,
const GEOSGeometry* g);
/*
* Return 0 on exception
*/
extern int GEOS_DLL GEOSGeom_getXMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getXMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value);
/*
* Return NULL on exception.
......@@ -1100,6 +1141,9 @@ extern int GEOS_DLL GEOSLength_r(GEOSContextHandle_t handle,
extern int GEOS_DLL GEOSDistance_r(GEOSContextHandle_t handle,
const GEOSGeometry* g1,
const GEOSGeometry* g2, double *dist);
extern int GEOS_DLL GEOSDistanceIndexed_r(GEOSContextHandle_t handle,
const GEOSGeometry* g1,
const GEOSGeometry* g2, double *dist);
extern int GEOS_DLL GEOSHausdorffDistance_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
......@@ -1108,6 +1152,14 @@ extern int GEOS_DLL GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
double densifyFrac, double *dist);
extern int GEOS_DLL GEOSFrechetDistance_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
double *dist);
extern int GEOS_DLL GEOSFrechetDistanceDensify_r(GEOSContextHandle_t handle,
const GEOSGeometry *g1,
const GEOSGeometry *g2,
double densifyFrac, double *dist);
extern int GEOS_DLL GEOSGeomGetLength_r(GEOSContextHandle_t handle,
const GEOSGeometry *g, double *length);
......@@ -1352,6 +1404,13 @@ extern int GEOS_DLL GEOSCoordSeq_getSize(const GEOSCoordSequence* s,
extern int GEOS_DLL GEOSCoordSeq_getDimensions(const GEOSCoordSequence* s,
unsigned int *dims);
/*
* Check orientation of a CoordinateSequence and set 'is_ccw' to 1
* if it has counter-clockwise orientation, 0 otherwise.
* Return 0 on exception, 1 on success.
*/
extern int GEOS_DLL GEOSCoordSeq_isCCW(const GEOSCoordSequence* s, char* is_ccw);
/************************************************************************
*
* Linear referencing functions -- there are more, but these are
......@@ -1585,6 +1644,7 @@ extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full(const GEOSGeometry* input,
GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid);
extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSReverse(const GEOSGeometry* g);
extern GEOSGeometry GEOS_DLL *GEOSSimplify(const GEOSGeometry* g, double tolerance);
extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify(const GEOSGeometry* g,
double tolerance);
......@@ -1651,6 +1711,29 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram(
const GEOSGeometry *env,
double tolerance,
int onlyEdges);
/*
* Computes the coordinate where two line segments intersect, if any
*
* @param ax0 x-coordinate of first point in first segment
* @param ay0 y-coordinate of first point in first segment
* @param ax1 x-coordinate of second point in first segment
* @param ay1 y-coordinate of second point in first segment
* @param bx0 x-coordinate of first point in second segment
* @param by0 y-coordinate of first point in second segment
* @param bx1 x-coordinate of second point in second segment
* @param by1 y-coordinate of second point in second segment
* @param cx x-coordinate of intersection point
* @param cy y-coordinate of intersection point
*
* @return 0 on error, 1 on success, -1 if segments do not intersect
*/
extern int GEOS_DLL GEOSSegmentIntersection(
double ax0, double ay0,
double ax1, double ay1,
double bx0, double by0,
double bx1, double by1,
double* cx, double* cy);
/************************************************************************
*
......@@ -1944,6 +2027,14 @@ extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g);
*/
extern int GEOS_DLL GEOSGeom_getCoordinateDimension(const GEOSGeometry* g);
/*
* Return 0 on exception
*/
extern int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value);
extern int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value);
/*
* Return NULL on exception.
* Must be LineString and must be freed by called.
......@@ -1963,10 +2054,16 @@ extern int GEOS_DLL GEOSArea(const GEOSGeometry* g, double *area);
extern int GEOS_DLL GEOSLength(const GEOSGeometry* g, double *length);
extern int GEOS_DLL GEOSDistance(const GEOSGeometry* g1, const GEOSGeometry* g2,
double *dist);
extern int GEOS_DLL GEOSDistanceIndexed(const GEOSGeometry* g1, const GEOSGeometry* g2,
double *dist);
extern int GEOS_DLL GEOSHausdorffDistance(const GEOSGeometry *g1,
const GEOSGeometry *g2, double *dist);
extern int GEOS_DLL GEOSHausdorffDistanceDensify(const GEOSGeometry *g1,
const GEOSGeometry *g2, double densifyFrac, double *dist);
extern int GEOS_DLL GEOSFrechetDistance(const GEOSGeometry *g1,
const GEOSGeometry *g2, double *dist);
extern int GEOS_DLL GEOSFrechetDistanceDensify(const GEOSGeometry *g1,
const GEOSGeometry *g2, double densifyFrac, double *dist);
extern int GEOS_DLL GEOSGeomGetLength(const GEOSGeometry *g, double *length);
/* Return 0 on exception, the closest points of the two geometries otherwise.
......
......@@ -3,7 +3,7 @@
*
* C-Wrapper for GEOS library
*
* Copyright (C) 2010-2012 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2010-2012 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2005-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
......@@ -11,12 +11,13 @@
* by the Free Software Foundation.
* See the COPYING file for more information.
*
* Author: Sandro Santilli <strk@keybit.net>
* Author: Sandro Santilli <strk@kbt.io>
* Thread Safety modifications: Chuck Thibert <charles.thibert@ingres.com>
*
***********************************************************************/
#include <geos/platform.h> // for FINITE
#include <geos/geom/Coordinate.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/prep/PreparedGeometry.h>
#include <geos/geom/prep/PreparedGeometryFactory.h>
......@@ -27,6 +28,7 @@
#include <geos/geom/MultiLineString.h>
#include <geos/geom/MultiPolygon.h>
#include <geos/geom/LinearRing.h>
#include <geos/geom/LineSegment.h>
#include <geos/geom/LineString.h>
#include <geos/geom/PrecisionModel.h>
#include <geos/geom/GeometryFactory.h>
......@@ -42,6 +44,7 @@
#include <geos/io/WKTWriter.h>
#include <geos/io/WKBWriter.h>
#include <geos/algorithm/distance/DiscreteHausdorffDistance.h>
#include <geos/algorithm/distance/DiscreteFrechetDistance.h>
#include <geos/algorithm/CGAlgorithms.h>
#include <geos/algorithm/BoundaryNodeRule.h>
#include <geos/algorithm/MinimumDiameter.h>
......@@ -53,6 +56,7 @@
#include <geos/operation/buffer/BufferOp.h>
#include <geos/operation/buffer/BufferParameters.h>
#include <geos/operation/distance/DistanceOp.h>
#include <geos/operation/distance/IndexedFacetDistance.h>
#include <geos/operation/linemerge/LineMerger.h>
#include <geos/operation/overlay/OverlayOp.h>
#include <geos/operation/overlay/snap/GeometrySnapper.h>
......@@ -122,8 +126,12 @@ using namespace std;
// import the most frequently used definitions globally
using geos::geom::Geometry;
using geos::geom::LineString;
using geos::geom::LinearRing;
using geos::geom::MultiLineString;
using geos::geom::MultiPolygon;
using geos::geom::Polygon;
using geos::geom::CoordinateSequence;
using geos::geom::GeometryCollection;
using geos::geom::GeometryFactory;
using geos::io::WKTReader;
......@@ -134,13 +142,15 @@ using geos::io::WKBWriter;
using geos::operation::overlay::OverlayOp;
using geos::operation::overlay::overlayOp;
using geos::operation::geounion::CascadedPolygonUnion;
using geos::operation::distance::IndexedFacetDistance;
using geos::operation::buffer::BufferParameters;
using geos::operation::buffer::BufferBuilder;
using geos::precision::GeometryPrecisionReducer;
using geos::util::IllegalArgumentException;
using geos::algorithm::distance::DiscreteHausdorffDistance;
using geos::algorithm::distance::DiscreteFrechetDistance;
typedef std::auto_ptr<Geometry> GeomAutoPtr;
typedef std::unique_ptr<Geometry> GeomPtr;
typedef struct GEOSContextHandle_HS
{
......@@ -270,7 +280,7 @@ class CAPI_ItemVisitor : public geos::index::ItemVisitor {
public:
CAPI_ItemVisitor (GEOSQueryCallback cb, void *ud)
: ItemVisitor(), callback(cb), userdata(ud) {}
void visitItem (void *item) { callback(item, userdata); }
void visitItem (void *item) override { callback(item, userdata); }
};
......@@ -1157,6 +1167,40 @@ GEOSDistance_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry
return 0;
}
int
GEOSDistanceIndexed_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double *dist)
{
assert(0 != dist);
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
*dist = IndexedFacetDistance::distance(g1, g2);
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
int
GEOSHausdorffDistance_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double *dist)
{
......@@ -1225,6 +1269,74 @@ GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t extHandle, const Geometry *g1
return 0;
}
int
GEOSFrechetDistance_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double *dist)
{
assert(0 != dist);
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
*dist = DiscreteFrechetDistance::distance(*g1, *g2);
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
int
GEOSFrechetDistanceDensify_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2, double densifyFrac, double *dist)
{
assert(0 != dist);
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
*dist = DiscreteFrechetDistance::distance(*g1, *g2, densifyFrac);
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
int
GEOSArea_r(GEOSContextHandle_t extHandle, const Geometry *g, double *area)
{
......@@ -2296,7 +2408,7 @@ GEOSUnaryUnion_r(GEOSContextHandle_t extHandle, const Geometry *g)
try
{
GeomAutoPtr g3 ( g->Union() );
GeomPtr g3 ( g->Union() );
return g3.release();
}
catch (const std::exception &e)
......@@ -2335,7 +2447,7 @@ GEOSNode_r(GEOSContextHandle_t extHandle, const Geometry *g)
try
{
std::auto_ptr<Geometry> g3 = geos::noding::GeometryNoder::node(*g);
std::unique_ptr<Geometry> g3 = geos::noding::GeometryNoder::node(*g);
return g3.release();
}
catch (const std::exception &e)
......@@ -2454,7 +2566,7 @@ GEOSClipByRect_r(GEOSContextHandle_t extHandle, const Geometry *g, double xmin,
using geos::operation::intersection::Rectangle;
using geos::operation::intersection::RectangleIntersection;
Rectangle rect(xmin, ymin, xmax, ymax);
std::auto_ptr<Geometry> g3 = RectangleIntersection::clip(*g, rect);
std::unique_ptr<Geometry> g3 = RectangleIntersection::clip(*g, rect);
return g3.release();
}
catch (const std::exception &e)
......@@ -3621,6 +3733,39 @@ GEOSLineMerge_r(GEOSContextHandle_t extHandle, const Geometry *g)
return out;
}
Geometry *
GEOSReverse_r(GEOSContextHandle_t extHandle, const Geometry *g)
{
assert(0 != g);
if ( 0 == extHandle )
{
return nullptr;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return nullptr;
}
try
{
return g->reverse();
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return nullptr;
}
void*
GEOSGeom_getUserData_r(GEOSContextHandle_t extHandle, const Geometry *g)
{
......@@ -4059,6 +4204,40 @@ GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t extHandle, const CoordinateSequ
return 0;
}
int
GEOSCoordSeq_isCCW_r(GEOSContextHandle_t extHandle, const CoordinateSequence *cs, char *val)
{
assert(cs != nullptr);
assert(val != nullptr);
if (extHandle == nullptr) {
return 0;
}
GEOSContextHandleInternal_t *handle = nullptr;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
*val = geos::algorithm::CGAlgorithms::isCCW(cs);
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
void
GEOSCoordSeq_destroy_r(GEOSContextHandle_t extHandle, CoordinateSequence *s)
{
......@@ -4445,10 +4624,10 @@ GEOSGeom_setPrecision_r(GEOSContextHandle_t extHandle, const GEOSGeometry *g,
{
const PrecisionModel *pm = g->getPrecisionModel();
double cursize = pm->isFloating() ? 0 : 1.0/pm->getScale();
std::auto_ptr<PrecisionModel> newpm;
std::unique_ptr<PrecisionModel> newpm;
if ( gridSize ) newpm.reset( new PrecisionModel(1.0/gridSize) );
else newpm.reset( new PrecisionModel() );
GeometryFactory::unique_ptr gf =
GeometryFactory::Ptr gf =
GeometryFactory::create( newpm.get(), g->getSRID() );
Geometry *ret;
if ( gridSize && cursize != gridSize )
......@@ -4577,6 +4756,154 @@ GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t extHandle, const Geometry
return 0;
}
int
GEOSGeom_getXMin_r(GEOSContextHandle_t extHandle, const Geometry *g, double *value)
{
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
if (g->isEmpty())
{
return 0;
}
*value = g->getEnvelopeInternal()->getMinX();
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
int
GEOSGeom_getXMax_r(GEOSContextHandle_t extHandle, const Geometry *g, double *value)
{
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
if (g->isEmpty())
{
return 0;
}
*value = g->getEnvelopeInternal()->getMaxX();
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
int
GEOSGeom_getYMin_r(GEOSContextHandle_t extHandle, const Geometry *g, double *value)
{
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
if (g->isEmpty())
{
return 0;
}
*value = g->getEnvelopeInternal()->getMinY();
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
int
GEOSGeom_getYMax_r(GEOSContextHandle_t extHandle, const Geometry *g, double *value)
{
if ( 0 == extHandle )
{
return 0;
}
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized )
{
return 0;
}
try
{
if (g->isEmpty())
{
return 0;
}
*value = g->getEnvelopeInternal()->getMaxY();
return 1;
}
catch (const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch (...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
Geometry *
GEOSSimplify_r(GEOSContextHandle_t extHandle, const Geometry *g1, double tolerance)
{
......@@ -4595,7 +4922,7 @@ GEOSSimplify_r(GEOSContextHandle_t extHandle, const Geometry *g1, double toleran
try
{
using namespace geos::simplify;
Geometry::AutoPtr g(DouglasPeuckerSimplifier::simplify(g1, tolerance));
Geometry::Ptr g(DouglasPeuckerSimplifier::simplify(g1, tolerance));
return g.release();
}
catch (const std::exception &e)
......@@ -4628,7 +4955,7 @@ GEOSTopologyPreserveSimplify_r(GEOSContextHandle_t extHandle, const Geometry *g1
try
{
using namespace geos::simplify;
Geometry::AutoPtr g(TopologyPreservingSimplifier::simplify(g1, tolerance));
Geometry::Ptr g(TopologyPreservingSimplifier::simplify(g1, tolerance));
return g.release();
}
catch (const std::exception &e)
......@@ -6071,7 +6398,7 @@ GEOSSTRtree_nearest_r(GEOSContextHandle_t extHandle,
geos::index::strtree::STRtree *tree,
const geos::geom::Geometry* geom)
{
return (const GEOSGeometry*) GEOSSTRtree_nearest_generic_r( extHandle, tree, geom, geom->getEnvelope(), NULL, NULL);
return (const GEOSGeometry*) GEOSSTRtree_nearest_generic_r( extHandle, tree, geom, geom, nullptr, nullptr);
}
const void *
......@@ -6082,6 +6409,7 @@ GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t extHandle,
GEOSDistanceCallback distancefn,
void* userdata)
{
using namespace geos::index::strtree;
GEOSContextHandleInternal_t *handle = 0;
......@@ -6092,7 +6420,7 @@ GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t extHandle,
GEOSDistanceCallback m_distancefn;
void* m_userdata;
double distance(const ItemBoundable* item1, const ItemBoundable* item2) {
double distance(const ItemBoundable* item1, const ItemBoundable* item2) override {
const void* a = item1->getItem();
const void* b = item2->getItem();
double d;
......@@ -6471,7 +6799,7 @@ GEOSSharedPaths_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const G
const GeometryFactory* factory = g1->getFactory();
size_t count;
std::auto_ptr< std::vector<Geometry*> > out1(
std::unique_ptr< std::vector<Geometry*> > out1(
new std::vector<Geometry*>()
);
count = forw.size();
......@@ -6479,11 +6807,11 @@ GEOSSharedPaths_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const G
for (size_t i=0; i<count; ++i) {
out1->push_back(forw[i]);
}
std::auto_ptr<Geometry> out1g (
std::unique_ptr<Geometry> out1g (
factory->createMultiLineString(out1.release())
);
std::auto_ptr< std::vector<Geometry*> > out2(
std::unique_ptr< std::vector<Geometry*> > out2(
new std::vector<Geometry*>()
);
count = back.size();
......@@ -6491,18 +6819,18 @@ GEOSSharedPaths_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const G
for (size_t i=0; i<count; ++i) {
out2->push_back(back[i]);
}
std::auto_ptr<Geometry> out2g (
std::unique_ptr<Geometry> out2g (
factory->createMultiLineString(out2.release())
);
std::auto_ptr< std::vector<Geometry*> > out(
std::unique_ptr< std::vector<Geometry*> > out(
new std::vector<Geometry*>()
);
out->reserve(2);
out->push_back(out1g.release());
out->push_back(out2g.release());
std::auto_ptr<Geometry> outg (
std::unique_ptr<Geometry> outg (
factory->createGeometryCollection(out.release())
);
......@@ -6523,7 +6851,7 @@ GEOSSnap_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1,
try{
GeometrySnapper snapper( *g1 );
std::auto_ptr<Geometry> ret = snapper.snapTo(*g2, tolerance);
std::unique_ptr<Geometry> ret = snapper.snapTo(*g2, tolerance);
return ret.release();
}
catch (const std::exception &e)
......@@ -6806,5 +7134,47 @@ GEOSVoronoiDiagram_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Ge
return NULL;
}
int
GEOSSegmentIntersection_r(GEOSContextHandle_t extHandle,
double ax0, double ay0, double ax1, double ay1,
double bx0, double by0, double bx1, double by1,
double* cx, double* cy)
{
if ( 0 == extHandle ) return 0;
GEOSContextHandleInternal_t *handle = 0;
handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
if ( 0 == handle->initialized ) return 0;
try
{
geos::geom::LineSegment a(ax0, ay0, ax1, ay1);
geos::geom::LineSegment b(bx0, by0, bx1, by1);
geos::geom::Coordinate isect;
bool intersects = a.intersection(b, isect);
if (!intersects)
{
return -1;
}
*cx = isect.x;
*cy = isect.y;
return 1;
}
catch(const std::exception &e)
{
handle->ERROR_MESSAGE("%s", e.what());
}
catch(...)
{
handle->ERROR_MESSAGE("Unknown exception thrown");
}
return 0;
}
} /* extern "C" */
#
# Macro generates tree of IDE source groups based on folders structure
# Source: http://www.cmake.org/pipermail/cmake/2013-November/056332.html
#
macro(GenerateSourceGroups curdir)
file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
GenerateSourceGroups(${curdir}/${child})
else()
string(REPLACE "/" "\\" groupname ${curdir})
# I would like to call the src root folder in a different name, only in visual studio (not mandatory requirement)
string(REPLACE "src" "Source Files" groupname ${groupname})
source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
endif()
endforeach()
endmacro()
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -14,17 +14,17 @@ dnl -- JTS_PORT: the version of JTS this release is bound to
JTS_PORT=1.13.0
dnl -- Version info for the CAPI
CAPI_INTERFACE_CURRENT=11
CAPI_INTERFACE_REVISION=2
CAPI_INTERFACE_AGE=10
CAPI_INTERFACE_CURRENT=12
CAPI_INTERFACE_REVISION=0
CAPI_INTERFACE_AGE=11
dnl
dnl -- Release versions / C++ library SONAME will use these
dnl -- encoding ABI break at every release
dnl
VERSION_MAJOR=3
VERSION_MINOR=6
VERSION_PATCH=2
VERSION_MINOR=7
VERSION_PATCH=0alpha
VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE))
......@@ -39,6 +39,10 @@ AM_MAINTAINER_MODE
AC_CONFIG_HEADERS([include/config.h] [include/geos/platform.h])
AC_PROG_CC
dnl Hush warnings
AC_DEFINE(USE_UNSTABLE_GEOS_CPP_API, [1], [We know])
dnl use libtool ----------------------------------------------------------
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
......@@ -133,6 +137,16 @@ dnl --------------------------------------------------------------------
dnl - Append default C++ and C flags
dnl --------------------------------------------------------------------
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
WARNFLAGS=""
AC_LANG_PUSH([C++])
dnl Available in GCC 5.1
AX_CHECK_COMPILE_FLAG([-Wsuggest-override -Werror], [WARNFLAGS="$WARNFLAGS -Wsuggest-override"])
dnl Available in clang 3.5
AX_CHECK_COMPILE_FLAG([-Wmissing-override -Werror], [WARNFLAGS="$WARNFLAGS -Wmissing-override"])
AC_LANG_POP([C++])
dnl In order for AC_LIBTOOL_COMPILER_OPTION to use
dnl the C compiler we need the hack below.
dnl It is likely a bug in the libtool macro file to
......@@ -144,17 +158,16 @@ AC_LIBTOOL_LANG_CXX_CONFIG
# Set default AM_CXXFLAGS and AM_CFLAGS
# -pedantic: ISO does not support long long
# we add -Wno-long-long to avoid those messages
WARNFLAGS=""
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ansi], [dummy_cv_ansi], [-ansi], [], [WARNFLAGS="$WARNFLAGS -ansi"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_no_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_wno_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
# To make numerical computation more stable, we use --ffloat-store
NUMERICFLAGS=""
AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS}"
HUSHWARNING="-DUSE_UNSTABLE_GEOS_CPP_API"
DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS} ${HUSHWARNING}"
AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
......