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>
98 TStorageNegIDs& storage_neg =
get_dummy()) :
99 m_storage_pos(storage_pos),
100 m_storage_neg(storage_neg) {
126 m_storage_pos.set(static_cast<osmium::unsigned_object_id_type>(
id), node.
location());
128 m_storage_neg.set(static_cast<osmium::unsigned_object_id_type>(-
id), node.
location());
137 return m_storage_pos.get_noexcept(static_cast<osmium::unsigned_object_id_type>(
id));
139 return m_storage_neg.get_noexcept(static_cast<osmium::unsigned_object_id_type>(-
id));
149 m_storage_pos.sort();
150 m_storage_neg.sort();
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"};
172 m_storage_pos.clear();
173 m_storage_neg.clear();
182 #endif // OSMIUM_HANDLER_NODE_LOCATIONS_FOR_WAYS_HPP WayNodeList & nodes()
Definition: way.hpp:89
bool m_ignore_errors
Definition: node_locations_for_ways.hpp:84
void way(osmium::Way &way)
Definition: node_locations_for_ways.hpp:147
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:86
void ignore_errors()
Definition: node_locations_for_ways.hpp:111
Definition: handler.hpp:71
~NodeLocationsForWays() noexcept=default
static dummy_type & get_dummy()
Definition: node_locations_for_ways.hpp:90
Namespace for everything in the Osmium library.
Definition: assembler.hpp:63
osmium::unsigned_object_id_type m_last_id
Definition: node_locations_for_ways.hpp:82
TStoragePosIDs & m_storage_pos
Object that handles the actual storage of the node locations (with positive IDs). ...
Definition: node_locations_for_ways.hpp:77
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:72
TStorageNegIDs & m_storage_neg
Object that handles the actual storage of the node locations (with negative IDs). ...
Definition: node_locations_for_ways.hpp:80
Definition: location.hpp:266
object_id_type id() const noexcept
Get ID of this object.
Definition: object.hpp:126
osmium::Location location() const noexcept
Definition: node.hpp:67
NodeLocationsForWays & operator=(const NodeLocationsForWays &)=delete
TStoragePosIDs index_pos_type
Definition: node_locations_for_ways.hpp:71
osmium::Location get_node_location(const osmium::object_id_type id) const
Definition: node_locations_for_ways.hpp:135
NodeLocationsForWays(TStoragePosIDs &storage_pos, TStorageNegIDs &storage_neg=get_dummy())
Definition: node_locations_for_ways.hpp:97
unsigned_object_id_type positive_id() const noexcept
Get absolute value of the ID of this object.
Definition: object.hpp:131
Definition: node_locations_for_ways.hpp:65
void node(const osmium::Node &node)
Definition: node_locations_for_ways.hpp:118
void clear()
Definition: node_locations_for_ways.hpp:171