82 float altToUse = (float)altM;
145 originWGS84Decimal.
lon,
146 originWGS84Decimal.
alt);
170 double sinPhi = sin(phiRad);
171 double cosPhi = cos(phiRad);
172 double sinLam = sin(lamRad);
173 double cosLam = cos(lamRad);
220 defaultWGS84Decimal.
lon,
221 defaultWGS84Decimal.
alt);
273 memcpy(&ut, std::gmtime(&time),
sizeof(tm));
274 memcpy(<, std::localtime(&time),
sizeof(tm));
281 SL_LOG_DEBUG(
"Universal time : %02d.%02d.%02d %02d:%02d:%02d",
288 SL_LOG_DEBUG(
"Local time : %02d.%02d.%02d %02d:%02d:%02d",
301 spa.year = lt.tm_year;
302 spa.month = lt.tm_mon;
303 spa.day = lt.tm_mday;
304 spa.hour = lt.tm_hour;
305 spa.minute = lt.tm_min;
306 spa.second = lt.tm_sec;
307 spa.timezone = lt.tm_hour - ut.tm_hour;
310 spa.longitude = locationLatLonAlt.
lon;
311 spa.latitude = locationLatLonAlt.
lat;
312 spa.elevation = locationLatLonAlt.
alt;
314 spa.pressure = 1013.25 * pow((1.0 - 0.0065 * locationLatLonAlt.
alt / 288.15), 5.255);
315 spa.temperature = 15.0;
317 spa.azm_rotation = 0;
318 spa.atmos_refract = 0.5667;
319 spa.function = SPA_ALL;
322 result = spa_calculate(&spa);
341 SL_LOG_DEBUG(
"Sunrise : %02d:%02d:%02d Local Time", (
int)(SRh), (
int)SRm, (
int)SRs);
342 SL_LOG_DEBUG(
"Sunset : %02d:%02d:%02d Local Time", (
int)(SSh), (
int)SSm, (
int)SSs);
356 return (result == 0);
387 "Set first defaultLatLonAlt and originLatLonAlt before you add a GeoTiff.");
410 string msg =
"SLDeviceLocation::loadGeoTiff: Either the geotiff file ";
411 msg +=
"could not be loaded or the origin or default position lies ";
412 msg +=
"not within the extends of the geotiff file.";
413 throw std::runtime_error(msg.c_str());
416 catch (std::exception& e)
422 SL_WARN_MSG(
"SLDeviceLocation::loadGeoTiff: Unknown exception catched.");
459 default:
return "Unknown";
#define SL_LOG_DEBUG(...)
#define SL_WARN_MSG(message)
Container for general algorithm functions.
Mobile device location class declaration.
CVVec3d lowerRightLatLonAlt() const
void loadGeoTiff(const string &filename)
Loads a GEOTiff file into the OpenCV image matrix.
float getAltitudeAtLatLon(double lat, double lon) const
Returns the altitude in m at the given position in WGS84 latitude-longitude.
CVVec3d upperLeftLatLonAlt() const
SLfloat _originSolarAzimuth
Azimuth angle of the sun in deg. (eastward from north) at origin at local time.
SLfloat _originSolarSunset
Sunset local time at origin.
void loadGeoTiff(const SLstring &geoTiffFile)
Loads a GeoTiff DEM (Digital Elevation Model) Image.
SLVec3d locLatLonAlt() const
bool posIsOnGeoTiff(SLdouble latDEG, SLdouble lonDEG) const
Return true if the current GPS location is within the GeoTiff boundaries.
SLstring offsetModeStr() const
Returns the device location offset mode as string.
SLbool calculateSolarAngles(SLVec3d locationLatLonAlt, std::time_t time)
Calculates the solar angles at origin at local time.
SLVec3d _locLatLonAlt
Earth location in latitudeDEG, longitudeDEG & AltitudeM on WGS84 geoid.
SLfloat _originAccuracyM
Accuracy radius of origin point.
SLVLocation _nameLocations
Vector of fix locations for default view points.
SLVec3d _defaultLatLonAlt
Default location of scene in LatLonAlt.
SLVec3d convertLatLonAlt2ENU(SLVec3d locLatLonAlt) const
Converter method: the transferred wgs84 coordinate is converted to ENU frame and returned (does not c...
SLbool _isFirstSensorValue
Flag for the first sensor values.
SLint _activeNamedLocation
Index of the active named location as defaultENU;.
SLVec3d originLatLonAlt() const
SLLocOffsetMode _offsetMode
Location offset mode.
SLfloat _locMaxDistanceM
Max. allowed distance from origin. If higher it is ignored.
SLVec3d _locECEF
Cartesian location in ECEF.
CVImageGeoTiff _demGeoTiff
Digital Elevation Model from a Geo Tiff image.
SLVec3d _defaultENU
Default location in ENU frame used if real location is too far away from origin.
HighResTimer _improveTimer
Timer to measure the improve time.
SLNode * _sunLightNode
Pointer to directional light node to be changed if solar angles are calculated.
SLVec3d _offsetENU
Offset vector in ENU frame.
bool geoTiffIsAvailableAndValid() const
SLfloat _locAccuracyM
Horizontal accuracy radius in m with 68% probability.
SLVec3d _originLatLonAlt
Global origin location of scene in LatLonAlt.
void onLocationLatLonAlt(SLdouble latDEG, SLdouble lonDEG, SLdouble altM, SLfloat accuracyM)
Event handler for mobile device location update.
SLbool _useOriginAltitude
Flag if global reference altitude should be used.
SLfloat _originSolarZenith
Zenith angle of the sun in deg. (from up dir.) at origin at local time.
SLMat3d _wRecef
ECEF frame to world frame rotation: rotates a point defined in ecef.
SLVec3d _locENU
Cartesian location in ENU frame.
SLbool _hasOrigin
Flag if this scene has a global reference location.
SLfloat _altDemM
Altitude in m from Digital Elevation Model.
SLbool _improveOrigin
Flag if origin should be improved over time & accuracy.
SLVec3d defaultLatLonAlt() const
SLfloat _improveTimeSEC
Max. time in seconds for the origin improvement.
SLfloat _altGpsM
Altitude in m from GPS.
SLbool _isUsed
Flag if the devices GPS Sensor is used.
SLfloat _cameraHeightM
Height from ground to the mobile camera in m.
SLVec3d _originENU
Origin location in ENU frame.
SLfloat _originSolarSunrise
Sunrise local time at origin.
void rotation(const T angleDEG, const SLVec3< T > &axis)
Sets the rotation components
void rotation(const SLQuat4f &rot, SLTransformSpace relativeTo=TS_parent)
void rotate(const SLQuat4f &rot, SLTransformSpace relativeTo=TS_object)
void latlonAlt2ecef(const SLVec3 &latDegLonDegAltM)
Latitude Longitude Altitude (LatLonAlt) to Earth Centered Earth Fixed (ecef) using the WGS84 model.
void set(const T X, const T Y, const T Z)
T geoDegMinSec2Decimal(int degrees, int minutes, T seconds)
convert geodetic datum defined in degrees, minutes and seconds to decimal
static const float DEG2RAD