2019-06-21 12:27:46 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
struct FileOrigin;
|
|
|
|
|
|
|
|
class LocationPoint {
|
|
|
|
public:
|
|
|
|
LocationPoint() = default;
|
2020-05-28 13:05:44 +00:00
|
|
|
explicit LocationPoint(const MTPDgeoPoint &point);
|
2019-06-21 12:27:46 +00:00
|
|
|
|
2020-05-28 13:05:44 +00:00
|
|
|
[[nodiscard]] QString latAsString() const;
|
|
|
|
[[nodiscard]] QString lonAsString() const;
|
|
|
|
[[nodiscard]] MTPGeoPoint toMTP() const;
|
2019-06-21 12:27:46 +00:00
|
|
|
|
2020-05-28 13:05:44 +00:00
|
|
|
[[nodiscard]] float64 lat() const;
|
|
|
|
[[nodiscard]] float64 lon() const;
|
|
|
|
[[nodiscard]] uint64 accessHash() const;
|
2019-06-21 12:27:46 +00:00
|
|
|
|
2020-05-28 13:05:44 +00:00
|
|
|
[[nodiscard]] size_t hash() const;
|
2019-06-21 12:27:46 +00:00
|
|
|
|
|
|
|
private:
|
2020-05-28 13:05:44 +00:00
|
|
|
friend inline bool operator==(
|
|
|
|
const LocationPoint &a,
|
|
|
|
const LocationPoint &b) {
|
2019-06-21 12:27:46 +00:00
|
|
|
return (a._lat == b._lat) && (a._lon == b._lon);
|
|
|
|
}
|
|
|
|
|
2020-05-28 13:05:44 +00:00
|
|
|
friend inline bool operator<(
|
|
|
|
const LocationPoint &a,
|
|
|
|
const LocationPoint &b) {
|
2019-06-21 12:27:46 +00:00
|
|
|
return (a._lat < b._lat) || ((a._lat == b._lat) && (a._lon < b._lon));
|
|
|
|
}
|
|
|
|
|
|
|
|
float64 _lat = 0;
|
|
|
|
float64 _lon = 0;
|
|
|
|
uint64 _access = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-05-28 13:05:44 +00:00
|
|
|
[[nodiscard]] GeoPointLocation ComputeLocation(const LocationPoint &point);
|
2019-06-21 12:27:46 +00:00
|
|
|
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct hash<Data::LocationPoint> {
|
|
|
|
size_t operator()(const Data::LocationPoint &value) const {
|
|
|
|
return value.hash();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace std
|