8#ifndef META_OCEAN_DEVICES_GPS_TRACKER_H
9#define META_OCEAN_DEVICES_GPS_TRACKER_H
66 inline Location(
const double latitude,
const double longitude,
const float altitude = NumericF::minValue(),
const float direction = -1.0f,
const float speed = -1.0f,
const float accuracy = -1.0f,
const float altitudeAccuracy = -1.0f,
const float directionAccuracy = -1.0f,
const float speedAccuracy = -1.0f);
72 inline double latitude()
const;
78 inline double longitude()
const;
84 inline float altitude()
const;
90 inline float direction()
const;
96 inline float speed()
const;
102 inline float accuracy()
const;
108 inline float altitudeAccuracy()
const;
114 inline float directionAccuracy()
const;
120 inline float speedAccuracy()
const;
126 inline bool isValid()
const;
131 double latitude_ = NumericD::minValue();
134 double longitude_ = NumericD::minValue();
137 float altitude_ = NumericF::minValue();
140 float direction_ = -1.0f;
143 float speed_ = -1.0f;
146 float accuracy_ = -1.0f;
149 float altitudeAccuracy_ = -1.0f;
152 float directionAccuracy_ = -1.0f;
155 float speedAccuracy_ = -1.0f;
194 inline const Locations& locations()
const;
213 static inline DeviceType deviceTypeGPSTracker();
231 static bool parseGPSLocation(
const std::string& gpsString,
double& latitude,
double& longitude,
double* altitude =
nullptr);
243 static bool decodePolyline(
const std::string& polyline,
const unsigned int precision, std::vector<Location>& locations,
const bool unescapeBackslash =
false);
277 static bool decodePolylineValue(
const std::string& polyline,
size_t& position, int32_t& integerValue,
const bool unescapeBackslash);
285inline GPSTracker::Location::Location(
const double latitude,
const double longitude,
const float altitude,
const float direction,
const float speed,
const float accuracy,
const float altitudeAccuracy,
const float directionAccuracy,
const float speedAccuracy) :
287 longitude_(longitude),
289 direction_(direction),
292 altitudeAccuracy_(altitudeAccuracy),
293 directionAccuracy_(directionAccuracy),
294 speedAccuracy_(speedAccuracy)
336 return altitudeAccuracy_;
341 return directionAccuracy_;
346 return speedAccuracy_;
351 ocean_assert((direction_ >= 0.0f && direction_ <= 360.0f) || direction_ == -1.0f);
352 ocean_assert((directionAccuracy_ >= 0.0f && directionAccuracy_ <= 180.0f) || directionAccuracy_ == -1.0f);
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
@ DEVICE_TRACKER
Tracker device.
Definition devices/Device.h:46
Definition of a sample holding GPS measurements.
Definition GPSTracker.h:167
GPSTrackerSample(const Timestamp ×tamp, const ReferenceSystem referenceSystem, const ObjectIds &objectIds, const Locations &locations, const Metadata &metadata=Metadata())
Creates a new GPS sample.
Locations locations_
The GPS locations, one for each object id.
Definition GPSTracker.h:199
GPSTrackerSample(const Timestamp ×tamp, const ReferenceSystem referenceSystem, ObjectIds &&objectIds, Locations &&locations, Metadata &&metadata=Metadata())
Creates a new GPS sample.
const Locations & locations() const
Returns the GPS locations.
Definition GPSTracker.h:357
This class implements a container for a GPS location.
Definition GPSTracker.h:46
float accuracy() const
Returns the accuracy of latitude and longitude.
Definition GPSTracker.h:329
double latitude_
The latitude of the GPS position, in degree, always valid, with range [-90, 90], NumericD::minValue()...
Definition GPSTracker.h:131
Location()
Creates an invalid location.
Definition GPSTracker.h:280
float altitudeAccuracy() const
Returns the accuracy of the altitude.
Definition GPSTracker.h:334
float speedAccuracy() const
Returns the accuracy of the speed value.
Definition GPSTracker.h:344
bool isValid() const
Returns whether this location holds valid data.
Definition GPSTracker.h:349
float direction() const
Returns the device's travel direction not the orientation of the device.
Definition GPSTracker.h:319
float direction_
The device's travel direction not the orientation of the device, relative to north,...
Definition GPSTracker.h:140
float directionAccuracy() const
Returns the accuracy of the direction.
Definition GPSTracker.h:339
float altitude() const
Returns the altitude of the GPS position.
Definition GPSTracker.h:314
double longitude() const
Returns the longitude of the GPS position.
Definition GPSTracker.h:309
double longitude_
The longitude of the GPS position, in degree, always valid, with range [-180, 180],...
Definition GPSTracker.h:134
double latitude() const
Returns the latitude of the GPS position.
Definition GPSTracker.h:304
float directionAccuracy_
The direction accuracy, in degree, with range [0, 180], -1 if unknown.
Definition GPSTracker.h:152
float speed() const
Returns the speed of the device.
Definition GPSTracker.h:324
This class is the base class for all gps tracker objects.
Definition GPSTracker.h:39
~GPSTracker() override
Destructs a GPS tracker object.
static bool parseGPSLocation(const std::string &gpsString, double &latitude, double &longitude, double *altitude=nullptr)
Parses a string with a GPS location.
GPSTracker(const std::string &name)
Creates a new GPS tracker object.
static bool decodePolyline(const std::string &polyline, const unsigned int precision, std::vector< Location > &locations, const bool unescapeBackslash=false)
Decodes all GPS locations from a polyline.
static bool decodePolylineValue(const std::string &polyline, size_t &position, int32_t &integerValue, const bool unescapeBackslash)
Decodes one value from a polyline.
static double approximatedDistanceBetweenLocations(const Location &locationA, const Location &locationB, const double earthRadius=6378135.0)
Calculates the distance between two GPS locations in meters, the location's latitude is not considere...
static DeviceType deviceTypeGPSTracker()
Returns the device type of this tracker.
Definition GPSTracker.h:362
std::unordered_map< std::string, Value > Metadata
Definition of an unordered map mapping keys to values.
Definition Measurement.h:62
Definition of a sample holding one measurement values of a tracker.
Definition devices/Tracker.h:90
This class implements the base class for all tracker devices.
Definition devices/Tracker.h:39
@ TRACKER_GPS
GPS tracker.
Definition devices/Tracker.h:58
ReferenceSystem
Definition of different tracking reference system.
Definition devices/Tracker.h:74
static constexpr bool isInsideRange(const T lower, const T value, const T upper, const T epsilon=NumericT< T >::eps())
Returns whether a value lies between a given range up to a provided epsilon border.
Definition Numeric.h:2881
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
This class implements a timestamp.
Definition Timestamp.h:63
The namespace covering the entire Ocean framework.
Definition Accessor.h:15