1 #ifndef OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP
2 #define OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP
36 #include <type_traits>
63 template <
typename TStoragePosIDs,
typename TStorageNegIDs = dummy_type>
88 static dummy_type instance;
95 TStorageNegIDs& storage_neg =
get_dummy()) :
96 m_storage_pos(storage_pos),
97 m_storage_neg(storage_neg) {
119 m_storage_pos.set(static_cast<osmium::unsigned_object_id_type>(
id), node.
location());
121 m_storage_neg.set(static_cast<osmium::unsigned_object_id_type>(-
id), node.
location());
130 return m_storage_pos.get(static_cast<osmium::unsigned_object_id_type>(
id));
132 return m_storage_neg.get(static_cast<osmium::unsigned_object_id_type>(-
id));
142 m_storage_pos.sort();
143 m_storage_neg.sort();
147 for (
auto& node_ref : way.
nodes()) {
150 if (!node_ref.location()) {
158 throw osmium::not_found(
"location for one or more nodes not found in node location index");
168 m_storage_pos.clear();
169 m_storage_neg.clear();
178 #endif // OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP
WayNodeList & nodes()
Definition: way.hpp:75
bool m_ignore_errors
Definition: node_locations_for_ways.hpp:81
osmium::index::map::Dummy< osmium::unsigned_object_id_type, osmium::Location > dummy_type
Definition: node_locations_for_ways.hpp:53
void way(osmium::Way &way)
Definition: node_locations_for_ways.hpp:140
bool m_must_sort
Definition: node_locations_for_ways.hpp:83
void ignore_errors()
Definition: node_locations_for_ways.hpp:108
Definition: handler.hpp:45
~NodeLocationsForWays() noexcept=default
static dummy_type & get_dummy()
Definition: node_locations_for_ways.hpp:87
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
Namespace for everything in the Osmium library.
Definition: assembler.hpp:59
TStoragePosIDs & m_storage_pos
Object that handles the actual storage of the node locations (with positive IDs). ...
Definition: node_locations_for_ways.hpp:76
TStorageNegIDs & m_storage_neg
Object that handles the actual storage of the node locations (with negative IDs). ...
Definition: node_locations_for_ways.hpp:79
Definition: location.hpp:79
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:110
osmium::Location location() const noexcept
Definition: node.hpp:61
NodeLocationsForWays & operator=(const NodeLocationsForWays &)=delete
NodeLocationsForWays(TStoragePosIDs &storage_pos, TStorageNegIDs &storage_neg=get_dummy())
Definition: node_locations_for_ways.hpp:94
TStorageNegIDs index_neg_type
Definition: node_locations_for_ways.hpp:71
Definition: node_locations_for_ways.hpp:64
void node(const osmium::Node &node)
Definition: node_locations_for_ways.hpp:115
osmium::Location get_node_location(const osmium::object_id_type id) const
Definition: node_locations_for_ways.hpp:128
void clear()
Definition: node_locations_for_ways.hpp:167
TStoragePosIDs index_pos_type
Definition: node_locations_for_ways.hpp:70