QGIS API Documentation 4.1.0-Master (376402f9aeb)
Loading...
Searching...
No Matches
qgssunpositioncalculator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssunpositioncalculator.h
3 -----------------------------
4 Date : April 2026
5 Copyright : (C) 2026 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSUNPOSITIONCALCULATOR_H
17#define QGSSUNPOSITIONCALCULATOR_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21#include "qgis_sip.h"
22
23class QgsPointXY;
26
32struct CORE_EXPORT QgsSunPositionResult
33{
35 double azimuth = 0.0;
36
38 double apparentElevation = 0.0;
39
42
44 QDateTime solarTransit;
45
48
50 QDateTime sunrise;
51
53 QDateTime sunset;
54
56 QDateTime civilDawn;
57
59 QDateTime civilDusk;
60
62 QDateTime nauticalDawn;
63
65 QDateTime nauticalDusk;
66
69
72};
73
84class CORE_EXPORT QgsSunPositionCalculator
85{
86 public:
106 const QgsPointXY &point,
108 const QgsCoordinateTransformContext &context,
109 const QDateTime &dateTime,
110 double elevationMeters = 0.0,
111 double pressure = 1013.25,
112 double temperature = 15.0
114
115 private:
116 static QString extractSpaErrorMessage( int errorCode );
117};
118
119#endif
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Custom exception class when argument are invalid.
Represents a 2D point.
Definition qgspointxy.h:62
Calculates the sun's position and related sun events for a given datetime.
static QgsSunPositionResult calculate(const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context, const QDateTime &dateTime, double elevationMeters=0.0, double pressure=1013.25, double temperature=15.0)
Calculates the solar position and events for a given point and time.
#define SIP_THROW(name,...)
Definition qgis_sip.h:210
Contains the results of a solar position calculation.
QDateTime astronomicalDawn
The datetime of astronomical dawn, when the geometric center of the sun is 18 degrees below the horiz...
QDateTime astronomicalDusk
The datetime of astronomical dusk, when the geometric center of the sun is 18 degrees below the horiz...
QDateTime civilDawn
The datetime of civil dawn, when the geometric center of the sun is 6 degrees below the horizon in th...
QDateTime nauticalDawn
The datetime of nautical dawn, when the geometric center of the sun is 12 degrees below the horizon i...
double azimuth
Azimuth angle in degrees clockwise from North.
QDateTime solarTransit
The datetime of solar transit (solar noon) when the sun reaches its highest elevation (in UTC).
QDateTime solarMidnightAfter
The datetime of the solar midnight following the calculation time (in UTC).
QDateTime sunrise
The datetime of sunrise, defined as the moment the upper edge of the sun's disk becomes visible above...
QDateTime sunset
The datetime of sunset, defined as the moment the upper edge of the sun's disk disappears below the h...
QDateTime nauticalDusk
The datetime of nautical dusk, when the geometric center of the sun is 12 degrees below the horizon i...
QDateTime solarMidnightBefore
The datetime of the solar midnight preceding the calculation time (in UTC).
QDateTime civilDusk
The datetime of civil dusk, when the geometric center of the sun is 6 degrees below the horizon in th...
double apparentElevation
Apparent topocentric elevation angle in degrees (corrected for atmospheric refraction).