1 #ifndef OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP 2 #define OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP 37 #include <type_traits> 64 template <
typename TStoragePosIDs,
typename TStorageNegIDs = dummy_type>
68 using based_on_map = std::is_base_of<osmium::index::map::Map<osmium::unsigned_object_id_type, osmium::Location>, T>;
100 TStorageNegIDs& storage_neg =
get_dummy()) :
126 const auto id =
node.id();
128 m_storage_pos.set(static_cast<osmium::unsigned_object_id_type>(
id),
node.location());
130 m_storage_neg.set(static_cast<osmium::unsigned_object_id_type>(-
id),
node.location());
139 return m_storage_pos.get_noexcept(static_cast<osmium::unsigned_object_id_type>(
id));
141 return m_storage_neg.get_noexcept(static_cast<osmium::unsigned_object_id_type>(-
id));
154 m_last_id = std::numeric_limits<osmium::unsigned_object_id_type>::max();
157 for (
auto& node_ref :
way.nodes()) {
159 if (!node_ref.location()) {
164 throw osmium::not_found{
"location for one or more nodes not found in node location index"};
184 #endif // OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP
bool m_ignore_errors
Definition: node_locations_for_ways.hpp:86
void way(osmium::Way &way)
Definition: node_locations_for_ways.hpp:149
std::is_base_of< osmium::index::map::Map< osmium::unsigned_object_id_type, osmium::Location >, T > based_on_map
Definition: node_locations_for_ways.hpp:68
uint64_t unsigned_object_id_type
Type for OSM object (node, way, or relation) IDs where we only allow positive IDs.
Definition: types.hpp:46
bool m_must_sort
Definition: node_locations_for_ways.hpp:88
void ignore_errors()
Definition: node_locations_for_ways.hpp:113
Definition: handler.hpp:71
~NodeLocationsForWays() noexcept=default
static dummy_type & get_dummy()
Definition: node_locations_for_ways.hpp:92
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53
osmium::unsigned_object_id_type m_last_id
Definition: node_locations_for_ways.hpp:84
TStoragePosIDs & m_storage_pos
Object that handles the actual storage of the node locations (with positive IDs). ...
Definition: node_locations_for_ways.hpp:79
int64_t object_id_type
Type for OSM object (node, way, or relation) IDs.
Definition: types.hpp:45
TStorageNegIDs index_neg_type
Definition: node_locations_for_ways.hpp:74
TStorageNegIDs & m_storage_neg
Object that handles the actual storage of the node locations (with negative IDs). ...
Definition: node_locations_for_ways.hpp:82
Definition: location.hpp:273
NodeLocationsForWays & operator=(const NodeLocationsForWays &)=delete
TStoragePosIDs index_pos_type
Definition: node_locations_for_ways.hpp:73
osmium::Location get_node_location(const osmium::object_id_type id) const
Definition: node_locations_for_ways.hpp:137
NodeLocationsForWays(TStoragePosIDs &storage_pos, TStorageNegIDs &storage_neg=get_dummy())
Definition: node_locations_for_ways.hpp:99
Definition: node_locations_for_ways.hpp:65
void node(const osmium::Node &node)
Definition: node_locations_for_ways.hpp:120
void clear()
Definition: node_locations_for_ways.hpp:173