Loading...
Searching...
No Matches
way.hpp
Go to the documentation of this file.
#ifndef OSMIUM_OSM_WAY_HPP
#define OSMIUM_OSM_WAY_HPP
/*
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <osmium/memory/collection.hpp>
#include <osmium/memory/item.hpp>
#include <osmium/osm/box.hpp>
#include <osmium/osm/entity.hpp>
#include <osmium/osm/item_type.hpp>
#include <osmium/osm/node_ref.hpp>
#include <osmium/osm/node_ref_list.hpp>
#include <osmium/osm/object.hpp>
namespace osmium {
namespace builder {
template <typename TDerived, typename T>
class OSMObjectBuilder;
} // namespace builder
class WayNodeList : public NodeRefList {
public:
static constexpr osmium::item_type itemtype = osmium::item_type::way_node_list;
constexpr static bool is_compatible_to(osmium::item_type t) noexcept {
return t == itemtype;
}
WayNodeList() noexcept :
NodeRefList(itemtype) {
}
}; // class WayNodeList
class Way : public OSMObject {
template <typename TDerived, typename T>
friend class osmium::builder::OSMObjectBuilder;
Way() noexcept :
OSMObject(sizeof(Way), osmium::item_type::way) {
}
public:
static constexpr osmium::item_type itemtype = osmium::item_type::way;
constexpr static bool is_compatible_to(osmium::item_type t) noexcept {
return t == itemtype;
}
WayNodeList& nodes() {
return osmium::detail::subitem_of_type<WayNodeList>(begin(), end());
}
const WayNodeList& nodes() const {
return osmium::detail::subitem_of_type<const WayNodeList>(cbegin(), cend());
}
void update_node_location(const NodeRef& new_node_ref) {
for (auto& node_ref : nodes()) {
if (node_ref.ref() == new_node_ref.ref()) {
node_ref.set_location(new_node_ref.location());
}
}
}
bool is_closed() const noexcept {
return nodes().is_closed();
}
bool ends_have_same_id() const noexcept {
return nodes().ends_have_same_id();
}
bool ends_have_same_location() const {
return nodes().ends_have_same_location();
}
osmium::Box envelope() const noexcept {
return nodes().envelope();
}
}; // class Way
} // namespace osmium
#endif // OSMIUM_OSM_WAY_HPP
box.hpp
osmium::NodeRefList
Definition node_ref_list.hpp:52
osmium::NodeRefList::envelope
osmium::Box envelope() const noexcept
Definition node_ref_list.hpp:190
osmium::NodeRefList::is_closed
bool is_closed() const noexcept
Definition node_ref_list.hpp:151
osmium::NodeRefList::ends_have_same_location
bool ends_have_same_location() const
Definition node_ref_list.hpp:178
osmium::NodeRefList::ends_have_same_id
bool ends_have_same_id() const noexcept
Definition node_ref_list.hpp:164
osmium::NodeRef
Definition node_ref.hpp:50
osmium::NodeRef::ref
constexpr osmium::object_id_type ref() const noexcept
Definition node_ref.hpp:71
osmium::NodeRef::location
osmium::Location & location() noexcept
Definition node_ref.hpp:85
osmium::OSMObject
Definition object.hpp:64
osmium::OSMObject::cend
const_iterator cend() const
Definition object.hpp:397
osmium::OSMObject::end
iterator end()
Definition object.hpp:389
osmium::OSMObject::begin
iterator begin()
Definition object.hpp:385
osmium::OSMObject::cbegin
const_iterator cbegin() const
Definition object.hpp:393
osmium::WayNodeList
Definition way.hpp:55
osmium::WayNodeList::WayNodeList
WayNodeList() noexcept
Definition way.hpp:65
osmium::WayNodeList::is_compatible_to
static constexpr bool is_compatible_to(osmium::item_type t) noexcept
Definition way.hpp:61
osmium::WayNodeList::itemtype
static constexpr osmium::item_type itemtype
Definition way.hpp:59
osmium::Way
Definition way.hpp:72
osmium::Way::ends_have_same_location
bool ends_have_same_location() const
Definition way.hpp:142
osmium::Way::is_compatible_to
static constexpr bool is_compatible_to(osmium::item_type t) noexcept
Definition way.hpp:85
osmium::Way::ends_have_same_id
bool ends_have_same_id() const noexcept
Definition way.hpp:129
osmium::Way::envelope
osmium::Box envelope() const noexcept
Definition way.hpp:152
osmium::Way::nodes
const WayNodeList & nodes() const
Definition way.hpp:93
osmium::Way::is_closed
bool is_closed() const noexcept
Definition way.hpp:117
osmium::Way::nodes
WayNodeList & nodes()
Definition way.hpp:89
osmium::Way::update_node_location
void update_node_location(const NodeRef &new_node_ref)
Definition way.hpp:101
osmium::Way::itemtype
static constexpr osmium::item_type itemtype
Definition way.hpp:83
osmium::Way::Way
Way() noexcept
Definition way.hpp:77
osmium::builder::OSMObjectBuilder
Definition way.hpp:49
collection.hpp
entity.hpp
item.hpp
item_type.hpp
osmium
Namespace for everything in the Osmium library.
Definition assembler.hpp:53
osmium::item_type
item_type
Definition item_type.hpp:45
osmium::item_type::way_node_list
@ way_node_list
osmium::item_type::way
@ way
node_ref.hpp
node_ref_list.hpp
object.hpp