Osmium
0.1
|
00001 #ifndef OSMIUM_OSM_WAY_NODE_HPP 00002 #define OSMIUM_OSM_WAY_NODE_HPP 00003 00004 /* 00005 00006 Copyright 2011 Jochen Topf <jochen@topf.org> and others (see README). 00007 00008 This file is part of Osmium (https://github.com/joto/osmium). 00009 00010 Osmium is free software: you can redistribute it and/or modify it under the 00011 terms of the GNU Lesser General Public License or (at your option) the GNU 00012 General Public License as published by the Free Software Foundation, either 00013 version 3 of the Licenses, or (at your option) any later version. 00014 00015 Osmium is distributed in the hope that it will be useful, but WITHOUT ANY 00016 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 00017 PARTICULAR PURPOSE. See the GNU Lesser General Public License and the GNU 00018 General Public License for more details. 00019 00020 You should have received a copy of the Licenses along with Osmium. If not, see 00021 <http://www.gnu.org/licenses/>. 00022 00023 */ 00024 00025 #include <osmium/osm/types.hpp> 00026 #include <osmium/osm/position.hpp> 00027 00028 namespace Osmium { 00029 00030 namespace OSM { 00031 00032 class WayNode { 00033 00034 public: 00035 00036 WayNode(osm_object_id_t ref=0) : m_ref(ref) { 00037 } 00038 00039 WayNode(osm_object_id_t ref, const Position& position) : m_ref(ref), m_position(position) { 00040 } 00041 00042 osm_object_id_t ref() const { 00043 return m_ref; 00044 } 00045 00046 const Position& position() const { 00047 return m_position; 00048 } 00049 00050 WayNode& position(const Position& position) { 00051 m_position = position; 00052 return *this; 00053 } 00054 00055 bool has_position() const { 00056 return m_position.defined(); 00057 } 00058 00059 double lon() const { 00060 return m_position.lon(); 00061 } 00062 00063 double lat() const { 00064 return m_position.lat(); 00065 } 00066 00067 friend bool operator==(const WayNode& wn1, const WayNode& wn2) { 00068 return wn1.ref() == wn2.ref(); 00069 } 00070 00071 friend bool operator!=(const WayNode& wn1, const WayNode& wn2) { 00072 return !(wn1 == wn2); 00073 } 00074 00075 private: 00076 00077 osm_object_id_t m_ref; 00078 Position m_position; 00079 00080 }; // class WayNode 00081 00082 } // namespace OSM 00083 00084 } // namespace Osmium 00085 00086 #endif // OSMIUM_OSM_WAY_NODE_HPP