libosmscout 1.1.1
Loading...
Searching...
No Matches
Point.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_POINT_H
2#define OSMSCOUT_POINT_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 Tim Teulings
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <osmscout/GeoCoord.h>
25
27
28namespace osmscout {
29
34 class OSMSCOUT_API Point CLASS_FINAL
35 {
36 private:
37 uint8_t serial=0;
38 GeoCoord coord;
39
40 public:
41 Point() = default;
42
43 Point(uint8_t serial,
44 const GeoCoord& coords)
45 : serial(serial),
47 {
48 // no code
49 }
50
51 void Set(uint8_t serial,
52 const GeoCoord& coords)
53 {
54 this->serial=serial;
55 this->coord=coords;
56 }
57
58 void SetSerial(uint8_t serial)
59 {
60 this->serial=serial;
61 }
62
64 {
65 serial=0;
66 }
67
69 {
70 this->coord=coords;
71 }
72
73 uint8_t GetSerial() const
74 {
75 return serial;
76 }
77
78 bool IsRelevant() const
79 {
80 return serial!=0;
81 }
82
91 Id GetId() const;
92
93 const GeoCoord& GetCoord() const
94 {
95 return coord;
96 }
97
98 double GetLat() const
99 {
100 return coord.GetLat();
101 }
102
103 double GetLon() const
104 {
105 return coord.GetLon();
106 }
107
117 bool IsIdentical(const Point& other) const
118 {
119 return serial==other.serial && coord==other.coord;
120 }
121
132 bool IsSame(const Point& other) const
133 {
134 return coord==other.coord;
135 }
136
145 bool IsEqual(const Point& other) const
146 {
147 return coord==other.coord;
148 }
149
159 bool operator<(const Point& other) const
160 {
161 return coord<other.GetCoord() ||
162 (coord==other.GetCoord() && serial < other.serial);
163 }
164
166 };
167}
168
169#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition Area.h:88
bool operator<(const Point &other) const
Definition Point.h:159
const GeoCoord coord
Definition RouteStateAgent.h:49
uint8_t GetSerial() const
Definition Point.h:73
bool IsRelevant() const
Definition Point.h:78
Point(uint8_t serial, const GeoCoord &coords)
Definition Point.h:43
void Set(uint8_t serial, const GeoCoord &coords)
Definition Point.h:51
std::vector< Coord > coords
Optional coordinates for coastline.
Definition GroundTile.h:99
bool IsSame(const Point &other) const
Definition Point.h:132
void SetSerial(uint8_t serial)
Definition Point.h:58
static GeoCoord GetCoordFromId(Id id)
void SetCoord(const GeoCoord &coords)
Definition Point.h:68
bool IsEqual(const Point &other) const
Definition Point.h:145
double GetLat() const
Definition Point.h:98
void ClearSerial()
Definition Point.h:63
double GetLon() const
Definition Point.h:103
bool IsIdentical(const Point &other) const
Definition Point.h:117
const GeoCoord & GetCoord() const
Definition Point.h:93
uint64_t Id
Definition OSMScoutTypes.h:40
Definition Area.h:39