8 #ifndef META_OCEAN_DEVICES_GPS_TRACKER_H
9 #define META_OCEAN_DEVICES_GPS_TRACKER_H
64 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);
70 inline double latitude()
const;
76 inline double longitude()
const;
82 inline float altitude()
const;
88 inline float direction()
const;
94 inline float speed()
const;
100 inline float accuracy()
const;
106 inline float altitudeAccuracy()
const;
112 inline float directionAccuracy()
const;
118 inline float speedAccuracy()
const;
124 inline bool isValid()
const;
138 float direction_ = -1.0f;
141 float speed_ = -1.0f;
144 float accuracy_ = -1.0f;
147 float altitudeAccuracy_ = -1.0f;
150 float directionAccuracy_ = -1.0f;
153 float speedAccuracy_ = -1.0f;
192 inline const Locations& locations()
const;
211 static inline DeviceType deviceTypeGPSTracker();
229 static bool parseGPSLocation(
const std::string& gpsString,
double& latitude,
double& longitude,
double* altitude =
nullptr);
241 static bool decodePolyline(
const std::string& polyline,
const unsigned int precision,
Locations& locations,
const bool unescapeBackslash =
false);
275 static bool decodePolylineValue(
const std::string& polyline,
size_t& position, int32_t& integerValue,
const bool unescapeBackslash);
283 inline 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) :
285 longitude_(longitude),
287 direction_(direction),
290 altitudeAccuracy_(altitudeAccuracy),
291 directionAccuracy_(directionAccuracy),
292 speedAccuracy_(speedAccuracy)
334 return altitudeAccuracy_;
339 return directionAccuracy_;
344 return speedAccuracy_;
349 ocean_assert((direction_ >= 0.0f && direction_ <= 360.0f) || direction_ == -1.0f);
350 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:165
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:197
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:355
This class implements a container for a GPS location.
Definition: GPSTracker.h:44
float accuracy() const
Returns the accuracy of latitude and longitude.
Definition: GPSTracker.h:327
double latitude_
The latitude of the GPS position, in degree, always valid, with range [-90, 90], NumericD::minValue()...
Definition: GPSTracker.h:129
Location()
Creates an invalid location.
Definition: GPSTracker.h:278
float altitudeAccuracy() const
Returns the accuracy of the altitude.
Definition: GPSTracker.h:332
float speedAccuracy() const
Returns the accuracy of the speed value.
Definition: GPSTracker.h:342
bool isValid() const
Returns whether this location holds valid data.
Definition: GPSTracker.h:347
float direction() const
Returns the device's travel direction not the orientation of the device.
Definition: GPSTracker.h:317
float direction_
The device's travel direction not the orientation of the device, relative to north,...
Definition: GPSTracker.h:138
float directionAccuracy() const
Returns the accuracy of the direction.
Definition: GPSTracker.h:337
float altitude() const
Returns the altitude of the GPS position.
Definition: GPSTracker.h:312
double longitude() const
Returns the longitude of the GPS position.
Definition: GPSTracker.h:307
double longitude_
The longitude of the GPS position, in degree, always valid, with range [-180, 180],...
Definition: GPSTracker.h:132
double latitude() const
Returns the latitude of the GPS position.
Definition: GPSTracker.h:302
float directionAccuracy_
The direction accuracy, in degree, with range [0, 180], -1 if unknown.
Definition: GPSTracker.h:150
float speed() const
Returns the speed of the device.
Definition: GPSTracker.h:322
This class is the base class for all gps tracker objects.
Definition: GPSTracker.h:37
~GPSTracker() override
Destructs a GPS tracker object.
std::vector< Location > Locations
Definition of a vector holding GPS data values.
Definition: GPSTracker.h:159
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 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 bool decodePolyline(const std::string &polyline, const unsigned int precision, Locations &locations, const bool unescapeBackslash=false)
Decodes all GPS locations from a polyline.
static DeviceType deviceTypeGPSTracker()
Returns the device type of this tracker.
Definition: GPSTracker.h:360
SmartObjectRef< GPSTrackerSample, Sample > GPSTrackerSampleRef
Definition of a smart object reference for GPS tracker samples.
Definition: GPSTracker.h:203
std::unordered_map< std::string, Value > Metadata
Definition of an unordered map mapping keys to values.
Definition: Measurement.h:61
std::vector< ObjectId > ObjectIds
Definition of a vector holding object ids.
Definition: Measurement.h:51
Definition of a sample holding one measurement values of a tracker.
Definition: devices/Tracker.h:88
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:72
static constexpr T minValue()
Returns the min scalar value.
Definition: Numeric.h:3250
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:2872
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:36
SmartDeviceRef< GPSTracker > GPSTrackerRef
Definition of a smart object reference for a GPS tracker.
Definition: GPSTracker.h:23
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15