Squashed 'third_party/libosmium/' changes from d5ecf4d..c1f34c4
c1f34c4 Release v2.11.0 d3b72e0 Updated change log. 2982b8d Update embedded Protozero to version 1.5.1. cc1ab2a Add non-const WayNodeList::operator[]. 3da372e Add missing example to examples/README.md. 30604ba Add OSMIUM_USE_SLOW_MERCATOR_PROJECTION define. 47a92e0 Clearer CheckOrder handler doc. f11106d Formatting fixes. a870737 Use faster implementation of web mercator projection. 041bb42 Test cleanups. 8933bc5 Cleanup *Map::get() functions. 6b989ca Document that (Multipolygon)Collectors only work with unique Ids. 8fb5bd2 Updated included Protozero to version 1.5.0. 76e153d Removed Makefile. 35d7ec9 Update copyright date. a7f8126 Rename guard define to common scheme. a923c69 Cleanup I/O tests. d353993 Add Map::get_noexcept() method for all index maps. 94fa5ac Add const overload for mmap_vector_base::operator[]. 3cf9184 Add default constructed "invalid" Coordinates. 358f170 Add Tile constructor from web mercator coordinates. 006aa4c Add index::RelationsMap(Stash|Index) classes. 9cc842e Updated catch to v1.5.9. bd8c3b6 Use initializer_list trick instead of recursive template. 2c82a6f Merge pull request #183 from daniel-j-h/rvalue-apply 0bf5404 Implements rvalue handler support for apply, resolves #180. ccaab08 Merge pull request #182 from AMDmi3/freebsd-endianess bffe626 Handle endianess on FreeBSD properly 7250222 Code formatting and test cleanup. 6652436 Merge pull request #179 from oxidase/add_match_key_std_regex afadf5b Rename centroid variables and function in example. 8355284 Add envelope() functions to NodeRefList, Way, and Area. fc83d2e Remove unnecessary include. 9ddd00e Add match_key<std::regex> tag 9c54a53 Update README. Moved some infos to manual. 89a90a6 Update readme and developer docs. c3446ec Simplify subitem iteration code and made it more flexible. 542b07c Add some static_asserts. f0fd690 Memory reporting on M68k doesn't work properly. e8957c6 Compare doubles in test using Approx(). 58ae4a6 Add amenity_list example. 53783f8 Fix doxygen config for reproducible builds. de4e52d Release v2.10.3 0cc42a2 ObjectPointerCollection constructor can't be noexcept. 4472dfb Round out ObjectPointerCollection implementation and test it. 28cb35d Build with XCode 8 and GCC 6 on travis. 03e3e66 Upgrade to new protozero version 1.4.5. 2102c2f Add assertion in queue handling code. git-subtree-dir: third_party/libosmium git-subtree-split: c1f34c45507e233a2b9028663906679c610fe179
This commit is contained in:
parent
6f885b5bdb
commit
0c6dee4bef
32
.travis.yml
32
.travis.yml
@ -109,7 +109,7 @@ matrix:
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc50-release
|
||||
compiler: linux-gcc5-release
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
||||
@ -117,7 +117,7 @@ matrix:
|
||||
env: COMPILER='g++-5' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc50-dev
|
||||
compiler: linux-gcc5-dev
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
||||
@ -125,6 +125,23 @@ matrix:
|
||||
env: COMPILER='g++-5' BUILD_TYPE='Dev'
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc6-release
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
||||
packages: ['g++-6', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
||||
env: COMPILER='g++-6' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: linux-gcc6-dev
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'boost-latest']
|
||||
packages: ['g++-6', 'libboost1.55-all-dev', 'libgdal-dev', 'libgeos++-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin']
|
||||
env: COMPILER='g++-6' BUILD_TYPE='Dev'
|
||||
|
||||
|
||||
# 3/ OSX Clang Builds
|
||||
- os: osx
|
||||
osx_image: xcode6.4
|
||||
@ -148,6 +165,17 @@ matrix:
|
||||
env: COMPILER='clang++' BUILD_TYPE='Dev'
|
||||
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
compiler: xcode8-clang-release
|
||||
env: COMPILER='clang++' BUILD_TYPE='Release'
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
compiler: xcode8-clang-dev
|
||||
env: COMPILER='clang++' BUILD_TYPE='Dev'
|
||||
|
||||
|
||||
install:
|
||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
||||
|
48
CHANGELOG.md
48
CHANGELOG.md
@ -13,6 +13,51 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Fixed
|
||||
|
||||
|
||||
## [2.11.0] - 2017-01-14
|
||||
|
||||
### Added
|
||||
|
||||
- New index::RelationsMap(Stash|Index) classes implementing an index for
|
||||
looking up parent relation IDs given a member relation ID.
|
||||
- Add `get_noexcept()` method to all index maps. For cases where ids are
|
||||
often not in the index using this can speed up a program considerably.
|
||||
- New non-const WayNodeList::operator[].
|
||||
- Default constructed "invalid" Coordinates.
|
||||
- Tile constructor from web mercator coordinates and some helper
|
||||
functions for tile arithmetic.
|
||||
- Tag matcher matching keys using a regex.
|
||||
- New `envelope()` functions on `NodeRefList`, `Way`, and `Area` returning a
|
||||
`Box` object with the geometric envelope of the object.
|
||||
- Add `amenity_list` example.
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced the implementation for the web mercator projection using the usual
|
||||
tan-formula with a polynomial approximation which is much faster and good
|
||||
enough for OSM data which only has ~1cm resolution anyway. See
|
||||
https://github.com/osmcode/mercator-projection for all the details and
|
||||
benchmarks. You can disable this by defining the macro
|
||||
`OSMIUM_USE_SLOW_MERCATOR_PROJECTION` before including any of the Osmium
|
||||
headers.
|
||||
- Removed the outdated `Makefile`. Always use CMake directly to build.
|
||||
- Refactoring of `osmium::apply()` removing the resursive templates for faster
|
||||
compile times and allowing rvalue handlers.
|
||||
- Lots of code and test cleanups and more documentation.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Handle endianess on FreeBSD properly.
|
||||
- Fixed doxygen config for reproducible builds.
|
||||
|
||||
|
||||
## [2.10.3] - 2016-11-20
|
||||
|
||||
### Changed
|
||||
|
||||
- Round out ObjectPointerCollection implementation and test it.
|
||||
- Updated embedded protozero to 1.4.5.
|
||||
|
||||
|
||||
## [2.10.2] - 2016-11-16
|
||||
|
||||
### Changed
|
||||
@ -480,7 +525,8 @@ This project adheres to [Semantic Versioning](http://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.10.2...HEAD
|
||||
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.10.3...HEAD
|
||||
[2.10.3]: https://github.com/osmcode/libosmium/compare/v2.10.2...v2.10.3
|
||||
[2.10.2]: https://github.com/osmcode/libosmium/compare/v2.10.1...v2.10.2
|
||||
[2.10.1]: https://github.com/osmcode/libosmium/compare/v2.10.0...v2.10.1
|
||||
[2.10.0]: https://github.com/osmcode/libosmium/compare/v2.9.0...v2.10.0
|
||||
|
@ -24,8 +24,8 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Cover
|
||||
project(libosmium)
|
||||
|
||||
set(LIBOSMIUM_VERSION_MAJOR 2)
|
||||
set(LIBOSMIUM_VERSION_MINOR 10)
|
||||
set(LIBOSMIUM_VERSION_PATCH 2)
|
||||
set(LIBOSMIUM_VERSION_MINOR 11)
|
||||
set(LIBOSMIUM_VERSION_PATCH 0)
|
||||
|
||||
set(LIBOSMIUM_VERSION
|
||||
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
|
||||
|
@ -8,5 +8,5 @@ Some rules for contributing to this project:
|
||||
|
||||
* We'd love for you to send pull requests for fixes you have made or new features
|
||||
you have added. Please read the [notes for developers](NOTES_FOR_DEVELOPERS.md)
|
||||
beforehand which contain some coding guidelines.
|
||||
beforehand which contains some coding guidelines.
|
||||
|
||||
|
25
Makefile
25
Makefile
@ -1,25 +0,0 @@
|
||||
|
||||
all:
|
||||
mkdir -p build && cd build && cmake .. && $(MAKE)
|
||||
|
||||
doc:
|
||||
mkdir -p build && cd build && cmake .. && $(MAKE) doc
|
||||
|
||||
clean:
|
||||
if test -d build; then cd build && $(MAKE) clean; fi
|
||||
|
||||
distclean:
|
||||
rm -fr build
|
||||
|
||||
#deb:
|
||||
# debuild -I -us -uc
|
||||
#
|
||||
#deb-clean:
|
||||
# debuild clean
|
||||
|
||||
indent:
|
||||
astyle --style=java --indent-namespaces --indent-switches --pad-header --lineend=linux --suffix=none --recursive include/\*.hpp examples/\*.cpp test/\*.cpp
|
||||
# astyle --style=java --indent-namespaces --indent-switches --pad-header --unpad-paren --align-pointer=type --lineend=linux --suffix=none --recursive include/\*.hpp examples/\*.cpp test/\*.cpp
|
||||
|
||||
.PHONY: clean distclean deb deb-clean doc indent
|
||||
|
@ -72,9 +72,7 @@ different.
|
||||
* The ellipsis in variadic template never has a space to the left of it and
|
||||
always has a space to the right: `template <typename... TArgs>` etc.
|
||||
|
||||
Keep to the indentation and other styles used in the code. Use `make indent`
|
||||
in the toplevel directory to fix indentation and styling. It calls `astyle`
|
||||
with the right parameters. This program is in the `astyle` Debian package.
|
||||
Keep to the indentation and other styles used in the code.
|
||||
|
||||
|
||||
## C++11
|
||||
@ -85,14 +83,6 @@ compilers don't support them yet. This list might change as we get more data
|
||||
about which compilers support which feature and what operating system versions
|
||||
or distributions have which versions of these compilers installed.
|
||||
|
||||
GCC 4.6 - too old, not supported (Ubuntu 12.04 LTS)
|
||||
GCC 4.7.2 - can probably not be supported (Debian wheezy)
|
||||
GCC 4.7.3 - probably works
|
||||
GCC 4.8 - works and is supported from here on
|
||||
clang 3.0 - too old, not supported (Debian wheezy, Ubuntu 12.04 LTS)
|
||||
clang 3.2 - probably works
|
||||
clang 3.5 - works and is supported from here on
|
||||
|
||||
Use `include/osmium/util/compatibility.hpp` if there are compatibility problems
|
||||
between compilers due to different C++11 support.
|
||||
|
||||
@ -137,7 +127,7 @@ default cmake config. Run `ctest` to run them. Many more tests are needed.
|
||||
|
||||
All namespaces, classes, functions, attributes, etc. should be documented.
|
||||
|
||||
Osmium uses the Doxygen (www.doxygen.org) source code documentation system.
|
||||
If it is installed, the CMake configuration will add a new build target, so
|
||||
you can build it with `make doc`.
|
||||
Osmium uses the [Doxygen](http://www.doxygen.org) source code documentation
|
||||
system. If it is installed, the CMake configuration will add a new build
|
||||
target, so you can build it with `make doc`.
|
||||
|
||||
|
46
README.md
46
README.md
@ -4,15 +4,14 @@ http://osmcode.org/libosmium
|
||||
|
||||
A fast and flexible C++ library for working with OpenStreetMap data.
|
||||
|
||||
Libosmium works on Linux, Mac OSX and Windows.
|
||||
|
||||
[](https://travis-ci.org/osmcode/libosmium)
|
||||
[](https://ci.appveyor.com/project/Mapbox/libosmium)
|
||||
|
||||
Libosmium is developed on Linux, but also works on OSX and Windows (with some
|
||||
limitations).
|
||||
Please see the [Libosmium manual](http://osmcode.org/libosmium/manual.html)
|
||||
for more details than this README can provide.
|
||||
|
||||
There are a few applications that use the Osmium library in the examples
|
||||
directory. See the [osmium-contrib](http://github.com/osmcode/osmium-contrib)
|
||||
repository for more example code.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@ -24,8 +23,9 @@ Different parts of Libosmium (and the applications built on top of it) need
|
||||
different libraries. You DO NOT NEED to install all of them, just install those
|
||||
you need for your programs.
|
||||
|
||||
For details see the
|
||||
[list of dependencies](https://github.com/osmcode/libosmium/wiki/Libosmium-dependencies).
|
||||
For details see the [list of
|
||||
dependencies](http://osmcode.org/libosmium/manual.html#dependencies) in the
|
||||
manual.
|
||||
|
||||
The following external (header-only) libraries are included in the libosmium
|
||||
repository:
|
||||
@ -33,10 +33,6 @@ repository:
|
||||
* [protozero](https://github.com/mapbox/protozero)
|
||||
* [utfcpp](http://utfcpp.sourceforge.net/)
|
||||
|
||||
If you want (some of) those libraries to be installed along with libosmium
|
||||
itself when calling `make install`, you have to use the CMake options
|
||||
`INSTALL_GDALCPP`, `INSTALL_PROTOZERO`, and/or `INSTALL_UTFCPP`.
|
||||
|
||||
|
||||
## Directories
|
||||
|
||||
@ -44,7 +40,7 @@ itself when calling `make install`, you have to use the CMake options
|
||||
|
||||
* cmake: CMake configuration scripts.
|
||||
|
||||
* doc: Config for documentation.
|
||||
* doc: Config for API reference documentation.
|
||||
|
||||
* examples: Osmium example applications.
|
||||
|
||||
@ -69,37 +65,23 @@ cmake:
|
||||
|
||||
This will build the examples and tests. Call `ctest` to run the tests.
|
||||
|
||||
For more see the
|
||||
[Libosmium Wiki](https://github.com/osmcode/libosmium/wiki/Building-Libosmium).
|
||||
For more detals see the
|
||||
[Building Libosmium](http://osmcode.org/libosmium/manual.html#building-libosmium)
|
||||
chapter in the manual.
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
See the
|
||||
[Libosmium Wiki](https://github.com/osmcode/libosmium/wiki/Testing-Libosmium)
|
||||
[Libosmium Manual](http://osmcode.org/libosmium/manual.html#running-tests)
|
||||
for instructions.
|
||||
|
||||
|
||||
## Osmium on 32bit Machines
|
||||
|
||||
Osmium works well on 64 bit machines, but on 32 bit machines there are some
|
||||
problems. Be aware that not everything will work on 32 bit architectures.
|
||||
This is mostly due to the 64 bit needed for node IDs. Also Osmium hasn't been
|
||||
tested well on 32 bit systems. Here are some issues you might run into:
|
||||
|
||||
* Google Sparsehash does not work on 32 bit machines in our use case.
|
||||
* The `mmap` system call is called with a `size_t` argument, so it can't
|
||||
give you more than 4GByte of memory on 32 bit systems. This might be a
|
||||
problem.
|
||||
|
||||
Please report any issues you have and we might be able to solve them.
|
||||
|
||||
|
||||
## Switching from the old Osmium
|
||||
|
||||
If you have been using the old version of Osmium at
|
||||
https://github.com/joto/osmium you might want to read about the
|
||||
[changes needed](https://github.com/osmcode/libosmium/wiki/Changes-from-old-versions-of-Osmium).
|
||||
https://github.com/joto/osmium you might want to read about the [changes
|
||||
needed](http://osmcode.org/libosmium/manual.html#changes-from-old-versions-of-osmium).
|
||||
|
||||
|
||||
## License
|
||||
|
@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES
|
||||
# will be relative from the directory where doxygen is started.
|
||||
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
|
||||
|
||||
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/include
|
||||
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
|
||||
# path mentioned in the documentation of a class, which tells the reader which
|
||||
@ -755,7 +755,7 @@ WARN_LOGFILE =
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @PROJECT_SOURCE_DIR@/include/osmium \
|
||||
@PROJECT_SOURCE_DIR@/doc/doc.txt
|
||||
@PROJECT_SOURCE_DIR@/doc/doc.md
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
@ -891,7 +891,7 @@ FILTER_SOURCE_PATTERNS =
|
||||
# (index.html). This can be useful if you have a project on for instance GitHub
|
||||
# and want to reuse the introduction page also for the doxygen output.
|
||||
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
USE_MDFILE_AS_MAINPAGE = @PROJECT_SOURCE_DIR@/doc/doc.md
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
|
21
doc/doc.md
Normal file
21
doc/doc.md
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
Osmium is a fast and flexible C++ library for working with OpenStreetMap
|
||||
data.
|
||||
|
||||
This is the API documentation that was automatically created from the
|
||||
source code. For more information about the Osmium Library see
|
||||
http://osmcode.org/libosmium .
|
||||
|
||||
Osmium is free software and available under the Boost Software License.
|
||||
The source code is available at https://github.com/osmcode/libosmium .
|
||||
|
||||
Osmium is a header-only library. You do not need to compile and link it,
|
||||
just include the headers you need.
|
||||
|
||||
Everything in namespaces called "detail" is for internal Osmium use only,
|
||||
do not depend on it in your code. Do not include any include files in
|
||||
directories named "detail" directly. Include files in directories called
|
||||
"experimental" and everything in namespaces called "experimental" is
|
||||
unsupported and may change at any time regardless of the status of the rest
|
||||
of the library.
|
||||
|
26
doc/doc.txt
26
doc/doc.txt
@ -1,26 +0,0 @@
|
||||
|
||||
/**
|
||||
* @mainpage
|
||||
*
|
||||
* Osmium is a fast and flexible C++ library for working with OpenStreetMap
|
||||
* data.
|
||||
*
|
||||
* This is the API documentation that was automatically created from the
|
||||
* source code. For more information about the Osmium Library see
|
||||
* http://osmcode.org/libosmium .
|
||||
*
|
||||
* Osmium is free software and available under the Boost Software License.
|
||||
* The source code is available at https://github.com/osmcode/libosmium .
|
||||
*
|
||||
* Osmium is a header-only library. You do not need to compile and link it,
|
||||
* just include the headers you need.
|
||||
*
|
||||
* Everything in namespaces called "detail" is for internal Osmium use only,
|
||||
* do not depend on it in your code. Do not include any include files in
|
||||
* directories named "detail" directly. Include files in directories called
|
||||
* "experimental" and everything in namespaces called "experimental" is
|
||||
* unsupported and may change at any time regardless of the status of the rest
|
||||
* of the library.
|
||||
*
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@
|
||||
message(STATUS "Configuring examples")
|
||||
|
||||
set(EXAMPLES
|
||||
amenity_list
|
||||
area_test
|
||||
change_tags
|
||||
convert
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
The programs in this directory are intended as examples for developers. They
|
||||
contain extensive comments explaining what's going on. Note that the examples
|
||||
only cover a small part of what Osmium can do, you should also read the
|
||||
documentation and API documentation.
|
||||
only cover a small part of what Osmium can do, you should also read the manuals
|
||||
and API documentation.
|
||||
|
||||
All programs can be run without arguments and they will tell you how to run
|
||||
All programs can be run without arguments and they will tell you how to use
|
||||
them.
|
||||
|
||||
## Very simple examples
|
||||
@ -18,6 +18,7 @@ them.
|
||||
|
||||
## Still reasonably simple examples
|
||||
|
||||
* `osmium_amenity_list`
|
||||
* `osmium_read_with_progress`
|
||||
* `osmium_filter_discussions`
|
||||
* `osmium_convert`
|
||||
|
167
examples/osmium_amenity_list.cpp
Normal file
167
examples/osmium_amenity_list.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
|
||||
EXAMPLE osmium_amenity_list
|
||||
|
||||
Create a list of all amenities in the OSM input data. The type of amenity
|
||||
(tag value) and, if available, the name is printed. For nodes, the location
|
||||
is printed, for areas the center location.
|
||||
|
||||
DEMONSTRATES USE OF:
|
||||
* file input
|
||||
* location indexes and the NodeLocationsForWays handler
|
||||
* the MultipolygonCollector and Assembler to assemble areas (multipolygons)
|
||||
* your own handler that works with areas (multipolygons)
|
||||
* accessing tags
|
||||
* osmium::geom::Coordinates
|
||||
|
||||
SIMPLER EXAMPLES you might want to understand first:
|
||||
* osmium_read
|
||||
* osmium_count
|
||||
* osmium_debug
|
||||
|
||||
LICENSE
|
||||
The code in this example file is released into the Public Domain.
|
||||
|
||||
*/
|
||||
|
||||
#include <cstdio> // for std::printf
|
||||
#include <cstdlib> // for std::exit
|
||||
#include <iostream> // for std::cerr
|
||||
#include <string> // for std::string
|
||||
|
||||
// For memory based sparse index
|
||||
#include <osmium/index/map/sparse_mem_array.hpp>
|
||||
|
||||
// For the NodeLocationForWays handler
|
||||
#include <osmium/handler/node_locations_for_ways.hpp>
|
||||
using index_type = osmium::index::map::SparseMemArray<osmium::unsigned_object_id_type, osmium::Location>;
|
||||
using location_handler_type = osmium::handler::NodeLocationsForWays<index_type>;
|
||||
|
||||
// For assembling multipolygons
|
||||
#include <osmium/area/assembler.hpp>
|
||||
#include <osmium/area/multipolygon_collector.hpp>
|
||||
|
||||
// Allow any format of input files (XML, PBF, ...)
|
||||
#include <osmium/io/any_input.hpp>
|
||||
|
||||
// For osmium::apply()
|
||||
#include <osmium/visitor.hpp>
|
||||
|
||||
// For osmium::geom::Coordinates
|
||||
#include <osmium/geom/coordinates.hpp>
|
||||
|
||||
class AmenityHandler : public osmium::handler::Handler {
|
||||
|
||||
// Print info about one amenity to stdout.
|
||||
void print_amenity(const char* type, const char* name, const osmium::geom::Coordinates& c) {
|
||||
std::printf("%8.4f,%8.4f %-15s %s\n", c.x, c.y, type, name ? name : "");
|
||||
}
|
||||
|
||||
// Calculate the center point of a NodeRefList.
|
||||
osmium::geom::Coordinates calc_center(const osmium::NodeRefList& nr_list) {
|
||||
// Coordinates simply store an X and Y coordinate pair as doubles.
|
||||
// (Unlike osmium::Location which stores them more efficiently as
|
||||
// 32 bit integers.) Use Coordinates when you want to do calculations
|
||||
// or store projected coordinates.
|
||||
osmium::geom::Coordinates c{0.0, 0.0};
|
||||
|
||||
for (const auto& nr : nr_list) {
|
||||
c.x += nr.lon();
|
||||
c.y += nr.lat();
|
||||
}
|
||||
|
||||
c.x /= nr_list.size();
|
||||
c.y /= nr_list.size();
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
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.
|
||||
const char* amenity = node.tags()["amenity"];
|
||||
if (amenity) {
|
||||
print_amenity(amenity, node.tags()["name"], node.location());
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
// create_empty_areas = false in the assembler config, we can
|
||||
// be sure there will always be at least one outer ring.
|
||||
const auto center = calc_center(*area.cbegin<osmium::OuterRing>());
|
||||
|
||||
print_amenity(amenity, area.tags()["name"], center);
|
||||
}
|
||||
}
|
||||
|
||||
}; // class AmenityHandler
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " OSMFILE\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
// The input file name
|
||||
const std::string input_file_name{argv[1]};
|
||||
|
||||
// Configuration for the multipolygon assembler. We disable the option to
|
||||
// create empty areas when invalid multipolygons are encountered. This
|
||||
// means areas created have a valid geometry and invalid multipolygons
|
||||
// are simply ignored.
|
||||
osmium::area::Assembler::config_type assembler_config;
|
||||
assembler_config.create_empty_areas = false;
|
||||
|
||||
// Initialize the MultipolygonCollector. Its job is to collect all
|
||||
// relations and member ways needed for each area. It then calls an
|
||||
// instance of the osmium::area::Assembler class (with the given config)
|
||||
// to actually assemble one area.
|
||||
osmium::area::MultipolygonCollector<osmium::area::Assembler> collector{assembler_config};
|
||||
|
||||
// We read the input file twice. In the first pass, only relations are
|
||||
// read and fed into the multipolygon collector. The read_meta::no option
|
||||
// disables reading of meta data (such as version numbers, timestamps, etc.)
|
||||
// which are not needed in this case. Disabling this can speed up your
|
||||
// program.
|
||||
std::cerr << "Pass 1...\n";
|
||||
osmium::io::Reader reader1{input_file_name, osmium::osm_entity_bits::relation, osmium::io::read_meta::no};
|
||||
collector.read_relations(reader1);
|
||||
reader1.close();
|
||||
std::cerr << "Pass 1 done\n";
|
||||
|
||||
// The index storing all node locations.
|
||||
index_type index;
|
||||
|
||||
// The handler that stores all node locations in the index and adds them
|
||||
// to the ways.
|
||||
location_handler_type location_handler{index};
|
||||
|
||||
// If a location is not available in the index, we ignore it. It might
|
||||
// not be needed (if it is not part of a multipolygon relation), so why
|
||||
// create an error?
|
||||
location_handler.ignore_errors();
|
||||
|
||||
// Create our handler.
|
||||
AmenityHandler data_handler;
|
||||
|
||||
// On the second pass we read all objects and run them first through the
|
||||
// node location handler and then the multipolygon collector. The collector
|
||||
// will put the areas it has created into the "buffer" which are then
|
||||
// fed through our handler.
|
||||
std::cerr << "Pass 2...\n";
|
||||
osmium::io::Reader reader2{input_file_name, osmium::io::read_meta::no};
|
||||
|
||||
osmium::apply(reader2, location_handler, data_handler, collector.handler([&data_handler](const osmium::memory::Buffer& area_buffer) {
|
||||
osmium::apply(area_buffer, data_handler);
|
||||
}));
|
||||
|
||||
reader2.close();
|
||||
std::cerr << "Pass 2 done\n";
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
* osmium_read
|
||||
* osmium_count
|
||||
* osmium_debug
|
||||
* osmium_amenity_list
|
||||
|
||||
LICENSE
|
||||
The code in this example file is released into the Public Domain.
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -69,6 +69,7 @@ namespace osmium {
|
||||
* class given as template argument.
|
||||
*
|
||||
* @tparam TAssembler Multipolygon Assembler class.
|
||||
* @pre The Ids of all objects must be unique in the input data.
|
||||
*/
|
||||
template <typename TAssembler>
|
||||
class MultipolygonCollector : public osmium::relations::Collector<MultipolygonCollector<TAssembler>, false, true, false> {
|
||||
@ -87,7 +88,7 @@ namespace osmium {
|
||||
|
||||
void flush_output_buffer() {
|
||||
if (this->callback()) {
|
||||
osmium::memory::Buffer buffer(initial_output_buffer_size);
|
||||
osmium::memory::Buffer buffer{initial_output_buffer_size};
|
||||
using std::swap;
|
||||
swap(buffer, m_output_buffer);
|
||||
this->callback()(std::move(buffer));
|
||||
@ -195,7 +196,7 @@ namespace osmium {
|
||||
}
|
||||
|
||||
osmium::memory::Buffer read() {
|
||||
osmium::memory::Buffer buffer(initial_output_buffer_size, osmium::memory::Buffer::auto_grow::yes);
|
||||
osmium::memory::Buffer buffer{initial_output_buffer_size, osmium::memory::Buffer::auto_grow::yes};
|
||||
|
||||
using std::swap;
|
||||
swap(buffer, m_output_buffer);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -84,8 +84,8 @@ namespace osmium {
|
||||
|
||||
template <typename TSource, typename... THandlers>
|
||||
inline void apply_diff(TSource& source, THandlers&... handlers) {
|
||||
apply_diff(osmium::io::InputIterator<TSource, osmium::OSMObject> {source},
|
||||
osmium::io::InputIterator<TSource, osmium::OSMObject> {},
|
||||
apply_diff(osmium::io::InputIterator<TSource, osmium::OSMObject>{source},
|
||||
osmium::io::InputIterator<TSource, osmium::OSMObject>{},
|
||||
handlers...);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -104,7 +104,8 @@ auto _name_##_dispatch(THandler& handler, const osmium::_type_& object, long) ->
|
||||
}
|
||||
|
||||
template <typename THandler>
|
||||
void flush_dispatch(THandler&, long) {}
|
||||
void flush_dispatch(THandler&, long) {
|
||||
}
|
||||
|
||||
template <typename THandler>
|
||||
class HandlerWrapper : public HandlerWrapperBase {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -33,7 +33,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <iosfwd>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <osmium/osm/location.hpp>
|
||||
@ -48,18 +50,71 @@ namespace osmium {
|
||||
double x;
|
||||
double y;
|
||||
|
||||
explicit Coordinates(double cx, double cy) noexcept : x(cx), y(cy) {
|
||||
/**
|
||||
* Default constructor creates invalid coordinates.
|
||||
*/
|
||||
Coordinates() noexcept :
|
||||
x(std::numeric_limits<double>::quiet_NaN()),
|
||||
y(std::numeric_limits<double>::quiet_NaN()) {
|
||||
}
|
||||
|
||||
Coordinates(const osmium::Location& location) : x(location.lon()), y(location.lat()) {
|
||||
/**
|
||||
* Create Coordinates from doubles. If any of them is NaN, the
|
||||
* coordinates are invalid.
|
||||
*/
|
||||
explicit Coordinates(double cx, double cy) noexcept :
|
||||
x(cx),
|
||||
y(cy) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Coordinates from a Location. Will throw
|
||||
* osmium::invalid_location if the location is not valid.
|
||||
*/
|
||||
Coordinates(const osmium::Location& location) :
|
||||
x(location.lon()),
|
||||
y(location.lat()) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Coordinates are invalid if they have been default constructed.
|
||||
*/
|
||||
bool valid() const noexcept {
|
||||
return !std::isnan(x) && !std::isnan(y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert coordinates to text and append to given string. If the
|
||||
* coordinate is invalid, the fixed string "invalid" will be
|
||||
* added to the string.
|
||||
*
|
||||
* @param s String to append the coordinates to.
|
||||
* @param infix Character to print between the two coordinates.
|
||||
* @param precision Number of digits after the decimal point the
|
||||
* coordinate will be rounded to.
|
||||
*/
|
||||
void append_to_string(std::string& s, const char infix, int precision) const {
|
||||
osmium::util::double2string(s, x, precision);
|
||||
s += infix;
|
||||
osmium::util::double2string(s, y, precision);
|
||||
if (valid()) {
|
||||
osmium::util::double2string(s, x, precision);
|
||||
s += infix;
|
||||
osmium::util::double2string(s, y, precision);
|
||||
} else {
|
||||
s.append("invalid");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert coordinates to text and append to given string. If the
|
||||
* coordinate is invalid, the fixed string "invalid" will be
|
||||
* added to the string between the prefix and suffix characters.
|
||||
*
|
||||
* @param s String to append the coordinates to.
|
||||
* @param prefix Character to print before the first coordinate.
|
||||
* @param infix Character to print between the two coordinates.
|
||||
* @param suffix Character to print after the second coordinate.
|
||||
* @param precision Number of digits after the decimal point the
|
||||
* coordinate will be rounded to.
|
||||
*/
|
||||
void append_to_string(std::string& s, const char prefix, const char infix, const char suffix, int precision) const {
|
||||
s += prefix;
|
||||
append_to_string(s, infix, precision);
|
||||
@ -69,11 +124,18 @@ namespace osmium {
|
||||
}; // struct coordinates
|
||||
|
||||
/**
|
||||
* Compare whether two Coordinates are identical. Might not give the
|
||||
* right result if the coordinates have been the result of some
|
||||
* Check whether two Coordinates are equal. Invalid coordinates are
|
||||
* equal to other invalid coordinates but not equal to any valid
|
||||
* coordinates.
|
||||
*
|
||||
* Because this is comparing floating point values, it might not give
|
||||
* the right result if the coordinates have been the result of some
|
||||
* calculation that introduced rounding errors.
|
||||
*/
|
||||
inline bool operator==(const Coordinates& lhs, const Coordinates& rhs) noexcept {
|
||||
if (!lhs.valid() && !rhs.valid()) {
|
||||
return true;
|
||||
}
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
return lhs.x == rhs.x && lhs.y == rhs.y;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -60,6 +60,8 @@ namespace osmium {
|
||||
|
||||
/**
|
||||
* Calculate distance in meters between two sets of coordinates.
|
||||
*
|
||||
* @pre @code c1.valid() && c2.valid() @endcode
|
||||
*/
|
||||
inline double distance(const osmium::geom::Coordinates& c1, const osmium::geom::Coordinates& c2) {
|
||||
double lonh = sin(deg_to_rad(c1.x - c2.x) * 0.5);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -53,10 +53,49 @@ namespace osmium {
|
||||
return earth_radius_for_epsg3857 * deg_to_rad(lon);
|
||||
}
|
||||
|
||||
inline double lat_to_y(double lat) { // not constexpr because math functions aren't
|
||||
inline double lat_to_y_with_tan(double lat) { // not constexpr because math functions aren't
|
||||
return earth_radius_for_epsg3857 * std::log(std::tan(osmium::geom::PI/4 + deg_to_rad(lat)/2));
|
||||
}
|
||||
|
||||
#ifdef OSMIUM_USE_SLOW_MERCATOR_PROJECTION
|
||||
inline double lat_to_y(double lat) {
|
||||
return lat_to_y_with_tan(lat);
|
||||
}
|
||||
#else
|
||||
|
||||
// This is a much faster implementation than the canonical
|
||||
// implementation using the tan() function. For details
|
||||
// see https://github.com/osmcode/mercator-projection .
|
||||
inline double lat_to_y(double lat) { // not constexpr because math functions aren't
|
||||
if (lat < -78.0 || lat > 78.0) {
|
||||
return lat_to_y_with_tan(lat);
|
||||
}
|
||||
|
||||
return earth_radius_for_epsg3857 *
|
||||
((((((((((-3.1112583378460085319e-23 * lat +
|
||||
2.0465852743943268009e-19) * lat +
|
||||
6.4905282018672673884e-18) * lat +
|
||||
-1.9685447939983315591e-14) * lat +
|
||||
-2.2022588158115104182e-13) * lat +
|
||||
5.1617537365509453239e-10) * lat +
|
||||
2.5380136069803016519e-9) * lat +
|
||||
-5.1448323697228488745e-6) * lat +
|
||||
-9.4888671473357768301e-6) * lat +
|
||||
1.7453292518154191887e-2) * lat)
|
||||
/
|
||||
((((((((((-1.9741136066814230637e-22 * lat +
|
||||
-1.258514031244679556e-20) * lat +
|
||||
4.8141483273572351796e-17) * lat +
|
||||
8.6876090870176172185e-16) * lat +
|
||||
-2.3298743439377541768e-12) * lat +
|
||||
-1.9300094785736130185e-11) * lat +
|
||||
4.3251609106864178231e-8) * lat +
|
||||
1.7301944508516974048e-7) * lat +
|
||||
-3.4554675198786337842e-4) * lat +
|
||||
-5.4367203601085991108e-4) * lat + 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
constexpr inline double x_to_lon(double x) {
|
||||
return rad_to_deg(x) / earth_radius_for_epsg3857;
|
||||
}
|
||||
@ -73,10 +112,20 @@ namespace osmium {
|
||||
*/
|
||||
constexpr double MERCATOR_MAX_LAT = 85.0511288;
|
||||
|
||||
/**
|
||||
* Convert the coordinates from WGS84 lon/lat to web mercator.
|
||||
*
|
||||
* @pre @code c.valid() @endcode
|
||||
*/
|
||||
inline Coordinates lonlat_to_mercator(const Coordinates& c) {
|
||||
return Coordinates(detail::lon_to_x(c.x), detail::lat_to_y(c.y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the coordinates from web mercator to WGS84 lon/lat.
|
||||
*
|
||||
* @pre @code c.valid() @endcode
|
||||
*/
|
||||
inline Coordinates mercator_to_lonlat(const Coordinates& c) {
|
||||
return Coordinates(detail::x_to_lon(c.x), detail::y_to_lat(c.y));
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -47,14 +47,52 @@ namespace osmium {
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
inline T restrict_to_range(T value, T min, T max) {
|
||||
if (value < min) return min;
|
||||
if (value > max) return max;
|
||||
return value;
|
||||
inline constexpr const T& clamp(const T& value, const T& min, const T& max) {
|
||||
return value < min ? min : (max < value ? max : value);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* Returns the number of tiles (in each direction) for the given zoom
|
||||
* level.
|
||||
*/
|
||||
inline constexpr uint32_t num_tiles_in_zoom(uint32_t zoom) noexcept {
|
||||
return 1u << zoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width or hight of a tile in web mercator coordinates for
|
||||
* the given zoom level.
|
||||
*/
|
||||
inline constexpr double tile_extent_in_zoom(uint32_t zoom) noexcept {
|
||||
return detail::max_coordinate_epsg3857 * 2 / num_tiles_in_zoom(zoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tile x number from an x coordinate in web mercator
|
||||
* projection in the given zoom level. Tiles are numbered from left
|
||||
* to right.
|
||||
*/
|
||||
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
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tile y number from an y coordinate in web mercator
|
||||
* projection in the given zoom level. Tiles are numbered from top
|
||||
* to bottom.
|
||||
*/
|
||||
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
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* A tile in the usual Mercator projection.
|
||||
*/
|
||||
@ -77,10 +115,13 @@ namespace osmium {
|
||||
*
|
||||
* @pre @code zoom <= 30 && x < 2^zoom && y < 2^zoom @endcode
|
||||
*/
|
||||
explicit Tile(uint32_t zoom, uint32_t tx, uint32_t ty) noexcept : x(tx), y(ty), z(zoom) {
|
||||
explicit Tile(uint32_t zoom, uint32_t tx, uint32_t ty) noexcept :
|
||||
x(tx),
|
||||
y(ty),
|
||||
z(zoom) {
|
||||
assert(zoom <= 30u);
|
||||
assert(x < (1u << zoom));
|
||||
assert(y < (1u << zoom));
|
||||
assert(x < num_tiles_in_zoom(zoom));
|
||||
assert(y < num_tiles_in_zoom(zoom));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,11 +136,24 @@ namespace osmium {
|
||||
z(zoom) {
|
||||
assert(zoom <= 30u);
|
||||
assert(location.valid());
|
||||
const osmium::geom::Coordinates c = lonlat_to_mercator(location);
|
||||
const int32_t n = 1 << zoom;
|
||||
const double scale = detail::max_coordinate_epsg3857 * 2 / n;
|
||||
x = uint32_t(detail::restrict_to_range<int32_t>(int32_t((c.x + detail::max_coordinate_epsg3857) / scale), 0, n-1));
|
||||
y = uint32_t(detail::restrict_to_range<int32_t>(int32_t((detail::max_coordinate_epsg3857 - c.y) / scale), 0, n-1));
|
||||
const auto coordinates = lonlat_to_mercator(location);
|
||||
x = mercx_to_tilex(zoom, coordinates.x);
|
||||
y = mercy_to_tiley(zoom, coordinates.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tile with the given zoom level that contains the given
|
||||
* coordinates in Mercator projection.
|
||||
*
|
||||
* The values are not checked for validity.
|
||||
*
|
||||
* @pre @code coordinates.valid() && zoom <= 30 @endcode
|
||||
*/
|
||||
explicit Tile(uint32_t zoom, const osmium::geom::Coordinates& coordinates) :
|
||||
z(zoom) {
|
||||
assert(zoom <= 30u);
|
||||
x = mercx_to_tilex(zoom, coordinates.x);
|
||||
y = mercy_to_tiley(zoom, coordinates.y);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +165,7 @@ namespace osmium {
|
||||
if (z > 30) {
|
||||
return false;
|
||||
}
|
||||
const uint32_t max = 1 << z;
|
||||
const auto max = num_tiles_in_zoom(z);
|
||||
return x < max && y < max;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -74,7 +74,7 @@ namespace osmium {
|
||||
struct call_flush {
|
||||
void operator()(THandlers& handlers) {
|
||||
std::get<N>(handlers).flush();
|
||||
call_flush<N+1, SIZE, THandlers>()(handlers);
|
||||
call_flush<N + 1, SIZE, THandlers>()(handlers);
|
||||
}
|
||||
}; // struct call_flush
|
||||
|
||||
@ -107,7 +107,7 @@ namespace osmium {
|
||||
call_relation<0, sizeof...(THandler), handlers_type>()(m_handlers, relation);
|
||||
}
|
||||
|
||||
void changeset( osmium::Changeset& changeset) {
|
||||
void changeset(osmium::Changeset& changeset) {
|
||||
call_changeset<0, sizeof...(THandler), handlers_type>()(m_handlers, changeset);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -67,8 +67,10 @@ namespace osmium {
|
||||
* Handler that can be used to check that an OSM file is ordered
|
||||
* correctly. Ordered in this case refers to the usual order in OSM
|
||||
* files: First nodes in the order of their IDs, then ways in the order
|
||||
* of their IDs, then relations in the order or their IDs. IDs have to
|
||||
* be unique for each type.
|
||||
* of their IDs, then relations in the order or their IDs.
|
||||
*
|
||||
* IDs have to be unique for each type. This check will fail for
|
||||
* history files.
|
||||
*
|
||||
* To use this add a CheckOrder member variable to your handler and
|
||||
* call the node(), way(), and relation() methods from your node(),
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -83,9 +83,9 @@ namespace osmium {
|
||||
|
||||
osmium::unsigned_object_id_type m_last_id{0};
|
||||
|
||||
bool m_ignore_errors {false};
|
||||
bool m_ignore_errors{false};
|
||||
|
||||
bool m_must_sort {false};
|
||||
bool m_must_sort{false};
|
||||
|
||||
// It is okay to have this static dummy instance, even when using several threads,
|
||||
// because it is read-only.
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -103,22 +103,27 @@ namespace osmium {
|
||||
return m_size == 0;
|
||||
}
|
||||
|
||||
const T* data() const {
|
||||
const_pointer data() const {
|
||||
return m_mapping.begin();
|
||||
}
|
||||
|
||||
T* data() {
|
||||
pointer data() {
|
||||
return m_mapping.begin();
|
||||
}
|
||||
|
||||
T& operator[](size_t n) {
|
||||
const_reference operator[](size_t n) const {
|
||||
assert(n < m_size);
|
||||
return data()[n];
|
||||
}
|
||||
|
||||
T at(size_t n) const {
|
||||
reference operator[](size_t n) {
|
||||
assert(n < m_size);
|
||||
return data()[n];
|
||||
}
|
||||
|
||||
value_type at(size_t n) const {
|
||||
if (n >= m_size) {
|
||||
throw std::out_of_range("out of range");
|
||||
throw std::out_of_range{"out of range"};
|
||||
}
|
||||
return data()[n];
|
||||
}
|
||||
@ -128,21 +133,21 @@ namespace osmium {
|
||||
}
|
||||
|
||||
void shrink_to_fit() {
|
||||
while (m_size > 0 && data()[m_size - 1] == osmium::index::empty_value<T>()) {
|
||||
while (m_size > 0 && data()[m_size - 1] == osmium::index::empty_value<value_type>()) {
|
||||
--m_size;
|
||||
}
|
||||
}
|
||||
|
||||
void push_back(const T& value) {
|
||||
resize(m_size+1);
|
||||
data()[m_size-1] = value;
|
||||
void push_back(const_reference value) {
|
||||
resize(m_size + 1);
|
||||
data()[m_size - 1] = value;
|
||||
}
|
||||
|
||||
void reserve(size_t new_capacity) {
|
||||
if (new_capacity > capacity()) {
|
||||
const size_t old_capacity = capacity();
|
||||
m_mapping.resize(new_capacity);
|
||||
std::fill(data() + old_capacity, data() + new_capacity, osmium::index::empty_value<T>());
|
||||
std::fill(data() + old_capacity, data() + new_capacity, osmium::index::empty_value<value_type>());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -81,16 +81,22 @@ namespace osmium {
|
||||
m_vector[id] = value;
|
||||
}
|
||||
|
||||
const TValue get(const TId id) const final {
|
||||
try {
|
||||
const TValue& value = m_vector.at(id);
|
||||
if (value == osmium::index::empty_value<TValue>()) {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
return value;
|
||||
} catch (const std::out_of_range&) {
|
||||
TValue get(const TId id) const final {
|
||||
if (id >= m_vector.size()) {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
const TValue value = m_vector[id];
|
||||
if (value == osmium::index::empty_value<TValue>()) {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
TValue get_noexcept(const TId id) const noexcept final {
|
||||
if (id >= m_vector.size()) {
|
||||
return osmium::index::empty_value<TValue>();
|
||||
}
|
||||
return m_vector[id];
|
||||
}
|
||||
|
||||
size_t size() const final {
|
||||
@ -155,6 +161,16 @@ namespace osmium {
|
||||
|
||||
vector_type m_vector;
|
||||
|
||||
typename vector_type::const_iterator find_id(const TId id) const noexcept {
|
||||
const element_type element {
|
||||
id,
|
||||
osmium::index::empty_value<TValue>()
|
||||
};
|
||||
return std::lower_bound(m_vector.begin(), m_vector.end(), element, [](const element_type& a, const element_type& b) {
|
||||
return a.first < b.first;
|
||||
});
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
VectorBasedSparseMap() :
|
||||
@ -171,19 +187,22 @@ namespace osmium {
|
||||
m_vector.push_back(element_type(id, value));
|
||||
}
|
||||
|
||||
const TValue get(const TId id) const final {
|
||||
const element_type element {
|
||||
id,
|
||||
osmium::index::empty_value<TValue>()
|
||||
};
|
||||
const auto result = std::lower_bound(m_vector.begin(), m_vector.end(), element, [](const element_type& a, const element_type& b) {
|
||||
return a.first < b.first;
|
||||
});
|
||||
TValue get(const TId id) const final {
|
||||
const auto result = find_id(id);
|
||||
if (result == m_vector.end() || result->first != id) {
|
||||
throw osmium::not_found{id};
|
||||
} else {
|
||||
return result->second;
|
||||
}
|
||||
|
||||
return result->second;
|
||||
}
|
||||
|
||||
TValue get_noexcept(const TId id) const noexcept final {
|
||||
const auto result = find_id(id);
|
||||
if (result == m_vector.end() || result->first != id) {
|
||||
return osmium::index::empty_value<TValue>();
|
||||
}
|
||||
|
||||
return result->second;
|
||||
}
|
||||
|
||||
size_t size() const final {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -126,8 +126,25 @@ namespace osmium {
|
||||
/// Set the field with id to value.
|
||||
virtual void set(const TId id, const TValue value) = 0;
|
||||
|
||||
/// Retrieve value by id. Does not check for overflow or empty fields.
|
||||
virtual const TValue get(const TId id) const = 0;
|
||||
/**
|
||||
* Retrieve value by id.
|
||||
*
|
||||
* @param id The id to look for.
|
||||
* @returns Value.
|
||||
* @throws osmium::not_found if the id could not be found.
|
||||
*/
|
||||
virtual TValue get(const TId id) const = 0;
|
||||
|
||||
/**
|
||||
* Retrieve value by id.
|
||||
*
|
||||
* @param id The id to look for.
|
||||
* @returns Value or, if not found, the empty value as defined
|
||||
* by osmium::index::empty_value<TValue>() which is
|
||||
* usually the default constructed value of type
|
||||
* TValue.
|
||||
*/
|
||||
virtual TValue get_noexcept(const TId id) const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Get the approximate number of items in the storage. The storage
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -62,10 +62,14 @@ namespace osmium {
|
||||
// intentionally left blank
|
||||
}
|
||||
|
||||
const TValue get(const TId id) const final {
|
||||
TValue get(const TId id) const final {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
|
||||
TValue get_noexcept(const TId /*id*/) const noexcept final {
|
||||
return osmium::index::empty_value<TValue>();
|
||||
}
|
||||
|
||||
size_t size() const final {
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -76,14 +76,22 @@ namespace osmium {
|
||||
m_elements[id] = value;
|
||||
}
|
||||
|
||||
const TValue get(const TId id) const final {
|
||||
auto it = m_elements.find(id);
|
||||
TValue get(const TId id) const final {
|
||||
const auto it = m_elements.find(id);
|
||||
if (it == m_elements.end()) {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
TValue get_noexcept(const TId id) const noexcept final {
|
||||
const auto it = m_elements.find(id);
|
||||
if (it == m_elements.end()) {
|
||||
return osmium::index::empty_value<TValue>();
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
size_t size() const noexcept final {
|
||||
return m_elements.size();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@ -97,13 +97,21 @@ namespace osmium {
|
||||
m_elements[id] = value;
|
||||
}
|
||||
|
||||
const TValue get(const TId id) const final {
|
||||
TValue get(const TId id) const final {
|
||||
if (id >= m_elements.size()) {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
if (m_elements[id] == osmium::index::empty_value<TValue>()) {
|
||||
const TValue value = m_elements[id];
|
||||
if (value == osmium::index::empty_value<TValue>()) {
|
||||
throw osmium::not_found{id};
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
TValue get_noexcept(const TId id) const noexcept final {
|
||||
if (id >= m_elements.size()) {
|
||||
return osmium::index::empty_value<TValue>();
|
||||
}
|
||||
return m_elements[id];
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
292
include/osmium/index/relations_map.hpp
Normal file
292
include/osmium/index/relations_map.hpp
Normal file
@ -0,0 +1,292 @@
|
||||
#ifndef OSMIUM_INDEX_RELATIONS_MAP_HPP
|
||||
#define OSMIUM_INDEX_RELATIONS_MAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2017 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 <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/osm/relation.hpp>
|
||||
#include <osmium/osm/types.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename TKey, typename TKeyInternal, typename TValue, typename TValueInternal>
|
||||
class flat_map {
|
||||
|
||||
public:
|
||||
|
||||
using key_type = TKey;
|
||||
using value_type = TValue;
|
||||
|
||||
private:
|
||||
|
||||
struct kv_pair {
|
||||
TKeyInternal key;
|
||||
TValueInternal value;
|
||||
|
||||
explicit kv_pair(key_type key_id) :
|
||||
key(static_cast<TKeyInternal>(key_id)),
|
||||
value() {
|
||||
}
|
||||
|
||||
kv_pair(key_type key_id, value_type value_id) :
|
||||
key(static_cast<TKeyInternal>(key_id)),
|
||||
value(static_cast<TValueInternal>(value_id)) {
|
||||
}
|
||||
|
||||
bool operator<(const kv_pair& other) const noexcept {
|
||||
return std::tie(key, value) < std::tie(other.key, other.value);
|
||||
}
|
||||
|
||||
bool operator==(const kv_pair& other) const noexcept {
|
||||
return std::tie(key, value) == std::tie(other.key, other.value);
|
||||
}
|
||||
}; // struct kv_pair
|
||||
|
||||
std::vector<kv_pair> m_map;
|
||||
|
||||
public:
|
||||
|
||||
using const_iterator = typename std::vector<kv_pair>::const_iterator;
|
||||
|
||||
void set(key_type key, value_type value) {
|
||||
m_map.emplace_back(key, value);
|
||||
}
|
||||
|
||||
void sort_unique() {
|
||||
std::sort(m_map.begin(), m_map.end());
|
||||
const auto last = std::unique(m_map.begin(), m_map.end());
|
||||
m_map.erase(last, m_map.end());
|
||||
}
|
||||
|
||||
std::pair<const_iterator, const_iterator> get(key_type key) const noexcept {
|
||||
return std::equal_range(m_map.begin(), m_map.end(), kv_pair{key}, [](const kv_pair& lhs, const kv_pair& rhs) {
|
||||
return lhs.key < rhs.key;
|
||||
});
|
||||
}
|
||||
|
||||
bool empty() const noexcept {
|
||||
return m_map.empty();
|
||||
}
|
||||
|
||||
size_t size() const noexcept {
|
||||
return m_map.size();
|
||||
}
|
||||
|
||||
}; // class flat_map
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* Index for looking up parent relation IDs given a member relation ID.
|
||||
* You can not instantiate such an index yourself, instead you need to
|
||||
* instantiate a RelationsMapStash, fill it and then create an index from
|
||||
* it:
|
||||
*
|
||||
* @code
|
||||
* RelationsMapStash stash;
|
||||
* ...
|
||||
* for_each_relation(const osmium::Relation& relation) {
|
||||
* stash.add_members(relation);
|
||||
* }
|
||||
* ...
|
||||
* const auto index = stash.build_index();
|
||||
* ...
|
||||
* osmium::unsigned_object_id_type member_id = ...;
|
||||
* index.for_each_parent(member_id, [](osmium::unsigned_object_id_type id) {
|
||||
* ...
|
||||
* });
|
||||
* ...
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
class RelationsMapIndex {
|
||||
|
||||
friend class RelationsMapStash;
|
||||
|
||||
using map_type = detail::flat_map<osmium::unsigned_object_id_type, uint32_t,
|
||||
osmium::unsigned_object_id_type, uint32_t>;
|
||||
|
||||
map_type m_map;
|
||||
|
||||
RelationsMapIndex(map_type&& map) :
|
||||
m_map(std::move(map)) {
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
RelationsMapIndex() = delete;
|
||||
|
||||
RelationsMapIndex(const RelationsMapIndex&) = delete;
|
||||
RelationsMapIndex& operator=(const RelationsMapIndex&) = delete;
|
||||
|
||||
RelationsMapIndex(RelationsMapIndex&&) = default;
|
||||
RelationsMapIndex& operator=(RelationsMapIndex&&) = default;
|
||||
|
||||
/**
|
||||
* Find the given relation id in the index and call the given function
|
||||
* with all parent relation ids.
|
||||
*
|
||||
* @code
|
||||
* osmium::unsigned_object_id_type member_id = 17;
|
||||
* index.for_each_parent(member_id, [](osmium::unsigned_object_id_type id) {
|
||||
* ...
|
||||
* });
|
||||
* @endcode
|
||||
*
|
||||
* Complexity: Logarithmic in the number of elements in the index.
|
||||
* (Lookup uses binary search.)
|
||||
*/
|
||||
template <typename Func>
|
||||
void for_each_parent(osmium::unsigned_object_id_type member_id, Func&& func) const {
|
||||
const auto parents = m_map.get(member_id);
|
||||
for (auto it = parents.first; it != parents.second; ++it) {
|
||||
std::forward<Func>(func)(it->value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this index empty?
|
||||
*
|
||||
* Complexity: Constant.
|
||||
*/
|
||||
bool empty() const noexcept {
|
||||
return m_map.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* How many entries are in this index?
|
||||
*
|
||||
* Complexity: Constant.
|
||||
*/
|
||||
size_t size() const noexcept {
|
||||
return m_map.size();
|
||||
}
|
||||
|
||||
}; // RelationsMapIndex
|
||||
|
||||
/**
|
||||
* The RelationsMapStash is used to build up the data needed to create
|
||||
* an index of member relation ID to parent relation ID. See the
|
||||
* RelationsMapIndex class for more.
|
||||
*/
|
||||
class RelationsMapStash {
|
||||
|
||||
using map_type = detail::flat_map<osmium::unsigned_object_id_type, uint32_t,
|
||||
osmium::unsigned_object_id_type, uint32_t>;
|
||||
|
||||
map_type m_map;
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool m_valid = true;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
RelationsMapStash() = default;
|
||||
|
||||
RelationsMapStash(const RelationsMapStash&) = delete;
|
||||
RelationsMapStash& operator=(const RelationsMapStash&) = delete;
|
||||
|
||||
RelationsMapStash(RelationsMapStash&&) = default;
|
||||
RelationsMapStash& operator=(RelationsMapStash&&) = default;
|
||||
|
||||
/**
|
||||
* Add mapping from member to parent relation in the stash.
|
||||
*/
|
||||
void add(osmium::unsigned_object_id_type member_id, osmium::unsigned_object_id_type relation_id) {
|
||||
assert(m_valid && "You can't use the RelationsMap any more after calling build_index()");
|
||||
m_map.set(member_id, relation_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add mapping from all members to given parent relation in the stash.
|
||||
*/
|
||||
void add_members(const osmium::Relation& relation) {
|
||||
assert(m_valid && "You can't use the RelationsMap any more after calling build_index()");
|
||||
for (const auto& member : relation.members()) {
|
||||
if (member.type() == osmium::item_type::relation) {
|
||||
m_map.set(member.positive_ref(), relation.positive_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this stash empty?
|
||||
*
|
||||
* Complexity: Constant.
|
||||
*/
|
||||
bool empty() const noexcept {
|
||||
assert(m_valid && "You can't use the RelationsMap any more after calling build_index()");
|
||||
return m_map.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* How many entries are in this stash?
|
||||
*
|
||||
* Complexity: Constant.
|
||||
*/
|
||||
size_t size() const noexcept {
|
||||
assert(m_valid && "You can't use the RelationsMap any more after calling build_index()");
|
||||
return m_map.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an index with the contents of this stash and return it.
|
||||
*
|
||||
* After you get the index you can not use the stash any more!
|
||||
*/
|
||||
RelationsMapIndex build_index() {
|
||||
assert(m_valid && "You can't use the RelationsMap any more after calling build_index()");
|
||||
m_map.sort_unique();
|
||||
#ifndef NDEBUG
|
||||
m_valid = false;
|
||||
#endif
|
||||
return RelationsMapIndex{std::move(m_map)};
|
||||
}
|
||||
|
||||
}; // class RelationsMapStash
|
||||
|
||||
} // namespace index
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_RELATIONS_MAP_HPP
|
@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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 (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2017 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