18 using Role = std::pair<std::string, Primitive*>;
20 using Errors = std::vector<std::string>;
31 virtual std::string
type() = 0;
41 std::string
type()
override {
return "node"; }
49 :
Primitive{
id, std::move(attributes)}, nodes{std::move(nodes)} {}
50 std::string
type()
override {
return "way"; }
58 :
Primitive{
id, std::move(attributes)}, members{std::move(roles)} {}
59 std::string
type()
override {
return "relation"; }
63 using Nodes = std::map<Id, Node>;
64 using Ways = std::map<Id, Way>;
73 File() noexcept =
default;
78 ~
File() noexcept =
default;
86 return std::find_if(roles.begin(), roles.end(), [&](
auto& role) {
return roleName == role.first; });
89 template <
typename Func>
91 std::for_each(roles.begin(), roles.end(), [&](
auto& role) {
92 if (roleName == role.first) {
Common abstract base class for all osm primitives. Provides id and attributes.
std::map< Id, Relation > Relations
std::map< std::string, Attribute > Configuration
std::map< std::string, std::string > Attributes
std::string type() override
virtual std::string type()=0
Intermediate representation of an osm file.
std::vector< Node * > nodes
Node(Id id, Attributes attributes, GPSPoint point)
Relation(Id id, Attributes attributes, Roles roles=Roles())
std::map< Id, Node > Nodes
std::pair< std::string, Primitive * > Role
File read(pugi::xml_document &node, lanelet::osm::Errors *errors=nullptr)
std::string type() override
auto forEachMember(const Roles &roles, const std::string &roleName, Func &&f)
Way(Id id, Attributes attributes, std::vector< Node *> nodes)
Primitive(Id id, Attributes attributes)
std::unique_ptr< pugi::xml_document > write(const File &file, const io::Configuration ¶ms=io::Configuration())
Primitive & operator=(Primitive &&rhs) noexcept=default
std::string type() override
std::vector< std::string > Errors
bool operator==(const Node &lhs, const Node &rhs)
virtual ~Primitive()=default
auto findRole(const Roles &roles, const std::string &roleName)