Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <relations_manager.hpp>
Public Member Functions | |
RelationsManager () | |
SecondPassHandler< RelationsManager > & | handler (const std::function< void(osmium::memory::Buffer &&)> &callback=nullptr) |
void | relation (const osmium::Relation &relation) |
void | handle_node (const osmium::Node &node) |
void | handle_way (const osmium::Way &way) |
void | handle_relation (const osmium::Relation &relation) |
template<typename TFunc > | |
void | for_each_incomplete_relation (TFunc &&func) |
Public Member Functions inherited from osmium::relations::RelationsManagerBase | |
RelationsManagerBase () | |
osmium::relations::RelationsDatabase & | relations_database () noexcept |
Access the internal RelationsDatabase. More... | |
osmium::relations::MembersDatabase< osmium::Node > & | member_nodes_database () noexcept |
Access the internal database containing member nodes. More... | |
const osmium::relations::MembersDatabase< osmium::Node > & | member_nodes_database () const noexcept |
Access the internal database containing member nodes. More... | |
osmium::relations::MembersDatabase< osmium::Way > & | member_ways_database () noexcept |
Access the internal database containing member ways. More... | |
const osmium::relations::MembersDatabase< osmium::Way > & | member_ways_database () const noexcept |
Access the internal database containing member ways. More... | |
osmium::relations::MembersDatabase< osmium::Relation > & | member_relations_database () noexcept |
Access the internal database containing member relations. More... | |
const osmium::relations::MembersDatabase< osmium::Relation > & | member_relations_database () const noexcept |
Access the internal database containing member relations. More... | |
relations::MembersDatabaseCommon & | member_database (osmium::item_type type) noexcept |
const relations::MembersDatabaseCommon & | member_database (osmium::item_type type) const noexcept |
const osmium::OSMObject * | get_member_object (const osmium::RelationMember &member) const noexcept |
const osmium::Node * | get_member_node (osmium::object_id_type id) const noexcept |
const osmium::Way * | get_member_way (osmium::object_id_type id) const noexcept |
const osmium::Relation * | get_member_relation (osmium::object_id_type id) const noexcept |
void | prepare_for_lookup () |
relations_manager_memory_usage | used_memory () const noexcept |
osmium::memory::Buffer & | buffer () noexcept |
Access the output buffer. More... | |
void | set_callback (const std::function< void(osmium::memory::Buffer &&)> &callback) |
Set the callback called when the output buffer is full. More... | |
void | flush_output () |
Flush the output buffer. More... | |
void | possibly_flush () |
Flush the output buffer if it is full. More... | |
osmium::memory::Buffer | read () |
Return the contents of the output buffer. More... | |
Public Member Functions inherited from osmium::handler::Handler | |
void | osm_object (const osmium::OSMObject &) const noexcept |
void | node (const osmium::Node &) const noexcept |
void | way (const osmium::Way &) const noexcept |
void | relation (const osmium::Relation &) const noexcept |
void | area (const osmium::Area &) const noexcept |
void | changeset (const osmium::Changeset &) const noexcept |
void | tag_list (const osmium::TagList &) const noexcept |
void | way_node_list (const osmium::WayNodeList &) const noexcept |
void | relation_member_list (const osmium::RelationMemberList &) const noexcept |
void | outer_ring (const osmium::OuterRing &) const noexcept |
void | inner_ring (const osmium::InnerRing &) const noexcept |
void | changeset_discussion (const osmium::ChangesetDiscussion &) const noexcept |
void | flush () const noexcept |
Private Types | |
using | check_order_handler = typename std::conditional< TCheckOrder, osmium::handler::CheckOrder, osmium::handler::Handler >::type |
Private Member Functions | |
bool | new_relation (const osmium::Relation &) const noexcept |
bool | new_member (const osmium::Relation &, const osmium::RelationMember &, std::size_t) const noexcept |
void | complete_relation (const osmium::Relation &) const noexcept |
void | before_node (const osmium::Node &) const noexcept |
void | node_not_in_any_relation (const osmium::Node &) const noexcept |
void | after_node (const osmium::Node &) const noexcept |
void | before_way (const osmium::Way &) const noexcept |
void | way_not_in_any_relation (const osmium::Way &) const noexcept |
void | after_way (const osmium::Way &) const noexcept |
void | before_relation (const osmium::Relation &) const noexcept |
void | relation_not_in_any_relation (const osmium::Relation &) const noexcept |
void | after_relation (const osmium::Relation &) const noexcept |
TManager & | derived () noexcept |
void | handle_complete_relation (RelationHandle &rel_handle) |
Static Private Member Functions | |
static bool | wanted_type (osmium::item_type type) noexcept |
Private Attributes | |
check_order_handler | m_check_order_handler |
SecondPassHandler< RelationsManager > | m_handler_pass2 |
This is a base class for RelationManager classes. It keeps track of all interesting relations and all interesting members of those relations. When all members are available it calls code to handle the completed relation.
This class is intended as a base class for classes that handle specific types of relations. Derive from this class, implement the complete_relation() function and overwrite certain other functions as needed.
TManager | The derived class (Uses CRTP). |
TNodes | Are we interested in member nodes? |
TWays | Are we interested in member ways? |
TRelations | Are we interested in member relations? |
TCheckOrder | Should the order of the input data be checked? |
|
private |
|
inline |
|
inlineprivatenoexcept |
This method is called for all nodes during the second pass after the relation member handling.
Overwrite this method in a derived class if you are interested in this.
|
inlineprivatenoexcept |
This method is called for all relations during the second pass after the relation member handling.
Overwrite this method in a derived class if you are interested in this.
|
inlineprivatenoexcept |
This method is called for all ways during the second pass after the relation member handling.
Overwrite this method in a derived class if you are interested in this.
|
inlineprivatenoexcept |
This method is called for all nodes during the second pass before the relation member handling.
Overwrite this method in a derived class if you are interested in this.
|
inlineprivatenoexcept |
This method is called for all relations during the second pass before the relation member handling.
Overwrite this method in a derived class if you are interested in this.
|
inlineprivatenoexcept |
This method is called for all ways during the second pass before the relation member handling.
Overwrite this method in a derived class if you are interested in this.
|
inlineprivatenoexcept |
This method is called for each complete relation, ie when all members you have expressed interest in are available.
You have to overwrite this in a derived class.
|
inlineprivatenoexcept |
|
inline |
Call this function it will call your function back for every incomplete relation, that is all relations that have missing members in the input data. Usually you call this only after your second pass through the data if you are interested in any relations that have all or some of their members missing in the input data.
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
Return reference to second pass handler.
|
inlineprivatenoexcept |
This method is called for every member of every relation that will be kept. It should decide if the member is interesting or not and return true or false to signal that. Only interesting members are later added to the relation.
Overwrite this method in a derived class. In the MultipolygonManager class this is used for instance to only keep members of type way and ignore all others.
|
inlineprivatenoexcept |
This method is called from the first pass handler for every relation in the input, to check whether it should be kept.
Overwrite this method in a derived class to only add relations you are interested in, for instance depending on the type tag. Storing relations takes a lot of memory, so it makes sense to filter this as much as possible.
|
inlineprivatenoexcept |
This method is called for all nodes that are not a member of any relation.
Overwrite this method in a derived class if you are interested in this.
|
inline |
Add the specified relation to the list of relations we want to build. This calls the new_relation() and new_member() functions to actually decide what to keep.
This member function is named relation() so the manager can be used as a handler for the first pass through a data file.
relation | Relation we might want to build. |
|
inlineprivatenoexcept |
This method is called for all relations that are not a member of any relation.
Overwrite this method in a derived class if you are interested in this.
|
inlinestaticprivatenoexcept |
|
inlineprivatenoexcept |
This method is called for all ways that are not a member of any relation.
Overwrite this method in a derived class if you are interested in this.
|
private |
|
private |