Merge commit 'a3a7a822e136d2357660d85124d8e7bb26ea6f7c' into subtrees-protozero-vtzero
This commit is contained in:
commit
3a9acde2c3
90
third_party/libosmium/.clang-tidy
vendored
Normal file
90
third_party/libosmium/.clang-tidy
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
Checks: '*,-android-cloexec-*,-cert-dcl21-cpp,-cert-err58-cpp,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-misc-macro-parentheses,-misc-unused-parameters,-modernize-make-unique,-modernize-raw-string-literal,-readability-avoid-const-params-in-decls,-readability-implicit-bool-cast,-readability-implicit-bool-conversion'
|
||||||
|
#
|
||||||
|
# For a list of check options, see:
|
||||||
|
# http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||||
|
#
|
||||||
|
# Disabled checks:
|
||||||
|
#
|
||||||
|
# android-cloexec-*
|
||||||
|
# O_CLOEXEC isn't available on Windows making this non-portable.
|
||||||
|
#
|
||||||
|
# cert-dcl21-cpp
|
||||||
|
# It is unclear whether this is still a good recommendation in modern C++.
|
||||||
|
#
|
||||||
|
# cert-err58-cpp
|
||||||
|
# Used in several singelton factory functions. I don't know of a better
|
||||||
|
# way to do this and it is rather unlikely that this will be a problem.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-owning-memory
|
||||||
|
# Don't want to add dependency on gsl library.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-bounds-array-to-pointer-decay
|
||||||
|
# Limited use and many false positives including for all asserts.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-bounds-constant-array-index
|
||||||
|
# Is needed for low-level code.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-bounds-pointer-arithmetic
|
||||||
|
# This is a low-level library, it needs to do pointer arithmetic.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-type-const-cast
|
||||||
|
# When you need it, you need it.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-type-reinterpret-cast
|
||||||
|
# This is a low-level library, it needs to do reinterpret-casts.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-type-static-cast-downcast
|
||||||
|
# This is needed and totally okay if we are sure about the types.
|
||||||
|
#
|
||||||
|
# cppcoreguidelines-pro-type-vararg
|
||||||
|
# We need some of these functions at least and for some functions it isn't
|
||||||
|
# even clear that those are vararg functions.
|
||||||
|
#
|
||||||
|
# fuchsia-*
|
||||||
|
# Much too strict.
|
||||||
|
#
|
||||||
|
# google-runtime-references
|
||||||
|
# This is just a matter of preference, and we can't change the interfaces
|
||||||
|
# now anyways.
|
||||||
|
#
|
||||||
|
# hicpp-invalid-access-moved
|
||||||
|
# Creates false positives.
|
||||||
|
#
|
||||||
|
# hicpp-no-array-decay
|
||||||
|
# Alias for cppcoreguidelines-pro-bounds-array-to-pointer-decay.
|
||||||
|
#
|
||||||
|
# hicpp-no-assembler
|
||||||
|
# Reports are from macros we don't have any control over.
|
||||||
|
#
|
||||||
|
# hicpp-vararg
|
||||||
|
# Too strict, sometimes calling vararg functions is necessary.
|
||||||
|
#
|
||||||
|
# misc-macro-parentheses
|
||||||
|
# False positive in the only place where it reports something and
|
||||||
|
# disabling locally doesn't work.
|
||||||
|
#
|
||||||
|
# misc-unused-parameters
|
||||||
|
# Can't be fixed, because then Doxygen will complain. (In file
|
||||||
|
# include/osmium/area/problem_reporter.hpp).
|
||||||
|
#
|
||||||
|
# modernize-make-unique
|
||||||
|
# This is a C++11 library and C++ doesn't have std::make_unique.
|
||||||
|
#
|
||||||
|
# modernize-raw-string-literal
|
||||||
|
# Readability isn't that much better, arguably worse because of the new
|
||||||
|
# syntax.
|
||||||
|
#
|
||||||
|
# readability-avoid-const-params-in-decls
|
||||||
|
# This is header only library, so the declaration and implementation are
|
||||||
|
# often the same and we want to have the const in implementations.
|
||||||
|
#
|
||||||
|
# readability-implicit-bool-cast
|
||||||
|
# Old name for readability-implicit-bool-conversion.
|
||||||
|
#
|
||||||
|
# readability-implicit-bool-conversion
|
||||||
|
# I don't think this makes the code more readable.
|
||||||
|
#
|
||||||
|
#WarningsAsErrors: '*'
|
||||||
|
HeaderFilterRegex: '\/include\/osmium\/.*'
|
||||||
|
...
|
3
third_party/libosmium/.gitmodules
vendored
Normal file
3
third_party/libosmium/.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "test/data-tests/osm-testdata"]
|
||||||
|
path = test/data-tests/osm-testdata
|
||||||
|
url = https://github.com/osmcode/osm-testdata
|
235
third_party/libosmium/.travis.yml
vendored
235
third_party/libosmium/.travis.yml
vendored
@ -8,6 +8,10 @@ language: generic
|
|||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.ccache
|
- $HOME/.ccache
|
||||||
@ -18,176 +22,195 @@ env:
|
|||||||
- CCACHE_COMPRESS=1
|
- CCACHE_COMPRESS=1
|
||||||
- CASHER_TIME_OUT=1000
|
- CASHER_TIME_OUT=1000
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Save common build configurations as shortcuts, so we can reference them later.
|
||||||
|
addons_shortcuts:
|
||||||
|
addons_clang35: &clang35
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.5']
|
||||||
|
addons_clang38: &clang38
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.8']
|
||||||
|
addons_clang39: &clang39
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.9']
|
||||||
|
addons_clang40: &clang40
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest', 'llvm-toolchain-trusty-4.0' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-4.0']
|
||||||
|
addons_clang50: &clang50
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest', 'llvm-toolchain-trusty-5.0' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-5.0', 'g++-6', 'gcc-6']
|
||||||
|
addons_gcc48: &gcc48
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.8', 'gcc-4.8' ]
|
||||||
|
addons_gcc49: &gcc49
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.9', 'gcc-4.9' ]
|
||||||
|
addons_gcc5: &gcc5
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-5', 'gcc-5' ]
|
||||||
|
addons_gcc6: &gcc6
|
||||||
|
apt:
|
||||||
|
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ]
|
||||||
|
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-6', 'gcc-6' ]
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|
||||||
# 1/ Linux Clang Builds
|
# 1/ Linux Clang Builds
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-clang35-release
|
compiler: linux-clang35-release
|
||||||
addons:
|
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Release'
|
||||||
apt:
|
addons: *clang35
|
||||||
sources: ['llvm-toolchain-precise-3.5', 'ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['clang-3.5', 'cmake', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='clang++-3.5' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-clang35-dev
|
compiler: linux-clang35-dev
|
||||||
addons:
|
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Dev'
|
||||||
apt:
|
addons: *clang35
|
||||||
sources: ['llvm-toolchain-precise-3.5', 'ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['clang-3.5', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='clang++-3.5' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: linux-clang37-release
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['llvm-toolchain-precise-3.7', 'ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['clang-3.7', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='clang++-3.7' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: linux-clang37-dev
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['llvm-toolchain-precise-3.7', 'ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['clang-3.7', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='clang++-3.7' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-clang38-release
|
compiler: linux-clang38-release
|
||||||
addons:
|
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Release'
|
||||||
apt:
|
addons: *clang38
|
||||||
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['clang-3.8', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='clang++-3.8' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-clang38-dev
|
compiler: linux-clang38-dev
|
||||||
addons:
|
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Dev'
|
||||||
apt:
|
addons: *clang38
|
||||||
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['clang-3.8', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='clang++-3.8' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: linux-clang39-release
|
||||||
|
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Release'
|
||||||
|
addons: *clang39
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: linux-clang39-dev
|
||||||
|
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Dev'
|
||||||
|
addons: *clang39
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: linux-clang40-release
|
||||||
|
env: CC='clang-4.0' CXX='clang++-4.0' BUILD_TYPE='Release'
|
||||||
|
addons: *clang40
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: linux-clang40-dev
|
||||||
|
env: CC='clang-4.0' CXX='clang++-4.0' BUILD_TYPE='Dev'
|
||||||
|
addons: *clang40
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: linux-clang50-release
|
||||||
|
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Release'
|
||||||
|
addons: *clang50
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: linux-clang50-dev
|
||||||
|
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Dev'
|
||||||
|
addons: *clang50
|
||||||
|
|
||||||
|
# Disabled because it creates false-positives on the old travis systems
|
||||||
|
# - os: linux
|
||||||
|
# compiler: linux-clang50-debug
|
||||||
|
# env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Debug'
|
||||||
|
# CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
|
||||||
|
# LDFLAGS="-fsanitize=address,undefined,integer"
|
||||||
|
# # LSAN doesn't work on container-based system
|
||||||
|
# sudo: required
|
||||||
|
# addons: *clang50
|
||||||
|
|
||||||
# 2/ Linux GCC Builds
|
# 2/ Linux GCC Builds
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc48-release
|
compiler: linux-gcc48-release
|
||||||
addons:
|
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Release'
|
||||||
apt:
|
CXXFLAGS='-Wno-return-type'
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
addons: *gcc48
|
||||||
packages: ['g++-4.8', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-4.8' COMPILER_FLAGS='-Wno-return-type' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc48-dev
|
compiler: linux-gcc48-dev
|
||||||
addons:
|
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Dev'
|
||||||
apt:
|
CXXFLAGS='-Wno-return-type'
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
addons: *gcc48
|
||||||
packages: ['g++-4.8', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-4.8' COMPILER_FLAGS='-Wno-return-type' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc49-release
|
compiler: linux-gcc49-release
|
||||||
addons:
|
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Release'
|
||||||
apt:
|
addons: *gcc49
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-4.9', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-4.9' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc49-dev
|
compiler: linux-gcc49-dev
|
||||||
addons:
|
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Dev'
|
||||||
apt:
|
addons: *gcc49
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-4.9', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-4.9' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc5-release
|
compiler: linux-gcc5-release
|
||||||
addons:
|
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Release'
|
||||||
apt:
|
addons: *gcc5
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-5', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-5' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc5-dev
|
compiler: linux-gcc5-dev
|
||||||
addons:
|
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Dev'
|
||||||
apt:
|
addons: *gcc5
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-5', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-5' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc6-release
|
compiler: linux-gcc6-release
|
||||||
addons:
|
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Release'
|
||||||
apt:
|
addons: *gcc6
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-6', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-6' BUILD_TYPE='Release'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc6-dev
|
compiler: linux-gcc6-dev
|
||||||
addons:
|
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Dev'
|
||||||
apt:
|
addons: *gcc6
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-6', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-6' BUILD_TYPE='Dev'
|
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: linux-gcc6-coverage
|
compiler: linux-gcc6-coverage
|
||||||
addons:
|
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Coverage'
|
||||||
apt:
|
addons: *gcc6
|
||||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
|
||||||
packages: ['g++-6', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
|
||||||
env: COMPILER='g++-6' BUILD_TYPE='Coverage'
|
|
||||||
|
|
||||||
|
|
||||||
# 3/ OSX Clang Builds
|
# 3/ OSX Clang Builds
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode6.4
|
osx_image: xcode6.4
|
||||||
compiler: xcode64-clang-release
|
compiler: xcode64-clang-release
|
||||||
env: COMPILER='clang++' BUILD_TYPE='Release'
|
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode6.4
|
osx_image: xcode6.4
|
||||||
compiler: xcode64-clang-dev
|
compiler: xcode64-clang-dev
|
||||||
env: COMPILER='clang++' BUILD_TYPE='Dev'
|
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
|
||||||
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7
|
osx_image: xcode7
|
||||||
compiler: xcode7-clang-release
|
compiler: xcode7-clang-release
|
||||||
env: COMPILER='clang++' BUILD_TYPE='Release'
|
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7
|
osx_image: xcode7
|
||||||
compiler: xcode7-clang-dev
|
compiler: xcode7-clang-dev
|
||||||
env: COMPILER='clang++' BUILD_TYPE='Dev'
|
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
|
||||||
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8.3
|
osx_image: xcode8.3
|
||||||
compiler: xcode8-clang-release
|
compiler: xcode8-clang-release
|
||||||
env: COMPILER='clang++' BUILD_TYPE='Release'
|
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8.3
|
osx_image: xcode8.3
|
||||||
compiler: xcode8-clang-dev
|
compiler: xcode8-clang-dev
|
||||||
env: COMPILER='clang++' BUILD_TYPE='Dev'
|
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
|
||||||
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
- git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero
|
||||||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
|
||||||
- git clone --quiet --depth 1 https://github.com/osmcode/osm-testdata.git
|
|
||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
brew remove gdal
|
brew remove gdal
|
||||||
@ -197,8 +220,9 @@ install:
|
|||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
|
- git submodule update --init
|
||||||
- mkdir build && cd build
|
- mkdir build && cd build
|
||||||
- CXX=${COMPILER} CXXFLAGS=${COMPILER_FLAGS} cmake -LA .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_WITH_CCACHE=1 -DOSM_TESTDATA="${TRAVIS_BUILD_DIR}/deps/osm-testdata"
|
- cmake -LA .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_DATA_TESTS=ON -DBUILD_WITH_CCACHE=1
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make VERBOSE=1 && ctest --output-on-failure
|
- make VERBOSE=1 && ctest --output-on-failure
|
||||||
@ -208,11 +232,12 @@ after_success:
|
|||||||
if [ "${BUILD_TYPE}" = "Coverage" ]; then
|
if [ "${BUILD_TYPE}" = "Coverage" ]; then
|
||||||
curl -S -f https://codecov.io/bash -o codecov
|
curl -S -f https://codecov.io/bash -o codecov
|
||||||
chmod +x codecov
|
chmod +x codecov
|
||||||
gcov-${COMPILER#g++-} -p $(find test/CMakeFiles -name '*.o')
|
gcov-${CXX#g++-} -p $(find test/CMakeFiles -name '*.o')
|
||||||
./codecov -Z -c -F unit_tests
|
./codecov -Z -c -X gcov -F unit_tests
|
||||||
gcov-${COMPILER#g++-} -p $(find test/data-tests -name '*.o')
|
gcov-${CXX#g++-} -p $(find test/data-tests -name '*.o')
|
||||||
./codecov -Z -c -F data_tests
|
./codecov -Z -c -X gcov -F data_tests
|
||||||
gcov-${COMPILER#g++-} -p $(find examples -name '*.o')
|
gcov-${CXX#g++-} -p $(find examples -name '*.o')
|
||||||
./codecov -Z -c -F examples
|
./codecov -Z -c -X gcov -F examples
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
89
third_party/libosmium/CHANGELOG.md
vendored
89
third_party/libosmium/CHANGELOG.md
vendored
@ -2,7 +2,7 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](https://semver.org/).
|
||||||
|
|
||||||
## [unreleased] -
|
## [unreleased] -
|
||||||
|
|
||||||
@ -13,6 +13,90 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
||||||
|
## [2.14.0] - 2018-03-31
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Add `ReaderWithProgressBar` class. This wraps an `osmium::io::Reader` and an
|
||||||
|
`osmium::ProgressBar` into a nice little package allowing easier use in the
|
||||||
|
common case.
|
||||||
|
* Add polygon implementation for WKT and GeoJSON geometry factories. (Thanks
|
||||||
|
to Horace Williams.)
|
||||||
|
* Various tests.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* Add git submodule with `osm-testdata` repository. Before this the repository
|
||||||
|
had to be installed externally. Now a submodule update can be used to get the
|
||||||
|
correct version of the osm-testdata repository.
|
||||||
|
* The XML file reader was rewritten to be more strict. Cases where it could
|
||||||
|
be tricked into failing badly were removed. There are now more tests for the
|
||||||
|
XML parser.
|
||||||
|
* Replaced `strftime` by our own implementation. Uses a specialized
|
||||||
|
implementation for our use case instead the more general `strftime`.
|
||||||
|
Benchmarked this to be faster.
|
||||||
|
* Changed the way IDs are parsed from strings. No asserts are used any more but
|
||||||
|
checks are done and an exception is thrown when IDs are out of range. This
|
||||||
|
also changes the way negative values are handled. The value `-1` is now
|
||||||
|
always accepted for all IDs and returned as `0`. This deprecates the
|
||||||
|
`string_to_user_id()` function, use `string_to_uid()` instead which returns a
|
||||||
|
different type.
|
||||||
|
* It was always a bit confusing that some of the util classes and functions are
|
||||||
|
directly in the `osmium` namespace and some are in `osmium::util`. The
|
||||||
|
`osmium::util` namespace is now declared `inline`. which allows all util
|
||||||
|
classes and functions to be addressed directly in the `osmium` namespace
|
||||||
|
while keeping backwards compatibility.
|
||||||
|
* An error is now thrown when the deprecated `pbf_add_metadata` file format
|
||||||
|
option is used. Use `add_metadata` instead.
|
||||||
|
* Extended the `add_metadata` file format option. In addition to allowing the
|
||||||
|
values `true`, `yes`, `false`, and `no`, the new values `all` and `none`
|
||||||
|
are now recognized. The option can also be set to a list of attributes
|
||||||
|
separated by the `+` sign. Attributes are `version`, `timestamp`,
|
||||||
|
`changeset`, `uid`, and `user`. All output formats have been updated to
|
||||||
|
only output the specified attributes. This is based on the new
|
||||||
|
`osmium::metadata_options` class which stores information about what metadata
|
||||||
|
an `OSMObject` has or should have. (Thanks to Michael Reichert.)
|
||||||
|
* The `<` (less than) operator on `OSMObject`s now ignores the case when
|
||||||
|
one or both of the timestamps on the objects are not set at all. This
|
||||||
|
allows better handling of OSM data files with reduced metadata.
|
||||||
|
* Allow `version = -1` and `changeset = -1` in PBF input. This value is
|
||||||
|
sometimes used by other programs to denote "no value". Osmium uses the `0`
|
||||||
|
for this.
|
||||||
|
* The example programs using the `getopt_long` function have been rewritten to
|
||||||
|
work without it. This makes using libosmium on Windows easier, where this
|
||||||
|
function is not available.
|
||||||
|
* Removed the embedded protozero from repository. Like other dependencies you
|
||||||
|
have to install protozero first. If you check out the protozero repository
|
||||||
|
in the same directory where you checked out libosmium, libosmium's CMake
|
||||||
|
will find it.
|
||||||
|
* Various code cleanups, fixing of include order, etc.
|
||||||
|
* Remove need for `winsock2` library in Windows by using code from Protozero.
|
||||||
|
(Thanks alex85k.)
|
||||||
|
* Add MSYS2 build to Appveyor and fixed some Windows compile issues. (Thanks
|
||||||
|
to alex85k.)
|
||||||
|
* Use array instead of map to store input/output format creators.
|
||||||
|
* Update included `catch.hpp` to version 1.12.1.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Remove check for lost ways in multipolygon assembler. This rules out too many
|
||||||
|
valid multipolygons, more specifically more complex ones with touching inner
|
||||||
|
rings.
|
||||||
|
* Use different macro magic for registering index maps. This allows the maps
|
||||||
|
to be used for several types at the same time.
|
||||||
|
* Lots of code was rewritten to fix warnings reported by `clang-tidy` making
|
||||||
|
libosmium more robust.
|
||||||
|
* Make ADL work for `begin()`/`end()` of `InputIterator<Reader>`.
|
||||||
|
* Various fixes to make the code more robust, including an undefined behaviour
|
||||||
|
in the debug output format and a buffer overflow in the o5m parser.
|
||||||
|
* Range checks in o5m parser throw exceptions now instead of triggering
|
||||||
|
assertions.
|
||||||
|
* Better checking that PBF data is in range.
|
||||||
|
* Check `read` and `write` system calls for `EINTR`.
|
||||||
|
* Use tag and type from protozero to make PBF parser more robust.
|
||||||
|
* Test `testdata-multipolygon` on Windows was using the wrong executable name.
|
||||||
|
|
||||||
|
|
||||||
## [2.13.1] - 2017-08-25
|
## [2.13.1] - 2017-08-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@ -739,7 +823,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
Doxygen (up to version 1.8.8). This version contains a workaround to fix
|
Doxygen (up to version 1.8.8). This version contains a workaround to fix
|
||||||
this.
|
this.
|
||||||
|
|
||||||
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.13.1...HEAD
|
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.14.0...HEAD
|
||||||
|
[2.14.0]: https://github.com/osmcode/libosmium/compare/v2.13.1...v2.14.0
|
||||||
[2.13.1]: https://github.com/osmcode/libosmium/compare/v2.13.0...v2.13.1
|
[2.13.1]: https://github.com/osmcode/libosmium/compare/v2.13.0...v2.13.1
|
||||||
[2.13.0]: https://github.com/osmcode/libosmium/compare/v2.12.2...v2.13.0
|
[2.13.0]: https://github.com/osmcode/libosmium/compare/v2.12.2...v2.13.0
|
||||||
[2.12.2]: https://github.com/osmcode/libosmium/compare/v2.12.1...v2.12.2
|
[2.12.2]: https://github.com/osmcode/libosmium/compare/v2.12.1...v2.12.2
|
||||||
|
64
third_party/libosmium/CMakeLists.txt
vendored
64
third_party/libosmium/CMakeLists.txt
vendored
@ -24,8 +24,8 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Cover
|
|||||||
project(libosmium)
|
project(libosmium)
|
||||||
|
|
||||||
set(LIBOSMIUM_VERSION_MAJOR 2)
|
set(LIBOSMIUM_VERSION_MAJOR 2)
|
||||||
set(LIBOSMIUM_VERSION_MINOR 13)
|
set(LIBOSMIUM_VERSION_MINOR 14)
|
||||||
set(LIBOSMIUM_VERSION_PATCH 1)
|
set(LIBOSMIUM_VERSION_PATCH 0)
|
||||||
|
|
||||||
set(LIBOSMIUM_VERSION
|
set(LIBOSMIUM_VERSION
|
||||||
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
|
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
|
||||||
@ -62,7 +62,6 @@ option(BUILD_BENCHMARKS "compile benchmark programs" ${dev_build})
|
|||||||
option(BUILD_DATA_TESTS "compile data tests, please run them with ctest" ${data_test_build})
|
option(BUILD_DATA_TESTS "compile data tests, please run them with ctest" ${data_test_build})
|
||||||
|
|
||||||
option(INSTALL_GDALCPP "also install gdalcpp headers" OFF)
|
option(INSTALL_GDALCPP "also install gdalcpp headers" OFF)
|
||||||
option(INSTALL_PROTOZERO "also install protozero headers" OFF)
|
|
||||||
option(INSTALL_UTFCPP "also install utfcpp headers" OFF)
|
option(INSTALL_UTFCPP "also install utfcpp headers" OFF)
|
||||||
|
|
||||||
option(WITH_PROFILING "add flags needed for profiling" OFF)
|
option(WITH_PROFILING "add flags needed for profiling" OFF)
|
||||||
@ -173,17 +172,6 @@ set(_own_index)
|
|||||||
|
|
||||||
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})
|
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
find_path(GETOPT_INCLUDE_DIR getopt.h)
|
|
||||||
find_library(GETOPT_LIBRARY NAMES wingetopt)
|
|
||||||
if(GETOPT_INCLUDE_DIR AND GETOPT_LIBRARY)
|
|
||||||
include_directories(SYSTEM ${GETOPT_INCLUDE_DIR})
|
|
||||||
list(APPEND OSMIUM_LIBRARIES ${GETOPT_LIBRARY})
|
|
||||||
else()
|
|
||||||
set(GETOPT_MISSING 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -402,13 +390,14 @@ if(BUILD_HEADERS)
|
|||||||
file(MAKE_DIRECTORY header_check)
|
file(MAKE_DIRECTORY header_check)
|
||||||
|
|
||||||
foreach(hpp ${ALL_HPPS})
|
foreach(hpp ${ALL_HPPS})
|
||||||
|
if(GDAL_FOUND OR NOT ((hpp STREQUAL "osmium/area/problem_reporter_ogr.hpp") OR (hpp STREQUAL "osmium/geom/ogr.hpp")))
|
||||||
string(REPLACE ".hpp" "" tmp ${hpp})
|
string(REPLACE ".hpp" "" tmp ${hpp})
|
||||||
string(REPLACE "/" "__" libname ${tmp})
|
string(REPLACE "/" "__" libname ${tmp})
|
||||||
|
|
||||||
# Create a dummy .cpp file that includes the header file we want to
|
# Create a dummy .cpp file that includes the header file we want to
|
||||||
# check.
|
# check.
|
||||||
set(DUMMYCPP ${CMAKE_BINARY_DIR}/header_check/${libname}.cpp)
|
set(DUMMYCPP ${CMAKE_BINARY_DIR}/header_check/${libname}.cpp)
|
||||||
file(WRITE ${DUMMYCPP} "#include <${hpp}>\n")
|
file(WRITE ${DUMMYCPP} "#include <${hpp}> // IWYU pragma: keep\n")
|
||||||
|
|
||||||
# There is no way in CMake to just compile but not link a C++ file,
|
# There is no way in CMake to just compile but not link a C++ file,
|
||||||
# so we pretend to build a library here.
|
# so we pretend to build a library here.
|
||||||
@ -416,7 +405,7 @@ if(BUILD_HEADERS)
|
|||||||
|
|
||||||
#### this is better but only supported from cmake 3.0:
|
#### this is better but only supported from cmake 3.0:
|
||||||
###add_library(${libname} OBJECT ${DUMMYCPP} include/${hpp})
|
###add_library(${libname} OBJECT ${DUMMYCPP} include/${hpp})
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -427,10 +416,10 @@ endif()
|
|||||||
#
|
#
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
message(STATUS "Looking for clang-tidy")
|
message(STATUS "Looking for clang-tidy")
|
||||||
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-3.9 clang-tidy-3.8 clang-tidy-3.7 clang-tidy-3.6 clang-tidy-3.5)
|
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-6.0 clang-tidy-5.0)
|
||||||
|
|
||||||
if(CLANG_TIDY)
|
if(CLANG_TIDY)
|
||||||
message(STATUS "Looking for clang-tidy - found")
|
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
|
||||||
|
|
||||||
if(BUILD_EXAMPLES)
|
if(BUILD_EXAMPLES)
|
||||||
file(GLOB CT_ALL_EXAMPLES examples/*.cpp)
|
file(GLOB CT_ALL_EXAMPLES examples/*.cpp)
|
||||||
@ -467,41 +456,9 @@ if(CLANG_TIDY)
|
|||||||
${CT_ALL_BENCHMARKS}
|
${CT_ALL_BENCHMARKS}
|
||||||
${CT_ALL_DATA_TESTS})
|
${CT_ALL_DATA_TESTS})
|
||||||
|
|
||||||
# For a list of check options, see:
|
|
||||||
# http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
|
||||||
|
|
||||||
list(APPEND CT_CHECKS "cert-*"
|
|
||||||
"-cert-err60-cpp") # even the std lib doesn't do this
|
|
||||||
|
|
||||||
# disabled, because it is slow
|
|
||||||
# list(APPEND CT_CHECKS "clang-analyzer-*")
|
|
||||||
|
|
||||||
list(APPEND CT_CHECKS "google-*"
|
|
||||||
"-google-explicit-constructor"
|
|
||||||
"-google-readability-casting"
|
|
||||||
"-google-readability-function")
|
|
||||||
|
|
||||||
list(APPEND CT_CHECKS "llvm-*"
|
|
||||||
"-llvm-include-order")
|
|
||||||
|
|
||||||
list(APPEND CT_CHECKS "misc-*"
|
|
||||||
"-misc-argument-comment")
|
|
||||||
|
|
||||||
list(APPEND CT_CHECKS "modernize-*"
|
|
||||||
"-modernize-make-unique") # not available in C++11
|
|
||||||
|
|
||||||
list(APPEND CT_CHECKS "readability-*"
|
|
||||||
"-readability-identifier-naming"
|
|
||||||
"-readability-implicit-bool-cast"
|
|
||||||
"-readability-named-parameter")
|
|
||||||
|
|
||||||
string(REPLACE ";" "," ALL_CHECKS "${CT_CHECKS}")
|
|
||||||
|
|
||||||
add_custom_target(clang-tidy
|
add_custom_target(clang-tidy
|
||||||
${CLANG_TIDY}
|
${CLANG_TIDY}
|
||||||
-p ${CMAKE_BINARY_DIR}
|
-p ${CMAKE_BINARY_DIR}
|
||||||
-header-filter='include/osmium/.*'
|
|
||||||
-checks="${ALL_CHECKS}"
|
|
||||||
${CT_CHECK_FILES}
|
${CT_CHECK_FILES}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
@ -523,10 +480,6 @@ if(INSTALL_GDALCPP)
|
|||||||
install(FILES include/gdalcpp.hpp DESTINATION include)
|
install(FILES include/gdalcpp.hpp DESTINATION include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(INSTALL_PROTOZERO)
|
|
||||||
install(DIRECTORY include/protozero DESTINATION include)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(INSTALL_UTFCPP)
|
if(INSTALL_UTFCPP)
|
||||||
install(FILES include/utf8.h DESTINATION include)
|
install(FILES include/utf8.h DESTINATION include)
|
||||||
install(DIRECTORY include/utf8 DESTINATION include)
|
install(DIRECTORY include/utf8 DESTINATION include)
|
||||||
@ -560,8 +513,7 @@ include(CPack)
|
|||||||
if(BUILD_DATA_TESTS AND OSM_TESTDATA STREQUAL "OSM_TESTDATA-NOTFOUND")
|
if(BUILD_DATA_TESTS AND OSM_TESTDATA STREQUAL "OSM_TESTDATA-NOTFOUND")
|
||||||
message("\n========================== WARNING ==========================")
|
message("\n========================== WARNING ==========================")
|
||||||
message("osm-testdata directory not found, data tests were disabled!\n")
|
message("osm-testdata directory not found, data tests were disabled!\n")
|
||||||
message("You can get it from https://github.com/osmcode/osm-testdata")
|
message("Call 'git submodule update --init' to install test data")
|
||||||
message("Clone it into the same directory libosmium is in")
|
|
||||||
message("or set the OSM_TESTDATA cmake variable to its path.")
|
message("or set the OSM_TESTDATA cmake variable to its path.")
|
||||||
message("=============================================================\n")
|
message("=============================================================\n")
|
||||||
endif()
|
endif()
|
||||||
|
7
third_party/libosmium/CONTRIBUTING.md
vendored
7
third_party/libosmium/CONTRIBUTING.md
vendored
@ -10,3 +10,10 @@ Some rules for contributing to this project:
|
|||||||
you have added. Please read the [notes for developers](NOTES_FOR_DEVELOPERS.md)
|
you have added. Please read the [notes for developers](NOTES_FOR_DEVELOPERS.md)
|
||||||
beforehand which contains some coding guidelines.
|
beforehand which contains some coding guidelines.
|
||||||
|
|
||||||
|
If you are reporting a problem:
|
||||||
|
|
||||||
|
* Describe exactly what you were trying to achieve, what you did, what you
|
||||||
|
expected to happen and what did happen instead. Include relevant information
|
||||||
|
about the platform, OS version etc. you are using. Include shell commands you
|
||||||
|
typed in, log files, errors messages etc.
|
||||||
|
|
||||||
|
206
third_party/libosmium/EXTERNAL_LICENSES.txt
vendored
206
third_party/libosmium/EXTERNAL_LICENSES.txt
vendored
@ -1,210 +1,4 @@
|
|||||||
|
|
||||||
==== For protozero from https://github.com/mapbox/protozero
|
|
||||||
|
|
||||||
protozero copyright (c) Mapbox.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in
|
|
||||||
the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
||||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
==== For protozero from https://github.com/mapbox/protozero
|
|
||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
==== For utf8.h
|
==== For utf8.h
|
||||||
|
|
||||||
Copyright 2006 Nemanja Trifunovic
|
Copyright 2006 Nemanja Trifunovic
|
||||||
|
@ -126,7 +126,7 @@ Call `cmake/iwyu.sh` to check for proper includes and forward declarations.
|
|||||||
This uses the clang-based `include-what-you-use` program. Note that it does
|
This uses the clang-based `include-what-you-use` program. Note that it does
|
||||||
produce some false reports and crashes often. The `osmium.imp` file can be
|
produce some false reports and crashes often. The `osmium.imp` file can be
|
||||||
used to define mappings for iwyu. See the IWYU tool at
|
used to define mappings for iwyu. See the IWYU tool at
|
||||||
<http://code.google.com/p/include-what-you-use/>.
|
<https://include-what-you-use.org/>.
|
||||||
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
13
third_party/libosmium/README.md
vendored
13
third_party/libosmium/README.md
vendored
@ -9,6 +9,7 @@ Libosmium works on Linux, Mac OSX and Windows.
|
|||||||
[](https://travis-ci.org/osmcode/libosmium)
|
[](https://travis-ci.org/osmcode/libosmium)
|
||||||
[](https://ci.appveyor.com/project/Mapbox/libosmium)
|
[](https://ci.appveyor.com/project/Mapbox/libosmium)
|
||||||
[](https://codecov.io/gh/osmcode/libosmium)
|
[](https://codecov.io/gh/osmcode/libosmium)
|
||||||
|
[](https://repology.org/metapackage/libosmium)
|
||||||
|
|
||||||
Please see the [Libosmium manual](http://osmcode.org/libosmium/manual.html)
|
Please see the [Libosmium manual](http://osmcode.org/libosmium/manual.html)
|
||||||
for more details than this README can provide.
|
for more details than this README can provide.
|
||||||
@ -31,9 +32,11 @@ manual.
|
|||||||
The following external (header-only) libraries are included in the libosmium
|
The following external (header-only) libraries are included in the libosmium
|
||||||
repository:
|
repository:
|
||||||
* [gdalcpp](https://github.com/joto/gdalcpp)
|
* [gdalcpp](https://github.com/joto/gdalcpp)
|
||||||
* [protozero](https://github.com/mapbox/protozero)
|
|
||||||
* [utfcpp](http://utfcpp.sourceforge.net/)
|
* [utfcpp](http://utfcpp.sourceforge.net/)
|
||||||
|
|
||||||
|
Note that [protozero](https://github.com/mapbox/protozero) was included in
|
||||||
|
earlier versions of libosmium, but isn't any more.
|
||||||
|
|
||||||
|
|
||||||
## Directories
|
## Directories
|
||||||
|
|
||||||
@ -73,6 +76,14 @@ chapter in the manual.
|
|||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
To download the `osm-testdata` submodule call:
|
||||||
|
|
||||||
|
```
|
||||||
|
git submodule update --init
|
||||||
|
```
|
||||||
|
|
||||||
|
This will enable additional tests.
|
||||||
|
|
||||||
See the
|
See the
|
||||||
[Libosmium Manual](http://osmcode.org/libosmium/manual.html#running-tests)
|
[Libosmium Manual](http://osmcode.org/libosmium/manual.html#running-tests)
|
||||||
for instructions.
|
for instructions.
|
||||||
|
40
third_party/libosmium/appveyor.yml
vendored
40
third_party/libosmium/appveyor.yml
vendored
@ -6,34 +6,54 @@
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- config: Dev
|
- config: MSYS2
|
||||||
autocrlf: true
|
autocrlf: true
|
||||||
- config: Dev
|
- config: Debug
|
||||||
|
autocrlf: true
|
||||||
|
- config: Release
|
||||||
|
autocrlf: true
|
||||||
|
- config: Debug
|
||||||
autocrlf: false
|
autocrlf: false
|
||||||
- config: RelWithDebInfo
|
- config: Release
|
||||||
autocrlf: true
|
|
||||||
- config: RelWithDebInfo
|
|
||||||
autocrlf: false
|
autocrlf: false
|
||||||
|
|
||||||
shallow_clone: true
|
clone_depth: 1
|
||||||
|
|
||||||
# Operating system (build VM template)
|
# Operating system (build VM template)
|
||||||
os: Visual Studio 2015
|
os: Visual Studio 2015
|
||||||
|
|
||||||
|
platform: x64
|
||||||
|
|
||||||
# scripts that are called at very beginning, before repo cloning
|
# scripts that are called at very beginning, before repo cloning
|
||||||
init:
|
init:
|
||||||
- git config --global core.autocrlf %autocrlf%
|
- git config --global core.autocrlf %autocrlf%
|
||||||
- git config --get core.autocrlf
|
- git config --get core.autocrlf
|
||||||
|
|
||||||
# clone directory
|
|
||||||
clone_folder: c:\projects\libosmium
|
clone_folder: c:\projects\libosmium
|
||||||
|
|
||||||
platform: x64
|
# The option --ask=20 is a workaround for a problem with the MSYS2 update
|
||||||
|
# process. Without it the following error is printed and the appveyor script
|
||||||
|
# halts: "msys2-runtime and catgets are in conflict. Remove catgets?"
|
||||||
|
# See also: https://github.com/Alexpux/MSYS2-packages/issues/1141
|
||||||
|
install:
|
||||||
|
- git submodule update --init
|
||||||
|
- cd c:\projects
|
||||||
|
- git clone --depth 1 https://github.com/mapbox/protozero
|
||||||
|
- if [%config%]==[MSYS2] (
|
||||||
|
C:\msys64\usr\bin\pacman --noconfirm --sync --refresh --refresh --sysupgrade --sysupgrade --ask=20
|
||||||
|
&& C:\msys64\usr\bin\pacman -Rc --noconfirm mingw-w64-x86_64-gcc-libs
|
||||||
|
)
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- build-appveyor.bat
|
- cd c:\projects\libosmium
|
||||||
|
- if [%config%]==[MSYS2] (
|
||||||
|
build-msys2.bat
|
||||||
|
) else (
|
||||||
|
build-appveyor.bat
|
||||||
|
)
|
||||||
|
|
||||||
# remove garbage VS messages
|
# remove garbage VS messages
|
||||||
# http://help.appveyor.com/discussions/problems/4569-the-target-_convertpdbfiles-listed-in-a-beforetargets-attribute-at-c-does-not-exist-in-the-project-and-will-be-ignored
|
# https://help.appveyor.com/discussions/problems/4569-the-target-_convertpdbfiles-listed-in-a-beforetargets-attribute-at-c-does-not-exist-in-the-project-and-will-be-ignored
|
||||||
before_build:
|
before_build:
|
||||||
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
|
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
cd $DATA_DIR
|
cd $DATA_DIR
|
||||||
curl --location --output 1_liechtenstein.osm.pbf http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf # about 2 MB
|
curl --location --output 1_liechtenstein.osm.pbf https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf # about 2 MB
|
||||||
curl --location --output 2_bremen.osm.pbf http://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf # about 16 MB
|
curl --location --output 2_bremen.osm.pbf https://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf # about 16 MB
|
||||||
curl --location --output 3_sachsen.osm.pbf http://download.geofabrik.de/europe/germany/sachsen-latest.osm.pbf # about 160 MB
|
curl --location --output 3_sachsen.osm.pbf https://download.geofabrik.de/europe/germany/sachsen-latest.osm.pbf # about 160 MB
|
||||||
curl --location --output 4_germany.osm.pbf http://download.geofabrik.de/europe/germany-latest.osm.pbf # about 3 GB
|
curl --location --output 4_germany.osm.pbf https://download.geofabrik.de/europe/germany-latest.osm.pbf # about 3 GB
|
||||||
curl --location --output 5_planet.osm.pbf http://planet.osm.org/pbf/planet-latest.osm.pbf # about 35 GB
|
curl --location --output 5_planet.osm.pbf https://planet.osm.org/pbf/planet-latest.osm.pbf # about 35 GB
|
||||||
|
|
||||||
|
@ -4,36 +4,35 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/handler.hpp>
|
||||||
|
#include <osmium/io/any_input.hpp>
|
||||||
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/io/any_input.hpp>
|
|
||||||
#include <osmium/handler.hpp>
|
|
||||||
#include <osmium/visitor.hpp>
|
|
||||||
|
|
||||||
struct CountHandler : public osmium::handler::Handler {
|
struct CountHandler : public osmium::handler::Handler {
|
||||||
|
|
||||||
uint64_t nodes = 0;
|
uint64_t nodes = 0;
|
||||||
uint64_t ways = 0;
|
uint64_t ways = 0;
|
||||||
uint64_t relations = 0;
|
uint64_t relations = 0;
|
||||||
|
|
||||||
void node(const osmium::Node&) {
|
void node(const osmium::Node& /*node*/) {
|
||||||
++nodes;
|
++nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void way(const osmium::Way&) {
|
void way(const osmium::Way& /*way*/) {
|
||||||
++ways;
|
++ways;
|
||||||
}
|
}
|
||||||
|
|
||||||
void relation(const osmium::Relation&) {
|
void relation(const osmium::Relation& /*relation*/) {
|
||||||
++relations;
|
++relations;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||||
@ -48,8 +47,8 @@ int main(int argc, char* argv[]) {
|
|||||||
osmium::apply(reader, handler);
|
osmium::apply(reader, handler);
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
||||||
std::cout << "Nodes: " << handler.nodes << "\n";
|
std::cout << "Nodes: " << handler.nodes << '\n';
|
||||||
std::cout << "Ways: " << handler.ways << "\n";
|
std::cout << "Ways: " << handler.ways << '\n';
|
||||||
std::cout << "Relations: " << handler.relations << "\n";
|
std::cout << "Relations: " << handler.relations << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/handler.hpp>
|
||||||
|
#include <osmium/io/any_input.hpp>
|
||||||
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/io/any_input.hpp>
|
|
||||||
#include <osmium/handler.hpp>
|
|
||||||
#include <osmium/visitor.hpp>
|
|
||||||
|
|
||||||
struct CountHandler : public osmium::handler::Handler {
|
struct CountHandler : public osmium::handler::Handler {
|
||||||
|
|
||||||
uint64_t counter = 0;
|
uint64_t counter = 0;
|
||||||
@ -26,17 +26,16 @@ struct CountHandler : public osmium::handler::Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void way(const osmium::Way&) {
|
void way(const osmium::Way& /*way*/) {
|
||||||
++all;
|
++all;
|
||||||
}
|
}
|
||||||
|
|
||||||
void relation(const osmium::Relation&) {
|
void relation(const osmium::Relation& /*relation*/) {
|
||||||
++all;
|
++all;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||||
@ -51,6 +50,6 @@ int main(int argc, char* argv[]) {
|
|||||||
osmium::apply(reader, handler);
|
osmium::apply(reader, handler);
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
||||||
std::cout << "r_all=" << handler.all << " r_counter=" << handler.counter << "\n";
|
std::cout << "r_all=" << handler.all << " r_counter=" << handler.counter << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,16 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/handler.hpp>
|
||||||
|
#include <osmium/handler/node_locations_for_ways.hpp>
|
||||||
|
#include <osmium/index/map/all.hpp>
|
||||||
|
#include <osmium/io/any_input.hpp>
|
||||||
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/index/map/all.hpp>
|
|
||||||
#include <osmium/handler/node_locations_for_ways.hpp>
|
|
||||||
#include <osmium/visitor.hpp>
|
|
||||||
|
|
||||||
#include <osmium/io/any_input.hpp>
|
|
||||||
#include <osmium/handler.hpp>
|
|
||||||
|
|
||||||
using index_type = osmium::index::map::Map<osmium::unsigned_object_id_type, osmium::Location>;
|
using index_type = osmium::index::map::Map<osmium::unsigned_object_id_type, osmium::Location>;
|
||||||
|
|
||||||
using location_handler_type = osmium::handler::NodeLocationsForWays<index_type>;
|
using location_handler_type = osmium::handler::NodeLocationsForWays<index_type>;
|
||||||
|
@ -4,17 +4,17 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/geom/mercator_projection.hpp>
|
||||||
|
#include <osmium/geom/wkb.hpp>
|
||||||
|
#include <osmium/handler.hpp>
|
||||||
|
#include <osmium/io/any_input.hpp>
|
||||||
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/io/any_input.hpp>
|
|
||||||
#include <osmium/handler.hpp>
|
|
||||||
#include <osmium/visitor.hpp>
|
|
||||||
#include <osmium/geom/wkb.hpp>
|
|
||||||
#include <osmium/geom/mercator_projection.hpp>
|
|
||||||
|
|
||||||
struct GeomHandler : public osmium::handler::Handler {
|
struct GeomHandler : public osmium::handler::Handler {
|
||||||
|
|
||||||
osmium::geom::WKBFactory<osmium::geom::MercatorProjection> factory;
|
osmium::geom::WKBFactory<osmium::geom::MercatorProjection> factory;
|
||||||
@ -25,7 +25,6 @@ struct GeomHandler : public osmium::handler::Handler {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||||
|
@ -16,6 +16,12 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/handler.hpp>
|
||||||
|
#include <osmium/handler/node_locations_for_ways.hpp>
|
||||||
|
#include <osmium/index/map/all.hpp>
|
||||||
|
#include <osmium/io/any_input.hpp>
|
||||||
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -24,13 +30,6 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/index/map/all.hpp>
|
|
||||||
#include <osmium/handler/node_locations_for_ways.hpp>
|
|
||||||
#include <osmium/visitor.hpp>
|
|
||||||
|
|
||||||
#include <osmium/io/any_input.hpp>
|
|
||||||
#include <osmium/handler.hpp>
|
|
||||||
|
|
||||||
using static_index_type = osmium::index::map::SparseMemArray<osmium::unsigned_object_id_type, osmium::Location>;
|
using static_index_type = osmium::index::map::SparseMemArray<osmium::unsigned_object_id_type, osmium::Location>;
|
||||||
const std::string location_store{"sparse_mem_array"};
|
const std::string location_store{"sparse_mem_array"};
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
const auto& map_factory = osmium::index::MapFactory<osmium::unsigned_object_id_type, osmium::Location>::instance();
|
const auto& map_factory = osmium::index::MapFactory<osmium::unsigned_object_id_type, osmium::Location>::instance();
|
||||||
|
|
||||||
const auto buffer_size = buffer.committed() / (1024*1024); // buffer size in MBytes
|
const auto buffer_size = buffer.committed() / (1024 * 1024); // buffer size in MBytes
|
||||||
const int runs = std::max(10, static_cast<int>(5000ull / buffer_size));
|
const int runs = std::max(10, static_cast<int>(5000ull / buffer_size));
|
||||||
|
|
||||||
std::cout << "input: filename=" << input_filename << " buffer_size=" << buffer_size << "MBytes\n";
|
std::cout << "input: filename=" << input_filename << " buffer_size=" << buffer_size << "MBytes\n";
|
||||||
@ -82,10 +81,14 @@ int main(int argc, char* argv[]) {
|
|||||||
osmium::apply(tmp_buffer, static_location_handler);
|
osmium::apply(tmp_buffer, static_location_handler);
|
||||||
const auto end = std::chrono::steady_clock::now();
|
const auto end = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
const double duration = std::chrono::duration<double, std::milli>(end-start).count();
|
const double duration = std::chrono::duration<double, std::milli>(end - start).count();
|
||||||
|
|
||||||
if (duration < static_min) static_min = duration;
|
if (duration < static_min) {
|
||||||
if (duration > static_max) static_max = duration;
|
static_min = duration;
|
||||||
|
}
|
||||||
|
if (duration > static_max) {
|
||||||
|
static_max = duration;
|
||||||
|
}
|
||||||
static_sum += duration;
|
static_sum += duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,16 +108,20 @@ int main(int argc, char* argv[]) {
|
|||||||
osmium::apply(tmp_buffer, dynamic_location_handler);
|
osmium::apply(tmp_buffer, dynamic_location_handler);
|
||||||
const auto end = std::chrono::steady_clock::now();
|
const auto end = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
const double duration = std::chrono::duration<double, std::milli>(end-start).count();
|
const double duration = std::chrono::duration<double, std::milli>(end - start).count();
|
||||||
|
|
||||||
if (duration < dynamic_min) dynamic_min = duration;
|
if (duration < dynamic_min) {
|
||||||
if (duration > dynamic_max) dynamic_max = duration;
|
dynamic_min = duration;
|
||||||
|
}
|
||||||
|
if (duration > dynamic_max) {
|
||||||
|
dynamic_max = duration;
|
||||||
|
}
|
||||||
dynamic_sum += duration;
|
dynamic_sum += duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double static_avg = static_sum/runs;
|
const double static_avg = static_sum / runs;
|
||||||
const double dynamic_avg = dynamic_sum/runs;
|
const double dynamic_avg = dynamic_sum / runs;
|
||||||
|
|
||||||
std::cout << "static min=" << static_min << "ms avg=" << static_avg << "ms max=" << static_max << "ms\n";
|
std::cout << "static min=" << static_min << "ms avg=" << static_avg << "ms max=" << static_max << "ms\n";
|
||||||
std::cout << "dynamic min=" << dynamic_min << "ms avg=" << dynamic_avg << "ms max=" << dynamic_max << "ms\n";
|
std::cout << "dynamic min=" << dynamic_min << "ms avg=" << dynamic_avg << "ms max=" << dynamic_max << "ms\n";
|
||||||
|
84
third_party/libosmium/build-appveyor.bat
vendored
84
third_party/libosmium/build-appveyor.bat
vendored
@ -4,73 +4,33 @@ SET EL=0
|
|||||||
|
|
||||||
ECHO ~~~~~~ %~f0 ~~~~~~
|
ECHO ~~~~~~ %~f0 ~~~~~~
|
||||||
|
|
||||||
SET CUSTOM_CMAKE=cmake-3.6.2-win64-x64
|
|
||||||
::show all available env vars
|
|
||||||
SET
|
SET
|
||||||
ECHO cmake on AppVeyor
|
|
||||||
cmake -version
|
|
||||||
|
|
||||||
ECHO activating VS cmd prompt && CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
ECHO activating VS cmd prompt && CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
SET lodir=%CD%
|
CD ..
|
||||||
SET PATH=%lodir%\%CUSTOM_CMAKE%\bin;%PATH%
|
|
||||||
SET LODEPSDIR=%lodir%\libosmium-deps
|
|
||||||
SET PROJ_LIB=%LODEPSDIR%\proj\share
|
|
||||||
SET GDAL_DATA=%LODEPSDIR%\gdal\data
|
|
||||||
::gdal.dll
|
|
||||||
SET PATH=%LODEPSDIR%\gdal\lib;%PATH%
|
|
||||||
::geos.dll
|
|
||||||
SET PATH=%LODEPSDIR%\geos\lib;%PATH%
|
|
||||||
::libtiff.dll
|
|
||||||
SET PATH=%LODEPSDIR%\libtiff\lib;%PATH%
|
|
||||||
::jpeg.dll
|
|
||||||
SET PATH=%LODEPSDIR%\jpeg\lib;%PATH%
|
|
||||||
::libexpat.dll
|
|
||||||
SET PATH=%LODEPSDIR%\expat\lib;%PATH%
|
|
||||||
::zlibwapi.dll
|
|
||||||
SET PATH=%LODEPSDIR%\zlib\lib;%PATH%
|
|
||||||
::convert backslashes in bzip2 path to forward slashes
|
|
||||||
::cmake cannot find it otherwise
|
|
||||||
SET LIBBZIP2=%LODEPSDIR%\bzip2\lib\libbz2.lib
|
|
||||||
SET LIBBZIP2=%LIBBZIP2:\=/%
|
|
||||||
|
|
||||||
IF NOT EXIST cm.7z ECHO downloading cmake %CUSTOM_CMAKE% ... && powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/%CUSTOM_CMAKE%.7z -OutFile cm.7z
|
nuget install expat.v140 -Version 2.2.5
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
IF NOT EXIST lodeps.7z ECHO downloading binary dependencies... && powershell Invoke-WebRequest https://mapbox.s3.amazonaws.com/windows-builds/windows-build-deps/libosmium-deps-win-14.0-x64.7z -OutFile lodeps.7z
|
SET PATH=C:/projects/expat.v140.2.2.5/build/native/bin/x64/%config%;%PATH%
|
||||||
|
|
||||||
|
nuget install zlib-vc140-static-64 -Version 1.2.11
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
IF NOT EXIST %CUSTOM_CMAKE% ECHO extracting cmake... && 7z x cm.7z | %windir%\system32\find "ing archive"
|
nuget install bzip2.v140 -Version 1.0.6.9
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
IF NOT EXIST %LODEPSDIR% ECHO extracting binary dependencies... && 7z x lodeps.7z | %windir%\system32\find "ing archive"
|
SET PATH=C:/projects/bzip2.v140.1.0.6.9/build/native/bin/x64/%config%;%PATH%
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
ECHO %LODEPSDIR%
|
CD libosmium
|
||||||
DIR %LODEPSDIR%
|
|
||||||
::TREE %LODEPSDIR%
|
|
||||||
|
|
||||||
::powershell (Get-ChildItem $env:LODEPSDIR\boost\lib -Filter *boost*.dll)[0].BaseName.split('_')[-1]
|
ECHO config^: %config%
|
||||||
FOR /F "tokens=1 usebackq" %%i in (`powershell ^(Get-ChildItem %LODEPSDIR%\boost\lib -Filter *boost*.dll^)[0].BaseName.split^('_'^)[-1]`) DO SET BOOST_VERSION=%%i
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
ECHO BOOST_VERSION^: %BOOST_VERSION%
|
SET libpostfix=""
|
||||||
|
IF "%config%"=="Debug" SET libpostfix="d"
|
||||||
|
|
||||||
ECHO our own cmake
|
|
||||||
cmake -version
|
|
||||||
|
|
||||||
CD %lodir%\..
|
|
||||||
|
|
||||||
IF NOT EXIST osm-testdata ECHO cloning osm-testdata && git clone --depth 1 https://github.com/osmcode/osm-testdata.git
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
CD osm-testdata
|
|
||||||
git fetch
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
git pull
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
|
||||||
|
|
||||||
CD %lodir%
|
|
||||||
IF EXIST build ECHO deleting build dir... && RD /Q /S build
|
IF EXIST build ECHO deleting build dir... && RD /Q /S build
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
@ -78,20 +38,21 @@ MKDIR build
|
|||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
CD build
|
CD build
|
||||||
ECHO config^: %config%
|
|
||||||
|
|
||||||
::This will produce lots of LNK4099 warnings which can be ignored.
|
::This will produce lots of LNK4099 warnings which can be ignored.
|
||||||
::Unfortunately they can't be disabled, see
|
::Unfortunately they can't be disabled, see
|
||||||
::http://stackoverflow.com/questions/661606/visual-c-how-to-disable-specific-linker-warnings
|
::https://stackoverflow.com/questions/661606/visual-c-how-to-disable-specific-linker-warnings
|
||||||
SET CMAKE_CMD=cmake .. ^
|
SET CMAKE_CMD=cmake .. -LA -G "Visual Studio 14 Win64" ^
|
||||||
-LA -G "Visual Studio 14 Win64" ^
|
|
||||||
-DOsmium_DEBUG=TRUE ^
|
-DOsmium_DEBUG=TRUE ^
|
||||||
-DCMAKE_BUILD_TYPE=%config% ^
|
-DCMAKE_BUILD_TYPE=%config% ^
|
||||||
-DBUILD_HEADERS=OFF ^
|
-DBUILD_HEADERS=OFF ^
|
||||||
-DBOOST_ROOT=%LODEPSDIR%\boost ^
|
-DBOOST_ROOT=C:/Libraries/boost_1_63_0 ^
|
||||||
-DZLIB_LIBRARY=%LODEPSDIR%\zlib\lib\zlibwapi.lib ^
|
-DZLIB_INCLUDE_DIR=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/include ^
|
||||||
-DBZIP2_LIBRARY_RELEASE=%LIBBZIP2% ^
|
-DZLIB_LIBRARY=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/libs/x64/static/%config%/zlibstatic.lib ^
|
||||||
-DCMAKE_PREFIX_PATH=%LODEPSDIR%\zlib;%LODEPSDIR%\expat;%LODEPSDIR%\bzip2;%LODEPSDIR%\geos;%LODEPSDIR%\gdal;%LODEPSDIR%\proj;%LODEPSDIR%\sparsehash;%LODEPSDIR%\wingetopt
|
-DEXPAT_INCLUDE_DIR=C:/projects/expat.v140.2.2.5/build/native/include ^
|
||||||
|
-DEXPAT_LIBRARY=C:/projects/expat.v140.2.2.5/build/native/lib/x64/%config%/libexpat%libpostfix%.lib ^
|
||||||
|
-DBZIP2_INCLUDE_DIR=C:/projects/bzip2.v140.1.0.6.9/build/native/include ^
|
||||||
|
-DBZIP2_LIBRARIES=C:/projects/bzip2.v140.1.0.6.9/build/native/lib/x64/%config%/libbz2%libpostfix%.lib
|
||||||
|
|
||||||
ECHO calling^: %CMAKE_CMD%
|
ECHO calling^: %CMAKE_CMD%
|
||||||
%CMAKE_CMD%
|
%CMAKE_CMD%
|
||||||
@ -107,12 +68,9 @@ msbuild libosmium.sln ^
|
|||||||
/p:PlatformToolset=v140 %avlogger%
|
/p:PlatformToolset=v140 %avlogger%
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
ctest --output-on-failure ^
|
ctest --output-on-failure -C %config% -E testdata-overview
|
||||||
-C %config% ^
|
|
||||||
-E testdata-overview
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
|
||||||
GOTO DONE
|
GOTO DONE
|
||||||
|
|
||||||
:ERROR
|
:ERROR
|
||||||
|
7
third_party/libosmium/build-local.bat
vendored
7
third_party/libosmium/build-local.bat
vendored
@ -6,11 +6,11 @@ ECHO ~~~~~~ %~f0 ~~~~~~
|
|||||||
|
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO build-local ["config=Dev"]
|
ECHO build-local ["config=Dev"]
|
||||||
ECHO default config^: RelWithDebInfo
|
ECHO default config^: Release
|
||||||
ECHO.
|
ECHO.
|
||||||
|
|
||||||
SET platform=x64
|
SET platform=x64
|
||||||
SET config=RelWithDebInfo
|
SET config=Release
|
||||||
|
|
||||||
:: OVERRIDE PARAMETERS >>>>>>>>
|
:: OVERRIDE PARAMETERS >>>>>>>>
|
||||||
:NEXT-ARG
|
:NEXT-ARG
|
||||||
@ -24,9 +24,6 @@ GOTO NEXT-ARG
|
|||||||
:ARGS-DONE
|
:ARGS-DONE
|
||||||
::<<<<< OVERRIDE PARAMETERS
|
::<<<<< OVERRIDE PARAMETERS
|
||||||
|
|
||||||
WHERE 7z
|
|
||||||
IF %ERRORLEVEL% NEQ 0 ECHO 7zip not on PATH && GOTO ERROR
|
|
||||||
|
|
||||||
CALL build-appveyor.bat
|
CALL build-appveyor.bat
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
41
third_party/libosmium/build-msys2.bat
vendored
Normal file
41
third_party/libosmium/build-msys2.bat
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
SETLOCAL
|
||||||
|
SET EL=0
|
||||||
|
|
||||||
|
ECHO ~~~~~~ %~f0 ~~~~~~
|
||||||
|
|
||||||
|
echo "Adding MSYS2 to path..."
|
||||||
|
SET "PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%"
|
||||||
|
echo %PATH%
|
||||||
|
|
||||||
|
echo "Installing MSYS2 packages..."
|
||||||
|
bash -lc "pacman -S --needed --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-geos mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-cppcheck mingw-w64-x86_64-doxygen mingw-w64-x86_64-gdb mingw-w64-x86_64-sparsehash mingw-w64-x86_64-gdal mingw-w64-x86_64-ruby mingw-w64-x86_64-libspatialite mingw-w64-x86_64-spatialite-tools mingw-w64-x86_64-clang-tools-extra"
|
||||||
|
bash -lc "pacman -S --needed --noconfirm mingw-w64-x86_64-postgresql mingw-w64-x86_64-netcdf mingw-w64-x86_64-crypto++"
|
||||||
|
call C:\msys64\mingw64\bin\gem.cmd install json
|
||||||
|
|
||||||
|
echo "Setting PROJ_LIB variable for correct PROJ.4 working"
|
||||||
|
set PROJ_LIB=c:\msys64\mingw64\share\proj
|
||||||
|
|
||||||
|
echo "Generating makefiles"
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -G "MSYS Makefiles" -DBUILD_DATA_TESTS=ON -DBUILD_HEADERS=OFF
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
echo "Building"
|
||||||
|
make
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
echo "Testing"
|
||||||
|
ctest --output-on-failure
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
:ERROR
|
||||||
|
ECHO ~~~~~~ ERROR %~f0 ~~~~~~
|
||||||
|
SET EL=%ERRORLEVEL%
|
||||||
|
|
||||||
|
:DONE
|
||||||
|
IF %EL% NEQ 0 ECHO. && ECHO !!! ERRORLEVEL^: %EL% !!! && ECHO.
|
||||||
|
ECHO ~~~~~~ DONE %~f0 ~~~~~~
|
||||||
|
|
||||||
|
EXIT /b %EL%
|
4
third_party/libosmium/cmake/FindGem.cmake
vendored
4
third_party/libosmium/cmake/FindGem.cmake
vendored
@ -1,5 +1,7 @@
|
|||||||
# Author thomas.roehr@dfki.de
|
# Author thomas.roehr@dfki.de
|
||||||
#
|
#
|
||||||
|
# Version 0.31 2017-09-15
|
||||||
|
# - find gem executable gem.cmd on Windows
|
||||||
# Version 0.3 2013-07-02
|
# Version 0.3 2013-07-02
|
||||||
# - rely on `gem content` to find library and header
|
# - rely on `gem content` to find library and header
|
||||||
# - introduce GEM_OS_PKG to allow search via pkgconfig
|
# - introduce GEM_OS_PKG to allow search via pkgconfig
|
||||||
@ -28,7 +30,7 @@
|
|||||||
# Check for how 'gem' should be called
|
# Check for how 'gem' should be called
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_program(GEM_EXECUTABLE
|
find_program(GEM_EXECUTABLE
|
||||||
NAMES "gem${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
|
NAMES "gem.cmd" "gem${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
|
||||||
"gem${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
|
"gem${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
|
||||||
"gem-${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
|
"gem-${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}"
|
||||||
"gem-${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
|
"gem-${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}"
|
||||||
|
32
third_party/libosmium/cmake/FindOsmium.cmake
vendored
32
third_party/libosmium/cmake/FindOsmium.cmake
vendored
@ -54,8 +54,7 @@
|
|||||||
#
|
#
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
# This is the list of directories where we look for osmium and protozero
|
# This is the list of directories where we look for osmium includes.
|
||||||
# includes.
|
|
||||||
set(_osmium_include_path
|
set(_osmium_include_path
|
||||||
../libosmium
|
../libosmium
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
@ -112,29 +111,14 @@ endif()
|
|||||||
if(Osmium_USE_PBF)
|
if(Osmium_USE_PBF)
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
find_package(Protozero 1.5.1)
|
||||||
message(STATUS "Looking for protozero")
|
|
||||||
find_path(PROTOZERO_INCLUDE_DIR protozero/version.hpp
|
|
||||||
PATH_SUFFIXES include
|
|
||||||
PATHS ${_osmium_include_path}
|
|
||||||
${OSMIUM_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
if(PROTOZERO_INCLUDE_DIR)
|
|
||||||
message(STATUS "Looking for protozero - found")
|
|
||||||
else()
|
|
||||||
message(STATUS "Looking for protozero - not found")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND OSMIUM_EXTRA_FIND_VARS ZLIB_FOUND Threads_FOUND PROTOZERO_INCLUDE_DIR)
|
list(APPEND OSMIUM_EXTRA_FIND_VARS ZLIB_FOUND Threads_FOUND PROTOZERO_INCLUDE_DIR)
|
||||||
if(ZLIB_FOUND AND Threads_FOUND AND PROTOZERO_INCLUDE_DIR)
|
if(ZLIB_FOUND AND Threads_FOUND AND PROTOZERO_FOUND)
|
||||||
list(APPEND OSMIUM_PBF_LIBRARIES
|
list(APPEND OSMIUM_PBF_LIBRARIES
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
)
|
)
|
||||||
if(WIN32)
|
|
||||||
# This is needed for the ntohl() function
|
|
||||||
list(APPEND OSMIUM_PBF_LIBRARIES ws2_32)
|
|
||||||
endif()
|
|
||||||
list(APPEND OSMIUM_INCLUDE_DIRS
|
list(APPEND OSMIUM_INCLUDE_DIRS
|
||||||
${ZLIB_INCLUDE_DIR}
|
${ZLIB_INCLUDE_DIR}
|
||||||
${PROTOZERO_INCLUDE_DIR}
|
${PROTOZERO_INCLUDE_DIR}
|
||||||
@ -361,10 +345,10 @@ endif()
|
|||||||
set(OSMIUM_DRACONIC_CLANG_OPTIONS "-Wdocumentation -Wunused-exception-parameter -Wmissing-declarations -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-exit-time-destructors -Wno-global-constructors -Wno-padded -Wno-switch-enum -Wno-missing-prototypes -Wno-weak-vtables -Wno-cast-align -Wno-float-equal")
|
set(OSMIUM_DRACONIC_CLANG_OPTIONS "-Wdocumentation -Wunused-exception-parameter -Wmissing-declarations -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-exit-time-destructors -Wno-global-constructors -Wno-padded -Wno-switch-enum -Wno-missing-prototypes -Wno-weak-vtables -Wno-cast-align -Wno-float-equal")
|
||||||
|
|
||||||
if(Osmium_DEBUG)
|
if(Osmium_DEBUG)
|
||||||
message(STATUS "OSMIUM_XML_LIBRARIES=" ${OSMIUM_XML_LIBRARIES})
|
message(STATUS "OSMIUM_XML_LIBRARIES=${OSMIUM_XML_LIBRARIES}")
|
||||||
message(STATUS "OSMIUM_PBF_LIBRARIES=" ${OSMIUM_PBF_LIBRARIES})
|
message(STATUS "OSMIUM_PBF_LIBRARIES=${OSMIUM_PBF_LIBRARIES}")
|
||||||
message(STATUS "OSMIUM_IO_LIBRARIES=" ${OSMIUM_IO_LIBRARIES})
|
message(STATUS "OSMIUM_IO_LIBRARIES=${OSMIUM_IO_LIBRARIES}")
|
||||||
message(STATUS "OSMIUM_LIBRARIES=" ${OSMIUM_LIBRARIES})
|
message(STATUS "OSMIUM_LIBRARIES=${OSMIUM_LIBRARIES}")
|
||||||
message(STATUS "OSMIUM_INCLUDE_DIRS=" ${OSMIUM_INCLUDE_DIRS})
|
message(STATUS "OSMIUM_INCLUDE_DIRS=${OSMIUM_INCLUDE_DIRS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
63
third_party/libosmium/cmake/FindProtozero.cmake
vendored
Normal file
63
third_party/libosmium/cmake/FindProtozero.cmake
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# FindProtozero.cmake
|
||||||
|
#
|
||||||
|
# Find the protozero headers.
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# Copy this file somewhere into your project directory, where cmake can
|
||||||
|
# find it. Usually this will be a directory called "cmake" which you can
|
||||||
|
# add to the CMake module search path with the following line in your
|
||||||
|
# CMakeLists.txt:
|
||||||
|
#
|
||||||
|
# list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
#
|
||||||
|
# Then add the following in your CMakeLists.txt:
|
||||||
|
#
|
||||||
|
# find_package(Protozero [version] [REQUIRED])
|
||||||
|
# include_directories(SYSTEM ${PROTOZERO_INCLUDE_DIR})
|
||||||
|
#
|
||||||
|
# The version number is optional. If it is not set, any version of
|
||||||
|
# protozero will do.
|
||||||
|
#
|
||||||
|
# if(NOT PROTOZERO_FOUND)
|
||||||
|
# message(WARNING "Protozero not found!\n")
|
||||||
|
# endif()
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Variables:
|
||||||
|
#
|
||||||
|
# PROTOZERO_FOUND - True if Protozero was found.
|
||||||
|
# PROTOZERO_INCLUDE_DIR - Where to find include files.
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# find include path
|
||||||
|
find_path(PROTOZERO_INCLUDE_DIR protozero/version.hpp
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
PATHS ${CMAKE_SOURCE_DIR}/../protozero
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check version number
|
||||||
|
if(Protozero_FIND_VERSION)
|
||||||
|
file(STRINGS "${PROTOZERO_INCLUDE_DIR}/protozero/version.hpp" _version_define REGEX "#define PROTOZERO_VERSION_STRING")
|
||||||
|
if("${_version_define}" MATCHES "#define PROTOZERO_VERSION_STRING \"([0-9.]+)\"")
|
||||||
|
set(_version "${CMAKE_MATCH_1}")
|
||||||
|
else()
|
||||||
|
set(_version "unknown")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#set(PROTOZERO_INCLUDE_DIRS "${PROTOZERO_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Protozero
|
||||||
|
REQUIRED_VARS PROTOZERO_INCLUDE_DIR
|
||||||
|
VERSION_VAR _version)
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
19
third_party/libosmium/examples/CMakeLists.txt
vendored
19
third_party/libosmium/examples/CMakeLists.txt
vendored
@ -30,25 +30,6 @@ set(EXAMPLES
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Examples depending on wingetopt
|
|
||||||
#
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
set(GETOPT_EXAMPLES area_test convert index_lookup)
|
|
||||||
if(NOT GETOPT_MISSING)
|
|
||||||
foreach(example ${GETOPT_EXAMPLES})
|
|
||||||
list(APPEND EXAMPLE_LIBS_${example} ${GETOPT_LIBRARY})
|
|
||||||
endforeach()
|
|
||||||
else()
|
|
||||||
message(STATUS "Configuring examples - Skipping examples because on Visual Studio the wingetopt library is needed and was not found:")
|
|
||||||
foreach(example ${GETOPT_EXAMPLES})
|
|
||||||
message(STATUS " - osmium_${example}")
|
|
||||||
list(REMOVE_ITEM EXAMPLES ${example})
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Configure examples
|
# Configure examples
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib> // for std::exit
|
#include <cstdlib> // for std::exit
|
||||||
#include <getopt.h> // for getopt_long
|
#include <cstring> // for std::strcmp
|
||||||
#include <iostream> // for std::cout, std::cerr
|
#include <iostream> // for std::cout, std::cerr
|
||||||
|
|
||||||
// For assembling multipolygons
|
// For assembling multipolygons
|
||||||
@ -91,13 +91,21 @@ void print_help() {
|
|||||||
<< " -o, --dump-objects Dump area objects\n";
|
<< " -o, --dump-objects Dump area objects\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_usage(const char* prgname) {
|
||||||
|
std::cerr << "Usage: " << prgname << " [OPTIONS] OSMFILE\n";
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
static struct option long_options[] = {
|
if (argc > 1 && (!std::strcmp(argv[1], "-h") ||
|
||||||
{"help", no_argument, nullptr, 'h'},
|
!std::strcmp(argv[1], "--help"))) {
|
||||||
{"dump-wkt", no_argument, nullptr, 'w'},
|
print_help();
|
||||||
{"dump-objects", no_argument, nullptr, 'o'},
|
std::exit(0);
|
||||||
{nullptr, 0, nullptr, 0}
|
}
|
||||||
};
|
|
||||||
|
if (argc != 3) {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize an empty DynamicHandler. Later it will be associated
|
// Initialize an empty DynamicHandler. Later it will be associated
|
||||||
// with one of the handlers. You can think of the DynamicHandler as
|
// with one of the handlers. You can think of the DynamicHandler as
|
||||||
@ -105,35 +113,15 @@ int main(int argc, char* argv[]) {
|
|||||||
// real handler.
|
// real handler.
|
||||||
osmium::handler::DynamicHandler handler;
|
osmium::handler::DynamicHandler handler;
|
||||||
|
|
||||||
// Read options from command line.
|
if (!std::strcmp(argv[1], "-w") || !std::strcmp(argv[1], "--dump-wkt")) {
|
||||||
while (true) {
|
|
||||||
const int c = getopt_long(argc, argv, "hwo", long_options, nullptr);
|
|
||||||
if (c == -1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c) {
|
|
||||||
case 'h':
|
|
||||||
print_help();
|
|
||||||
std::exit(0);
|
|
||||||
case 'w':
|
|
||||||
handler.set<WKTDump>();
|
handler.set<WKTDump>();
|
||||||
break;
|
} else if (!std::strcmp(argv[1], "-o") || !std::strcmp(argv[1], "--dump-objects")) {
|
||||||
case 'o':
|
|
||||||
handler.set<osmium::handler::Dump>(std::cout);
|
handler.set<osmium::handler::Dump>(std::cout);
|
||||||
break;
|
} else {
|
||||||
default:
|
print_usage(argv[0]);
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const int remaining_args = argc - optind;
|
osmium::io::File input_file{argv[2]};
|
||||||
if (remaining_args != 1) {
|
|
||||||
std::cerr << "Usage: " << argv[0] << " [OPTIONS] OSMFILE\n";
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
osmium::io::File input_file{argv[optind]};
|
|
||||||
|
|
||||||
// Configuration for the multipolygon assembler. Here the default settings
|
// Configuration for the multipolygon assembler. Here the default settings
|
||||||
// are used, but you could change multiple settings.
|
// are used, but you could change multiple settings.
|
||||||
|
@ -76,8 +76,9 @@ class RewriteHandler : public osmium::handler::Handler {
|
|||||||
// Iterate over all tags and build new tags using the new builder
|
// Iterate over all tags and build new tags using the new builder
|
||||||
// based on the old ones.
|
// based on the old ones.
|
||||||
for (const auto& tag : tags) {
|
for (const auto& tag : tags) {
|
||||||
if (std::strcmp(tag.key(), "created_by")) {
|
if (!std::strcmp(tag.key(), "created_by")) {
|
||||||
if (!std::strcmp(tag.key(), "landuse") && !std::strcmp(tag.value(), "forest")) {
|
// ignore
|
||||||
|
} else if (!std::strcmp(tag.key(), "landuse") && !std::strcmp(tag.value(), "forest")) {
|
||||||
// add_tag() can be called with key and value C strings
|
// add_tag() can be called with key and value C strings
|
||||||
builder.add_tag("natural", "wood");
|
builder.add_tag("natural", "wood");
|
||||||
} else {
|
} else {
|
||||||
@ -86,7 +87,6 @@ class RewriteHandler : public osmium::handler::Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdlib> // for std::exit
|
#include <cstdlib> // for std::exit
|
||||||
|
#include <cstring> // for std::strcmp
|
||||||
#include <exception> // for std::exception
|
#include <exception> // for std::exception
|
||||||
#include <getopt.h> // for getopt_long
|
|
||||||
#include <iostream> // for std::cout, std::cerr
|
#include <iostream> // for std::cout, std::cerr
|
||||||
#include <string> // for std::string
|
#include <string> // for std::string
|
||||||
|
|
||||||
@ -51,13 +51,21 @@ void print_help() {
|
|||||||
<< " -t, --to-format=FORMAT Output format\n";
|
<< " -t, --to-format=FORMAT Output format\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_usage(const char* prgname) {
|
||||||
|
std::cerr << "Usage: " << prgname << " [OPTIONS] [INFILE [OUTFILE]]\n";
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
static struct option long_options[] = {
|
if (argc == 1) {
|
||||||
{"help", no_argument, nullptr, 'h'},
|
print_usage(argv[0]);
|
||||||
{"from-format", required_argument, nullptr, 'f'},
|
}
|
||||||
{"to-format", required_argument, nullptr, 't'},
|
|
||||||
{nullptr, 0, nullptr, 0}
|
if (argc > 1 && (!std::strcmp(argv[1], "-h") ||
|
||||||
};
|
!std::strcmp(argv[1], "--help"))) {
|
||||||
|
print_help();
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Input and output format are empty by default. Later this will mean that
|
// Input and output format are empty by default. Later this will mean that
|
||||||
// the format should be taken from the input and output file suffix,
|
// the format should be taken from the input and output file suffix,
|
||||||
@ -65,44 +73,35 @@ int main(int argc, char* argv[]) {
|
|||||||
std::string input_format;
|
std::string input_format;
|
||||||
std::string output_format;
|
std::string output_format;
|
||||||
|
|
||||||
// Read options from command line.
|
|
||||||
while (true) {
|
|
||||||
const int c = getopt_long(argc, argv, "dhf:t:", long_options, nullptr);
|
|
||||||
if (c == -1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c) {
|
|
||||||
case 'h':
|
|
||||||
print_help();
|
|
||||||
std::exit(0);
|
|
||||||
case 'f':
|
|
||||||
input_format = optarg;
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
output_format = optarg;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const int remaining_args = argc - optind;
|
|
||||||
if (remaining_args == 0 || remaining_args > 2) {
|
|
||||||
std::cerr << "Usage: " << argv[0] << " [OPTIONS] [INFILE [OUTFILE]]\n";
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get input file name from command line.
|
|
||||||
std::string input_file_name;
|
std::string input_file_name;
|
||||||
if (remaining_args >= 1) {
|
|
||||||
input_file_name = argv[optind];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get output file name from command line.
|
|
||||||
std::string output_file_name;
|
std::string output_file_name;
|
||||||
if (remaining_args == 2) {
|
|
||||||
output_file_name = argv[optind+1];
|
for (int i = 1; i < argc; ++i) {
|
||||||
|
if (!std::strcmp(argv[i], "-f") || !std::strcmp(argv[i], "--from-format")) {
|
||||||
|
++i;
|
||||||
|
if (i < argc) {
|
||||||
|
input_format = argv[i];
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
} else if (!std::strncmp(argv[i], "--from-format=", 14)) {
|
||||||
|
input_format = argv[i] + 14;
|
||||||
|
} else if (!std::strcmp(argv[i], "-t") || !std::strcmp(argv[i], "--to-format")) {
|
||||||
|
++i;
|
||||||
|
if (i < argc) {
|
||||||
|
output_format = argv[i];
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
} else if (!std::strncmp(argv[i], "--to-format=", 12)) {
|
||||||
|
output_format = argv[i] + 12;
|
||||||
|
} else if (input_file_name.empty()) {
|
||||||
|
input_file_name = argv[i];
|
||||||
|
} else if (output_file_name.empty()) {
|
||||||
|
output_file_name = argv[i];
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This declares the input and output files using either the suffix of
|
// This declares the input and output files using either the suffix of
|
||||||
|
@ -43,17 +43,17 @@ struct CountHandler : public osmium::handler::Handler {
|
|||||||
std::uint64_t relations = 0;
|
std::uint64_t relations = 0;
|
||||||
|
|
||||||
// This callback is called by osmium::apply for each node in the data.
|
// This callback is called by osmium::apply for each node in the data.
|
||||||
void node(const osmium::Node&) noexcept {
|
void node(const osmium::Node& /*node*/) noexcept {
|
||||||
++nodes;
|
++nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This callback is called by osmium::apply for each way in the data.
|
// This callback is called by osmium::apply for each way in the data.
|
||||||
void way(const osmium::Way&) noexcept {
|
void way(const osmium::Way& /*way*/) noexcept {
|
||||||
++ways;
|
++ways;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This callback is called by osmium::apply for each relation in the data.
|
// This callback is called by osmium::apply for each relation in the data.
|
||||||
void relation(const osmium::Relation&) noexcept {
|
void relation(const osmium::Relation& /*relation*/) noexcept {
|
||||||
++relations;
|
++relations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,8 @@
|
|||||||
#include <osmium/io/any_output.hpp>
|
#include <osmium/io/any_output.hpp>
|
||||||
|
|
||||||
// We want to use the builder interface
|
// We want to use the builder interface
|
||||||
#include <osmium/builder/osm_object_builder.hpp>
|
|
||||||
#include <osmium/builder/attr.hpp>
|
#include <osmium/builder/attr.hpp>
|
||||||
|
#include <osmium/builder/osm_object_builder.hpp>
|
||||||
// Declare this to use the functions starting with the underscore (_) below.
|
|
||||||
using namespace osmium::builder::attr;
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
@ -56,6 +53,9 @@ int main(int argc, char* argv[]) {
|
|||||||
const size_t initial_buffer_size = 10000;
|
const size_t initial_buffer_size = 10000;
|
||||||
osmium::memory::Buffer buffer{initial_buffer_size, osmium::memory::Buffer::auto_grow::yes};
|
osmium::memory::Buffer buffer{initial_buffer_size, osmium::memory::Buffer::auto_grow::yes};
|
||||||
|
|
||||||
|
// Declare this to use the functions starting with the underscore (_) below.
|
||||||
|
using namespace osmium::builder::attr; // NOLINT(google-build-using-namespace)
|
||||||
|
|
||||||
// Add nodes to the buffer. This is, of course, only an example.
|
// Add nodes to the buffer. This is, of course, only an example.
|
||||||
// You can set any of the attributes and more tags, etc. Ways and
|
// You can set any of the attributes and more tags, etc. Ways and
|
||||||
// relations can be added in a similar way.
|
// relations can be added in a similar way.
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cerrno> // for errno
|
#include <cerrno> // for errno
|
||||||
#include <cstring> // for std::strerror
|
|
||||||
#include <cstdlib> // for std::exit
|
#include <cstdlib> // for std::exit
|
||||||
|
#include <cstring> // for std::strerror
|
||||||
#include <iostream> // for std::cout, std::cerr
|
#include <iostream> // for std::cout, std::cerr
|
||||||
#include <string> // for std::string
|
#include <string> // for std::string
|
||||||
#include <sys/stat.h> // for open
|
#include <sys/stat.h> // for open
|
||||||
@ -71,7 +71,7 @@ class IndexFile {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
explicit IndexFile(const std::string& filename) :
|
explicit IndexFile(const std::string& filename) :
|
||||||
m_fd(::open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666)) {
|
m_fd(::open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666)) { // NOLINT(hicpp-signed-bitwise)
|
||||||
if (m_fd < 0) {
|
if (m_fd < 0) {
|
||||||
std::cerr << "Can't open index file '" << filename << "': " << std::strerror(errno) << "\n";
|
std::cerr << "Can't open index file '" << filename << "': " << std::strerror(errno) << "\n";
|
||||||
std::exit(2);
|
std::exit(2);
|
||||||
@ -81,6 +81,12 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IndexFile(const IndexFile&) = delete;
|
||||||
|
IndexFile& operator=(const IndexFile&) = delete;
|
||||||
|
|
||||||
|
IndexFile(IndexFile&&) = delete;
|
||||||
|
IndexFile& operator=(IndexFile&&) = delete;
|
||||||
|
|
||||||
~IndexFile() {
|
~IndexFile() {
|
||||||
if (m_fd >= 0) {
|
if (m_fd >= 0) {
|
||||||
close(m_fd);
|
close(m_fd);
|
||||||
@ -115,7 +121,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
// Create the output file which will contain our serialized OSM data
|
// Create the output file which will contain our serialized OSM data
|
||||||
const std::string data_file{output_dir + "/data.osm.ser"};
|
const std::string data_file{output_dir + "/data.osm.ser"};
|
||||||
const int data_fd = ::open(data_file.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
const int data_fd = ::open(data_file.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666); // NOLINT(hicpp-signed-bitwise)
|
||||||
if (data_fd < 0) {
|
if (data_fd < 0) {
|
||||||
std::cerr << "Can't open data file '" << data_file << "': " << std::strerror(errno) << "\n";
|
std::cerr << "Can't open data file '" << data_file << "': " << std::strerror(errno) << "\n";
|
||||||
std::exit(2);
|
std::exit(2);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
EXAMPLE osmium_filter_discussions
|
EXAMPLE osmium_filter_discussions
|
||||||
|
|
||||||
Read OSM changesets with discussions from a changeset dump like the one
|
Read OSM changesets with discussions from a changeset dump like the one
|
||||||
you get from http://planet.osm.org/planet/discussions-latest.osm.bz2
|
you get from https://planet.osm.org/planet/discussions-latest.osm.bz2
|
||||||
and write out only those changesets which have discussions (ie comments).
|
and write out only those changesets which have discussions (ie comments).
|
||||||
|
|
||||||
DEMONSTRATES USE OF:
|
DEMONSTRATES USE OF:
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include <algorithm> // for std::all_of, std::equal_range
|
#include <algorithm> // for std::all_of, std::equal_range
|
||||||
#include <cstdlib> // for std::exit
|
#include <cstdlib> // for std::exit
|
||||||
|
#include <cstring> // for std::strcmp
|
||||||
#include <fcntl.h> // for open
|
#include <fcntl.h> // for open
|
||||||
#include <getopt.h> // for getopt_long
|
|
||||||
#include <iostream> // for std::cout, std::cerr
|
#include <iostream> // for std::cout, std::cerr
|
||||||
#include <memory> // for std::unique_ptr
|
#include <memory> // for std::unique_ptr
|
||||||
#include <string> // for std::string
|
#include <string> // for std::string
|
||||||
@ -64,6 +64,12 @@ public:
|
|||||||
return m_fd;
|
return m_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IndexAccess(const IndexAccess&) = delete;
|
||||||
|
IndexAccess& operator=(const IndexAccess&) = delete;
|
||||||
|
|
||||||
|
IndexAccess(IndexAccess&&) = delete;
|
||||||
|
IndexAccess& operator=(IndexAccess&&) = delete;
|
||||||
|
|
||||||
virtual ~IndexAccess() = default;
|
virtual ~IndexAccess() = default;
|
||||||
|
|
||||||
virtual void dump() const = 0;
|
virtual void dump() const = 0;
|
||||||
@ -187,58 +193,70 @@ class Options {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_usage(const char* prgname) {
|
||||||
|
std::cout << "Usage: " << prgname << " [OPTIONS]\n\n";
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Options(int argc, char* argv[]) {
|
Options(int argc, char* argv[]) {
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
print_help();
|
print_usage(argv[0]);
|
||||||
std::exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct option long_options[] = {
|
if (argc > 1 && (!std::strcmp(argv[1], "-h") ||
|
||||||
{"array", required_argument, nullptr, 'a'},
|
!std::strcmp(argv[1], "--help"))) {
|
||||||
{"dump", no_argument, nullptr, 'd'},
|
|
||||||
{"help", no_argument, nullptr, 'h'},
|
|
||||||
{"list", required_argument, nullptr, 'l'},
|
|
||||||
{"search", required_argument, nullptr, 's'},
|
|
||||||
{"type", required_argument, nullptr, 't'},
|
|
||||||
{nullptr, 0, nullptr, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
const int c = getopt_long(argc, argv, "a:dhl:s:t:", long_options, nullptr);
|
|
||||||
if (c == -1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (c) {
|
|
||||||
case 'a':
|
|
||||||
m_array_format = true;
|
|
||||||
m_filename = optarg;
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
m_dump = true;
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
print_help();
|
print_help();
|
||||||
std::exit(0);
|
std::exit(0);
|
||||||
case 'l':
|
|
||||||
m_list_format = true;
|
|
||||||
m_filename = optarg;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
m_ids.push_back(std::atoll(optarg));
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
m_type = optarg;
|
|
||||||
if (m_type != "location" && m_type != "id" && m_type != "offset") {
|
|
||||||
std::cerr << "Unknown type '" << m_type
|
|
||||||
<< "'. Must be 'location', 'id', or 'offset'.\n";
|
|
||||||
std::exit(2);
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
for (int i = 1; i < argc; ++i) {
|
||||||
std::exit(2);
|
if (!std::strcmp(argv[i], "-a") || !std::strcmp(argv[i], "--array")) {
|
||||||
|
++i;
|
||||||
|
if (i < argc) {
|
||||||
|
m_array_format = true;
|
||||||
|
m_filename = argv[i];
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
} else if (!std::strncmp(argv[i], "--array=", 8)) {
|
||||||
|
m_array_format = true;
|
||||||
|
m_filename = argv[i] + 8;
|
||||||
|
} else if (!std::strcmp(argv[i], "-l") || !std::strcmp(argv[i], "--list")) {
|
||||||
|
++i;
|
||||||
|
if (i < argc) {
|
||||||
|
m_list_format = true;
|
||||||
|
m_filename = argv[i];
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
} else if (!std::strncmp(argv[i], "--list=", 7)) {
|
||||||
|
m_list_format = true;
|
||||||
|
m_filename = argv[i] + 7;
|
||||||
|
} else if (!std::strcmp(argv[i], "-d") || !std::strcmp(argv[i], "--dump")) {
|
||||||
|
m_dump = true;
|
||||||
|
} else if (!std::strcmp(argv[i], "-s") || !std::strcmp(argv[i], "--search")) {
|
||||||
|
++i;
|
||||||
|
if (i < argc) {
|
||||||
|
m_ids.push_back(std::atoll(argv[i])); // NOLINT(cert-err34-c)
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
} else if (!std::strncmp(argv[i], "--search=", 9)) {
|
||||||
|
m_ids.push_back(std::atoll(argv[i] + 9)); // NOLINT(cert-err34-c)
|
||||||
|
} else if (!std::strcmp(argv[i], "-t") || !std::strcmp(argv[i], "--type")) {
|
||||||
|
++i;
|
||||||
|
if (i < argc) {
|
||||||
|
m_type = argv[i];
|
||||||
|
} else {
|
||||||
|
print_usage(argv[0]);
|
||||||
|
}
|
||||||
|
} else if (!std::strncmp(argv[i], "--type=", 7)) {
|
||||||
|
m_type = argv[i] + 7;
|
||||||
|
} else {
|
||||||
|
std::cerr << "Unknown command line options or arguments\n";
|
||||||
|
print_usage(argv[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,6 +275,11 @@ public:
|
|||||||
std::exit(2);
|
std::exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_type != "location" && m_type != "id" && m_type != "offset") {
|
||||||
|
std::cerr << "Unknown type '" << m_type
|
||||||
|
<< "'. Must be 'location', 'id', or 'offset'.\n";
|
||||||
|
std::exit(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* filename() const noexcept {
|
const char* filename() const noexcept {
|
||||||
@ -302,9 +325,8 @@ int run(const IndexAccess<TValue>& index, const Options& options) {
|
|||||||
if (options.do_dump()) {
|
if (options.do_dump()) {
|
||||||
index.dump();
|
index.dump();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
return index.search(options.search_keys()) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
return index.search(options.search_keys()) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
@ -329,16 +351,18 @@ int main(int argc, char* argv[]) {
|
|||||||
// index id -> location
|
// index id -> location
|
||||||
const auto index = create<osmium::Location>(options.dense_format(), fd);
|
const auto index = create<osmium::Location>(options.dense_format(), fd);
|
||||||
return run(*index, options);
|
return run(*index, options);
|
||||||
} else if (options.type_is("id")) {
|
}
|
||||||
|
|
||||||
|
if (options.type_is("id")) {
|
||||||
// index id -> id
|
// index id -> id
|
||||||
const auto index = create<osmium::unsigned_object_id_type>(options.dense_format(), fd);
|
const auto index = create<osmium::unsigned_object_id_type>(options.dense_format(), fd);
|
||||||
return run(*index, options);
|
return run(*index, options);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// index id -> offset
|
// index id -> offset
|
||||||
const auto index = create<std::size_t>(options.dense_format(), fd);
|
const auto index = create<std::size_t>(options.dense_format(), fd);
|
||||||
return run(*index, options);
|
return run(*index, options);
|
||||||
}
|
} catch (const std::exception& e) {
|
||||||
} catch(const std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << '\n';
|
std::cerr << "Error: " << e.what() << '\n';
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
|
|
||||||
// For the location index. There are different types of index implementation
|
// For the location index. There are different types of index implementation
|
||||||
// available. These implementations put the index on disk. See below.
|
// available. These implementations put the index on disk. See below.
|
||||||
#include <osmium/index/map/sparse_file_array.hpp>
|
|
||||||
#include <osmium/index/map/dense_file_array.hpp>
|
#include <osmium/index/map/dense_file_array.hpp>
|
||||||
|
#include <osmium/index/map/sparse_file_array.hpp>
|
||||||
|
|
||||||
// For the NodeLocationForWays handler
|
// For the NodeLocationForWays handler
|
||||||
#include <osmium/handler/node_locations_for_ways.hpp>
|
#include <osmium/handler/node_locations_for_ways.hpp>
|
||||||
@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
|
|||||||
osmium::io::Reader reader{input_filename, osmium::osm_entity_bits::node};
|
osmium::io::Reader reader{input_filename, osmium::osm_entity_bits::node};
|
||||||
|
|
||||||
// Initialize location index on disk creating a new file.
|
// Initialize location index on disk creating a new file.
|
||||||
const int fd = ::open(cache_filename.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666);
|
const int fd = ::open(cache_filename.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666); // NOLINT(hicpp-signed-bitwise)
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
std::cerr << "Can not open location cache file '" << cache_filename << "': " << std::strerror(errno) << "\n";
|
std::cerr << "Can not open location cache file '" << cache_filename << "': " << std::strerror(errno) << "\n";
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
|
@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
|
|||||||
osmium::io::Reader reader{input_file};
|
osmium::io::Reader reader{input_file};
|
||||||
|
|
||||||
// Initialize progress bar, enable it only if STDERR is a TTY.
|
// Initialize progress bar, enable it only if STDERR is a TTY.
|
||||||
osmium::ProgressBar progress{reader.file_size(), osmium::util::isatty(2)};
|
osmium::ProgressBar progress{reader.file_size(), osmium::isatty(2)};
|
||||||
|
|
||||||
// OSM data comes in buffers, read until there are no more.
|
// OSM data comes in buffers, read until there are no more.
|
||||||
while (osmium::memory::Buffer buffer = reader.read()) {
|
while (osmium::memory::Buffer buffer = reader.read()) {
|
||||||
|
20
third_party/libosmium/examples/osmium_tiles.cpp
vendored
20
third_party/libosmium/examples/osmium_tiles.cpp
vendored
@ -36,21 +36,21 @@ int main(int argc, char* argv[]) {
|
|||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int zoom = std::atoi(argv[1]);
|
const int zoom = std::atoi(argv[1]); // NOLINT(cert-err34-c)
|
||||||
|
|
||||||
if (zoom < 0 || zoom > 30) {
|
if (zoom < 0 || zoom > 30) {
|
||||||
std::cerr << "ERROR: Zoom must be between 0 and 30\n";
|
std::cerr << "ERROR: Zoom must be between 0 and 30\n";
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const double lon = std::atof(argv[2]);
|
osmium::Location location{};
|
||||||
const double lat = std::atof(argv[3]);
|
try {
|
||||||
|
location.set_lon(argv[2]);
|
||||||
// Create location from WGS84 coordinates. In Osmium the order of
|
location.set_lat(argv[3]);
|
||||||
// coordinate values is always x/longitude first, then y/latitude.
|
} catch (const osmium::invalid_location&) {
|
||||||
const osmium::Location location{lon, lat};
|
std::cerr << "ERROR: Location is invalid\n";
|
||||||
|
std::exit(1);
|
||||||
std::cout << "WGS84: lon=" << lon << " lat=" << lat << "\n";
|
}
|
||||||
|
|
||||||
// A location can store some invalid locations, ie locations outside the
|
// A location can store some invalid locations, ie locations outside the
|
||||||
// -180 to 180 and -90 to 90 degree range. This function checks for that.
|
// -180 to 180 and -90 to 90 degree range. This function checks for that.
|
||||||
@ -59,6 +59,8 @@ int main(int argc, char* argv[]) {
|
|||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "WGS84: lon=" << location.lon() << " lat=" << location.lat() << "\n";
|
||||||
|
|
||||||
// Project the coordinates using a helper function. You can also use the
|
// Project the coordinates using a helper function. You can also use the
|
||||||
// osmium::geom::MercatorProjection class.
|
// osmium::geom::MercatorProjection class.
|
||||||
const osmium::geom::Coordinates c = osmium::geom::lonlat_to_mercator(location);
|
const osmium::geom::Coordinates c = osmium::geom::lonlat_to_mercator(location);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,10 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/area/assembler_config.hpp>
|
#include <osmium/area/assembler_config.hpp>
|
||||||
#include <osmium/area/detail/basic_assembler_with_tags.hpp>
|
#include <osmium/area/detail/basic_assembler_with_tags.hpp>
|
||||||
#include <osmium/area/detail/segment_list.hpp>
|
#include <osmium/area/detail/segment_list.hpp>
|
||||||
@ -50,6 +46,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/tag.hpp>
|
#include <osmium/osm/tag.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -111,8 +111,6 @@ namespace osmium {
|
|||||||
detail::BasicAssemblerWithTags(config) {
|
detail::BasicAssemblerWithTags(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~Assembler() noexcept = default;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assemble an area from the given way.
|
* Assemble an area from the given way.
|
||||||
* The resulting area is put into the out_buffer.
|
* The resulting area is put into the out_buffer.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,18 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring>
|
|
||||||
#include <functional>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <set>
|
|
||||||
#include <string>
|
|
||||||
#include <map>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/area/assembler_config.hpp>
|
#include <osmium/area/assembler_config.hpp>
|
||||||
#include <osmium/area/detail/basic_assembler_with_tags.hpp>
|
#include <osmium/area/detail/basic_assembler_with_tags.hpp>
|
||||||
#include <osmium/area/detail/proto_ring.hpp>
|
#include <osmium/area/detail/proto_ring.hpp>
|
||||||
@ -62,6 +50,18 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
#include <osmium/tags/filter.hpp>
|
#include <osmium/tags/filter.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
|
#include <functional>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -207,8 +207,6 @@ namespace osmium {
|
|||||||
detail::BasicAssemblerWithTags(config) {
|
detail::BasicAssemblerWithTags(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~AssemblerLegacy() noexcept = default;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assemble an area from the given way.
|
* Assemble an area from the given way.
|
||||||
* The resulting area is put into the out_buffer.
|
* The resulting area is put into the out_buffer.
|
||||||
@ -335,7 +333,7 @@ namespace osmium {
|
|||||||
if (stats().wrong_role == 0) {
|
if (stats().wrong_role == 0) {
|
||||||
detail::for_each_member(relation, members, [this, &ways_that_should_be_areas, &area_tags](const osmium::RelationMember& member, const osmium::Way& way) {
|
detail::for_each_member(relation, members, [this, &ways_that_should_be_areas, &area_tags](const osmium::RelationMember& member, const osmium::Way& way) {
|
||||||
if (!std::strcmp(member.role(), "inner")) {
|
if (!std::strcmp(member.role(), "inner")) {
|
||||||
if (!way.nodes().empty() && way.is_closed() && way.tags().size() > 0) {
|
if (!way.nodes().empty() && way.is_closed() && !way.tags().empty()) {
|
||||||
const auto d = std::count_if(way.tags().cbegin(), way.tags().cend(), std::cref(filter()));
|
const auto d = std::count_if(way.tags().cbegin(), way.tags().cend(), std::cref(filter()));
|
||||||
if (d > 0) {
|
if (d > 0) {
|
||||||
osmium::tags::KeyFilter::iterator way_fi_begin(std::cref(filter()), way.tags().cbegin(), way.tags().cend());
|
osmium::tags::KeyFilter::iterator way_fi_begin(std::cref(filter()), way.tags().cbegin(), way.tags().cend());
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,6 +33,20 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/area/assembler_config.hpp>
|
||||||
|
#include <osmium/area/detail/node_ref_segment.hpp>
|
||||||
|
#include <osmium/area/detail/proto_ring.hpp>
|
||||||
|
#include <osmium/area/detail/segment_list.hpp>
|
||||||
|
#include <osmium/area/problem_reporter.hpp>
|
||||||
|
#include <osmium/area/stats.hpp>
|
||||||
|
#include <osmium/builder/osm_object_builder.hpp>
|
||||||
|
#include <osmium/osm/location.hpp>
|
||||||
|
#include <osmium/osm/node_ref.hpp>
|
||||||
|
#include <osmium/osm/types.hpp>
|
||||||
|
#include <osmium/osm/way.hpp>
|
||||||
|
#include <osmium/util/iterator.hpp>
|
||||||
|
#include <osmium/util/timer.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -45,21 +59,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osmium/builder/osm_object_builder.hpp>
|
|
||||||
#include <osmium/osm/location.hpp>
|
|
||||||
#include <osmium/osm/node_ref.hpp>
|
|
||||||
#include <osmium/osm/types.hpp>
|
|
||||||
#include <osmium/osm/way.hpp>
|
|
||||||
#include <osmium/util/iterator.hpp>
|
|
||||||
#include <osmium/util/timer.hpp>
|
|
||||||
|
|
||||||
#include <osmium/area/assembler_config.hpp>
|
|
||||||
#include <osmium/area/detail/node_ref_segment.hpp>
|
|
||||||
#include <osmium/area/detail/proto_ring.hpp>
|
|
||||||
#include <osmium/area/detail/segment_list.hpp>
|
|
||||||
#include <osmium/area/problem_reporter.hpp>
|
|
||||||
#include <osmium/area/stats.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -70,19 +69,17 @@ namespace osmium {
|
|||||||
|
|
||||||
struct location_to_ring_map {
|
struct location_to_ring_map {
|
||||||
osmium::Location location;
|
osmium::Location location;
|
||||||
open_ring_its_type::iterator ring_it;
|
open_ring_its_type::iterator ring_it{};
|
||||||
bool start;
|
bool start{false};
|
||||||
|
|
||||||
location_to_ring_map(const osmium::Location& l, const open_ring_its_type::iterator& r, bool s) noexcept :
|
location_to_ring_map(osmium::Location l, open_ring_its_type::iterator r, const bool s) noexcept :
|
||||||
location(l),
|
location(l),
|
||||||
ring_it(r),
|
ring_it(r),
|
||||||
start(s) {
|
start(s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit location_to_ring_map(const osmium::Location& l) noexcept :
|
explicit location_to_ring_map(osmium::Location l) noexcept :
|
||||||
location(l),
|
location(l) {
|
||||||
ring_it(),
|
|
||||||
start(false) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProtoRing& ring() const noexcept {
|
const ProtoRing& ring() const noexcept {
|
||||||
@ -108,7 +105,7 @@ namespace osmium {
|
|||||||
|
|
||||||
struct slocation {
|
struct slocation {
|
||||||
|
|
||||||
static constexpr const uint32_t invalid_item = 1 << 30;
|
static constexpr const uint32_t invalid_item = 1u << 30u;
|
||||||
|
|
||||||
uint32_t item : 31;
|
uint32_t item : 31;
|
||||||
uint32_t reverse : 1;
|
uint32_t reverse : 1;
|
||||||
@ -320,7 +317,7 @@ namespace osmium {
|
|||||||
const int64_t ly = end_location.y();
|
const int64_t ly = end_location.y();
|
||||||
const auto z = (bx - ax)*(ly - ay) - (by - ay)*(lx - ax);
|
const auto z = (bx - ax)*(ly - ay) - (by - ay)*(lx - ax);
|
||||||
if (debug()) {
|
if (debug()) {
|
||||||
std::cerr << " Segment XXXX z=" << z << "\n";
|
std::cerr << " Segment z=" << z << '\n';
|
||||||
}
|
}
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
nesting += segment->is_reverse() ? -1 : 1;
|
nesting += segment->is_reverse() ? -1 : 1;
|
||||||
@ -623,8 +620,8 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void merge_two_rings(open_ring_its_type& open_ring_its, const location_to_ring_map& m1, const location_to_ring_map& m2) {
|
void merge_two_rings(open_ring_its_type& open_ring_its, const location_to_ring_map& m1, const location_to_ring_map& m2) {
|
||||||
std::list<ProtoRing>::iterator r1 = *m1.ring_it;
|
const auto r1 = *m1.ring_it;
|
||||||
std::list<ProtoRing>::iterator r2 = *m2.ring_it;
|
const auto r2 = *m2.ring_it;
|
||||||
|
|
||||||
if (r1->get_node_ref_stop().location() == r2->get_node_ref_start().location()) {
|
if (r1->get_node_ref_stop().location() == r2->get_node_ref_start().location()) {
|
||||||
r1->join_forward(*r2);
|
r1->join_forward(*r2);
|
||||||
@ -689,13 +686,12 @@ namespace osmium {
|
|||||||
|
|
||||||
struct candidate {
|
struct candidate {
|
||||||
int64_t sum;
|
int64_t sum;
|
||||||
std::vector<std::pair<location_to_ring_map, bool>> rings;
|
std::vector<std::pair<location_to_ring_map, bool>> rings{};
|
||||||
osmium::Location start_location;
|
osmium::Location start_location;
|
||||||
osmium::Location stop_location;
|
osmium::Location stop_location;
|
||||||
|
|
||||||
explicit candidate(location_to_ring_map& ring, bool reverse) :
|
explicit candidate(location_to_ring_map& ring, bool reverse) :
|
||||||
sum(ring.ring().sum()),
|
sum(ring.ring().sum()),
|
||||||
rings(),
|
|
||||||
start_location(ring.ring().get_node_ref_start().location()),
|
start_location(ring.ring().get_node_ref_start().location()),
|
||||||
stop_location(ring.ring().get_node_ref_stop().location()) {
|
stop_location(ring.ring().get_node_ref_stop().location()) {
|
||||||
rings.emplace_back(ring, reverse);
|
rings.emplace_back(ring, reverse);
|
||||||
@ -813,8 +809,8 @@ namespace osmium {
|
|||||||
++m_stats.open_rings;
|
++m_stats.open_rings;
|
||||||
if (m_config.problem_reporter) {
|
if (m_config.problem_reporter) {
|
||||||
for (auto& it : open_ring_its) {
|
for (auto& it : open_ring_its) {
|
||||||
m_config.problem_reporter->report_ring_not_closed(it->get_node_ref_start());
|
m_config.problem_reporter->report_ring_not_closed(it->get_node_ref_start(), nullptr);
|
||||||
m_config.problem_reporter->report_ring_not_closed(it->get_node_ref_stop());
|
m_config.problem_reporter->report_ring_not_closed(it->get_node_ref_stop(), nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -939,20 +935,6 @@ namespace osmium {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if any ways were completely removed in the
|
|
||||||
* erase_duplicate_segments step.
|
|
||||||
*/
|
|
||||||
bool ways_were_lost() {
|
|
||||||
std::unordered_set<const osmium::Way*> ways_in_segments;
|
|
||||||
|
|
||||||
for (const auto& segment : m_segment_list) {
|
|
||||||
ways_in_segments.insert(segment.way());
|
|
||||||
}
|
|
||||||
|
|
||||||
return ways_in_segments.size() < m_num_members;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef OSMIUM_WITH_TIMER
|
#ifdef OSMIUM_WITH_TIMER
|
||||||
static bool print_header() {
|
static bool print_header() {
|
||||||
std::cout << "nodes outer_rings inner_rings sort dupl intersection locations split simple_case complex_case roles_check\n";
|
std::cout << "nodes outer_rings inner_rings sort dupl intersection locations split simple_case complex_case roles_check\n";
|
||||||
@ -1022,15 +1004,6 @@ namespace osmium {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If one or more complete ways was removed because of
|
|
||||||
// duplicate segments, this isn't a valid area.
|
|
||||||
if (ways_were_lost()) {
|
|
||||||
if (debug()) {
|
|
||||||
std::cerr << " Complete ways removed because of duplicate segments\n";
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_config.debug_level >= 3) {
|
if (m_config.debug_level >= 3) {
|
||||||
std::cerr << "Sorted de-duplicated segment list:\n";
|
std::cerr << "Sorted de-duplicated segment list:\n";
|
||||||
for (const auto& s : m_segment_list) {
|
for (const auto& s : m_segment_list) {
|
||||||
@ -1170,8 +1143,6 @@ namespace osmium {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~BasicAssembler() noexcept = default;
|
|
||||||
|
|
||||||
const AssemblerConfig& config() const noexcept {
|
const AssemblerConfig& config() const noexcept {
|
||||||
return m_config;
|
return m_config;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include <osmium/area/assembler_config.hpp>
|
#include <osmium/area/assembler_config.hpp>
|
||||||
#include <osmium/area/detail/basic_assembler.hpp>
|
#include <osmium/area/detail/basic_assembler.hpp>
|
||||||
#include <osmium/area/stats.hpp>
|
#include <osmium/area/stats.hpp>
|
||||||
#include <osmium/builder/osm_object_builder.hpp>
|
#include <osmium/builder/osm_object_builder.hpp>
|
||||||
#include <osmium/osm/tag.hpp>
|
#include <osmium/osm/tag.hpp>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -68,7 +68,7 @@ namespace osmium {
|
|||||||
static void copy_tags_without_type(osmium::builder::AreaBuilder& builder, const osmium::TagList& tags) {
|
static void copy_tags_without_type(osmium::builder::AreaBuilder& builder, const osmium::TagList& tags) {
|
||||||
osmium::builder::TagListBuilder tl_builder{builder};
|
osmium::builder::TagListBuilder tl_builder{builder};
|
||||||
for (const osmium::Tag& tag : tags) {
|
for (const osmium::Tag& tag : tags) {
|
||||||
if (std::strcmp(tag.key(), "type")) {
|
if (std::strcmp(tag.key(), "type") != 0) {
|
||||||
tl_builder.add_tag(tag.key(), tag.value());
|
tl_builder.add_tag(tag.key(), tag.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,16 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/area/detail/vector.hpp>
|
||||||
|
#include <osmium/osm/location.hpp>
|
||||||
|
#include <osmium/osm/node_ref.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <osmium/area/detail/vector.hpp>
|
|
||||||
#include <osmium/osm/location.hpp>
|
|
||||||
#include <osmium/osm/node_ref.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class Way;
|
class Way;
|
||||||
@ -74,20 +74,20 @@ namespace osmium {
|
|||||||
class NodeRefSegment {
|
class NodeRefSegment {
|
||||||
|
|
||||||
// First node in order described above.
|
// First node in order described above.
|
||||||
osmium::NodeRef m_first;
|
osmium::NodeRef m_first{};
|
||||||
|
|
||||||
// Second node in order described above.
|
// Second node in order described above.
|
||||||
osmium::NodeRef m_second;
|
osmium::NodeRef m_second{};
|
||||||
|
|
||||||
// Way this segment was from.
|
// Way this segment was from.
|
||||||
const osmium::Way* m_way;
|
const osmium::Way* m_way = nullptr;
|
||||||
|
|
||||||
// The ring this segment is part of. Initially nullptr, this
|
// The ring this segment is part of. Initially nullptr, this
|
||||||
// will be filled in once we know which ring the segment is in.
|
// will be filled in once we know which ring the segment is in.
|
||||||
ProtoRing* m_ring;
|
ProtoRing* m_ring = nullptr;
|
||||||
|
|
||||||
// The role of this segment from the member role.
|
// The role of this segment from the member role.
|
||||||
role_type m_role;
|
role_type m_role = role_type::unknown;
|
||||||
|
|
||||||
// Nodes have to be reversed to get the intended order.
|
// Nodes have to be reversed to get the intended order.
|
||||||
bool m_reverse = false;
|
bool m_reverse = false;
|
||||||
@ -98,19 +98,12 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NodeRefSegment() noexcept :
|
NodeRefSegment() noexcept = default;
|
||||||
m_first(),
|
|
||||||
m_second(),
|
|
||||||
m_way(nullptr),
|
|
||||||
m_ring(nullptr),
|
|
||||||
m_role(role_type::unknown) {
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeRefSegment(const osmium::NodeRef& nr1, const osmium::NodeRef& nr2, role_type role, const osmium::Way* way) noexcept :
|
NodeRefSegment(const osmium::NodeRef& nr1, const osmium::NodeRef& nr2, role_type role, const osmium::Way* way) noexcept :
|
||||||
m_first(nr1),
|
m_first(nr1),
|
||||||
m_second(nr2),
|
m_second(nr2),
|
||||||
m_way(way),
|
m_way(way),
|
||||||
m_ring(nullptr),
|
|
||||||
m_role(role) {
|
m_role(role) {
|
||||||
if (nr2.location() < nr1.location()) {
|
if (nr2.location() < nr1.location()) {
|
||||||
using std::swap;
|
using std::swap;
|
||||||
@ -303,7 +296,7 @@ namespace osmium {
|
|||||||
* or a defined Location if the segments intersect.
|
* or a defined Location if the segments intersect.
|
||||||
*/
|
*/
|
||||||
inline osmium::Location calculate_intersection(const NodeRefSegment& s1, const NodeRefSegment& s2) noexcept {
|
inline osmium::Location calculate_intersection(const NodeRefSegment& s1, const NodeRefSegment& s2) noexcept {
|
||||||
// See http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
|
// See https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
|
||||||
// for some hints about how the algorithm works.
|
// for some hints about how the algorithm works.
|
||||||
const vec p0{s1.first()};
|
const vec p0{s1.first()};
|
||||||
const vec p1{s1.second()};
|
const vec p1{s1.second()};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,6 +33,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/area/detail/node_ref_segment.hpp>
|
||||||
|
#include <osmium/osm/location.hpp>
|
||||||
|
#include <osmium/osm/node_ref.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -40,10 +44,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osmium/osm/location.hpp>
|
|
||||||
#include <osmium/osm/node_ref.hpp>
|
|
||||||
#include <osmium/area/detail/node_ref_segment.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class Way;
|
class Way;
|
||||||
@ -64,18 +64,18 @@ namespace osmium {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
// Segments in this ring.
|
// Segments in this ring.
|
||||||
segments_type m_segments;
|
segments_type m_segments{};
|
||||||
|
|
||||||
// If this is an outer ring, these point to it's inner rings
|
// If this is an outer ring, these point to it's inner rings
|
||||||
// (if any).
|
// (if any).
|
||||||
std::vector<ProtoRing*> m_inner;
|
std::vector<ProtoRing*> m_inner{};
|
||||||
|
|
||||||
// The smallest segment. Will be kept current whenever a new
|
// The smallest segment. Will be kept current whenever a new
|
||||||
// segment is added to the ring.
|
// segment is added to the ring.
|
||||||
NodeRefSegment* m_min_segment;
|
NodeRefSegment* m_min_segment;
|
||||||
|
|
||||||
// If this is an inner ring, points to the outer ring.
|
// If this is an inner ring, points to the outer ring.
|
||||||
ProtoRing* m_outer_ring;
|
ProtoRing* m_outer_ring = nullptr;
|
||||||
|
|
||||||
#ifdef OSMIUM_DEBUG_RING_NO
|
#ifdef OSMIUM_DEBUG_RING_NO
|
||||||
static int64_t next_num() noexcept {
|
static int64_t next_num() noexcept {
|
||||||
@ -91,10 +91,7 @@ namespace osmium {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
explicit ProtoRing(NodeRefSegment* segment) noexcept :
|
explicit ProtoRing(NodeRefSegment* segment) noexcept :
|
||||||
m_segments(),
|
|
||||||
m_inner(),
|
|
||||||
m_min_segment(segment),
|
m_min_segment(segment),
|
||||||
m_outer_ring(nullptr),
|
|
||||||
#ifdef OSMIUM_DEBUG_RING_NO
|
#ifdef OSMIUM_DEBUG_RING_NO
|
||||||
m_num(next_num()),
|
m_num(next_num()),
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,6 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/area/detail/node_ref_segment.hpp>
|
||||||
|
#include <osmium/area/problem_reporter.hpp>
|
||||||
|
#include <osmium/osm/item_type.hpp>
|
||||||
|
#include <osmium/osm/location.hpp>
|
||||||
|
#include <osmium/osm/node_ref.hpp>
|
||||||
|
#include <osmium/osm/relation.hpp>
|
||||||
|
#include <osmium/osm/types.hpp>
|
||||||
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -43,15 +52,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osmium/area/detail/node_ref_segment.hpp>
|
|
||||||
#include <osmium/area/problem_reporter.hpp>
|
|
||||||
#include <osmium/osm/item_type.hpp>
|
|
||||||
#include <osmium/osm/location.hpp>
|
|
||||||
#include <osmium/osm/node_ref.hpp>
|
|
||||||
#include <osmium/osm/relation.hpp>
|
|
||||||
#include <osmium/osm/types.hpp>
|
|
||||||
#include <osmium/osm/way.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -84,7 +84,7 @@ namespace osmium {
|
|||||||
|
|
||||||
using slist_type = std::vector<NodeRefSegment>;
|
using slist_type = std::vector<NodeRefSegment>;
|
||||||
|
|
||||||
slist_type m_segments;
|
slist_type m_segments{};
|
||||||
|
|
||||||
bool m_debug;
|
bool m_debug;
|
||||||
|
|
||||||
@ -144,7 +144,6 @@ namespace osmium {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
explicit SegmentList(bool debug) noexcept :
|
explicit SegmentList(bool debug) noexcept :
|
||||||
m_segments(),
|
|
||||||
m_debug(debug) {
|
m_debug(debug) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,12 +33,12 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <iosfwd>
|
|
||||||
|
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
#include <osmium/osm/node_ref.hpp>
|
#include <osmium/osm/node_ref.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,11 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstring>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/area/stats.hpp>
|
#include <osmium/area/stats.hpp>
|
||||||
#include <osmium/memory/buffer.hpp>
|
#include <osmium/memory/buffer.hpp>
|
||||||
#include <osmium/osm/item_type.hpp>
|
#include <osmium/osm/item_type.hpp>
|
||||||
@ -48,6 +43,11 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
#include <osmium/relations/collector.hpp>
|
#include <osmium/relations/collector.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstring>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace relations {
|
namespace relations {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,13 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstring>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/area/stats.hpp>
|
#include <osmium/area/stats.hpp>
|
||||||
#include <osmium/osm/item_type.hpp>
|
#include <osmium/osm/item_type.hpp>
|
||||||
#include <osmium/osm/relation.hpp>
|
#include <osmium/osm/relation.hpp>
|
||||||
@ -53,6 +46,13 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/tags/taglist.hpp>
|
#include <osmium/tags/taglist.hpp>
|
||||||
#include <osmium/tags/tags_filter.hpp>
|
#include <osmium/tags/tags_filter.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,9 +93,9 @@ namespace osmium {
|
|||||||
* needed on closed ways or multipolygon relations
|
* needed on closed ways or multipolygon relations
|
||||||
* to build the area.
|
* to build the area.
|
||||||
*/
|
*/
|
||||||
explicit MultipolygonManager(const assembler_config_type& assembler_config, const osmium::TagsFilter& filter = osmium::TagsFilter{true}) :
|
explicit MultipolygonManager(assembler_config_type assembler_config, osmium::TagsFilter filter = osmium::TagsFilter{true}) :
|
||||||
m_assembler_config(assembler_config),
|
m_assembler_config(std::move(assembler_config)),
|
||||||
m_filter(filter) {
|
m_filter(std::move(filter)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,13 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstring>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/area/stats.hpp>
|
#include <osmium/area/stats.hpp>
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
#include <osmium/handler/check_order.hpp>
|
#include <osmium/handler/check_order.hpp>
|
||||||
@ -55,6 +48,13 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/relations/relations_manager.hpp>
|
#include <osmium/relations/relations_manager.hpp>
|
||||||
#include <osmium/storage/item_stash.hpp>
|
#include <osmium/storage/item_stash.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,12 +33,12 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include <osmium/osm/item_type.hpp>
|
#include <osmium/osm/item_type.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class NodeRef;
|
class NodeRef;
|
||||||
@ -62,18 +62,24 @@ namespace osmium {
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Type of object we are currently working on
|
// Type of object we are currently working on
|
||||||
osmium::item_type m_object_type;
|
osmium::item_type m_object_type = osmium::item_type::undefined;
|
||||||
|
|
||||||
// ID of the relation/way we are currently working on
|
// ID of the relation/way we are currently working on
|
||||||
osmium::object_id_type m_object_id;
|
osmium::object_id_type m_object_id = 0;
|
||||||
|
|
||||||
// Number of nodes in the area
|
// Number of nodes in the area
|
||||||
size_t m_nodes;
|
size_t m_nodes = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ProblemReporter() = default;
|
ProblemReporter() = default;
|
||||||
|
|
||||||
|
ProblemReporter(const ProblemReporter&) = default;
|
||||||
|
ProblemReporter& operator=(const ProblemReporter&) = default;
|
||||||
|
|
||||||
|
ProblemReporter(ProblemReporter&&) noexcept = default;
|
||||||
|
ProblemReporter& operator=(ProblemReporter&&) noexcept = default;
|
||||||
|
|
||||||
virtual ~ProblemReporter() = default;
|
virtual ~ProblemReporter() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,7 +167,7 @@ namespace osmium {
|
|||||||
* @param nr NodeRef of one end of the ring.
|
* @param nr NodeRef of one end of the ring.
|
||||||
* @param way Optional pointer to way the end node is in.
|
* @param way Optional pointer to way the end node is in.
|
||||||
*/
|
*/
|
||||||
virtual void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way = nullptr) {
|
virtual void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,13 +33,13 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
#include <osmium/area/problem_reporter_stream.hpp>
|
#include <osmium/area/problem_reporter_stream.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class NodeRef;
|
class NodeRef;
|
||||||
@ -57,8 +57,6 @@ namespace osmium {
|
|||||||
ProblemReporterStream(m_sstream) {
|
ProblemReporterStream(m_sstream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~ProblemReporterException() override = default;
|
|
||||||
|
|
||||||
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {
|
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {
|
||||||
m_sstream.str("");
|
m_sstream.str("");
|
||||||
ProblemReporterStream::report_duplicate_node(node_id1, node_id2, location);
|
ProblemReporterStream::report_duplicate_node(node_id1, node_id2, location);
|
||||||
@ -90,7 +88,7 @@ namespace osmium {
|
|||||||
throw std::runtime_error{m_sstream.str()};
|
throw std::runtime_error{m_sstream.str()};
|
||||||
}
|
}
|
||||||
|
|
||||||
void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way = nullptr) override {
|
void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way) override {
|
||||||
m_sstream.str("");
|
m_sstream.str("");
|
||||||
ProblemReporterStream::report_ring_not_closed(nr, way);
|
ProblemReporterStream::report_ring_not_closed(nr, way);
|
||||||
throw std::runtime_error{m_sstream.str()};
|
throw std::runtime_error{m_sstream.str()};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -42,10 +42,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
* @attention If you include this file, you'll need to link with `libgdal`.
|
* @attention If you include this file, you'll need to link with `libgdal`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <gdalcpp.hpp>
|
|
||||||
|
|
||||||
#include <osmium/area/problem_reporter.hpp>
|
#include <osmium/area/problem_reporter.hpp>
|
||||||
#include <osmium/geom/factory.hpp>
|
#include <osmium/geom/factory.hpp>
|
||||||
#include <osmium/geom/ogr.hpp>
|
#include <osmium/geom/ogr.hpp>
|
||||||
@ -56,6 +52,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
|
#include <gdalcpp.hpp>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -137,8 +137,6 @@ namespace osmium {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
~ProblemReporterOGR() override = default;
|
|
||||||
|
|
||||||
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {
|
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {
|
||||||
write_point("duplicate_node", node_id1, node_id2, location);
|
write_point("duplicate_node", node_id1, node_id2, location);
|
||||||
}
|
}
|
||||||
@ -162,7 +160,7 @@ namespace osmium {
|
|||||||
write_line("overlapping_segment", nr1.ref(), nr2.ref(), nr1.location(), nr2.location());
|
write_line("overlapping_segment", nr1.ref(), nr2.ref(), nr1.location(), nr2.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way = nullptr) override {
|
void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way) override {
|
||||||
write_point("ring_not_closed", nr.ref(), way ? way->id() : 0, nr.location());
|
write_point("ring_not_closed", nr.ref(), way ? way->id() : 0, nr.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,8 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
#include <osmium/area/problem_reporter.hpp>
|
#include <osmium/area/problem_reporter.hpp>
|
||||||
#include <osmium/osm/item_type.hpp>
|
#include <osmium/osm/item_type.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
@ -42,6 +40,8 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace area {
|
namespace area {
|
||||||
@ -56,8 +56,6 @@ namespace osmium {
|
|||||||
m_out(&out) {
|
m_out(&out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~ProblemReporterStream() override = default;
|
|
||||||
|
|
||||||
void header(const char* msg) {
|
void header(const char* msg) {
|
||||||
*m_out << "DATA PROBLEM: " << msg << " on " << item_type_to_char(m_object_type) << m_object_id << " (with " << m_nodes << " nodes): ";
|
*m_out << "DATA PROBLEM: " << msg << " on " << item_type_to_char(m_object_type) << m_object_id << " (with " << m_nodes << " nodes): ";
|
||||||
}
|
}
|
||||||
@ -91,7 +89,7 @@ namespace osmium {
|
|||||||
<< " node_id2=" << nr2.ref() << " location2=" << nr2.location() << "\n";
|
<< " node_id2=" << nr2.ref() << " location2=" << nr2.location() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way = nullptr) override {
|
void report_ring_not_closed(const osmium::NodeRef& nr, const osmium::Way* way) override {
|
||||||
header("ring not closed");
|
header("ring not closed");
|
||||||
*m_out << "node_id=" << nr.ref() << " location=" << nr.location();
|
*m_out << "node_id=" << nr.ref() << " location=" << nr.location();
|
||||||
if (way) {
|
if (way) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,16 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <ctime>
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <iterator>
|
|
||||||
#include <string>
|
|
||||||
#include <tuple>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <osmium/builder/builder.hpp>
|
#include <osmium/builder/builder.hpp>
|
||||||
#include <osmium/builder/osm_object_builder.hpp>
|
#include <osmium/builder/osm_object_builder.hpp>
|
||||||
#include <osmium/memory/buffer.hpp>
|
#include <osmium/memory/buffer.hpp>
|
||||||
@ -56,6 +46,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/timestamp.hpp>
|
#include <osmium/osm/timestamp.hpp>
|
||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <ctime>
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <iterator>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace builder {
|
namespace builder {
|
||||||
@ -94,13 +94,13 @@ namespace osmium {
|
|||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
// True if Predicate matches for none of the types Ts
|
// True if Predicate matches for none of the types Ts
|
||||||
template <template<typename> class Predicate, typename... Ts>
|
template <template <typename> class Predicate, typename... Ts>
|
||||||
struct static_none_of : std::is_same<std::tuple<std::false_type, typename Predicate<Ts>::type...>,
|
struct static_none_of : std::is_same<std::tuple<std::false_type, typename Predicate<Ts>::type...>,
|
||||||
std::tuple<typename Predicate<Ts>::type..., std::false_type>>
|
std::tuple<typename Predicate<Ts>::type..., std::false_type>>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
// True if Predicate matches for all of the types Ts
|
// True if Predicate matches for all of the types Ts
|
||||||
template <template<typename> class Predicate, typename... Ts>
|
template <template <typename> class Predicate, typename... Ts>
|
||||||
struct static_all_of : std::is_same<std::tuple<std::true_type, typename Predicate<Ts>::type...>,
|
struct static_all_of : std::is_same<std::tuple<std::true_type, typename Predicate<Ts>::type...>,
|
||||||
std::tuple<typename Predicate<Ts>::type..., std::true_type>>
|
std::tuple<typename Predicate<Ts>::type..., std::true_type>>
|
||||||
{};
|
{};
|
||||||
@ -364,17 +364,21 @@ namespace osmium {
|
|||||||
|
|
||||||
template <typename TTagIterator>
|
template <typename TTagIterator>
|
||||||
inline constexpr detail::tags_from_iterator_pair<TTagIterator> _tags(TTagIterator first, TTagIterator last) {
|
inline constexpr detail::tags_from_iterator_pair<TTagIterator> _tags(TTagIterator first, TTagIterator last) {
|
||||||
return detail::tags_from_iterator_pair<TTagIterator>(first, last);
|
return {first, last};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TContainer>
|
template <typename TContainer>
|
||||||
inline detail::tags_from_iterator_pair<typename TContainer::const_iterator> _tags(const TContainer& container) {
|
inline detail::tags_from_iterator_pair<typename TContainer::const_iterator> _tags(const TContainer& container) {
|
||||||
return detail::tags_from_iterator_pair<typename TContainer::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using tag_ilist = std::initializer_list<std::pair<const char*, const char*>>;
|
using tag_ilist = std::initializer_list<std::pair<const char*, const char*>>;
|
||||||
inline detail::tags_from_iterator_pair<tag_ilist::const_iterator> _tags(const tag_ilist& container) {
|
inline detail::tags_from_iterator_pair<tag_ilist::const_iterator> _tags(const tag_ilist& container) {
|
||||||
return detail::tags_from_iterator_pair<tag_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -388,22 +392,28 @@ namespace osmium {
|
|||||||
|
|
||||||
template <typename TIdIterator>
|
template <typename TIdIterator>
|
||||||
inline constexpr detail::nodes_from_iterator_pair<TIdIterator> _nodes(TIdIterator first, TIdIterator last) {
|
inline constexpr detail::nodes_from_iterator_pair<TIdIterator> _nodes(TIdIterator first, TIdIterator last) {
|
||||||
return detail::nodes_from_iterator_pair<TIdIterator>(first, last);
|
return {first, last};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TContainer>
|
template <typename TContainer>
|
||||||
inline detail::nodes_from_iterator_pair<typename TContainer::const_iterator> _nodes(const TContainer& container) {
|
inline detail::nodes_from_iterator_pair<typename TContainer::const_iterator> _nodes(const TContainer& container) {
|
||||||
return detail::nodes_from_iterator_pair<typename TContainer::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using object_id_ilist = std::initializer_list<osmium::object_id_type>;
|
using object_id_ilist = std::initializer_list<osmium::object_id_type>;
|
||||||
inline detail::nodes_from_iterator_pair<object_id_ilist::const_iterator> _nodes(const object_id_ilist& container) {
|
inline detail::nodes_from_iterator_pair<object_id_ilist::const_iterator> _nodes(const object_id_ilist& container) {
|
||||||
return detail::nodes_from_iterator_pair<object_id_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using node_ref_ilist = std::initializer_list<osmium::NodeRef>;
|
using node_ref_ilist = std::initializer_list<osmium::NodeRef>;
|
||||||
inline detail::nodes_from_iterator_pair<node_ref_ilist::const_iterator> _nodes(const node_ref_ilist& container) {
|
inline detail::nodes_from_iterator_pair<node_ref_ilist::const_iterator> _nodes(const node_ref_ilist& container) {
|
||||||
return detail::nodes_from_iterator_pair<node_ref_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -422,17 +432,21 @@ namespace osmium {
|
|||||||
|
|
||||||
template <typename TMemberIterator>
|
template <typename TMemberIterator>
|
||||||
inline constexpr detail::members_from_iterator_pair<TMemberIterator> _members(TMemberIterator first, TMemberIterator last) {
|
inline constexpr detail::members_from_iterator_pair<TMemberIterator> _members(TMemberIterator first, TMemberIterator last) {
|
||||||
return detail::members_from_iterator_pair<TMemberIterator>(first, last);
|
return {first, last};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TContainer>
|
template <typename TContainer>
|
||||||
inline detail::members_from_iterator_pair<typename TContainer::const_iterator> _members(const TContainer& container) {
|
inline detail::members_from_iterator_pair<typename TContainer::const_iterator> _members(const TContainer& container) {
|
||||||
return detail::members_from_iterator_pair<typename TContainer::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using member_ilist = std::initializer_list<member_type>;
|
using member_ilist = std::initializer_list<member_type>;
|
||||||
inline detail::members_from_iterator_pair<member_ilist::const_iterator> _members(const member_ilist& container) {
|
inline detail::members_from_iterator_pair<member_ilist::const_iterator> _members(const member_ilist& container) {
|
||||||
return detail::members_from_iterator_pair<member_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -450,58 +464,74 @@ namespace osmium {
|
|||||||
|
|
||||||
template <typename TCommentIterator>
|
template <typename TCommentIterator>
|
||||||
inline constexpr detail::comments_from_iterator_pair<TCommentIterator> _comments(TCommentIterator first, TCommentIterator last) {
|
inline constexpr detail::comments_from_iterator_pair<TCommentIterator> _comments(TCommentIterator first, TCommentIterator last) {
|
||||||
return detail::comments_from_iterator_pair<TCommentIterator>(first, last);
|
return {first, last};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TContainer>
|
template <typename TContainer>
|
||||||
inline detail::comments_from_iterator_pair<typename TContainer::const_iterator> _comments(const TContainer& container) {
|
inline detail::comments_from_iterator_pair<typename TContainer::const_iterator> _comments(const TContainer& container) {
|
||||||
return detail::comments_from_iterator_pair<typename TContainer::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using comment_ilist = std::initializer_list<comment_type>;
|
using comment_ilist = std::initializer_list<comment_type>;
|
||||||
inline detail::comments_from_iterator_pair<comment_ilist::const_iterator> _comments(const comment_ilist& container) {
|
inline detail::comments_from_iterator_pair<comment_ilist::const_iterator> _comments(const comment_ilist& container) {
|
||||||
return detail::comments_from_iterator_pair<comment_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename TIdIterator>
|
template <typename TIdIterator>
|
||||||
inline constexpr detail::outer_ring_from_iterator_pair<TIdIterator> _outer_ring(TIdIterator first, TIdIterator last) {
|
inline constexpr detail::outer_ring_from_iterator_pair<TIdIterator> _outer_ring(TIdIterator first, TIdIterator last) {
|
||||||
return detail::outer_ring_from_iterator_pair<TIdIterator>(first, last);
|
return {first, last};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TContainer>
|
template <typename TContainer>
|
||||||
inline detail::outer_ring_from_iterator_pair<typename TContainer::const_iterator> _outer_ring(const TContainer& container) {
|
inline detail::outer_ring_from_iterator_pair<typename TContainer::const_iterator> _outer_ring(const TContainer& container) {
|
||||||
return detail::outer_ring_from_iterator_pair<typename TContainer::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using object_id_ilist = std::initializer_list<osmium::object_id_type>;
|
using object_id_ilist = std::initializer_list<osmium::object_id_type>;
|
||||||
inline detail::outer_ring_from_iterator_pair<object_id_ilist::const_iterator> _outer_ring(const object_id_ilist& container) {
|
inline detail::outer_ring_from_iterator_pair<object_id_ilist::const_iterator> _outer_ring(const object_id_ilist& container) {
|
||||||
return detail::outer_ring_from_iterator_pair<object_id_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using node_ref_ilist = std::initializer_list<osmium::NodeRef>;
|
using node_ref_ilist = std::initializer_list<osmium::NodeRef>;
|
||||||
inline detail::outer_ring_from_iterator_pair<node_ref_ilist::const_iterator> _outer_ring(const node_ref_ilist& container) {
|
inline detail::outer_ring_from_iterator_pair<node_ref_ilist::const_iterator> _outer_ring(const node_ref_ilist& container) {
|
||||||
return detail::outer_ring_from_iterator_pair<node_ref_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TIdIterator>
|
template <typename TIdIterator>
|
||||||
inline constexpr detail::inner_ring_from_iterator_pair<TIdIterator> _inner_ring(TIdIterator first, TIdIterator last) {
|
inline constexpr detail::inner_ring_from_iterator_pair<TIdIterator> _inner_ring(TIdIterator first, TIdIterator last) {
|
||||||
return detail::inner_ring_from_iterator_pair<TIdIterator>(first, last);
|
return {first, last};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TContainer>
|
template <typename TContainer>
|
||||||
inline detail::inner_ring_from_iterator_pair<typename TContainer::const_iterator> _inner_ring(const TContainer& container) {
|
inline detail::inner_ring_from_iterator_pair<typename TContainer::const_iterator> _inner_ring(const TContainer& container) {
|
||||||
return detail::inner_ring_from_iterator_pair<typename TContainer::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using object_id_ilist = std::initializer_list<osmium::object_id_type>;
|
using object_id_ilist = std::initializer_list<osmium::object_id_type>;
|
||||||
inline detail::inner_ring_from_iterator_pair<object_id_ilist::const_iterator> _inner_ring(const object_id_ilist& container) {
|
inline detail::inner_ring_from_iterator_pair<object_id_ilist::const_iterator> _inner_ring(const object_id_ilist& container) {
|
||||||
return detail::inner_ring_from_iterator_pair<object_id_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
using node_ref_ilist = std::initializer_list<osmium::NodeRef>;
|
using node_ref_ilist = std::initializer_list<osmium::NodeRef>;
|
||||||
inline detail::inner_ring_from_iterator_pair<node_ref_ilist::const_iterator> _inner_ring(const node_ref_ilist& container) {
|
inline detail::inner_ring_from_iterator_pair<node_ref_ilist::const_iterator> _inner_ring(const node_ref_ilist& container) {
|
||||||
return detail::inner_ring_from_iterator_pair<node_ref_ilist::const_iterator>(std::begin(container), std::end(container));
|
using std::begin;
|
||||||
|
using std::end;
|
||||||
|
return {begin(container), end(container)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -516,7 +546,7 @@ namespace osmium {
|
|||||||
struct changeset_handler : public entity_handler {
|
struct changeset_handler : public entity_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(osmium::Changeset&, const TDummy&) noexcept {
|
static void set_value(osmium::Changeset& /*changeset*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_value(osmium::Changeset& changeset, attr::_cid id) noexcept {
|
static void set_value(osmium::Changeset& changeset, attr::_cid id) noexcept {
|
||||||
@ -548,7 +578,7 @@ namespace osmium {
|
|||||||
struct object_handler : public entity_handler {
|
struct object_handler : public entity_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(osmium::OSMObject&, const TDummy&) noexcept {
|
static void set_value(osmium::OSMObject& /*object*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_value(osmium::OSMObject& object, attr::_id id) noexcept {
|
static void set_value(osmium::OSMObject& object, attr::_id id) noexcept {
|
||||||
@ -601,7 +631,7 @@ namespace osmium {
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
template <typename... TArgs>
|
template <typename... TArgs>
|
||||||
inline constexpr const char* get_user(const attr::_user& user, const TArgs&...) noexcept {
|
inline constexpr const char* get_user(const attr::_user& user, const TArgs&... /*args*/) noexcept {
|
||||||
return user.value;
|
return user.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +641,7 @@ namespace osmium {
|
|||||||
|
|
||||||
template <typename TFirst, typename... TRest>
|
template <typename TFirst, typename... TRest>
|
||||||
inline constexpr typename std::enable_if<!std::is_same<attr::_user, TFirst>::value, const char*>::type
|
inline constexpr typename std::enable_if<!std::is_same<attr::_user, TFirst>::value, const char*>::type
|
||||||
get_user(const TFirst&, const TRest&... args) noexcept {
|
get_user(const TFirst& /*first*/, const TRest&... args) noexcept {
|
||||||
return get_user(args...);
|
return get_user(args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +655,7 @@ namespace osmium {
|
|||||||
struct tags_handler {
|
struct tags_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(TagListBuilder&, const TDummy&) noexcept {
|
static void set_value(TagListBuilder& /*tlb*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_value(TagListBuilder& builder, const attr::_tag& tag) {
|
static void set_value(TagListBuilder& builder, const attr::_tag& tag) {
|
||||||
@ -644,7 +674,7 @@ namespace osmium {
|
|||||||
struct nodes_handler {
|
struct nodes_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(WayNodeListBuilder&, const TDummy&) noexcept {
|
static void set_value(WayNodeListBuilder& /*wnlb*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_value(WayNodeListBuilder& builder, const attr::_node& node_ref) {
|
static void set_value(WayNodeListBuilder& builder, const attr::_node& node_ref) {
|
||||||
@ -663,7 +693,7 @@ namespace osmium {
|
|||||||
struct members_handler {
|
struct members_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(RelationMemberListBuilder&, const TDummy&) noexcept {
|
static void set_value(RelationMemberListBuilder& /*rmlb*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_value(RelationMemberListBuilder& builder, const attr::_member& member) {
|
static void set_value(RelationMemberListBuilder& builder, const attr::_member& member) {
|
||||||
@ -682,7 +712,7 @@ namespace osmium {
|
|||||||
struct discussion_handler {
|
struct discussion_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(ChangesetDiscussionBuilder&, const TDummy&) noexcept {
|
static void set_value(ChangesetDiscussionBuilder& /*cdb*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_value(ChangesetDiscussionBuilder& builder, const attr::_comment& comment) {
|
static void set_value(ChangesetDiscussionBuilder& builder, const attr::_comment& comment) {
|
||||||
@ -703,7 +733,7 @@ namespace osmium {
|
|||||||
struct ring_handler {
|
struct ring_handler {
|
||||||
|
|
||||||
template <typename TDummy>
|
template <typename TDummy>
|
||||||
static void set_value(AreaBuilder&, const TDummy&) noexcept {
|
static void set_value(AreaBuilder& /*ab*/, const TDummy& /*dummy*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TIterator>
|
template <typename TIterator>
|
||||||
@ -728,7 +758,7 @@ namespace osmium {
|
|||||||
|
|
||||||
template <typename TBuilder, typename THandler, typename... TArgs>
|
template <typename TBuilder, typename THandler, typename... TArgs>
|
||||||
inline typename std::enable_if<!is_handled_by<THandler, TArgs...>::value>::type
|
inline typename std::enable_if<!is_handled_by<THandler, TArgs...>::value>::type
|
||||||
add_list(osmium::builder::Builder&, const TArgs&...) noexcept {
|
add_list(osmium::builder::Builder& /*parent*/, const TArgs&... /*args*/) noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TBuilder, typename THandler, typename... TArgs>
|
template <typename TBuilder, typename THandler, typename... TArgs>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,16 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/memory/buffer.hpp>
|
||||||
|
#include <osmium/memory/item.hpp>
|
||||||
|
#include <osmium/util/compatibility.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include <osmium/memory/buffer.hpp>
|
|
||||||
#include <osmium/memory/item.hpp>
|
|
||||||
#include <osmium/util/compatibility.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,12 +60,6 @@ namespace osmium {
|
|||||||
Builder* m_parent;
|
Builder* m_parent;
|
||||||
std::size_t m_item_offset;
|
std::size_t m_item_offset;
|
||||||
|
|
||||||
Builder(const Builder&) = delete;
|
|
||||||
Builder(Builder&&) = delete;
|
|
||||||
|
|
||||||
Builder& operator=(const Builder&) = delete;
|
|
||||||
Builder& operator=(Builder&&) = delete;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
explicit Builder(osmium::memory::Buffer& buffer, Builder* parent, osmium::memory::item_size_type size) :
|
explicit Builder(osmium::memory::Buffer& buffer, Builder* parent, osmium::memory::item_size_type size) :
|
||||||
@ -203,6 +197,12 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Builder(const Builder&) = delete;
|
||||||
|
Builder(Builder&&) = delete;
|
||||||
|
|
||||||
|
Builder& operator=(const Builder&) = delete;
|
||||||
|
Builder& operator=(Builder&&) = delete;
|
||||||
|
|
||||||
/// Return the buffer this builder is using.
|
/// Return the buffer this builder is using.
|
||||||
osmium::memory::Buffer& buffer() noexcept {
|
osmium::memory::Buffer& buffer() noexcept {
|
||||||
return m_buffer;
|
return m_buffer;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,16 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <osmium/builder/osm_object_builder.hpp>
|
#include <osmium/builder/osm_object_builder.hpp>
|
||||||
#include <osmium/memory/buffer.hpp>
|
#include <osmium/memory/buffer.hpp>
|
||||||
#include <osmium/util/compatibility.hpp>
|
#include <osmium/util/compatibility.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <functional>
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class NodeRef;
|
class NodeRef;
|
||||||
@ -103,7 +103,7 @@ namespace osmium {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
* Use osmium::builder::add_tag_list() instead.
|
* Use osmium::builder::add_tag_list() instead.
|
||||||
*/
|
*/
|
||||||
OSMIUM_DEPRECATED inline const osmium::TagList& build_tag_list_from_func(osmium::memory::Buffer& buffer, std::function<void(osmium::builder::TagListBuilder&)> func) {
|
OSMIUM_DEPRECATED inline const osmium::TagList& build_tag_list_from_func(osmium::memory::Buffer& buffer, const std::function<void(osmium::builder::TagListBuilder&)>& func) {
|
||||||
const size_t pos = buffer.committed();
|
const size_t pos = buffer.committed();
|
||||||
{
|
{
|
||||||
osmium::builder::TagListBuilder tl_builder(buffer);
|
osmium::builder::TagListBuilder tl_builder(buffer);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,18 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstring>
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <limits>
|
|
||||||
#include <new>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <osmium/builder/builder.hpp>
|
#include <osmium/builder/builder.hpp>
|
||||||
#include <osmium/memory/item.hpp>
|
#include <osmium/memory/item.hpp>
|
||||||
#include <osmium/osm/area.hpp>
|
#include <osmium/osm/area.hpp>
|
||||||
@ -60,9 +48,20 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/timestamp.hpp>
|
#include <osmium/osm/timestamp.hpp>
|
||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
#include <osmium/util/cast.hpp>
|
|
||||||
#include <osmium/util/compatibility.hpp>
|
#include <osmium/util/compatibility.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <limits>
|
||||||
|
#include <new>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace memory {
|
namespace memory {
|
||||||
@ -85,6 +84,12 @@ namespace osmium {
|
|||||||
new (&item()) TagList{};
|
new (&item()) TagList{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TagListBuilder(const TagListBuilder&) = delete;
|
||||||
|
TagListBuilder& operator=(const TagListBuilder&) = delete;
|
||||||
|
|
||||||
|
TagListBuilder(TagListBuilder&&) = delete;
|
||||||
|
TagListBuilder& operator=(TagListBuilder&&) = delete;
|
||||||
|
|
||||||
~TagListBuilder() {
|
~TagListBuilder() {
|
||||||
add_padding();
|
add_padding();
|
||||||
}
|
}
|
||||||
@ -196,6 +201,12 @@ namespace osmium {
|
|||||||
new (&item()) T{};
|
new (&item()) T{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NodeRefListBuilder(const NodeRefListBuilder&) = delete;
|
||||||
|
NodeRefListBuilder& operator=(const NodeRefListBuilder&) = delete;
|
||||||
|
|
||||||
|
NodeRefListBuilder(NodeRefListBuilder&&) = delete;
|
||||||
|
NodeRefListBuilder& operator=(NodeRefListBuilder&&) = delete;
|
||||||
|
|
||||||
~NodeRefListBuilder() {
|
~NodeRefListBuilder() {
|
||||||
add_padding();
|
add_padding();
|
||||||
}
|
}
|
||||||
@ -247,6 +258,12 @@ namespace osmium {
|
|||||||
new (&item()) RelationMemberList{};
|
new (&item()) RelationMemberList{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RelationMemberListBuilder(const RelationMemberListBuilder&) = delete;
|
||||||
|
RelationMemberListBuilder& operator=(const RelationMemberListBuilder&) = delete;
|
||||||
|
|
||||||
|
RelationMemberListBuilder(RelationMemberListBuilder&&) = delete;
|
||||||
|
RelationMemberListBuilder& operator=(RelationMemberListBuilder&&) = delete;
|
||||||
|
|
||||||
~RelationMemberListBuilder() {
|
~RelationMemberListBuilder() {
|
||||||
add_padding();
|
add_padding();
|
||||||
}
|
}
|
||||||
@ -265,7 +282,7 @@ namespace osmium {
|
|||||||
* osmium::max_osm_string_length
|
* osmium::max_osm_string_length
|
||||||
*/
|
*/
|
||||||
void add_member(osmium::item_type type, object_id_type ref, const char* role, const std::size_t role_length, const osmium::OSMObject* full_member = nullptr) {
|
void add_member(osmium::item_type type, object_id_type ref, const char* role, const std::size_t role_length, const osmium::OSMObject* full_member = nullptr) {
|
||||||
osmium::RelationMember* member = reserve_space_for<osmium::RelationMember>();
|
auto* member = reserve_space_for<osmium::RelationMember>();
|
||||||
new (member) osmium::RelationMember{ref, type, full_member != nullptr};
|
new (member) osmium::RelationMember{ref, type, full_member != nullptr};
|
||||||
add_size(sizeof(RelationMember));
|
add_size(sizeof(RelationMember));
|
||||||
add_role(*member, role, role_length);
|
add_role(*member, role, role_length);
|
||||||
@ -339,6 +356,12 @@ namespace osmium {
|
|||||||
new (&item()) ChangesetDiscussion{};
|
new (&item()) ChangesetDiscussion{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChangesetDiscussionBuilder(const ChangesetDiscussionBuilder&) = delete;
|
||||||
|
ChangesetDiscussionBuilder& operator=(const ChangesetDiscussionBuilder&) = delete;
|
||||||
|
|
||||||
|
ChangesetDiscussionBuilder(ChangesetDiscussionBuilder&&) = delete;
|
||||||
|
ChangesetDiscussionBuilder& operator=(ChangesetDiscussionBuilder&&) = delete;
|
||||||
|
|
||||||
~ChangesetDiscussionBuilder() {
|
~ChangesetDiscussionBuilder() {
|
||||||
assert(!m_comment && "You have to always call both add_comment() and then add_comment_text() in that order for each comment!");
|
assert(!m_comment && "You have to always call both add_comment() and then add_comment_text() in that order for each comment!");
|
||||||
add_padding();
|
add_padding();
|
||||||
@ -440,18 +463,25 @@ namespace osmium {
|
|||||||
* Set user name.
|
* Set user name.
|
||||||
*
|
*
|
||||||
* @param user Pointer to \0-terminated user name.
|
* @param user Pointer to \0-terminated user name.
|
||||||
|
*
|
||||||
|
* @pre @code strlen(user) < 2^16 - 1 @endcode
|
||||||
*/
|
*/
|
||||||
TDerived& set_user(const char* user) {
|
TDerived& set_user(const char* user) {
|
||||||
return set_user(user, static_cast_with_assert<string_size_type>(std::strlen(user)));
|
const auto len = std::strlen(user);
|
||||||
|
assert(len < std::numeric_limits<string_size_type>::max());
|
||||||
|
return set_user(user, static_cast<string_size_type>(len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set user name.
|
* Set user name.
|
||||||
*
|
*
|
||||||
* @param user User name.
|
* @param user User name.
|
||||||
|
*
|
||||||
|
* @pre @code user.size() < 2^16 - 1 @endcode
|
||||||
*/
|
*/
|
||||||
TDerived& set_user(const std::string& user) {
|
TDerived& set_user(const std::string& user) {
|
||||||
return set_user(user.data(), static_cast_with_assert<string_size_type>(user.size()));
|
assert(user.size() < std::numeric_limits<string_size_type>::max());
|
||||||
|
return set_user(user.data(), static_cast<string_size_type>(user.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @deprecated Use set_user(...) instead.
|
/// @deprecated Use set_user(...) instead.
|
||||||
@ -649,18 +679,25 @@ namespace osmium {
|
|||||||
* Set user name.
|
* Set user name.
|
||||||
*
|
*
|
||||||
* @param user Pointer to \0-terminated user name.
|
* @param user Pointer to \0-terminated user name.
|
||||||
|
*
|
||||||
|
* @pre @code strlen(user) < 2^16 - 1 @endcode
|
||||||
*/
|
*/
|
||||||
ChangesetBuilder& set_user(const char* user) {
|
ChangesetBuilder& set_user(const char* user) {
|
||||||
return set_user(user, static_cast_with_assert<string_size_type>(std::strlen(user)));
|
const auto len = std::strlen(user);
|
||||||
|
assert(len <= std::numeric_limits<string_size_type>::max());
|
||||||
|
return set_user(user, static_cast<string_size_type>(len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set user name.
|
* Set user name.
|
||||||
*
|
*
|
||||||
* @param user User name.
|
* @param user User name.
|
||||||
|
*
|
||||||
|
* @pre @code user.size() < 2^16 - 1 @endcode
|
||||||
*/
|
*/
|
||||||
ChangesetBuilder& set_user(const std::string& user) {
|
ChangesetBuilder& set_user(const std::string& user) {
|
||||||
return set_user(user.data(), static_cast_with_assert<string_size_type>(user.size()));
|
assert(user.size() < std::numeric_limits<string_size_type>::max());
|
||||||
|
return set_user(user.data(), static_cast<string_size_type>(user.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @deprecated Use set_user(...) instead.
|
/// @deprecated Use set_user(...) instead.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/osm/diff_object.hpp>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <osmium/osm/diff_object.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class OSMObject;
|
class OSMObject;
|
||||||
@ -69,11 +69,11 @@ namespace osmium {
|
|||||||
const bool use_curr_for_prev = m_prev->type() != m_curr->type() || m_prev->id() != m_curr->id();
|
const bool use_curr_for_prev = m_prev->type() != m_curr->type() || m_prev->id() != m_curr->id();
|
||||||
const bool use_curr_for_next = m_next == m_end || m_next->type() != m_curr->type() || m_next->id() != m_curr->id();
|
const bool use_curr_for_next = m_next == m_end || m_next->type() != m_curr->type() || m_next->id() != m_curr->id();
|
||||||
|
|
||||||
m_diff = std::move(osmium::DiffObject{
|
m_diff = osmium::DiffObject{
|
||||||
*(use_curr_for_prev ? m_curr : m_prev),
|
*(use_curr_for_prev ? m_curr : m_prev),
|
||||||
*m_curr,
|
*m_curr,
|
||||||
*(use_curr_for_next ? m_curr : m_next)
|
*(use_curr_for_next ? m_curr : m_next)
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,11 +33,11 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/handler.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <osmium/handler.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
class Node;
|
class Node;
|
||||||
@ -54,21 +54,29 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
HandlerWrapperBase() = default;
|
||||||
|
|
||||||
|
HandlerWrapperBase(const HandlerWrapperBase&) = default;
|
||||||
|
HandlerWrapperBase& operator=(const HandlerWrapperBase&) = default;
|
||||||
|
|
||||||
|
HandlerWrapperBase(HandlerWrapperBase&&) noexcept = default;
|
||||||
|
HandlerWrapperBase& operator=(HandlerWrapperBase&&) noexcept = default;
|
||||||
|
|
||||||
virtual ~HandlerWrapperBase() = default;
|
virtual ~HandlerWrapperBase() = default;
|
||||||
|
|
||||||
virtual void node(const osmium::Node&) {
|
virtual void node(const osmium::Node& /*node*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void way(const osmium::Way&) {
|
virtual void way(const osmium::Way& /*way*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void relation(const osmium::Relation&) {
|
virtual void relation(const osmium::Relation& /*relation*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void area(const osmium::Area&) {
|
virtual void area(const osmium::Area& /*area*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void changeset(const osmium::Changeset&) {
|
virtual void changeset(const osmium::Changeset& /*changeset*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void flush() {
|
virtual void flush() {
|
||||||
@ -78,7 +86,7 @@ namespace osmium {
|
|||||||
|
|
||||||
|
|
||||||
// The following uses trick from
|
// The following uses trick from
|
||||||
// http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
|
// https://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
|
||||||
// to either call handler style functions or visitor style operator().
|
// to either call handler style functions or visitor style operator().
|
||||||
|
|
||||||
#define OSMIUM_DYNAMIC_HANDLER_DISPATCH(_name_, _type_) \
|
#define OSMIUM_DYNAMIC_HANDLER_DISPATCH(_name_, _type_) \
|
||||||
@ -98,12 +106,12 @@ auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, long) ->
|
|||||||
OSMIUM_DYNAMIC_HANDLER_DISPATCH(area, Area)
|
OSMIUM_DYNAMIC_HANDLER_DISPATCH(area, Area)
|
||||||
|
|
||||||
template <typename THandler>
|
template <typename THandler>
|
||||||
auto flush_dispatch(THandler& handler, int) -> decltype(handler.flush(), void()) {
|
auto flush_dispatch(THandler& handler, int /*dispatch*/) -> decltype(handler.flush(), void()) {
|
||||||
handler.flush();
|
handler.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename THandler>
|
template <typename THandler>
|
||||||
void flush_dispatch(THandler&, long) {
|
void flush_dispatch(THandler& /*handler*/, long /*dispatch*/) { // NOLINT(google-runtime-int)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename THandler>
|
template <typename THandler>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,10 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/area/assembler.hpp>
|
#include <osmium/area/assembler.hpp>
|
||||||
#include <osmium/area/multipolygon_collector.hpp>
|
#include <osmium/area/multipolygon_collector.hpp>
|
||||||
#include <osmium/handler/node_locations_for_ways.hpp> // IWYU pragma: keep
|
#include <osmium/handler/node_locations_for_ways.hpp> // IWYU pragma: keep
|
||||||
@ -47,6 +43,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/entity_bits.hpp>
|
#include <osmium/osm/entity_bits.hpp>
|
||||||
#include <osmium/visitor.hpp>
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
third_party/libosmium/include/osmium/fwd.hpp
vendored
2
third_party/libosmium/include/osmium/fwd.hpp
vendored
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/osm/location.hpp>
|
||||||
|
#include <osmium/util/double.hpp>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/osm/location.hpp>
|
|
||||||
#include <osmium/util/double.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -70,8 +70,11 @@ namespace osmium {
|
|||||||
/**
|
/**
|
||||||
* Create Coordinates from a Location. Will throw
|
* Create Coordinates from a Location. Will throw
|
||||||
* osmium::invalid_location if the location is not valid.
|
* osmium::invalid_location if the location is not valid.
|
||||||
|
*
|
||||||
|
* This constructor is not explicit on purpose allowing use of
|
||||||
|
* a Location everywhere a Coordinates object is needed.
|
||||||
*/
|
*/
|
||||||
Coordinates(const osmium::Location& location) :
|
Coordinates(const osmium::Location& location) : // NOLINT(google-explicit-constructor, hicpp-explicit-conversions)
|
||||||
x(location.lon()),
|
x(location.lon()),
|
||||||
y(location.lat()) {
|
y(location.lat()) {
|
||||||
}
|
}
|
||||||
@ -95,9 +98,9 @@ namespace osmium {
|
|||||||
*/
|
*/
|
||||||
void append_to_string(std::string& s, const char infix, int precision) const {
|
void append_to_string(std::string& s, const char infix, int precision) const {
|
||||||
if (valid()) {
|
if (valid()) {
|
||||||
osmium::util::double2string(s, x, precision);
|
osmium::double2string(s, x, precision);
|
||||||
s += infix;
|
s += infix;
|
||||||
osmium::util::double2string(s, y, precision);
|
osmium::double2string(s, y, precision);
|
||||||
} else {
|
} else {
|
||||||
s.append("invalid");
|
s.append("invalid");
|
||||||
}
|
}
|
||||||
@ -143,7 +146,7 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator!=(const Coordinates& lhs, const Coordinates& rhs) noexcept {
|
inline bool operator!=(const Coordinates& lhs, const Coordinates& rhs) noexcept {
|
||||||
return ! operator==(lhs, rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename TChar, typename TTraits>
|
template <typename TChar, typename TTraits>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,11 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/memory/collection.hpp>
|
#include <osmium/memory/collection.hpp>
|
||||||
#include <osmium/memory/item.hpp>
|
#include <osmium/memory/item.hpp>
|
||||||
@ -50,6 +45,11 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -267,7 +267,6 @@ namespace osmium {
|
|||||||
size_t num_points = 0;
|
size_t num_points = 0;
|
||||||
|
|
||||||
if (un == use_nodes::unique) {
|
if (un == use_nodes::unique) {
|
||||||
osmium::Location last_location;
|
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case direction::forward:
|
case direction::forward:
|
||||||
num_points = fill_linestring_unique(wnl.cbegin(), wnl.cend());
|
num_points = fill_linestring_unique(wnl.cbegin(), wnl.cend());
|
||||||
@ -294,7 +293,7 @@ namespace osmium {
|
|||||||
return linestring_finish(num_points);
|
return linestring_finish(num_points);
|
||||||
}
|
}
|
||||||
|
|
||||||
linestring_type create_linestring(const osmium::Way& way, use_nodes un=use_nodes::unique, direction dir = direction::forward) {
|
linestring_type create_linestring(const osmium::Way& way, use_nodes un = use_nodes::unique, direction dir = direction::forward) {
|
||||||
try {
|
try {
|
||||||
return create_linestring(way.nodes(), un, dir);
|
return create_linestring(way.nodes(), un, dir);
|
||||||
} catch (osmium::geometry_error& e) {
|
} catch (osmium::geometry_error& e) {
|
||||||
@ -341,7 +340,6 @@ namespace osmium {
|
|||||||
size_t num_points = 0;
|
size_t num_points = 0;
|
||||||
|
|
||||||
if (un == use_nodes::unique) {
|
if (un == use_nodes::unique) {
|
||||||
osmium::Location last_location;
|
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case direction::forward:
|
case direction::forward:
|
||||||
num_points = fill_polygon_unique(wnl.cbegin(), wnl.cend());
|
num_points = fill_polygon_unique(wnl.cbegin(), wnl.cend());
|
||||||
@ -368,7 +366,7 @@ namespace osmium {
|
|||||||
return polygon_finish(num_points);
|
return polygon_finish(num_points);
|
||||||
}
|
}
|
||||||
|
|
||||||
polygon_type create_polygon(const osmium::Way& way, use_nodes un=use_nodes::unique, direction dir = direction::forward) {
|
polygon_type create_polygon(const osmium::Way& way, use_nodes un = use_nodes::unique, direction dir = direction::forward) {
|
||||||
try {
|
try {
|
||||||
return create_polygon(way.nodes(), un, dir);
|
return create_polygon(way.nodes(), un, dir);
|
||||||
} catch (osmium::geometry_error& e) {
|
} catch (osmium::geometry_error& e) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/geom/coordinates.hpp>
|
||||||
|
#include <osmium/geom/factory.hpp>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
|
||||||
#include <osmium/geom/factory.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -60,7 +60,7 @@ namespace osmium {
|
|||||||
using multipolygon_type = std::string;
|
using multipolygon_type = std::string;
|
||||||
using ring_type = std::string;
|
using ring_type = std::string;
|
||||||
|
|
||||||
GeoJSONFactoryImpl(int /* srid */, int precision = 7) :
|
explicit GeoJSONFactoryImpl(int /*srid*/, int precision = 7) :
|
||||||
m_precision(precision) {
|
m_precision(precision) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace osmium {
|
|||||||
|
|
||||||
// { "type": "Point", "coordinates": [100.0, 0.0] }
|
// { "type": "Point", "coordinates": [100.0, 0.0] }
|
||||||
point_type make_point(const osmium::geom::Coordinates& xy) const {
|
point_type make_point(const osmium::geom::Coordinates& xy) const {
|
||||||
std::string str {"{\"type\":\"Point\",\"coordinates\":"};
|
std::string str{"{\"type\":\"Point\",\"coordinates\":"};
|
||||||
xy.append_to_string(str, '[', ',', ']', m_precision);
|
xy.append_to_string(str, '[', ',', ']', m_precision);
|
||||||
str += "}";
|
str += "}";
|
||||||
return str;
|
return str;
|
||||||
@ -86,7 +86,7 @@ namespace osmium {
|
|||||||
m_str += ',';
|
m_str += ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
linestring_type linestring_finish(size_t /* num_points */) {
|
linestring_type linestring_finish(size_t /*num_points*/) {
|
||||||
assert(!m_str.empty());
|
assert(!m_str.empty());
|
||||||
std::string str;
|
std::string str;
|
||||||
|
|
||||||
@ -98,6 +98,28 @@ namespace osmium {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Polygon */
|
||||||
|
void polygon_start() {
|
||||||
|
m_str = "{\"type\":\"Polygon\",\"coordinates\":[[";
|
||||||
|
}
|
||||||
|
|
||||||
|
void polygon_add_location(const osmium::geom::Coordinates& xy) {
|
||||||
|
xy.append_to_string(m_str, '[', ',', ']', m_precision);
|
||||||
|
m_str += ',';
|
||||||
|
}
|
||||||
|
|
||||||
|
polygon_type polygon_finish(size_t /*num_points*/) {
|
||||||
|
assert(!m_str.empty());
|
||||||
|
std::string str;
|
||||||
|
|
||||||
|
using std::swap;
|
||||||
|
swap(str, m_str);
|
||||||
|
|
||||||
|
str.back() = ']';
|
||||||
|
str += "]}";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
/* MultiPolygon */
|
/* MultiPolygon */
|
||||||
|
|
||||||
void multipolygon_start() {
|
void multipolygon_start() {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -52,14 +52,9 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
* @attention If you include this file, you'll need to link with `libgeos`.
|
* @attention If you include this file, you'll need to link with `libgeos`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <cassert>
|
#include <osmium/geom/factory.hpp>
|
||||||
#include <cstddef>
|
#include <osmium/util/compatibility.hpp>
|
||||||
#include <iterator>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <geos/geom/Coordinate.h>
|
#include <geos/geom/Coordinate.h>
|
||||||
#include <geos/geom/CoordinateSequence.h>
|
#include <geos/geom/CoordinateSequence.h>
|
||||||
@ -72,9 +67,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <geos/geom/PrecisionModel.h>
|
#include <geos/geom/PrecisionModel.h>
|
||||||
#include <geos/util/GEOSException.h>
|
#include <geos/util/GEOSException.h>
|
||||||
|
|
||||||
#include <osmium/geom/factory.hpp>
|
#include <algorithm>
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <cassert>
|
||||||
#include <osmium/util/compatibility.hpp>
|
#include <cstddef>
|
||||||
|
#include <iterator>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// MSVC doesn't support throw_with_nested yet
|
// MSVC doesn't support throw_with_nested yet
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/geom/util.hpp>
|
#include <osmium/geom/util.hpp>
|
||||||
#include <osmium/osm/node_ref.hpp>
|
#include <osmium/osm/node_ref.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -48,7 +48,7 @@ namespace osmium {
|
|||||||
/**
|
/**
|
||||||
* @brief Functions to calculate arc distance on Earth using the haversine formula.
|
* @brief Functions to calculate arc distance on Earth using the haversine formula.
|
||||||
*
|
*
|
||||||
* See http://en.wikipedia.org/wiki/Haversine_formula
|
* See https://en.wikipedia.org/wiki/Haversine_formula
|
||||||
*
|
*
|
||||||
* Implementation derived from
|
* Implementation derived from
|
||||||
* http://blog.julien.cayzac.name/2008/10/arc-and-distance-between-two-points-on.html
|
* http://blog.julien.cayzac.name/2008/10/arc-and-distance-between-two-points-on.html
|
||||||
@ -69,7 +69,7 @@ namespace osmium {
|
|||||||
double lath = sin(deg_to_rad(c1.y - c2.y) * 0.5);
|
double lath = sin(deg_to_rad(c1.y - c2.y) * 0.5);
|
||||||
lath *= lath;
|
lath *= lath;
|
||||||
const double tmp = cos(deg_to_rad(c1.y)) * cos(deg_to_rad(c2.y));
|
const double tmp = cos(deg_to_rad(c1.y)) * cos(deg_to_rad(c2.y));
|
||||||
return 2.0 * EARTH_RADIUS_IN_METERS * asin(sqrt(lath + tmp*lonh));
|
return 2.0 * EARTH_RADIUS_IN_METERS * asin(sqrt(lath + tmp * lonh));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,13 +33,13 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/geom/util.hpp>
|
#include <osmium/geom/util.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -54,7 +54,7 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline double lat_to_y_with_tan(double lat) { // not constexpr because math functions aren't
|
inline double lat_to_y_with_tan(double lat) { // not constexpr because math functions aren't
|
||||||
return earth_radius_for_epsg3857 * std::log(std::tan(osmium::geom::PI/4 + deg_to_rad(lat)/2));
|
return earth_radius_for_epsg3857 * std::log(std::tan(osmium::geom::PI / 4 + deg_to_rad(lat) / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OSMIUM_USE_SLOW_MERCATOR_PROJECTION
|
#ifdef OSMIUM_USE_SLOW_MERCATOR_PROJECTION
|
||||||
@ -101,7 +101,7 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline double y_to_lat(double y) { // not constexpr because math functions aren't
|
inline double y_to_lat(double y) { // not constexpr because math functions aren't
|
||||||
return rad_to_deg(2 * std::atan(std::exp(y / earth_radius_for_epsg3857)) - osmium::geom::PI/2);
|
return rad_to_deg(2 * std::atan(std::exp(y / earth_radius_for_epsg3857)) - osmium::geom::PI / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
@ -138,7 +138,11 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MercatorProjection() {
|
// This is not "= default" on purpose because some compilers don't
|
||||||
|
// like it and complain that "default initialization of an object
|
||||||
|
// of const type 'const osmium::geom::MercatorProjection' requires
|
||||||
|
// a user-provided default constructor".
|
||||||
|
MercatorProjection() { // NOLINT(hicpp-use-equals-default, modernize-use-equals-default)
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinates operator()(osmium::Location location) const {
|
Coordinates operator()(osmium::Location location) const {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -42,16 +42,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
* @attention If you include this file, you'll need to link with `libgdal`.
|
* @attention If you include this file, you'll need to link with `libgdal`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/geom/coordinates.hpp>
|
||||||
|
#include <osmium/geom/factory.hpp>
|
||||||
|
|
||||||
|
#include <ogr_geometry.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <ogr_geometry.h>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
|
||||||
#include <osmium/geom/factory.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -42,16 +42,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
* @attention If you include this file, you'll need to link with `libproj`.
|
* @attention If you include this file, you'll need to link with `libproj`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <proj_api.h>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/geom/mercator_projection.hpp>
|
#include <osmium/geom/mercator_projection.hpp>
|
||||||
#include <osmium/geom/util.hpp>
|
#include <osmium/geom/util.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
|
|
||||||
|
#include <proj_api.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -161,7 +161,9 @@ namespace osmium {
|
|||||||
Coordinates operator()(osmium::Location location) const {
|
Coordinates operator()(osmium::Location location) const {
|
||||||
if (m_epsg == 4326) {
|
if (m_epsg == 4326) {
|
||||||
return Coordinates{location.lon(), location.lat()};
|
return Coordinates{location.lon(), location.lat()};
|
||||||
} else if (m_epsg == 3857) {
|
}
|
||||||
|
|
||||||
|
if (m_epsg == 3857) {
|
||||||
return Coordinates{detail::lon_to_x(location.lon()),
|
return Coordinates{detail::lon_to_x(location.lon()),
|
||||||
detail::lat_to_y(location.lat())};
|
detail::lat_to_y(location.lat())};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,11 +33,11 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/geom/factory.hpp>
|
#include <osmium/geom/factory.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,13 +33,13 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/geom/mercator_projection.hpp>
|
#include <osmium/geom/mercator_projection.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -177,7 +177,7 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator!=(const Tile& lhs, const Tile& rhs) noexcept {
|
inline bool operator!=(const Tile& lhs, const Tile& rhs) noexcept {
|
||||||
return ! (lhs == rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,16 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
#include <osmium/geom/coordinates.hpp>
|
||||||
#include <osmium/geom/factory.hpp>
|
#include <osmium/geom/factory.hpp>
|
||||||
#include <osmium/util/cast.hpp>
|
#include <osmium/util/cast.hpp>
|
||||||
#include <osmium/util/endian.hpp>
|
#include <osmium/util/endian.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -70,8 +70,8 @@ namespace osmium {
|
|||||||
out.reserve(str.size() * 2);
|
out.reserve(str.size() * 2);
|
||||||
|
|
||||||
for (char c : str) {
|
for (char c : str) {
|
||||||
out += lookup_hex[(c >> 4) & 0xf];
|
out += lookup_hex[(static_cast<unsigned int>(c) >> 4u) & 0xfu];
|
||||||
out += lookup_hex[c & 0xf];
|
out += lookup_hex[ static_cast<unsigned int>(c) & 0xfu];
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@ -83,7 +83,7 @@ namespace osmium {
|
|||||||
* Type of WKB geometry.
|
* Type of WKB geometry.
|
||||||
* These definitions are from
|
* These definitions are from
|
||||||
* 99-049_OpenGIS_Simple_Features_Specification_For_SQL_Rev_1.1.pdf (for WKB)
|
* 99-049_OpenGIS_Simple_Features_Specification_For_SQL_Rev_1.1.pdf (for WKB)
|
||||||
* and http://trac.osgeo.org/postgis/browser/trunk/doc/ZMSgeoms.txt (for EWKB).
|
* and https://trac.osgeo.org/postgis/browser/trunk/doc/ZMSgeoms.txt (for EWKB).
|
||||||
* They are used to encode geometries into the WKB format.
|
* They are used to encode geometries into the WKB format.
|
||||||
*/
|
*/
|
||||||
enum wkbGeometryType : uint32_t {
|
enum wkbGeometryType : uint32_t {
|
||||||
@ -140,8 +140,11 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_size(const std::size_t offset, const std::size_t size) {
|
void set_size(const std::size_t offset, const std::size_t size) {
|
||||||
uint32_t s = static_cast_with_assert<uint32_t>(size);
|
if (size > std::numeric_limits<uint32_t>::max()) {
|
||||||
std::copy_n(reinterpret_cast<char*>(&s), sizeof(uint32_t), &m_data[offset]);
|
throw geometry_error{"Too many points in geometry"};
|
||||||
|
}
|
||||||
|
const auto s = static_cast<uint32_t>(size);
|
||||||
|
std::copy_n(reinterpret_cast<const char*>(&s), sizeof(uint32_t), &m_data[offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -168,9 +171,9 @@ namespace osmium {
|
|||||||
|
|
||||||
if (m_out_type == out_type::hex) {
|
if (m_out_type == out_type::hex) {
|
||||||
return convert_to_hex(data);
|
return convert_to_hex(data);
|
||||||
} else {
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LineString */
|
/* LineString */
|
||||||
@ -194,9 +197,9 @@ namespace osmium {
|
|||||||
|
|
||||||
if (m_out_type == out_type::hex) {
|
if (m_out_type == out_type::hex) {
|
||||||
return convert_to_hex(data);
|
return convert_to_hex(data);
|
||||||
} else {
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MultiPolygon */
|
/* MultiPolygon */
|
||||||
@ -254,9 +257,9 @@ namespace osmium {
|
|||||||
|
|
||||||
if (m_out_type == out_type::hex) {
|
if (m_out_type == out_type::hex) {
|
||||||
return convert_to_hex(data);
|
return convert_to_hex(data);
|
||||||
} else {
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // class WKBFactoryImpl
|
}; // class WKBFactoryImpl
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/geom/coordinates.hpp>
|
||||||
|
#include <osmium/geom/factory.hpp>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <osmium/geom/coordinates.hpp>
|
|
||||||
#include <osmium/geom/factory.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace geom {
|
namespace geom {
|
||||||
@ -67,8 +67,7 @@ namespace osmium {
|
|||||||
using multipolygon_type = std::string;
|
using multipolygon_type = std::string;
|
||||||
using ring_type = std::string;
|
using ring_type = std::string;
|
||||||
|
|
||||||
WKTFactoryImpl(int srid, int precision = 7, wkt_type wtype = wkt_type::wkt) :
|
explicit WKTFactoryImpl(int srid, int precision = 7, wkt_type wtype = wkt_type::wkt) :
|
||||||
m_srid_prefix(),
|
|
||||||
m_precision(precision),
|
m_precision(precision),
|
||||||
m_wkt_type(wtype) {
|
m_wkt_type(wtype) {
|
||||||
if (m_wkt_type == wkt_type::ewkt) {
|
if (m_wkt_type == wkt_type::ewkt) {
|
||||||
@ -81,7 +80,7 @@ namespace osmium {
|
|||||||
/* Point */
|
/* Point */
|
||||||
|
|
||||||
point_type make_point(const osmium::geom::Coordinates& xy) const {
|
point_type make_point(const osmium::geom::Coordinates& xy) const {
|
||||||
std::string str {m_srid_prefix};
|
std::string str{m_srid_prefix};
|
||||||
str += "POINT";
|
str += "POINT";
|
||||||
xy.append_to_string(str, '(', ' ', ')', m_precision);
|
xy.append_to_string(str, '(', ' ', ')', m_precision);
|
||||||
return str;
|
return str;
|
||||||
@ -110,6 +109,29 @@ namespace osmium {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Polygon */
|
||||||
|
void polygon_start() {
|
||||||
|
m_str = m_srid_prefix;
|
||||||
|
m_str += "POLYGON((";
|
||||||
|
}
|
||||||
|
|
||||||
|
void polygon_add_location(const osmium::geom::Coordinates& xy) {
|
||||||
|
xy.append_to_string(m_str, ' ', m_precision);
|
||||||
|
m_str += ',';
|
||||||
|
}
|
||||||
|
|
||||||
|
polygon_type polygon_finish(size_t /* num_points */) {
|
||||||
|
assert(!m_str.empty());
|
||||||
|
std::string str;
|
||||||
|
|
||||||
|
using std::swap;
|
||||||
|
swap(str, m_str);
|
||||||
|
|
||||||
|
str.back() = ')';
|
||||||
|
str += ")";
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
/* MultiPolygon */
|
/* MultiPolygon */
|
||||||
|
|
||||||
void multipolygon_start() {
|
void multipolygon_start() {
|
||||||
|
26
third_party/libosmium/include/osmium/handler.hpp
vendored
26
third_party/libosmium/include/osmium/handler.hpp
vendored
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -72,40 +72,40 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void osm_object(const osmium::OSMObject&) const noexcept {
|
void osm_object(const osmium::OSMObject& /*osm_object*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void node(const osmium::Node&) const noexcept {
|
void node(const osmium::Node& /*node*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void way(const osmium::Way&) const noexcept {
|
void way(const osmium::Way& /*way*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void relation(const osmium::Relation&) const noexcept {
|
void relation(const osmium::Relation& /*relation*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void area(const osmium::Area&) const noexcept {
|
void area(const osmium::Area& /*area*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeset(const osmium::Changeset&) const noexcept {
|
void changeset(const osmium::Changeset& /*changeset*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void tag_list(const osmium::TagList&) const noexcept {
|
void tag_list(const osmium::TagList& /*tag_list*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void way_node_list(const osmium::WayNodeList&) const noexcept {
|
void way_node_list(const osmium::WayNodeList& /*way_node_list*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void relation_member_list(const osmium::RelationMemberList&) const noexcept {
|
void relation_member_list(const osmium::RelationMemberList& /*relation_member_list*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void outer_ring(const osmium::OuterRing&) const noexcept {
|
void outer_ring(const osmium::OuterRing& /*outer_ring*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void inner_ring(const osmium::InnerRing&) const noexcept {
|
void inner_ring(const osmium::InnerRing& /*inner_ring*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeset_discussion(const osmium::ChangesetDiscussion&) const noexcept {
|
void changeset_discussion(const osmium::ChangesetDiscussion& /*changeset_discussion*/) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush() const noexcept {
|
void flush() const noexcept {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,10 +33,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#define OSMIUM_CHAIN_HANDLER_CALL(_func_, _type_) \
|
#define OSMIUM_CHAIN_HANDLER_CALL(_func_, _type_) \
|
||||||
template <int N, int SIZE, typename THandlers> \
|
template <int N, int SIZE, typename THandlers> \
|
||||||
struct call_ ## _func_ { \
|
struct call_ ## _func_ { \
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,10 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
#include <osmium/osm/node.hpp>
|
#include <osmium/osm/node.hpp>
|
||||||
#include <osmium/osm/object_comparisons.hpp>
|
#include <osmium/osm/object_comparisons.hpp>
|
||||||
@ -44,6 +40,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,8 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
#include <osmium/index/map.hpp>
|
#include <osmium/index/map.hpp>
|
||||||
#include <osmium/io/detail/read_write.hpp>
|
#include <osmium/io/detail/read_write.hpp>
|
||||||
@ -46,6 +44,8 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
#include <osmium/visitor.hpp>
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace handler {
|
namespace handler {
|
||||||
@ -78,11 +78,6 @@ namespace osmium {
|
|||||||
m_relation_index(relation_index) {
|
m_relation_index(relation_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DiskStore(const DiskStore&) = delete;
|
|
||||||
DiskStore& operator=(const DiskStore&) = delete;
|
|
||||||
|
|
||||||
~DiskStore() noexcept = default;
|
|
||||||
|
|
||||||
void node(const osmium::Node& node) {
|
void node(const osmium::Node& node) {
|
||||||
m_node_index.set(node.positive_id(), m_offset);
|
m_node_index.set(node.positive_id(), m_offset);
|
||||||
m_offset += node.byte_size();
|
m_offset += node.byte_size();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,10 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iomanip>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
#include <osmium/memory/collection.hpp>
|
#include <osmium/memory/collection.hpp>
|
||||||
#include <osmium/memory/item.hpp>
|
#include <osmium/memory/item.hpp>
|
||||||
@ -54,6 +50,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
#include <osmium/visitor.hpp>
|
#include <osmium/visitor.hpp>
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace handler {
|
namespace handler {
|
||||||
@ -136,10 +136,10 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit Dump(std::ostream& out, bool with_size = true, const std::string& prefix = "") :
|
explicit Dump(std::ostream& out, bool with_size = true, std::string prefix = "") :
|
||||||
m_out(&out),
|
m_out(&out),
|
||||||
m_with_size(with_size),
|
m_with_size(with_size),
|
||||||
m_prefix(prefix) {
|
m_prefix(std::move(prefix)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void tag_list(const osmium::TagList& tags) {
|
void tag_list(const osmium::TagList& tags) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,19 +33,18 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
#include <osmium/index/index.hpp>
|
#include <osmium/index/index.hpp>
|
||||||
#include <osmium/index/map/dummy.hpp>
|
#include <osmium/index/map/dummy.hpp>
|
||||||
|
#include <osmium/index/node_locations_map.hpp>
|
||||||
#include <osmium/osm/location.hpp>
|
#include <osmium/osm/location.hpp>
|
||||||
#include <osmium/osm/node.hpp>
|
#include <osmium/osm/node.hpp>
|
||||||
#include <osmium/osm/node_ref.hpp>
|
#include <osmium/osm/node_ref.hpp>
|
||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
|
|
||||||
#include <osmium/index/node_locations_map.hpp>
|
#include <limits>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ namespace osmium {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
explicit NodeLocationsForWays(TStoragePosIDs& storage_pos,
|
explicit NodeLocationsForWays(TStoragePosIDs& storage_pos,
|
||||||
TStorageNegIDs& storage_neg = get_dummy()) :
|
TStorageNegIDs& storage_neg = get_dummy()) noexcept :
|
||||||
m_storage_pos(storage_pos),
|
m_storage_pos(storage_pos),
|
||||||
m_storage_neg(storage_neg) {
|
m_storage_neg(storage_neg) {
|
||||||
}
|
}
|
||||||
@ -107,8 +106,8 @@ namespace osmium {
|
|||||||
NodeLocationsForWays(const NodeLocationsForWays&) = delete;
|
NodeLocationsForWays(const NodeLocationsForWays&) = delete;
|
||||||
NodeLocationsForWays& operator=(const NodeLocationsForWays&) = delete;
|
NodeLocationsForWays& operator=(const NodeLocationsForWays&) = delete;
|
||||||
|
|
||||||
NodeLocationsForWays(NodeLocationsForWays&&) = default;
|
NodeLocationsForWays(NodeLocationsForWays&&) noexcept = default;
|
||||||
NodeLocationsForWays& operator=(NodeLocationsForWays&&) = default;
|
NodeLocationsForWays& operator=(NodeLocationsForWays&&) noexcept = default;
|
||||||
|
|
||||||
~NodeLocationsForWays() noexcept = default;
|
~NodeLocationsForWays() noexcept = default;
|
||||||
|
|
||||||
@ -138,10 +137,9 @@ namespace osmium {
|
|||||||
*/
|
*/
|
||||||
osmium::Location get_node_location(const osmium::object_id_type id) const {
|
osmium::Location get_node_location(const osmium::object_id_type id) const {
|
||||||
if (id >= 0) {
|
if (id >= 0) {
|
||||||
return m_storage_pos.get_noexcept(static_cast<osmium::unsigned_object_id_type>( id));
|
return m_storage_pos.get_noexcept(static_cast<osmium::unsigned_object_id_type>(id));
|
||||||
} else {
|
|
||||||
return m_storage_neg.get_noexcept(static_cast<osmium::unsigned_object_id_type>(-id));
|
|
||||||
}
|
}
|
||||||
|
return m_storage_neg.get_noexcept(static_cast<osmium::unsigned_object_id_type>(-id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
#include <osmium/index/multimap.hpp>
|
#include <osmium/index/multimap.hpp>
|
||||||
#include <osmium/osm/node_ref.hpp>
|
|
||||||
#include <osmium/osm/item_type.hpp>
|
#include <osmium/osm/item_type.hpp>
|
||||||
|
#include <osmium/osm/node_ref.hpp>
|
||||||
#include <osmium/osm/relation.hpp>
|
#include <osmium/osm/relation.hpp>
|
||||||
#include <osmium/osm/types.hpp>
|
#include <osmium/osm/types.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
@ -70,11 +70,6 @@ namespace osmium {
|
|||||||
m_index_r2r(r2r) {
|
m_index_r2r(r2r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectRelations(const ObjectRelations&) = delete;
|
|
||||||
ObjectRelations& operator=(const ObjectRelations&) = delete;
|
|
||||||
|
|
||||||
~ObjectRelations() noexcept = default;
|
|
||||||
|
|
||||||
void way(const osmium::Way& way) {
|
void way(const osmium::Way& way) {
|
||||||
for (const auto& node_ref : way.nodes()) {
|
for (const auto& node_ref : way.nodes()) {
|
||||||
m_index_n2w.set(node_ref.positive_ref(), way.positive_id());
|
m_index_n2w.set(node_ref.positive_ref(), way.positive_id());
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
assert(config.size() > 1);
|
assert(config.size() > 1);
|
||||||
const std::string& filename = config[1];
|
const std::string& filename = config[1];
|
||||||
const int fd = ::open(filename.c_str(), O_CREAT | O_RDWR, 0644);
|
const int fd = ::open(filename.c_str(), O_CREAT | O_RDWR, 0644); // NOLINT(hicpp-signed-bitwise)
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
throw std::runtime_error{std::string{"can't open file '"} + filename + "': " + std::strerror(errno)};
|
throw std::runtime_error{std::string{"can't open file '"} + filename + "': " + std::strerror(errno)};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -54,8 +54,6 @@ namespace osmium {
|
|||||||
mmap_vector_base<T>() {
|
mmap_vector_base<T>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
~mmap_vector_anon() noexcept = default;
|
|
||||||
|
|
||||||
}; // class mmap_vector_anon
|
}; // class mmap_vector_anon
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,15 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/index/index.hpp>
|
||||||
|
#include <osmium/util/memory_mapping.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <new> // IWYU pragma: keep
|
#include <new> // IWYU pragma: keep
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <osmium/index/index.hpp>
|
|
||||||
#include <osmium/util/memory_mapping.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -58,27 +58,24 @@ namespace osmium {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
size_t m_size;
|
size_t m_size = 0;
|
||||||
osmium::util::TypedMemoryMapping<T> m_mapping;
|
osmium::TypedMemoryMapping<T> m_mapping;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
mmap_vector_base(int fd, size_t capacity, size_t size = 0) :
|
mmap_vector_base(int fd, size_t capacity, size_t size = 0) :
|
||||||
m_size(size),
|
m_size(size),
|
||||||
m_mapping(capacity, osmium::util::MemoryMapping::mapping_mode::write_shared, fd) {
|
m_mapping(capacity, osmium::MemoryMapping::mapping_mode::write_shared, fd) {
|
||||||
assert(size <= capacity);
|
assert(size <= capacity);
|
||||||
std::fill(data() + size, data() + capacity, osmium::index::empty_value<T>());
|
std::fill(data() + size, data() + capacity, osmium::index::empty_value<T>());
|
||||||
shrink_to_fit();
|
shrink_to_fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit mmap_vector_base(size_t capacity = mmap_vector_size_increment) :
|
explicit mmap_vector_base(size_t capacity = mmap_vector_size_increment) :
|
||||||
m_size(0),
|
|
||||||
m_mapping(capacity) {
|
m_mapping(capacity) {
|
||||||
std::fill_n(data(), capacity, osmium::index::empty_value<T>());
|
std::fill_n(data(), capacity, osmium::index::empty_value<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
~mmap_vector_base() noexcept = default;
|
|
||||||
|
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
using pointer = value_type*;
|
using pointer = value_type*;
|
||||||
using const_pointer = const value_type*;
|
using const_pointer = const value_type*;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,15 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/index/detail/mmap_vector_base.hpp>
|
||||||
|
#include <osmium/index/detail/tmpfile.hpp>
|
||||||
|
#include <osmium/util/file.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <osmium/index/detail/mmap_vector_base.hpp>
|
|
||||||
#include <osmium/index/detail/tmpfile.hpp>
|
|
||||||
#include <osmium/util/file.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -54,7 +54,7 @@ namespace osmium {
|
|||||||
class mmap_vector_file : public mmap_vector_base<T> {
|
class mmap_vector_file : public mmap_vector_base<T> {
|
||||||
|
|
||||||
static std::size_t filesize(int fd) {
|
static std::size_t filesize(int fd) {
|
||||||
const auto size = osmium::util::file_size(fd);
|
const auto size = osmium::file_size(fd);
|
||||||
|
|
||||||
if (size % sizeof(T) != 0) {
|
if (size % sizeof(T) != 0) {
|
||||||
throw std::runtime_error{"Index file has wrong size (must be multiple of " + std::to_string(sizeof(T)) + ")."};
|
throw std::runtime_error{"Index file has wrong size (must be multiple of " + std::to_string(sizeof(T)) + ")."};
|
||||||
@ -78,8 +78,6 @@ namespace osmium {
|
|||||||
filesize(fd)) {
|
filesize(fd)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~mmap_vector_file() noexcept = default;
|
|
||||||
|
|
||||||
}; // class mmap_vector_file
|
}; // class mmap_vector_file
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,14 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <osmium/index/index.hpp>
|
#include <osmium/index/index.hpp>
|
||||||
#include <osmium/index/map.hpp>
|
#include <osmium/index/map.hpp>
|
||||||
#include <osmium/io/detail/read_write.hpp>
|
#include <osmium/io/detail/read_write.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace index {
|
namespace index {
|
||||||
@ -67,8 +67,6 @@ namespace osmium {
|
|||||||
m_vector(fd) {
|
m_vector(fd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~VectorBasedDenseMap() noexcept final = default;
|
|
||||||
|
|
||||||
void reserve(const std::size_t size) final {
|
void reserve(const std::size_t size) final {
|
||||||
m_vector.reserve(size);
|
m_vector.reserve(size);
|
||||||
}
|
}
|
||||||
@ -146,7 +144,7 @@ namespace osmium {
|
|||||||
}; // class VectorBasedDenseMap
|
}; // class VectorBasedDenseMap
|
||||||
|
|
||||||
|
|
||||||
template <typename TId, typename TValue, template<typename...> class TVector>
|
template <typename TId, typename TValue, template <typename...> class TVector>
|
||||||
class VectorBasedSparseMap : public Map<TId, TValue> {
|
class VectorBasedSparseMap : public Map<TId, TValue> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -180,8 +178,6 @@ namespace osmium {
|
|||||||
m_vector(fd) {
|
m_vector(fd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~VectorBasedSparseMap() final = default;
|
|
||||||
|
|
||||||
void set(const TId id, const TValue value) final {
|
void set(const TId id, const TValue value) final {
|
||||||
m_vector.push_back(element_type(id, value));
|
m_vector.push_back(element_type(id, value));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,21 +33,21 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <osmium/index/index.hpp>
|
#include <osmium/index/index.hpp>
|
||||||
#include <osmium/index/multimap.hpp>
|
#include <osmium/index/multimap.hpp>
|
||||||
#include <osmium/io/detail/read_write.hpp>
|
#include <osmium/io/detail/read_write.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace index {
|
namespace index {
|
||||||
|
|
||||||
namespace multimap {
|
namespace multimap {
|
||||||
|
|
||||||
template <typename TId, typename TValue, template<typename...> class TVector>
|
template <typename TId, typename TValue, template <typename...> class TVector>
|
||||||
class VectorBasedSparseMultimap : public Multimap<TId, TValue> {
|
class VectorBasedSparseMultimap : public Multimap<TId, TValue> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -75,8 +75,6 @@ namespace osmium {
|
|||||||
m_vector(fd) {
|
m_vector(fd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~VectorBasedSparseMultimap() noexcept final = default;
|
|
||||||
|
|
||||||
void set(const TId id, const TValue value) final {
|
void set(const TId id, const TValue value) final {
|
||||||
m_vector.push_back(element_type(id, value));
|
m_vector.push_back(element_type(id, value));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,6 +33,9 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/osm/item_type.hpp>
|
||||||
|
#include <osmium/osm/types.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -42,9 +45,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osmium/osm/item_type.hpp>
|
|
||||||
#include <osmium/osm/types.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace index {
|
namespace index {
|
||||||
@ -58,6 +58,14 @@ namespace osmium {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IdSet() = default;
|
||||||
|
|
||||||
|
IdSet(const IdSet&) = default;
|
||||||
|
IdSet& operator=(const IdSet&) = default;
|
||||||
|
|
||||||
|
IdSet(IdSet&&) noexcept = default;
|
||||||
|
IdSet& operator=(IdSet&&) noexcept = default;
|
||||||
|
|
||||||
virtual ~IdSet() = default;
|
virtual ~IdSet() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,7 +121,7 @@ namespace osmium {
|
|||||||
const auto slot = m_set->m_data[cid][IdSetDense<T>::offset(m_value)];
|
const auto slot = m_set->m_data[cid][IdSetDense<T>::offset(m_value)];
|
||||||
if (slot == 0) {
|
if (slot == 0) {
|
||||||
m_value += 8;
|
m_value += 8;
|
||||||
m_value &= ~0x7;
|
m_value &= ~0x7ull;
|
||||||
} else {
|
} else {
|
||||||
++m_value;
|
++m_value;
|
||||||
}
|
}
|
||||||
@ -154,7 +162,7 @@ namespace osmium {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const IdSetDenseIterator<T>& rhs) const noexcept {
|
bool operator!=(const IdSetDenseIterator<T>& rhs) const noexcept {
|
||||||
return ! (*this == rhs);
|
return !(*this == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
T operator*() const noexcept {
|
T operator*() const noexcept {
|
||||||
@ -183,22 +191,22 @@ namespace osmium {
|
|||||||
// which would mean less (but larger) memory allocations. For
|
// which would mean less (but larger) memory allocations. For
|
||||||
// relations Ids it could be smaller, because they would all fit
|
// relations Ids it could be smaller, because they would all fit
|
||||||
// into a smaller allocation.
|
// into a smaller allocation.
|
||||||
constexpr static const std::size_t chunk_bits = 22;
|
constexpr static const std::size_t chunk_bits = 22u;
|
||||||
constexpr static const std::size_t chunk_size = 1 << chunk_bits;
|
constexpr static const std::size_t chunk_size = 1u << chunk_bits;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<unsigned char[]>> m_data;
|
std::vector<std::unique_ptr<unsigned char[]>> m_data;
|
||||||
T m_size = 0;
|
T m_size = 0;
|
||||||
|
|
||||||
static std::size_t chunk_id(T id) noexcept {
|
static std::size_t chunk_id(T id) noexcept {
|
||||||
return id >> (chunk_bits + 3);
|
return id >> (chunk_bits + 3u);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::size_t offset(T id) noexcept {
|
static std::size_t offset(T id) noexcept {
|
||||||
return (id >> 3) & ((1 << chunk_bits) - 1);
|
return (id >> 3u) & ((1u << chunk_bits) - 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char bitmask(T id) noexcept {
|
static unsigned char bitmask(T id) noexcept {
|
||||||
return 1 << (id & 0x7);
|
return 1u << (id & 0x7u);
|
||||||
}
|
}
|
||||||
|
|
||||||
T last() const noexcept {
|
T last() const noexcept {
|
||||||
@ -422,7 +430,7 @@ namespace osmium {
|
|||||||
}; // class IdSetSmall
|
}; // class IdSetSmall
|
||||||
|
|
||||||
/// @deprecated Use nwr_array helper class instead.
|
/// @deprecated Use nwr_array helper class instead.
|
||||||
template <template<typename> class IdSetType>
|
template <template <typename> class IdSetType>
|
||||||
class NWRIdSet {
|
class NWRIdSet {
|
||||||
|
|
||||||
using id_set_type = IdSetType<osmium::unsigned_object_id_type>;
|
using id_set_type = IdSetType<osmium::unsigned_object_id_type>;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <osmium/util/string.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -43,8 +45,6 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <osmium/util/string.hpp>
|
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
struct map_factory_error : public std::runtime_error {
|
struct map_factory_error : public std::runtime_error {
|
||||||
@ -98,13 +98,10 @@ namespace osmium {
|
|||||||
static_assert(std::is_integral<TId>::value && std::is_unsigned<TId>::value,
|
static_assert(std::is_integral<TId>::value && std::is_unsigned<TId>::value,
|
||||||
"TId template parameter for class Map must be unsigned integral type");
|
"TId template parameter for class Map must be unsigned integral type");
|
||||||
|
|
||||||
Map(const Map&) = delete;
|
|
||||||
Map& operator=(const Map&) = delete;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Map(Map&&) = default;
|
Map(Map&&) noexcept = default;
|
||||||
Map& operator=(Map&&) = default;
|
Map& operator=(Map&&) noexcept = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -114,11 +111,14 @@ namespace osmium {
|
|||||||
/// The "value" type, usually a Location or size_t.
|
/// The "value" type, usually a Location or size_t.
|
||||||
using value_type = TValue;
|
using value_type = TValue;
|
||||||
|
|
||||||
Map() = default;
|
Map() noexcept = default;
|
||||||
|
|
||||||
|
Map(const Map&) = delete;
|
||||||
|
Map& operator=(const Map&) = delete;
|
||||||
|
|
||||||
virtual ~Map() noexcept = default;
|
virtual ~Map() noexcept = default;
|
||||||
|
|
||||||
virtual void reserve(const size_t) {
|
virtual void reserve(const size_t /*size*/) {
|
||||||
// default implementation is empty
|
// default implementation is empty
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,14 +210,16 @@ namespace osmium {
|
|||||||
|
|
||||||
MapFactory() = default;
|
MapFactory() = default;
|
||||||
|
|
||||||
|
~MapFactory() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
MapFactory(const MapFactory&) = delete;
|
MapFactory(const MapFactory&) = delete;
|
||||||
MapFactory& operator=(const MapFactory&) = delete;
|
MapFactory& operator=(const MapFactory&) = delete;
|
||||||
|
|
||||||
MapFactory(MapFactory&&) = delete;
|
MapFactory(MapFactory&&) = delete;
|
||||||
MapFactory& operator=(MapFactory&&) = delete;
|
MapFactory& operator=(MapFactory&&) = delete;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static MapFactory<id_type, value_type>& instance() {
|
static MapFactory<id_type, value_type>& instance() {
|
||||||
static MapFactory<id_type, value_type> factory;
|
static MapFactory<id_type, value_type> factory;
|
||||||
return factory;
|
return factory;
|
||||||
@ -262,16 +264,16 @@ namespace osmium {
|
|||||||
|
|
||||||
namespace map {
|
namespace map {
|
||||||
|
|
||||||
template <typename TId, typename TValue, template<typename, typename> class TMap>
|
template <typename TId, typename TValue, template <typename, typename> class TMap>
|
||||||
struct create_map {
|
struct create_map {
|
||||||
TMap<TId, TValue>* operator()(const std::vector<std::string>&) {
|
TMap<TId, TValue>* operator()(const std::vector<std::string>& /*config_string*/) {
|
||||||
return new TMap<TId, TValue>();
|
return new TMap<TId, TValue>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace map
|
} // namespace map
|
||||||
|
|
||||||
template <typename TId, typename TValue, template<typename, typename> class TMap>
|
template <typename TId, typename TValue, template <typename, typename> class TMap>
|
||||||
inline bool register_map(const std::string& name) {
|
inline bool register_map(const std::string& name) {
|
||||||
return osmium::index::MapFactory<TId, TValue>::instance().register_map(name, [](const std::vector<std::string>& config) {
|
return osmium::index::MapFactory<TId, TValue>::instance().register_map(name, [](const std::vector<std::string>& config) {
|
||||||
return map::create_map<TId, TValue, TMap>()(config);
|
return map::create_map<TId, TValue, TMap>()(config);
|
||||||
@ -283,10 +285,11 @@ namespace osmium {
|
|||||||
|
|
||||||
#define REGISTER_MAP(id, value, klass, name) \
|
#define REGISTER_MAP(id, value, klass, name) \
|
||||||
namespace osmium { namespace index { namespace detail { \
|
namespace osmium { namespace index { namespace detail { \
|
||||||
const bool OSMIUM_CONCATENATE_(registered_, name) = osmium::index::register_map<id, value, klass>(#name); \
|
namespace OSMIUM_CONCATENATE_(register_map_, __COUNTER__) { \
|
||||||
inline bool OSMIUM_CONCATENATE_(get_registered_, name)() noexcept { \
|
const bool registered = osmium::index::register_map<id, value, klass>(#name); \
|
||||||
return OSMIUM_CONCATENATE_(registered_, name); \
|
inline bool get_registered() noexcept { \
|
||||||
} \
|
return registered; \
|
||||||
|
} } \
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
} // namespace index
|
} // namespace index
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,12 +33,12 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string>
|
#include <osmium/index/detail/create_map_with_fd.hpp>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/index/detail/mmap_vector_file.hpp>
|
#include <osmium/index/detail/mmap_vector_file.hpp>
|
||||||
#include <osmium/index/detail/vector_map.hpp>
|
#include <osmium/index/detail/vector_map.hpp>
|
||||||
#include <osmium/index/detail/create_map_with_fd.hpp>
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define OSMIUM_HAS_INDEX_MAP_DENSE_FILE_ARRAY
|
#define OSMIUM_HAS_INDEX_MAP_DENSE_FILE_ARRAY
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,10 +33,10 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <osmium/index/detail/vector_map.hpp>
|
#include <osmium/index/detail/vector_map.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define OSMIUM_HAS_INDEX_MAP_DENSE_MEM_ARRAY
|
#define OSMIUM_HAS_INDEX_MAP_DENSE_MEM_ARRAY
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||||
|
|
||||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
Copyright 2013-2018 Jochen Topf <jochen@topf.org> and others (see README).
|
||||||
|
|
||||||
Boost Software License - Version 1.0 - August 17th, 2003
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
@ -33,11 +33,11 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include <osmium/index/index.hpp>
|
#include <osmium/index/index.hpp>
|
||||||
#include <osmium/index/map.hpp>
|
#include <osmium/index/map.hpp>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace osmium {
|
namespace osmium {
|
||||||
|
|
||||||
namespace index {
|
namespace index {
|
||||||
@ -56,9 +56,7 @@ namespace osmium {
|
|||||||
|
|
||||||
Dummy() = default;
|
Dummy() = default;
|
||||||
|
|
||||||
~Dummy() noexcept final = default;
|
void set(const TId /*id*/, const TValue /*value*/) final {
|
||||||
|
|
||||||
void set(const TId, const TValue) final {
|
|
||||||
// intentionally left blank
|
// intentionally left blank
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user