1 #ifndef OSMSCOUT_GEOCOORD_H 2 #define OSMSCOUT_GEOCOORD_H 81 GeoCoord(
const GeoCoord& other) =
default;
122 std::string GetDisplayText()
const;
126 stream << GetDisplayText();
148 buffer[0]=((latValue >> 0u) & 0xffu);
149 buffer[1]=((latValue >> 8u) & 0xffu);
150 buffer[2]=((latValue >> 16u) & 0xffu);
152 buffer[3]=((lonValue >> 0u) & 0xffu);
153 buffer[4]=((lonValue >> 8u) & 0xffu);
154 buffer[5]=((lonValue >> 16u) & 0xffu);
156 buffer[6]=((latValue >> 24u) & 0x07u) | ((lonValue >> 20u) & 0x70u);
168 for (
size_t i=0; i<27; i++) {
172 number=number+((latValue >> bit) & 0x01u);
175 number=number+((lonValue >> bit) & 0x01u);
186 uint32_t latDat= (buffer[0] << 0u)
189 | ((buffer[6] & 0x0fu) << 24u);
191 uint32_t lonDat= (buffer[3] << 0u)
194 | ((buffer[6] & 0xf0u) << 20u);
205 return lat==other.lat && lon==other.lon;
237 static bool Parse(
const std::string& text,
249 Distance GetDistance(
const GeoCoord &target)
const;
262 GeoCoord Add(
const Bearing &bearing,
const Distance &distance)
const;
269 return lat==other.lat && lon==other.lon;
277 return lat!=other.lat || lon!=other.lon;
282 return std::tie(lat, lon) < std::tie(other.lat, other.lon);
288 GeoCoord& operator=(
const GeoCoord& other) =
default;
292 return GetDistance(other);
uint64_t Id
Definition: OSMScoutTypes.h:41
constexpr uint32_t maxRawCoordValue
Definition: GeoCoord.h:56
std::ostream & operator<<(std::ostream &stream) const
Definition: GeoCoord.h:124
bool operator==(const GeoCoord &other) const
Definition: GeoCoord.h:267
Distance operator-(const GeoCoord &other) const
Definition: GeoCoord.h:290
bool operator!=(const GeoCoord &other) const
Definition: GeoCoord.h:275
bool IsEqual(const GeoCoord &other) const
Definition: GeoCoord.h:203
GeoCoord(double lat, double lon)
Definition: GeoCoord.h:86
bool operator<(const GeoCoord &other) const
Definition: GeoCoord.h:280
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
void Set(double lat, double lon)
Definition: GeoCoord.h:96
Id GetHash() const
Definition: GeoCoord.h:162
void DecodeFromBuffer(const unsigned char buffer[])
Definition: GeoCoord.h:184
double GetLon() const
Definition: GeoCoord.h:114
OSMSCOUT_API const double latConversionFactor
OSMSCOUT_API const double lonConversionFactor
const size_t coordByteSize
Definition: GeoCoord.h:62
void EncodeToBuffer(unsigned char buffer[]) const
Definition: GeoCoord.h:143
double GetLat() const
Definition: GeoCoord.h:106