Update libosmium to 2.18.0. Fix problem with Docker image build. (#6303)
This commit is contained in:
parent
51a8486375
commit
9688e48ad1
37
.github/workflows/osrm-backend.yml
vendored
37
.github/workflows/osrm-backend.yml
vendored
@ -47,6 +47,17 @@ jobs:
|
||||
./scripts/format.sh && ./scripts/error_on_dirty.sh
|
||||
node ./scripts/validate_changelog.js
|
||||
npm run docs && ./scripts/error_on_dirty.sh
|
||||
|
||||
docker-image:
|
||||
needs: format-taginfo-docs
|
||||
runs-on: ubuntu-22.04
|
||||
continue-on-error: false
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Docker build
|
||||
run: |
|
||||
docker build -f docker/Dockerfile .
|
||||
|
||||
build-test-publish:
|
||||
needs: format-taginfo-docs
|
||||
@ -78,13 +89,13 @@ jobs:
|
||||
OSRM_CONNECTION_RETRIES: 10
|
||||
OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5
|
||||
|
||||
- name: clang-5.0-debug
|
||||
- name: clang-6.0-debug
|
||||
continue-on-error: false
|
||||
node: 12
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Debug
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
CUCUMBER_TIMEOUT: 60000
|
||||
|
||||
- name: clang-11.0-debug-clang-tidy
|
||||
@ -113,7 +124,7 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TOOLS: ON
|
||||
BUILD_TYPE: Release
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_CONAN: ON
|
||||
|
||||
- name: gcc-11-release
|
||||
@ -230,7 +241,7 @@ jobs:
|
||||
node: 12
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Release
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -241,7 +252,7 @@ jobs:
|
||||
node: 12
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Debug
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -252,7 +263,7 @@ jobs:
|
||||
node: 14
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Release
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -263,7 +274,7 @@ jobs:
|
||||
node: 14
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Debug
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -275,7 +286,7 @@ jobs:
|
||||
node: 16
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Release
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -286,7 +297,7 @@ jobs:
|
||||
node: 16
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Debug
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -311,7 +322,7 @@ jobs:
|
||||
node: 16
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Release
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -323,7 +334,7 @@ jobs:
|
||||
node: 16
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Debug
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -346,7 +357,7 @@ jobs:
|
||||
node: "lts/*"
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Release
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
@ -357,7 +368,7 @@ jobs:
|
||||
node: "lts/*"
|
||||
runs-on: ubuntu-20.04
|
||||
BUILD_TYPE: Debug
|
||||
CLANG_VERSION: 5.0.0
|
||||
CLANG_VERSION: 6.0.0
|
||||
ENABLE_GLIBC_WORKAROUND: ON
|
||||
ENABLE_CONAN: ON
|
||||
NODE_PACKAGE_TESTS_ONLY: ON
|
||||
|
@ -9,6 +9,7 @@
|
||||
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
|
||||
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)
|
||||
- Build:
|
||||
- CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303)
|
||||
- CHANGED: Remove EXACT from find_package if using Conan. [#6299](https://github.com/Project-OSRM/osrm-backend/pull/6299)
|
||||
- CHANGED: Configure Undefined Behaviour Sanitizer. [#6290](https://github.com/Project-OSRM/osrm-backend/pull/6290)
|
||||
- CHANGED: Use Conan instead of Mason to install code dependencies. [#6284](https://github.com/Project-OSRM/osrm-backend/pull/6284)
|
||||
|
@ -10,7 +10,8 @@ RUN apt-get update && \
|
||||
COPY . /src
|
||||
WORKDIR /src
|
||||
|
||||
RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} echo "Building OSRM ${DOCKER_TAG}" && \
|
||||
RUN NPROC=${BUILD_CONCURRENCY:-$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1)} && \
|
||||
echo "Building OSRM ${DOCKER_TAG}" && \
|
||||
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
||||
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
||||
mkdir -p build && \
|
||||
|
28
third_party/libosmium/.clang-tidy
vendored
28
third_party/libosmium/.clang-tidy
vendored
@ -1,11 +1,17 @@
|
||||
---
|
||||
Checks: '*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-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-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers'
|
||||
Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-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-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto'
|
||||
#
|
||||
# For a list of check options, see:
|
||||
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
#
|
||||
# Disabled checks:
|
||||
#
|
||||
# abseil-string-find-str-contains
|
||||
# We don't want the dependency.
|
||||
#
|
||||
# altera-*
|
||||
# Doesn't apply.
|
||||
#
|
||||
# android-cloexec-*
|
||||
# O_CLOEXEC isn't available on Windows making this non-portable.
|
||||
#
|
||||
@ -13,6 +19,9 @@ Checks: '*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-macro-parentheses
|
||||
# Nice idea but collides but with switch statements we'll need to use
|
||||
# fall-throughs to fix this, which is also bad.
|
||||
#
|
||||
# bugprone-easily-swappable-parameters
|
||||
# Interesting test, but not something we can do much about in many places.
|
||||
#
|
||||
# bugprone-macro-parentheses
|
||||
# False positive in the only place where it reports something and
|
||||
# disabling locally doesn't work.
|
||||
@ -87,6 +96,14 @@ Checks: '*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-macro-parentheses
|
||||
# hicpp-vararg
|
||||
# Too strict, sometimes calling vararg functions is necessary.
|
||||
#
|
||||
# llvm-qualified-auto
|
||||
# readability-qualified-auto
|
||||
# This reports too many cases. Typical case is an iterator that might be
|
||||
# a pointer on one system but some special type on another.
|
||||
#
|
||||
# llvmlibc-*
|
||||
# Doesn't apply to us.
|
||||
#
|
||||
# misc-macro-parentheses
|
||||
# Old name for bugprone-macro-parentheses.
|
||||
#
|
||||
@ -95,6 +112,9 @@ Checks: '*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-macro-parentheses
|
||||
# an option "IgnoreClassesWithAllMemberVariablesBeingPublic" which should
|
||||
# disable this, but it didn't work for me.
|
||||
#
|
||||
# misc-no-recursion
|
||||
# There is nothing wrong with recursion.
|
||||
#
|
||||
# misc-unused-parameters
|
||||
# Can't be fixed, because then Doxygen will complain. (In file
|
||||
# include/osmium/area/problem_reporter.hpp).
|
||||
@ -117,6 +137,12 @@ Checks: '*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-macro-parentheses
|
||||
# This is header only library, so the declaration and implementation are
|
||||
# often the same and we want to have the const in implementations.
|
||||
#
|
||||
# readability-function-cognitive-complexity
|
||||
# Sometimes the large functions are needed.
|
||||
#
|
||||
# readability-identifier-length
|
||||
# Too strict.
|
||||
#
|
||||
# readability-implicit-bool-cast
|
||||
# Old name for readability-implicit-bool-conversion.
|
||||
#
|
||||
|
1
third_party/libosmium/.github/FUNDING.yml
vendored
Normal file
1
third_party/libosmium/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
custom: "https://osmcode.org/sponsors.html"
|
48
third_party/libosmium/.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
48
third_party/libosmium/.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
name: Report problems with the software
|
||||
about: You found a (possible) bug in libosmium
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## What version of libosmium are you using?
|
||||
|
||||
<!-- Please use the [latest
|
||||
release](https://github.com/osmcode/libosmium/releases) or master if at all
|
||||
possible. -->
|
||||
|
||||
|
||||
## What operating system and compiler are you using?
|
||||
|
||||
<!-- Also what Linux distribution if applicable, OS version? -->
|
||||
|
||||
|
||||
## Tell us something about your system
|
||||
|
||||
<!-- How much RAM do you have, how many CPUs, bare metal or cloud setup? -->
|
||||
|
||||
|
||||
## What did you do exactly?
|
||||
|
||||
<!-- Please provide the command(s) you used including all options etc. Include
|
||||
links to input files. -->
|
||||
|
||||
|
||||
## What did you expect to happen?
|
||||
|
||||
<!-- Describe in detail what you expected the above would do. -->
|
||||
|
||||
|
||||
## What did happen instead?
|
||||
|
||||
<!-- Please describe what happened and why you think this is wrong. Please
|
||||
include (or link to, if it is too verbose) the log output. -->
|
||||
|
||||
|
||||
## What did you do to try analyzing the problem?
|
||||
|
||||
<!-- Describe what steps you already did to try analyzing the problem before
|
||||
reporting. -->
|
||||
|
4
third_party/libosmium/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
4
third_party/libosmium/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
contact_links:
|
||||
- name: help.osm.org
|
||||
url: https://help.openstreetmap.org/
|
||||
about: Ask questions and get support from the community.
|
10
third_party/libosmium/.github/actions/build-windows/action.yml
vendored
Normal file
10
third_party/libosmium/.github/actions/build-windows/action.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
name: Windows Build
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Build
|
||||
run: cmake --build . --config Release --verbose
|
||||
shell: bash
|
||||
working-directory: build
|
||||
|
10
third_party/libosmium/.github/actions/build/action.yml
vendored
Normal file
10
third_party/libosmium/.github/actions/build/action.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
name: Build
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Build
|
||||
run: make VERBOSE=1
|
||||
shell: bash
|
||||
working-directory: build
|
||||
|
13
third_party/libosmium/.github/actions/cmake-windows/action.yml
vendored
Normal file
13
third_party/libosmium/.github/actions/cmake-windows/action.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
name: Windows CMake
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Create build directory
|
||||
run: mkdir build
|
||||
shell: bash
|
||||
- name: Configure
|
||||
run: cmake -LA .. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_HEADERS=OFF -DBUILD_BENCHMARKS=ON -DOsmium_DEBUG=TRUE -DPROTOZERO_INCLUDE_DIR=${GITHUB_WORKSPACE}/../protozero/include
|
||||
shell: bash
|
||||
working-directory: build
|
||||
|
19
third_party/libosmium/.github/actions/cmake/action.yml
vendored
Normal file
19
third_party/libosmium/.github/actions/cmake/action.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: CMake
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Create build directory
|
||||
run: mkdir build
|
||||
shell: bash
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -LA .. \
|
||||
-DBUILD_DATA_TESTS=ON \
|
||||
-DUSE_CPP_VERSION=${CPP_VERSION} \
|
||||
-DWITH_PROJ=${WITH_PROJ} \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DPROTOZERO_INCLUDE_DIR=${GITHUB_WORKSPACE}/../protozero/include
|
||||
shell: bash
|
||||
working-directory: build
|
||||
|
10
third_party/libosmium/.github/actions/ctest-windows/action.yml
vendored
Normal file
10
third_party/libosmium/.github/actions/ctest-windows/action.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
name: Windows Test
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Test
|
||||
run: ctest --output-on-failure -C Release
|
||||
shell: bash
|
||||
working-directory: build
|
||||
|
10
third_party/libosmium/.github/actions/ctest/action.yml
vendored
Normal file
10
third_party/libosmium/.github/actions/ctest/action.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
name: ctest
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Test
|
||||
run: ctest --output-on-failure
|
||||
shell: bash
|
||||
working-directory: build
|
||||
|
13
third_party/libosmium/.github/actions/install-macos/action.yml
vendored
Normal file
13
third_party/libosmium/.github/actions/install-macos/action.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
name: Install homebrew packages on macOS
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: |
|
||||
brew install \
|
||||
boost \
|
||||
gdal \
|
||||
google-sparsehash
|
||||
shell: bash
|
||||
|
9
third_party/libosmium/.github/actions/install-protozero/action.yml
vendored
Normal file
9
third_party/libosmium/.github/actions/install-protozero/action.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
name: Install Protozero from git
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install from git
|
||||
run: git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero
|
||||
shell: bash
|
||||
|
23
third_party/libosmium/.github/actions/install-ubuntu/action.yml
vendored
Normal file
23
third_party/libosmium/.github/actions/install-ubuntu/action.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: Install apt packages on Ubuntu/Debian
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -yq \
|
||||
doxygen \
|
||||
libboost-dev \
|
||||
libgdal-dev \
|
||||
libgeos++-dev \
|
||||
liblz4-dev \
|
||||
libproj-dev \
|
||||
libsparsehash-dev \
|
||||
ruby-json \
|
||||
spatialite-bin
|
||||
test "$CC" = clang-6.0 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-6.0
|
||||
test "$CC" = clang-8 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-8
|
||||
test "$CC" = clang-13 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-13
|
||||
shell: bash
|
||||
|
17
third_party/libosmium/.github/actions/install-windows/action.yml
vendored
Normal file
17
third_party/libosmium/.github/actions/install-windows/action.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
name: Install vcpkg packages on Windows
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: |
|
||||
vcpkg install \
|
||||
boost-crc:x64-windows \
|
||||
boost-variant:x64-windows \
|
||||
bzip2:x64-windows \
|
||||
expat:x64-windows \
|
||||
lz4:x64-windows \
|
||||
sparsehash:x64-windows \
|
||||
zlib:x64-windows
|
||||
shell: bash
|
||||
|
316
third_party/libosmium/.github/workflows/ci.yml
vendored
Normal file
316
third_party/libosmium/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,316 @@
|
||||
name: CI
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
name: [Ubuntu-18, Ubuntu-20, Ubuntu-21, Debian-9, Debian-10, Debian-11, Debian-Testing, Debian-Experimental, Fedora-34]
|
||||
build_type: [Dev]
|
||||
cpp_compiler: [g++]
|
||||
cpp_version: [c++11]
|
||||
include:
|
||||
- name: Ubuntu-18
|
||||
# Uses gcc 7.5.0, clang 6.0.0, cmake 3.10.2
|
||||
image: "ubuntu:18.04"
|
||||
ubuntu: 18
|
||||
installer: apt
|
||||
- name: Ubuntu-20
|
||||
# Uses gcc 9.3.0, clang 10.0.0, cmake 3.16.3
|
||||
image: "ubuntu:20.04"
|
||||
ubuntu: 20
|
||||
installer: apt
|
||||
- name: Ubuntu-21
|
||||
# Uses gcc 10.3.0, clang, 12.0.0, cmake 3.18.4
|
||||
image: "ubuntu:21.04"
|
||||
ubuntu: 21
|
||||
installer: apt
|
||||
- name: Debian-9
|
||||
# Uses gcc 6.3.0, clang 3.8.1, cmake 3.7.2
|
||||
image: "debian:stretch"
|
||||
installer: apt
|
||||
- name: Debian-10
|
||||
# Uses gcc 8.3.0, clang 7.0.1, cmake 3.13.4
|
||||
image: "debian:buster"
|
||||
installer: apt
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
cpp_version: c++17
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
cpp_version: c++20
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
cpp_version: c++17
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
cpp_version: c++20
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
build_type: RelWithDebInfo
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
- name: Debian-11
|
||||
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
|
||||
image: "debian:bullseye"
|
||||
installer: apt
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
CXXFLAGS: -fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer
|
||||
LDFLAGS: -fsanitize=address,undefined,integer
|
||||
- name: Debian-Testing
|
||||
# Uses gcc 10.3.0, clang 11.1.0, cmake 3.21.3
|
||||
image: "debian:testing"
|
||||
installer: apt
|
||||
CXXFLAGS: -Wno-stringop-overread
|
||||
- name: Debian-Testing
|
||||
# Uses gcc 10.3.0, clang 11.1.0, cmake 3.21.3
|
||||
image: "debian:testing"
|
||||
installer: apt
|
||||
c_compiler: clang
|
||||
cpp_compiler: clang++
|
||||
- name: Debian-Experimental
|
||||
# Uses gcc 11, clang 14, cmake 3.21.3
|
||||
image: "debian:experimental"
|
||||
installer: apt
|
||||
CXXFLAGS: -Wno-stringop-overread
|
||||
- name: Debian-Experimental
|
||||
# Uses gcc 11, clang 14, cmake 3.21.3
|
||||
image: "debian:experimental"
|
||||
installer: apt
|
||||
c_compiler: clang-14
|
||||
cpp_compiler: clang++-14
|
||||
- name: Fedora-34
|
||||
# Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5
|
||||
image: "fedora:34"
|
||||
installer: dnf
|
||||
CXXFLAGS: -Wno-stringop-overread
|
||||
- name: Fedora-35
|
||||
# Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5
|
||||
image: "fedora:35"
|
||||
installer: dnf
|
||||
CXXFLAGS: -Wno-stringop-overread
|
||||
container:
|
||||
image: ${{ matrix.image }}
|
||||
env:
|
||||
LANG: en_US.UTF-8
|
||||
BUILD_TYPE: ${{ matrix.build_type }}
|
||||
CXXFLAGS: ${{ matrix.CXXFLAGS }}
|
||||
LDFLAGS: ${{ matrix.LDFLAGS }}
|
||||
CC: ${{ matrix.c_compiler }}
|
||||
CXX: ${{ matrix.cpp_compiler }}
|
||||
CPP_VERSION: ${{ matrix.cpp_version }}
|
||||
WITH_PROJ: ON
|
||||
steps:
|
||||
- name: Prepare container (apt)
|
||||
run: |
|
||||
export APT_LISTCHANGES_FRONTEND=none
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get install -y \
|
||||
clang \
|
||||
cmake \
|
||||
doxygen \
|
||||
g++ \
|
||||
git \
|
||||
graphviz \
|
||||
libboost-dev \
|
||||
libbz2-dev \
|
||||
libexpat1-dev \
|
||||
libgdal-dev \
|
||||
libgeos++-dev \
|
||||
liblz4-dev \
|
||||
libproj-dev \
|
||||
libsparsehash-dev \
|
||||
make \
|
||||
ruby \
|
||||
ruby-json \
|
||||
spatialite-bin \
|
||||
zlib1g-dev
|
||||
shell: bash
|
||||
if: matrix.installer == 'apt'
|
||||
- name: Install compiler
|
||||
shell: bash
|
||||
run: |
|
||||
export APT_LISTCHANGES_FRONTEND=none
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get install -y clang-14
|
||||
if: matrix.cpp_compiler == 'clang++-14'
|
||||
- name: Prepare container (dnf)
|
||||
run: |
|
||||
dnf install --quiet --assumeyes \
|
||||
boost-devel \
|
||||
bzip2-devel \
|
||||
cmake \
|
||||
doxygen \
|
||||
expat-devel \
|
||||
gcc-c++ \
|
||||
gdal-devel \
|
||||
gdalcpp-static \
|
||||
geos-devel \
|
||||
git \
|
||||
graphviz \
|
||||
lz4-devel \
|
||||
make \
|
||||
proj-devel \
|
||||
ruby \
|
||||
rubygem-json \
|
||||
sparsehash-devel \
|
||||
spatialite-tools \
|
||||
zlib-devel
|
||||
shell: bash
|
||||
if: matrix.installer == 'dnf'
|
||||
# Use v1 of checkout because v2 doesn't work with submodules
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake
|
||||
- uses: ./.github/actions/build
|
||||
- uses: ./.github/actions/ctest
|
||||
|
||||
ubuntu-latest:
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes: 40
|
||||
env:
|
||||
CC: clang-13
|
||||
CXX: clang++-13
|
||||
BUILD_TYPE: Dev
|
||||
WITH_PROJ: ON
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install new clang
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
|
||||
shell: bash
|
||||
- uses: ./.github/actions/install-ubuntu
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake
|
||||
- uses: ./.github/actions/build
|
||||
- uses: ./.github/actions/ctest
|
||||
|
||||
macos10-dev:
|
||||
runs-on: macos-10.15
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
BUILD_TYPE: Dev
|
||||
WITH_PROJ: OFF
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-macos
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake
|
||||
- uses: ./.github/actions/build
|
||||
- uses: ./.github/actions/ctest
|
||||
|
||||
macos11-dev:
|
||||
runs-on: macos-11
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
BUILD_TYPE: Dev
|
||||
WITH_PROJ: OFF
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-macos
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake
|
||||
- uses: ./.github/actions/build
|
||||
- uses: ./.github/actions/ctest
|
||||
|
||||
macos11-release:
|
||||
runs-on: macos-11
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
BUILD_TYPE: Release
|
||||
WITH_PROJ: OFF
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-macos
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake
|
||||
- uses: ./.github/actions/build
|
||||
- uses: ./.github/actions/ctest
|
||||
|
||||
windows-2019-minimal:
|
||||
runs-on: windows-2019
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-windows
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake-windows
|
||||
- uses: ./.github/actions/build-windows
|
||||
- uses: ./.github/actions/ctest-windows
|
||||
|
||||
windows-2019-full:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-windows
|
||||
- name: Install extra packages
|
||||
run: vcpkg install geos:x64-windows gdal:x64-windows proj4:x64-windows
|
||||
shell: bash
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake-windows
|
||||
- uses: ./.github/actions/build-windows
|
||||
- uses: ./.github/actions/ctest-windows
|
||||
|
||||
windows-2022-minimal:
|
||||
runs-on: windows-2022
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-windows
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake-windows
|
||||
- uses: ./.github/actions/build-windows
|
||||
- uses: ./.github/actions/ctest-windows
|
||||
|
66
third_party/libosmium/.github/workflows/clang-tidy.yml
vendored
Normal file
66
third_party/libosmium/.github/workflows/clang-tidy.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
name: clang-tidy
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
|
||||
clang-tidy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: ["debian:bullseye", "debian:testing", "debian:experimental"]
|
||||
include:
|
||||
- image: "debian:bullseye"
|
||||
clang: 11
|
||||
- image: "debian:testing"
|
||||
clang: 12
|
||||
- image: "debian:experimental"
|
||||
clang: 14
|
||||
container:
|
||||
image: ${{ matrix.image }}
|
||||
env:
|
||||
BUILD_TYPE: Dev
|
||||
CC: clang-${{ matrix.clang }}
|
||||
CXX: clang++-${{ matrix.clang }}
|
||||
CPP_VERSION: c++11
|
||||
WITH_PROJ: ON
|
||||
steps:
|
||||
- name: Prepare container (apt)
|
||||
run: |
|
||||
export APT_LISTCHANGES_FRONTEND=none
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get install -y \
|
||||
clang-${{ matrix.clang }} \
|
||||
clang-tidy-${{ matrix.clang }} \
|
||||
cmake \
|
||||
git \
|
||||
libboost-dev \
|
||||
libbz2-dev \
|
||||
libexpat1-dev \
|
||||
libgdal-dev \
|
||||
libgeos++-dev \
|
||||
liblz4-dev \
|
||||
libproj-dev \
|
||||
libsparsehash-dev \
|
||||
make \
|
||||
zlib1g-dev
|
||||
shell: bash
|
||||
# Use v1 of checkout because v2 doesn't work with submodules
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-protozero
|
||||
- uses: ./.github/actions/cmake
|
||||
- name: clang-tidy
|
||||
run: make clang-tidy | tee clang-tidy-${{ matrix.clang }}.log
|
||||
shell: bash
|
||||
working-directory: build
|
||||
- name: Upload Log
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: clang-tidy-${{ matrix.clang }}-log
|
||||
path: build/clang-tidy-${{ matrix.clang }}.log
|
||||
|
224
third_party/libosmium/.travis.yml
vendored
224
third_party/libosmium/.travis.yml
vendored
@ -1,224 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Configuration for continuous integration service at travis-ci.org
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
os: linux
|
||||
|
||||
dist: xenial
|
||||
|
||||
language: generic
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ccache
|
||||
|
||||
env:
|
||||
global:
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- CCACHE_COMPRESS=1
|
||||
- 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:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.8']
|
||||
addons_clang39: &clang39
|
||||
apt:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.9']
|
||||
addons_clang50: &clang50
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-5.0', 'g++-6', 'gcc-6']
|
||||
addons_clang60: &clang60
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-6.0', 'g++-6', 'gcc-6']
|
||||
addons_clang7: &clang7
|
||||
apt:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-7' ]
|
||||
addons_gcc48: &gcc48
|
||||
apt:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.8', 'gcc-4.8' ]
|
||||
addons_gcc49: &gcc49
|
||||
apt:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.9', 'gcc-4.9' ]
|
||||
addons_gcc5: &gcc5
|
||||
apt:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-5', 'gcc-5' ]
|
||||
addons_gcc6: &gcc6
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-6', 'gcc-6' ]
|
||||
addons_gcc7: &gcc7
|
||||
apt:
|
||||
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin' ]
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
addons:
|
||||
homebrew:
|
||||
packages:
|
||||
- cmake
|
||||
- boost
|
||||
- google-sparsehash
|
||||
- gdal
|
||||
update: true
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
# Linux Clang Builds
|
||||
- os: linux
|
||||
compiler: linux-clang35-dev
|
||||
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Dev'
|
||||
addons: *clang35
|
||||
dist: trusty
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang38-dev
|
||||
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Dev'
|
||||
addons: *clang38
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang39-dev
|
||||
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Dev'
|
||||
addons: *clang39
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang50-dev
|
||||
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Dev'
|
||||
addons: *clang50
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang60-dev
|
||||
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Dev'
|
||||
addons: *clang60
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang60-debug
|
||||
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Debug'
|
||||
CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
|
||||
LDFLAGS="-fsanitize=address,undefined,integer"
|
||||
addons: *clang60
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang60-release
|
||||
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Release'
|
||||
addons: *clang60
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang7-debug
|
||||
env: CC='clang-7' CXX='clang++-7' BUILD_TYPE='Debug'
|
||||
CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
|
||||
LDFLAGS="-fsanitize=address,undefined,integer"
|
||||
addons: *clang7
|
||||
dist: bionic
|
||||
|
||||
- os: linux
|
||||
compiler: linux-clang7-release
|
||||
env: CC='clang-7' CXX='clang++-7' BUILD_TYPE='Release'
|
||||
addons: *clang7
|
||||
dist: bionic
|
||||
|
||||
# Linux GCC Builds
|
||||
- os: linux
|
||||
compiler: linux-gcc48-dev
|
||||
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Dev'
|
||||
CXXFLAGS='-Wno-return-type'
|
||||
addons: *gcc48
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc49-dev
|
||||
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Dev'
|
||||
addons: *gcc49
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc5-dev
|
||||
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Dev'
|
||||
addons: *gcc5
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc6-dev
|
||||
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Dev'
|
||||
addons: *gcc6
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc7-dev
|
||||
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Dev'
|
||||
addons: *gcc7
|
||||
dist: bionic
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc7-coverage
|
||||
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Coverage'
|
||||
addons: *gcc7
|
||||
dist: bionic
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc7-release
|
||||
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Release'
|
||||
addons: *gcc7
|
||||
dist: bionic
|
||||
|
||||
# OSX Clang Builds
|
||||
- os: osx
|
||||
osx_image: xcode9.4
|
||||
compiler: xcode94-clang-dev
|
||||
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode10.2
|
||||
compiler: xcode10-clang-dev
|
||||
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
compiler: xcode11-clang-dev
|
||||
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
compiler: xcode11-clang-release
|
||||
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
|
||||
|
||||
|
||||
install:
|
||||
- git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero
|
||||
- cmake --version
|
||||
|
||||
before_script:
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
- git submodule update --init
|
||||
- mkdir build && cd build
|
||||
- cmake -LA .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_DATA_TESTS=ON -DBUILD_WITH_CCACHE=1
|
||||
|
||||
script:
|
||||
- make VERBOSE=1 && ctest --output-on-failure
|
||||
|
||||
after_success:
|
||||
- |
|
||||
if [ "${BUILD_TYPE}" = "Coverage" ]; then
|
||||
curl -S -f https://codecov.io/bash -o codecov
|
||||
chmod +x codecov
|
||||
gcov-${CXX#g++-} -p $(find test/CMakeFiles -name '*.o')
|
||||
./codecov -Z -c -X gcov -F unit_tests
|
||||
gcov-${CXX#g++-} -p $(find test/data-tests -name '*.o')
|
||||
./codecov -Z -c -X gcov -F data_tests
|
||||
gcov-${CXX#g++-} -p $(find examples -name '*.o')
|
||||
./codecov -Z -c -X gcov -F examples
|
||||
fi
|
||||
|
||||
#-----------------------------------------------------------------------------
|
229
third_party/libosmium/CHANGELOG.md
vendored
229
third_party/libosmium/CHANGELOG.md
vendored
@ -13,6 +13,227 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
### Fixed
|
||||
|
||||
|
||||
## [2.18.0] - 2022-02-07
|
||||
|
||||
### Changed
|
||||
|
||||
* Use `system_error` instead of `runtime_error` where it fits better.
|
||||
* Remove `OSMIUM_NORETURN` macro. This hasn't been used in a while.
|
||||
|
||||
### Removed deprecated parts of the code
|
||||
|
||||
Several parts of libosmium have been marked deprecated, many of them for a very
|
||||
long time. These are now removed:
|
||||
|
||||
* Sparsehash index class `osmium::index::map::SparseMemTable` as well as the
|
||||
complete file `osmium/index/map/sparse_mem_table.hpp`.
|
||||
* Callback functionality of the `osmium::memory::Buffer` class. The
|
||||
`set_full_callback()` will not be available any more. See the source
|
||||
for replacement options.
|
||||
* Various `osmium::builder::build_*` functions in
|
||||
`osmium/builder/builder_helper.hpp`. Use `osmium::builder::add_*`
|
||||
functions instead. Removes `builder_helper.hpp`.
|
||||
* `osmium::builder::Builder::add_item(const osmium::memory::Item* item)`.
|
||||
Use the function of the same name taking a reference instead.
|
||||
* `osmium::builder::OSMObject/ChangesetBuilder::add_user()`. Use
|
||||
`set_user()` instead.
|
||||
* `osmium::builder::ChangesetBuilder::bounds()` returning a modifiable
|
||||
reference. Use `set_bounds()` instead.
|
||||
* Several functions around `osmium::io::OutputIterator`.
|
||||
* `osmium::Area::inner_ring_cbegin/cend()`, use `inner_rings()` instead.
|
||||
* `osmium::RelationMember::ref()`, use `set_ref()` instead.
|
||||
* Implicit conversion from `osmium::Timestamp` to `std::time_t`. Use
|
||||
`seconds_since_epoch()` instead.
|
||||
* `osmium::string_to_user_id()`, use `string_to_uid` instead.
|
||||
* `osmium::static_cast_with_assert()` helper functions as well as the
|
||||
complete include file `osmium/util/cast.hpp`.
|
||||
* Some constructors of `osmium::util::MemoryMapping` and
|
||||
`osmium::util::TypedMemoryMapping`. Use other constructor instead.
|
||||
|
||||
|
||||
## [2.17.3] - 2022-01-19
|
||||
|
||||
### Fixed
|
||||
|
||||
* Removed possible deadlock when shutting down active Reader.
|
||||
|
||||
|
||||
## [2.17.2] - 2021-12-16
|
||||
|
||||
### Changed
|
||||
|
||||
* Libosmium now supports being compiled in C++17 and C++20 mode. The minimum
|
||||
version required is still C++11, but if you use libosmium in an C++17 or
|
||||
C++20 application this should work properly.
|
||||
* Switch from catch version 1 to catch2 as test framework.
|
||||
* When `std::variant` is available (C++17 and above), libosmium will use that
|
||||
instead of `boost::variant` reducing the dependencies a little bit.
|
||||
* Removed various workaround that were needed for older MSVC compilers.
|
||||
* Remove use of `boost::filter_iterator` and `boost::indirect_iterator`. The
|
||||
removes the dependency on Boost Iterator.
|
||||
* Examples now mostly use the somewhat cleaner `return` instead of
|
||||
`std::exit()` to return an exit code from `main`.
|
||||
* As always: Various small code cleanups.
|
||||
|
||||
### Fixed
|
||||
|
||||
* When ordering OSM objects (mostly use in the `CheckOrder` handler), the
|
||||
smallest id possible (`INTMIN`) wasn't sorted correctly.
|
||||
* Threading problem when reading files.
|
||||
* Possible dereference of invalid iterator in legacy area assembler. This
|
||||
only affects the legacy area assembler that takes old-style multipolygons
|
||||
into account, so modern code that is not working with history data is not
|
||||
affected.
|
||||
* Fixed read from an empty queue when reading a file which could block
|
||||
libosmium forever when an error was encountered while reading a file.
|
||||
|
||||
### Deprecated
|
||||
|
||||
Several parts of libosmium have been marked deprecated, many of them for a very
|
||||
long time. These will not be part of the next version of libosmium:
|
||||
|
||||
* Sparsehash index class `osmium::index::map::SparseMemTable` as well as the
|
||||
complete file `osmium/index/map/sparse_mem_table.hpp`.
|
||||
* Callback functionality of the `osmium::memory::Buffer` class. The
|
||||
`set_full_callback()` will not be available any more. See the source
|
||||
for replacement options.
|
||||
* Various `osmium::builder::build_*` functions in
|
||||
`osmium/builder/builder_helper.hpp`. Use `osmium::builder::add_*`
|
||||
functions instead. Removes `builder_helper.hpp`.
|
||||
* `osmium::builder::Builder::add_item(const osmium::memory::Item* item)`.
|
||||
Use the function of the same name taking a reference instead.
|
||||
* `osmium::builder::OSMObject/ChangesetBuilder::add_user()`. Use
|
||||
`set_user()` instead.
|
||||
* `osmium::builder::ChangesetBuilder::bounds()` returning a modifiable
|
||||
reference. Use `set_bounds()` instead.
|
||||
* Several functions around `osmium::io::OutputIterator`.
|
||||
* `osmium::Area::inner_ring_cbegin/cend()`, use `inner_rings()` instead.
|
||||
* `osmium::RelationMember::ref()`, use `set_ref()` instead.
|
||||
* Implicit conversion from `osmium::Timestamp` to `std::time_t`. Use
|
||||
`seconds_since_epoch()` instead.
|
||||
* `osmium::string_to_user_id()`, use `string_to_uid` instead.
|
||||
* `osmium::static_cast_with_assert()` helper functions as well as the
|
||||
complete include file `osmium/util/cast.hpp`.
|
||||
* Some constructors of `osmium::util::MemoryMapping` and
|
||||
`osmium::util::TypedMemoryMapping`. Use other constructor instead.
|
||||
|
||||
|
||||
## [2.17.1] - 2021-10-05
|
||||
|
||||
### Added
|
||||
|
||||
* Add `osmium_tags_filter` example showing use of tags filter.
|
||||
* Add `Writer::set_header()` function to set header after constructing.
|
||||
|
||||
### Changed
|
||||
|
||||
* Various improvements in PBF file reading make it slightly faster and less
|
||||
CPU intensive.
|
||||
* Since 2.17.0 Osmium will, when reading files, tell the kernel using
|
||||
`fadvise` that it can remove pages from the buffer cache that are not
|
||||
needed any more. This is usually beneficial, because the memory can be used
|
||||
for something else. But if you are reading the same OSM file multiple times
|
||||
at the same time or in short succession, it might be better to keep those
|
||||
buffer pages. In that case you can set the environment variable
|
||||
`OSMIUM_CLEAN_PAGE_CACHE_AFTER_READ` to `no` and Osmium will not call
|
||||
`fadvise`. Set it to `yes` or anything else (or not set it at all) to get
|
||||
the default behaviour.
|
||||
* If the macro `OSMIUM_DEFINE_EXPORT` is defined, all exception classes used
|
||||
by Osmium will get "tagged as exported" using `__declspec(dllexport)` when
|
||||
using MSVC or `__attribute__ ((visibility("default")))` on other compilers.
|
||||
This is needed in PyOsmium.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fix integer parser. IDs in OPL files can now be anything between -2^63 and
|
||||
2^63-1.
|
||||
|
||||
|
||||
## [2.17.0] - 2021-04-26
|
||||
|
||||
### Added
|
||||
|
||||
* Add "ids" output format. New IDS output format that is similar to
|
||||
the OPL format, but only the entity type and id is written out.
|
||||
* Add convenience functions `left()`, `right()`, `top()`, `bottom()` to
|
||||
access `osmium::Box` boundaries.
|
||||
* Add polygon output to WKB factory.
|
||||
* Add functions to access storage from `node_locations_for_ways`
|
||||
handler.
|
||||
* Add flag `osmium::io::buffers_type` for telling the `Reader` class whether
|
||||
you want buffers read to only contain a single type of OSM entity.
|
||||
* Add convenient named `nodes()`, `ways()`, and `relations()` accessor
|
||||
functions to `nwr_array` class.
|
||||
* Add `DeltaDecode::value()` accessor function.
|
||||
* Add variant of the `Buffer::purge_removed()` function which doesn't take
|
||||
a callback parameter.
|
||||
|
||||
### Changed
|
||||
|
||||
* Different varint decoding for faster PBF decoding. This makes PBF
|
||||
decoding about 15% faster.
|
||||
* Several code optimmizations in (PBF) writer code that speed up
|
||||
writing of OSM files considerably while using less CPU and spreading
|
||||
the load on multiple CPUs.
|
||||
* Use memset/memcpy instead of `std::fill_n` and `std::copy` in object
|
||||
builder for some slight speedups.
|
||||
* Ignore metadata setting on reader for history/change files. History
|
||||
and change files must be read with metadata, because otherwise the
|
||||
information is lost whether an object is visible or deleted. So
|
||||
ignore this setting in that case.
|
||||
* On Linux: Use fadvise() to tell kernel about our reading patterns:
|
||||
1. Tell kernel that we are reading OSM files sequentially. This
|
||||
should improve pre-fetching of data blocks.
|
||||
2. Tell kernel that we are done with block so they can be released.
|
||||
This means we don't hog the buffer cache for something that
|
||||
will, in all likelyhood, not be needed any more.
|
||||
* Use assert() instead of exception in "can not happen" situation in
|
||||
the relations manager code.
|
||||
* Various code cleanups.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Test failure with `add_tag_list` on some systems.
|
||||
* Test framework fix for aarch64 architecture.
|
||||
* Remove undefined behaviour in bzip2 compression code.
|
||||
* Rename some local variables to not shadow member functions.
|
||||
* Wrap `osmium::util::MemoryMapping::unmap()` in try/catch on Windows
|
||||
also because we call this from a noexcept function.
|
||||
* Removed superfluous `std::forward`s and fixed code that called
|
||||
`std::forward` multiple times on the same object.
|
||||
* Fix in OPL parser which could lead to invalid data being generated.
|
||||
* Fixed three bugs in O5M parser which could lead to an infinit loop
|
||||
or segmentation faults.
|
||||
|
||||
## [2.16.0] - 2021-01-08
|
||||
|
||||
### Added
|
||||
|
||||
* The PBF reader and writer now understand PBF blobs compressed with the LZ4
|
||||
compression algorithm in addition to the usual ZLIB compression (or no
|
||||
compression at all). LZ4 is much faster to compress and uncompress. Use
|
||||
by setting the `pbf_compression` output file format option to `lz4`. You
|
||||
have to define `OSMIUM_WITH_LZ4` to enable this before including any
|
||||
libosmium includes.
|
||||
* The function `osmium::io::supported_pbf_compression_types` can now be used
|
||||
to get a list of all PBF compression types supported.
|
||||
* The output file option `pbf_compression_level` can now be set to an integer.
|
||||
The range depends on the compression type used, 0-9 for zlib compression
|
||||
and 1-65537 for lz4 compression.
|
||||
* Adds `ptr_begin()`/`ptr_end()` functions to `ObjectPointerCollection` for
|
||||
accessing the pointers instead of the underlying objects.
|
||||
|
||||
### Changed
|
||||
|
||||
* The `osmium::io::Writer::close()` function now returns the number of bytes
|
||||
written to an OSM file if it is available (and 0 otherwise).
|
||||
* Use stable sort when sorting `ObjectPointerCollection`.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Various small fixes and cleanups.
|
||||
|
||||
|
||||
## [2.15.6] - 2020-06-27
|
||||
|
||||
### Added
|
||||
@ -1032,7 +1253,13 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
Doxygen (up to version 1.8.8). This version contains a workaround to fix
|
||||
this.
|
||||
|
||||
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.15.6...HEAD
|
||||
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.18.0...HEAD
|
||||
[2.18.0]: https://github.com/osmcode/libosmium/compare/v2.17.3...v2.18.0
|
||||
[2.17.3]: https://github.com/osmcode/libosmium/compare/v2.17.2...v2.17.3
|
||||
[2.17.2]: https://github.com/osmcode/libosmium/compare/v2.17.1...v2.17.2
|
||||
[2.17.1]: https://github.com/osmcode/libosmium/compare/v2.17.0...v2.17.1
|
||||
[2.17.0]: https://github.com/osmcode/libosmium/compare/v2.16.0...v2.17.0
|
||||
[2.16.0]: https://github.com/osmcode/libosmium/compare/v2.15.6...v2.16.0
|
||||
[2.15.6]: https://github.com/osmcode/libosmium/compare/v2.15.5...v2.15.6
|
||||
[2.15.5]: https://github.com/osmcode/libosmium/compare/v2.15.4...v2.15.5
|
||||
[2.15.4]: https://github.com/osmcode/libosmium/compare/v2.15.3...v2.15.4
|
||||
|
23
third_party/libosmium/CMakeLists.txt
vendored
23
third_party/libosmium/CMakeLists.txt
vendored
@ -6,7 +6,7 @@
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
|
||||
@ -39,8 +39,8 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Cover
|
||||
project(libosmium)
|
||||
|
||||
set(LIBOSMIUM_VERSION_MAJOR 2)
|
||||
set(LIBOSMIUM_VERSION_MINOR 15)
|
||||
set(LIBOSMIUM_VERSION_PATCH 6)
|
||||
set(LIBOSMIUM_VERSION_MINOR 18)
|
||||
set(LIBOSMIUM_VERSION_PATCH 0)
|
||||
|
||||
set(LIBOSMIUM_VERSION
|
||||
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
|
||||
@ -80,6 +80,8 @@ option(INSTALL_GDALCPP "also install gdalcpp headers" OFF)
|
||||
|
||||
option(WITH_PROFILING "add flags needed for profiling" OFF)
|
||||
|
||||
option(WITH_PROJ "build/test with proj" ON)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
@ -167,7 +169,11 @@ set(OSMIUM_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
include_directories(${OSMIUM_INCLUDE_DIR})
|
||||
|
||||
find_package(Osmium COMPONENTS io gdal geos proj sparsehash)
|
||||
if(WITH_PROJ)
|
||||
find_package(Osmium COMPONENTS lz4 io gdal geos proj)
|
||||
else()
|
||||
find_package(Osmium COMPONENTS lz4 io gdal geos)
|
||||
endif()
|
||||
|
||||
# The find_package put the directory where it found the libosmium includes
|
||||
# into OSMIUM_INCLUDE_DIRS. We remove it again, because we want to make
|
||||
@ -326,9 +332,6 @@ if(CPPCHECK)
|
||||
--force
|
||||
-Uassert -DPROTOZERO_STRICT_API -DPROTOZERO_USE_BUILTIN_BSWAP -UPROTOZERO_USE_VIEW)
|
||||
|
||||
# cpp doesn't find system includes for some reason, suppress that report
|
||||
set(CPPCHECK_OPTIONS ${CPPCHECK_OPTIONS} --suppress=missingIncludeSystem)
|
||||
|
||||
file(GLOB_RECURSE ALL_INCLUDES include/osmium/*.hpp)
|
||||
file(GLOB ALL_EXAMPLES examples/*.cpp)
|
||||
file(GLOB ALL_BENCHMARKS benchmarks/*.cpp)
|
||||
@ -398,14 +401,14 @@ if(BUILD_HEADERS)
|
||||
file(MAKE_DIRECTORY header_check)
|
||||
|
||||
foreach(hpp ${ALL_HPPS})
|
||||
if(GDAL_FOUND OR NOT ((hpp STREQUAL "osmium/area/problem_reporter_ogr.hpp") OR (hpp STREQUAL "osmium/geom/ogr.hpp")))
|
||||
if((GDAL_FOUND AND PROJ_FOUND) OR NOT ((hpp STREQUAL "osmium/area/problem_reporter_ogr.hpp") OR (hpp STREQUAL "osmium/geom/ogr.hpp") OR (hpp STREQUAL "osmium/geom/projection.hpp")))
|
||||
string(REPLACE ".hpp" "" tmp ${hpp})
|
||||
string(REPLACE "/" "__" libname ${tmp})
|
||||
|
||||
# Create a dummy .cpp file that includes the header file we want to
|
||||
# check.
|
||||
set(DUMMYCPP ${CMAKE_BINARY_DIR}/header_check/${libname}.cpp)
|
||||
file(WRITE ${DUMMYCPP} "#define OSMIUM_UTIL_COMPATIBILITY_HPP\n#define OSMIUM_DEPRECATED\n#include <${hpp}> // IWYU pragma: keep\n")
|
||||
file(WRITE ${DUMMYCPP} "#define OSMIUM_UTIL_COMPATIBILITY_HPP\n#define OSMIUM_DEPRECATED\n#define OSMIUM_EXPORT\n#include <${hpp}> // IWYU pragma: keep\n")
|
||||
|
||||
# There is no way in CMake to just compile but not link a C++ file,
|
||||
# so we pretend to build a library here.
|
||||
@ -424,7 +427,7 @@ endif()
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
message(STATUS "Looking for clang-tidy")
|
||||
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7 clang-tidy-7.0 clang-tidy-6.0 clang-tidy-5.0)
|
||||
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11)
|
||||
|
||||
if(CLANG_TIDY)
|
||||
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
|
||||
|
15
third_party/libosmium/NOTES_FOR_DEVELOPERS.md
vendored
15
third_party/libosmium/NOTES_FOR_DEVELOPERS.md
vendored
@ -89,11 +89,11 @@ between compilers due to different C++11 support.
|
||||
|
||||
## Operating systems
|
||||
|
||||
Usually all code must work on Linux, OSX, and Windows. Execptions are allowed
|
||||
Usually all code must work on Linux, macOS, and Windows. Execptions are allowed
|
||||
for some minor functionality, but please discuss this first.
|
||||
|
||||
When writing code and tests, care must be taken that everything works with the
|
||||
CR line ending convention used on Linux and OSX and the CRLF line ending used
|
||||
CR line ending convention used on Linux and macOS and the CRLF line ending used
|
||||
on Windows. Note that `git` can be run with different settings regarding line
|
||||
ending rewritings on different machines making things more difficult. Some
|
||||
files have been "forced" to LF line endings using `.gitattributes` files.
|
||||
@ -136,15 +136,8 @@ directory, some data tests in `test/osm-testdata` and tests of the examples in
|
||||
`test/examples`. They are built by the default cmake config. Run `ctest` to
|
||||
run them. We can always use more tests.
|
||||
|
||||
Tests are run automatically using the Travis (Linux/Mac) and Appveyor (Windows)
|
||||
services. We automatically create coverage reports on Codevoc.io. Note that
|
||||
the coverage percentages reported are not always accurate, because code that
|
||||
is not used in tests at all will not necessarily end up in the binary and
|
||||
the code coverage tool will not know it is there.
|
||||
|
||||
[](https://travis-ci.org/osmcode/libosmium)
|
||||
[](https://ci.appveyor.com/project/Mapbox/libosmium)
|
||||
[](https://codecov.io/gh/osmcode/libosmium)
|
||||
Tests are run automatically using Github Actions (Linux/macOS) and Appveyor
|
||||
(Windows) services.
|
||||
|
||||
|
||||
## Documenting the code
|
||||
|
6
third_party/libosmium/README.md
vendored
6
third_party/libosmium/README.md
vendored
@ -4,9 +4,9 @@ https://osmcode.org/libosmium
|
||||
|
||||
A fast and flexible C++ library for working with OpenStreetMap data.
|
||||
|
||||
Libosmium works on Linux, Mac OSX and Windows.
|
||||
Libosmium works on Linux, macOS and Windows.
|
||||
|
||||
[](https://travis-ci.org/osmcode/libosmium)
|
||||
[](https://github.com/osmcode/libosmium/actions)
|
||||
[](https://ci.appveyor.com/project/lonvia/libosmium-eq41p/branch/master)
|
||||
[](https://codecov.io/gh/osmcode/libosmium)
|
||||
[](https://repology.org/metapackage/libosmium)
|
||||
@ -97,7 +97,7 @@ needed](https://osmcode.org/libosmium/manual.html#changes-from-old-versions-of-o
|
||||
|
||||
## License
|
||||
|
||||
Libosmium is available under the Boost Software License. See LICENSE.txt.
|
||||
Libosmium is available under the Boost Software License. See LICENSE.
|
||||
|
||||
|
||||
## Authors
|
||||
|
7
third_party/libosmium/appveyor.yml
vendored
7
third_party/libosmium/appveyor.yml
vendored
@ -4,7 +4,7 @@
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
os: Visual Studio 2017
|
||||
image: Visual Studio 2017
|
||||
|
||||
platform: x64
|
||||
|
||||
@ -24,6 +24,7 @@ environment:
|
||||
autocrlf: false
|
||||
- config: MSYS2
|
||||
autocrlf: true
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@ -57,6 +58,6 @@ build_script:
|
||||
|
||||
# remove garbage VS messages
|
||||
# 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:
|
||||
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
|
||||
#before_build:
|
||||
# - del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
|
||||
|
||||
|
@ -36,7 +36,7 @@ struct CountHandler : public osmium::handler::Handler {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -53,7 +53,9 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << "Relations: " << handler.relations << '\n';
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ struct CountHandler : public osmium::handler::Handler {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -54,7 +54,9 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << "r_all=" << handler.all << " r_counter=" << handler.counter << '\n';
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ using location_handler_type = osmium::handler::NodeLocationsForWays<index_type>;
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE FORMAT\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -39,7 +39,9 @@ int main(int argc, char* argv[]) {
|
||||
reader.close();
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ struct GeomHandler : public osmium::handler::Handler {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -41,7 +41,9 @@ int main(int argc, char* argv[]) {
|
||||
reader.close();
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ using dynamic_location_handler_type = osmium::handler::NodeLocationsForWays<dyna
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -51,7 +51,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
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() / (1024UL * 1024UL); // buffer size in MBytes
|
||||
const int runs = std::max(10, static_cast<int>(5000ULL / buffer_size));
|
||||
|
||||
std::cout << "input: filename=" << input_filename << " buffer_size=" << buffer_size << "MBytes\n";
|
||||
@ -143,7 +143,9 @@ int main(int argc, char* argv[]) {
|
||||
std::cout << " max=" << diff_max << "ms (" << percent_max << "%)\n";
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " INPUT-FILE OUTPUT-FILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -34,7 +34,9 @@ int main(int argc, char* argv[]) {
|
||||
reader.close();
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
6
third_party/libosmium/build-msys2.bat
vendored
6
third_party/libosmium/build-msys2.bat
vendored
@ -9,8 +9,8 @@ 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++"
|
||||
bash -lc "pacman -Sy --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-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 -Sy --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
|
||||
|
||||
REM Workaround for problem with spatialite (see https://github.com/osmcode/libosmium/issues/262)
|
||||
@ -19,6 +19,8 @@ copy /y C:\msys64\mingw64\bin\libreadline8.dll C:\msys64\mingw64\bin\libreadline
|
||||
echo "Setting PROJ_LIB variable for correct PROJ.4 working"
|
||||
set PROJ_LIB=c:\msys64\mingw64\share\proj
|
||||
|
||||
set CXXFLAGS=-Wno-stringop-overflow
|
||||
|
||||
echo "Generating makefiles"
|
||||
mkdir build
|
||||
cd build
|
||||
|
2
third_party/libosmium/cmake/FindGem.cmake
vendored
2
third_party/libosmium/cmake/FindGem.cmake
vendored
@ -149,7 +149,7 @@ if(DEFINED GEM_INCLUDE_DIRS)
|
||||
LIST(REMOVE_DUPLICATES GEM_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(GEM
|
||||
find_package_handle_standard_args(Gem
|
||||
REQUIRED_VARS ${components_found_vars}
|
||||
FAIL_MESSAGE "Could not find all required gems")
|
||||
|
||||
|
38
third_party/libosmium/cmake/FindLZ4.cmake
vendored
Normal file
38
third_party/libosmium/cmake/FindLZ4.cmake
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
find_path(LZ4_INCLUDE_DIR
|
||||
NAMES lz4.h
|
||||
DOC "lz4 include directory")
|
||||
mark_as_advanced(LZ4_INCLUDE_DIR)
|
||||
find_library(LZ4_LIBRARY
|
||||
NAMES lz4 liblz4
|
||||
DOC "lz4 library")
|
||||
mark_as_advanced(LZ4_LIBRARY)
|
||||
|
||||
if (LZ4_INCLUDE_DIR)
|
||||
file(STRINGS "${LZ4_INCLUDE_DIR}/lz4.h" _lz4_version_lines
|
||||
REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)")
|
||||
string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}")
|
||||
string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}")
|
||||
string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}")
|
||||
set(LZ4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}")
|
||||
unset(_lz4_version_major)
|
||||
unset(_lz4_version_minor)
|
||||
unset(_lz4_version_release)
|
||||
unset(_lz4_version_lines)
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LZ4
|
||||
REQUIRED_VARS LZ4_LIBRARY LZ4_INCLUDE_DIR
|
||||
VERSION_VAR LZ4_VERSION)
|
||||
|
||||
if (LZ4_FOUND)
|
||||
set(LZ4_INCLUDE_DIRS "${LZ4_INCLUDE_DIR}")
|
||||
set(LZ4_LIBRARIES "${LZ4_LIBRARY}")
|
||||
|
||||
if (NOT TARGET LZ4::LZ4)
|
||||
add_library(LZ4::LZ4 UNKNOWN IMPORTED)
|
||||
set_target_properties(LZ4::LZ4 PROPERTIES
|
||||
IMPORTED_LOCATION "${LZ4_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
|
||||
endif ()
|
||||
endif ()
|
11
third_party/libosmium/cmake/FindOsmium.cmake
vendored
11
third_party/libosmium/cmake/FindOsmium.cmake
vendored
@ -33,7 +33,8 @@
|
||||
# geos - include if you want to use any of the GEOS functions
|
||||
# gdal - include if you want to use any of the OGR functions
|
||||
# proj - include if you want to use any of the Proj.4 functions
|
||||
# sparsehash - include if you use the sparsehash index
|
||||
# sparsehash - include if you use the sparsehash index (deprecated!)
|
||||
# lz4 - include support for LZ4 compression of PBF files
|
||||
#
|
||||
# You can check for success with something like this:
|
||||
#
|
||||
@ -116,14 +117,21 @@ if(Osmium_USE_PBF)
|
||||
find_package(Threads)
|
||||
find_package(Protozero 1.6.3)
|
||||
|
||||
if(Osmium_USE_LZ4)
|
||||
find_package(LZ4 REQUIRED)
|
||||
add_definitions(-DOSMIUM_WITH_LZ4)
|
||||
endif()
|
||||
|
||||
list(APPEND OSMIUM_EXTRA_FIND_VARS ZLIB_FOUND Threads_FOUND PROTOZERO_INCLUDE_DIR)
|
||||
if(ZLIB_FOUND AND Threads_FOUND AND PROTOZERO_FOUND)
|
||||
list(APPEND OSMIUM_PBF_LIBRARIES
|
||||
${ZLIB_LIBRARIES}
|
||||
${LZ4_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
list(APPEND OSMIUM_INCLUDE_DIRS
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${LZ4_INCLUDE_DIRS}
|
||||
${PROTOZERO_INCLUDE_DIR}
|
||||
)
|
||||
else()
|
||||
@ -216,6 +224,7 @@ endif()
|
||||
#----------------------------------------------------------------------
|
||||
# Component 'sparsehash'
|
||||
if(Osmium_USE_SPARSEHASH)
|
||||
message(WARNING "Osmium: Use of Google SparseHash is deprecated. Please switch to a different index type.")
|
||||
find_path(SPARSEHASH_INCLUDE_DIR google/sparsetable)
|
||||
|
||||
list(APPEND OSMIUM_EXTRA_FIND_VARS SPARSEHASH_INCLUDE_DIR)
|
||||
|
15
third_party/libosmium/cmake/build.bat
vendored
15
third_party/libosmium/cmake/build.bat
vendored
@ -1,15 +0,0 @@
|
||||
call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
|
||||
set CMAKE_PREFIX_PATH=C:\PROJ
|
||||
set VERSION=Debug
|
||||
set TESTS=ON
|
||||
set ALLHPPS=ON
|
||||
set PREFIX=d:\libs18d
|
||||
set BOOST_ROOT=d:\boost
|
||||
|
||||
cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=%PREFIX% -DBOOST_ROOT=%BOOST_ROOT% -DBoost_USE_STATIC_LIBS=ON -DBUILD_TESTING=%TESTS% -DBUILD_TRY_HPPS=%ALLHPPS$ -T CTP_Nov2013
|
||||
msbuild /clp:Verbosity=minimal /nologo libosmium.sln /flp1:logfile=build_errors.txt;errorsonly /flp2:logfile=build_warnings.txt;warningsonly
|
||||
set PATH=%PATH%;%PREFIX%/bin
|
||||
|
||||
del test\osm-testdata\*.db
|
||||
del test\osm-testdata\*.json
|
||||
if "%TESTS%"=="ON" ctest -VV >build_tests.log
|
@ -25,6 +25,7 @@ set(EXAMPLES
|
||||
read
|
||||
read_with_progress
|
||||
road_length
|
||||
tags_filter
|
||||
tiles
|
||||
CACHE STRING "Example programs"
|
||||
)
|
||||
|
1
third_party/libosmium/examples/README.md
vendored
1
third_party/libosmium/examples/README.md
vendored
@ -29,6 +29,7 @@ them.
|
||||
|
||||
* `osmium_area_test`
|
||||
* `osmium_create_pois`
|
||||
* `osmium_tags_filter`
|
||||
|
||||
## Even more advanced examples
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <cstdio> // for std::printf
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cerr
|
||||
#include <string> // for std::string
|
||||
|
||||
@ -83,7 +82,9 @@ class AmenityHandler : public osmium::handler::Handler {
|
||||
|
||||
public:
|
||||
|
||||
void node(const osmium::Node& node) {
|
||||
// The callback functions can be either static or not depending on whether
|
||||
// you need to access any member variables of the handler.
|
||||
static void node(const osmium::Node& node) {
|
||||
// Getting a tag value can be expensive, because a list of tags has
|
||||
// to be gone through and each tag has to be checked. So we store the
|
||||
// result and reuse it.
|
||||
@ -93,7 +94,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void area(const osmium::Area& area) {
|
||||
// The callback functions can be either static or not depending on whether
|
||||
// you need to access any member variables of the handler.
|
||||
static void area(const osmium::Area& area) {
|
||||
const char* amenity = area.tags()["amenity"];
|
||||
if (amenity) {
|
||||
// Use the center of the first outer ring. Because we set
|
||||
@ -110,7 +113,7 @@ public:
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -171,7 +174,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for std::strcmp
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
|
||||
@ -93,18 +92,18 @@ void print_help() {
|
||||
|
||||
void print_usage(const char* prgname) {
|
||||
std::cerr << "Usage: " << prgname << " [OPTIONS] OSMFILE\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc > 1 && (!std::strcmp(argv[1], "-h") ||
|
||||
!std::strcmp(argv[1], "--help"))) {
|
||||
print_help();
|
||||
std::exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc != 3) {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -120,6 +119,7 @@ int main(int argc, char* argv[]) {
|
||||
handler.set<osmium::handler::Dump>(std::cout);
|
||||
} else {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
osmium::io::File input_file{argv[2]};
|
||||
@ -198,7 +198,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for std::strcmp
|
||||
#include <exception> // for std::exception
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
@ -150,7 +149,7 @@ public:
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " INFILE OUTFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get input and output file names from command line.
|
||||
@ -197,7 +196,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for std::strcmp
|
||||
#include <exception> // for std::exception
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
@ -53,18 +52,18 @@ void print_help() {
|
||||
|
||||
void print_usage(const char* prgname) {
|
||||
std::cerr << "Usage: " << prgname << " [OPTIONS] [INFILE [OUTFILE]]\n";
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc == 1) {
|
||||
print_usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 1 && (!std::strcmp(argv[1], "-h") ||
|
||||
!std::strcmp(argv[1], "--help"))) {
|
||||
print_help();
|
||||
std::exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Input and output format are empty by default. Later this will mean that
|
||||
@ -83,6 +82,7 @@ int main(int argc, char* argv[]) {
|
||||
input_format = argv[i];
|
||||
} else {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
} else if (!std::strncmp(argv[i], "--from-format=", 14)) {
|
||||
input_format = argv[i] + 14;
|
||||
@ -92,6 +92,7 @@ int main(int argc, char* argv[]) {
|
||||
output_format = argv[i];
|
||||
} else {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
} else if (!std::strncmp(argv[i], "--to-format=", 12)) {
|
||||
output_format = argv[i] + 12;
|
||||
@ -101,6 +102,7 @@ int main(int argc, char* argv[]) {
|
||||
output_file_name = argv[i];
|
||||
} else {
|
||||
print_usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +150,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <cstdint> // for std::uint64_t
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
|
||||
// Allow any format of input files (XML, PBF, ...)
|
||||
@ -63,7 +62,7 @@ struct CountHandler : public osmium::handler::Handler {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -88,14 +87,14 @@ int main(int argc, char* argv[]) {
|
||||
// Because of the huge amount of OSM data, some Osmium-based programs
|
||||
// (though not this one) can use huge amounts of data. So checking actual
|
||||
// memore usage is often useful and can be done easily with this class.
|
||||
// (Currently only works on Linux, not OSX and Windows.)
|
||||
// (Currently only works on Linux, not macOS and Windows.)
|
||||
osmium::MemoryUsage memory;
|
||||
|
||||
std::cout << "\nMemory used: " << memory.peak() << " MBytes\n";
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for std::strcmp
|
||||
#include <ctime> // for std::time
|
||||
#include <exception> // for std::exception
|
||||
@ -37,7 +36,7 @@
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OUTFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get output file name from command line.
|
||||
@ -94,7 +93,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
#include <string> // for std::string
|
||||
|
||||
@ -34,7 +33,7 @@ int main(int argc, char* argv[]) {
|
||||
if (argc < 2 || argc > 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE [TYPES]\n";
|
||||
std::cerr << "TYPES can be any combination of 'n', 'w', 'r', and 'c' to indicate what types of OSM entities you want (default: all).\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -84,7 +83,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
*/
|
||||
|
||||
#include <cerrno> // for errno
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for std::strerror
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
#include <string> // for std::string
|
||||
@ -73,8 +72,7 @@ public:
|
||||
explicit IndexFile(const std::string& filename) :
|
||||
m_fd(::open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666)) { // NOLINT(hicpp-signed-bitwise)
|
||||
if (m_fd < 0) {
|
||||
std::cerr << "Can't open index file '" << filename << "': " << std::strerror(errno) << "\n";
|
||||
std::exit(2);
|
||||
throw std::system_error{errno, std::system_category(), "Can't open index file '" + filename};
|
||||
}
|
||||
#ifdef _WIN32
|
||||
_setmode(m_fd, _O_BINARY);
|
||||
@ -102,7 +100,7 @@ public:
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE DIR\n";
|
||||
std::exit(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -117,7 +115,7 @@ int main(int argc, char* argv[]) {
|
||||
#endif
|
||||
if (result == -1 && errno != EEXIST) {
|
||||
std::cerr << "Problem creating directory '" << output_dir << "': " << std::strerror(errno) << "\n";
|
||||
std::exit(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Create the output file which will contain our serialized OSM data
|
||||
@ -125,7 +123,7 @@ int main(int argc, char* argv[]) {
|
||||
const int data_fd = ::open(data_file.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666); // NOLINT(hicpp-signed-bitwise)
|
||||
if (data_fd < 0) {
|
||||
std::cerr << "Can't open data file '" << data_file << "': " << std::strerror(errno) << "\n";
|
||||
std::exit(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -196,7 +194,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
#include <algorithm> // for std::copy_if
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
|
||||
// We want to read OSM files in XML format
|
||||
@ -43,7 +42,7 @@
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cout << "Usage: " << argv[0] << " INFILE OUTFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -92,7 +91,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
IndexAccess(IndexAccess&&) = delete;
|
||||
IndexAccess& operator=(IndexAccess&&) = delete;
|
||||
|
||||
virtual ~IndexAccess() = default;
|
||||
virtual ~IndexAccess() noexcept = default;
|
||||
|
||||
virtual void dump() const = 0;
|
||||
|
||||
@ -97,6 +97,14 @@ public:
|
||||
IndexAccess<TValue>(fd) {
|
||||
}
|
||||
|
||||
IndexAccessDense(const IndexAccessDense&) = default;
|
||||
IndexAccessDense& operator=(const IndexAccessDense&) = default;
|
||||
|
||||
IndexAccessDense(IndexAccessDense&&) noexcept = default;
|
||||
IndexAccessDense& operator=(IndexAccessDense&&) noexcept = default;
|
||||
|
||||
~IndexAccessDense() noexcept override = default;
|
||||
|
||||
void dump() const override {
|
||||
index_type index{this->fd()};
|
||||
|
||||
@ -136,6 +144,14 @@ public:
|
||||
IndexAccess<TValue>(fd) {
|
||||
}
|
||||
|
||||
IndexAccessSparse(const IndexAccessSparse&) = default;
|
||||
IndexAccessSparse& operator=(const IndexAccessSparse&) = default;
|
||||
|
||||
IndexAccessSparse(IndexAccessSparse&&) noexcept = default;
|
||||
IndexAccessSparse& operator=(IndexAccessSparse&&) noexcept = default;
|
||||
|
||||
~IndexAccessSparse() noexcept override = default;
|
||||
|
||||
void dump() const override {
|
||||
index_type index{this->fd()};
|
||||
|
||||
@ -338,7 +354,7 @@ int main(int argc, char* argv[]) {
|
||||
if (fd < 0) {
|
||||
std::cerr << "Can not open file '" << options.filename()
|
||||
<< "': " << std::strerror(errno) << '\n';
|
||||
std::exit(2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -365,7 +381,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <cerrno> // for errno
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for strerror
|
||||
#include <fcntl.h> // for open
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
@ -62,7 +61,7 @@ using location_handler_type = osmium::handler::NodeLocationsForWays<index_type>;
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSM_FILE CACHE_FILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -76,7 +75,7 @@ int main(int argc, char* argv[]) {
|
||||
const int fd = ::open(cache_filename.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666); // NOLINT(hicpp-signed-bitwise)
|
||||
if (fd == -1) {
|
||||
std::cerr << "Can not open location cache file '" << cache_filename << "': " << std::strerror(errno) << "\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
_setmode(fd, _O_BINARY);
|
||||
@ -94,7 +93,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <cerrno> // for errno
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for strerror
|
||||
#include <fcntl.h> // for open
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
@ -63,7 +62,9 @@ using location_handler_type = osmium::handler::NodeLocationsForWays<index_type>;
|
||||
// ID and all nodes IDs and locations in those ways.
|
||||
struct MyHandler : public osmium::handler::Handler {
|
||||
|
||||
void way(const osmium::Way& way) {
|
||||
// The callback functions can be either static or not depending on whether
|
||||
// you need to access any member variables of the handler.
|
||||
static void way(const osmium::Way& way) {
|
||||
std::cout << "way " << way.id() << "\n";
|
||||
for (const auto& nr : way.nodes()) {
|
||||
std::cout << " node " << nr.ref() << " " << nr.location() << "\n";
|
||||
@ -75,7 +76,7 @@ struct MyHandler : public osmium::handler::Handler {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSM_FILE CACHE_FILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -108,7 +109,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <cstring> // for std::strncmp
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
|
||||
@ -57,13 +56,17 @@ class NamesHandler : public osmium::handler::Handler {
|
||||
|
||||
public:
|
||||
|
||||
// The callback functions can be either static or not depending on whether
|
||||
// you need to access any member variables of the handler.
|
||||
// Nodes can be tagged amenity=pub.
|
||||
void node(const osmium::Node& node) {
|
||||
static void node(const osmium::Node& node) {
|
||||
output_pubs(node);
|
||||
}
|
||||
|
||||
// The callback functions can be either static or not depending on whether
|
||||
// you need to access any member variables of the handler.
|
||||
// Ways can be tagged amenity=pub, too (typically buildings).
|
||||
void way(const osmium::Way& way) {
|
||||
static void way(const osmium::Way& way) {
|
||||
output_pubs(way);
|
||||
}
|
||||
|
||||
@ -72,7 +75,7 @@ public:
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -89,7 +92,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cerr
|
||||
|
||||
// Allow any format of input files (XML, PBF, ...)
|
||||
@ -22,7 +21,7 @@
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -42,7 +41,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cerr
|
||||
|
||||
// Allow any format of input files (XML, PBF, ...)
|
||||
@ -29,7 +28,7 @@
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -56,7 +55,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
|
||||
// Allow any format of input files (XML, PBF, ...)
|
||||
@ -65,7 +64,7 @@ struct RoadLengthHandler : public osmium::handler::Handler {
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -92,7 +91,7 @@ int main(int argc, char* argv[]) {
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
171
third_party/libosmium/examples/osmium_tags_filter.cpp
vendored
Normal file
171
third_party/libosmium/examples/osmium_tags_filter.cpp
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
|
||||
EXAMPLE osmium_filter
|
||||
|
||||
Filter OSM files
|
||||
|
||||
DEMONSTRATES USE OF:
|
||||
* file input and output
|
||||
* file types
|
||||
* Osmium buffers
|
||||
* Tags filter
|
||||
|
||||
SIMPLER EXAMPLES you might want to understand first:
|
||||
* osmium_convert
|
||||
|
||||
LICENSE
|
||||
The code in this example file is released into the Public Domain.
|
||||
|
||||
*/
|
||||
|
||||
#include <cstring> // for std::strcmp
|
||||
#include <exception> // for std::exception
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
#include <string> // for std::string
|
||||
|
||||
// Allow any format of input files (XML, PBF, ...)
|
||||
#include <osmium/io/any_input.hpp>
|
||||
|
||||
// Allow any format of output files (XML, PBF, ...)
|
||||
#include <osmium/io/any_output.hpp>
|
||||
|
||||
#include <osmium/tags/taglist.hpp>
|
||||
#include <osmium/tags/tags_filter.hpp>
|
||||
|
||||
void print_help() {
|
||||
std::cout << "osmium_filter [OPTIONS] [INFILE [OUTFILE]]\n\n" \
|
||||
<< "If INFILE or OUTFILE is not given stdin/stdout is assumed.\n" \
|
||||
<< "File format is autodetected from file name suffix.\n" \
|
||||
<< "Use -f and -t options to force file format.\n" \
|
||||
<< "\nFile types:\n" \
|
||||
<< " osm normal OSM file\n" \
|
||||
<< " osc OSM change file\n" \
|
||||
<< " osh OSM file with history information\n" \
|
||||
<< "\nFile format:\n" \
|
||||
<< " (default) XML encoding\n" \
|
||||
<< " pbf binary PBF encoding\n" \
|
||||
<< " opl OPL encoding\n" \
|
||||
<< "\nFile compression\n" \
|
||||
<< " gz compressed with gzip\n" \
|
||||
<< " bz2 compressed with bzip2\n" \
|
||||
<< "\nOptions:\n" \
|
||||
<< " -h, --help This help message\n" \
|
||||
<< " -f, --from-format=FORMAT Input format\n" \
|
||||
<< " -t, --to-format=FORMAT Output format\n";
|
||||
}
|
||||
|
||||
void print_usage(const char* prgname) {
|
||||
std::cerr << "Usage: " << prgname << " [OPTIONS] [INFILE [OUTFILE]]\n";
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc == 1) {
|
||||
print_usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 1 && (!std::strcmp(argv[1], "-h") ||
|
||||
!std::strcmp(argv[1], "--help"))) {
|
||||
print_help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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,
|
||||
// respectively.
|
||||
std::string input_format;
|
||||
std::string output_format;
|
||||
|
||||
std::string input_file_name;
|
||||
std::string output_file_name;
|
||||
|
||||
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]);
|
||||
return 1;
|
||||
}
|
||||
} 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]);
|
||||
return 1;
|
||||
}
|
||||
} 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]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// This declares the input and output files using either the suffix of
|
||||
// the file names or the format in the 2nd argument. It does not yet open
|
||||
// the files.
|
||||
const osmium::io::File input_file{input_file_name, input_format};
|
||||
const osmium::io::File output_file{output_file_name, output_format};
|
||||
|
||||
// Input and output files can be OSM data files (without history) or
|
||||
// OSM history files. History files are detected if they use the '.osh'
|
||||
// file suffix.
|
||||
if ( input_file.has_multiple_object_versions() &&
|
||||
!output_file.has_multiple_object_versions()) {
|
||||
std::cerr << "Warning! You are converting from an OSM file with (potentially) several versions of the same object to one that is not marked as such.\n";
|
||||
}
|
||||
|
||||
try {
|
||||
// Initialize Reader
|
||||
osmium::io::Reader reader{input_file};
|
||||
|
||||
// Get header from input file and change the "generator" setting to
|
||||
// ourselves.
|
||||
osmium::io::Header header = reader.header();
|
||||
header.set("generator", "osmium_convert");
|
||||
|
||||
// Initialize Writer using the header from above and tell it that it
|
||||
// is allowed to overwrite a possibly existing file.
|
||||
osmium::io::Writer writer{output_file, header, osmium::io::overwrite::allow};
|
||||
|
||||
// Match highway=primary or highway=secondary
|
||||
osmium::TagsFilter filter1{false};
|
||||
filter1.add_rule(true, "highway", "primary");
|
||||
filter1.add_rule(true, "highway", "secondary");
|
||||
|
||||
// Match oneway=yes
|
||||
osmium::TagsFilter filter2{false};
|
||||
filter2.add_rule(true, "oneway", "yes");
|
||||
|
||||
// Get all object matching both filters
|
||||
while (osmium::memory::Buffer buffer = reader.read()) { // NOLINT(bugprone-use-after-move) Bug in clang-tidy https://bugs.llvm.org/show_bug.cgi?id=36516
|
||||
for (const auto& object : buffer.select<osmium::OSMObject>()) {
|
||||
if (osmium::tags::match_any_of(object.tags(), filter1) &&
|
||||
osmium::tags::match_any_of(object.tags(), filter2)) {
|
||||
writer(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Explicitly close the writer and reader. Will throw an exception if
|
||||
// there is a problem. If you wait for the destructor to close the writer
|
||||
// and reader, you will not notice the problem, because destructors must
|
||||
// not throw.
|
||||
writer.close();
|
||||
reader.close();
|
||||
} catch (const std::exception& e) {
|
||||
// All exceptions used by the Osmium library derive from std::exception.
|
||||
std::cerr << e.what() << '\n';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
10
third_party/libosmium/examples/osmium_tiles.cpp
vendored
10
third_party/libosmium/examples/osmium_tiles.cpp
vendored
@ -15,7 +15,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdlib> // for std::exit, std::atoi, std::atof
|
||||
#include <cstdlib> // for std::atoi, std::atof
|
||||
#include <iostream> // for std::cout, std::cerr
|
||||
|
||||
// The Location contains a longitude and latitude and is usually used inside
|
||||
@ -33,14 +33,14 @@
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 4) {
|
||||
std::cerr << "Usage: " << argv[0] << " ZOOM LON LAT\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const int zoom = std::atoi(argv[1]); // NOLINT(cert-err34-c)
|
||||
|
||||
if (zoom < 0 || zoom > 30) {
|
||||
std::cerr << "ERROR: Zoom must be between 0 and 30\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
osmium::Location location{};
|
||||
@ -49,14 +49,14 @@ int main(int argc, char* argv[]) {
|
||||
location.set_lat(argv[3]);
|
||||
} catch (const osmium::invalid_location&) {
|
||||
std::cerr << "ERROR: Location is invalid\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 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.
|
||||
if (!location.valid()) {
|
||||
std::cerr << "ERROR: Location is invalid\n";
|
||||
std::exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "WGS84: lon=" << location.lon() << " lat=" << location.lat() << "\n";
|
||||
|
16
third_party/libosmium/include/gdalcpp.hpp
vendored
16
third_party/libosmium/include/gdalcpp.hpp
vendored
@ -5,11 +5,11 @@
|
||||
|
||||
C++11 wrapper classes for GDAL/OGR.
|
||||
|
||||
Version 1.2.0
|
||||
Version 1.3.0
|
||||
|
||||
https://github.com/joto/gdalcpp
|
||||
|
||||
Copyright 2015-2018 Jochen Topf <jochen@topf.org>
|
||||
Copyright 2015-2021 Jochen Topf <jochen@topf.org>
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -50,6 +50,12 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define GDALCPP_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
# define GDALCPP_EXPORT __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
namespace gdalcpp {
|
||||
|
||||
#if GDAL_VERSION_MAJOR >= 2
|
||||
@ -63,7 +69,7 @@ namespace gdalcpp {
|
||||
/**
|
||||
* Exception thrown for all errors in this class.
|
||||
*/
|
||||
class gdal_error : public std::runtime_error {
|
||||
class GDALCPP_EXPORT gdal_error : public std::runtime_error {
|
||||
|
||||
std::string m_driver;
|
||||
std::string m_dataset;
|
||||
@ -190,7 +196,7 @@ namespace gdalcpp {
|
||||
|
||||
SRS() :
|
||||
m_spatial_reference() {
|
||||
const auto result = m_spatial_reference.SetWellKnownGeogCS("WGS84");
|
||||
const auto result = m_spatial_reference.SetWellKnownGeogCS("CRS84");
|
||||
if (result != OGRERR_NONE) {
|
||||
throw gdal_error{std::string{"can not initialize spatial reference system WGS84"},
|
||||
result};
|
||||
@ -514,4 +520,6 @@ namespace gdalcpp {
|
||||
|
||||
} // namespace gdalcpp
|
||||
|
||||
#undef GDALCPP_EXPORT
|
||||
|
||||
#endif // GDALCPP_HPP
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -33,8 +33,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace area {
|
||||
@ -135,16 +133,6 @@ namespace osmium {
|
||||
debug_level(d) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable debug output to stderr. This is for Osmium
|
||||
* developers only.
|
||||
*
|
||||
* @deprecated Set debug_level directly.
|
||||
*/
|
||||
OSMIUM_DEPRECATED void enable_debug_output(bool d = true) {
|
||||
debug_level = d;
|
||||
}
|
||||
|
||||
}; // struct AssemblerConfig
|
||||
|
||||
} // namespace area
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -336,8 +336,11 @@ namespace osmium {
|
||||
osmium::tags::KeyFilter::iterator way_fi_end(std::cref(filter()), way.tags().cend(), way.tags().cend());
|
||||
osmium::tags::KeyFilter::iterator area_fi_begin(std::cref(filter()), area_tags.cbegin(), area_tags.cend());
|
||||
osmium::tags::KeyFilter::iterator area_fi_end(std::cref(filter()), area_tags.cend(), area_tags.cend());
|
||||
|
||||
if (!std::equal(way_fi_begin, way_fi_end, area_fi_begin) || d != std::distance(area_fi_begin, area_fi_end)) {
|
||||
#ifdef __cpp_lib_robust_nonmodifying_seq_ops
|
||||
if (!std::equal(way_fi_begin, way_fi_end, area_fi_begin, area_fi_end)) {
|
||||
#else
|
||||
if (d != std::distance(area_fi_begin, area_fi_end) || !std::equal(way_fi_begin, way_fi_end, area_fi_begin)) {
|
||||
#endif
|
||||
ways_that_should_be_areas.push_back(&way);
|
||||
} else {
|
||||
++stats().inner_with_same_tags;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -51,6 +51,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
@ -195,7 +196,7 @@ namespace osmium {
|
||||
++m_stats.wrong_role;
|
||||
if (debug()) {
|
||||
std::cerr << " Segment " << *segment << " from way " << segment->way()->id() << " has role '" << segment->role_name()
|
||||
<< "', but should have role '" << (ring.is_outer() ? "outer" : "inner") << "'\n";
|
||||
<< "', but should have role '" << (ring.is_outer() ? "outer" : "inner") << "'\n";
|
||||
}
|
||||
if (m_config.problem_reporter) {
|
||||
if (ring.is_outer()) {
|
||||
@ -325,7 +326,7 @@ namespace osmium {
|
||||
const int64_t ay = a.y();
|
||||
const int64_t by = b.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()) {
|
||||
std::cerr << " Segment z=" << z << '\n';
|
||||
}
|
||||
@ -352,7 +353,7 @@ namespace osmium {
|
||||
const int64_t ay = a.y();
|
||||
const int64_t by = b.y();
|
||||
const int64_t ly = 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 (z >= 0) {
|
||||
nesting += segment->is_reverse() ? -1 : 1;
|
||||
@ -384,7 +385,7 @@ namespace osmium {
|
||||
}
|
||||
assert(!outer_rings.empty());
|
||||
|
||||
std::sort(outer_rings.rbegin(), outer_rings.rend());
|
||||
std::stable_sort(outer_rings.rbegin(), outer_rings.rend());
|
||||
if (debug()) {
|
||||
for (const auto& o : outer_rings) {
|
||||
std::cerr << " y=" << o.y() << " " << o.ring() << "\n";
|
||||
@ -407,7 +408,7 @@ namespace osmium {
|
||||
return std::find(m_split_locations.cbegin(), m_split_locations.cend(), location) != m_split_locations.cend();
|
||||
}
|
||||
|
||||
uint32_t add_new_ring(slocation& node) {
|
||||
uint32_t add_new_ring(const slocation& node) {
|
||||
NodeRefSegment* segment = &m_segment_list[node.item];
|
||||
assert(!segment->is_done());
|
||||
|
||||
@ -465,7 +466,7 @@ namespace osmium {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
uint32_t add_new_ring_complex(slocation& node) {
|
||||
uint32_t add_new_ring_complex(const slocation& node) {
|
||||
NodeRefSegment* segment = &m_segment_list[node.item];
|
||||
assert(!segment->is_done());
|
||||
|
||||
@ -552,7 +553,7 @@ namespace osmium {
|
||||
return;
|
||||
}
|
||||
|
||||
std::sort(rings.begin(), rings.end(), [](ProtoRing* a, ProtoRing* b) {
|
||||
std::stable_sort(rings.begin(), rings.end(), [](ProtoRing* a, ProtoRing* b) {
|
||||
return a->min_segment() < b->min_segment();
|
||||
});
|
||||
|
||||
@ -592,7 +593,7 @@ namespace osmium {
|
||||
}
|
||||
++m_stats.open_rings;
|
||||
} else {
|
||||
if (loc == previous_location && (m_split_locations.empty() || m_split_locations.back() != previous_location )) {
|
||||
if (loc == previous_location && (m_split_locations.empty() || m_split_locations.back() != previous_location)) {
|
||||
m_split_locations.push_back(previous_location);
|
||||
}
|
||||
++it;
|
||||
@ -618,7 +619,7 @@ namespace osmium {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<location_to_ring_map> create_location_to_ring_map(open_ring_its_type& open_ring_its) {
|
||||
std::vector<location_to_ring_map> create_location_to_ring_map(open_ring_its_type& open_ring_its) const {
|
||||
std::vector<location_to_ring_map> xrings;
|
||||
xrings.reserve(open_ring_its.size() * 2);
|
||||
|
||||
@ -630,7 +631,7 @@ namespace osmium {
|
||||
xrings.emplace_back((*it)->get_node_ref_stop().location(), it, false);
|
||||
}
|
||||
|
||||
std::sort(xrings.begin(), xrings.end());
|
||||
std::stable_sort(xrings.begin(), xrings.end());
|
||||
|
||||
return xrings;
|
||||
}
|
||||
@ -695,7 +696,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
bool there_are_open_rings() const noexcept {
|
||||
return std::any_of(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring){
|
||||
return std::any_of(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring) {
|
||||
return !ring.closed();
|
||||
});
|
||||
}
|
||||
@ -719,9 +720,11 @@ namespace osmium {
|
||||
|
||||
};
|
||||
|
||||
struct exceeded_max_depth {};
|
||||
struct exceeded_max_depth : public std::exception {};
|
||||
|
||||
void find_candidates(std::vector<candidate>& candidates, std::unordered_set<osmium::Location>& loc_done, const std::vector<location_to_ring_map>& xrings, const candidate& cand, unsigned depth = 0) {
|
||||
using location_set = std::vector<osmium::Location>;
|
||||
|
||||
void find_candidates(std::vector<candidate>& candidates, location_set& loc_done, const std::vector<location_to_ring_map>& xrings, const candidate& cand, unsigned depth = 0) {
|
||||
if (depth > max_depth) {
|
||||
throw exceeded_max_depth{};
|
||||
}
|
||||
@ -781,13 +784,14 @@ namespace osmium {
|
||||
candidates.back() = c;
|
||||
}
|
||||
}
|
||||
} else if (loc_done.count(c.stop_location) == 0) {
|
||||
} else if (std::find(loc_done.cbegin(), loc_done.cend(), c.stop_location) == loc_done.cend()) {
|
||||
if (debug()) {
|
||||
std::cerr << " recurse... (depth=" << depth << " candidates.size=" << candidates.size() << ")\n";
|
||||
std::cerr << " recurse... (depth=" << depth << " candidates.size=" << candidates.size() << " loc_done.size=" << loc_done.size() << ")\n";
|
||||
}
|
||||
loc_done.insert(c.stop_location);
|
||||
loc_done.push_back(c.stop_location);
|
||||
find_candidates(candidates, loc_done, xrings, c, depth + 1);
|
||||
loc_done.erase(c.stop_location);
|
||||
assert(!loc_done.empty() && loc_done.back() == c.stop_location);
|
||||
loc_done.pop_back();
|
||||
if (debug()) {
|
||||
std::cerr << " ...back\n";
|
||||
}
|
||||
@ -833,9 +837,9 @@ namespace osmium {
|
||||
|
||||
// Locations we have visited while finding candidates, used
|
||||
// to detect loops.
|
||||
std::unordered_set<osmium::Location> loc_done;
|
||||
location_set loc_done;
|
||||
|
||||
loc_done.insert(cand.stop_location);
|
||||
loc_done.push_back(cand.stop_location);
|
||||
|
||||
std::vector<candidate> candidates;
|
||||
try {
|
||||
@ -865,9 +869,9 @@ namespace osmium {
|
||||
|
||||
if (debug()) {
|
||||
std::cerr << " Found candidates:\n";
|
||||
for (const auto& cand : candidates) {
|
||||
std::cerr << " sum=" << cand.sum << "\n";
|
||||
for (const auto& ring : cand.rings) {
|
||||
for (const auto& c : candidates) {
|
||||
std::cerr << " sum=" << c.sum << "\n";
|
||||
for (const auto& ring : c.rings) {
|
||||
std::cerr << " " << ring.first.ring() << (ring.second ? " reverse" : "") << "\n";
|
||||
}
|
||||
}
|
||||
@ -903,11 +907,11 @@ namespace osmium {
|
||||
auto count_remaining = m_segment_list.size();
|
||||
for (const osmium::Location& location : m_split_locations) {
|
||||
const auto locs = make_range(std::equal_range(m_locations.begin(),
|
||||
m_locations.end(),
|
||||
slocation{},
|
||||
[this, &location](const slocation& lhs, const slocation& rhs) {
|
||||
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
|
||||
}));
|
||||
m_locations.end(),
|
||||
slocation{},
|
||||
[this, &location](const slocation& lhs, const slocation& rhs) {
|
||||
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
|
||||
}));
|
||||
for (auto& loc : locs) {
|
||||
if (!m_segment_list[loc.item].is_done()) {
|
||||
count_remaining -= add_new_ring_complex(loc);
|
||||
@ -1106,17 +1110,16 @@ namespace osmium {
|
||||
// whether there were any split locations or not. If there
|
||||
// are no splits, we use the faster "simple algorithm", if
|
||||
// there are, we use the slower "complex algorithm".
|
||||
osmium::Timer timer_simple_case;
|
||||
osmium::Timer timer_complex_case;
|
||||
osmium::Timer timer;
|
||||
if (m_split_locations.empty()) {
|
||||
if (debug()) {
|
||||
std::cerr << " No split locations -> using simple algorithm\n";
|
||||
}
|
||||
++m_stats.area_simple_case;
|
||||
|
||||
timer_simple_case.start();
|
||||
timer.start();
|
||||
create_rings_simple_case();
|
||||
timer_simple_case.stop();
|
||||
timer.stop();
|
||||
} else if (m_split_locations.size() > max_split_locations) {
|
||||
if (m_config.debug_level > 0) {
|
||||
std::cerr << " Ignoring polygon with "
|
||||
@ -1134,11 +1137,11 @@ namespace osmium {
|
||||
}
|
||||
++m_stats.area_touching_rings_case;
|
||||
|
||||
timer_complex_case.start();
|
||||
timer.start();
|
||||
if (!create_rings_complex_case()) {
|
||||
return false;
|
||||
}
|
||||
timer_complex_case.stop();
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
// If the assembler was so configured, now check whether the
|
||||
@ -1149,7 +1152,7 @@ namespace osmium {
|
||||
timer_roles.stop();
|
||||
}
|
||||
|
||||
m_stats.outer_rings = std::count_if(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring){
|
||||
m_stats.outer_rings = std::count_if(m_rings.cbegin(), m_rings.cend(), [](const ProtoRing& ring) {
|
||||
return ring.is_outer();
|
||||
});
|
||||
m_stats.inner_rings = m_rings.size() - m_stats.outer_rings;
|
||||
@ -1163,11 +1166,9 @@ namespace osmium {
|
||||
' ' << timer_split.elapsed_microseconds();
|
||||
|
||||
if (m_split_locations.empty()) {
|
||||
std::cout << ' ' << timer_simple_case.elapsed_microseconds() <<
|
||||
" 0";
|
||||
std::cout << ' ' << timer.elapsed_microseconds() << " 0";
|
||||
} else {
|
||||
std::cout << " 0" <<
|
||||
' ' << timer_complex_case.elapsed_microseconds();
|
||||
std::cout << " 0" << ' ' << timer.elapsed_microseconds();
|
||||
}
|
||||
|
||||
std::cout <<
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -56,13 +56,13 @@ namespace osmium {
|
||||
return false;
|
||||
}
|
||||
return stats().duplicate_nodes ||
|
||||
stats().duplicate_segments ||
|
||||
stats().intersections ||
|
||||
stats().open_rings ||
|
||||
stats().short_ways ||
|
||||
stats().touching_rings ||
|
||||
stats().ways_in_multiple_rings ||
|
||||
stats().wrong_role;
|
||||
stats().duplicate_segments ||
|
||||
stats().intersections ||
|
||||
stats().open_rings ||
|
||||
stats().short_ways ||
|
||||
stats().touching_rings ||
|
||||
stats().ways_in_multiple_rings ||
|
||||
stats().wrong_role;
|
||||
}
|
||||
|
||||
static void copy_tags_without_type(osmium::builder::AreaBuilder& builder, const osmium::TagList& tags) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -192,7 +192,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
const char* role_name() const noexcept {
|
||||
static const std::array<const char*, 4> names = {{ "unknown", "outer", "inner", "empty" }};
|
||||
static const std::array<const char*, 4> names = {{"unknown", "outer", "inner", "empty"}};
|
||||
return names[int(m_role)];
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
inline bool operator!=(const NodeRefSegment& lhs, const NodeRefSegment& rhs) noexcept {
|
||||
return ! (lhs == rhs);
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -346,9 +346,9 @@ namespace osmium {
|
||||
};
|
||||
|
||||
std::array<seg_loc, 4> sl = {{
|
||||
{0, s1.first().location() },
|
||||
{0, s1.first().location()},
|
||||
{0, s1.second().location()},
|
||||
{1, s2.first().location() },
|
||||
{1, s2.first().location()},
|
||||
{1, s2.second().location()},
|
||||
}};
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -296,14 +296,14 @@ namespace osmium {
|
||||
}
|
||||
}
|
||||
|
||||
if (it+2 != m_segments.end() && *it == *(it+2)) {
|
||||
if (it + 2 != m_segments.end() && *it == *(it + 2)) {
|
||||
++overlapping_segments;
|
||||
if (problem_reporter) {
|
||||
problem_reporter->report_overlapping_segment(it->first(), it->second());
|
||||
}
|
||||
}
|
||||
|
||||
m_segments.erase(it, it+2);
|
||||
m_segments.erase(it, it + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ namespace osmium {
|
||||
|
||||
for (auto it1 = m_segments.cbegin(); it1 != m_segments.cend() - 1; ++it1) {
|
||||
const NodeRefSegment& s1 = *it1;
|
||||
for (auto it2 = it1+1; it2 != m_segments.end(); ++it2) {
|
||||
for (auto it2 = it1 + 1; it2 != m_segments.end(); ++it2) {
|
||||
const NodeRefSegment& s2 = *it2;
|
||||
|
||||
assert(s1 != s2); // erase_duplicate_segments() should have made sure of that
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -172,7 +172,7 @@ namespace osmium {
|
||||
}
|
||||
}
|
||||
|
||||
void complete_relation(osmium::relations::RelationMeta& relation_meta) {
|
||||
void complete_relation(const osmium::relations::RelationMeta& relation_meta) {
|
||||
const osmium::Relation& relation = this->get_relation(relation_meta);
|
||||
const osmium::memory::Buffer& buffer = this->members_buffer();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -80,7 +80,7 @@ namespace osmium {
|
||||
ProblemReporter(ProblemReporter&&) noexcept = default;
|
||||
ProblemReporter& operator=(ProblemReporter&&) noexcept = default;
|
||||
|
||||
virtual ~ProblemReporter() = default;
|
||||
virtual ~ProblemReporter() noexcept = default;
|
||||
|
||||
/**
|
||||
* Set the object the next problem reports will be on.
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -117,8 +117,7 @@ namespace osmium {
|
||||
.add_field("nodes", OFTInteger, 8)
|
||||
.add_field("id1", OFTReal, 12, 1)
|
||||
.add_field("id2", OFTReal, 12, 1)
|
||||
.add_field("problem", OFTString, 30)
|
||||
;
|
||||
.add_field("problem", OFTString, 30);
|
||||
|
||||
m_layer_lerror
|
||||
.add_field("obj_type", OFTString, 1)
|
||||
@ -126,15 +125,13 @@ namespace osmium {
|
||||
.add_field("nodes", OFTInteger, 8)
|
||||
.add_field("id1", OFTReal, 12, 1)
|
||||
.add_field("id2", OFTReal, 12, 1)
|
||||
.add_field("problem", OFTString, 30)
|
||||
;
|
||||
.add_field("problem", OFTString, 30);
|
||||
|
||||
m_layer_ways
|
||||
.add_field("obj_type", OFTString, 1)
|
||||
.add_field("obj_id", OFTInteger, 10)
|
||||
.add_field("way_id", OFTInteger, 10)
|
||||
.add_field("nodes", OFTInteger, 8)
|
||||
;
|
||||
.add_field("nodes", OFTInteger, 8);
|
||||
}
|
||||
|
||||
void report_duplicate_node(osmium::object_id_type node_id1, osmium::object_id_type node_id2, osmium::Location location) override {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -288,7 +288,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
member_type_string(char type, osmium::object_id_type ref, std::string&& role) noexcept :
|
||||
member_type_string(osmium::char_to_item_type(type), ref, std::forward<std::string>(role)) {
|
||||
member_type_string(osmium::char_to_item_type(type), ref, std::move(role)) {
|
||||
}
|
||||
|
||||
osmium::item_type type() const noexcept {
|
||||
@ -682,7 +682,7 @@ namespace osmium {
|
||||
return;
|
||||
}
|
||||
const char* key = tag.value.first;
|
||||
auto const equal_sign = std::strchr(key, '=');
|
||||
const char* const equal_sign = std::strchr(key, '=');
|
||||
if (!equal_sign) {
|
||||
builder.add_tag(key, "");
|
||||
return;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -35,7 +35,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <osmium/memory/buffer.hpp>
|
||||
#include <osmium/memory/item.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -87,8 +86,12 @@ namespace osmium {
|
||||
}
|
||||
#endif
|
||||
|
||||
osmium::memory::Item& item() const {
|
||||
return *reinterpret_cast<osmium::memory::Item*>(m_buffer.data() + m_buffer.committed() + m_item_offset);
|
||||
unsigned char* item_pos() const noexcept {
|
||||
return m_buffer.data() + m_buffer.committed() + m_item_offset;
|
||||
}
|
||||
|
||||
osmium::memory::Item& item() const noexcept {
|
||||
return *reinterpret_cast<osmium::memory::Item*>(item_pos());
|
||||
}
|
||||
|
||||
unsigned char* reserve_space(std::size_t size) {
|
||||
@ -183,18 +186,6 @@ namespace osmium {
|
||||
return append(str, static_cast<osmium::memory::item_size_type>(std::strlen(str) + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Append '\0' to the buffer.
|
||||
*
|
||||
* @deprecated Use append_with_zero() instead.
|
||||
*
|
||||
* @returns The number of bytes appended (always 1).
|
||||
*/
|
||||
OSMIUM_DEPRECATED osmium::memory::item_size_type append_zero() {
|
||||
*reserve_space(1) = '\0';
|
||||
return 1;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Builder(const Builder&) = delete;
|
||||
@ -217,15 +208,6 @@ namespace osmium {
|
||||
add_size(item.padded_size());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the version of add_item() taking a
|
||||
* reference instead.
|
||||
*/
|
||||
OSMIUM_DEPRECATED void add_item(const osmium::memory::Item* item) {
|
||||
assert(item);
|
||||
add_item(*item);
|
||||
}
|
||||
|
||||
}; // class Builder
|
||||
|
||||
} // namespace builder
|
||||
|
@ -1,120 +0,0 @@
|
||||
#ifndef OSMIUM_BUILDER_BUILDER_HELPER_HPP
|
||||
#define OSMIUM_BUILDER_BUILDER_HELPER_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/builder/osm_object_builder.hpp>
|
||||
#include <osmium/memory/buffer.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
class NodeRef;
|
||||
class TagList;
|
||||
class WayNodeList;
|
||||
|
||||
namespace builder {
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use osmium::builder::add_way_node_list() instead.
|
||||
*/
|
||||
OSMIUM_DEPRECATED inline const osmium::WayNodeList& build_way_node_list(osmium::memory::Buffer& buffer, const std::initializer_list<osmium::NodeRef>& nodes) {
|
||||
const size_t pos = buffer.committed();
|
||||
{
|
||||
osmium::builder::WayNodeListBuilder wnl_builder(buffer);
|
||||
for (const auto& node_ref : nodes) {
|
||||
wnl_builder.add_node_ref(node_ref);
|
||||
}
|
||||
}
|
||||
buffer.commit();
|
||||
return buffer.get<const osmium::WayNodeList>(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use osmium::builder::add_tag_list() instead.
|
||||
*/
|
||||
OSMIUM_DEPRECATED inline const osmium::TagList& build_tag_list(osmium::memory::Buffer& buffer, const std::initializer_list<std::pair<const char*, const char*>>& tags) {
|
||||
const size_t pos = buffer.committed();
|
||||
{
|
||||
osmium::builder::TagListBuilder tl_builder(buffer);
|
||||
for (const auto& p : tags) {
|
||||
tl_builder.add_tag(p.first, p.second);
|
||||
}
|
||||
}
|
||||
buffer.commit();
|
||||
return buffer.get<const osmium::TagList>(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use osmium::builder::add_tag_list() instead.
|
||||
*/
|
||||
OSMIUM_DEPRECATED inline const osmium::TagList& build_tag_list_from_map(osmium::memory::Buffer& buffer, const std::map<const char*, const char*>& tags) {
|
||||
const size_t pos = buffer.committed();
|
||||
{
|
||||
osmium::builder::TagListBuilder tl_builder(buffer);
|
||||
for (const auto& p : tags) {
|
||||
tl_builder.add_tag(p.first, p.second);
|
||||
}
|
||||
}
|
||||
buffer.commit();
|
||||
return buffer.get<const osmium::TagList>(pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use osmium::builder::add_tag_list() instead.
|
||||
*/
|
||||
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();
|
||||
{
|
||||
osmium::builder::TagListBuilder tl_builder(buffer);
|
||||
func(tl_builder);
|
||||
}
|
||||
buffer.commit();
|
||||
return buffer.get<const osmium::TagList>(pos);
|
||||
}
|
||||
|
||||
} // namespace builder
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_BUILDER_BUILDER_HELPER_HPP
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -48,7 +48,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <osmium/osm/timestamp.hpp>
|
||||
#include <osmium/osm/types.hpp>
|
||||
#include <osmium/osm/way.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -405,18 +404,22 @@ namespace osmium {
|
||||
|
||||
constexpr static const std::size_t min_size_for_user = osmium::memory::padded_length(sizeof(string_size_type) + 1);
|
||||
|
||||
void set_user_size(string_size_type size) noexcept {
|
||||
std::memcpy(item_pos() + sizeof(T), &size, sizeof(string_size_type));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit OSMObjectBuilder(osmium::memory::Buffer& buffer, Builder* parent = nullptr) :
|
||||
Builder(buffer, parent, sizeof(T) + min_size_for_user) {
|
||||
new (&item()) T{};
|
||||
add_size(min_size_for_user);
|
||||
std::fill_n(object().data() + sizeof(T), min_size_for_user, 0);
|
||||
object().set_user_size(1);
|
||||
std::memset(object().data() + sizeof(T), 0, min_size_for_user);
|
||||
set_user_size(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the object buing built.
|
||||
* Get a reference to the object being built.
|
||||
*
|
||||
* Note that this reference will be invalidated by every action
|
||||
* on the builder that might make the buffer grow. This includes
|
||||
@ -427,7 +430,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a const reference to the object buing built.
|
||||
* Get a const reference to the object being built.
|
||||
*
|
||||
* Note that this reference will be invalidated by every action
|
||||
* on the builder that might make the buffer grow. This includes
|
||||
@ -447,14 +450,14 @@ namespace osmium {
|
||||
const auto size_of_object = sizeof(T) + sizeof(string_size_type);
|
||||
assert(cobject().user_size() == 1 && (size() <= size_of_object + osmium::memory::padded_length(1))
|
||||
&& "set_user() must be called at most once and before any sub-builders");
|
||||
const auto available_space = min_size_for_user - sizeof(string_size_type) - 1;
|
||||
constexpr const auto available_space = min_size_for_user - sizeof(string_size_type) - 1;
|
||||
if (length > available_space) {
|
||||
const auto space_needed = osmium::memory::padded_length(length - available_space);
|
||||
std::fill_n(reserve_space(space_needed), space_needed, 0);
|
||||
std::memset(reserve_space(space_needed), 0, space_needed);
|
||||
add_size(static_cast<uint32_t>(space_needed));
|
||||
}
|
||||
std::copy_n(user, length, object().data() + size_of_object);
|
||||
object().set_user_size(length + 1);
|
||||
std::memcpy(object().data() + size_of_object, user, length);
|
||||
set_user_size(length + 1);
|
||||
|
||||
return static_cast<TDerived&>(*this);
|
||||
}
|
||||
@ -484,12 +487,6 @@ namespace osmium {
|
||||
return set_user(user.data(), static_cast<string_size_type>(user.size()));
|
||||
}
|
||||
|
||||
/// @deprecated Use set_user(...) instead.
|
||||
template <typename... TArgs>
|
||||
OSMIUM_DEPRECATED void add_user(TArgs&&... args) {
|
||||
set_user(std::forward<TArgs>(args)...);
|
||||
}
|
||||
|
||||
OSMIUM_FORWARD(set_id)
|
||||
OSMIUM_FORWARD(set_visible)
|
||||
OSMIUM_FORWARD(set_deleted)
|
||||
@ -608,7 +605,7 @@ namespace osmium {
|
||||
Builder(buffer, parent, sizeof(Changeset) + min_size_for_user) {
|
||||
new (&item()) Changeset{};
|
||||
add_size(min_size_for_user);
|
||||
std::fill_n(object().data() + sizeof(Changeset), min_size_for_user, 0);
|
||||
std::memset(object().data() + sizeof(Changeset), 0, min_size_for_user);
|
||||
object().set_user_size(1);
|
||||
}
|
||||
|
||||
@ -644,11 +641,6 @@ namespace osmium {
|
||||
OSMIUM_FORWARD(set_attribute)
|
||||
OSMIUM_FORWARD(set_removed)
|
||||
|
||||
// @deprecated Use set_bounds() instead.
|
||||
OSMIUM_DEPRECATED osmium::Box& bounds() noexcept {
|
||||
return object().bounds();
|
||||
}
|
||||
|
||||
ChangesetBuilder& set_bounds(const osmium::Box& box) noexcept {
|
||||
object().bounds() = box;
|
||||
return *this;
|
||||
@ -663,13 +655,13 @@ namespace osmium {
|
||||
ChangesetBuilder& set_user(const char* user, const string_size_type length) {
|
||||
assert(cobject().user_size() == 1 && (size() <= sizeof(Changeset) + osmium::memory::padded_length(1))
|
||||
&& "set_user() must be called at most once and before any sub-builders");
|
||||
const auto available_space = min_size_for_user - 1;
|
||||
constexpr const auto available_space = min_size_for_user - 1;
|
||||
if (length > available_space) {
|
||||
const auto space_needed = osmium::memory::padded_length(length - available_space);
|
||||
std::fill_n(reserve_space(space_needed), space_needed, 0);
|
||||
std::memset(reserve_space(space_needed), 0, space_needed);
|
||||
add_size(static_cast<uint32_t>(space_needed));
|
||||
}
|
||||
std::copy_n(user, length, object().data() + sizeof(Changeset));
|
||||
std::memcpy(object().data() + sizeof(Changeset), user, length);
|
||||
object().set_user_size(length + 1);
|
||||
|
||||
return *this;
|
||||
@ -700,12 +692,6 @@ namespace osmium {
|
||||
return set_user(user.data(), static_cast<string_size_type>(user.size()));
|
||||
}
|
||||
|
||||
/// @deprecated Use set_user(...) instead.
|
||||
template <typename... TArgs>
|
||||
OSMIUM_DEPRECATED void add_user(TArgs&&... args) {
|
||||
set_user(std::forward<TArgs>(args)...);
|
||||
}
|
||||
|
||||
}; // class ChangesetBuilder
|
||||
|
||||
#undef OSMIUM_FORWARD
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -48,13 +48,13 @@ namespace osmium {
|
||||
|
||||
DiffHandler() = default;
|
||||
|
||||
void node(const osmium::DiffNode&) const noexcept {
|
||||
void node(const osmium::DiffNode& /*node*/) const noexcept {
|
||||
}
|
||||
|
||||
void way(const osmium::DiffWay&) const noexcept {
|
||||
void way(const osmium::DiffWay& /*way*/) const noexcept {
|
||||
}
|
||||
|
||||
void relation(const osmium::DiffRelation&) const noexcept {
|
||||
void relation(const osmium::DiffRelation& /*relation*/) const noexcept {
|
||||
}
|
||||
|
||||
}; // class DiffHandler
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -91,8 +91,7 @@ namespace osmium {
|
||||
m_prev(begin),
|
||||
m_curr(begin),
|
||||
m_next(begin == end ? begin : ++begin),
|
||||
m_end(std::move(end)),
|
||||
m_diff() {
|
||||
m_end(std::move(end)) {
|
||||
}
|
||||
|
||||
DiffIterator& operator++() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -62,7 +62,7 @@ namespace osmium {
|
||||
HandlerWrapperBase(HandlerWrapperBase&&) noexcept = default;
|
||||
HandlerWrapperBase& operator=(HandlerWrapperBase&&) noexcept = default;
|
||||
|
||||
virtual ~HandlerWrapperBase() = default;
|
||||
virtual ~HandlerWrapperBase() noexcept = default;
|
||||
|
||||
virtual void node(const osmium::Node& /*node*/) {
|
||||
}
|
||||
@ -126,6 +126,14 @@ auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, long) ->
|
||||
m_handler(std::forward<TArgs>(args)...) {
|
||||
}
|
||||
|
||||
HandlerWrapper(const HandlerWrapper&) = default;
|
||||
HandlerWrapper& operator=(const HandlerWrapper&) = default;
|
||||
|
||||
HandlerWrapper(HandlerWrapper&&) noexcept = default;
|
||||
HandlerWrapper& operator=(HandlerWrapper&&) noexcept = default;
|
||||
|
||||
~HandlerWrapper() noexcept override = default;
|
||||
|
||||
void node(const osmium::Node& node) final {
|
||||
node_dispatch(m_handler, node, 0);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -73,7 +73,6 @@ namespace osmium {
|
||||
m_entities((entities & ~osmium::osm_entity_bits::area) | (m_with_areas ? osmium::osm_entity_bits::node | osmium::osm_entity_bits::way : osmium::osm_entity_bits::nothing)),
|
||||
m_location_handler(location_handler),
|
||||
m_reader(file, m_entities),
|
||||
m_assembler_config(),
|
||||
m_collector(m_assembler_config)
|
||||
{
|
||||
m_location_handler.ignore_errors();
|
||||
|
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 (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -74,6 +74,7 @@ namespace osmium {
|
||||
* This constructor is not explicit on purpose allowing use of
|
||||
* a Location everywhere a Coordinates object is needed.
|
||||
*/
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
Coordinates(const osmium::Location& location) : // NOLINT(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
x(location.lon()),
|
||||
y(location.lat()) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -44,6 +44,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <osmium/osm/node_ref_list.hpp>
|
||||
#include <osmium/osm/types.hpp>
|
||||
#include <osmium/osm/way.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
@ -56,7 +57,7 @@ namespace osmium {
|
||||
* Exception thrown when an invalid geometry is encountered. An example
|
||||
* would be a linestring with less than two points.
|
||||
*/
|
||||
class geometry_error : public std::runtime_error {
|
||||
class OSMIUM_EXPORT geometry_error : public std::runtime_error {
|
||||
|
||||
std::string m_message;
|
||||
osmium::object_id_type m_id;
|
||||
@ -131,11 +132,11 @@ namespace osmium {
|
||||
return Coordinates{location.lon(), location.lat()};
|
||||
}
|
||||
|
||||
int epsg() const noexcept {
|
||||
static int epsg() noexcept {
|
||||
return 4326;
|
||||
}
|
||||
|
||||
std::string proj_string() const {
|
||||
static std::string proj_string() noexcept {
|
||||
return "+proj=longlat +datum=WGS84 +no_defs";
|
||||
}
|
||||
|
||||
@ -385,7 +386,7 @@ namespace osmium {
|
||||
|
||||
for (const auto& item : area) {
|
||||
if (item.type() == osmium::item_type::outer_ring) {
|
||||
auto& ring = static_cast<const osmium::OuterRing&>(item);
|
||||
const auto& ring = static_cast<const osmium::OuterRing&>(item);
|
||||
if (num_polygons > 0) {
|
||||
m_impl.multipolygon_polygon_finish();
|
||||
}
|
||||
@ -396,7 +397,7 @@ namespace osmium {
|
||||
++num_rings;
|
||||
++num_polygons;
|
||||
} else if (item.type() == osmium::item_type::inner_ring) {
|
||||
auto& ring = static_cast<const osmium::InnerRing&>(item);
|
||||
const auto& ring = static_cast<const osmium::InnerRing&>(item);
|
||||
m_impl.multipolygon_inner_ring_start();
|
||||
add_points(ring);
|
||||
m_impl.multipolygon_inner_ring_finish();
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -54,7 +54,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <osmium/geom/coordinates.hpp>
|
||||
#include <osmium/geom/factory.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
#include <geos/geom/Coordinate.h>
|
||||
#include <geos/geom/CoordinateSequence.h>
|
||||
@ -70,20 +69,13 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
// MSVC doesn't support throw_with_nested yet
|
||||
#ifdef _MSC_VER
|
||||
# define THROW throw
|
||||
#else
|
||||
# include <exception>
|
||||
# define THROW std::throw_with_nested
|
||||
#endif
|
||||
|
||||
namespace osmium {
|
||||
|
||||
struct geos_geometry_error : public geometry_error {
|
||||
@ -123,16 +115,6 @@ namespace osmium {
|
||||
m_geos_factory(&geos_factory) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Do not set SRID explicitly. It will be set to the
|
||||
* correct value automatically.
|
||||
*/
|
||||
OSMIUM_DEPRECATED explicit GEOSFactoryImpl(int /* srid */, int srid) :
|
||||
m_precision_model(new geos::geom::PrecisionModel),
|
||||
m_our_geos_factory(new geos::geom::GeometryFactory{m_precision_model.get(), srid}),
|
||||
m_geos_factory(m_our_geos_factory.get()) {
|
||||
}
|
||||
|
||||
explicit GEOSFactoryImpl(int srid) :
|
||||
m_precision_model(new geos::geom::PrecisionModel),
|
||||
m_our_geos_factory(new geos::geom::GeometryFactory{m_precision_model.get(), srid}),
|
||||
@ -145,7 +127,7 @@ namespace osmium {
|
||||
try {
|
||||
return point_type{m_geos_factory->createPoint(geos::geom::Coordinate{xy.x, xy.y})};
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +137,7 @@ namespace osmium {
|
||||
try {
|
||||
m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +145,7 @@ namespace osmium {
|
||||
try {
|
||||
m_coordinate_sequence->add(geos::geom::Coordinate{xy.x, xy.y});
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +153,7 @@ namespace osmium {
|
||||
try {
|
||||
return linestring_type{m_geos_factory->createLineString(m_coordinate_sequence.release())};
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +177,7 @@ namespace osmium {
|
||||
m_polygons.emplace_back(m_geos_factory->createPolygon(m_rings[0].release(), inner_rings));
|
||||
m_rings.clear();
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +185,7 @@ namespace osmium {
|
||||
try {
|
||||
m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +193,7 @@ namespace osmium {
|
||||
try {
|
||||
m_rings.emplace_back(m_geos_factory->createLinearRing(m_coordinate_sequence.release()));
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,7 +201,7 @@ namespace osmium {
|
||||
try {
|
||||
m_coordinate_sequence.reset(m_geos_factory->getCoordinateSequenceFactory()->create(static_cast<std::size_t>(0), 2));
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,7 +209,7 @@ namespace osmium {
|
||||
try {
|
||||
m_rings.emplace_back(m_geos_factory->createLinearRing(m_coordinate_sequence.release()));
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +217,7 @@ namespace osmium {
|
||||
try {
|
||||
m_coordinate_sequence->add(geos::geom::Coordinate{xy.x, xy.y});
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +230,7 @@ namespace osmium {
|
||||
m_polygons.clear();
|
||||
return multipolygon_type{m_geos_factory->createMultiPolygon(polygons)};
|
||||
} catch (const geos::util::GEOSException& e) {
|
||||
THROW(osmium::geos_geometry_error(e.what()));
|
||||
std::throw_with_nested(osmium::geos_geometry_error(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,8 +246,6 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#undef THROW
|
||||
|
||||
#endif
|
||||
|
||||
#endif // OSMIUM_GEOM_GEOS_HPP
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -78,7 +78,7 @@ namespace osmium {
|
||||
inline double distance(const osmium::WayNodeList& wnl) {
|
||||
double sum_length = 0;
|
||||
|
||||
for (auto it = wnl.begin(); it != wnl.end(); ++it) {
|
||||
for (const auto* it = wnl.begin(); it != wnl.end(); ++it) {
|
||||
if (std::next(it) != wnl.end()) {
|
||||
sum_length += distance(it->location(), std::next(it)->location());
|
||||
}
|
||||
@ -93,7 +93,7 @@ namespace osmium {
|
||||
inline double distance(const osmium::NodeRefList& nrl) {
|
||||
double sum_length = 0;
|
||||
|
||||
for (auto it = nrl.begin(); it != nrl.end(); ++it) {
|
||||
for (const auto* it = nrl.begin(); it != nrl.end(); ++it) {
|
||||
if (std::next(it) != nrl.end()) {
|
||||
sum_length += distance(it->location(), std::next(it)->location());
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -161,11 +161,11 @@ namespace osmium {
|
||||
return Coordinates{detail::lon_to_x(location.lon()), detail::lat_to_y(location.lat())};
|
||||
}
|
||||
|
||||
int epsg() const noexcept {
|
||||
static int epsg() noexcept {
|
||||
return 3857;
|
||||
}
|
||||
|
||||
std::string proj_string() const {
|
||||
static std::string proj_string() noexcept {
|
||||
return "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs";
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -82,7 +82,7 @@ namespace osmium {
|
||||
|
||||
/* Point */
|
||||
|
||||
point_type make_point(const osmium::geom::Coordinates& xy) const {
|
||||
static point_type make_point(const osmium::geom::Coordinates& xy) {
|
||||
return point_type{new OGRPoint{xy.x, xy.y}};
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -68,7 +68,7 @@ namespace osmium {
|
||||
*
|
||||
* @deprecated Only supports the old PROJ API.
|
||||
*/
|
||||
class CRS {
|
||||
class OSMIUM_DEPRECATED CRS {
|
||||
|
||||
struct ProjCRSDeleter {
|
||||
void operator()(void* crs) {
|
||||
@ -122,7 +122,6 @@ namespace osmium {
|
||||
*
|
||||
* @deprecated Only supports the old PROJ API.
|
||||
*/
|
||||
// cppcheck-suppress passedByValue (because c is small and we want to change it)
|
||||
inline OSMIUM_DEPRECATED Coordinates transform(const CRS& src, const CRS& dest, Coordinates c) {
|
||||
const int result = pj_transform(src.get(), dest.get(), 1, 1, &c.x, &c.y, nullptr);
|
||||
if (result != 0) {
|
||||
@ -144,7 +143,7 @@ namespace osmium {
|
||||
*
|
||||
* @deprecated Only supports the old PROJ API.
|
||||
*/
|
||||
class Projection {
|
||||
class OSMIUM_DEPRECATED Projection {
|
||||
|
||||
int m_epsg;
|
||||
std::string m_proj_string;
|
||||
@ -153,9 +152,9 @@ namespace osmium {
|
||||
|
||||
public:
|
||||
|
||||
explicit Projection(const std::string& proj_string) :
|
||||
explicit Projection(std::string proj_string) :
|
||||
m_epsg(-1),
|
||||
m_proj_string(proj_string),
|
||||
m_proj_string(std::move(proj_string)),
|
||||
m_crs_user(proj_string) {
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -77,8 +77,7 @@ namespace osmium {
|
||||
inline constexpr uint32_t mercx_to_tilex(uint32_t zoom, double x) noexcept {
|
||||
return static_cast<uint32_t>(detail::clamp<int32_t>(
|
||||
static_cast<int32_t>((x + detail::max_coordinate_epsg3857) / tile_extent_in_zoom(zoom)),
|
||||
0, num_tiles_in_zoom(zoom) -1
|
||||
));
|
||||
0, num_tiles_in_zoom(zoom) - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +88,7 @@ namespace osmium {
|
||||
inline constexpr uint32_t mercy_to_tiley(uint32_t zoom, double y) noexcept {
|
||||
return static_cast<uint32_t>(detail::clamp<int32_t>(
|
||||
static_cast<int32_t>((detail::max_coordinate_epsg3857 - y) / tile_extent_in_zoom(zoom)),
|
||||
0, num_tiles_in_zoom(zoom) -1
|
||||
));
|
||||
0, num_tiles_in_zoom(zoom) - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@ -42,7 +44,7 @@ namespace osmium {
|
||||
* Exception thrown when a projection object can not be initialized or the
|
||||
* projection of some coordinates can not be calculated.
|
||||
*/
|
||||
struct projection_error : public std::runtime_error {
|
||||
struct OSMIUM_EXPORT projection_error : public std::runtime_error {
|
||||
|
||||
explicit projection_error(const std::string& what) :
|
||||
std::runtime_error(what) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -201,6 +201,34 @@ namespace osmium {
|
||||
return data;
|
||||
}
|
||||
|
||||
/* Polygon */
|
||||
|
||||
void polygon_start() {
|
||||
m_data.clear();
|
||||
set_size(header(m_data, wkbPolygon, true), 1);
|
||||
m_ring_size_offset = m_data.size();
|
||||
str_push(m_data, static_cast<uint32_t>(0));
|
||||
}
|
||||
|
||||
void polygon_add_location(const osmium::geom::Coordinates& xy) {
|
||||
str_push(m_data, xy.x);
|
||||
str_push(m_data, xy.y);
|
||||
}
|
||||
|
||||
polygon_type polygon_finish(std::size_t num_points) {
|
||||
set_size(m_ring_size_offset, num_points);
|
||||
std::string data;
|
||||
|
||||
using std::swap;
|
||||
swap(data, m_data);
|
||||
|
||||
if (m_out_type == out_type::hex) {
|
||||
return convert_to_hex(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* MultiPolygon */
|
||||
|
||||
void multipolygon_start() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (https://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2020 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user