Библиотека GEOS 3.8.1 для ЗОСРВ Нейтрино
Этот коммит содержится в:
Коммит
bec8387f45
57
AUTHORS
Обычный файл
57
AUTHORS
Обычный файл
@ -0,0 +1,57 @@
|
||||
2006-Present
|
||||
GEOS is a project of the OSGEO foundation and is continually improved
|
||||
and funded by mandy FOSS4G developers as well as corporations all
|
||||
over the world.
|
||||
|
||||
Developers and Project Steering Committee (PSC):
|
||||
Active:
|
||||
Martin Davis (mtnclimb at gmail.com )(PSC) - Architecture
|
||||
Sandro Santilli (strk@kbt.io) (PSC Chair) - Bug Fixing / Maintenance
|
||||
Paul Ramsey (pramsey@cleverelephant.ca) (PSC) - Coordination / Build
|
||||
Regina Obe (lr@pcorp.us) (PSC) - QA / Windows / Coordination
|
||||
Howard Butler (howard@hobu.co) (PSC) - OS Platform support and testing
|
||||
Dale Lutz (dale.lutz@safe.com) (PSC)
|
||||
Daniel Baston (dbaston@gmail.com) - Bug Fixing / New functionality
|
||||
Kurt Schwehr ( schwehr@gmail.com ) - Bug Fixing / Test hardening
|
||||
Vicky Vergara (vicky@georepublic.de) - Refactor / Test development
|
||||
|
||||
Not Active:
|
||||
Mateusz Loskot (mateusz@loskot.net) - Unit testing
|
||||
Frank Warmerdam (warmerdam@pobox.com) - VStudio porting
|
||||
Dave Blasby (dblasby@gmail.com) - PostGIS Connectivity
|
||||
Yury Bychkov (me@yury.ca) - Initial Porting
|
||||
Sean Gillies (sgillies@frii.com) - Scripting Interface
|
||||
Fernando Villa (fvilla@zoo.uvm.edu) - GNU Build System
|
||||
Norman Vine (nvine@cape.com) - Porting / C++ Expertise
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
2003-11-06
|
||||
|
||||
Initial development of GEOS was funded by:
|
||||
|
||||
Vivid Solutions Inc (www.vividsolutions.com)
|
||||
Refractions Research Inc (www.refractions.net)
|
||||
British Columbia Advanced Systems Institute (www.asi.bc.ca)
|
||||
|
||||
GEOS is based on algorithms originally developed in Java
|
||||
by Martin Davis (mbdavis@refractions.net) in the
|
||||
JTS Topology Suite (www.vividsolutions.com/jts/jtshome.htm)
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
2004 to 2006
|
||||
|
||||
Continued development of GEOS funded by Refractions Research Inc.
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
2006
|
||||
|
||||
Continued development of GEOS funded by Refractions Research Inc.
|
||||
|
||||
Inclusion of new JTS functionality in JTS 1.5 to 1.7 funded
|
||||
by Safe Software and Autodesk.
|
||||
|
||||
Improved robustness of geometric operations for GEOS 3.0.0 funded
|
||||
by the Bavarian State Ministry of Agriculture and Forestry and the
|
||||
State Survey of Bavaria.
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
394
CMakeLists.txt
Обычный файл
394
CMakeLists.txt
Обычный файл
@ -0,0 +1,394 @@
|
||||
##############################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018-2019 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
##############################################################################
|
||||
|
||||
# Require CMake 3.8+ with support for meta-features that request compiler
|
||||
# modes for specific C/C++ language standard levels.
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
# Default to release build so packagers don't release debug builds
|
||||
set(DEFAULT_BUILD_TYPE Release)
|
||||
|
||||
# Require CMake 3.13+ with VS generator for complete support of VS versions
|
||||
# and support by AppVeyor.
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
# TODO: Follow CMake detection of git and version tagging
|
||||
# https://gitlab.kitware.com/cmake/cmake/blob/master/Source/CMakeVersionSource.cmake
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD)
|
||||
set(GEOS_BUILD_FROM_GIT ON)
|
||||
endif()
|
||||
|
||||
# Make sure we know our build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})
|
||||
message(STATUS "GEOS: Using default build type: ${CMAKE_BUILD_TYPE}")
|
||||
else()
|
||||
message(STATUS "GEOS: Build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Options
|
||||
#-----------------------------------------------------------------------------
|
||||
include(CMakeDependentOption)
|
||||
|
||||
## CMake global variables
|
||||
option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" ON)
|
||||
set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard version to use (default is 11)")
|
||||
|
||||
## GEOS custom variables
|
||||
cmake_dependent_option(GEOS_BUILD_DEVELOPER
|
||||
"Build with compilation flags useful for development" ON
|
||||
"GEOS_BUILD_FROM_GIT" OFF)
|
||||
mark_as_advanced(GEOS_BUILD_DEVELOPER)
|
||||
|
||||
if (POLICY CMP0092)
|
||||
# dont set /W3 warning flags by default, we already
|
||||
# set /W4 anyway
|
||||
cmake_policy(SET CMP0092 NEW)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup build directories
|
||||
#-----------------------------------------------------------------------------
|
||||
# Place executables and shared libraries in the same location for
|
||||
# convenience of direct execution from common spot and for
|
||||
# convenience in environments without RPATH support.
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
message(STATUS "GEOS: Run-time output: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
|
||||
message(STATUS "GEOS: Archives output: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Version
|
||||
#-----------------------------------------------------------------------------
|
||||
file(READ Version.txt _version_txt)
|
||||
|
||||
string(REGEX MATCH "GEOS_VERSION_MAJOR=([0-9]+)" _ ${_version_txt})
|
||||
set(_version_major ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "GEOS_VERSION_MINOR=([0-9]+)" _ ${_version_txt})
|
||||
set(_version_minor ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "GEOS_VERSION_PATCH=([0-9]+)" _ ${_version_txt})
|
||||
set(_version_patch ${CMAKE_MATCH_1})
|
||||
# OPTIONS: "", "dev", "rc1" etc.
|
||||
string(REGEX MATCH "GEOS_PATCH_WORD=([a-zA-Z0-9]+)" _ ${_version_txt})
|
||||
set(_version_patch_word ${CMAKE_MATCH_1})
|
||||
|
||||
# Version of JTS this release is bound to
|
||||
string(REGEX MATCH "JTS_PORT=([0-9a-zA-Z\.]+)" _ ${_version_txt})
|
||||
set(JTS_PORT ${CMAKE_MATCH_1})
|
||||
|
||||
# Version of public C API
|
||||
string(REGEX MATCH "CAPI_INTERFACE_CURRENT=([0-9]+)" _ ${_version_txt})
|
||||
set(_version_capi_current ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "CAPI_INTERFACE_REVISION=([0-9]+)" _ ${_version_txt})
|
||||
set(_version_capi_revision ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "CAPI_INTERFACE_AGE=([0-9]+)" _ ${_version_txt})
|
||||
set(_version_capi_age ${CMAKE_MATCH_1})
|
||||
|
||||
unset(_version_txt)
|
||||
|
||||
math(EXPR _version_capi_major "${_version_capi_current} - ${_version_capi_age}")
|
||||
set(CAPI_VERSION_MAJOR ${_version_capi_major})
|
||||
set(CAPI_VERSION_MINOR ${_version_capi_age})
|
||||
set(CAPI_VERSION_PATCH ${_version_capi_revision})
|
||||
set(CAPI_VERSION "${_version_capi_major}.${_version_capi_age}.${_version_capi_revision}")
|
||||
|
||||
unset(_version_capi_current)
|
||||
unset(_version_capi_major)
|
||||
unset(_version_capi_age)
|
||||
unset(_version_capi_revision)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Project
|
||||
#-----------------------------------------------------------------------------
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9)
|
||||
list(APPEND _project_info DESCRIPTION "GEOS - C++ port of the Java Topology Suite (JTS)")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
|
||||
list(APPEND _project_info HOMEPAGE_URL "http://geos.osgeo.org")
|
||||
endif()
|
||||
|
||||
project(GEOS VERSION "${_version_major}.${_version_minor}.${_version_patch}"
|
||||
LANGUAGES C CXX
|
||||
${_project_info})
|
||||
|
||||
if("${_version_patch_word}" STREQUAL "")
|
||||
set(GEOS_VERSION_FULL "${GEOS_VERSION}")
|
||||
else()
|
||||
set(GEOS_VERSION_FULL "${GEOS_VERSION}${_version_patch_word}")
|
||||
endif()
|
||||
|
||||
unset(_version_major)
|
||||
unset(_version_minor)
|
||||
unset(_version_patch)
|
||||
unset(_version_patch_word)
|
||||
|
||||
message(STATUS "GEOS: Version ${GEOS_VERSION_FULL}")
|
||||
message(STATUS "GEOS: C API Version ${CAPI_VERSION}")
|
||||
message(STATUS "GEOS: JTS port ${JTS_PORT}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# C++ language version and compilation flags
|
||||
#-----------------------------------------------------------------------------
|
||||
message(STATUS "GEOS: Require C++${CMAKE_CXX_STANDARD}")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Target geos_cxx_flags: common compilation flags
|
||||
#-----------------------------------------------------------------------------
|
||||
add_library(geos_cxx_flags INTERFACE)
|
||||
target_compile_features(geos_cxx_flags INTERFACE cxx_std_11)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Target geos_cxx_flags: common compilation flags
|
||||
#-----------------------------------------------------------------------------
|
||||
option(DISABLE_GEOS_INLINE "Disable inlining" ON)
|
||||
if(NOT DISABLE_GEOS_INLINE)
|
||||
target_compile_definitions(geos_cxx_flags INTERFACE GEOS_INLINE)
|
||||
else()
|
||||
message(STATUS
|
||||
"GEOS: DISABLING inlining of small functions")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Target geos_developer_cxx_flags: developer mode compilation flags
|
||||
#-----------------------------------------------------------------------------
|
||||
# Do NOT install this target for end-users!
|
||||
add_library(geos_developer_cxx_flags INTERFACE)
|
||||
|
||||
if(GEOS_BUILD_DEVELOPER)
|
||||
message(STATUS "GEOS: Developer mode enabled")
|
||||
endif()
|
||||
|
||||
# geos_cxx_flags inherits properties from geos_developer_cxx_flags when
|
||||
# building as part of the GEOS repository or on explicit request for
|
||||
# developer compilation mode, as GEOS contributor.
|
||||
# The flags are intended only for GEOS itself and are not part of
|
||||
# usage requirements needed by GEOS consumers.
|
||||
if(GEOS_BUILD_DEVELOPER)
|
||||
target_link_libraries(geos_cxx_flags
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:geos_developer_cxx_flags>)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(geos_cxx_flags
|
||||
INTERFACE
|
||||
USE_UNSTABLE_GEOS_CPP_API)
|
||||
|
||||
target_compile_definitions(geos_developer_cxx_flags
|
||||
INTERFACE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:_CRT_NONSTDC_NO_DEPRECATE>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_DEPRECATE>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:NOMINMAX>)
|
||||
|
||||
if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" )
|
||||
add_compile_options( -Wno-psabi )
|
||||
add_compile_definitions( DISABLE_GEOS_INLINE=ON )
|
||||
endif()
|
||||
|
||||
target_compile_options(geos_developer_cxx_flags
|
||||
INTERFACE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:-W4>
|
||||
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-pedantic -Wall -Wextra -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wdouble-promotion -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wuninitialized -Wunused-parameter -fno-common>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-fno-implicit-inline-templates>)
|
||||
|
||||
# Disable TTMath ASM support on Windows due to build issues
|
||||
if(WIN32)
|
||||
target_compile_definitions(geos_cxx_flags
|
||||
INTERFACE TTMATH_NOASM)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Define a coverage build
|
||||
#-----------------------------------------------------------------------------
|
||||
set(CMAKE_CXX_FLAGS_COVERAGE "-fprofile-arcs -ftest-coverage")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Target geos: C++ API library
|
||||
#-----------------------------------------------------------------------------
|
||||
add_library(geos "")
|
||||
target_link_libraries(geos PUBLIC geos_cxx_flags)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(src)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(geos
|
||||
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:GEOS_DLL_EXPORT>)
|
||||
|
||||
set_target_properties(geos PROPERTIES VERSION ${GEOS_VERSION})
|
||||
set_target_properties(geos PROPERTIES SOVERSION ${GEOS_VERSION})
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Target geos_c: C API library
|
||||
#-----------------------------------------------------------------------------
|
||||
add_library(geos_c "")
|
||||
target_link_libraries(geos_c PRIVATE geos)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(geos_c
|
||||
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:GEOS_DLL_EXPORT>)
|
||||
|
||||
set_target_properties(geos_c PROPERTIES VERSION ${CAPI_VERSION})
|
||||
if(NOT WIN32)
|
||||
set_target_properties(geos_c PROPERTIES SOVERSION ${CAPI_VERSION_MAJOR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(capi)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Tests
|
||||
#-----------------------------------------------------------------------------
|
||||
#include(CTest)
|
||||
#if(BUILD_TESTING)
|
||||
#add_subdirectory(tests)
|
||||
#endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Benchmarks
|
||||
#-----------------------------------------------------------------------------
|
||||
#add_subdirectory(benchmarks)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Documentation/Examples
|
||||
#-----------------------------------------------------------------------------
|
||||
#add_subdirectory(doc)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Install and export targets - support 'make install' or equivalent
|
||||
#-----------------------------------------------------------------------------
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake"
|
||||
VERSION ${GEOS_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
configure_file(cmake/geos-config.cmake
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake"
|
||||
COPYONLY)
|
||||
|
||||
install(TARGETS geos geos_cxx_flags
|
||||
EXPORT geos-targets
|
||||
LIBRARY DESTINATION lib NAMELINK_SKIP
|
||||
ARCHIVE DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
install(TARGETS geos_c
|
||||
EXPORT geos-targets
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
#install(EXPORT geos-targets
|
||||
#FILE geos-targets.cmake
|
||||
#NAMESPACE GEOS::
|
||||
#DESTINATION lib/cmake/GEOS)
|
||||
|
||||
#install(FILES
|
||||
#"${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake"
|
||||
#"${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake"
|
||||
#DESTINATION lib/cmake/GEOS)
|
||||
#install(DIRECTORY
|
||||
#"${CMAKE_CURRENT_LIST_DIR}/include/geos"
|
||||
#"${CMAKE_CURRENT_BINARY_DIR}/include/geos"
|
||||
#DESTINATION include
|
||||
#FILES_MATCHING PATTERN "*.h")
|
||||
#if(NOT DISABLE_GEOS_INLINE)
|
||||
#install(DIRECTORY
|
||||
#"${CMAKE_CURRENT_LIST_DIR}/include/geos"
|
||||
#"${CMAKE_CURRENT_BINARY_DIR}/include/geos"
|
||||
#DESTINATION include
|
||||
#FILES_MATCHING PATTERN "*.inl")
|
||||
#endif()
|
||||
#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capi/geos_c.h"
|
||||
#DESTINATION include)
|
||||
|
||||
# 03.07.2023, A.Vasyunin: CMake fails with error: no matching function for call to 'stat::stat(const char*, stat*)'
|
||||
# In KPDA_TARGET/usr/include/sys/stat.h we have stat::stat() wrapped under #if defined(__EXT_POSIX1_198808)
|
||||
# add_subdirectory(tools)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Uninstall
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# "make dist" workalike
|
||||
#-----------------------------------------------------------------------------
|
||||
get_property(_is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT _is_multi_config_generator)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GEOS Computational Geometry Library")
|
||||
set(CPACK_PACKAGE_VENDOR "OSGeo")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
|
||||
set(CPACK_SOURCE_GENERATOR "TBZ2")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${GEOS_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${GEOS_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${GEOS_VERSION_PATCH})
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "geos-${GEOS_VERSION_FULL}")
|
||||
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"/\\\\.git"
|
||||
"/autogen\\\\.sh"
|
||||
"/tools/ci"
|
||||
"/HOWTO_RELEASE"
|
||||
"/autom4te\\\\.cache"
|
||||
"\\\\.yml\$"
|
||||
"\\\\.deps"
|
||||
"/debian/"
|
||||
"/php/"
|
||||
"/.*build-.*/"
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# message(STATUS "GEOS: CPACK_SOURCE_PACKAGE_FILE_NAME: ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||
# message(STATUS "GEOS: CPACK_SOURCE_IGNORE_FILES: ${CPACK_SOURCE_IGNORE_FILES}")
|
||||
# message(STATUS "GEOS: CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
|
||||
include(CPack)
|
||||
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
|
||||
|
||||
message(STATUS "GEOS: Configured 'dist' target")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# "make check" workalike
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_BUILD_TOOL} test)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# "make distcheck" workalike
|
||||
#-----------------------------------------------------------------------------
|
||||
#if(NOT _is_multi_config_generator)
|
||||
#find_package(MakeDistCheck)
|
||||
#AddMakeDistCheck()
|
||||
#message(STATUS "GEOS: Configured 'distcheck' target")
|
||||
#endif()
|
||||
|
||||
unset(_is_multi_config_generator)
|
502
COPYING
Обычный файл
502
COPYING
Обычный файл
@ -0,0 +1,502 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
47
HOWTO_RELEASE
Обычный файл
47
HOWTO_RELEASE
Обычный файл
@ -0,0 +1,47 @@
|
||||
1. Verify that the versions currently set in Version.txt
|
||||
sense for this release.
|
||||
|
||||
- GEOS_VERSION_PATCH
|
||||
- GEOS_VERSION_MINOR
|
||||
- GEOS_VERSION_MAJOR
|
||||
|
||||
- CAPI_INTERFACE_CURRENT
|
||||
- CAPI_INTERFACE_REVISION
|
||||
- CAPI_INTERFACE_AGE
|
||||
|
||||
Always increase the revision value.
|
||||
Increase the current value whenever an interface has been added, removed or changed.
|
||||
Increase the age value only if the changes made to the ABI are backward compatible.
|
||||
|
||||
2. Run 'make distcheck', fix any problem with it.
|
||||
|
||||
3. Update the NEWS file (extract most important things from the
|
||||
repository log). Make sure to update the release date.
|
||||
|
||||
4. Commit the changes in the NEWS file.
|
||||
|
||||
5. Run 'make dist-bzip2'.
|
||||
|
||||
$ ./autogen.sh && ./configure && make dist-bzip2
|
||||
|
||||
6. Verify that you can un-pack and build the tarball.
|
||||
|
||||
- autotools: ./configure && make check
|
||||
- cmake: mkdir build && cd build && cmake .. && make && make check
|
||||
|
||||
7. Copy the tarball to upload.osgeo.org:/osgeo/download/geos
|
||||
|
||||
8. Tag the release:
|
||||
|
||||
$ git tag MAJOR.MINOR.PATCH
|
||||
$ git push origin MAJOR.MINOR.PATCH
|
||||
|
||||
9. Increment all the version numbers for the next release (described in 1 above).
|
||||
|
||||
10. Update wiki page https://trac.osgeo.org/geos/ at Download section
|
||||
|
||||
- Add latest release
|
||||
- Remove previous patch level release (if any)
|
||||
|
||||
11. Announce on geos-devel
|
||||
|
92
INSTALL
Обычный файл
92
INSTALL
Обычный файл
@ -0,0 +1,92 @@
|
||||
## Building GEOS From Source
|
||||
|
||||
### Prerequisites
|
||||
|
||||
GEOS has no external library dependencies and can be built with any C++11
|
||||
compiler.
|
||||
|
||||
### Unix
|
||||
|
||||
GEOS can be built on Unix systems using either the autotools or CMake build
|
||||
systems.
|
||||
|
||||
#### Using Autotools:
|
||||
|
||||
When building GEOS using autotools, a `configure` script must first be generated
|
||||
using the `autogen.sh` file included in the root of the repository:
|
||||
|
||||
./autogen.sh
|
||||
|
||||
An out-of-tree build can then be initiated by creating a subdirectory and
|
||||
running the generated `configure` script from that subdirectory:
|
||||
|
||||
mkdir obj && cd obj && ../configure
|
||||
|
||||
Once the `configure` script has run, GEOS can be built by running `make` and
|
||||
installed by running `make install`. The test suite can be run using `make
|
||||
check`.
|
||||
|
||||
#### Using CMake:
|
||||
|
||||
To build `GEOS` using CMake, create a build directory and run the `cmake` command
|
||||
from that location:
|
||||
|
||||
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
Setting `CMAKE_BUILD_TYPE` to `Release` is necessary to enable compiler
|
||||
optimizations.
|
||||
|
||||
Once the `cmake` tool has run, GEOS can be built by running `make` and
|
||||
installed by running `make install`.
|
||||
|
||||
The entire test suite can be run using `make check`.
|
||||
Alternatively, the `ctest` command can be used, which provides more control over test execution.
|
||||
For example, `ctest -R unit-capi -j2` uses a regular expression to run all tests
|
||||
associated with the C API, using two processes in parallel.
|
||||
A list of available tests can be obtained using `ctest -N`.
|
||||
|
||||
### Microsoft Windows
|
||||
|
||||
GEOS can be built with Microsoft Visual C++ by opening the `CMakeLists.txt` in
|
||||
the project root using `File > Open > CMake`.
|
||||
|
||||
If you prefer the command-line
|
||||
|
||||
#### Build with CMake generator for Ninja (fast)
|
||||
|
||||
In the Visual Studio 2019 command prompt, `x64 Native Tools Command Prompt for VS 2019` or `x64_x86 Cross Tools Command Prompt for VS 2019`:
|
||||
|
||||
```
|
||||
cmake -S . -B _build_vs2019_ninja -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build _build_vs2019_ninja -j 16 --verbose
|
||||
```
|
||||
|
||||
#### Build with CMake generator for MSBuild (default)
|
||||
|
||||
In the non-specific Command Prompt:
|
||||
|
||||
##### 64-bit
|
||||
|
||||
```
|
||||
cmake -S . -B _build_vs2019x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_GENERATOR_TOOLSET=host=x64
|
||||
cmake --build _build_vs2019x64 --config Release -j 16 --verbose
|
||||
```
|
||||
|
||||
##### 32-bit
|
||||
|
||||
```
|
||||
cmake -S . -B _build_vs2019x32 -G "Visual Studio 16 2019" -A x32 -DCMAKE_GENERATOR_TOOLSET=host=x64
|
||||
cmake --build _build_vs2019x32 --config Release -j 16 --verbose
|
||||
```
|
||||
|
||||
#### Test using CMake
|
||||
|
||||
```
|
||||
cd <build directory>
|
||||
ctest --show-only
|
||||
ctest
|
||||
ctest --output-on-failure
|
||||
ctest -V
|
||||
ctest -VV
|
||||
```
|
||||
|
77
Makefile.am
Обычный файл
77
Makefile.am
Обычный файл
@ -0,0 +1,77 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
# NOTE: Make sure that 'src' appears first.
|
||||
# 'capi' and 'doc' surely rely on availability of libgeos
|
||||
# which is built under 'src' and it seems that automake
|
||||
# is not able to detect required build order but blindly
|
||||
# relies on the order items in SUBDIRS appear.
|
||||
#
|
||||
|
||||
# foreign is needed to avoid enforced ChangeLog in EXTRA_DIST
|
||||
# (we'll still take care of adding it ourselves)
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
SUBDIRS = \
|
||||
include \
|
||||
src \
|
||||
capi \
|
||||
doc \
|
||||
macros \
|
||||
swig \
|
||||
tests \
|
||||
benchmarks \
|
||||
tools
|
||||
|
||||
BUILT_SOURCES =
|
||||
|
||||
EXTRA_DIST = \
|
||||
README.md \
|
||||
acsite.m4 \
|
||||
.editorconfig \
|
||||
Version.txt \
|
||||
CMakeLists.txt \
|
||||
cmake/cmake_uninstall.cmake.in \
|
||||
cmake/geos-config.cmake \
|
||||
cmake/FindMakeDistCheck.cmake
|
||||
|
||||
ACLOCAL_AMFLAGS = -I macros
|
||||
|
||||
dist-hook: gen-ChangeLog
|
||||
|
||||
gen-ChangeLog:
|
||||
cd $(distdir) && owd=`pwd` && \
|
||||
cd ../ && cd $(srcdir) && \
|
||||
if test -d .git; then \
|
||||
git log --pretty --numstat --summary | git2cl > $${owd}/ChangeLog; \
|
||||
elif test -d .svn; then \
|
||||
svn2cl --authors=authors.svn -i -o $${owd}/ChangeLog; \
|
||||
elif test -f ChangeLog; then \
|
||||
cp ChangeLog $${owd}/ChangeLog; \
|
||||
fi
|
||||
|
||||
apidoc doxygen:
|
||||
cd doc && make $@
|
||||
|
||||
doxygen-checked:
|
||||
( set -o pipefail; \
|
||||
! make doxygen 2>&1 > /dev/null | \
|
||||
grep -v '\(not documented\|ignoring unsupported tag\)'; \
|
||||
)
|
||||
|
||||
authors.git: authors.svn
|
||||
cd $(srcdir) && sed -e 's/:/ = /' authors.svn > authors.git
|
||||
|
||||
svnrebase: authors.git
|
||||
cd $(srcdir) && git svn rebase --authors-file authors.git
|
||||
|
||||
VALGRIND = $(LIBTOOL) --mode=execute valgrind --leak-check=full --error-exitcode=1
|
||||
|
||||
valgrindcheck:
|
||||
$(VALGRIND) tests/unit/geos_unit
|
||||
|
||||
check-local:
|
||||
! find $(srcdir) -name '*.cpp' -o -name '*.h' | \
|
||||
grep -v tests/xmltester/tinyxml | \
|
||||
grep -v include/geos/algorithm/ttmath | \
|
||||
xargs grep -n '[[:space:]]$$'
|
706
NEWS
Обычный файл
706
NEWS
Обычный файл
@ -0,0 +1,706 @@
|
||||
Changes in 3.8.1
|
||||
2020-03-10
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Stack allocate line segments in OverlapUnion (Paul Ramsey)
|
||||
- Avoid returning non-empty CoordinateSequence from empty Point
|
||||
(#1001, Dan Baston)
|
||||
- Avoid assertion failure with MSVC 2017 / 2019 (#1002, Dan Baston)
|
||||
- Remove whitespace from end of GEOSversion() output (azhi)
|
||||
- Improve performance of GEOSisValid (#1008, Dan Baston)
|
||||
- Avoid changing MultiLineString component order in GEOSReverse
|
||||
(#1013, Dan Baston)
|
||||
- Fix missing vtable for LineString and CoordinateArraySequenceFactory
|
||||
(#299 and #1016, Evgen Bodunov)
|
||||
- Reduce performance regression in GEOSBuffer (#1020)
|
||||
|
||||
Changes in 3.8.0
|
||||
2019-10-10
|
||||
|
||||
- New things:
|
||||
- CAPI: GEOSBuildArea (#952, Even Rouault)
|
||||
- CAPI: GEOSMakeValid (#952, Even Rouault)
|
||||
- CAPI: GEOSPolygonize_valid (#727, Dan Baston)
|
||||
- CAPI: GEOSCoverageUnion (Dan Baston)
|
||||
- CAPI: GEOSCoordSeq_setXY, GEOSCoordSeq_setXYZ,
|
||||
GEOSCoordSeq_getXY, GEOSCoordSeq_getXYZ (Dan Baston)
|
||||
- CAPI: GEOSMinimumBoundingCircle (#735)
|
||||
- CAPI: GEOSGeom_createPointFromXY (Dan Baston)
|
||||
|
||||
- Improvements:
|
||||
- Improve overall performance by reducing of heap allocations (Dan Baston)
|
||||
- Improve performance and robustness of GEOSPointOnSurface (Martin Davis)
|
||||
- Improve performance of GEOSPolygonize for cases with many potential
|
||||
holes (#748, Dan Baston)
|
||||
- Support extended precision calculations (ttmath) and port JTS
|
||||
improvements related to extended precision (Paul Ramsey, Mateusz Loskot)
|
||||
- Improve performance of GEOSPolygonize for cases with many or complex
|
||||
shells (Dan Baston, Martin Davis)
|
||||
- Improve performance of Delaunay triangulations / Voronoi Diagrams
|
||||
(Dan Baston)
|
||||
- Improve performance of prepared geometry operations (Dan Baston)
|
||||
- Improve robustness of Delaunay triangulations (Paul Ramsey, Martin Davis)
|
||||
- Improve performance of unary union for lines (Dan Baston)
|
||||
- Improve general predicate, overlay, and buffer performance (Dan Baston, Paul Ramsey)
|
||||
- Improve cascaded union performance (Paul Ramsey, Martin Davis)
|
||||
- Allocate default GeometryFactory singleton on the stack (Sandro Mani)
|
||||
- Harmonize XML tests with JTS and harmonize cmake/autoconf
|
||||
test running (Paul Ramsey)
|
||||
- CMake modernization (Mateusz Loskot, Paul Ramsey, Dan Baston)
|
||||
- Return unique_ptr from most methods that produce a new geometry (Dan Baston)
|
||||
|
||||
- Changes:
|
||||
- Constructive geometry functions in CAPI now preserve SRID
|
||||
of input arguments in output (#896)
|
||||
|
||||
|
||||
Changes in 3.7.2
|
||||
2019-05-02
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Envelope constructor using strtod (#875 Paul Ramsey)
|
||||
- Failure in CMake for OSX Framework (#936 Paul Ramsey)
|
||||
- Polygon build failure in Overlay difference (#789 Paul Ramsey)
|
||||
- Invalid union result from valid polygon inputs (#838)
|
||||
|
||||
|
||||
Changes in 3.7.1
|
||||
2018-11-29
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix crash in GEOSCoordSeq_isCCW with empty coordseq
|
||||
(#927, Sergey Fedoseev)
|
||||
- Fix crash in GEOSInterpolate with empty LineString
|
||||
(#926, Sergey Fedoseev)
|
||||
- Fix crash in GEOSUnaryUnion with empty LineString
|
||||
(#928, Sergey Fedoseev)
|
||||
- Fix memory leak in SIRtree::insert (#919, Dan Baston)
|
||||
- Reduce required autoconf to 2.63
|
||||
(#56, John Harvey)
|
||||
- Fix incorrect return values on error from GEOSLength
|
||||
GEOSisValidDetail (#941, Dan Baston)
|
||||
|
||||
|
||||
Changes in 3.7.0
|
||||
2018-09-10
|
||||
|
||||
- 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)
|
||||
- CAPI: GEOSSegmentIntersection (#873, Dan Baston)
|
||||
- CAPI: GEOSGeomGetZ (#581, J Smith)
|
||||
|
||||
- Improvements
|
||||
- Interruptible snap operation (Paul Ramsey)
|
||||
- Numerous packaging, doc, and build changes
|
||||
(Debian group: Bas Couwenberg, Francesco Paolo Lovergine)
|
||||
|
||||
- C++ API changes:
|
||||
- Require defining USE_UNSTABLE_GEOS_CPP_API for use without
|
||||
warnings.
|
||||
- Make C++11 required (Mateusz Loskot)
|
||||
- Use C++11 unique_ptr, nullptr, and override constructs
|
||||
(Mateusz Loskot)
|
||||
- C++11 standard delete on noncopyable
|
||||
(#851, Vicky Vergara)
|
||||
- Fix CommonBits::getBit to correctly handle i >= 32
|
||||
(#834, Kurt Schwehr)
|
||||
|
||||
Changes in 3.7.0rc1
|
||||
2018-08-19
|
||||
Fixes / enhancements since 3.7.0beta2
|
||||
- Avoid segfault when querying empty tree (#730, framm)
|
||||
- Collection with Empty components crashes overlay (#782, Dan Baston)
|
||||
- Allow static library with C API for CMake builds (#878, Dakota Hawkins)
|
||||
|
||||
Changes in 3.7.0beta2
|
||||
2018-08-06
|
||||
Fixes since 3.7.0beta1
|
||||
- Fix infinite loop in GEOSClipByRect (#865, Dan Baston)
|
||||
- Make GEOSException inherit from std::runtime_error
|
||||
to address clang warnings (Dan Baston)
|
||||
- Add missing CMake files to tarball (#895, Regina Obe)
|
||||
|
||||
|
||||
Changes in 3.7.0beta1
|
||||
2018-06-25
|
||||
See 3.7.0 latest notes
|
||||
|
||||
Changes in 3.7.0alpha
|
||||
2018-06-14
|
||||
See 3.7.0 notes
|
||||
|
||||
Changes in 3.6.1
|
||||
2016-12-24
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix GEOSSTRtree_nearest_r signature and add implementation (#796)
|
||||
- Fix --static-clibs and --static-cclibs returns from geos-config
|
||||
- Fix WKB representation of empty polygon (#680).
|
||||
- Fix empty GEOSSimplify return on inner ring collapse (#741)
|
||||
|
||||
Changes in 3.6.0
|
||||
2016-10-25
|
||||
|
||||
- Important / Breaking Changes:
|
||||
- The PHP binding moved to its own repository:
|
||||
http://git.osgeo.org/gogs/geos/php-geos (#765)
|
||||
- New things:
|
||||
- CAPI: GEOSGeom_{get,set}UserData (Rashad Kanavath)
|
||||
- CAPI: GEOSGeom_{set,get}Precision (#713)
|
||||
- CAPI: GEOSMinimumRotatedRectangle and GEOSMinimumWidth
|
||||
(#729, Nyall Dawson)
|
||||
- CAPI: GEOSSTRtree_nearest (#768, Dan Baston)
|
||||
- CAPI: GEOSMinimumClearance and GEOSMinimumClearanceLine
|
||||
(#776, Dan Baston)
|
||||
- C++ API changes:
|
||||
- Automatic memory management for GeometryFactory objects
|
||||
|
||||
|
||||
Changes in 3.5.0
|
||||
2015-08-16
|
||||
|
||||
- New things:
|
||||
- Voronoi API (#627)
|
||||
- PHP: Geometry->normalize method
|
||||
- GEOS_USE_ONLY_R_API macro support (#695)
|
||||
- PHP: WKBReader->read() & WKBWriter::write() methods (Benjamin Morel)
|
||||
- GEOSClipByRect (#699, Mika Heiskanen, Sandro Santilli)
|
||||
- CAPI: thread-safe message handling API (#663, Pepijn Van Eeckhoudt)
|
||||
- Improvements:
|
||||
- Speed-up intersection and difference between geometries
|
||||
with small bounding box overlap.
|
||||
- CAPI: add MULTILINESTRING support for GEOSisClosed (Benjamin Morel)
|
||||
- C++ API changes:
|
||||
- Added no-parameter CoordinateSequenceFactory::create method (Sandro Mani)
|
||||
|
||||
Changes in 3.4.2
|
||||
2013-08-25
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Use a double for PrecisionModel scale, avoiding overflows
|
||||
should fix 32-bit regression failures (#652)
|
||||
- isnan workaround OS detection missing NetBSD, DragonFly, Sun nuance (#650)
|
||||
- Do not distribute platform.h and version.h, but install both (#601)
|
||||
- Non-standard ChangeLog file in 3.4.0 and 3.4.1 releases (#654)
|
||||
- new travis bot (#657)
|
||||
- accept multiple Nan representations (#656)
|
||||
|
||||
|
||||
Changes in 3.4.1
|
||||
2013-08-17
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Assertion failure snapping line to points of rectangle
|
||||
smaller than tolerance (#649)
|
||||
- Can't build using cmake with tar ball (#644)
|
||||
|
||||
Changes in 3.4.0
|
||||
2013-08-11
|
||||
|
||||
- New things:
|
||||
- Delaunay Triangulation API (#487, #565, #570, #567)
|
||||
- Interruptibility API (C and C++)
|
||||
- CAPI: GEOSNode (#496) - PHP: Geometry->node
|
||||
- GeometryPrecisionReducer class (#496, #526)
|
||||
- BufferInputLineSimplifier header exposed (#548)
|
||||
- New Centroid class supporting mixed geometry components (#612)
|
||||
- io::Writer::reserve() method
|
||||
- CAPI: GEOSNearestPoints
|
||||
- Add --cclibs, --static-clibs and --static-cclibs to geos-config (#497)
|
||||
- Early bail out of overlay exception if input is invalid
|
||||
|
||||
- C++ API changes:
|
||||
- New noding::GeometryNoder class
|
||||
- Added BufferOp::setSingleSided
|
||||
- Signature of most functions taking a Label changed to take it
|
||||
by reference rather than pointer.
|
||||
- Signature of most functions taking an IntersectionMatrix changed
|
||||
to take it by reference rather than pointer.
|
||||
- GraphComponent::label is now a Label value (from a pointer)
|
||||
- NodedSegmentString takes ownership of CoordinateSenuence now
|
||||
- io::Writer's toString() returns by const ref, write() takes a const ref
|
||||
- Unify prototypes of WKTReader and WKBReader constructor (#310)
|
||||
- GeometryCollection::computeEnvelopInternal and
|
||||
GeometryCollection::compareToSameClass are marked virtual (#478)
|
||||
|
||||
- Bug fixes / improvements
|
||||
- A point interpolated from a line does not always intersect
|
||||
the same line (#323)
|
||||
- Port ConvexHull robustness fix from JTS-1.13 (#457)
|
||||
- Improve Overlay robustness by reducing input precision on topology
|
||||
exception and by refusing to accept unnoded output (#459)
|
||||
- Improve Buffer robustness by reducing input precision on topology
|
||||
exception (#605)
|
||||
- Mismatch segment sides in OffsetCurveBuilder (#633 )
|
||||
- Fixed Linear Referencing API to handle MultiLineStrings consistently
|
||||
by always using the lowest possible index value, and by trimming
|
||||
zero-length components from results (#323)
|
||||
- Fixed CMake configuration to set correct SOVERSION (current - age)
|
||||
- Fix EMPTY return from single-point lines and zero-length polygons (#612)
|
||||
- CMakeLists.txt, tools/geos_svn_revision_cmake.h.in: Add
|
||||
geos_svn_revision.h generator to CMake config (#643)
|
||||
- Makefile.vc 'clean' step leaks obj files (#607)
|
||||
|
||||
Changes in 3.3.9
|
||||
2013-09-04
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix OffsetCurve op in presence of duplicated vertices (#602)
|
||||
- Fix LineSegmentVisitor copy ctor (#636)
|
||||
- Fix area boundary return from GEOSPointOnSurface (#623)
|
||||
- Speedup GEOSWKBReader_read (#621)
|
||||
- Fix RobustLineIntersector handling of invalid intersection points (#622)
|
||||
- Reduce likelyhood of invalid output from snap operation (#629, #501)
|
||||
- Reduce memory fragmentation of prepared Polygon/Point intersection op
|
||||
- Fix mingw64 compile (#630)
|
||||
- Fix bug in HotPixel constructor (#635)
|
||||
- Fix install location of linearref headers (#624)
|
||||
- Fix multi-geometry constructor to drop SRID from components (#583)
|
||||
|
||||
Changes in 3.3.8
|
||||
2013-02-28
|
||||
|
||||
- Bug fixes / improvements
|
||||
- IsValidOp: throw proper error on nested shells (#608)
|
||||
- Fix header guards (#617, #618, #619)
|
||||
- WKTWriter::appendCoordinate optimisation
|
||||
- Fix centroid computation for collections with empty components (#582)
|
||||
|
||||
Changes in 3.3.7
|
||||
2013-01-22
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix abort in RightmostEdgeFinder (#605)
|
||||
- Do not force precision reduction below 6 significant digits
|
||||
while trying to obtain a valid Buffer output (#605)
|
||||
- Fix GEOSPointOnSurface with zero-length linestring (#609)
|
||||
- Fix EMPTY return from zero-area polygon (#613)
|
||||
- Segfault from symdifference (#615)
|
||||
|
||||
Changes in 3.3.6
|
||||
2012-11-15 -- that's Post-GIS day !
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Add support for testing with phpunit 3.6 (not loosing support for 3.4)
|
||||
- Segfault from intersection (#586, #598, #599)
|
||||
|
||||
Changes in 3.3.5
|
||||
2012-06-25
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Correctly increment CAPI lib version from 3.3.3 (#558)
|
||||
- Port robustness fix to CentroidArea (#559)
|
||||
- Always return POINT from GEOSGetCentroid, even for EMPTY (#560)
|
||||
- Always return POINT from GEOSPointOnSurface, even for EMPTY (#561)
|
||||
|
||||
Changes in 3.3.4
|
||||
2012-05-31
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Do not abort on NaN overlay input (#530)
|
||||
- Reduce CommonBitsRemover harmful effects during overlay op (#527)
|
||||
- Better cross-compiler support (#534)
|
||||
- Enable overlay ops short-circuits (#542)
|
||||
- Envelope-based short-circuit for symDifference (#543)
|
||||
- Fix support for PHP 5.4 (#513)
|
||||
- Fix TopologyPreservingSimplifier invalid output on closed line (#508)
|
||||
- Reduce calls to ptNotInList, greatly speeding up Polygonizer (#545)
|
||||
|
||||
Changes in 3.3.3
|
||||
2012-04-01
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix simplification of collections with empty items (#519)
|
||||
- Fix MSVC compilation of ambiguous log() call (#506)
|
||||
- Fix CMake issues with std:: namespace detection (#493)
|
||||
|
||||
Changes in 3.3.2
|
||||
2012-01-05
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix CMAKE_CXX_FLAGS overriding -std=gnu++0x (#489)
|
||||
- Missing versions update in CMake configuration (#490)
|
||||
- Fix noding of self-intersecting lines through UnaryUnion (#482)
|
||||
- Fix handling of collapsed edges skipping in BufferOp (#494)
|
||||
- Print up to 18 digits of precision for TopologyException points
|
||||
- Fix noding with reduced precision in Buffer operation (#473)
|
||||
- Fix HotPixel original point invalidation (#498)
|
||||
- Fix CascadedPolygonUnion to discard non-polygonal components (#499)
|
||||
- Improve buffer robustness by reverting to non-snaprounding noder (#495)
|
||||
- Fix C++11 build by avoiding std::pair<auto_ptr> (#491)
|
||||
- Add --clibs to geos-config and GEOS_C_LIBS to geos.m4 (#497)
|
||||
- Apply shoelace formula for area calculation (#485)
|
||||
- Fix default initialization issue for clang (#500)
|
||||
- Improve overlay robustness by fixing areal validity on snapping (#488)
|
||||
|
||||
Changes in 3.3.1
|
||||
2011-09-27
|
||||
|
||||
- Bug fixes / improvements
|
||||
- Fix memory leak on invalid geometry in InteriorPointArea (#475)
|
||||
- ValidOp abort in presence of 2 touching holes forming an island (#449)
|
||||
- Enable prepared intersects operation for points
|
||||
- Fortify suspicious code found by static analysis tools
|
||||
- Fix for SOLARIS build (#461)
|
||||
- Fix EMPTY result from GEOSOffsetCurve with distance 0 (#454)
|
||||
- Fix Geometry::clone to copy SRID (#464)
|
||||
- Fix for clang builds (#463)
|
||||
- Fix out-of-place builds for python binding (#332) and regress testing
|
||||
- Fix OS X framework cmake build (#385)
|
||||
|
||||
Changes in 3.3.0
|
||||
2011-05-30
|
||||
|
||||
- New things:
|
||||
- CAPI: GEOSBufferWithParams (allows single sided buffers)
|
||||
- CAPI: GEOSOffsetCurve deprecates GEOSSingleSidedBuffer
|
||||
- CAPI: GEOSUnaryUnion deprecates GEOSCascadedUnion
|
||||
- CAPI: GEOSisValidDetail: tell state, reason & location apart. allows
|
||||
passing flags.
|
||||
- CAPI: GEOSContext_setNoticeHandler_r, GEOSContext_setErrorHandler_r
|
||||
- CAPI: GEOSGeom_createEmptyPoint, GEOSGeom_createEmptyLineString
|
||||
GEOSGeom_createEmptyPolygon, GEOSGeom_createEmptyCollection
|
||||
- CAPI: GEOSGeom_extractUniquePoints
|
||||
- CAPI: GEOSGetGeometryN support for single geometries
|
||||
- CAPI: GEOSPolygonize_full to return all informations computed by
|
||||
the polygonizer
|
||||
- CAPI: GEOSOrientationIndex
|
||||
- CAPI: GEOSSharedPaths to find shared paths and their orientation
|
||||
- CAPI: GEOSSnap
|
||||
- CAPI: GEOSRelatePatternMatch
|
||||
- CAPI: GEOSCovers, GEOSCoveredBy (#396)
|
||||
- CAPI: GEOSRelateBoundaryNodeRule (#399)
|
||||
- CAPI: GEOSGeom_getCoordinateDimension() (#311)
|
||||
- CAPI: GEOSWKTWriter_setOutputDimension, GEOSWKTWriter_setOld3D (#292)
|
||||
- PHP: new PHP5 bindings based on CAPI
|
||||
- Semantic C++ API changes:
|
||||
- Geometry inheritance chain changed to introduce Puntal, Lineal
|
||||
and Polygonal classes (virtual inheritance introduced)
|
||||
- Polygonizer::getInvalidRingLines retains ownership of vector elements
|
||||
- Geometry::isWithinDistance method is now const
|
||||
- Polygonizer::getCutEdges returns by const ref
|
||||
- Polygonizer::getDangles returns by const ref
|
||||
- Empty LinearRings are closed by definition
|
||||
- Bug fixes / improvements
|
||||
- Fixed Geometry.distance() and DistanceOp to return 0.0 for empty inputs
|
||||
- Invalid compound geometries reported as valid (#333)
|
||||
- Return up to 15 digits of precision from GEOSisValidReason_t (#329)
|
||||
- CAPI: do not leak contexts when using the non-reentrant interface
|
||||
- Fix duplicated dangles returned by Polygonizer
|
||||
- Fix SnapIfNeededOverlayOp to throw the originating exception
|
||||
- Fixed LineMerger to skip lines with only a single unique coordinate
|
||||
- Fix NodedSegmentString to handle zero-length line segments correctly
|
||||
(via safeOctant)
|
||||
- Fixed buffer OffsetCurveSetBuilder to handle "flat" rings correctly
|
||||
- Added illegal state check in LineSegment::pointAlongOffset()
|
||||
- Improved performance of RectangleIntersects by always using
|
||||
segment-scanning and refining SegmentIntersectionTester
|
||||
- Reduce memory use in PreparedGeometry predicates (#342)
|
||||
- Fix infinite loop in RobustDeterminant with nan/inf input (#357)
|
||||
|
||||
Changes in 3.2.0
|
||||
2009-12-14
|
||||
|
||||
- Add Single-sided buffer operation
|
||||
- JTS-1.10 sync ...
|
||||
- Drastically improved Buffer speed (20x for a case in testsuite)
|
||||
- Improved EdgeList duplicate edge finding
|
||||
- Added algorithm::distance package
|
||||
- Added algorithm::Angle class
|
||||
- Added algorithm::BoundaryNodeRule class
|
||||
- IsSimpleOp can now return non-simple location coordinate
|
||||
- DistanceOp can now check for 'within distance' predicate
|
||||
(earlier exit)
|
||||
- MultiPolygon::getBoundary always return MultiLineString, also
|
||||
when the result is the EMPTY geometry.
|
||||
- Various bug and leak fixes, optimizations
|
||||
- Replace MarkupSTL with tinyXML
|
||||
|
||||
Changes in 3.1.0
|
||||
|
||||
- PreparedGeometry operations for very fast predicate testing.
|
||||
- Intersects()
|
||||
- Covers()
|
||||
- CoveredBy()
|
||||
- ContainsProperly()
|
||||
- Easier builds under MSVC and OpenSolaris
|
||||
- Thread-safe CAPI option
|
||||
- IsValidReason added to CAPI
|
||||
- GEOSPolygonizer_getCutEdges added to CAPI
|
||||
- CascadedUnion operation for fast unions of geometry sets
|
||||
- Numerous bug fixes.
|
||||
http://trac.osgeo.org/geos/query?status=closed&milestone=3.1.0&order=priority
|
||||
|
||||
Changes in 3.0.0
|
||||
|
||||
These are mostly ABI breaking changes.
|
||||
In few cases the API also changed, but the most external one
|
||||
(the documented one) should be unchanged.
|
||||
|
||||
- New things:
|
||||
- Added geom::BinaryOp class performing a binary operation
|
||||
using different heuristics to reduce probability of robustness
|
||||
issues. Both C-API and XMLTester now use this class for
|
||||
binary operations.
|
||||
- Added covers() and coveredBy() predicates to Geometry class
|
||||
- Added overlay::overlayOp() adapter class
|
||||
- Added GEOSSimplify() and GEOSTopologyPreserveSimplify()
|
||||
to the C API
|
||||
- Added closed ring checks in IsValidOp
|
||||
- Multi-input support in XMLTester
|
||||
- HEXWKB I/O
|
||||
- Envelope(string) ctor
|
||||
- Ruby interface
|
||||
- New ShortCircuitedGeometryVisitor class
|
||||
- New operation/predicate package
|
||||
- Added CGAlgorithms::isPointInRing() version working with
|
||||
Coordinate::ConstVect type (faster!)
|
||||
- Added getAt(int pos, Coordinate &to) funtion to CoordinateSequence
|
||||
class.
|
||||
- Moved GetNumGeometries() and GetGeometryN() interfaces
|
||||
from GeometryCollection to Geometry class.
|
||||
- New planarSubgraph class
|
||||
- New ConnectedSubgraphFinder class.
|
||||
- New LineSequencer class
|
||||
- New WKTWriter::toLineString and ::toPoint convenience methods
|
||||
- New IsValidOp::setSelfTouchingRingFormingHoleValid method
|
||||
- New WKTWriter::toLineString and ::toPoint convenience methods
|
||||
- New IsValidOp::setSelfTouchingRingFormingHoleValid method
|
||||
- New Envelope::centre()
|
||||
- New Envelope::intersection(Envelope)
|
||||
- New Envelope::expandBy(distance, [ydistance])
|
||||
- New LineString::reverse()
|
||||
- New MultiLineString::reverse()
|
||||
- New Geometry::buffer(distance, quadSeg, endCapStyle)
|
||||
- New SnapRounding code
|
||||
- New size() and operator[] interfaces to CoordinateSequence
|
||||
- New ScaledNoder class
|
||||
- New unit tests (make check rule)
|
||||
|
||||
- Optimizations:
|
||||
- WKT parser speedup
|
||||
- Function inlining
|
||||
- Coordinate copies reduction
|
||||
- Heap allocations reduction
|
||||
- More classes made final
|
||||
- Better use of standard containers
|
||||
- Use of singletons when appropriate
|
||||
- Removed many function calls in loops' end conditions
|
||||
- Improved XMLTester output and user interface
|
||||
- Improved memory use in geos::geom::util::PolygonExtractor
|
||||
- Ported JTS-1.7 version of ConvexHull with big attention to
|
||||
memory usage optimizations.
|
||||
- Changed CoordinateArrayFilter to reduce memory copies
|
||||
- Changed UniqueCoordinateArrayFilter to reduce memory copies
|
||||
- Added rectangle-based optimizations of intersects() and
|
||||
contains() ops
|
||||
- Inlined all planarGraphComponent class
|
||||
- More iterators returning methods and inlining in planargraph.
|
||||
- Obsoleted toInternalGeometry/fromInternalGeometry
|
||||
- Improved buffering speed and robustness by using Snap Rounding
|
||||
|
||||
- Semantic changes
|
||||
|
||||
- SegmentString: getCoordinates() doesn't return a clone
|
||||
anymore, getCoordinatesRO() obsoleted.
|
||||
- JTS packages mapped to geos:: sub-namespaces
|
||||
- Geometry::getInteriorPoint() returns NULL if called
|
||||
against an EMPTY geom
|
||||
- LineString::get{Start,End}Point return NULL for
|
||||
EMPTY geoms
|
||||
- GEOSException is now derived by std::runtim_exception
|
||||
and thrown by const reference.
|
||||
- Geometry constructors made protected, to force use
|
||||
of a GeometryFactory.
|
||||
|
||||
- Correctness:
|
||||
- More const-correct signatures
|
||||
- Stronger methods typing (removed some void * args).
|
||||
- Changed index-related funx signatures to use size_t
|
||||
rather then int
|
||||
- More const-correctness in Buffer "package"
|
||||
- Bugfix in LineString::getCoordinate() failing to return
|
||||
NULL from getCoordinat() when empty.
|
||||
- Use unsigned int for indexes and sizes.
|
||||
|
||||
- Layout changes:
|
||||
- Namespaces mapping JTS packages
|
||||
- Renamed classes after JTS names (namespaces use made this possible
|
||||
w/out name clashes)
|
||||
- Splitted headers, for build speedup and possible API reduction.
|
||||
- Moved source/bigtest and source/test to tests/bigtest
|
||||
and test/xmltester
|
||||
- Moved C-API in it's own top-level dir capi/
|
||||
- Reworked automake scripts to produce a static lib for each subdir
|
||||
and then link all subsystem's libs togheter
|
||||
- Renamed DefaultCoordinateSequence to CoordinateArraySequence.
|
||||
- Renamed OverlayOp opcodes by prepending the 'op' prefix, and
|
||||
given the enum a name (OpCode) for type-safety.
|
||||
|
||||
- Bug fixes:
|
||||
- Fixed bug causing redundant linestrings to be returned in the
|
||||
result of overlaying polygons containing touching holes (#13)
|
||||
- Fixed integer conversion bug
|
||||
- Fixed PointLocator handling of LinearRings
|
||||
- Added missing ::clone() methods for Multi* geoms
|
||||
|
||||
- (Partial) Detailed list of changes:
|
||||
- Changed SegmentNode to contain a *real* Coordinate (not a pointer)
|
||||
to reduce construction costs.
|
||||
- Changed geomgraph nodeMap to use Coordinate pointers as keys
|
||||
- Envelope destructor made non-virtual to give compiler more static
|
||||
binding options.
|
||||
- Changed BufferSubgraph::computeDepths to use a set instead of a
|
||||
vector for checking visited Edges.
|
||||
- Made LineIntersector a concrete type
|
||||
- Node::isIncidentEdgeInResult() method made virtual
|
||||
- Const-correct signatures in LineMerger package
|
||||
- Changed operation/valid/*NestedRingTester classes interface
|
||||
to use Coordinate pointers instead of copies.
|
||||
- Changed EdgeIntersectionList to use a set instead of a vector
|
||||
- Changed DepthSegment to store a real Coordinate rather then a pointer.
|
||||
- Changed SubgraphDepthLocater to store real containers rather then
|
||||
pointers.
|
||||
- Changed BufferSubgraph to store a real RightmostEdgeFinder and real
|
||||
containers rather then pointers.
|
||||
- CoordinateSequence API changes:
|
||||
- point index and size related functions
|
||||
use unsigned int rather then int
|
||||
- Changed EdgeEndStar to maintain a single container for EdgeEnds
|
||||
- Changed PlanarGraph::addEdges to take a const vector by ref
|
||||
rathern then a non-const vector by pointer
|
||||
- Changed EdgeList::addAll to take a const vector by ref
|
||||
rather then a non-const vector by pointer
|
||||
- Added apply_rw(CoordinateFilter *) and apply_ro(CoordinateFilter *)
|
||||
const to CoordinateSequence
|
||||
- LineBuilder::lineEdgesList made a real vector, rather then pointer
|
||||
(private member)
|
||||
- SegmentString::eiList made a real SegmentNodeList, rather then
|
||||
a pointer (private member)
|
||||
- Removed coordinate copies in ElevationMatrix::elevate
|
||||
- Changed CoordinateFilter interface to have a const method
|
||||
for filter_rw, updated interfaces using this to take
|
||||
const CoordinateFilter (apply_rw).
|
||||
|
||||
|
||||
Changes in 2.2.4
|
||||
|
||||
- Added version.in.vc to distribution
|
||||
|
||||
Changes in 2.2.1
|
||||
|
||||
- Support for MingW builds
|
||||
- Bugfix in Polygonizer chocking on invalid LineString inputs
|
||||
- CAPI: small leak removed in GEOSHasZ()
|
||||
|
||||
Changes in 2.2.0
|
||||
|
||||
- Performance improvement in OverlayOp::insertUniqueEdge()
|
||||
- CoordinateSequence copy removal in EdgeRing
|
||||
- Minor memory allocation improvements
|
||||
- Higher dimensions interface for CoordinateSequence
|
||||
- Added getCoordinatesRO for Point class
|
||||
- NEW WKB IO
|
||||
- NEW Simplified and stabler C API
|
||||
|
||||
Changes in 2.1.4
|
||||
|
||||
- Severe BUGFIX in BufferSubgraphGT and other functions used
|
||||
as StrictWeakOrdering predicates for sort()
|
||||
|
||||
Changes in 2.1.3
|
||||
|
||||
- win32/mingw build support
|
||||
- Segfault fix in LinearRing and LineString constructors
|
||||
- Segfault fix in Polygonizer
|
||||
- XMLTester installed by default
|
||||
- XMLTester code cleanup
|
||||
- Fixed handling of collection input in GeometryFactory::buildGeometry
|
||||
- Added shortcircuit test for Union operation
|
||||
- Reduced useless Coordinate copies in CGAlgorithms::isPointInRing()
|
||||
- Performance improvements in CGAlgorithms::isOnLine()
|
||||
- Other minor performance improvements
|
||||
- New Node::isIncidentEdgeInResult() method
|
||||
- OverlayOp's PointBuilder performance improvement by reduction
|
||||
of LineIntersector calls.
|
||||
- Optimizations in Buffer operation
|
||||
- Sever BUGFIX in DepthSegmentLT as suggested by Graeme Hiebert
|
||||
|
||||
Changes in 2.1.2
|
||||
|
||||
- Segfault fix in Point::isEmpty
|
||||
- Mem Leak fix in OffsetCurveBuilder::getRingCurve
|
||||
- Bugfix in LineSegment::reverse
|
||||
- Added multipolygon buffering test in source/test/testLeaksBig
|
||||
- Ported JTS robustness patch for RobustLineIntersector
|
||||
- Removed useless Coordinate copies in OverlayOp::mergeZ()
|
||||
- Avoided throws by IsValid on invalid input
|
||||
- Stricter C++ syntax (math.h=>cmath, ieeefp.h in "C" block, ostringstream
|
||||
instead of sprintf)
|
||||
- Better support for older compilers (Polygonizer::LineStringAdder friendship)
|
||||
- Removed useless Coordinate copies in CGAlgorithms::isOnLine()
|
||||
- Added support for polygonize and parametrized buffer tests in XMLTester
|
||||
- Fixed support for --includedir and --libdir
|
||||
- Fixed Z interpolation in LineIntersector
|
||||
- Handled NULL results from getCentroid() in XMLTester
|
||||
- Segfault fix in (EMPTY)Geometry::getCentroid()
|
||||
- Made polygon::getBoundary() always OGC-valid (no LinearRings)
|
||||
- Input checking and promoting in GeometryFactory::createMultiLineString()
|
||||
- Segfault fix in GeometryEditor::editPolygon()
|
||||
|
||||
|
||||
Changes in 2.1.1
|
||||
|
||||
- Fixed uninitialized Coordinate in TopologyException
|
||||
- Added install of version.h, platform.h and timeval.h
|
||||
- Memleak fix in PolygonizeGraph
|
||||
- Memleak fix in OverlayOp
|
||||
- Compiler warnings removal
|
||||
- Cleaner w32 build
|
||||
- Z interpolation in overlay operations
|
||||
- Debian package build scripts
|
||||
|
||||
|
||||
Changes in 2.1.0
|
||||
|
||||
- Added Polygonizer and LineMerger classes.
|
||||
- python wrapper examples
|
||||
- General cleanup / warnings removal
|
||||
- cleaner win32 / older copilers builds
|
||||
- Reduced heap allocations
|
||||
- debian package builder scripts
|
||||
- reduction of standard C lib headers dependency
|
||||
- Z support in overlay operations.
|
||||
|
||||
|
||||
Changes in 2.0.0
|
||||
|
||||
- CoordinateList renamed to CoordinateSequence, BasicCoordinateList
|
||||
renamed to DefaultCoordinateSequence to reflect JTS changes.
|
||||
DefaultCoordinateSequenceFactory and CoordinateSequenceFactory
|
||||
got same interface as JTS.
|
||||
- Added geos/version.h defining versioning infos
|
||||
- Added geos.h for quick inclusion. It will include geos/geom.h,
|
||||
new geos/version.h, geos/util.h geos/io.h and geos/unload.h
|
||||
(geometry input/output, exceptions, operations).
|
||||
- Added a geos::version() function showing GEOS and equivalent
|
||||
JTS versions as strings.
|
||||
- All geometry constructors take ownership of given arguments.
|
||||
GeometryFactory provides pass-by-reference geometry creators
|
||||
to take care of a deep-copy.
|
||||
- GeometryFactory::createMultiPoint(const CoordinateList *)
|
||||
has been renamed to
|
||||
GeometryFactory::createMultiPoint(const CoordinateList &)
|
||||
to reflect copy semantic
|
||||
- GeometryFactory: EMPTY geometry creation do now have their
|
||||
own constructors taking no arguments.
|
||||
- Geometry constructors taking PrecisionModel and SRID have
|
||||
been dropped. You have to use GeometryFactory instead.
|
||||
- WKTWriter default constructor has been dropped. You need
|
||||
to initialize it with an explicit GeometryFactory
|
||||
|
122
README.md
Обычный файл
122
README.md
Обычный файл
@ -0,0 +1,122 @@
|
||||
GEOS -- Geometry Engine, Open Source
|
||||
====================================
|
||||
|
||||
GEOS is a C++11 library for performing operations on two-dimensional vector
|
||||
geometries. It is primarily a port of the [JTS Topology
|
||||
Suite](https://github.com/locationtech/jts) Java library. It provides many of
|
||||
the algorithms used by [PostGIS](http://www.postgis.net/), the
|
||||
[Shapely](https://pypi.org/project/Shapely/) package for Python, the
|
||||
[sf](https://github.com/r-spatial/sf) package for R, and others.
|
||||
|
||||
More information is available the [project homepage](https://trac.osgeo.org/geos).
|
||||
|
||||
## Build status
|
||||
|
||||
| Branch | Debbie | Winnie | Dronie | Travis CI | GitLab CI | AppVeyor |
|
||||
|:--- |:--- |:--- |:--- |:--- |:--- |:--- |
|
||||
| 3.8 | [](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.8/) | [](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.8/) | [](https://dronie.osgeo.org/geos/geos?branch=3.8) | [](https://travis-ci.com/libgeos/geos?branch=3.8) | [](https://gitlab.com/geos/libgeos/commits/3.8) | [](https://ci.appveyor.com/project/dbaston/geos/branch/3.8) |
|
||||
|
||||
|
||||
## Build/install
|
||||
|
||||
See [INSTALL](./INSTALL) file
|
||||
|
||||
## Client applications
|
||||
|
||||
### Using the C interface
|
||||
|
||||
GEOS promises long-term stability of the C API. In general, successive releases
|
||||
of the C API may add new functions but will not remove or change existing types
|
||||
or function signatures. 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. For
|
||||
this reason, it is recommended to use the C API for software that is intended
|
||||
to be dynamically linked to a system install of GEOS.
|
||||
|
||||
The `geos-config` program can be used to determine appropriate compiler and
|
||||
linker flags for building against the C library:
|
||||
|
||||
CFLAGS += `geos-config --cflags`
|
||||
LDFLAGS += `geos-config --ldflags` -lgeos_c
|
||||
|
||||
All functionality of the C API is available through the `geos_c.h` header file.
|
||||
|
||||
Documentation for the C API is provided via comments in the `geos_c.h` header
|
||||
file. C API usage examples can be found in the GEOS unit tests and in the
|
||||
source code of software that uses GEOS, such as PostGIS and the sf package
|
||||
for R.
|
||||
|
||||
### Using the C++ interface
|
||||
|
||||
The C++ interface to GEOS provides a more natural API for C++ programs, as well
|
||||
as additional functionality that has not been exposed in the C API. However,
|
||||
developers who decide to use the C++ interface should be aware that GEOS does
|
||||
not promise API or ABI stability of the C++ API between releases. Breaking
|
||||
changes in the C++ API/ABI are not typically announced or included in the NEWS
|
||||
file.
|
||||
|
||||
The C++ library name will change on every minor release.
|
||||
|
||||
The `geos-config` program can be used to determine appropriate compiler and
|
||||
linker flags for building against the C++ library:
|
||||
|
||||
CFLAGS += `geos-config --cflags`
|
||||
LDFLAGS += `geos-config --ldflags` -lgeos
|
||||
|
||||
A compiler warning may be issued when building against the C++ library. To
|
||||
remove the compiler warning, define `USE_UNSTABLE_GEOS_CPP_API` somewhere
|
||||
in the program.
|
||||
|
||||
Commonly-used functionality of GEOS is available in the `geos.h` header file.
|
||||
Less-common functionality can be accessed by including headers for individual
|
||||
classes, e.g. `#include <geos/algorithm/distance/DiscreteHausdorffDistance.h>`.
|
||||
|
||||
#include <geos.h>
|
||||
|
||||
Documentation for the C++ API is available at https://geos.osgeo.org/doxygen/,
|
||||
and basic C++ usage examples can be found in `doc/example.cpp`.
|
||||
|
||||
|
||||
### Scripting language bindings
|
||||
|
||||
#### Ruby
|
||||
|
||||
Ruby bindings are part of GEOS. To build, use the `--enable-ruby` option
|
||||
when configuring:
|
||||
|
||||
./configure .. --enable-ruby
|
||||
|
||||
#### PHP
|
||||
|
||||
PHP bindings for GEOS are available separately from
|
||||
[php-geos](https://git.osgeo.org/gitea/geos/php-geos).
|
||||
|
||||
#### Python
|
||||
|
||||
Python bindings are available via:
|
||||
|
||||
1. [Shapely](http://pypi.python.org/pypi/Shapely) package.
|
||||
2. Calling functions from `libgeos_c` via Python ctypes.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Doxygen documentation can be generated using either the autotools or CMake build
|
||||
systems.
|
||||
|
||||
### Using Autotools:
|
||||
|
||||
cd doc
|
||||
make doxygen-html
|
||||
|
||||
### Using CMake:
|
||||
|
||||
cmake -DBUILD_DOCUMENTATION=YES
|
||||
make docs
|
||||
|
||||
## Style
|
||||
|
||||
To format your code into the desired style, use the astyle
|
||||
version included in source tree:
|
||||
|
||||
tools/astyle.sh <yourfile.cpp>
|
22
Version.txt
Обычный файл
22
Version.txt
Обычный файл
@ -0,0 +1,22 @@
|
||||
|
||||
# GEOS Versions
|
||||
GEOS_VERSION_MAJOR=3
|
||||
GEOS_VERSION_MINOR=8
|
||||
GEOS_VERSION_PATCH=1
|
||||
|
||||
# OPTIONS: "", "dev", "rc1" etc.
|
||||
GEOS_PATCH_WORD=
|
||||
|
||||
# GEOS CAPI Versions
|
||||
#
|
||||
# Always increase the revision value.
|
||||
# Increase the current value whenever an interface has been
|
||||
# added, removed or changed.
|
||||
# Increase the age value only if the changes made to the ABI
|
||||
# are backward compatible.
|
||||
CAPI_INTERFACE_CURRENT=14
|
||||
CAPI_INTERFACE_REVISION=3
|
||||
CAPI_INTERFACE_AGE=13
|
||||
|
||||
# JTS Port
|
||||
JTS_PORT=1.13.0
|
55
acsite.m4
Обычный файл
55
acsite.m4
Обычный файл
@ -0,0 +1,55 @@
|
||||
# This has been taken from postgres-9.1+ local macros
|
||||
# ( REL9_1_BETA2-1484-g293ec33 )
|
||||
|
||||
# PGAC_TYPE_64BIT_INT(TYPE)
|
||||
# -------------------------
|
||||
# Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to
|
||||
# yes or no respectively, and define HAVE_TYPE_64 if yes.
|
||||
AC_DEFUN([PGAC_TYPE_64BIT_INT],
|
||||
[define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl
|
||||
define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
|
||||
AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
|
||||
[AC_TRY_RUN(
|
||||
[typedef $1 ac_int64;
|
||||
|
||||
/*
|
||||
* These are globals to discourage the compiler from folding all the
|
||||
* arithmetic tests down to compile-time constants.
|
||||
*/
|
||||
ac_int64 a = 20000001;
|
||||
ac_int64 b = 40000005;
|
||||
|
||||
int does_int64_work()
|
||||
{
|
||||
ac_int64 c,d;
|
||||
|
||||
if (sizeof(ac_int64) != 8)
|
||||
return 0; /* definitely not the right size */
|
||||
|
||||
/* Do perfunctory checks to see if 64-bit arithmetic seems to work */
|
||||
c = a * b;
|
||||
d = (c + b) / b;
|
||||
if (d != a+1)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
main() {
|
||||
if (does_int64_work())
|
||||
exit(0);
|
||||
exit(-1);
|
||||
}],
|
||||
[Ac_cachevar=yes],
|
||||
[Ac_cachevar=no],
|
||||
[# If cross-compiling, check the size reported by the compiler and
|
||||
# trust that the arithmetic works.
|
||||
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [sizeof($1) == 8])],
|
||||
Ac_cachevar=yes,
|
||||
Ac_cachevar=no)])])
|
||||
|
||||
Ac_define=$Ac_cachevar
|
||||
if test x"$Ac_cachevar" = xyes ; then
|
||||
AC_DEFINE(Ac_define, 1, [Define to 1 if `]$1[' works and is 64 bits.])
|
||||
fi
|
||||
undefine([Ac_define])dnl
|
||||
undefine([Ac_cachevar])dnl
|
||||
])# PGAC_TYPE_64BIT_INT
|
81
appveyor.yml
Обычный файл
81
appveyor.yml
Обычный файл
@ -0,0 +1,81 @@
|
||||
version: 1.0.{build}
|
||||
|
||||
image: Visual Studio 2017
|
||||
|
||||
platform: x64
|
||||
|
||||
configuration: Release
|
||||
|
||||
shallow_clone: true
|
||||
clone_depth: 5
|
||||
|
||||
matrix:
|
||||
fast_finish: false # set this flag to immediately finish build once one of the jobs fails.
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- PLATFORM: x64
|
||||
BUILDER: CMake
|
||||
GENERATOR: "Visual Studio 15 2017 Win64"
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
# - PLATFORM: x86
|
||||
# BUILDER: CMake
|
||||
# GENERATOR: "Visual Studio 15 2017"
|
||||
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
# - PLATFORM: x64
|
||||
# BUILDER: CMake
|
||||
# GENERATOR: "NMake Makefiles"
|
||||
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
# - PLATFORM: x86
|
||||
# BUILDER: CMake
|
||||
# GENERATOR: "NMake Makefiles"
|
||||
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
# - PLATFORM: x64
|
||||
# BUILDER: CMake
|
||||
# GENERATOR: "Visual Studio 14 2015 Win64"
|
||||
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
# - PLATFORM: x86
|
||||
# BUILDER: CMake
|
||||
# GENERATOR: "Visual Studio 14 2015"
|
||||
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
# - PLATFORM: x64
|
||||
# BUILDER: CMake
|
||||
# GENERATOR: "NMake Makefiles"
|
||||
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- PLATFORM: x86
|
||||
BUILDER: CMake
|
||||
GENERATOR: "NMake Makefiles"
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
|
||||
init:
|
||||
- ps: 'Write-Host "Building GEOS branch: $env:APPVEYOR_REPO_BRANCH" -ForegroundColor Magenta'
|
||||
#- ps: |
|
||||
# Write-Host "Build worker environment variables:" -ForegroundColor Magenta
|
||||
# Get-ChildItem Env: | %{"{0}={1}" -f $_.Name,$_.Value}
|
||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
|
||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
|
||||
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
|
||||
|
||||
before_build:
|
||||
- ps: 'Write-Host "Running $env:BUILDER with $env:GENERATOR" -ForegroundColor Magenta'
|
||||
- if "%BUILDER%"=="CMake" cmake.exe -G "%GENERATOR%" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER%
|
||||
- if "%BUILDER%"=="NMake" .\autogen.bat
|
||||
|
||||
build_script:
|
||||
- ps: 'Write-Host "Running $env:BUILDER:" -ForegroundColor Magenta'
|
||||
- if "%BUILDER%"=="CMake" cmake --build . --config %CONFIGURATION%
|
||||
- if "%BUILDER%"=="NMake" nmake /f makefile.vc
|
||||
|
||||
test_script:
|
||||
- ps: 'Write-Host "Running tests:" -ForegroundColor Magenta'
|
||||
- if "%BUILDER%"=="CMake" ctest --output-on-failure -C %CONFIGURATION%
|
||||
- if "%BUILDER%"=="NMake" echo *** NMake does NOT build tests ***
|
||||
|
||||
# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then:
|
||||
# 1. Uncomment the on_finish section below:
|
||||
#on_finish:
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
# 2. Add this line to the init section below
|
||||
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
96
autogen.sh
Исполняемый файл
96
autogen.sh
Исполняемый файл
@ -0,0 +1,96 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# GEOS Bootstrapping Script
|
||||
#
|
||||
giveup()
|
||||
{
|
||||
echo
|
||||
echo " Something went wrong, giving up!"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
OSTYPE=`uname -s`
|
||||
|
||||
AUTOCONF=`which autoconf 2>/dev/null`
|
||||
if [ ! ${AUTOCONF} ]; then
|
||||
echo "Missing autoconf!"
|
||||
exit
|
||||
fi
|
||||
AUTOCONF_VER=`${AUTOCONF} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'`
|
||||
|
||||
AUTOHEADER=`which autoheader 2>/dev/null`
|
||||
if [ ! ${AUTOHEADER} ]; then
|
||||
echo "Missing autoheader!"
|
||||
exit
|
||||
fi
|
||||
|
||||
for aclocal in aclocal aclocal-1.10 aclocal-1.9; do
|
||||
ACLOCAL=`which $aclocal 2>/dev/null`
|
||||
if test -x "${ACLOCAL}"; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ ! ${ACLOCAL} ]; then
|
||||
echo "Missing aclocal!"
|
||||
exit
|
||||
fi
|
||||
ACLOCAL_VER=`${ACLOCAL} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'`
|
||||
|
||||
for automake in automake automake-1.10 automake-1.9; do
|
||||
AUTOMAKE=`which $automake 2>/dev/null`
|
||||
if test -x "${AUTOMAKE}"; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ ! ${AUTOMAKE} ]; then
|
||||
echo "Missing automake!"
|
||||
exit
|
||||
fi
|
||||
AUTOMAKE_VER=`${AUTOMAKE} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'`
|
||||
|
||||
for libtoolize in libtoolize glibtoolize; do
|
||||
LIBTOOLIZE=`which $libtoolize 2>/dev/null`
|
||||
if test -x "${LIBTOOLIZE}"; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ ! ${LIBTOOLIZE} ]; then
|
||||
echo "Missing libtoolize!"
|
||||
exit
|
||||
fi
|
||||
LIBTOOLIZE_VER=`${LIBTOOLIZE} --version | grep -E "^.*[0-9]\.[0-9]" | sed 's/^.* //'`
|
||||
|
||||
AMOPTS="--add-missing --copy -Woverride"
|
||||
if test "$OSTYPE" = "IRIX" -o "$OSTYPE" = "IRIX64"; then
|
||||
AMOPTS=$AMOPTS" --include-deps";
|
||||
fi
|
||||
|
||||
LTOPTS="--force --copy"
|
||||
echo "* Running ${LIBTOOLIZE} (${LIBTOOLIZE_VER})"
|
||||
echo " OPTIONS = ${LTOPTS}"
|
||||
${LIBTOOLIZE} ${LTOPTS} || giveup
|
||||
|
||||
echo "* Running $ACLOCAL (${ACLOCAL_VER})"
|
||||
${ACLOCAL} -I macros || giveup
|
||||
|
||||
echo "* Running ${AUTOHEADER} (${AUTOCONF_VER})"
|
||||
${AUTOHEADER} || giveup
|
||||
|
||||
echo "* Running ${AUTOMAKE} (${AUTOMAKE_VER})"
|
||||
echo " OPTIONS = ${AMOPTS}"
|
||||
${AUTOMAKE} ${AMOPTS} || giveup
|
||||
|
||||
echo "* Running ${AUTOCONF} (${AUTOCONF_VER})"
|
||||
${AUTOCONF} || giveup
|
||||
|
||||
if test -f "${PWD}/configure"; then
|
||||
echo "======================================"
|
||||
echo "Now you are ready to run './configure'"
|
||||
echo "======================================"
|
||||
else
|
||||
echo " Failed to generate ./configure script!"
|
||||
giveup
|
||||
fi
|
||||
|
16
benchmarks/CMakeLists.txt
Обычный файл
16
benchmarks/CMakeLists.txt
Обычный файл
@ -0,0 +1,16 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
add_executable(perf_class_sizes ClassSizes.cpp)
|
||||
target_link_libraries(perf_class_sizes PRIVATE geos)
|
||||
|
||||
add_subdirectory(algorithm)
|
||||
add_subdirectory(operation)
|
||||
add_subdirectory(capi)
|
76
benchmarks/ClassSizes.cpp
Обычный файл
76
benchmarks/ClassSizes.cpp
Обычный файл
@ -0,0 +1,76 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* - Monitor class sizes
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/io/WKTReader.h>
|
||||
#include <geos/geom/CoordinateArraySequence.h>
|
||||
#include <geos/geom/FixedSizeCoordinateSequence.h>
|
||||
#include <geos/geom/Geometry.h>
|
||||
#include <geos/geom/Point.h>
|
||||
#include <geos/geom/LinearRing.h>
|
||||
#include <geos/geom/LineString.h>
|
||||
#include <geos/geom/Polygon.h>
|
||||
#include <geos/geom/GeometryCollection.h>
|
||||
#include <geos/geom/MultiPoint.h>
|
||||
#include <geos/geom/MultiLineString.h>
|
||||
#include <geos/geom/MultiPolygon.h>
|
||||
#include <geos/geomgraph/Depth.h>
|
||||
#include <geos/geomgraph/DirectedEdge.h>
|
||||
#include <geos/geomgraph/Edge.h>
|
||||
#include <geos/geomgraph/EdgeEnd.h>
|
||||
#include <geos/geomgraph/PlanarGraph.h>
|
||||
#include <geos/noding/NodedSegmentString.h>
|
||||
#include <geos/profiler.h>
|
||||
#include <geos/constants.h>
|
||||
#include <iostream>
|
||||
#include <geos/geomgraph/index/SweepLineEvent.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace geos;
|
||||
|
||||
#define check(x) \
|
||||
{ cout << "Size of " << #x << " is " << sizeof(x) << endl; }
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
check(geomgraph::Depth);
|
||||
check(geomgraph::DirectedEdge);
|
||||
check(geomgraph::DirectedEdgeStar);
|
||||
check(geomgraph::Edge);
|
||||
check(geomgraph::EdgeEnd);
|
||||
check(geomgraph::PlanarGraph);
|
||||
check(geomgraph::TopologyLocation);
|
||||
check(geomgraph::index::SweepLineEvent);
|
||||
check(noding::NodedSegmentString);
|
||||
check(geom::Geometry);
|
||||
check(geom::Point);
|
||||
check(geom::LineString);
|
||||
check(geom::LinearRing);
|
||||
check(geom::Polygon);
|
||||
check(geom::GeometryCollection);
|
||||
check(geom::MultiPoint);
|
||||
check(geom::MultiLineString);
|
||||
check(geom::MultiPolygon);
|
||||
check(geom::CoordinateArraySequence);
|
||||
check(geom::FixedSizeCoordinateSequence<1>);
|
||||
check(geom::FixedSizeCoordinateSequence<2>);
|
||||
check(int64);
|
||||
}
|
||||
|
17
benchmarks/Makefile.am
Обычный файл
17
benchmarks/Makefile.am
Обычный файл
@ -0,0 +1,17 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
SUBDIRS = \
|
||||
algorithm \
|
||||
operation \
|
||||
capi
|
||||
|
||||
LIBS = $(top_builddir)/src/libgeos.la
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
noinst_PROGRAMS = ClassSizes
|
||||
|
||||
ClassSizes_SOURCES = ClassSizes.cpp
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
20
benchmarks/algorithm/CMakeLists.txt
Обычный файл
20
benchmarks/algorithm/CMakeLists.txt
Обычный файл
@ -0,0 +1,20 @@
|
||||
#################################################################################
|
||||
#
|
||||
# CMake configuration for GEOS benchmarks/operation/predicate tests
|
||||
#
|
||||
# Copyright (C) 2017 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
#
|
||||
#################################################################################
|
||||
add_executable(perf_interiorpoint_area InteriorPointAreaPerfTest.cpp)
|
||||
target_link_libraries(perf_interiorpoint_area geos)
|
||||
|
||||
add_executable(perf_voronoi VoronoiPerfTest.cpp)
|
||||
target_link_libraries(perf_voronoi geos)
|
||||
|
||||
add_executable(perf_unaryunion_segments UnaryUnionSegmentsPerfTest.cpp)
|
||||
target_link_libraries(perf_unaryunion_segments geos)
|
138
benchmarks/algorithm/InteriorPointAreaPerfTest.cpp
Обычный файл
138
benchmarks/algorithm/InteriorPointAreaPerfTest.cpp
Обычный файл
@ -0,0 +1,138 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: perf/operation/predicate/RectangleIntersectsPerfTest.java r378 (JTS-1.12)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#include <geos/geom/PrecisionModel.h>
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/util/GeometricShapeFactory.h>
|
||||
#include <geos/precision/SimpleGeometryPrecisionReducer.h>
|
||||
#include <geos/geom/util/SineStarFactory.h>
|
||||
#include <geos/geom/Geometry.h>
|
||||
#include <geos/geom/Polygon.h>
|
||||
#include <geos/geom/Point.h>
|
||||
#include <geos/profiler.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
|
||||
using namespace geos::geom;
|
||||
using namespace geos::io;
|
||||
using namespace std;
|
||||
|
||||
class InteriorPointAreaPerfTest {
|
||||
public:
|
||||
InteriorPointAreaPerfTest()
|
||||
:
|
||||
pm(),
|
||||
fact(GeometryFactory::create(&pm, 0))
|
||||
{
|
||||
showHeader();
|
||||
}
|
||||
|
||||
void
|
||||
test(int nPts)
|
||||
{
|
||||
Coordinate origin(ORG_X, ORG_Y);
|
||||
std::unique_ptr<geos::geom::Polygon> sinePoly =
|
||||
createSineStar(origin, SIZE, nPts);
|
||||
|
||||
/**
|
||||
* Make the geometry "crinkly" by rounding off the points.
|
||||
* This defeats the MonotoneChain optimization in the full relate
|
||||
* algorithm, and provides a more realistic test.
|
||||
*/
|
||||
using geos::precision::SimpleGeometryPrecisionReducer;
|
||||
double scale = nPts / SIZE;
|
||||
PrecisionModel p_pm(scale);
|
||||
SimpleGeometryPrecisionReducer reducer(&p_pm);
|
||||
std::unique_ptr<Geometry> sinePolyCrinkly(reducer.reduce(sinePoly.get()));
|
||||
sinePoly.reset();
|
||||
|
||||
//cout << sinePolyCrinkly->toText() << endl;
|
||||
|
||||
test(*sinePolyCrinkly);
|
||||
}
|
||||
|
||||
const double ORG_X = 100.0;
|
||||
const double ORG_Y = 100.0;
|
||||
const double SIZE = 100.0;
|
||||
const int N_ARMS = 20;
|
||||
const double ARM_RATIO = 0.3;
|
||||
const int N_ITER = 100;
|
||||
|
||||
private:
|
||||
PrecisionModel pm;
|
||||
GeometryFactory::Ptr fact;
|
||||
|
||||
void
|
||||
showHeader() {
|
||||
cout << "Interior Point Area perf test" << endl;
|
||||
cout << "# Iterations: " << N_ITER << endl;
|
||||
cout << "SineStar: origin: ("
|
||||
<< ORG_X << ", " << ORG_Y
|
||||
<< ") size: " << SIZE
|
||||
<< " # arms: " << N_ARMS
|
||||
<< " arm ratio: " << ARM_RATIO
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void
|
||||
test(geos::geom::Geometry& poly)
|
||||
{
|
||||
geos::util::Profile sw("");
|
||||
sw.start();
|
||||
|
||||
for(int i = 0; i < N_ITER; i++) {
|
||||
std::unique_ptr<geos::geom::Point> pt( poly.getInteriorPoint() );
|
||||
}
|
||||
|
||||
sw.stop();
|
||||
cout << poly.getNumPoints() << " points: " << sw.getTotFormatted() << endl;
|
||||
}
|
||||
|
||||
std::unique_ptr<geos::geom::Polygon>
|
||||
createSineStar(const Coordinate& origin,
|
||||
double size, int nPts)
|
||||
{
|
||||
using geos::geom::util::SineStarFactory;
|
||||
|
||||
SineStarFactory gsf(fact.get());
|
||||
gsf.setCentre(origin);
|
||||
gsf.setSize(size);
|
||||
gsf.setNumPoints(nPts);
|
||||
gsf.setArmLengthRatio( ARM_RATIO );
|
||||
gsf.setNumArms( N_ARMS );
|
||||
std::unique_ptr<geos::geom::Polygon> poly = gsf.createSineStar();
|
||||
return poly;
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
InteriorPointAreaPerfTest tester;
|
||||
|
||||
tester.test(100);
|
||||
tester.test(1000);
|
||||
tester.test(10000);
|
||||
tester.test(100000);
|
||||
tester.test(1000000);
|
||||
}
|
||||
|
25
benchmarks/algorithm/Makefile.am
Обычный файл
25
benchmarks/algorithm/Makefile.am
Обычный файл
@ -0,0 +1,25 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
prefix=@prefix@
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=@top_builddir@
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
InteriorPointAreaPerfTest \
|
||||
VoronoiPerfTest \
|
||||
UnaryUnionSegmentsPerfTest
|
||||
|
||||
InteriorPointAreaPerfTest_SOURCES = InteriorPointAreaPerfTest.cpp
|
||||
InteriorPointAreaPerfTest_LDADD = $(top_builddir)/src/libgeos.la
|
||||
|
||||
VoronoiPerfTest_SOURCES = VoronoiPerfTest.cpp
|
||||
VoronoiPerfTest_LDADD = $(top_builddir)/src/libgeos.la
|
||||
|
||||
UnaryUnionSegmentsPerfTest_SOURCES = UnaryUnionSegmentsPerfTest.cpp
|
||||
UnaryUnionSegmentsPerfTest_LDADD = $(top_builddir)/src/libgeos.la
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/src/io/markup
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
71
benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp
Обычный файл
71
benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp
Обычный файл
@ -0,0 +1,71 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <geos/triangulate/DelaunayTriangulationBuilder.h>
|
||||
#include <geos/triangulate/VoronoiDiagramBuilder.h>
|
||||
#include <geos/geom/CoordinateArraySequence.h>
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/profiler.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class SegmentUnaryUnionPerfTest {
|
||||
|
||||
public:
|
||||
void test(size_t num_lines) {
|
||||
using namespace geos::geom;
|
||||
|
||||
std::default_random_engine e(12345);
|
||||
std::uniform_real_distribution<> dis(0, 100);
|
||||
|
||||
|
||||
std::vector<std::unique_ptr<LineString>> lines;
|
||||
|
||||
for (size_t i = 0; i < num_lines; i++) {
|
||||
CoordinateArraySequence cas(2, 2);
|
||||
cas.setAt(Coordinate(dis(e), dis(e)), 0);
|
||||
cas.setAt(Coordinate(dis(e), dis(e)), 1);
|
||||
|
||||
lines.emplace_back(gfact->createLineString(std::move(cas)));
|
||||
}
|
||||
|
||||
auto g = gfact->createMultiLineString(std::move(lines));
|
||||
|
||||
auto sw = profiler->get("union");
|
||||
sw->start();
|
||||
|
||||
g->Union();
|
||||
|
||||
sw->stop();
|
||||
|
||||
std::cout << *sw << std::endl;
|
||||
}
|
||||
private:
|
||||
decltype(geos::geom::GeometryFactory::create()) gfact = geos::geom::GeometryFactory::create();
|
||||
geos::util::Profiler* profiler = geos::util::Profiler::instance();
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
SegmentUnaryUnionPerfTest tester;
|
||||
|
||||
auto num_lines = std::atol(argv[1]);
|
||||
auto num_reps = argc > 2 ? std::atol(argv[2]) : 1;
|
||||
|
||||
for (int i = 0; i < num_reps; i++) {
|
||||
tester.test(num_lines);
|
||||
}
|
||||
}
|
92
benchmarks/algorithm/VoronoiPerfTest.cpp
Обычный файл
92
benchmarks/algorithm/VoronoiPerfTest.cpp
Обычный файл
@ -0,0 +1,92 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <geos/triangulate/DelaunayTriangulationBuilder.h>
|
||||
#include <geos/triangulate/VoronoiDiagramBuilder.h>
|
||||
#include <geos/geom/CoordinateArraySequence.h>
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/profiler.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class VoronoiPerfTest {
|
||||
|
||||
public:
|
||||
void test(size_t num_points) {
|
||||
using namespace geos::geom;
|
||||
|
||||
std::default_random_engine e(12345);
|
||||
std::uniform_real_distribution<> dis(0, 100);
|
||||
|
||||
std::unique_ptr<std::vector<Coordinate>> coords(new std::vector<Coordinate>(num_points));
|
||||
std::generate(coords->begin(), coords->end(), [&dis, &e]() {
|
||||
return Coordinate(dis(e), dis(e));
|
||||
});
|
||||
CoordinateArraySequence seq(coords.release());
|
||||
auto geom = gfact->createLineString(seq.clone());
|
||||
|
||||
voronoi(seq);
|
||||
voronoi(*geom);
|
||||
|
||||
delaunay(seq);
|
||||
delaunay(*geom);
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
private:
|
||||
decltype(geos::geom::GeometryFactory::create()) gfact = geos::geom::GeometryFactory::create();
|
||||
geos::util::Profiler* profiler = geos::util::Profiler::instance();
|
||||
|
||||
template<typename T>
|
||||
void voronoi(const T & sites) {
|
||||
auto sw = profiler->get(std::string("Voronoi from ") + typeid(T).name());
|
||||
sw->start();
|
||||
|
||||
geos::triangulate::VoronoiDiagramBuilder vdb;
|
||||
vdb.setSites(sites);
|
||||
|
||||
auto result = vdb.getDiagram(*gfact);
|
||||
|
||||
sw->stop();
|
||||
std::cout << sw->name << ": " << result->getNumGeometries() << ": " << *sw << std::endl;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void delaunay(const T & seq) {
|
||||
auto sw = profiler->get(std::string("Delaunay from ") + typeid(T).name());
|
||||
sw->start();
|
||||
|
||||
geos::triangulate::DelaunayTriangulationBuilder dtb;
|
||||
dtb.setSites(seq);
|
||||
|
||||
auto result = dtb.getTriangles(*gfact);
|
||||
|
||||
sw->stop();
|
||||
std::cout << sw->name << ": " << result->getNumGeometries() << ": " << *sw << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
VoronoiPerfTest tester;
|
||||
|
||||
//tester.test(100);
|
||||
//tester.test(1000);
|
||||
//tester.test(10000);
|
||||
for (auto i = 0; i < 5; i++) {
|
||||
tester.test(100000);
|
||||
}
|
||||
}
|
24
benchmarks/capi/CMakeLists.txt
Обычный файл
24
benchmarks/capi/CMakeLists.txt
Обычный файл
@ -0,0 +1,24 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
add_executable(perf_memleak_mp_prep memleak_mp_prep.c)
|
||||
# test_perf_memleak_mp_prep is not dependant against geos target,
|
||||
# but geos_c only, so need explicit include directories.
|
||||
target_include_directories(perf_memleak_mp_prep
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
||||
target_link_libraries(perf_memleak_mp_prep PRIVATE geos_c)
|
||||
|
||||
add_executable(perf_geospreparedcontains GEOSPreparedContainsPerfTest.cpp)
|
||||
target_link_libraries(perf_geospreparedcontains PRIVATE geos geos_c)
|
||||
|
||||
add_executable(perf_intersection IntersectionPerfTest.cpp)
|
||||
target_link_libraries(perf_intersection PRIVATE geos geos_c)
|
111
benchmarks/capi/GEOSPreparedContainsPerfTest.cpp
Обычный файл
111
benchmarks/capi/GEOSPreparedContainsPerfTest.cpp
Обычный файл
@ -0,0 +1,111 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <geos/profiler.h>
|
||||
#include <geos_c.h>
|
||||
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/geom/Polygon.h>
|
||||
#include <geos/geom/util/SineStarFactory.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
class GEOSPreparedContainsPerfTest {
|
||||
|
||||
public:
|
||||
void test(const GEOSGeometry* g, size_t num_points) {
|
||||
using namespace geos::geom;
|
||||
|
||||
double xmin, xmax, ymin, ymax;
|
||||
|
||||
GEOSGeom_getXMin(g, &xmin);
|
||||
GEOSGeom_getXMax(g, &xmax);
|
||||
GEOSGeom_getYMin(g, &ymin);
|
||||
GEOSGeom_getYMax(g, &ymax);
|
||||
|
||||
std::default_random_engine e(12345);
|
||||
std::uniform_real_distribution<> xdist(xmin, xmax);
|
||||
std::uniform_real_distribution<> ydist(ymin, ymax);
|
||||
|
||||
std::vector<Coordinate> coords(num_points);
|
||||
std::generate(coords.begin(), coords.end(), [&xdist, &ydist, &e]() {
|
||||
return Coordinate(xdist(e), ydist(e));
|
||||
});
|
||||
|
||||
geos::util::Profile sw("GEOSPreparedContains");
|
||||
sw.start();
|
||||
|
||||
size_t hits = 0;
|
||||
auto prep = GEOSPrepare(g);
|
||||
for (const auto& c : coords) {
|
||||
auto pt = GEOSGeom_createPointFromXY(c.x, c.y);
|
||||
|
||||
if (GEOSPreparedContains(prep, pt)) {
|
||||
hits++;
|
||||
}
|
||||
|
||||
GEOSGeom_destroy(pt);
|
||||
}
|
||||
|
||||
GEOSPreparedGeom_destroy(prep);
|
||||
|
||||
sw.stop();
|
||||
|
||||
std::cout << sw.name << ": " << hits << " hits from " << num_points << " points in " << sw.getTotFormatted() << std::endl;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc != 3) {
|
||||
std::cout << "perf_geospreparedcontins performs a specified number of point-in-polygon tests" << std::endl;
|
||||
std::cout << "on randomly generated points from the bounding box of a single geometry provided" << std::endl;
|
||||
std::cout << "in a file as WKT." << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Usage: perf_geospreparedcontins [wktfile] [n]" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
GEOSPreparedContainsPerfTest tester;
|
||||
|
||||
int n = std::atoi(argv[2]);
|
||||
std::cout << "Performing " << n << " point-in-polygon tests." << std::endl;
|
||||
|
||||
std::string fname{argv[1]};
|
||||
std::cout << "Reading shape from " << fname << std::endl;
|
||||
|
||||
std::ifstream f(fname);
|
||||
std::stringstream buff;
|
||||
buff << f.rdbuf();
|
||||
f.close();
|
||||
|
||||
std::string wkt = buff.str();
|
||||
buff.clear();
|
||||
|
||||
initGEOS(nullptr, nullptr);
|
||||
GEOSGeometry* g = GEOSGeomFromWKT(wkt.c_str());
|
||||
wkt.clear();
|
||||
|
||||
tester.test(g, n);
|
||||
|
||||
GEOSGeom_destroy(g);
|
||||
}
|
87
benchmarks/capi/IntersectionPerfTest.cpp
Обычный файл
87
benchmarks/capi/IntersectionPerfTest.cpp
Обычный файл
@ -0,0 +1,87 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#include <geos/profiler.h>
|
||||
#include <geos_c.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc != 2 && argc != 3) {
|
||||
std::cout << "perf_intersection reads geometries from a WKT file and" << std::endl;
|
||||
std::cout << "inserts them into an STR-tree. For each input geometry, it" << std::endl;
|
||||
std::cout << "queries the tree to find all intersecting geometries and" << std::endl;
|
||||
std::cout << "then computes their intersection." << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "Usage: perf_intersection [wktfile] [n]" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
initGEOS(nullptr, nullptr);
|
||||
|
||||
std::string fname{argv[1]};
|
||||
|
||||
long max_geoms;
|
||||
if (argc == 3) {
|
||||
max_geoms = std::atol(argv[2]);
|
||||
std::cout << "Reading up to " << max_geoms << " geometries from " << fname << std::endl;
|
||||
} else {
|
||||
std::cout << "Reading geometries from " << fname << std::endl;
|
||||
max_geoms = -1;
|
||||
}
|
||||
|
||||
std::vector<GEOSGeometry*> geoms;
|
||||
|
||||
std::ifstream f(fname);
|
||||
std::string line;
|
||||
long i = 0;
|
||||
while(std::getline(f, line) && i < max_geoms) {
|
||||
geoms.push_back(GEOSGeomFromWKT(line.c_str()));
|
||||
i++;
|
||||
}
|
||||
f.close();
|
||||
|
||||
std::cout << "Read " << geoms.size() << " geometries." << std::endl;
|
||||
|
||||
GEOSSTRtree* tree = GEOSSTRtree_create(10);
|
||||
|
||||
for (const auto& g : geoms) {
|
||||
GEOSSTRtree_insert(tree, g, g);
|
||||
}
|
||||
|
||||
geos::util::Profile sw("Intersection");
|
||||
sw.start();
|
||||
|
||||
for (const auto& g : geoms) {
|
||||
GEOSSTRtree_query(tree, g, [](void* g2v, void* g1v) {
|
||||
GEOSGeometry* g1 = (GEOSGeometry*) g1v;
|
||||
GEOSGeometry* g2 = (GEOSGeometry*) g2v;
|
||||
if (GEOSIntersects(g1, g2) == 1) {
|
||||
GEOSGeometry* g3 = GEOSIntersection(g1, g2);
|
||||
GEOSGeom_destroy(g3);
|
||||
}
|
||||
}, g);
|
||||
}
|
||||
|
||||
sw.stop();
|
||||
std::cout << sw.getTotFormatted() << std::endl;
|
||||
|
||||
GEOSSTRtree_destroy(tree);
|
||||
|
||||
for (auto& g : geoms) {
|
||||
GEOSGeom_destroy(g);
|
||||
}
|
||||
}
|
26
benchmarks/capi/Makefile.am
Обычный файл
26
benchmarks/capi/Makefile.am
Обычный файл
@ -0,0 +1,26 @@
|
||||
#
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
prefix=@prefix@
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=@top_builddir@
|
||||
|
||||
check_PROGRAMS = \
|
||||
memleak_mp_prep \
|
||||
GEOSPreparedContainsPerfTest \
|
||||
IntersectionPerfTest
|
||||
|
||||
LIBS = $(top_builddir)/capi/libgeos_c.la
|
||||
AM_CPPFLAGS = -I$(top_builddir)/capi -I$(top_srcdir)/include
|
||||
|
||||
memleak_mp_prep_SOURCES = memleak_mp_prep.c
|
||||
memleak_mp_prep_LDADD = $(LIBS)
|
||||
|
||||
GEOSPreparedContainsPerfTest_SOURCES = GEOSPreparedContainsPerfTest.cpp
|
||||
GEOSPreparedContainsPerfTest_LDADD = $(top_builddir)/src/libgeos.la
|
||||
|
||||
IntersectionPerfTest_SOURCES = IntersectionPerfTest.cpp
|
||||
IntersectionPerfTest_LDADD = $(top_builddir)/src/libgeos.la
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
42
benchmarks/capi/memleak_mp_prep.c
Обычный файл
42
benchmarks/capi/memleak_mp_prep.c
Обычный файл
@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "geos_c.h"
|
||||
|
||||
int main(void) {
|
||||
GEOSWKTReader *reader;
|
||||
GEOSGeometry *mp;
|
||||
GEOSGeometry *p;
|
||||
const GEOSPreparedGeometry *prep_mp;
|
||||
unsigned long int i;
|
||||
unsigned long int count = 1e6;
|
||||
|
||||
initGEOS(NULL, NULL);
|
||||
|
||||
reader = GEOSWKTReader_create();
|
||||
|
||||
mp = GEOSWKTReader_read(reader,
|
||||
"MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))");
|
||||
|
||||
p = GEOSWKTReader_read(reader,
|
||||
"POLYGON((2 2, 6 2, 6 6, 2 6, 2 2))");
|
||||
|
||||
assert(GEOSisValid(mp));
|
||||
assert(GEOSisValid(p));
|
||||
|
||||
prep_mp = GEOSPrepare(mp);
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
|
||||
if ( !(i%100) ) printf("%lu iterations\n", i);
|
||||
|
||||
/* does not leak */
|
||||
/* GEOSContains(mp, p); */
|
||||
|
||||
/* leaks */
|
||||
GEOSPreparedContains(prep_mp, p);
|
||||
}
|
||||
|
||||
printf("%lu iterations (END)\n", i);
|
||||
|
||||
return 0;
|
||||
}
|
6
benchmarks/capi/memleak_mp_prep.sh
Обычный файл
6
benchmarks/capi/memleak_mp_prep.sh
Обычный файл
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# tweak the number till you get a few lines of output and a segfault..
|
||||
ulimit -v $((1024*18))
|
||||
|
||||
./memleak_mp_prep
|
12
benchmarks/operation/CMakeLists.txt
Обычный файл
12
benchmarks/operation/CMakeLists.txt
Обычный файл
@ -0,0 +1,12 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
add_subdirectory(buffer)
|
||||
add_subdirectory(predicate)
|
9
benchmarks/operation/Makefile.am
Обычный файл
9
benchmarks/operation/Makefile.am
Обычный файл
@ -0,0 +1,9 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
SUBDIRS = \
|
||||
buffer \
|
||||
predicate
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
12
benchmarks/operation/buffer/CMakeLists.txt
Обычный файл
12
benchmarks/operation/buffer/CMakeLists.txt
Обычный файл
@ -0,0 +1,12 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
add_executable(perf_iterated_buffer IteratedBufferStressTest.cpp)
|
||||
target_link_libraries(perf_iterated_buffer PRIVATE geos)
|
90
benchmarks/operation/buffer/IteratedBufferStressTest.cpp
Обычный файл
90
benchmarks/operation/buffer/IteratedBufferStressTest.cpp
Обычный файл
@ -0,0 +1,90 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: perf/operation/buffer/IteratedBufferStressTest.java rev 1.1
|
||||
*
|
||||
* - Added exit condition when number of vertices is zero
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#include <geos/geom/PrecisionModel.h>
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/io/WKTReader.h>
|
||||
#include <geos/geom/Geometry.h>
|
||||
#include <geos/profiler.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace geos::geom;
|
||||
using namespace geos::io;
|
||||
using namespace std;
|
||||
|
||||
typedef unique_ptr<Geometry> GeomPtr;
|
||||
|
||||
GeomPtr
|
||||
doBuffer(const Geometry& g, double dist)
|
||||
{
|
||||
cout << "Buffering with dist = " << dist << endl;
|
||||
GeomPtr buf(g.buffer(dist));
|
||||
cout << "Buffer result has " << buf->getNumPoints() << " vertices" << endl;
|
||||
|
||||
//cout << *buf << endl;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
// throws Exception
|
||||
void
|
||||
run(const Geometry* base)
|
||||
{
|
||||
GeomPtr tmp;
|
||||
|
||||
// profile here
|
||||
geos::util::Profile totalSW("buffer");
|
||||
double dist = 1.0;
|
||||
while(true) {
|
||||
|
||||
totalSW.start();
|
||||
|
||||
GeomPtr b1 = doBuffer(*base, dist);
|
||||
GeomPtr b2 = doBuffer(*b1, -dist);
|
||||
|
||||
totalSW.stop();
|
||||
cout << "---------------------- "
|
||||
<< totalSW << endl; // totalSW.getTimeString() << endl;
|
||||
|
||||
dist += 1;
|
||||
base = b2.get();
|
||||
tmp = std::move(b2); // move as anti-optimisation?
|
||||
|
||||
if(! base->getNumPoints()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
PrecisionModel pm;
|
||||
GeometryFactory::Ptr gf = GeometryFactory::create(&pm);
|
||||
WKTReader rdr(gf.get());
|
||||
|
||||
string inputWKT =
|
||||
"POLYGON ((110 320, 190 220, 60 200, 180 120, 120 40, 290 150, 410 40, 410 230, 500 340, 320 310, 260 370, 220 310, 110 320), (220 260, 250 180, 290 220, 360 150, 350 250, 260 280, 220 260))";
|
||||
|
||||
GeomPtr base(rdr.read(inputWKT));
|
||||
run(base.get());
|
||||
}
|
||||
|
17
benchmarks/operation/buffer/Makefile.am
Обычный файл
17
benchmarks/operation/buffer/Makefile.am
Обычный файл
@ -0,0 +1,17 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
prefix=@prefix@
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=@top_builddir@
|
||||
|
||||
noinst_PROGRAMS = IteratedBufferStressTest
|
||||
|
||||
LIBS = $(top_builddir)/src/libgeos.la
|
||||
|
||||
IteratedBufferStressTest_SOURCES = IteratedBufferStressTest.cpp
|
||||
IteratedBufferStressTest_LDADD = $(LIBS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
12
benchmarks/operation/predicate/CMakeLists.txt
Обычный файл
12
benchmarks/operation/predicate/CMakeLists.txt
Обычный файл
@ -0,0 +1,12 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
add_executable(perf_rectangle_intersects RectangleIntersectsPerfTest.cpp)
|
||||
target_link_libraries(perf_rectangle_intersects PRIVATE geos)
|
17
benchmarks/operation/predicate/Makefile.am
Обычный файл
17
benchmarks/operation/predicate/Makefile.am
Обычный файл
@ -0,0 +1,17 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
prefix=@prefix@
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=@top_builddir@
|
||||
|
||||
noinst_PROGRAMS = RectangleIntersectsPerfTest
|
||||
|
||||
LIBS = $(top_builddir)/src/libgeos.la
|
||||
|
||||
RectangleIntersectsPerfTest_SOURCES = RectangleIntersectsPerfTest.cpp
|
||||
RectangleIntersectsPerfTest_LDADD = $(LIBS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
164
benchmarks/operation/predicate/RectangleIntersectsPerfTest.cpp
Обычный файл
164
benchmarks/operation/predicate/RectangleIntersectsPerfTest.cpp
Обычный файл
@ -0,0 +1,164 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: perf/operation/predicate/RectangleIntersectsPerfTest.java r378 (JTS-1.12)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#include <geos/geom/PrecisionModel.h>
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
#include <geos/util/GeometricShapeFactory.h>
|
||||
#include <geos/precision/SimpleGeometryPrecisionReducer.h>
|
||||
#include <geos/geom/util/SineStarFactory.h>
|
||||
#include <geos/geom/Geometry.h>
|
||||
#include <geos/geom/Polygon.h>
|
||||
#include <geos/profiler.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
|
||||
using namespace geos::geom;
|
||||
using namespace geos::io;
|
||||
using namespace std;
|
||||
|
||||
class RectangleIntersectsPerfTest {
|
||||
public:
|
||||
RectangleIntersectsPerfTest()
|
||||
:
|
||||
pm(),
|
||||
fact(GeometryFactory::create(&pm, 0))
|
||||
{}
|
||||
|
||||
void
|
||||
test(int nPts)
|
||||
{
|
||||
double size = 100;
|
||||
Coordinate origin(0, 0);
|
||||
Geometry::Ptr sinePoly(
|
||||
createSineStar(origin, size, nPts)->getBoundary()
|
||||
);
|
||||
|
||||
/**
|
||||
* Make the geometry "crinkly" by rounding off the points.
|
||||
* This defeats the MonotoneChain optimization in the full relate
|
||||
* algorithm, and provides a more realistic test.
|
||||
*/
|
||||
using geos::precision::SimpleGeometryPrecisionReducer;
|
||||
PrecisionModel p_pm(size / 10);
|
||||
SimpleGeometryPrecisionReducer reducer(&p_pm);
|
||||
Geometry::Ptr sinePolyCrinkly(reducer.reduce(sinePoly.get()));
|
||||
sinePoly.reset();
|
||||
|
||||
Geometry& target = *sinePolyCrinkly;
|
||||
|
||||
testRectangles(target, 30, 5);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
static const int MAX_ITER = 10;
|
||||
|
||||
static const int NUM_AOI_PTS = 2000;
|
||||
static const int NUM_LINES = 5000;
|
||||
static const int NUM_LINE_PTS = 1000;
|
||||
|
||||
PrecisionModel pm;
|
||||
GeometryFactory::Ptr fact;
|
||||
|
||||
void
|
||||
testRectangles(const Geometry& target, int nRect, double rectSize)
|
||||
{
|
||||
vector<const Geometry*> rects;
|
||||
createRectangles(*target.getEnvelopeInternal(), nRect, rectSize, rects);
|
||||
test(rects, target);
|
||||
for(vector<const Geometry*>::iterator i = rects.begin(), n = rects.end();
|
||||
i != n; ++i) {
|
||||
delete *i;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test(vector<const Geometry*>& rect, const Geometry& g)
|
||||
{
|
||||
typedef vector<const Geometry*>::size_type size_type;
|
||||
|
||||
geos::util::Profile sw("");
|
||||
sw.start();
|
||||
|
||||
for(int i = 0; i < MAX_ITER; i++) {
|
||||
for(size_type j = 0; j < rect.size(); j++) {
|
||||
rect[j]->intersects(&g);
|
||||
}
|
||||
}
|
||||
|
||||
sw.stop();
|
||||
cout << g.getNumPoints() << " points: " << sw.getTot() << " usecs" << endl;
|
||||
|
||||
}
|
||||
|
||||
// Push newly created geoms to rectLit
|
||||
void
|
||||
createRectangles(const Envelope& env, int nRect, double,
|
||||
vector<const Geometry*>& rectList)
|
||||
{
|
||||
int nSide = 1 + (int)sqrt((double) nRect);
|
||||
double dx = env.getWidth() / nSide;
|
||||
double dy = env.getHeight() / nSide;
|
||||
|
||||
for(int i = 0; i < nSide; i++) {
|
||||
for(int j = 0; j < nSide; j++) {
|
||||
double baseX = env.getMinX() + i * dx;
|
||||
double baseY = env.getMinY() + j * dy;
|
||||
Envelope envRect(
|
||||
baseX, baseX + dx,
|
||||
baseY, baseY + dy);
|
||||
Geometry* rect = fact->toGeometry(&envRect).release();
|
||||
rectList.push_back(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Polygon::Ptr
|
||||
createSineStar(const Coordinate& origin,
|
||||
double size, int nPts)
|
||||
{
|
||||
using geos::geom::util::SineStarFactory;
|
||||
|
||||
SineStarFactory gsf(fact.get());
|
||||
gsf.setCentre(origin);
|
||||
gsf.setSize(size);
|
||||
gsf.setNumPoints(nPts);
|
||||
gsf.setArmLengthRatio(2);
|
||||
gsf.setNumArms(20);
|
||||
Polygon::Ptr poly = gsf.createSineStar();
|
||||
return poly;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
|
||||
RectangleIntersectsPerfTest tester;
|
||||
|
||||
tester.test(500);
|
||||
tester.test(100000);
|
||||
}
|
||||
|
36
capi/CMakeLists.txt
Обычный файл
36
capi/CMakeLists.txt
Обычный файл
@ -0,0 +1,36 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
|
||||
file(GLOB_RECURSE _headers ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
|
||||
target_sources(geos_c PRIVATE ${_headers})
|
||||
unset(_headers)
|
||||
|
||||
target_include_directories(geos_c
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<INSTALL_INTERFACE:include/geos>)
|
||||
|
||||
# Copy these over so they match the @VARIABLES@ used by autoconf
|
||||
# in geos_c.h.in
|
||||
set(VERSION ${GEOS_VERSION})
|
||||
set(VERSION_MAJOR ${GEOS_VERSION_MAJOR})
|
||||
set(VERSION_MINOR ${GEOS_VERSION_MINOR})
|
||||
set(VERSION_PATCH ${GEOS_VERSION_PATCH})
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/geos_c.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
|
||||
@ONLY)
|
||||
|
||||
unset(VERSION)
|
||||
unset(VERSION_MAJOR)
|
||||
unset(VERSION_MINOR)
|
||||
unset(VERSION_PATCH)
|
33
capi/Makefile.am
Обычный файл
33
capi/Makefile.am
Обычный файл
@ -0,0 +1,33 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
prefix=@prefix@
|
||||
top_srcdir=@top_srcdir@
|
||||
GEOS_CAPI_VERSION="@VERSION@-CAPI-@CAPI_VERSION@"
|
||||
GEOS_JTS_PORT="@JTS_PORT@"
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
capidir = $(includedir)
|
||||
|
||||
nodist_capi_HEADERS = \
|
||||
geos_c.h
|
||||
|
||||
lib_LTLIBRARIES = libgeos_c.la
|
||||
|
||||
DIR_SOURCES = \
|
||||
geos_c.cpp \
|
||||
geos_ts_c.cpp \
|
||||
$(NULL)
|
||||
|
||||
libgeos_c_la_SOURCES = $(DIR_SOURCES)
|
||||
libgeos_c_la_CPPFLAGS = $(AM_CPPFLAGS) -DGEOS_CAPI_VERSION='$(GEOS_CAPI_VERSION)' -DGEOS_JTS_PORT='$(GEOS_JTS_PORT)'
|
||||
libgeos_c_la_LIBADD = $(top_builddir)/src/libgeos.la
|
||||
libgeos_c_la_LDFLAGS = \
|
||||
-version-info @CAPI_INTERFACE_CURRENT@:@CAPI_INTERFACE_REVISION@:@CAPI_INTERFACE_AGE@ \
|
||||
-no-undefined
|
||||
|
||||
dist-local:
|
||||
cp -p $(DIST_SOURCES) Makefile.am Makefile.in $(distdir)
|
||||
|
||||
EXTRA_DIST = geos_c.h CMakeLists.txt
|
1476
capi/geos_c.cpp
Обычный файл
1476
capi/geos_c.cpp
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
2194
capi/geos_c.h.in
Обычный файл
2194
capi/geos_c.h.in
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
6812
capi/geos_ts_c.cpp
Обычный файл
6812
capi/geos_ts_c.cpp
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
61
cmake/FindMakeDistCheck.cmake
Обычный файл
61
cmake/FindMakeDistCheck.cmake
Обычный файл
@ -0,0 +1,61 @@
|
||||
# Inspired by CMake Distcheck for LAAS-CNRS
|
||||
#
|
||||
# DEFINE_DISTCHECK
|
||||
# ---------------
|
||||
#
|
||||
# Add a distcheck target to check the generated tarball.
|
||||
#
|
||||
# This step calls `make dist' to generate a copy of the sources as it
|
||||
# stands in the current git HEAD i.e., unversioned files are skipped.
|
||||
#
|
||||
# Then:
|
||||
# - create _build and _inst to respectively create a build
|
||||
# and an installation directory.
|
||||
# - run cmake with _inst as the installation prefix
|
||||
# - run make, make check, make install and make uninstall
|
||||
# - remove _build and _inst.
|
||||
# - remove dist directory and confirm success.
|
||||
#
|
||||
# During the compilation phase, all files in the source tree are modified
|
||||
# to *not* be writeable to detect bad compilation steps which tries to modify
|
||||
# the source tree. Permissions are reverted at the end of the check.
|
||||
#
|
||||
macro(AddMakeDistCheck)
|
||||
find_program(_tar tar)
|
||||
find_program(_bzip2 bzip2)
|
||||
string(TOLOWER "${CPACK_SOURCE_PACKAGE_FILE_NAME}" _distbasename)
|
||||
set(_distname "${_distbasename}.tar.bz2")
|
||||
set(_builddir "${CMAKE_BINARY_DIR}/${_distbasename}/_build")
|
||||
set(_instdir "${CMAKE_BINARY_DIR}/${_distbasename}/_inst")
|
||||
# message(STATUS "GEOS: _distbasename: ${_distbasename}")
|
||||
# message(STATUS "GEOS: _distname: ${_distname}")
|
||||
# message(STATUS "GEOS: _builddir: ${_builddir}")
|
||||
# message(STATUS "GEOS: _instdir: ${_instdir}")
|
||||
|
||||
add_custom_target(distcheck
|
||||
COMMAND rm -rf "${_distbasename}"
|
||||
&& \(${_bzip2} -d -c "${_distname}" | ${_tar} xf -\)
|
||||
&& mkdir -vp "${_builddir}"
|
||||
&& mkdir -vp "${_instdir}"
|
||||
&& cd "${_builddir}"
|
||||
&& ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH="${_instdir}" ..
|
||||
|| \(echo "ERROR: the cmake configuration failed." && false\)
|
||||
&& make
|
||||
|| \(echo "ERROR: the compilation failed." && false\)
|
||||
&& make test
|
||||
|| \(echo "ERROR: the test suite failed." && false\)
|
||||
&& make install
|
||||
|| \(echo "ERROR: the install target failed." && false\)
|
||||
&& make uninstall
|
||||
|| \(echo "ERROR: the uninstall target failed." && false\)
|
||||
&& make clean
|
||||
|| \(echo "ERROR: the clean target failed." && false\)
|
||||
&& cd ../..
|
||||
&& rm -rf "${_distbasename}"
|
||||
&& echo "=============================================================="
|
||||
&& echo "${_distname} is ready for distribution."
|
||||
&& echo "=============================================================="
|
||||
)
|
||||
|
||||
add_dependencies(distcheck dist)
|
||||
endmacro()
|
48
cmake/cmake_uninstall.cmake.in
Обычный файл
48
cmake/cmake_uninstall.cmake.in
Обычный файл
@ -0,0 +1,48 @@
|
||||
#################################################################################
|
||||
#
|
||||
# This file is a part of CMake build configuration of GEOS library
|
||||
#
|
||||
# Defines commands used by make uninstall target of CMake build configuration.
|
||||
#
|
||||
# Author: Credit to the CMake mailing list archives for providing this solution.
|
||||
# Modifications: Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
#################################################################################
|
||||
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR
|
||||
"Cannot find install manifest:
|
||||
@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
endif()
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
|
||||
set(GEOS_INCLUDE_DIR)
|
||||
foreach(file ${files})
|
||||
|
||||
if(${file} MATCHES "geom.h")
|
||||
get_filename_component(GEOS_INCLUDE_DIR ${file} PATH)
|
||||
endif()
|
||||
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(NOT EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
message(STATUS "\tTrying to execute remove command anyway.")
|
||||
endif()
|
||||
|
||||
exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message(STATUS "Deleting ${GEOS_INCLUDE_DIR} directory")
|
||||
exec_program("@CMAKE_COMMAND@"
|
||||
ARGS "-E remove_directory \"${GEOS_INCLUDE_DIR}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"${GEOS_INCLUDE_DIR}\"")
|
||||
endif()
|
11
cmake/geos-config.cmake
Обычный файл
11
cmake/geos-config.cmake
Обычный файл
@ -0,0 +1,11 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/geos-targets.cmake")
|
520
configure.ac
Обычный файл
520
configure.ac
Обычный файл
@ -0,0 +1,520 @@
|
||||
dnl
|
||||
dnl configure.in - autoconf input template to produce ./configure script
|
||||
dnl
|
||||
dnl version 2.52 is required for Cygwin libtool support
|
||||
AC_PREREQ([2.63])
|
||||
|
||||
dnl local vars to hold user's preferences --------------------------------
|
||||
AC_INIT([include/geos.h])
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AC_CONFIG_MACRO_DIR([macros])
|
||||
|
||||
dnl
|
||||
dnl -- Release versions / C++ library SONAME will use these
|
||||
dnl -- encoding ABI break at every release
|
||||
dnl
|
||||
VERTXT=${srcdir}/Version.txt
|
||||
VERSION_MAJOR=`cat $VERTXT | awk -F= '/^GEOS_VERSION_MAJOR/ {print $2}'`
|
||||
VERSION_MINOR=`cat $VERTXT | awk -F= '/^GEOS_VERSION_MINOR/ {print $2}'`
|
||||
VERSION_PATCH=`cat $VERTXT | awk -F= '/^GEOS_VERSION_PATCH/ {print $2}'`
|
||||
PATCH_WORD=`cat $VERTXT | awk -F= '/^GEOS_PATCH_WORD/ {print $2}'`
|
||||
|
||||
VERSION_PATCH=${VERSION_PATCH}${PATCH_WORD}
|
||||
VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
|
||||
VERSION_RELEASE=`echo "$VERSION" | sed -E 's/^([[0-9]+\.[0-9]+\.[0-9]+]).*$/\1/'`
|
||||
|
||||
AC_MSG_CHECKING([for GEOS version])
|
||||
AC_MSG_RESULT(["$VERSION"])
|
||||
|
||||
CAPI_INTERFACE_CURRENT=`cat $VERTXT | awk -F= '/^CAPI_INTERFACE_CURRENT/ {print $2}'`
|
||||
CAPI_INTERFACE_REVISION=`cat $VERTXT | awk -F= '/^CAPI_INTERFACE_REVISION/ {print $2}'`
|
||||
CAPI_INTERFACE_AGE=`cat $VERTXT | awk -F= '/^CAPI_INTERFACE_AGE/ {print $2}'`
|
||||
|
||||
dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE))
|
||||
dnl the following should be more portable
|
||||
CAPI_VERSION_MAJOR=`expr $CAPI_INTERFACE_CURRENT - $CAPI_INTERFACE_AGE`
|
||||
CAPI_VERSION_MINOR=$CAPI_INTERFACE_AGE
|
||||
CAPI_VERSION_PATCH=$CAPI_INTERFACE_REVISION
|
||||
CAPI_VERSION="$CAPI_VERSION_MAJOR.$CAPI_VERSION_MINOR.$CAPI_VERSION_PATCH"
|
||||
|
||||
AC_MSG_CHECKING([for GEOS CAPI version])
|
||||
AC_MSG_RESULT(["$CAPI_VERSION"])
|
||||
|
||||
AM_INIT_AUTOMAKE([geos], [$VERSION], [no-define])
|
||||
AM_MAINTAINER_MODE
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
|
||||
AC_CONFIG_HEADERS([include/config.h])
|
||||
AC_PROG_CC
|
||||
|
||||
AC_CONFIG_LINKS([tools/astyle.sh:tools/astyle.sh])
|
||||
|
||||
dnl -- JTS_PORT: the version of JTS this release is bound to
|
||||
dnl JTS_PORT=1.13.0
|
||||
JTS_PORT=`cat $VERTXT | awk -F= '/^JTS_PORT/ {print $2}'`
|
||||
|
||||
DOXYGEN_LOGFILE=
|
||||
AC_SUBST(DOXYGEN_LOGFILE)
|
||||
|
||||
dnl Hush warnings
|
||||
AC_DEFINE(USE_UNSTABLE_GEOS_CPP_API, [1], [We know])
|
||||
|
||||
dnl use libtool ----------------------------------------------------------
|
||||
AC_LIBTOOL_DLOPEN
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
dnl check for programs ----------------------------------------------------
|
||||
AC_PROG_CXX
|
||||
AC_ISC_POSIX
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl function checks ------------------------------------------------------
|
||||
AC_FUNC_CLOSEDIR_VOID
|
||||
AC_FUNC_MEMCMP
|
||||
AC_FUNC_STRFTIME
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_ALLOCA
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([memory.h])
|
||||
AC_CHECK_HEADERS([unistd.h])
|
||||
AC_CHECK_HEADERS([ieeefp.h])
|
||||
AC_CHECK_HEADERS([sys/file.h])
|
||||
AC_CHECK_HEADERS([sys/time.h])
|
||||
AC_CHECK_FUNCS([strchr memcpy gettimeofday])
|
||||
AC_HEADER_STAT
|
||||
AC_STRUCT_TM
|
||||
AC_TYPE_SIZE_T
|
||||
AC_C_CONST
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - Check for inline and cassert settings
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
|
||||
AC_ARG_ENABLE([inline], [ --disable-inline Disable inlining],
|
||||
[case "${enableval}" in
|
||||
yes) enable_inline=true ;;
|
||||
no) enable_inline=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-inline);;
|
||||
esac],
|
||||
[enable_inline=true]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE([cassert], [ --disable-cassert Disable assertion checking],
|
||||
[case "${enableval}" in
|
||||
yes) enable_cassert=true ;;
|
||||
no) enable_cassert=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-cassert);;
|
||||
esac],
|
||||
[enable_cassert=true]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE([glibcxx-debug], [ --enable-glibcxx-debug Enable libstdc++ debug mode],
|
||||
[case "${enableval}" in
|
||||
yes) enable_glibcxx_debug=true ;;
|
||||
no) enable_glibcxx_debug=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-glibcxx-debug);;
|
||||
esac],
|
||||
[enable_glibcxx_debug=false]
|
||||
)
|
||||
|
||||
|
||||
AC_MSG_CHECKING([if requested to force inline functions])
|
||||
INLINE_FLAGS=
|
||||
AC_SUBST(INLINE_FLAGS)
|
||||
if test x"$enable_inline" = xtrue; then
|
||||
INLINE_FLAGS="-DGEOS_INLINE"
|
||||
AM_CXXFLAGS="$AM_CXXFLAGS $INLINE_FLAGS"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if requested to enable assert macros])
|
||||
if test x"$enable_cassert" = xfalse; then
|
||||
AM_CXXFLAGS="$AM_CXXFLAGS -DNDEBUG"
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if requested libstdc++ debug mode])
|
||||
if test x"$enable_glibcxx_debug" = xtrue; then
|
||||
AM_CXXFLAGS="$AM_CXXFLAGS -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
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
|
||||
dnl require AC_LIBTOOL_LANG_CXX_CONFIG in *addition*
|
||||
dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP()
|
||||
dnl
|
||||
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
|
||||
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 -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"], [])
|
||||
|
||||
HUSHWARNING="-DUSE_UNSTABLE_GEOS_CPP_API"
|
||||
DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS} ${HUSHWARNING}"
|
||||
|
||||
AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
|
||||
AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
|
||||
AC_SUBST(AM_CXXFLAGS)
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - Look for finite and/or isfinite macros/functions
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
dnl These two tests need the math library or they won't link
|
||||
dnl on OpenBSD, even if the functions exist.
|
||||
save_LIBS=$LIBS
|
||||
LIBS="$LIBS -lm"
|
||||
AC_CACHE_CHECK([for finite], ac_cv_finite,
|
||||
[AC_TRY_LINK([#include <math.h>],
|
||||
[double x; int y; y = finite(x);],
|
||||
ac_cv_finite=yes,
|
||||
ac_cv_finite=no
|
||||
)])
|
||||
if test x"$ac_cv_finite" = x"yes"; then
|
||||
AC_DEFINE(HAVE_FINITE, [1], [Has finite])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
|
||||
[AC_TRY_LINK([#include <math.h>],
|
||||
[double x; int y; y = isfinite(x);],
|
||||
ac_cv_isfinite=yes,
|
||||
ac_cv_isfinite=no
|
||||
)])
|
||||
if test x"$ac_cv_isfinite" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
|
||||
fi
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Test for presence of isnan function when using C++ and <cmath>
|
||||
dnl This is for a particular bug in OS/X where <cmath> drops the definition
|
||||
dnl of isnan().
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_CACHE_CHECK([for isnan], ac_cv_isnan,
|
||||
[AC_TRY_LINK([#include <cmath>],
|
||||
[double x; int y; y = std::isnan(x);],
|
||||
ac_cv_isnan=yes,
|
||||
ac_cv_isnan=no
|
||||
)])
|
||||
if test x"$ac_cv_isnan" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
|
||||
fi
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
LIBS=$save_LIBS
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - Look for a 64bit integer (do after CFLAGS is set)
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
dnl Find a working 64bit integer
|
||||
PGAC_TYPE_64BIT_INT([int64_t])
|
||||
if test x"$HAVE_INT64_T_64" = x"no" ; then
|
||||
PGAC_TYPE_64BIT_INT([long long int])
|
||||
if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then
|
||||
PGAC_TYPE_64BIT_INT([long int])
|
||||
if test x"$HAVE_LONG_INT_64" = x"no" ; then
|
||||
AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]);
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - check whether python is required for the build
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([python], [ --enable-python Enable build of python module],
|
||||
[case "${enableval}" in
|
||||
yes) use_python=true ;;
|
||||
no) use_python=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
|
||||
esac],
|
||||
[use_python=false]
|
||||
)
|
||||
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - check whether ruby is required for the build
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([ruby], [ --enable-ruby Enable build of ruby module],
|
||||
[case "${enableval}" in
|
||||
yes) use_ruby=true ;;
|
||||
no) use_ruby=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
|
||||
esac],
|
||||
[use_ruby=false]
|
||||
)
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - check for swig if python or ruby are enabled
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
use_swig=false
|
||||
if test x"$use_python" = xtrue ||
|
||||
test x"$use_ruby" = xtrue; then
|
||||
AC_PROG_SWIG(1.3.28)
|
||||
if test x"$SWIG" != "x"; then
|
||||
SWIG_ENABLE_CXX
|
||||
AC_SUBST(SWIG)
|
||||
use_swig=true
|
||||
else
|
||||
use_python=false
|
||||
use_ruby=false
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
|
||||
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - check for python if enabled
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
if test x"$use_python" = xtrue; then
|
||||
dnl Check for Python
|
||||
AM_PATH_PYTHON
|
||||
SWIG_PYTHON
|
||||
|
||||
if test x"$PYTHON" = "x"; then
|
||||
use_python=false
|
||||
fi
|
||||
|
||||
AC_SUBST(PYTHON)
|
||||
AC_SUBST(SWIG_PYTHON_CPPFLAGS)
|
||||
AC_SUBST(SWIG_PYTHON_OPT)
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
|
||||
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - check for ruby if enabled
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
if test x"$use_ruby" = xtrue; then
|
||||
dnl Check for Ruby
|
||||
AC_RUBY_DEVEL
|
||||
|
||||
if test x"$RUBY" = x; then
|
||||
use_ruby=false
|
||||
fi
|
||||
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ])
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - do operating-system specific things
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING([OS-specific settings])
|
||||
|
||||
case "${host_os}" in
|
||||
*darwin*)
|
||||
AC_MSG_RESULT([${host_os}])
|
||||
AC_MSG_CHECKING([for OS/X version])
|
||||
kernel=`uname -r`
|
||||
|
||||
# "Darwin 9.6.0" is Mac OSX 10.5.6
|
||||
# "Darwin 10.x" would presumably be Mac OS X 10.6.x
|
||||
case "${kernel}" in
|
||||
8.*)
|
||||
AC_MSG_RESULT([Mac OS X 10.4 Tiger])
|
||||
;;
|
||||
9.*)
|
||||
AC_MSG_RESULT([Mac OS X 10.5 Leopard])
|
||||
;;
|
||||
10.*)
|
||||
dnl AM_CXXFLAGS="$AM_CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual"
|
||||
AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)])
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl - check for boost
|
||||
dnl --------------------------------------------------------------------
|
||||
|
||||
dnl -- AX_BOOST(1.32)
|
||||
dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
|
||||
dnl -- use_boost_utf=yes
|
||||
dnl -- else
|
||||
dnl -- use_boost_utf=no
|
||||
dnl -- fi
|
||||
dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"])
|
||||
|
||||
dnl things to substitute in output ----------------------------------------
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(VERSION_MAJOR)
|
||||
AC_SUBST(VERSION_MINOR)
|
||||
AC_SUBST(VERSION_PATCH)
|
||||
AC_SUBST(VERSION_RELEASE)
|
||||
AC_SUBST(JTS_PORT)
|
||||
AC_SUBST(CAPI_VERSION)
|
||||
AC_SUBST(CAPI_VERSION_MAJOR)
|
||||
AC_SUBST(CAPI_VERSION_MINOR)
|
||||
AC_SUBST(CAPI_VERSION_PATCH)
|
||||
AC_SUBST(CAPI_INTERFACE_CURRENT)
|
||||
AC_SUBST(CAPI_INTERFACE_REVISION)
|
||||
AC_SUBST(CAPI_INTERFACE_AGE)
|
||||
|
||||
dnl output stuff ----------------------------------------------------------
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
capi/Makefile
|
||||
capi/geos_c.h
|
||||
doc/Doxyfile
|
||||
doc/Makefile
|
||||
macros/Makefile
|
||||
src/Makefile
|
||||
src/algorithm/Makefile
|
||||
src/algorithm/locate/Makefile
|
||||
src/algorithm/distance/Makefile
|
||||
src/geom/Makefile
|
||||
src/geom/prep/Makefile
|
||||
src/geom/util/Makefile
|
||||
src/geomgraph/Makefile
|
||||
src/geomgraph/index/Makefile
|
||||
include/Makefile
|
||||
include/geos/Makefile
|
||||
include/geos/algorithm/Makefile
|
||||
include/geos/algorithm/locate/Makefile
|
||||
include/geos/algorithm/distance/Makefile
|
||||
include/geos/algorithm/ttmath/Makefile
|
||||
include/geos/geom/Makefile
|
||||
include/geos/geom/prep/Makefile
|
||||
include/geos/geom/util/Makefile
|
||||
include/geos/geomgraph/Makefile
|
||||
include/geos/geomgraph/index/Makefile
|
||||
include/geos/index/Makefile
|
||||
include/geos/index/bintree/Makefile
|
||||
include/geos/index/chain/Makefile
|
||||
include/geos/index/intervalrtree/Makefile
|
||||
include/geos/index/quadtree/Makefile
|
||||
include/geos/index/strtree/Makefile
|
||||
include/geos/index/sweepline/Makefile
|
||||
include/geos/io/Makefile
|
||||
include/geos/linearref/Makefile
|
||||
include/geos/noding/Makefile
|
||||
include/geos/noding/snapround/Makefile
|
||||
include/geos/operation/Makefile
|
||||
include/geos/operation/buffer/Makefile
|
||||
include/geos/operation/distance/Makefile
|
||||
include/geos/operation/intersection/Makefile
|
||||
include/geos/operation/linemerge/Makefile
|
||||
include/geos/operation/overlay/Makefile
|
||||
include/geos/operation/overlay/snap/Makefile
|
||||
include/geos/operation/polygonize/Makefile
|
||||
include/geos/operation/predicate/Makefile
|
||||
include/geos/operation/relate/Makefile
|
||||
include/geos/operation/sharedpaths/Makefile
|
||||
include/geos/operation/union/Makefile
|
||||
include/geos/operation/valid/Makefile
|
||||
include/geos/planargraph/Makefile
|
||||
include/geos/planargraph/algorithm/Makefile
|
||||
include/geos/precision/Makefile
|
||||
include/geos/simplify/Makefile
|
||||
include/geos/triangulate/Makefile
|
||||
include/geos/triangulate/quadedge/Makefile
|
||||
include/geos/util/Makefile
|
||||
include/geos/version.h
|
||||
src/index/Makefile
|
||||
src/index/bintree/Makefile
|
||||
src/index/chain/Makefile
|
||||
src/index/intervalrtree/Makefile
|
||||
src/index/quadtree/Makefile
|
||||
src/index/strtree/Makefile
|
||||
src/index/sweepline/Makefile
|
||||
src/io/Makefile
|
||||
src/linearref/Makefile
|
||||
src/noding/Makefile
|
||||
src/noding/snapround/Makefile
|
||||
src/operation/Makefile
|
||||
src/operation/buffer/Makefile
|
||||
src/operation/distance/Makefile
|
||||
src/operation/intersection/Makefile
|
||||
src/operation/linemerge/Makefile
|
||||
src/operation/overlay/Makefile
|
||||
src/operation/polygonize/Makefile
|
||||
src/operation/predicate/Makefile
|
||||
src/operation/relate/Makefile
|
||||
src/operation/sharedpaths/Makefile
|
||||
src/operation/union/Makefile
|
||||
src/operation/valid/Makefile
|
||||
src/planargraph/Makefile
|
||||
src/precision/Makefile
|
||||
src/simplify/Makefile
|
||||
src/triangulate/Makefile
|
||||
src/triangulate/quadedge/Makefile
|
||||
src/util/Makefile
|
||||
swig/geos.i
|
||||
swig/Makefile
|
||||
swig/python/Makefile
|
||||
swig/python/tests/Makefile
|
||||
swig/ruby/Makefile
|
||||
swig/ruby/test/Makefile
|
||||
tests/Makefile
|
||||
tests/bigtest/Makefile
|
||||
tests/unit/Makefile
|
||||
benchmarks/Makefile
|
||||
benchmarks/algorithm/Makefile
|
||||
benchmarks/operation/Makefile
|
||||
benchmarks/operation/buffer/Makefile
|
||||
benchmarks/operation/predicate/Makefile
|
||||
benchmarks/capi/Makefile
|
||||
tests/xmltester/Makefile
|
||||
tests/geostest/Makefile
|
||||
tests/thread/Makefile
|
||||
tools/Makefile
|
||||
tools/geos-config
|
||||
tools/astyle/Makefile
|
||||
])
|
||||
|
||||
dnl -- echo "---------------------------------------"
|
||||
dnl -- echo "Boost UTF: $use_boost_utf"
|
||||
echo "Swig: $use_swig"
|
||||
echo "Python bindings: $use_python"
|
||||
echo "Ruby bindings: $use_ruby"
|
||||
|
||||
dnl -- echo "---------------------------------------"
|
41
debian/README.Debian
поставляемый
Обычный файл
41
debian/README.Debian
поставляемый
Обычный файл
@ -0,0 +1,41 @@
|
||||
|
||||
hello all,
|
||||
|
||||
to make binary .deb packages, do the following:
|
||||
cd <the directory of this file>
|
||||
cd ..
|
||||
fakeroot debian/rules binary
|
||||
cd ..
|
||||
|
||||
here you have the .deb files.
|
||||
you may first check them for standards compliance: lintian *.deb
|
||||
root may install the packages to your system: dpkg -i *.deb
|
||||
|
||||
a few notes:
|
||||
|
||||
this package should work with any version of geos (provided geos is been made
|
||||
in the same way), and debian (made on sarge, but tested to work under woody
|
||||
without change. package versioning is been done automatically from geos.
|
||||
|
||||
this debian package has been made under sarge, and then backported to Woody.
|
||||
to avoid duplication, woody shortcomings have been bypassed only:
|
||||
|
||||
dh_install was not working for woody with wildcards, so i have added
|
||||
dh_movefiles, which works on definition files in the format used later by
|
||||
dh_install. hence the symlinks pkg.files (for dh_movefiles) -> pkg.install
|
||||
(for dh_install).
|
||||
|
||||
the woody binaries are bigger then those on sarge, due to lesser stripping
|
||||
options in woody dh_strip.
|
||||
|
||||
under woody, doxygen is creating less html documentation files. if problematic,
|
||||
woody users may use a libgeos-doc package made for any other architecture and
|
||||
linux version.
|
||||
|
||||
during my first tests on woody, dh_shlibdeps has sometimes failed, but this
|
||||
phenomenum has diisappeared before i had a chance to further investigate. this
|
||||
might be due to woody upgrade.
|
||||
|
||||
please enjoy,
|
||||
|
||||
alex
|
12
debian/changelog
поставляемый
Обычный файл
12
debian/changelog
поставляемый
Обычный файл
@ -0,0 +1,12 @@
|
||||
geos (2.1.0-1) unstable; urgency=low
|
||||
|
||||
* Debian Package rebuild.
|
||||
|
||||
-- Alex Bodnaru <alexbodn@012.net.il> Sat, 27 Nov 2004 04:03:01 +0200
|
||||
|
||||
geos (2.0.1-1) unstable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- Alex Bodnaru <alexbodn@012.net.il> Mon, 8 Nov 2004 06:47:01 +0200
|
||||
|
1
debian/compat
поставляемый
Обычный файл
1
debian/compat
поставляемый
Обычный файл
@ -0,0 +1 @@
|
||||
4
|
51
debian/control
поставляемый
Обычный файл
51
debian/control
поставляемый
Обычный файл
@ -0,0 +1,51 @@
|
||||
Source: geos
|
||||
Section: science
|
||||
Priority: optional
|
||||
Maintainer: Alex Bodnaru <alexbodn@012.net.il>
|
||||
Build-Depends: debhelper (>= 4.0.0), c++-compiler, doxygen, autoconf2.13, autotools-dev
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: libgeos-dev
|
||||
Section: science
|
||||
Priority: optional
|
||||
Architecture: any
|
||||
Depends: libgeos (= ${Source-Version})
|
||||
Recommends: libgeos-doc (= ${Source-Version})
|
||||
Description: GEOS (Geometry Engine - Open Source) development files
|
||||
GEOS (Geometry Engine - Open Source) is a C++ port of the
|
||||
Java Topology Suite (JTS). As such, it aims to contain the
|
||||
complete functionality of JTS in C++. This includes all
|
||||
the OpenGIS "Simple Features for SQL" spatial predicate
|
||||
functions and spatial operators, as well as specific JTS
|
||||
topology functions such as IsValid().
|
||||
.
|
||||
This package contains the files required to compile and
|
||||
link a program with GEOS.
|
||||
|
||||
Package: libgeos
|
||||
Section: science
|
||||
Priority: optional
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Description: GEOS (Geometry Engine - Open Source) library
|
||||
GEOS (Geometry Engine - Open Source) is a C++ port of the
|
||||
Java Topology Suite (JTS). As such, it aims to contain the
|
||||
complete functionality of JTS in C++. This includes all
|
||||
the OpenGIS "Simple Features for SQL" spatial predicate
|
||||
functions and spatial operators, as well as specific JTS
|
||||
topology functions such as IsValid().
|
||||
|
||||
Package: libgeos-doc
|
||||
Section: doc
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Description: GEOS (Geometry Engine - Open Source) documentation
|
||||
GEOS (Geometry Engine - Open Source) is a C++ port of the
|
||||
Java Topology Suite (JTS). As such, it aims to contain the
|
||||
complete functionality of JTS in C++. This includes all
|
||||
the OpenGIS "Simple Features for SQL" spatial predicate
|
||||
functions and spatial operators, as well as specific JTS
|
||||
topology functions such as IsValid().
|
||||
.
|
||||
This package contains a reference manual for the GEOS library
|
||||
claees.
|
28
debian/copyright
поставляемый
Обычный файл
28
debian/copyright
поставляемый
Обычный файл
@ -0,0 +1,28 @@
|
||||
This package was debianized by Alex Bodnaru <alexbodn@012.net.il> on
|
||||
Mon, 8 Nov 2004 06:47:01 +0200.
|
||||
|
||||
It was downloaded from http://geos.osgeo.org
|
||||
|
||||
Upstream Authors: See /usr/share/libgeos/AUTHORS
|
||||
|
||||
License: LGPL
|
||||
|
||||
Copyright:
|
||||
|
||||
This package is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This package 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this package; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
On Debian systems, the complete text of the GNU Lesser General
|
||||
Public License can be found in `/usr/share/common-licenses/LGPL'.
|
||||
|
63
debian/geos-config.1
поставляемый
Обычный файл
63
debian/geos-config.1
поставляемый
Обычный файл
@ -0,0 +1,63 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH GEOS 1 "November 8, 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.SH NAME
|
||||
geos-config - script to get information about the installed version of GEOS
|
||||
.SH SYNOPSIS
|
||||
.B geos-config
|
||||
[\-\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags] [\-\-includes] [\-\-jtsport]
|
||||
.br
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fIgeos-config\fP is a tool that is used to configure to determine
|
||||
the compiler and linker flags that should be used to compile
|
||||
and link programs that use \fIGEOS\fP. It is also used internally
|
||||
to the .m4 macros for GNU autoconf that are included with \fIGEOS\fP.
|
||||
.
|
||||
\fIGEOS (Geometry Engine - Open Source)\fP is a C++ port of the
|
||||
\fIJava Topology Suite (JTS)\fP. As such, it aims to contain the
|
||||
complete functionality of JTS in C++. This includes all the
|
||||
\fIOpenGIS "Simple Features for SQL"\fP spatial predicate functions
|
||||
and spatial operators, as well as specific JTS topology
|
||||
functions such as IsValid().
|
||||
.
|
||||
.SH OPTIONS
|
||||
These programs follow the usual GNU command line syntax, with long
|
||||
options starting with two dashes (`-').
|
||||
.l
|
||||
\fIgeos-config\fP accepts the following options:
|
||||
.TP 8
|
||||
.B \-\-version
|
||||
Print the currently installed version of \fIGEOS\fP on the standard output.
|
||||
.TP 8
|
||||
.B \-\-libs
|
||||
Print the linker flags that are necessary to link a \fIGEOS\fP program.
|
||||
.TP 8
|
||||
.B \-\-cflags
|
||||
Print the compiler flags that are necessary to compile a \fIGEOS\fP program.
|
||||
.TP 8
|
||||
.B \-\-prefix=PREFIX
|
||||
If specified, use PREFIX instead of the installation prefix that \fIGEOS\fP
|
||||
was built with when computing the output for the \-\-cflags and
|
||||
\-\-libs options. This option must be specified before any
|
||||
\-\-libs or \-\-cflags options.
|
||||
.TP 8
|
||||
.B \-\-jtsport
|
||||
Print the version of Java Topology Suite library, which is implemented
|
||||
by the current \fIGEOS\fP library.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR /usr/share/doc/libgeos-doc/html/index.html
|
||||
.br
|
||||
The installed \fIGEOS\fP library is fully documented in the GEOS documentation
|
||||
package, at
|
||||
.IR /usr/share/doc/libgeos-doc/html/index.html
|
||||
and the pages at the same location, viewable with a web browser.
|
||||
.
|
||||
For further information, see the \fIGEOS\fP home page, at
|
||||
http://geos.osgeo.org/.
|
||||
.SH AUTHOR
|
||||
See /usr/share/doc/libgeos/AUTHORS
|
||||
.PP
|
||||
This manual page was written by Alex Bodnaru <alexbodn@012.net.il>,
|
||||
for the Debian project (but may be used by others).
|
4
debian/libgeos-dev.dirs
поставляемый
Обычный файл
4
debian/libgeos-dev.dirs
поставляемый
Обычный файл
@ -0,0 +1,4 @@
|
||||
usr/bin
|
||||
usr/lib
|
||||
usr/include
|
||||
usr/include/geos
|
4
debian/libgeos-dev.docs
поставляемый
Обычный файл
4
debian/libgeos-dev.docs
поставляемый
Обычный файл
@ -0,0 +1,4 @@
|
||||
README
|
||||
NEWS
|
||||
TODO
|
||||
AUTHORS
|
6
debian/libgeos-dev.install
поставляемый
Обычный файл
6
debian/libgeos-dev.install
поставляемый
Обычный файл
@ -0,0 +1,6 @@
|
||||
usr/bin/*
|
||||
usr/include/*
|
||||
usr/lib/lib*.a
|
||||
usr/lib/lib*.so
|
||||
usr/lib/*.la
|
||||
usr/share/man/man1/*
|
1
debian/libgeos-dev.manpages
поставляемый
Обычный файл
1
debian/libgeos-dev.manpages
поставляемый
Обычный файл
@ -0,0 +1 @@
|
||||
debian/geos-config.1
|
10
debian/libgeos-doc.doc-base
поставляемый
Обычный файл
10
debian/libgeos-doc.doc-base
поставляемый
Обычный файл
@ -0,0 +1,10 @@
|
||||
Document: geos-reference-manual
|
||||
Title: GEOS Reference Manual
|
||||
Author: See /usr/share/doc/libgeos/AUTHORS
|
||||
Abstract: This manual provides the libgeos
|
||||
API reference.
|
||||
Section: science
|
||||
|
||||
Format: HTML
|
||||
Index: /usr/share/doc/libgeos-doc/html/index.html
|
||||
Files: /usr/share/doc/libgeos-doc/html/*.html
|
3
debian/libgeos-doc.docs
поставляемый
Обычный файл
3
debian/libgeos-doc.docs
поставляемый
Обычный файл
@ -0,0 +1,3 @@
|
||||
doc/doxygen_docs/html
|
||||
README
|
||||
AUTHORS
|
1
debian/libgeos.dirs
поставляемый
Обычный файл
1
debian/libgeos.dirs
поставляемый
Обычный файл
@ -0,0 +1 @@
|
||||
usr/lib
|
3
debian/libgeos.docs
поставляемый
Обычный файл
3
debian/libgeos.docs
поставляемый
Обычный файл
@ -0,0 +1,3 @@
|
||||
NEWS
|
||||
TODO
|
||||
AUTHORS
|
1
debian/libgeos.install
поставляемый
Обычный файл
1
debian/libgeos.install
поставляемый
Обычный файл
@ -0,0 +1 @@
|
||||
usr/lib/lib*.so.*
|
8
debian/makedoc
поставляемый
Исполняемый файл
8
debian/makedoc
поставляемый
Исполняемый файл
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd doc
|
||||
make doxygen-html
|
||||
cd doxygen_docs
|
||||
cd ../..
|
||||
mkdir -p debian/tmp/usr/share/man/man1
|
||||
cp debian/geos-config.1 debian/tmp/usr/share/man/man1
|
127
debian/rules
поставляемый
Исполняемый файл
127
debian/rules
поставляемый
Исполняемый файл
@ -0,0 +1,127 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
|
||||
# These are used for cross-compiling and for saving the configure script
|
||||
# from having to guess our platform (since we know it already)
|
||||
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
||||
INSTALL_PROGRAM += -s
|
||||
endif
|
||||
|
||||
# shared library versions
|
||||
version=`ls source/geom/.libs/lib*.so.* | \
|
||||
awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
|
||||
major=`ls source/geom/.libs/lib*.so.* | \
|
||||
awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
|
||||
|
||||
#ifeq "2" "$(major)"
|
||||
# POSTGIS_CONFLICT='-u-DConflicts="libpostgis (<< 0.9.0)"'
|
||||
# echo "ver 2"
|
||||
#endif
|
||||
|
||||
config.status: configure
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
CFLAGS="$(CFLAGS)" \
|
||||
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
|
||||
--prefix=/usr --mandir=\$${prefix}/share/man \
|
||||
--infodir=\$${prefix}/share/info
|
||||
|
||||
|
||||
build: build-stamp
|
||||
build-stamp: config.status
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE)
|
||||
$(MAKE) check
|
||||
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
rm -f debian/shlibs.local
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) distclean
|
||||
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
|
||||
cp -f /usr/share/misc/config.sub config.sub
|
||||
endif
|
||||
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
||||
cp -f /usr/share/misc/config.guess config.guess
|
||||
endif
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/tmp
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
|
||||
$(MAKE) installcheck DESTDIR=$(CURDIR)/debian/tmp
|
||||
$(CURDIR)/debian/makedoc
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs ChangeLog
|
||||
dh_installchangelogs debian/changelog
|
||||
dh_installdocs
|
||||
dh_installexamples doc/example.cpp
|
||||
dh_movefiles --sourcedir=debian/tmp #woody uses wildcards in pkg.files
|
||||
# dh_install --sourcedir=$(CURDIR)debian/tmp #woody doesn't use wildcards
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
dh_installman
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
# dh_perl
|
||||
# dh_python
|
||||
dh_makeshlibs
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol $(POSTGIS_CONFLICT)
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
6
debian/watch
поставляемый
Обычный файл
6
debian/watch
поставляемый
Обычный файл
@ -0,0 +1,6 @@
|
||||
# Example watch control file for uscan
|
||||
# Rename this file to "watch" and then you can run the "uscan" command
|
||||
# to check for upstream updates and more.
|
||||
# Site Directory Pattern Version Script
|
||||
version=2
|
||||
geos.refractions.net / geos-(.*)\.tar.bz2 debian uupdate
|
55
doc/CMakeLists.txt
Обычный файл
55
doc/CMakeLists.txt
Обычный файл
@ -0,0 +1,55 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
|
||||
add_executable(example example.cpp)
|
||||
|
||||
target_link_libraries(example PRIVATE geos)
|
||||
target_include_directories(test_geos_unit
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
|
||||
|
||||
option(BUILD_DOCUMENTATION "Build Doxygen documentation" OFF)
|
||||
|
||||
if(BUILD_DOCUMENTATION)
|
||||
find_package(Doxygen)
|
||||
|
||||
if(NOT DOXYGEN_FOUND)
|
||||
message(FATAL_ERROR "Doxygen was not found.")
|
||||
endif()
|
||||
|
||||
set(srcdir ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(VERSION ${GEOS_VERSION_FULL})
|
||||
set(DOXYGEN_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxygen.log)
|
||||
set(CHECK_ERROR_SCRIPT "check_doxygen_errors.cmake")
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${CHECK_ERROR_SCRIPT}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${CHECK_ERROR_SCRIPT}"
|
||||
COPYONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
@ONLY)
|
||||
unset(srcdir)
|
||||
unset(VERSION)
|
||||
|
||||
add_custom_target(docs
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
BYPRODUCTS ${DOXYGEN_LOGFILE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen_docs)
|
||||
|
||||
add_test(NAME test_docs
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D DOXYGEN_LOGFILE="${DOXYGEN_LOGFILE}"
|
||||
-P "${CMAKE_CURRENT_BINARY_DIR}/${CHECK_ERROR_SCRIPT}")
|
||||
|
||||
unset(DOXYGEN_LOGFILE)
|
||||
unset(CHECK_ERROR_SCRIPT)
|
||||
endif()
|
2450
doc/Doxyfile.in
Обычный файл
2450
doc/Doxyfile.in
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
26
doc/Makefile.am
Обычный файл
26
doc/Makefile.am
Обычный файл
@ -0,0 +1,26 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
prefix=@prefix@
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=@top_builddir@
|
||||
|
||||
noinst_PROGRAMS = example
|
||||
|
||||
LIBS = $(top_builddir)/src/libgeos.la
|
||||
|
||||
example_SOURCES = example.cpp
|
||||
example_LDADD = $(LIBS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
DOXYGEN = doxygen
|
||||
|
||||
doxygen-html apidoc doxygen: Doxyfile
|
||||
$(DOXYGEN) $<
|
||||
|
||||
clean-local:
|
||||
rm -Rf doxygen_docs
|
||||
|
||||
EXTRA_DIST = Doxyfile \
|
||||
CMakeLists.txt
|
5
doc/README
Обычный файл
5
doc/README
Обычный файл
@ -0,0 +1,5 @@
|
||||
To build Doxygen documentation use:
|
||||
|
||||
make doxygen-html
|
||||
|
||||
Take a look at example.cpp to get started.
|
50
doc/check_doxygen_errors.cmake
Обычный файл
50
doc/check_doxygen_errors.cmake
Обычный файл
@ -0,0 +1,50 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Script checking the doxygen logfile for errors and warnings, which are not
|
||||
# accepted. Throws FATAL_ERROR if found.
|
||||
#
|
||||
# Copyright (C) 2019 Nicklas Larsson <n_larsson@yahoo.com>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
|
||||
file(TO_NATIVE_PATH ${DOXYGEN_LOGFILE} DOXYGEN_LOGFILE)
|
||||
|
||||
if(EXISTS "${DOXYGEN_LOGFILE}")
|
||||
set(ERRORS "")
|
||||
file(READ "${DOXYGEN_LOGFILE}" LOGFILE)
|
||||
|
||||
# convert file content to list
|
||||
string(REGEX REPLACE "\n$" "" LOGFILE "${LOGFILE}")
|
||||
string(REGEX REPLACE ";" "\\\\;" LOGFILE "${LOGFILE}")
|
||||
string(REGEX REPLACE "\n" ";" LOGFILE "${LOGFILE}")
|
||||
|
||||
# let's not forget non-fatal warnings
|
||||
list(LENGTH LOGFILE NUM_WARNINGS)
|
||||
if(NUM_WARNINGS GREATER 0)
|
||||
message(STATUS
|
||||
"Doxygen issued ${NUM_WARNINGS} warning(s), see ${DOXYGEN_LOGFILE}")
|
||||
endif()
|
||||
|
||||
foreach(LINE ${LOGFILE})
|
||||
string(REGEX MATCH
|
||||
".*(not documented|ignoring unsupported tag).*" IGNORE ${LINE})
|
||||
if("${IGNORE}" STREQUAL "")
|
||||
list(APPEND ERRORS ${LINE})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT "${ERRORS}" STREQUAL "")
|
||||
# convert list to string
|
||||
string(REGEX REPLACE ";" "\n" ERROR_MSG "${ERRORS}")
|
||||
message(FATAL_ERROR "${ERROR_MSG}")
|
||||
endif()
|
||||
|
||||
unset(ERRORS)
|
||||
endif()
|
||||
|
||||
message(STATUS "Doxygen documentation is OK")
|
1156
doc/example.cpp
Обычный файл
1156
doc/example.cpp
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
9
doc/example.tosql
Исполняемый файл
9
doc/example.tosql
Исполняемый файл
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
table=$1
|
||||
else
|
||||
table='test'
|
||||
fi
|
||||
|
||||
grep '^\[' | sed "s/^\[[^]]*\]/INSERT INTO $table (geom) VALUES ('/" | sed "s/$/');/" | sed 's/LINEARRING/LINESTRING/g'
|
20
examples/client/CMakeLists.txt
Обычный файл
20
examples/client/CMakeLists.txt
Обычный файл
@ -0,0 +1,20 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
project(GEOS VERSION 1.0.0 LANGUAGES C CXX)
|
||||
find_package(GEOS 3.8 REQUIRED)
|
||||
|
||||
add_executable(geos_client geos_client.cpp)
|
||||
target_link_libraries(geos_client PRIVATE GEOS::geos)
|
||||
|
||||
add_executable(geos_c_client geos_c_client.cpp)
|
||||
target_link_libraries(geos_c_client PRIVATE GEOS::geos_c)
|
6
examples/client/geos_c_client.cpp
Обычный файл
6
examples/client/geos_c_client.cpp
Обычный файл
@ -0,0 +1,6 @@
|
||||
#include <geos_c.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
finishGEOS();
|
||||
}
|
8
examples/client/geos_client.cpp
Обычный файл
8
examples/client/geos_client.cpp
Обычный файл
@ -0,0 +1,8 @@
|
||||
#include <geos/geom/GeometryFactory.h>
|
||||
using namespace geos::geom;
|
||||
|
||||
int main()
|
||||
{
|
||||
GeometryFactory::Ptr factory = GeometryFactory::create();
|
||||
(void)factory;
|
||||
}
|
37
include/CMakeLists.txt
Обычный файл
37
include/CMakeLists.txt
Обычный файл
@ -0,0 +1,37 @@
|
||||
################################################################################
|
||||
# Part of CMake configuration for GEOS
|
||||
#
|
||||
# Copyright (C) 2018 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# This is free software; you can redistribute and/or modify it under
|
||||
# the terms of the GNU Lesser General Public Licence as published
|
||||
# by the Free Software Foundation.
|
||||
# See the COPYING file for more information.
|
||||
################################################################################
|
||||
if(DISABLE_GEOS_INLINE)
|
||||
file(GLOB_RECURSE _headers ${CMAKE_CURRENT_LIST_DIR}/*.h CONFIGURE_DEPEND)
|
||||
else()
|
||||
file(GLOB_RECURSE _headers ${CMAKE_CURRENT_LIST_DIR}/*.h ${CMAKE_CURRENT_LIST_DIR}/*.inl CONFIGURE_DEPEND)
|
||||
endif()
|
||||
target_sources(geos PRIVATE ${_headers})
|
||||
unset(_headers)
|
||||
|
||||
target_include_directories(geos
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<INSTALL_INTERFACE:include/geos>)
|
||||
|
||||
set(VERSION ${GEOS_VERSION})
|
||||
set(VERSION_MAJOR ${GEOS_VERSION_MAJOR})
|
||||
set(VERSION_MINOR ${GEOS_VERSION_MINOR})
|
||||
set(VERSION_PATCH ${GEOS_VERSION_PATCH})
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/geos/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/geos/version.h
|
||||
@ONLY)
|
||||
|
||||
unset(VERSION)
|
||||
unset(VERSION_MAJOR)
|
||||
unset(VERSION_MINOR)
|
||||
unset(VERSION_PATCH)
|
10
include/Makefile.am
Обычный файл
10
include/Makefile.am
Обычный файл
@ -0,0 +1,10 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
SUBDIRS = \
|
||||
geos
|
||||
|
||||
include_HEADERS = \
|
||||
geos.h
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
20
include/acconfig.h
Обычный файл
20
include/acconfig.h
Обычный файл
@ -0,0 +1,20 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/* Set to 1 if type "long int" works and is 64 bits */
|
||||
#undef HAVE_LONG_INT_64
|
||||
|
||||
/* Set to 1 if type "long long int" works and is 64 bits */
|
||||
#undef HAVE_LONG_LONG_INT_64
|
35
include/geos.h
Обычный файл
35
include/geos.h
Обычный файл
@ -0,0 +1,35 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005 Refractions Research Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_H
|
||||
#define GEOS_H
|
||||
|
||||
/*
|
||||
* \file geos.h
|
||||
* \brief
|
||||
* This file is intended as an include wrapper for client application.
|
||||
* It includes commonly needed GEOS headers.
|
||||
*/
|
||||
|
||||
#include <geos/version.h>
|
||||
#include <geos/geom.h>
|
||||
#include <geos/util.h>
|
||||
#include <geos/io.h>
|
||||
#include <geos/unload.h>
|
||||
|
||||
/// Basic namespace for all GEOS functionalities.
|
||||
namespace geos {
|
||||
}
|
||||
|
||||
#endif
|
57
include/geos/Makefile.am
Обычный файл
57
include/geos/Makefile.am
Обычный файл
@ -0,0 +1,57 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
SUBDIRS = \
|
||||
algorithm \
|
||||
geom \
|
||||
geomgraph \
|
||||
index \
|
||||
io \
|
||||
linearref \
|
||||
noding \
|
||||
operation \
|
||||
planargraph \
|
||||
precision \
|
||||
simplify \
|
||||
triangulate \
|
||||
util
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
geosdir = $(includedir)/geos
|
||||
|
||||
geos_HEADERS = \
|
||||
constants.h \
|
||||
export.h \
|
||||
geomgraph.h \
|
||||
geomgraphindex.h \
|
||||
geom.h \
|
||||
geomUtil.h \
|
||||
geosAlgorithm.h \
|
||||
indexBintree.h \
|
||||
indexChain.h \
|
||||
indexQuadtree.h \
|
||||
indexStrtree.h \
|
||||
indexSweepline.h \
|
||||
inline.h \
|
||||
io.h \
|
||||
noding.h \
|
||||
nodingSnapround.h \
|
||||
opBuffer.h \
|
||||
opDistance.h \
|
||||
operation.h \
|
||||
opLinemerge.h \
|
||||
opOverlay.h \
|
||||
opPolygonize.h \
|
||||
opPredicate.h \
|
||||
opRelate.h \
|
||||
opValid.h \
|
||||
planargraph.h \
|
||||
precision.h \
|
||||
profiler.h \
|
||||
spatialIndex.h \
|
||||
unload.h \
|
||||
util.h
|
||||
|
||||
nodist_geos_HEADERS = \
|
||||
version.h
|
227
include/geos/algorithm/Angle.h
Обычный файл
227
include/geos/algorithm/Angle.h
Обычный файл
@ -0,0 +1,227 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/Angle.java r378 (JTS-1.12)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_ANGLE_H
|
||||
#define GEOS_ALGORITHM_ANGLE_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/algorithm/Orientation.h> // for constants
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Coordinate;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/// Utility functions for working with angles.
|
||||
//
|
||||
/// Unless otherwise noted, methods in this class express angles in radians.
|
||||
///
|
||||
class GEOS_DLL Angle {
|
||||
public:
|
||||
|
||||
static const double PI_TIMES_2; // 2.0 * PI;
|
||||
static const double PI_OVER_2; // PI / 2.0;
|
||||
static const double PI_OVER_4; // PI / 4.0;
|
||||
|
||||
/// Constant representing counterclockwise orientation
|
||||
static const int COUNTERCLOCKWISE = Orientation::COUNTERCLOCKWISE;
|
||||
|
||||
/// Constant representing clockwise orientation
|
||||
static const int CLOCKWISE = Orientation::CLOCKWISE;
|
||||
|
||||
/// Constant representing no orientation
|
||||
static const int NONE = Orientation::COLLINEAR;
|
||||
|
||||
/// Converts from radians to degrees.
|
||||
//
|
||||
/// @param radians an angle in radians
|
||||
/// @return the angle in degrees
|
||||
///
|
||||
static double toDegrees(double radians);
|
||||
|
||||
/// Converts from degrees to radians.
|
||||
//
|
||||
/// @param angleDegrees an angle in degrees
|
||||
/// @return the angle in radians
|
||||
///
|
||||
static double toRadians(double angleDegrees);
|
||||
|
||||
/// \brief
|
||||
/// Returns the angle of the vector from p0 to p1,
|
||||
/// relative to the positive X-axis.
|
||||
//
|
||||
/// The angle is normalized to be in the range [ -Pi, Pi ].
|
||||
///
|
||||
/// @return the normalized angle (in radians) that p0-p1 makes
|
||||
/// with the positive x-axis.
|
||||
///
|
||||
static double angle(const geom::Coordinate& p0,
|
||||
const geom::Coordinate& p1);
|
||||
|
||||
/// \brief
|
||||
/// Returns the angle that the vector from (0,0) to p,
|
||||
/// relative to the positive X-axis.
|
||||
//
|
||||
/// The angle is normalized to be in the range ( -Pi, Pi ].
|
||||
///
|
||||
/// @return the normalized angle (in radians) that p makes
|
||||
/// with the positive x-axis.
|
||||
///
|
||||
static double angle(const geom::Coordinate& p);
|
||||
|
||||
/// Tests whether the angle between p0-p1-p2 is acute.
|
||||
//
|
||||
/// An angle is acute if it is less than 90 degrees.
|
||||
///
|
||||
/// Note: this implementation is not precise (determistic) for
|
||||
/// angles very close to 90 degrees.
|
||||
///
|
||||
/// @param p0 an endpoint of the angle
|
||||
/// @param p1 the base of the angle
|
||||
/// @param p2 the other endpoint of the angle
|
||||
///
|
||||
static bool isAcute(const geom::Coordinate& p0,
|
||||
const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2);
|
||||
|
||||
/// Tests whether the angle between p0-p1-p2 is obtuse.
|
||||
//
|
||||
/// An angle is obtuse if it is greater than 90 degrees.
|
||||
///
|
||||
/// Note: this implementation is not precise (determistic) for
|
||||
/// angles very close to 90 degrees.
|
||||
///
|
||||
/// @param p0 an endpoint of the angle
|
||||
/// @param p1 the base of the angle
|
||||
/// @param p2 the other endpoint of the angle
|
||||
///
|
||||
static bool isObtuse(const geom::Coordinate& p0,
|
||||
const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2);
|
||||
|
||||
/// Returns the unoriented smallest angle between two vectors.
|
||||
//
|
||||
/// The computed angle will be in the range [0, Pi).
|
||||
///
|
||||
/// @param tip1 the tip of one vector
|
||||
/// @param tail the tail of each vector
|
||||
/// @param tip2 the tip of the other vector
|
||||
/// @return the angle between tail-tip1 and tail-tip2
|
||||
///
|
||||
static double angleBetween(const geom::Coordinate& tip1,
|
||||
const geom::Coordinate& tail,
|
||||
const geom::Coordinate& tip2);
|
||||
|
||||
/// Returns the oriented smallest angle between two vectors.
|
||||
//
|
||||
/// The computed angle will be in the range (-Pi, Pi].
|
||||
/// A positive result corresponds to a counterclockwise rotation
|
||||
/// from v1 to v2;
|
||||
/// a negative result corresponds to a clockwise rotation.
|
||||
///
|
||||
/// @param tip1 the tip of v1
|
||||
/// @param tail the tail of each vector
|
||||
/// @param tip2 the tip of v2
|
||||
/// @return the angle between v1 and v2, relative to v1
|
||||
///
|
||||
static double angleBetweenOriented(const geom::Coordinate& tip1,
|
||||
const geom::Coordinate& tail,
|
||||
const geom::Coordinate& tip2);
|
||||
|
||||
/// Computes the interior angle between two segments of a ring.
|
||||
//
|
||||
/// The ring is assumed to be oriented in a clockwise direction.
|
||||
/// The computed angle will be in the range [0, 2Pi]
|
||||
///
|
||||
/// @param p0
|
||||
/// a point of the ring
|
||||
/// @param p1
|
||||
/// the next point of the ring
|
||||
/// @param p2
|
||||
/// the next point of the ring
|
||||
/// @return the interior angle based at <code>p1</code>
|
||||
///
|
||||
static double interiorAngle(const geom::Coordinate& p0,
|
||||
const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2);
|
||||
|
||||
/// \brief
|
||||
/// Returns whether an angle must turn clockwise or counterclockwise
|
||||
/// to overlap another angle.
|
||||
///
|
||||
/// @param ang1 an angle (in radians)
|
||||
/// @param ang2 an angle (in radians)
|
||||
/// @return whether a1 must turn CLOCKWISE, COUNTERCLOCKWISE or
|
||||
/// NONE to overlap a2.
|
||||
///
|
||||
static int getTurn(double ang1, double ang2);
|
||||
|
||||
/// \brief
|
||||
/// Computes the normalized value of an angle, which is the
|
||||
/// equivalent angle in the range ( -Pi, Pi ].
|
||||
///
|
||||
/// @param angle the angle to normalize
|
||||
/// @return an equivalent angle in the range (-Pi, Pi]
|
||||
///
|
||||
static double normalize(double angle);
|
||||
|
||||
/// \brief
|
||||
/// Computes the normalized positive value of an angle,
|
||||
/// which is the equivalent angle in the range [ 0, 2*Pi ).
|
||||
///
|
||||
/// E.g.:
|
||||
/// - normalizePositive(0.0) = 0.0
|
||||
/// - normalizePositive(-PI) = PI
|
||||
/// - normalizePositive(-2PI) = 0.0
|
||||
/// - normalizePositive(-3PI) = PI
|
||||
/// - normalizePositive(-4PI) = 0
|
||||
/// - normalizePositive(PI) = PI
|
||||
/// - normalizePositive(2PI) = 0.0
|
||||
/// - normalizePositive(3PI) = PI
|
||||
/// - normalizePositive(4PI) = 0.0
|
||||
///
|
||||
/// @param angle the angle to normalize, in radians
|
||||
/// @return an equivalent positive angle
|
||||
///
|
||||
static double normalizePositive(double angle);
|
||||
|
||||
|
||||
/// Computes the unoriented smallest difference between two angles.
|
||||
//
|
||||
/// The angles are assumed to be normalized to the range [-Pi, Pi].
|
||||
/// The result will be in the range [0, Pi].
|
||||
///
|
||||
/// @param ang1 the angle of one vector (in [-Pi, Pi] )
|
||||
/// @param ang2 the angle of the other vector (in range [-Pi, Pi] )
|
||||
/// @return the angle (in radians) between the two vectors
|
||||
/// (in range [0, Pi] )
|
||||
///
|
||||
static double diff(double ang1, double ang2);
|
||||
};
|
||||
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_ANGLE_H
|
78
include/geos/algorithm/Area.h
Обычный файл
78
include/geos/algorithm/Area.h
Обычный файл
@ -0,0 +1,78 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2018 Paul Ramsey <pramsey@cleverlephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/Area.java @ 2017-09-04
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_AREA_H
|
||||
#define GEOS_ALGORITHM_AREA_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
|
||||
class GEOS_DLL Area {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Computes the area for a ring.
|
||||
*
|
||||
* @param ring the coordinates forming the ring
|
||||
* @return the area of the ring
|
||||
*/
|
||||
static double ofRing(const std::vector<geom::Coordinate>& ring);
|
||||
|
||||
/**
|
||||
* Computes the area for a ring.
|
||||
*
|
||||
* @param ring the coordinates forming the ring
|
||||
* @return the area of the ring
|
||||
*/
|
||||
static double ofRing(const geom::CoordinateSequence* ring);
|
||||
|
||||
/**
|
||||
* Computes the signed area for a ring. The signed area is positive if the
|
||||
* ring is oriented CW, negative if the ring is oriented CCW, and zero if the
|
||||
* ring is degenerate or flat.
|
||||
*
|
||||
* @param ring
|
||||
* the coordinates forming the ring
|
||||
* @return the signed area of the ring
|
||||
*/
|
||||
static double ofRingSigned(const std::vector<geom::Coordinate>& ring);
|
||||
|
||||
/**
|
||||
* Computes the signed area for a ring. The signed area is positive if the
|
||||
* ring is oriented CW, negative if the ring is oriented CCW, and zero if the
|
||||
* ring is degenerate or flat.
|
||||
*
|
||||
* @param ring
|
||||
* the coordinates forming the ring
|
||||
* @return the signed area of the ring
|
||||
*/
|
||||
static double ofRingSigned(const geom::CoordinateSequence* ring);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_AREA_H
|
145
include/geos/algorithm/BoundaryNodeRule.h
Обычный файл
145
include/geos/algorithm/BoundaryNodeRule.h
Обычный файл
@ -0,0 +1,145 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/BoundaryNodeRule.java rev 1.4 (JTS-1.10)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_BOUNDARYNODERULE_H
|
||||
#define GEOS_ALGORITHM_BOUNDARYNODERULE_H
|
||||
|
||||
#include <geos/export.h>
|
||||
|
||||
// Forward declarations
|
||||
// ...
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
|
||||
/** \brief
|
||||
* An interface for rules which determine whether node points which are
|
||||
* in boundaries of lineal geometry components
|
||||
* are in the boundary of the parent geometry collection.
|
||||
*
|
||||
* The SFS specifies a single kind of boundary node rule,
|
||||
* the `Mod2BoundaryNodeRule` rule.
|
||||
* However, other kinds of Boundary Node Rules are appropriate
|
||||
* in specific situations (for instance, linear network topology
|
||||
* usually follows the `EndPointBoundaryNodeRule`.)
|
||||
* Some JTS operations allow the BoundaryNodeRule to be specified,
|
||||
* and respect this rule when computing the results of the operation.
|
||||
*
|
||||
* @author Martin Davis
|
||||
* @version 1.7
|
||||
*
|
||||
* @see operation::relate::RelateOp
|
||||
* @see operation::IsSimpleOp
|
||||
* @see algorithm::PointLocator
|
||||
*/
|
||||
class GEOS_DLL BoundaryNodeRule {
|
||||
|
||||
public:
|
||||
|
||||
// virtual classes should always have a virtual destructor..
|
||||
virtual
|
||||
~BoundaryNodeRule() {}
|
||||
|
||||
/** \brief
|
||||
* Tests whether a point that lies in `boundaryCount`
|
||||
* geometry component boundaries is considered to form part of
|
||||
* the boundary of the parent geometry.
|
||||
*
|
||||
* @param boundaryCount the number of component boundaries that
|
||||
* this point occurs in
|
||||
* @return `true` if points in this number of boundaries lie in
|
||||
* the parent boundary
|
||||
*/
|
||||
virtual bool isInBoundary(int boundaryCount) const = 0;
|
||||
|
||||
/** \brief
|
||||
* The Mod-2 Boundary Node Rule (which is the rule specified
|
||||
* in the OGC SFS).
|
||||
*
|
||||
* A BoundaryNodeRule specifies that points are in the boundary of
|
||||
* a lineal geometry iff the point lies on the boundary of an odd number
|
||||
* of components. Under this rule LinearRings and closed LineStrings have
|
||||
* an empty boundary.
|
||||
*
|
||||
* This is the rule specified by the OGC SFS, and is the default
|
||||
* rule used in JTS.
|
||||
*/
|
||||
//static const BoundaryNodeRule& MOD2_BOUNDARY_RULE;
|
||||
static const BoundaryNodeRule& getBoundaryRuleMod2();
|
||||
|
||||
/** \brief
|
||||
* The Endpoint Boundary Node Rule.
|
||||
*
|
||||
* A BoundaryNodeRule which specifies that any points which are endpoints
|
||||
* of lineal components are in the boundary of the parent geometry. This
|
||||
* corresponds to the "intuitive" topological definition of boundary. Under
|
||||
* this rule LinearRings have a non-empty boundary (the common endpoint
|
||||
* of the underlying LineString).
|
||||
*
|
||||
* This rule is useful when dealing with linear networks. For example,
|
||||
* it can be used to check whether linear networks are correctly noded.
|
||||
* The usual network topology constraint is that linear segments may
|
||||
* touch only at endpoints. In the case of a segment touching a closed
|
||||
* segment (ring) at one point, the Mod2 rule cannot distinguish between
|
||||
* the permitted case of touching at the node point and the invalid case
|
||||
* of touching at some other interior (non-node) point. The EndPoint rule
|
||||
* does distinguish between these cases, so is more appropriate for use.
|
||||
*/
|
||||
//static const BoundaryNodeRule& ENDPOINT_BOUNDARY_RULE;
|
||||
static const BoundaryNodeRule& getBoundaryEndPoint();
|
||||
|
||||
/** \brief
|
||||
* The MultiValent Endpoint Boundary Node Rule.
|
||||
*
|
||||
* A BoundaryNodeRule which determines that only endpoints with valency
|
||||
* greater than 1 are on the boundary. This corresponds to the boundary
|
||||
* of a MultiLineString being all the "attached" endpoints, but not
|
||||
* the "unattached" ones.
|
||||
*/
|
||||
//static const BoundaryNodeRule& MULTIVALENT_ENDPOINT_BOUNDARY_RULE;
|
||||
static const BoundaryNodeRule& getBoundaryMultivalentEndPoint();
|
||||
|
||||
/** \brief
|
||||
* The Monovalent Endpoint Boundary Node Rule.
|
||||
*
|
||||
* A BoundaryNodeRule which determines that only endpoints with valency of
|
||||
* exactly 1 are on the boundary. This corresponds to the boundary of
|
||||
* a MultiLineString being all the "unattached" endpoints.
|
||||
*/
|
||||
//static const BoundaryNodeRule& MONOVALENT_ENDPOINT_BOUNDARY_RULE;
|
||||
static const BoundaryNodeRule& getBoundaryMonovalentEndPoint();
|
||||
|
||||
/** \brief
|
||||
* The Boundary Node Rule specified by the OGC Simple Features
|
||||
* Specification, which is the same as the Mod-2 rule.
|
||||
*
|
||||
* A BoundaryNodeRule which determines that only endpoints with valency
|
||||
* greater than 1 are on the boundary. This corresponds to the boundary
|
||||
* of a MultiLineString being all the "attached" endpoints, but not the
|
||||
* "unattached" ones.
|
||||
*/
|
||||
//static const BoundaryNodeRule& OGC_SFS_BOUNDARY_RULE;
|
||||
static const BoundaryNodeRule& getBoundaryOGCSFS();
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_BOUNDARYNODERULE_H
|
||||
|
165
include/geos/algorithm/CGAlgorithmsDD.h
Обычный файл
165
include/geos/algorithm/CGAlgorithmsDD.h
Обычный файл
@ -0,0 +1,165 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2014 Mateusz Loskot <mateusz@loskot.net>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/CGAlgorithmsDD.java r789 (JTS-1.14)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_CGALGORITHMDD_H
|
||||
#define GEOS_ALGORITHM_CGALGORITHMDD_H
|
||||
#include <geos/export.h>
|
||||
#include <geos/algorithm/ttmath/ttmath.h>
|
||||
|
||||
/// \file CGAlgorithmsDD.h
|
||||
|
||||
/// \brief Close to DoubleDouble equivalent used by JTS
|
||||
///
|
||||
/// Usage: `ttmath::Big<exponent, mantissa>`
|
||||
typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(128)> DD;
|
||||
//typedef ttmath::Big<TTMATH_BITS(64), TTMATH_BITS(128)> DD;
|
||||
//typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(256)> DD;
|
||||
//typedef ttmath::Big<TTMATH_BITS(64), TTMATH_BITS(256)> DD;
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Coordinate;
|
||||
class CoordinateSequence;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/// Implements basic computational geometry algorithms using extended precision float-point arithmetic.
|
||||
class GEOS_DLL CGAlgorithmsDD {
|
||||
|
||||
public:
|
||||
|
||||
enum {
|
||||
CLOCKWISE = -1,
|
||||
COLLINEAR = 0,
|
||||
COUNTERCLOCKWISE = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
RIGHT = -1,
|
||||
LEFT = 1,
|
||||
STRAIGHT = 0,
|
||||
FAILURE = 2
|
||||
};
|
||||
|
||||
/** \brief
|
||||
* Returns the index of the direction of the point `q` relative to
|
||||
* a vector specified by `p1-p2`.
|
||||
*
|
||||
* @param p1 the origin point of the vector
|
||||
* @param p2 the final point of the vector
|
||||
* @param q the point to compute the direction to
|
||||
*
|
||||
* @return 1 if q is counter-clockwise (left) from p1-p2
|
||||
* @return -1 if q is clockwise (right) from p1-p2
|
||||
* @return 0 if q is collinear with p1-p2
|
||||
*/
|
||||
static int orientationIndex(const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q);
|
||||
/** \brief
|
||||
* A filter for computing the orientation index of three coordinates.
|
||||
*
|
||||
* If the orientation can be computed safely using standard DP arithmetic,
|
||||
* this routine returns the orientation index. Otherwise, a value `i > 1` is
|
||||
* returned. In this case the orientation index must be computed using some
|
||||
* other more robust method.
|
||||
*
|
||||
* The filter is fast to compute, so can be used to avoid the use of slower
|
||||
* robust methods except when they are really needed, thus providing better
|
||||
* average performance.
|
||||
*
|
||||
* Uses an approach due to Jonathan Shewchuk, which is in the public domain.
|
||||
*
|
||||
* @param pa a coordinate
|
||||
* @param pb a coordinate
|
||||
* @param pc a coordinate
|
||||
* @return the orientation index if it can be computed safely
|
||||
* @return `i > 1` if the orientation index cannot be computed safely
|
||||
*/
|
||||
static int orientationIndexFilter(const geom::Coordinate& pa,
|
||||
const geom::Coordinate& pb,
|
||||
const geom::Coordinate& pc);
|
||||
|
||||
static int
|
||||
orientation(double x)
|
||||
{
|
||||
if(x < 0) {
|
||||
return CGAlgorithmsDD::RIGHT;
|
||||
}
|
||||
if(x > 0) {
|
||||
return CGAlgorithmsDD::LEFT;
|
||||
}
|
||||
return CGAlgorithmsDD::STRAIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the lines are parallel (either identical
|
||||
* or separate) a null value is returned.
|
||||
* @param p1 an endpoint of line segment 1
|
||||
* @param p2 an endpoint of line segment 1
|
||||
* @param q1 an endpoint of line segment 2
|
||||
* @param q2 an endpoint of line segment 2
|
||||
* @return an intersection point if one exists, or null if the lines are parallel
|
||||
*/
|
||||
static geom::Coordinate intersection(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1, const geom::Coordinate& q2);
|
||||
|
||||
static int signOfDet2x2(double dx1, double dy1, double dx2, double dy2);
|
||||
|
||||
static DD detDD(double x1, double y1, double x2, double y2);
|
||||
static DD detDD(const DD& x1, const DD& y1, const DD& x2, const DD& y2);
|
||||
|
||||
/** \brief
|
||||
* Computes the circumcentre of a triangle.
|
||||
*
|
||||
* The circumcentre is the centre of the circumcircle, the smallest circle
|
||||
* which encloses the triangle. It is also the common intersection point of
|
||||
* the perpendicular bisectors of the sides of the triangle, and is the only
|
||||
* point which has equal distance to all three vertices of the triangle.
|
||||
*
|
||||
* The circumcentre does not necessarily lie within the triangle. For example,
|
||||
* the circumcentre of an obtuse isosceles triangle lies outside the triangle.
|
||||
*
|
||||
* This method uses @ref DD extended-precision arithmetic to provide more accurate
|
||||
* results than [circumcentre(Coordinate, Coordinate, Coordinate)]
|
||||
* (@ref geos::geom::Triangle::circumcentre(const Coordinate& p0, const Coordinate& p1, const Coordinate& p2)).
|
||||
*
|
||||
* @param a
|
||||
* a vertex of the triangle
|
||||
* @param b
|
||||
* a vertex of the triangle
|
||||
* @param c
|
||||
* a vertex of the triangle
|
||||
* @return the circumcentre of the triangle
|
||||
*/
|
||||
static geom::Coordinate circumcentreDD(const geom::Coordinate& a, const geom::Coordinate& b, const geom::Coordinate& c);
|
||||
|
||||
protected:
|
||||
|
||||
static int signOfDet2x2(const DD& x1, const DD& y1, const DD& x2, const DD& y2);
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_CGALGORITHM_H
|
163
include/geos/algorithm/CentralEndpointIntersector.h
Обычный файл
163
include/geos/algorithm/CentralEndpointIntersector.h
Обычный файл
@ -0,0 +1,163 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2006 Refractions Research Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/CentralEndpointIntersector.java rev. 1.1
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_CENTRALENDPOINTINTERSECTOR_H
|
||||
#define GEOS_ALGORITHM_CENTRALENDPOINTINTERSECTOR_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
|
||||
#endif
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
//class PrecisionModel;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* Computes an approximate intersection of two line segments
|
||||
* by taking the most central of the endpoints of the segments.
|
||||
*
|
||||
* This is effective in cases where the segments are nearly parallel
|
||||
* and should intersect at an endpoint.
|
||||
* It is also a reasonable strategy for cases where the
|
||||
* endpoint of one segment lies on or almost on the interior of another one.
|
||||
* Taking the most central endpoint ensures that the computed intersection
|
||||
* point lies in the envelope of the segments.
|
||||
* Also, by always returning one of the input points, this should result
|
||||
* in reducing segment fragmentation.
|
||||
* Intended to be used as a last resort for
|
||||
* computing ill-conditioned intersection situations which
|
||||
* cause other methods to fail.
|
||||
*
|
||||
* @author Martin Davis
|
||||
* @version 1.8
|
||||
*/
|
||||
class GEOS_DLL CentralEndpointIntersector {
|
||||
|
||||
public:
|
||||
|
||||
static const geom::Coordinate&
|
||||
getIntersection(const geom::Coordinate& p00,
|
||||
const geom::Coordinate& p01, const geom::Coordinate& p10,
|
||||
const geom::Coordinate& p11)
|
||||
{
|
||||
CentralEndpointIntersector intor(p00, p01, p10, p11);
|
||||
return intor.getIntersection();
|
||||
}
|
||||
|
||||
CentralEndpointIntersector(const geom::Coordinate& p00,
|
||||
const geom::Coordinate& p01,
|
||||
const geom::Coordinate& p10,
|
||||
const geom::Coordinate& p11)
|
||||
:
|
||||
_pts(4)
|
||||
{
|
||||
_pts[0] = p00;
|
||||
_pts[1] = p01;
|
||||
_pts[2] = p10;
|
||||
_pts[3] = p11;
|
||||
compute();
|
||||
}
|
||||
|
||||
const geom::Coordinate&
|
||||
getIntersection() const
|
||||
{
|
||||
return _intPt;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// This is likely overkill.. we'll be allocating heap
|
||||
// memory at every call !
|
||||
std::vector<geom::Coordinate> _pts;
|
||||
|
||||
geom::Coordinate _intPt;
|
||||
|
||||
void
|
||||
compute()
|
||||
{
|
||||
geom::Coordinate centroid = average(_pts);
|
||||
_intPt = findNearestPoint(centroid, _pts);
|
||||
}
|
||||
|
||||
static geom::Coordinate
|
||||
average(
|
||||
const std::vector<geom::Coordinate>& pts)
|
||||
{
|
||||
geom::Coordinate avg(0, 0);
|
||||
size_t n = pts.size();
|
||||
if(! n) {
|
||||
return avg;
|
||||
}
|
||||
for(std::size_t i = 0; i < n; ++i) {
|
||||
avg.x += pts[i].x;
|
||||
avg.y += pts[i].y;
|
||||
}
|
||||
avg.x /= n;
|
||||
avg.y /= n;
|
||||
return avg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines a point closest to the given point.
|
||||
*
|
||||
* @param p the point to compare against
|
||||
* @param p1 a potential result point
|
||||
* @param p2 a potential result point
|
||||
* @param q1 a potential result point
|
||||
* @param q2 a potential result point
|
||||
* @return the point closest to the input point p
|
||||
*/
|
||||
geom::Coordinate
|
||||
findNearestPoint(const geom::Coordinate& p,
|
||||
const std::vector<geom::Coordinate>& pts) const
|
||||
{
|
||||
double minDistSq = std::numeric_limits<double>::max();
|
||||
geom::Coordinate result = geom::Coordinate::getNull();
|
||||
for(std::size_t i = 0, n = pts.size(); i < n; ++i) {
|
||||
double distSq = p.distanceSquared(pts[i]);
|
||||
if(distSq < minDistSq) {
|
||||
minDistSq = distSq;
|
||||
result = pts[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // GEOS_ALGORITHM_CENTRALENDPOINTINTERSECTOR_H
|
159
include/geos/algorithm/Centroid.h
Обычный файл
159
include/geos/algorithm/Centroid.h
Обычный файл
@ -0,0 +1,159 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2013 Sandro Santilli <strk@kbt.io>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/Centroid.java r728 (JTS-0.13+)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_CENTROID_H
|
||||
#define GEOS_ALGORITHM_CENTROID_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h> // for composition
|
||||
#include <memory> // for std::unique_ptr
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Geometry;
|
||||
class Polygon;
|
||||
class CoordinateSequence;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**\brief
|
||||
* Computes the centroid of a [Geometry](@ref geom::Geometry) of any dimension.
|
||||
*
|
||||
* If the geometry is nomimally of higher dimension, but contains only
|
||||
* components having a lower effective dimension (i.e. zero length or area),
|
||||
* the centroid will be computed appropriately.
|
||||
*
|
||||
* ### Algorithm #
|
||||
*
|
||||
* - **Dimension = 2** - Based on the usual algorithm for calculating
|
||||
* the centroid as a weighted sum of the centroids
|
||||
* of a decomposition of the area into (possibly overlapping) triangles.
|
||||
* The algorithm has been extended to handle holes and multi-polygons.
|
||||
* See http://www.faqs.org/faqs/graphics/algorithms-faq/
|
||||
* for further details of the basic approach.
|
||||
* - **Dimension = 1** - Computes the average of the midpoints
|
||||
* of all line segments weighted by the segment length.
|
||||
* - **Dimension = 0** - Compute the average coordinate over all points.
|
||||
*
|
||||
* If the input geometries are empty, a `null` Coordinate is returned.
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL Centroid {
|
||||
|
||||
public:
|
||||
|
||||
/** \brief
|
||||
* Computes the centroid point of a geometry.
|
||||
*
|
||||
* @param geom the geometry to use
|
||||
* @param cent will be set to the centroid point, if any
|
||||
*
|
||||
* @return `true` if a centroid could be computed,
|
||||
* `false` otherwise (empty geom)
|
||||
*/
|
||||
static bool getCentroid(const geom::Geometry& geom, geom::Coordinate& cent);
|
||||
|
||||
/** \brief
|
||||
* Creates a new instance for computing the centroid of a geometry
|
||||
*/
|
||||
Centroid(const geom::Geometry& geom)
|
||||
:
|
||||
areasum2(0.0),
|
||||
totalLength(0.0),
|
||||
ptCount(0)
|
||||
{
|
||||
add(geom);
|
||||
}
|
||||
|
||||
/** \brief
|
||||
* Gets the computed centroid.
|
||||
*
|
||||
* @param cent will be set to the centroid point, if any
|
||||
*
|
||||
* @return `true` if a centroid could be computed,
|
||||
* `false` otherwise (empty geom)
|
||||
*/
|
||||
bool getCentroid(geom::Coordinate& cent) const;
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<geom::Coordinate> areaBasePt;
|
||||
geom::Coordinate triangleCent3;
|
||||
geom::Coordinate cg3;
|
||||
geom::Coordinate lineCentSum;
|
||||
geom::Coordinate ptCentSum;
|
||||
double areasum2;
|
||||
double totalLength;
|
||||
int ptCount;
|
||||
|
||||
/**
|
||||
* Adds a Geometry to the centroid total.
|
||||
*
|
||||
* @param geom the geometry to add
|
||||
*/
|
||||
void add(const geom::Geometry& geom);
|
||||
|
||||
void setAreaBasePoint(const geom::Coordinate& basePt);
|
||||
|
||||
void add(const geom::Polygon& poly);
|
||||
|
||||
void addShell(const geom::CoordinateSequence& pts);
|
||||
|
||||
void addHole(const geom::CoordinateSequence& pts);
|
||||
|
||||
void addTriangle(const geom::Coordinate& p0, const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
bool isPositiveArea);
|
||||
|
||||
/**
|
||||
* Computes three times the centroid of the triangle p1-p2-p3.
|
||||
* The factor of 3 is
|
||||
* left in to permit division to be avoided until later.
|
||||
*/
|
||||
static void centroid3(const geom::Coordinate& p1, const geom::Coordinate& p2, const geom::Coordinate& p3,
|
||||
geom::Coordinate& c);
|
||||
|
||||
/**
|
||||
* Returns twice the signed area of the triangle p1-p2-p3.
|
||||
* The area is positive if the triangle is oriented CCW, and negative if CW.
|
||||
*/
|
||||
static double area2(const geom::Coordinate& p1, const geom::Coordinate& p2, const geom::Coordinate& p3);
|
||||
|
||||
/**
|
||||
* Adds the line segments defined by an array of coordinates
|
||||
* to the linear centroid accumulators.
|
||||
*
|
||||
* @param pts an array of {@link Coordinate}s
|
||||
*/
|
||||
void addLineSegments(const geom::CoordinateSequence& pts);
|
||||
|
||||
/**
|
||||
* Adds a point to the point centroid accumulator.
|
||||
* @param pt a {@link Coordinate}
|
||||
*/
|
||||
void addPoint(const geom::Coordinate& pt);
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_CENTROID_H
|
193
include/geos/algorithm/ConvexHull.h
Обычный файл
193
include/geos/algorithm/ConvexHull.h
Обычный файл
@ -0,0 +1,193 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/ConvexHull.java r407 (JTS-1.12+)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_CONVEXHULL_H
|
||||
#define GEOS_ALGORITHM_CONVEXHULL_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// FIXME: avoid using Cordinate:: typedefs to avoid full include
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
|
||||
#endif
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Geometry;
|
||||
class GeometryFactory;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* Computes the convex hull of a Geometry.
|
||||
*
|
||||
* The convex hull is the smallest convex Geometry that contains all the
|
||||
* points in the input Geometry.
|
||||
*
|
||||
* Uses the Graham Scan algorithm.
|
||||
*
|
||||
* Last port: algorithm/ConvexHull.java rev. 1.26 (JTS-1.7)
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL ConvexHull {
|
||||
private:
|
||||
const geom::GeometryFactory* geomFactory;
|
||||
geom::Coordinate::ConstVect inputPts;
|
||||
|
||||
void extractCoordinates(const geom::Geometry* geom);
|
||||
|
||||
/// Create a CoordinateSequence from the Coordinate::ConstVect
|
||||
/// This is needed to construct the geometries.
|
||||
/// Here coordinate copies happen
|
||||
/// The returned object is newly allocated !NO EXCEPTION SAFE!
|
||||
std::unique_ptr<geom::CoordinateSequence> toCoordinateSequence(geom::Coordinate::ConstVect& cv);
|
||||
|
||||
void computeOctPts(const geom::Coordinate::ConstVect& src,
|
||||
geom::Coordinate::ConstVect& tgt);
|
||||
|
||||
bool computeOctRing(const geom::Coordinate::ConstVect& src,
|
||||
geom::Coordinate::ConstVect& tgt);
|
||||
|
||||
/**
|
||||
* Uses a heuristic to reduce the number of points scanned
|
||||
* to compute the hull.
|
||||
* The heuristic is to find a polygon guaranteed to
|
||||
* be in (or on) the hull, and eliminate all points inside it.
|
||||
* A quadrilateral defined by the extremal points
|
||||
* in the four orthogonal directions
|
||||
* can be used, but even more inclusive is
|
||||
* to use an octilateral defined by the points in the
|
||||
* 8 cardinal directions.
|
||||
*
|
||||
* Note that even if the method used to determine the polygon
|
||||
* vertices is not 100% robust, this does not affect the
|
||||
* robustness of the convex hull.
|
||||
*
|
||||
* To satisfy the requirements of the Graham Scan algorithm,
|
||||
* the resulting array has at least 3 entries.
|
||||
*
|
||||
* @param pts The vector of const Coordinate pointers
|
||||
* to be reduced (to at least 3 elements)
|
||||
*
|
||||
* WARNING: the parameter will be modified
|
||||
*
|
||||
*/
|
||||
void reduce(geom::Coordinate::ConstVect& pts);
|
||||
|
||||
/// parameter will be modified
|
||||
void padArray3(geom::Coordinate::ConstVect& pts);
|
||||
|
||||
/// parameter will be modified
|
||||
void preSort(geom::Coordinate::ConstVect& pts);
|
||||
|
||||
/**
|
||||
* Given two points p and q compare them with respect to their radial
|
||||
* ordering about point o. First checks radial ordering.
|
||||
* If points are collinear, the comparison is based
|
||||
* on their distance to the origin.
|
||||
*
|
||||
* p < q iff
|
||||
*
|
||||
* - ang(o-p) < ang(o-q) (e.g. o-p-q is CCW)
|
||||
* - or ang(o-p) == ang(o-q) && dist(o,p) < dist(o,q)
|
||||
*
|
||||
* @param o the origin
|
||||
* @param p a point
|
||||
* @param q another point
|
||||
* @return -1, 0 or 1 depending on whether p is less than,
|
||||
* equal to or greater than q
|
||||
*/
|
||||
int polarCompare(const geom::Coordinate& o,
|
||||
const geom::Coordinate& p, const geom::Coordinate& q);
|
||||
|
||||
void grahamScan(const geom::Coordinate::ConstVect& c,
|
||||
geom::Coordinate::ConstVect& ps);
|
||||
|
||||
/**
|
||||
* @param vertices the vertices of a linear ring,
|
||||
* which may or may not be
|
||||
* flattened (i.e. vertices collinear)
|
||||
*
|
||||
* @return a 2-vertex LineString if the vertices are
|
||||
* collinear; otherwise, a Polygon with unnecessary
|
||||
* (collinear) vertices removed
|
||||
*/
|
||||
std::unique_ptr<geom::Geometry> lineOrPolygon(const geom::Coordinate::ConstVect& vertices);
|
||||
|
||||
/**
|
||||
* Write in 'cleaned' a version of 'input' with collinear
|
||||
* vertexes removed.
|
||||
*/
|
||||
void cleanRing(const geom::Coordinate::ConstVect& input,
|
||||
geom::Coordinate::ConstVect& cleaned);
|
||||
|
||||
/**
|
||||
* @return whether the three coordinates are collinear
|
||||
* and c2 lies between c1 and c3 inclusive
|
||||
*/
|
||||
bool isBetween(const geom::Coordinate& c1, const geom::Coordinate& c2, const geom::Coordinate& c3);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Create a new convex hull construction for the input Geometry.
|
||||
*/
|
||||
ConvexHull(const geom::Geometry* newGeometry);
|
||||
|
||||
|
||||
~ConvexHull();
|
||||
|
||||
/**
|
||||
* Returns a Geometry that represents the convex hull of
|
||||
* the input geometry.
|
||||
* The returned geometry contains the minimal number of points
|
||||
* needed to represent the convex hull.
|
||||
* In particular, no more than two consecutive points
|
||||
* will be collinear.
|
||||
*
|
||||
* @return if the convex hull contains 3 or more points,
|
||||
* a Polygon; 2 points, a LineString;
|
||||
* 1 point, a Point; 0 points, an empty GeometryCollection.
|
||||
*/
|
||||
std::unique_ptr<geom::Geometry> getConvexHull();
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef GEOS_INLINE
|
||||
# include "geos/algorithm/ConvexHull.inl"
|
||||
#endif
|
||||
|
||||
#endif // GEOS_ALGORITHM_CONVEXHULL_H
|
53
include/geos/algorithm/ConvexHull.inl
Обычный файл
53
include/geos/algorithm/ConvexHull.inl
Обычный файл
@ -0,0 +1,53 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/ConvexHull.java r407 (JTS-1.12+)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_CONVEXHULL_INL
|
||||
#define GEOS_ALGORITHM_CONVEXHULL_INL
|
||||
|
||||
#include <cassert>
|
||||
#include <geos/algorithm/ConvexHull.h>
|
||||
#include <geos/util/UniqueCoordinateArrayFilter.h>
|
||||
#include <geos/geom/Geometry.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
INLINE
|
||||
ConvexHull::ConvexHull(const geom::Geometry* newGeometry)
|
||||
:
|
||||
geomFactory(newGeometry->getFactory())
|
||||
{
|
||||
extractCoordinates(newGeometry);
|
||||
}
|
||||
|
||||
INLINE
|
||||
ConvexHull::~ConvexHull()
|
||||
{
|
||||
}
|
||||
|
||||
INLINE void
|
||||
ConvexHull::extractCoordinates(const geom::Geometry* geom)
|
||||
{
|
||||
util::UniqueCoordinateArrayFilter filter(inputPts);
|
||||
geom->apply_ro(&filter);
|
||||
}
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_CONVEXHULL_INL
|
110
include/geos/algorithm/Distance.h
Обычный файл
110
include/geos/algorithm/Distance.h
Обычный файл
@ -0,0 +1,110 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2018 Paul Ramsey <pramsey@cleverlephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/Distance.java @ 2017-09-04
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_DISTANCE_H
|
||||
#define GEOS_ALGORITHM_DISTANCE_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* Functions to compute distance between basic geometric structures.
|
||||
*
|
||||
* @author Martin Davis
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL Distance {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Computes the distance from a line segment AB to a line segment CD
|
||||
*
|
||||
* Note: NON-ROBUST!
|
||||
*
|
||||
* @param A
|
||||
* a point of one line
|
||||
* @param B
|
||||
* the second point of (must be different to A)
|
||||
* @param C
|
||||
* one point of the line
|
||||
* @param D
|
||||
* another point of the line (must be different to A)
|
||||
*/
|
||||
// formerly distanceLineLine
|
||||
static double segmentToSegment(const geom::Coordinate& A,
|
||||
const geom::Coordinate& B,
|
||||
const geom::Coordinate& C,
|
||||
const geom::Coordinate& D);
|
||||
|
||||
/**
|
||||
* Computes the distance from a point to a sequence of line segments.
|
||||
*
|
||||
* @param p
|
||||
* a point
|
||||
* @param seq
|
||||
* a sequence of contiguous line segments defined by their vertices
|
||||
* @return the minimum distance between the point and the line segments
|
||||
*/
|
||||
static double pointToSegmentString(const geom::Coordinate& p,
|
||||
const geom::CoordinateSequence* seq);
|
||||
|
||||
/**
|
||||
* Computes the distance from a point p to a line segment AB
|
||||
*
|
||||
* Note: NON-ROBUST!
|
||||
*
|
||||
* @param p
|
||||
* the point to compute the distance for
|
||||
* @param A
|
||||
* one point of the line
|
||||
* @param B
|
||||
* another point of the line (must be different to A)
|
||||
* @return the distance from p to line segment AB
|
||||
*/
|
||||
// formerly distancePointLine
|
||||
static double pointToSegment(const geom::Coordinate& p,
|
||||
const geom::Coordinate& A,
|
||||
const geom::Coordinate& B);
|
||||
|
||||
/**
|
||||
* Computes the perpendicular distance from a point p to the (infinite) line
|
||||
* containing the points AB
|
||||
*
|
||||
* @param p
|
||||
* the point to compute the distance for
|
||||
* @param A
|
||||
* one point of the line
|
||||
* @param B
|
||||
* another point of the line (must be different to A)
|
||||
* @return the distance from p to line AB
|
||||
*/
|
||||
// formerly distancePointLinePerpendicular
|
||||
static double pointToLinePerpendicular(const geom::Coordinate& p,
|
||||
const geom::Coordinate& A,
|
||||
const geom::Coordinate& B);
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_DISTANCE_H
|
103
include/geos/algorithm/HCoordinate.h
Обычный файл
103
include/geos/algorithm/HCoordinate.h
Обычный файл
@ -0,0 +1,103 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/HCoordinate.java r386 (JTS-1.12+)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_HCOORDINATE_H
|
||||
#define GEOS_ALGORITHM_HCOORDINATE_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <iosfwd>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Coordinate;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
|
||||
/** \brief
|
||||
* Represents a homogeneous coordinate in a 2-D coordinate space.
|
||||
*
|
||||
* HCoordinate are used as a clean way
|
||||
* of computing intersections between line segments.
|
||||
*/
|
||||
class GEOS_DLL HCoordinate {
|
||||
|
||||
public:
|
||||
|
||||
friend std::ostream& operator<< (std::ostream& o, const HCoordinate& c);
|
||||
|
||||
/** \brief
|
||||
* Computes the (approximate) intersection point between two line
|
||||
* segments using homogeneous coordinates.
|
||||
*
|
||||
* @note this algorithm is not numerically stable; i.e. it can
|
||||
* produce intersection points which lie outside the envelope of the
|
||||
* line segments themselves. In order to increase the precision of
|
||||
* the calculation input points should be normalized before
|
||||
* passing them to this routine.
|
||||
*/
|
||||
static void intersection(const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1,
|
||||
const geom::Coordinate& q2,
|
||||
geom::Coordinate& ret);
|
||||
|
||||
double x, y, w;
|
||||
|
||||
HCoordinate();
|
||||
|
||||
HCoordinate(double _x, double _y, double _w);
|
||||
|
||||
HCoordinate(const geom::Coordinate& p);
|
||||
|
||||
/** \brief
|
||||
* Constructs a homogeneous coordinate which is the intersection
|
||||
* of the lines define by the homogenous coordinates represented
|
||||
* by two [Coordinates](@ref geom::Coordinate).
|
||||
*
|
||||
* @param p1
|
||||
* @param p2
|
||||
*/
|
||||
HCoordinate(const geom::Coordinate& p1, const geom::Coordinate& p2);
|
||||
|
||||
HCoordinate(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1, const geom::Coordinate& q2);
|
||||
|
||||
HCoordinate(const HCoordinate& p1, const HCoordinate& p2);
|
||||
|
||||
double getX() const;
|
||||
|
||||
double getY() const;
|
||||
|
||||
void getCoordinate(geom::Coordinate& ret) const;
|
||||
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& o, const HCoordinate& c);
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_HCOORDINATE_H
|
||||
|
113
include/geos/algorithm/InteriorPointArea.h
Обычный файл
113
include/geos/algorithm/InteriorPointArea.h
Обычный файл
@ -0,0 +1,113 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Martin Davis <mtnclimb@gmail.com>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/InteriorPointArea.java (JTS-1.17+)
|
||||
* https://github.com/locationtech/jts/commit/a140ca30cc51be4f65c950a30b0a8f51a6df75ba
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_INTERIORPOINTAREA_H
|
||||
#define GEOS_ALGORITHM_INTERIORPOINTAREA_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Geometry;
|
||||
class Polygon;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* Computes a point in the interior of an areal geometry.
|
||||
* The point will lie in the geometry interior
|
||||
* in all except certain pathological cases.
|
||||
*
|
||||
* <h2>Algorithm</h2>
|
||||
* For each input polygon:
|
||||
* <ul>
|
||||
* <li>Determine a horizontal scan line on which the interior
|
||||
* point will be located.
|
||||
* To increase the chance of the scan line
|
||||
* having non-zero-width intersection with the polygon
|
||||
* the scan line Y ordinate is chosen to be near the centre of the polygon's
|
||||
* Y extent but distinct from all of vertex Y ordinates.
|
||||
* <li>Compute the sections of the scan line
|
||||
* which lie in the interior of the polygon.
|
||||
* <li>Choose the widest interior section
|
||||
* and take its midpoint as the interior point.
|
||||
* </ul>
|
||||
* The final interior point is chosen as
|
||||
* the one occurring in the widest interior section.
|
||||
* <p>
|
||||
* This algorithm is a tradeoff between performance
|
||||
* and point quality (where points further from the geometry
|
||||
* boundary are considered to be higher quality)
|
||||
* Priority is given to performance.
|
||||
* This means that the computed interior point
|
||||
* may not be suitable for some uses
|
||||
* (such as label positioning).
|
||||
* <p>
|
||||
* The algorithm handles some kinds of invalid/degenerate geometry,
|
||||
* including zero-area and self-intersecting polygons.
|
||||
* <p>
|
||||
* Empty geometry is handled by returning a <code>null</code> point.
|
||||
*
|
||||
* <h3>KNOWN BUGS</h3>
|
||||
* <ul>
|
||||
* <li>If a fixed precision model is used, in some cases this method may return
|
||||
* a point which does not lie in the interior.
|
||||
* <li>If the input polygon is <i>extremely</i> narrow the computed point
|
||||
* may not lie in the interior of the polygon.
|
||||
* </ul>
|
||||
*/
|
||||
class GEOS_DLL InteriorPointArea {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new interior point finder
|
||||
* for an areal geometry.
|
||||
*
|
||||
* @param g an areal geometry
|
||||
*/
|
||||
InteriorPointArea(const geom::Geometry* g);
|
||||
|
||||
/**
|
||||
* Gets the computed interior point.
|
||||
*
|
||||
* @return the coordinate of an interior point
|
||||
* or <code>null</code> if the input geometry is empty
|
||||
*/
|
||||
bool getInteriorPoint(geom::Coordinate& ret) const;
|
||||
|
||||
private:
|
||||
geom::Coordinate interiorPoint;
|
||||
double maxWidth;
|
||||
|
||||
void process(const geom::Geometry* geom);
|
||||
|
||||
void processPolygon(const geom::Polygon* polygon);
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_INTERIORPOINTAREA_H
|
||||
|
82
include/geos/algorithm/InteriorPointLine.h
Обычный файл
82
include/geos/algorithm/InteriorPointLine.h
Обычный файл
@ -0,0 +1,82 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/InteriorPointLine.java r317 (JTS-1.12)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_INTERIORPOINTLINE_H
|
||||
#define GEOS_ALGORITHM_INTERIORPOINTLINE_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Geometry;
|
||||
class CoordinateSequence;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* Computes a point in the interior of an linear geometry.
|
||||
*
|
||||
* <h2>Algorithm</h2>
|
||||
*
|
||||
* - Find an interior vertex which is closest to
|
||||
* the centroid of the linestring.
|
||||
* - If there is no interior vertex, find the endpoint which is
|
||||
* closest to the centroid.
|
||||
*/
|
||||
class GEOS_DLL InteriorPointLine {
|
||||
public:
|
||||
|
||||
InteriorPointLine(const geom::Geometry* g);
|
||||
//Coordinate* getInteriorPoint() const;
|
||||
|
||||
bool getInteriorPoint(geom::Coordinate& ret) const;
|
||||
|
||||
private:
|
||||
|
||||
bool hasInterior;
|
||||
|
||||
geom::Coordinate centroid;
|
||||
|
||||
double minDistance;
|
||||
|
||||
geom::Coordinate interiorPoint;
|
||||
|
||||
void addInterior(const geom::Geometry* geom);
|
||||
|
||||
void addInterior(const geom::CoordinateSequence* pts);
|
||||
|
||||
void addEndpoints(const geom::Geometry* geom);
|
||||
|
||||
void addEndpoints(const geom::CoordinateSequence* pts);
|
||||
|
||||
void add(const geom::Coordinate& point);
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_INTERIORPOINTLINE_H
|
||||
|
76
include/geos/algorithm/InteriorPointPoint.h
Обычный файл
76
include/geos/algorithm/InteriorPointPoint.h
Обычный файл
@ -0,0 +1,76 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_INTERIORPOINTPOINT_H
|
||||
#define GEOS_ALGORITHM_INTERIORPOINTPOINT_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Geometry;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* \class InteriorPointPoint geosAlgorithm.h geos/geosAlgorithm.h
|
||||
* \brief
|
||||
* Computes a point in the interior of an point geometry.
|
||||
*
|
||||
* Algorithm:
|
||||
*
|
||||
* Find a point which is closest to the centroid of the geometry.
|
||||
*/
|
||||
class GEOS_DLL InteriorPointPoint {
|
||||
private:
|
||||
|
||||
bool hasInterior;
|
||||
|
||||
geom::Coordinate centroid;
|
||||
|
||||
double minDistance;
|
||||
|
||||
geom::Coordinate interiorPoint;
|
||||
|
||||
/**
|
||||
* Tests the point(s) defined by a Geometry for the best inside point.
|
||||
* If a Geometry is not of dimension 0 it is not tested.
|
||||
* @param geom the geometry to add
|
||||
*/
|
||||
void add(const geom::Geometry* geom);
|
||||
|
||||
void add(const geom::Coordinate* point);
|
||||
|
||||
public:
|
||||
|
||||
InteriorPointPoint(const geom::Geometry* g);
|
||||
|
||||
~InteriorPointPoint() {}
|
||||
|
||||
bool getInteriorPoint(geom::Coordinate& ret) const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_INTERIORPOINTPOINT_H
|
||||
|
61
include/geos/algorithm/Intersection.h
Обычный файл
61
include/geos/algorithm/Intersection.h
Обычный файл
@ -0,0 +1,61 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Paul Ramsey <pramsey@cleverlephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_INTERSECTION_H
|
||||
#define GEOS_ALGORITHM_INTERSECTION_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* Computes the intersection point of two lines.
|
||||
* If the lines are parallel or collinear this case is detected
|
||||
* and <code>null</code> is returned.
|
||||
* <p>
|
||||
* In general it is not possible to accurately compute
|
||||
* the intersection point of two lines, due to
|
||||
* numerical roundoff.
|
||||
* This is particularly true when the input lines are nearly parallel.
|
||||
* This routine uses numerical conditioning on the input values
|
||||
* to ensure that the computed value should be very close to the correct value.
|
||||
*
|
||||
* @param p1 an endpoint of line 1
|
||||
* @param p2 an endpoint of line 1
|
||||
* @param q1 an endpoint of line 2
|
||||
* @param q2 an endpoint of line 2
|
||||
* @return the intersection point between the lines, if there is one,
|
||||
* or null if the lines are parallel or collinear
|
||||
*
|
||||
* @see CGAlgorithmsDD#intersection(Coordinate, Coordinate, Coordinate, Coordinate)
|
||||
*/
|
||||
|
||||
class GEOS_DLL Intersection {
|
||||
|
||||
public:
|
||||
|
||||
static geom::Coordinate intersection(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1, const geom::Coordinate& q2);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_INTERSECTION_H
|
53
include/geos/algorithm/Length.h
Обычный файл
53
include/geos/algorithm/Length.h
Обычный файл
@ -0,0 +1,53 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2018 Paul Ramsey <pramsey@cleverlephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/Length.java @ 2017-09-04
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_LENGTH_H
|
||||
#define GEOS_ALGORITHM_LENGTH_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* Functions for computing length.
|
||||
*
|
||||
* @author Martin Davis
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL Length {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Computes the length of a linestring specified by a sequence of points.
|
||||
*
|
||||
* @param ring the points specifying the linestring
|
||||
* @return the length of the linestring
|
||||
*/
|
||||
static double ofLine(const geom::CoordinateSequence* ring);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_LENGTH_H
|
360
include/geos/algorithm/LineIntersector.h
Обычный файл
360
include/geos/algorithm/LineIntersector.h
Обычный файл
@ -0,0 +1,360 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/RobustLineIntersector.java r785 (JTS-1.13+)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_LINEINTERSECTOR_H
|
||||
#define GEOS_ALGORITHM_LINEINTERSECTOR_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <string>
|
||||
|
||||
#include <geos/geom/Coordinate.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class PrecisionModel;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* A LineIntersector is an algorithm that can both test whether
|
||||
* two line segments intersect and compute the intersection point
|
||||
* if they do.
|
||||
*
|
||||
* The intersection point may be computed in a precise or non-precise manner.
|
||||
* Computing it precisely involves rounding it to an integer. (This assumes
|
||||
* that the input coordinates have been made precise by scaling them to
|
||||
* an integer grid.)
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL LineIntersector {
|
||||
public:
|
||||
|
||||
/// \brief
|
||||
/// Return a Z value being the interpolation of Z from p0 and p1 at
|
||||
/// the given point p
|
||||
static double interpolateZ(const geom::Coordinate& p, const geom::Coordinate& p0, const geom::Coordinate& p1);
|
||||
|
||||
|
||||
/// Computes the "edge distance" of an intersection point p in an edge.
|
||||
//
|
||||
/// The edge distance is a metric of the point along the edge.
|
||||
/// The metric used is a robust and easy to compute metric function.
|
||||
/// It is <b>not</b> equivalent to the usual Euclidean metric.
|
||||
/// It relies on the fact that either the x or the y ordinates of the
|
||||
/// points in the edge are unique, depending on whether the edge is longer in
|
||||
/// the horizontal or vertical direction.
|
||||
///
|
||||
/// NOTE: This function may produce incorrect distances
|
||||
/// for inputs where p is not precisely on p1-p2
|
||||
/// (E.g. p = (139,9) p1 = (139,10), p2 = (280,1) produces distanct
|
||||
/// 0.0, which is incorrect.
|
||||
///
|
||||
/// My hypothesis is that the function is safe to use for points which are the
|
||||
/// result of <b>rounding</b> points which lie on the line,
|
||||
/// but not safe to use for <b>truncated</b> points.
|
||||
///
|
||||
static double computeEdgeDistance(const geom::Coordinate& p, const geom::Coordinate& p0, const geom::Coordinate& p1);
|
||||
|
||||
static double nonRobustComputeEdgeDistance(const geom::Coordinate& p, const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2);
|
||||
|
||||
LineIntersector(const geom::PrecisionModel* initialPrecisionModel = nullptr)
|
||||
:
|
||||
precisionModel(initialPrecisionModel),
|
||||
result(0),
|
||||
isProperVar(false)
|
||||
{}
|
||||
|
||||
~LineIntersector() {}
|
||||
|
||||
/** \brief
|
||||
* Tests whether either intersection point is an interior point of
|
||||
* one of the input segments.
|
||||
*
|
||||
* @return <code>true</code> if either intersection point is in
|
||||
* the interior of one of the input segments
|
||||
*/
|
||||
bool isInteriorIntersection();
|
||||
|
||||
/** \brief
|
||||
* Tests whether either intersection point is an interior point
|
||||
* of the specified input segment.
|
||||
*
|
||||
* @return <code>true</code> if either intersection point is in
|
||||
* the interior of the input segment
|
||||
*/
|
||||
bool isInteriorIntersection(int inputLineIndex);
|
||||
|
||||
/// Force computed intersection to be rounded to a given precision model.
|
||||
//
|
||||
/// No getter is provided, because the precision model is not required
|
||||
/// to be specified.
|
||||
/// @param newPM the PrecisionModel to use for rounding
|
||||
///
|
||||
void
|
||||
setPrecisionModel(const geom::PrecisionModel* newPM)
|
||||
{
|
||||
precisionModel = newPM;
|
||||
}
|
||||
|
||||
/// Compute the intersection of a point p and the line p1-p2.
|
||||
//
|
||||
/// This function computes the boolean value of the hasIntersection test.
|
||||
/// The actual value of the intersection (if there is one)
|
||||
/// is equal to the value of <code>p</code>.
|
||||
///
|
||||
void computeIntersection(const geom::Coordinate& p, const geom::Coordinate& p1, const geom::Coordinate& p2);
|
||||
|
||||
/// Same as above but doen's compute intersection point. Faster.
|
||||
static bool hasIntersection(const geom::Coordinate& p, const geom::Coordinate& p1, const geom::Coordinate& p2);
|
||||
|
||||
// These are deprecated, due to ambiguous naming
|
||||
enum {
|
||||
DONT_INTERSECT = 0,
|
||||
DO_INTERSECT = 1,
|
||||
COLLINEAR = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
/// Indicates that line segments do not intersect
|
||||
NO_INTERSECTION = 0,
|
||||
|
||||
/// Indicates that line segments intersect in a single point
|
||||
POINT_INTERSECTION = 1,
|
||||
|
||||
/// Indicates that line segments intersect in a line segment
|
||||
COLLINEAR_INTERSECTION = 2
|
||||
};
|
||||
|
||||
/// Computes the intersection of the lines p1-p2 and p3-p4
|
||||
void computeIntersection(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& p3, const geom::Coordinate& p4);
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
/**
|
||||
* Tests whether the input geometries intersect.
|
||||
*
|
||||
* @return true if the input geometries intersect
|
||||
*/
|
||||
bool
|
||||
hasIntersection() const
|
||||
{
|
||||
return result != NO_INTERSECTION;
|
||||
}
|
||||
|
||||
/// Returns the number of intersection points found.
|
||||
//
|
||||
/// This will be either 0, 1 or 2.
|
||||
///
|
||||
size_t
|
||||
getIntersectionNum() const
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// Returns the intIndex'th intersection point
|
||||
//
|
||||
/// @param intIndex is 0 or 1
|
||||
///
|
||||
/// @return the intIndex'th intersection point
|
||||
///
|
||||
const geom::Coordinate&
|
||||
getIntersection(size_t intIndex) const
|
||||
{
|
||||
return intPt[intIndex];
|
||||
}
|
||||
|
||||
/// Returns false if both numbers are zero.
|
||||
//
|
||||
/// @return true if both numbers are positive or if both numbers are negative.
|
||||
///
|
||||
static bool isSameSignAndNonZero(double a, double b);
|
||||
|
||||
/** \brief
|
||||
* Test whether a point is a intersection point of two line segments.
|
||||
*
|
||||
* Note that if the intersection is a line segment, this method only tests for
|
||||
* equality with the endpoints of the intersection segment.
|
||||
* It does <b>not</b> return true if
|
||||
* the input point is internal to the intersection segment.
|
||||
*
|
||||
* @return true if the input point is one of the intersection points.
|
||||
*/
|
||||
bool isIntersection(const geom::Coordinate& pt) const;
|
||||
|
||||
/** \brief
|
||||
* Tests whether an intersection is proper.
|
||||
*
|
||||
* The intersection between two line segments is considered proper if
|
||||
* they intersect in a single point in the interior of both segments
|
||||
* (e.g. the intersection is a single point and is not equal to any of the
|
||||
* endpoints).
|
||||
*
|
||||
* The intersection between a point and a line segment is considered proper
|
||||
* if the point lies in the interior of the segment (e.g. is not equal to
|
||||
* either of the endpoints).
|
||||
*
|
||||
* @return true if the intersection is proper
|
||||
*/
|
||||
bool
|
||||
isProper() const
|
||||
{
|
||||
return hasIntersection() && isProperVar;
|
||||
}
|
||||
|
||||
/** \brief
|
||||
* Computes the intIndex'th intersection point in the direction of
|
||||
* a specified input line segment
|
||||
*
|
||||
* @param segmentIndex is 0 or 1
|
||||
* @param intIndex is 0 or 1
|
||||
*
|
||||
* @return the intIndex'th intersection point in the direction of the
|
||||
* specified input line segment
|
||||
*/
|
||||
const geom::Coordinate& getIntersectionAlongSegment(int segmentIndex, int intIndex);
|
||||
|
||||
/** \brief
|
||||
* Computes the index of the intIndex'th intersection point in the direction of
|
||||
* a specified input line segment
|
||||
*
|
||||
* @param segmentIndex is 0 or 1
|
||||
* @param intIndex is 0 or 1
|
||||
*
|
||||
* @return the index of the intersection point along the segment (0 or 1)
|
||||
*/
|
||||
int getIndexAlongSegment(int segmentIndex, int intIndex);
|
||||
|
||||
/** \brief
|
||||
* Computes the "edge distance" of an intersection point along the specified
|
||||
* input line segment.
|
||||
*
|
||||
* @param geomIndex is 0 or 1
|
||||
* @param intIndex is 0 or 1
|
||||
*
|
||||
* @return the edge distance of the intersection point
|
||||
*/
|
||||
double getEdgeDistance(size_t geomIndex, size_t intIndex) const;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* If makePrecise is true, computed intersection coordinates
|
||||
* will be made precise using Coordinate#makePrecise
|
||||
*/
|
||||
const geom::PrecisionModel* precisionModel;
|
||||
|
||||
size_t result;
|
||||
|
||||
const geom::Coordinate* inputLines[2][2];
|
||||
|
||||
/**
|
||||
* We store real Coordinates here because
|
||||
* we must compute the Z of intersection point.
|
||||
*/
|
||||
geom::Coordinate intPt[2];
|
||||
|
||||
/**
|
||||
* The indexes of the endpoints of the intersection lines, in order along
|
||||
* the corresponding line
|
||||
*/
|
||||
int intLineIndex[2][2];
|
||||
|
||||
bool isProperVar;
|
||||
//Coordinate &pa;
|
||||
//Coordinate &pb;
|
||||
|
||||
bool
|
||||
isCollinear() const
|
||||
{
|
||||
return result == COLLINEAR_INTERSECTION;
|
||||
}
|
||||
|
||||
int computeIntersect(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1, const geom::Coordinate& q2);
|
||||
|
||||
bool
|
||||
isEndPoint() const
|
||||
{
|
||||
return hasIntersection() && !isProperVar;
|
||||
}
|
||||
|
||||
void computeIntLineIndex();
|
||||
|
||||
void computeIntLineIndex(int segmentIndex);
|
||||
|
||||
int computeCollinearIntersection(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1, const geom::Coordinate& q2);
|
||||
|
||||
/** \brief
|
||||
* This method computes the actual value of the intersection point.
|
||||
*
|
||||
* To obtain the maximum precision from the intersection calculation,
|
||||
* the coordinates are normalized by subtracting the minimum
|
||||
* ordinate values (in absolute value). This has the effect of
|
||||
* removing common significant digits from the calculation to
|
||||
* maintain more bits of precision.
|
||||
*/
|
||||
geom::Coordinate intersection(const geom::Coordinate& p1,
|
||||
const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1,
|
||||
const geom::Coordinate& q2) const;
|
||||
|
||||
/**
|
||||
* Test whether a point lies in the envelopes of both input segments.
|
||||
* A correctly computed intersection point should return true
|
||||
* for this test.
|
||||
* Since this test is for debugging purposes only, no attempt is
|
||||
* made to optimize the envelope test.
|
||||
*
|
||||
* @return true if the input point lies within both
|
||||
* input segment envelopes
|
||||
*/
|
||||
bool isInSegmentEnvelopes(const geom::Coordinate& intPt) const;
|
||||
|
||||
|
||||
/**
|
||||
* Computes a segment intersection.
|
||||
* Round-off error can cause the raw computation to fail,
|
||||
* (usually due to the segments being approximately parallel).
|
||||
* If this happens, a reasonable approximation is computed instead.
|
||||
*
|
||||
* @param p1 a segment endpoint
|
||||
* @param p2 a segment endpoint
|
||||
* @param q1 a segment endpoint
|
||||
* @param q2 a segment endpoint
|
||||
* @return the computed intersection point is stored there
|
||||
*/
|
||||
geom::Coordinate intersectionSafe(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q1, const geom::Coordinate& q2) const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_LINEINTERSECTOR_H
|
||||
|
39
include/geos/algorithm/Makefile.am
Обычный файл
39
include/geos/algorithm/Makefile.am
Обычный файл
@ -0,0 +1,39 @@
|
||||
#
|
||||
# This file is part of project GEOS (http://trac.osgeo.org/geos/)
|
||||
#
|
||||
SUBDIRS = \
|
||||
locate \
|
||||
distance \
|
||||
ttmath
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
geosdir = $(includedir)/geos/algorithm
|
||||
|
||||
geos_HEADERS = \
|
||||
Angle.h \
|
||||
Area.h \
|
||||
BoundaryNodeRule.h \
|
||||
CGAlgorithmsDD.h \
|
||||
CentralEndpointIntersector.h \
|
||||
Centroid.h \
|
||||
ConvexHull.h \
|
||||
ConvexHull.inl \
|
||||
Distance.h \
|
||||
HCoordinate.h \
|
||||
InteriorPointArea.h \
|
||||
InteriorPointLine.h \
|
||||
InteriorPointPoint.h \
|
||||
Intersection.h \
|
||||
Length.h \
|
||||
LineIntersector.h \
|
||||
MinimumBoundingCircle.h \
|
||||
MinimumDiameter.h \
|
||||
NotRepresentableException.h \
|
||||
Orientation.h \
|
||||
PointLocation.h \
|
||||
PointLocator.h \
|
||||
RayCrossingCounter.h \
|
||||
RayCrossingCounterDD.h \
|
||||
RobustDeterminant.h
|
||||
|
139
include/geos/algorithm/MinimumBoundingCircle.h
Обычный файл
139
include/geos/algorithm/MinimumBoundingCircle.h
Обычный файл
@ -0,0 +1,139 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2019 Paul Ramsey <pramsey@cleverelephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/MinimumBoundingCircle.java 2019-01-23
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_MINIMUMBOUNDINGCIRCLE_H
|
||||
#define GEOS_ALGORITHM_MINIMUMBOUNDINGCIRCLE_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
#include <geos/geom/Geometry.h>
|
||||
#include <geos/geom/Point.h>
|
||||
#include <geos/geom/Triangle.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Forward declarations
|
||||
// namespace geos {
|
||||
// namespace geom {
|
||||
// class GeometryCollection;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
class GEOS_DLL MinimumBoundingCircle {
|
||||
|
||||
private:
|
||||
|
||||
// member variables
|
||||
const geom::Geometry* input;
|
||||
std::vector<geom::Coordinate> extremalPts;
|
||||
geom::Coordinate centre;
|
||||
double radius;
|
||||
|
||||
void computeCentre();
|
||||
void compute();
|
||||
void computeCirclePoints();
|
||||
geom::Coordinate lowestPoint(std::vector<geom::Coordinate>& pts);
|
||||
geom::Coordinate pointWitMinAngleWithX(std::vector<geom::Coordinate>& pts, geom::Coordinate& P);
|
||||
geom::Coordinate pointWithMinAngleWithSegment(std::vector<geom::Coordinate>& pts,
|
||||
geom::Coordinate& P, geom::Coordinate& Q);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
MinimumBoundingCircle(const geom::Geometry* geom):
|
||||
input(nullptr),
|
||||
radius(0.0)
|
||||
{
|
||||
input = geom;
|
||||
centre.setNull();
|
||||
}
|
||||
|
||||
~MinimumBoundingCircle() {};
|
||||
|
||||
/**
|
||||
* Gets a geometry which represents the Minimum Bounding Circle.
|
||||
* If the input is degenerate (empty or a single unique point),
|
||||
* this method will return an empty geometry or a single Point geometry.
|
||||
* Otherwise, a Polygon will be returned which approximates the
|
||||
* Minimum Bounding Circle.
|
||||
* (Note that because the computed polygon is only an approximation,
|
||||
* it may not precisely contain all the input points.)
|
||||
*
|
||||
* @return a Geometry representing the Minimum Bounding Circle.
|
||||
*/
|
||||
std::unique_ptr<geom::Geometry> getCircle();
|
||||
|
||||
/**
|
||||
* Gets a geometry representing a line between the two farthest points
|
||||
* in the input.
|
||||
* These points will be two of the extremal points of the Minimum Bounding Circle.
|
||||
* They also lie on the convex hull of the input.
|
||||
*
|
||||
* @return a LineString between the two farthest points of the input
|
||||
* @return a empty LineString if the input is empty
|
||||
* @return a Point if the input is a point
|
||||
*/
|
||||
std::unique_ptr<geom::Geometry> getFarthestPoints();
|
||||
|
||||
/**
|
||||
* Gets a geometry representing the diameter of the computed Minimum Bounding
|
||||
* Circle.
|
||||
*
|
||||
* @return the diameter LineString of the Minimum Bounding Circle
|
||||
* @return a empty LineString if the input is empty
|
||||
* @return a Point if the input is a point
|
||||
*/
|
||||
std::unique_ptr<geom::Geometry> getDiameter();
|
||||
|
||||
/**
|
||||
* Gets the extremal points which define the computed Minimum Bounding Circle.
|
||||
* There may be zero, one, two or three of these points,
|
||||
* depending on the number of points in the input
|
||||
* and the geometry of those points.
|
||||
*
|
||||
* @return the points defining the Minimum Bounding Circle
|
||||
*/
|
||||
std::vector<geom::Coordinate> getExtremalPoints();
|
||||
|
||||
/**
|
||||
* Gets the centre point of the computed Minimum Bounding Circle.
|
||||
*
|
||||
* @return the centre point of the Minimum Bounding Circle
|
||||
* @return null if the input is empty
|
||||
*/
|
||||
geom::Coordinate getCentre();
|
||||
|
||||
/**
|
||||
* Gets the radius of the computed Minimum Bounding Circle.
|
||||
*
|
||||
* @return the radius of the Minimum Bounding Circle
|
||||
*/
|
||||
double getRadius();
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_MINIMUMBOUNDINGCIRCLE_H
|
||||
|
180
include/geos/algorithm/MinimumDiameter.h
Обычный файл
180
include/geos/algorithm/MinimumDiameter.h
Обычный файл
@ -0,0 +1,180 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/MinimumDiameter.java r966
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H
|
||||
#define GEOS_ALGORITHM_MINIMUMDIAMETER_H
|
||||
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/LineSegment.h>
|
||||
|
||||
#include <memory>
|
||||
#include <geos/export.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Geometry;
|
||||
class LineString;
|
||||
class CoordinateSequence;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* Computes the minimum diameter of a geom::Geometry
|
||||
*
|
||||
* The minimum diameter is defined to be the width of the smallest band that
|
||||
* contains the geometry, where a band is a strip of the plane defined
|
||||
* by two parallel lines. This can be thought of as the smallest hole
|
||||
* that the geometry can be moved through, with a single rotation.
|
||||
*
|
||||
* The first step in the algorithm is computing the convex hull of the Geometry.
|
||||
* If the input Geometry is known to be convex, a hint can be supplied to
|
||||
* avoid this computation.
|
||||
*
|
||||
* This class can also be used to compute a line segment representing
|
||||
* the minimum diameter, the supporting line segment of the minimum diameter,
|
||||
* and a minimum rectangle enclosing the input geometry.
|
||||
* This rectangle will have width equal to the minimum diameter, and have
|
||||
* one side parallel to the supporting segment.
|
||||
*
|
||||
* @see ConvexHull
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL MinimumDiameter {
|
||||
private:
|
||||
const geom::Geometry* inputGeom;
|
||||
bool isConvex;
|
||||
|
||||
std::unique_ptr<geom::CoordinateSequence> convexHullPts;
|
||||
|
||||
geom::LineSegment minBaseSeg;
|
||||
geom::Coordinate minWidthPt;
|
||||
size_t minPtIndex;
|
||||
double minWidth;
|
||||
void computeMinimumDiameter();
|
||||
void computeWidthConvex(const geom::Geometry* geom);
|
||||
|
||||
/**
|
||||
* Compute the width information for a ring of {@link geom::Coordinate}s.
|
||||
* Leaves the width information in the instance variables.
|
||||
*
|
||||
* @param pts
|
||||
* @return
|
||||
*/
|
||||
void computeConvexRingMinDiameter(const geom::CoordinateSequence* pts);
|
||||
|
||||
unsigned int findMaxPerpDistance(const geom::CoordinateSequence* pts,
|
||||
const geom::LineSegment* seg, unsigned int startIndex);
|
||||
|
||||
static unsigned int getNextIndex(const geom::CoordinateSequence* pts,
|
||||
unsigned int index);
|
||||
|
||||
static double computeC(double a, double b, const geom::Coordinate& p);
|
||||
|
||||
static geom::LineSegment computeSegmentForLine(double a, double b, double c);
|
||||
|
||||
public:
|
||||
~MinimumDiameter() = default;
|
||||
|
||||
/** \brief
|
||||
* Compute a minimum diameter for a given [Geometry](@ref geom::Geometry).
|
||||
*
|
||||
* @param newInputGeom a Geometry
|
||||
*/
|
||||
MinimumDiameter(const geom::Geometry* newInputGeom);
|
||||
|
||||
/** \brief
|
||||
* Compute a minimum diameter for a given Geometry,
|
||||
* with a hint if the Geometry is convex
|
||||
* (e.g. a convex Polygon or LinearRing,
|
||||
* or a two-point LineString, or a Point).
|
||||
*
|
||||
* @param newInputGeom a Geometry which is convex
|
||||
* @param newIsConvex `true` if the input geometry is convex
|
||||
*/
|
||||
MinimumDiameter(const geom::Geometry* newInputGeom,
|
||||
const bool newIsConvex);
|
||||
|
||||
/** \brief
|
||||
* Gets the length of the minimum diameter of the input Geometry.
|
||||
*
|
||||
* @return the length of the minimum diameter
|
||||
*/
|
||||
double getLength();
|
||||
|
||||
/** \brief
|
||||
* Gets the {@link geom::Coordinate} forming one end of the minimum diameter.
|
||||
*
|
||||
* @return a coordinate forming one end of the minimum diameter
|
||||
*/
|
||||
const geom::Coordinate& getWidthCoordinate();
|
||||
|
||||
/** \brief
|
||||
* Gets the segment forming the base of the minimum diameter.
|
||||
*
|
||||
* @return the segment forming the base of the minimum diameter
|
||||
*/
|
||||
std::unique_ptr<geom::LineString> getSupportingSegment();
|
||||
|
||||
/** \brief
|
||||
* Gets a LineString which is a minimum diameter.
|
||||
*
|
||||
* @return a LineString which is a minimum diameter
|
||||
*/
|
||||
std::unique_ptr<geom::LineString> getDiameter();
|
||||
|
||||
/** \brief
|
||||
* Gets the minimum rectangular Polygon which encloses the input geometry.
|
||||
*
|
||||
* The rectangle has width equal to the minimum diameter, and a longer
|
||||
* length. If the convex hill of the input is degenerate (a line or point)
|
||||
* a LineString or Point is returned.
|
||||
* The minimum rectangle can be used as an extremely generalized
|
||||
* representation for the given geometry.
|
||||
*
|
||||
* @return the minimum rectangle enclosing the input (or a line or point if degenerate)
|
||||
*/
|
||||
std::unique_ptr<geom::Geometry> getMinimumRectangle();
|
||||
|
||||
/** \brief
|
||||
* Gets the minimum rectangle enclosing a geometry.
|
||||
*
|
||||
* @param geom the geometry
|
||||
* @return the minimum rectangle enclosing the geometry
|
||||
*/
|
||||
static std::unique_ptr<geom::Geometry> getMinimumRectangle(geom::Geometry* geom);
|
||||
|
||||
/** \brief
|
||||
* Gets the length of the minimum diameter enclosing a geometry.
|
||||
* @param geom the geometry
|
||||
* @return the length of the minimum diameter of the geometry
|
||||
*/
|
||||
static std::unique_ptr<geom::Geometry> getMinimumDiameter(geom::Geometry* geom);
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H
|
||||
|
46
include/geos/algorithm/NotRepresentableException.h
Обычный файл
46
include/geos/algorithm/NotRepresentableException.h
Обычный файл
@ -0,0 +1,46 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_NOTREPRESENTABLEEXCEPTION_H
|
||||
#define GEOS_ALGORITHM_NOTREPRESENTABLEEXCEPTION_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <string>
|
||||
#include <geos/util/GEOSException.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* \class NotRepresentableException geosAlgorithm.h geos/geosAlgorithm.h
|
||||
* \brief
|
||||
* Indicates that a HCoordinate has been computed which is
|
||||
* not representable on the Cartesian plane.
|
||||
*
|
||||
* @version 1.4
|
||||
* @see HCoordinate
|
||||
*/
|
||||
class GEOS_DLL NotRepresentableException: public util::GEOSException {
|
||||
public:
|
||||
NotRepresentableException();
|
||||
NotRepresentableException(std::string msg);
|
||||
~NotRepresentableException() throw() override {}
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
#endif
|
||||
|
96
include/geos/algorithm/Orientation.h
Обычный файл
96
include/geos/algorithm/Orientation.h
Обычный файл
@ -0,0 +1,96 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2018 Paul Ramsey <pramsey@cleverlephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/Orientation.java @ 2017-09-04
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_ORIENTATION_H
|
||||
#define GEOS_ALGORITHM_ORIENTATION_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* Functions to compute the orientation of basic geometric structures
|
||||
* including point triplets (triangles) and rings.
|
||||
*
|
||||
* Orientation is a fundamental property of planar geometries
|
||||
* (and more generally geometry on two-dimensional manifolds).
|
||||
*
|
||||
* Orientation is notoriously subject to numerical precision errors
|
||||
* in the case of collinear or nearly collinear points.
|
||||
* JTS uses extended-precision arithmetic to increase
|
||||
* the robustness of the computation.
|
||||
*
|
||||
* @author Martin Davis
|
||||
*/
|
||||
class GEOS_DLL Orientation {
|
||||
public:
|
||||
|
||||
/* A value that indicates an orientation or turn */
|
||||
enum {
|
||||
CLOCKWISE = -1,
|
||||
COLLINEAR = 0,
|
||||
COUNTERCLOCKWISE = 1,
|
||||
RIGHT = -1,
|
||||
LEFT = 1,
|
||||
STRAIGHT = 0
|
||||
};
|
||||
|
||||
/** \brief
|
||||
* Returns the orientation index of the direction of the point q relative to
|
||||
* a directed infinite line specified by p1-p2.
|
||||
*
|
||||
* The index indicates whether the point lies to the
|
||||
* `Orientation::LEFT` or `Orientation::RIGHT`
|
||||
* of the line, or lies on it `Orientation::COLLINEAR`.
|
||||
* The index also indicates the orientation of the triangle formed
|
||||
* by the three points
|
||||
* ( `Orientation::COUNTERCLOCKWISE`,
|
||||
* `Orientation::CLOCKWISE`, or `Orientation::STRAIGHT` )
|
||||
*/
|
||||
static int index(const geom::Coordinate& p1, const geom::Coordinate& p2,
|
||||
const geom::Coordinate& q);
|
||||
|
||||
/** \brief
|
||||
* Computes whether a ring defined by an array of
|
||||
* [Coordinates](@ref geom::Coordinate) is oriented counter-clockwise.
|
||||
*
|
||||
* - The list of points is assumed to have the first and last points equal.
|
||||
* - This will handle coordinate lists which contain repeated points.
|
||||
*
|
||||
* This algorithm is *only* guaranteed to work with valid rings. If the
|
||||
* ring is invalid (e.g. self-crosses or touches), the computed result may not
|
||||
* be correct.
|
||||
*
|
||||
* @param ring an array of Coordinates forming a ring
|
||||
* @return `true` if the ring is oriented counter-clockwise.
|
||||
* @throws IllegalArgumentException
|
||||
* if there are too few points to determine orientation (< 4)
|
||||
*/
|
||||
static bool isCCW(const geom::CoordinateSequence* ring);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_ORIENTATION_H
|
43
include/geos/algorithm/PointInRing.h
Обычный файл
43
include/geos/algorithm/PointInRing.h
Обычный файл
@ -0,0 +1,43 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2006 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_POINTINRING_H
|
||||
#define GEOS_ALGORITHM_POINTINRING_H
|
||||
|
||||
#include <geos/export.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Coordinate;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
class GEOS_DLL PointInRing {
|
||||
public:
|
||||
virtual
|
||||
~PointInRing() {}
|
||||
virtual bool isInside(const geom::Coordinate& pt) = 0;
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif
|
||||
|
92
include/geos/algorithm/PointLocation.h
Обычный файл
92
include/geos/algorithm/PointLocation.h
Обычный файл
@ -0,0 +1,92 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2018 Paul Ramsey <pramsey@cleverlephant.ca>
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/PointLocation.java @ 2017-09-04
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_POINTLOCATION_H
|
||||
#define GEOS_ALGORITHM_POINTLOCATION_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
#include <geos/geom/Location.h>
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/** \brief
|
||||
* Functions for locating points within basic geometric
|
||||
* structures such as lines and rings.
|
||||
*
|
||||
* @author Martin Davis
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL PointLocation {
|
||||
public:
|
||||
|
||||
/** \brief
|
||||
* Tests whether a point lies on the line defined by a
|
||||
* [CoordinateSequence](@ref geom::CoordinateSequence).
|
||||
*
|
||||
* @param p the point to test
|
||||
* @param line the line coordinates
|
||||
* @return true if the point is a vertex of the line or lies in the interior
|
||||
* of a line segment in the line
|
||||
*/
|
||||
static bool isOnLine(const geom::Coordinate& p, const geom::CoordinateSequence* line);
|
||||
|
||||
/** \brief
|
||||
* Tests whether a point lies inside or on a ring.
|
||||
*
|
||||
* The ring may be oriented in either direction. A point lying exactly
|
||||
* on the ring boundary is considered to be inside the ring.
|
||||
*
|
||||
* This method does **not** first check the point against the envelope of
|
||||
* the ring.
|
||||
*
|
||||
* @param p point to check for ring inclusion
|
||||
* @param ring an array of coordinates representing the ring (which must have
|
||||
* first point identical to last point)
|
||||
* @return `true` if p is inside ring
|
||||
*
|
||||
* @see RayCrossingCounter::locatePointInRing()
|
||||
*/
|
||||
static bool isInRing(const geom::Coordinate& p, const std::vector<const geom::Coordinate*>& ring);
|
||||
static bool isInRing(const geom::Coordinate& p, const geom::CoordinateSequence* ring);
|
||||
|
||||
/** \brief
|
||||
* Determines whether a point lies in the interior, on the boundary, or in the
|
||||
* exterior of a ring. The ring may be oriented in either direction.
|
||||
*
|
||||
* This method does *not* first check the point against the envelope of
|
||||
* the ring.
|
||||
*
|
||||
* @param p point to check for ring inclusion
|
||||
* @param ring an array of coordinates representing the ring (which must have
|
||||
* first point identical to last point)
|
||||
* @return the [Location](@ref geom::Location) of p relative to the ring
|
||||
*/
|
||||
static geom::Location locateInRing(const geom::Coordinate& p, const std::vector<const geom::Coordinate*>& ring);
|
||||
static geom::Location locateInRing(const geom::Coordinate& p, const geom::CoordinateSequence& ring);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_POINTLOCATION_H
|
111
include/geos/algorithm/PointLocator.h
Обычный файл
111
include/geos/algorithm/PointLocator.h
Обычный файл
@ -0,0 +1,111 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* GEOS - Geometry Engine Open Source
|
||||
* http://geos.osgeo.org
|
||||
*
|
||||
* Copyright (C) 2005-2011 Refractions Research Inc.
|
||||
* Copyright (C) 2001-2002 Vivid Solutions Inc.
|
||||
*
|
||||
* This is free software; you can redistribute and/or modify it under
|
||||
* the terms of the GNU Lesser General Public Licence as published
|
||||
* by the Free Software Foundation.
|
||||
* See the COPYING file for more information.
|
||||
*
|
||||
**********************************************************************
|
||||
*
|
||||
* Last port: algorithm/PointLocator.java 95fbe34b (JTS-1.15.2-SNAPSHOT)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef GEOS_ALGORITHM_POINTLOCATOR_H
|
||||
#define GEOS_ALGORITHM_POINTLOCATOR_H
|
||||
|
||||
#include <geos/export.h>
|
||||
#include <geos/geom/Location.h> // for inlines
|
||||
|
||||
// Forward declarations
|
||||
namespace geos {
|
||||
namespace geom {
|
||||
class Coordinate;
|
||||
class Geometry;
|
||||
class LinearRing;
|
||||
class LineString;
|
||||
class Polygon;
|
||||
class Point;
|
||||
}
|
||||
}
|
||||
|
||||
namespace geos {
|
||||
namespace algorithm { // geos::algorithm
|
||||
|
||||
/**
|
||||
* \class PointLocator geosAlgorithm.h geos/geosAlgorithm.h
|
||||
*
|
||||
* \brief
|
||||
* Computes the topological relationship (Location)
|
||||
* of a single point to a Geometry.
|
||||
*
|
||||
* The algorithm obeys the SFS boundaryDetermination rule to correctly determine
|
||||
* whether the point lies on the boundary or not.
|
||||
*
|
||||
* Notes:
|
||||
* - instances of this class are not reentrant.
|
||||
* - LinearRing objects do not enclose any area
|
||||
* (points inside the ring are still in the EXTERIOR of the ring.)
|
||||
*
|
||||
*/
|
||||
class GEOS_DLL PointLocator {
|
||||
public:
|
||||
PointLocator() {}
|
||||
~PointLocator() {}
|
||||
|
||||
/**
|
||||
* Computes the topological relationship (Location) of a single point
|
||||
* to a Geometry. It handles both single-element and multi-element Geometries.
|
||||
* The algorithm for multi-part Geometriestakes into account the SFS
|
||||
* Boundary Determination rule.
|
||||
*
|
||||
* @return the Location of the point relative to the input Geometry
|
||||
*/
|
||||
geom::Location locate(const geom::Coordinate& p, const geom::Geometry* geom);
|
||||
|
||||
/**
|
||||
* Convenience method to test a point for intersection with
|
||||
* a Geometry
|
||||
*
|
||||
* @param p the coordinate to test
|
||||
* @param geom the Geometry to test
|
||||
* @return <code>true</code> if the point is in the interior or boundary of the Geometry
|
||||
*/
|
||||
bool
|
||||
intersects(const geom::Coordinate& p, const geom::Geometry* geom)
|
||||
{
|
||||
return locate(p, geom) != geom::Location::EXTERIOR;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
bool isIn; // true if the point lies in or on any Geometry element
|
||||
|
||||
int numBoundaries; // the number of sub-elements whose boundaries the point lies in
|
||||
|
||||
void computeLocation(const geom::Coordinate& p, const geom::Geometry* geom);
|
||||
|
||||
void updateLocationInfo(geom::Location loc);
|
||||
|
||||
geom::Location locate(const geom::Coordinate& p, const geom::Point* pt);
|
||||
|
||||
geom::Location locate(const geom::Coordinate& p, const geom::LineString* l);
|
||||
|
||||
geom::Location locateInPolygonRing(const geom::Coordinate& p, const geom::LinearRing* ring);
|
||||
|
||||
geom::Location locate(const geom::Coordinate& p, const geom::Polygon* poly);
|
||||
|
||||
};
|
||||
|
||||
} // namespace geos::algorithm
|
||||
} // namespace geos
|
||||
|
||||
|
||||
#endif // GEOS_ALGORITHM_POINTLOCATOR_H
|
||||
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
x
Ссылка в новой задаче
Block a user