1 #ifndef OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP 2 #define OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP 47 #include <type_traits> 63 template <
typename TStoragePosIDs,
typename TStorageNegIDs = dummy_type>
67 using based_on_map = std::is_base_of<osmium::index::map::Map<osmium::unsigned_object_id_type, osmium::Location>, T>;
99 TStorageNegIDs& storage_neg =
get_dummy()) noexcept :
125 const auto id =
node.id();
127 m_storage_pos.set(static_cast<osmium::unsigned_object_id_type>(
id),
node.location());
129 m_storage_neg.set(static_cast<osmium::unsigned_object_id_type>(-
id),
node.location());
138 return m_storage_pos.get_noexcept(static_cast<osmium::unsigned_object_id_type>(
id));
140 return m_storage_neg.get_noexcept(static_cast<osmium::unsigned_object_id_type>(-
id));
152 m_last_id = std::numeric_limits<osmium::unsigned_object_id_type>::max();
155 for (
auto& node_ref :
way.nodes()) {
157 if (!node_ref.location()) {
162 throw osmium::not_found{
"location for one or more nodes not found in node location index"};
182 #endif // OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP
bool m_ignore_errors
Definition: node_locations_for_ways.hpp:85
void way(osmium::Way &way)
Definition: node_locations_for_ways.hpp:147
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:67
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:87
void ignore_errors()
Definition: node_locations_for_ways.hpp:112
Definition: handler.hpp:71
static dummy_type & get_dummy()
Definition: node_locations_for_ways.hpp:91
NodeLocationsForWays(TStoragePosIDs &storage_pos, TStorageNegIDs &storage_neg=get_dummy()) noexcept
Definition: node_locations_for_ways.hpp:98
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:83
TStoragePosIDs & m_storage_pos
Object that handles the actual storage of the node locations (with positive IDs).
Definition: node_locations_for_ways.hpp:78
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:73
TStorageNegIDs & m_storage_neg
Object that handles the actual storage of the node locations (with negative IDs).
Definition: node_locations_for_ways.hpp:81
Definition: location.hpp:271
NodeLocationsForWays & operator=(const NodeLocationsForWays &)=delete
TStoragePosIDs index_pos_type
Definition: node_locations_for_ways.hpp:72
osmium::Location get_node_location(const osmium::object_id_type id) const
Definition: node_locations_for_ways.hpp:136
Definition: node_locations_for_ways.hpp:64
void node(const osmium::Node &node)
Definition: node_locations_for_ways.hpp:119
void clear()
Definition: node_locations_for_ways.hpp:171