libosmscout  1.1.1
RawCoord.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_IMPORT_RAWCOORD_H
2 #define OSMSCOUT_IMPORT_RAWCOORD_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2016 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>
24 #include <osmscout/TypeConfig.h>
25 
28 
30 
31 namespace osmscout {
32 
37  class RawCoord CLASS_FINAL
38  {
39  private:
40  OSMId id; //<! OSM id of the corresponding node
41  GeoCoord coord; //<! The actual coordinate
42 
43  public:
44  RawCoord();
45 
49  inline OSMId GetOSMId() const
50  {
51  return id;
52  }
53 
57  inline const GeoCoord& GetCoord() const
58  {
59  return coord;
60  }
61 
65  inline bool IsIdentical(const RawCoord& other) const
66  {
67  return id==other.id;
68  }
69 
73  inline bool IsSame(const RawCoord& other) const
74  {
75  return coord==other.coord;
76  }
77 
81  inline bool IsEqual(const RawCoord& other) const
82  {
83  return id==other.id || coord==other.coord;
84  }
85 
86  void SetOSMId(OSMId id);
87 
88  void SetCoord(const GeoCoord& coord);
89  void Read(const TypeConfig& typeConfig,
90  FileScanner& scanner);
91  void Write(const TypeConfig& typeConfig,
92  FileWriter& writer) const;
93  void Write(FileWriter& writer) const;
94  };
95 
96  using RawCoordRef = std::shared_ptr<RawCoord>;
97 }
98 
99 #endif
int64_t OSMId
Definition: OSMScoutTypes.h:34
bool IsSame(const RawCoord &other) const
Definition: RawCoord.h:73
Definition: Area.h:38
#define CLASS_FINAL
Definition: Compiler.h:26
OSMId GetOSMId() const
Definition: RawCoord.h:49
bool IsIdentical(const RawCoord &other) const
Definition: RawCoord.h:65
const GeoCoord & GetCoord() const
Definition: RawCoord.h:57
bool IsEqual(const RawCoord &other) const
Definition: RawCoord.h:81
std::shared_ptr< RawCoord > RawCoordRef
Definition: RawCoord.h:96