Libosmium  2.7.1
Fast and flexible C++ library for working with OpenStreetMap data
way.hpp
Go to the documentation of this file.
1 #ifndef OSMIUM_OSM_WAY_HPP
2 #define OSMIUM_OSM_WAY_HPP
3 
4 /*
5 
6 This file is part of Osmium (http://osmcode.org/libosmium).
7 
8 Copyright 2013-2016 Jochen Topf <jochen@topf.org> and others (see README).
9 
10 Boost Software License - Version 1.0 - August 17th, 2003
11 
12 Permission is hereby granted, free of charge, to any person or organization
13 obtaining a copy of the software and accompanying documentation covered by
14 this license (the "Software") to use, reproduce, display, distribute,
15 execute, and transmit the Software, and to prepare derivative works of the
16 Software, and to permit third-parties to whom the Software is furnished to
17 do so, all subject to the following:
18 
19 The copyright notices in the Software and this entire statement, including
20 the above license grant, this restriction and the following disclaimer,
21 must be included in all copies of the Software, in whole or in part, and
22 all derivative works of the Software, unless such copies or derivative
23 works are solely in the form of machine-executable object code generated by
24 a source language processor.
25 
26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 DEALINGS IN THE SOFTWARE.
33 
34 */
35 
36 #include <osmium/memory/item.hpp>
37 #include <osmium/osm/item_type.hpp>
38 #include <osmium/osm/object.hpp>
39 #include <osmium/osm/types.hpp>
40 #include <osmium/osm/node_ref.hpp>
42 
43 namespace osmium {
44 
45  namespace builder {
46  template <typename T> class ObjectBuilder;
47  } // namespace builder
48 
52  class WayNodeList : public NodeRefList {
53 
54  public:
55 
57 
59  NodeRefList(itemtype) {
60  }
61 
62  }; // class WayNodeList
63 
64 
65  class Way : public OSMObject {
66 
68 
69  Way() noexcept :
70  OSMObject(sizeof(Way), osmium::item_type::way) {
71  }
72 
73  public:
74 
76  return osmium::detail::subitem_of_type<WayNodeList>(begin(), end());
77  }
78 
79  const WayNodeList& nodes() const {
80  return osmium::detail::subitem_of_type<const WayNodeList>(cbegin(), cend());
81  }
82 
87  void update_node_location(const NodeRef& new_node_ref) {
88  for (auto& node_ref : nodes()) {
89  if (node_ref.ref() == new_node_ref.ref()) {
90  node_ref.set_location(new_node_ref.location());
91  }
92  }
93  }
94 
98  bool is_closed() const {
99  return nodes().is_closed();
100  }
101 
102  bool ends_have_same_id() const {
103  return nodes().ends_have_same_id();
104  }
105 
106  bool ends_have_same_location() const {
107  return nodes().ends_have_same_location();
108  }
109 
110  }; // class Way
111 
112 
113 } // namespace osmium
114 
115 #endif // OSMIUM_OSM_WAY_HPP
WayNodeList & nodes()
Definition: way.hpp:75
bool ends_have_same_id() const
Definition: way.hpp:102
item_type
Definition: item_type.hpp:43
Definition: way.hpp:65
const WayNodeList & nodes() const
Definition: way.hpp:79
constexpr osmium::object_id_type ref() const noexcept
Definition: node_ref.hpp:65
Definition: way.hpp:52
Namespace for everything in the Osmium library.
Definition: assembler.hpp:66
void update_node_location(const NodeRef &new_node_ref)
Definition: way.hpp:87
bool ends_have_same_location() const
Definition: way.hpp:106
osmium::io::InputIterator< osmium::io::Reader > end(osmium::io::Reader &)
Definition: reader_iterator.hpp:45
WayNodeList()
Definition: way.hpp:58
osmium::Location & location() noexcept
Definition: node_ref.hpp:79
Definition: builder.hpp:186
Definition: node_ref_list.hpp:50
bool is_closed() const
Definition: way.hpp:98
Definition: node_ref.hpp:50
osmium::io::InputIterator< osmium::io::Reader > begin(osmium::io::Reader &reader)
Definition: reader_iterator.hpp:41
Definition: object.hpp:60