SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Encapsulation of a mobile device location set by the device's GPS sensor. More...
#include <SLDeviceLocation.h>
Public Member Functions | |
SLDeviceLocation () | |
void | init () |
void | onLocationLatLonAlt (SLdouble latDEG, SLdouble lonDEG, SLdouble altM, SLfloat accuracyM) |
Event handler for mobile device location update. More... | |
SLbool | calculateSolarAngles (SLVec3d locationLatLonAlt, std::time_t time) |
Calculates the solar angles at origin at local time. More... | |
SLVec3d | convertLatLonAlt2ENU (SLVec3d locLatLonAlt) const |
Converter method: the transferred wgs84 coordinate is converted to ENU frame and returned (does not change SLDeviceLocation) More... | |
void | isUsed (SLbool isUsed) |
Setter that turns on the device rotation sensor. More... | |
void | useOriginAltitude (SLbool useGLA) |
void | improveOrigin (SLbool impO) |
void | hasOrigin (SLbool hasOL) |
void | originLatLonAlt (int degreesLat, int minutesLat, double secondsLat, int degreesLon, int minutesLon, double secondsLon, double altitudeM) |
Origin coordinate setter in WGS84 Lat-Lon in degrees, minutes and seconds. More... | |
void | originLatLonAlt (SLdouble latDEG, SLdouble lonDEG, SLdouble altM) |
Set global origin in latitude, longitude and altitude at the ground level. More... | |
void | originLatLonAlt (SLVec3d lla) |
void | defaultLatLonAlt (int degreesLat, int minutesLat, double secondsLat, int degreesLon, int minutesLon, double secondsLon, double altitudeM) |
Default coordinate setter in WGS84 Lat-Lon in degrees, minutes and seconds. More... | |
void | defaultLatLonAlt (SLdouble latDEG, SLdouble lonDEG, SLdouble altM) |
Sets the default location in latitude, longitude and altitude. More... | |
void | defaultLatLonAlt (SLVec3d lla) |
void | locMaxDistanceM (SLfloat maxDist) |
void | sunLightNode (SLLightDirect *sln) |
void | loadGeoTiff (const SLstring &geoTiffFile) |
Loads a GeoTiff DEM (Digital Elevation Model) Image. More... | |
bool | geoTiffIsAvailableAndValid () const |
bool | posIsOnGeoTiff (SLdouble latDEG, SLdouble lonDEG) const |
Return true if the current GPS location is within the GeoTiff boundaries. More... | |
void | cameraHeightM (float camHeightM) |
void | offsetMode (SLLocOffsetMode lom) |
void | offsetENU (SLVec3d offsetENU) |
void | activeNamedLocation (SLint locIndex) |
SLbool | isUsed () const |
SLVec3d | locLatLonAlt () const |
SLVec3d | locECEF () const |
SLVec3d | locENU () const |
SLfloat | locAccuracyM () const |
SLfloat | locMaxDistanceM () const |
SLVec3d | defaultENU () const |
SLVec3d | originLatLonAlt () const |
SLVec3d | defaultLatLonAlt () const |
SLVec3d | originENU () const |
SLVec3d | offsetENU () const |
SLbool | hasOrigin () const |
SLbool | useOriginAltitude () const |
SLMat3d | wRecef () const |
SLfloat | improveTime () |
SLfloat | originSolarZenit () const |
SLfloat | originSolarAzimut () const |
SLfloat | originSolarSunrise () const |
SLfloat | originSolarSunset () const |
SLNode * | sunLightNode () const |
SLfloat | altDemM () const |
SLfloat | altGpsM () const |
SLfloat | cameraHeightM () const |
SLLocOffsetMode | offsetMode () |
SLstring | offsetModeStr () const |
Returns the device location offset mode as string. More... | |
SLVLocation & | nameLocations () |
SLint | activeNamedLocation () const |
Private Attributes | |
SLbool | _isUsed |
Flag if the devices GPS Sensor is used. More... | |
SLbool | _isFirstSensorValue |
Flag for the first sensor values. More... | |
SLVec3d | _locLatLonAlt |
Earth location in latitudeDEG, longitudeDEG & AltitudeM on WGS84 geoid. More... | |
SLVec3d | _locECEF |
Cartesian location in ECEF. More... | |
SLVec3d | _locENU |
Cartesian location in ENU frame. More... | |
SLfloat | _locAccuracyM |
Horizontal accuracy radius in m with 68% probability. More... | |
SLfloat | _locMaxDistanceM |
Max. allowed distance from origin. If higher it is ignored. More... | |
SLVec3d | _defaultLatLonAlt |
Default location of scene in LatLonAlt. More... | |
SLVec3d | _defaultENU |
Default location in ENU frame used if real location is too far away from origin. More... | |
SLVec3d | _originLatLonAlt |
Global origin location of scene in LatLonAlt. More... | |
SLVec3d | _originENU |
Origin location in ENU frame. More... | |
SLVec3d | _offsetENU |
Offset vector in ENU frame. More... | |
SLfloat | _originAccuracyM |
Accuracy radius of origin point. More... | |
SLfloat | _originSolarZenith |
Zenith angle of the sun in deg. (from up dir.) at origin at local time. More... | |
SLfloat | _originSolarAzimuth |
Azimuth angle of the sun in deg. (eastward from north) at origin at local time. More... | |
SLfloat | _originSolarSunrise |
Sunrise local time at origin. More... | |
SLfloat | _originSolarSunset |
Sunset local time at origin. More... | |
SLbool | _hasOrigin |
Flag if this scene has a global reference location. More... | |
SLbool | _useOriginAltitude |
Flag if global reference altitude should be used. More... | |
SLfloat | _altDemM |
Altitude in m from Digital Elevation Model. More... | |
SLfloat | _altGpsM |
Altitude in m from GPS. More... | |
SLfloat | _cameraHeightM |
Height from ground to the mobile camera in m. More... | |
SLbool | _improveOrigin |
Flag if origin should be improved over time & accuracy. More... | |
SLfloat | _improveTimeSEC |
Max. time in seconds for the origin improvement. More... | |
HighResTimer | _improveTimer |
Timer to measure the improve time. More... | |
SLMat3d | _wRecef |
ECEF frame to world frame rotation: rotates a point defined in ecef. More... | |
SLNode * | _sunLightNode |
Pointer to directional light node to be changed if solar angles are calculated. More... | |
CVImageGeoTiff | _demGeoTiff |
Digital Elevation Model from a Geo Tiff image. More... | |
SLLocOffsetMode | _offsetMode |
Location offset mode. More... | |
SLVLocation | _nameLocations |
Vector of fix locations for default view points. More... | |
SLint | _activeNamedLocation |
Index of the active named location as defaultENU;. More... | |
Encapsulation of a mobile device location set by the device's GPS sensor.
This class is only used if SLProject runs on a mobile device. Check out the app-demo/android and app_demo_slproject/ios how the sensor data is generated and passed to this object hold by AppCommon. The class stores the devices location that it gets from its GPS (global positioning system) sensor. The device location can be used in the active camera to apply it to the scene camera (s. SLCamera::setView).
Definition at line 86 of file SLDeviceLocation.h.
|
inline |
Definition at line 89 of file SLDeviceLocation.h.
|
inline |
Definition at line 169 of file SLDeviceLocation.h.
Definition at line 135 of file SLDeviceLocation.h.
|
inline |
Definition at line 163 of file SLDeviceLocation.h.
|
inline |
Definition at line 164 of file SLDeviceLocation.h.
Calculates the solar angles at origin at local time.
Calculates the zenith and azimuth angle in deg. of the sun at the origin at the local time using the Solar Position Algorithm from: https://midcdmz.nrel.gov/spa/ that is part of libsl_external.
Definition at line 265 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 165 of file SLDeviceLocation.h.
|
inline |
Definition at line 132 of file SLDeviceLocation.h.
Converter method: the transferred wgs84 coordinate is converted to ENU frame and returned (does not change SLDeviceLocation)
Definition at line 360 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 149 of file SLDeviceLocation.h.
|
inline |
Definition at line 151 of file SLDeviceLocation.h.
void SLDeviceLocation::defaultLatLonAlt | ( | int | degreesLat, |
int | minutesLat, | ||
double | secondsLat, | ||
int | degreesLon, | ||
int | minutesLon, | ||
double | secondsLon, | ||
double | altitudeM | ||
) |
Default coordinate setter in WGS84 Lat-Lon in degrees, minutes and seconds.
Definition at line 204 of file SLDeviceLocation.cpp.
Sets the default location in latitude, longitude and altitude.
It must be called after setting the origin. If no origin is set with it will be automatically set in onLocationLatLonAlt. The default location is used by the camera in SLCamera::setView if the current distance between _locENU and _originENU is greater than _locMaxDistanceM. Witch means that you are in real not near the location. /param latDEG Latitude (vertical) on WGS84 geoid in degrees /param lonDEG Longitude (horizontal) on WGS84 geoid in degrees /param altM Altitude over WGS84 geoid in meters
Definition at line 234 of file SLDeviceLocation.cpp.
Definition at line 126 of file SLDeviceLocation.h.
bool SLDeviceLocation::geoTiffIsAvailableAndValid | ( | ) | const |
Definition at line 429 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 154 of file SLDeviceLocation.h.
Definition at line 52 of file SLDeviceLocation.cpp.
Definition at line 103 of file SLDeviceLocation.h.
|
inline |
Definition at line 157 of file SLDeviceLocation.h.
void SLDeviceLocation::init | ( | ) |
Definition at line 18 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 143 of file SLDeviceLocation.h.
Setter that turns on the device rotation sensor.
Definition at line 252 of file SLDeviceLocation.cpp.
Loads a GeoTiff DEM (Digital Elevation Model) Image.
Definition at line 381 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 147 of file SLDeviceLocation.h.
|
inline |
Definition at line 145 of file SLDeviceLocation.h.
|
inline |
Definition at line 146 of file SLDeviceLocation.h.
|
inline |
Definition at line 144 of file SLDeviceLocation.h.
|
inline |
Definition at line 148 of file SLDeviceLocation.h.
Definition at line 127 of file SLDeviceLocation.h.
|
inline |
Definition at line 168 of file SLDeviceLocation.h.
|
inline |
Definition at line 153 of file SLDeviceLocation.h.
Definition at line 134 of file SLDeviceLocation.h.
|
inline |
Definition at line 166 of file SLDeviceLocation.h.
|
inline |
Definition at line 133 of file SLDeviceLocation.h.
SLstring SLDeviceLocation::offsetModeStr | ( | ) | const |
Returns the device location offset mode as string.
Definition at line 453 of file SLDeviceLocation.cpp.
void SLDeviceLocation::onLocationLatLonAlt | ( | SLdouble | latDEG, |
SLdouble | lonDEG, | ||
SLdouble | altM, | ||
SLfloat | accuracyM | ||
) |
Event handler for mobile device location update.
Global event handler for device GPS location with longitude and latitude in degrees and altitude in meters. This location uses the World Geodetic System 1984 (WGS84). The accuracy in meters is a radius in which the location is with a probability of 68% (2 sigma). The altitude in m is the most inaccurate information. The option _useOriginAltitude allows to overwrite the current altitude with the origins altitude. If a geoTiff is available the altitude is is take from it. /param latDEG Latitude (vertical) on WGS84 geoid in degrees /param lonDEG Longitude (horizontal) on WGS84 geoid in degrees /param altM Altitude over WGS84 geoid in meters /param accuracyM Accuracy in meters is a radius
Definition at line 75 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 152 of file SLDeviceLocation.h.
|
inline |
Definition at line 150 of file SLDeviceLocation.h.
void SLDeviceLocation::originLatLonAlt | ( | int | degreesLat, |
int | minutesLat, | ||
double | secondsLat, | ||
int | degreesLon, | ||
int | minutesLon, | ||
double | secondsLon, | ||
double | altitudeM | ||
) |
Origin coordinate setter in WGS84 Lat-Lon in degrees, minutes and seconds.
Definition at line 129 of file SLDeviceLocation.cpp.
Set global origin in latitude, longitude and altitude at the ground level.
The calculated values can be used for global camera positioning via GPS sensor. The origin is the zero point of the model. The origin should be defined in the model on the ground. /param latDEG Latitude (vertical) on WGS84 geoid in decimal degrees /param lonDEG Longitude (horizontal) on WGS84 geoid in decimal degrees /param altM Altitude over WGS84 geoid in meters
Definition at line 157 of file SLDeviceLocation.cpp.
Definition at line 115 of file SLDeviceLocation.h.
|
inline |
Definition at line 159 of file SLDeviceLocation.h.
|
inline |
Definition at line 160 of file SLDeviceLocation.h.
|
inline |
Definition at line 161 of file SLDeviceLocation.h.
|
inline |
Definition at line 158 of file SLDeviceLocation.h.
Return true if the current GPS location is within the GeoTiff boundaries.
Definition at line 443 of file SLDeviceLocation.cpp.
|
inline |
Definition at line 162 of file SLDeviceLocation.h.
|
inline |
Definition at line 128 of file SLDeviceLocation.h.
|
inline |
Definition at line 155 of file SLDeviceLocation.h.
Definition at line 102 of file SLDeviceLocation.h.
|
inline |
Definition at line 156 of file SLDeviceLocation.h.
|
private |
Index of the active named location as defaultENU;.
Definition at line 202 of file SLDeviceLocation.h.
|
private |
Altitude in m from Digital Elevation Model.
Definition at line 191 of file SLDeviceLocation.h.
|
private |
Altitude in m from GPS.
Definition at line 192 of file SLDeviceLocation.h.
|
private |
Height from ground to the mobile camera in m.
Definition at line 193 of file SLDeviceLocation.h.
|
private |
Default location in ENU frame used if real location is too far away from origin.
Definition at line 180 of file SLDeviceLocation.h.
|
private |
Default location of scene in LatLonAlt.
Definition at line 179 of file SLDeviceLocation.h.
|
private |
Digital Elevation Model from a Geo Tiff image.
Definition at line 199 of file SLDeviceLocation.h.
|
private |
Flag if this scene has a global reference location.
Definition at line 189 of file SLDeviceLocation.h.
|
private |
Flag if origin should be improved over time & accuracy.
Definition at line 194 of file SLDeviceLocation.h.
|
private |
Timer to measure the improve time.
Definition at line 196 of file SLDeviceLocation.h.
|
private |
Max. time in seconds for the origin improvement.
Definition at line 195 of file SLDeviceLocation.h.
|
private |
Flag for the first sensor values.
Definition at line 173 of file SLDeviceLocation.h.
|
private |
Flag if the devices GPS Sensor is used.
Definition at line 172 of file SLDeviceLocation.h.
|
private |
Horizontal accuracy radius in m with 68% probability.
Definition at line 177 of file SLDeviceLocation.h.
|
private |
Cartesian location in ECEF.
Definition at line 175 of file SLDeviceLocation.h.
|
private |
Cartesian location in ENU frame.
Definition at line 176 of file SLDeviceLocation.h.
|
private |
Earth location in latitudeDEG, longitudeDEG & AltitudeM on WGS84 geoid.
Definition at line 174 of file SLDeviceLocation.h.
|
private |
Max. allowed distance from origin. If higher it is ignored.
Definition at line 178 of file SLDeviceLocation.h.
|
private |
Vector of fix locations for default view points.
Definition at line 201 of file SLDeviceLocation.h.
|
private |
Offset vector in ENU frame.
Definition at line 183 of file SLDeviceLocation.h.
|
private |
Location offset mode.
Definition at line 200 of file SLDeviceLocation.h.
|
private |
Accuracy radius of origin point.
Definition at line 184 of file SLDeviceLocation.h.
|
private |
Origin location in ENU frame.
Definition at line 182 of file SLDeviceLocation.h.
|
private |
Global origin location of scene in LatLonAlt.
Definition at line 181 of file SLDeviceLocation.h.
|
private |
Azimuth angle of the sun in deg. (eastward from north) at origin at local time.
Definition at line 186 of file SLDeviceLocation.h.
|
private |
Sunrise local time at origin.
Definition at line 187 of file SLDeviceLocation.h.
|
private |
Sunset local time at origin.
Definition at line 188 of file SLDeviceLocation.h.
|
private |
Zenith angle of the sun in deg. (from up dir.) at origin at local time.
Definition at line 185 of file SLDeviceLocation.h.
|
private |
Pointer to directional light node to be changed if solar angles are calculated.
Definition at line 198 of file SLDeviceLocation.h.
|
private |
Flag if global reference altitude should be used.
Definition at line 190 of file SLDeviceLocation.h.
|
private |
ECEF frame to world frame rotation: rotates a point defined in ecef.
Definition at line 197 of file SLDeviceLocation.h.