QGIS API Documentation
4.3.0-Master (a080b0d5f12)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
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
23
class
QgsPointXY
;
24
class
QgsCoordinateReferenceSystem
;
25
class
QgsCoordinateTransformContext
;
26
32
struct
CORE_EXPORT
QgsSunPositionResult
33
{
35
double
azimuth
= 0.0;
36
38
double
apparentElevation
= 0.0;
39
41
QDateTime
solarMidnightBefore
;
42
44
QDateTime
solarTransit
;
45
47
QDateTime
solarMidnightAfter
;
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
68
QDateTime
astronomicalDawn
;
69
71
QDateTime
astronomicalDusk
;
72
};
73
84
class
CORE_EXPORT
QgsSunPositionCalculator
85
{
86
public
:
105
static
QgsSunPositionResult
calculate
(
106
const
QgsPointXY
&point,
107
const
QgsCoordinateReferenceSystem
&crs,
108
const
QgsCoordinateTransformContext
&context,
109
const
QDateTime &dateTime,
110
double
elevationMeters = 0.0,
111
double
pressure = 1013.25,
112
double
temperature = 15.0
113
)
SIP_THROW
(
QgsCsException
,
QgsInvalidArgumentException
);
114
115
private
:
116
static
QString extractSpaErrorMessage(
int
errorCode );
117
};
118
119
#endif
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsCsException
Custom exception class for Coordinate Reference System related exceptions.
Definition
qgsexception.h:60
QgsInvalidArgumentException
Custom exception class when argument are invalid.
Definition
qgsexception.h:162
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
QgsSunPositionCalculator
Calculates the sun's position and related sun events for a given datetime.
Definition
qgssunpositioncalculator.h:85
QgsSunPositionCalculator::calculate
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.
Definition
qgssunpositioncalculator.cpp:34
qgis.h
qgis_sip.h
SIP_THROW
#define SIP_THROW(name,...)
Definition
qgis_sip.h:215
QgsSunPositionResult
Contains the results of a solar position calculation.
Definition
qgssunpositioncalculator.h:33
QgsSunPositionResult::astronomicalDawn
QDateTime astronomicalDawn
The datetime of astronomical dawn, when the geometric center of the sun is 18 degrees below the horiz...
Definition
qgssunpositioncalculator.h:68
QgsSunPositionResult::astronomicalDusk
QDateTime astronomicalDusk
The datetime of astronomical dusk, when the geometric center of the sun is 18 degrees below the horiz...
Definition
qgssunpositioncalculator.h:71
QgsSunPositionResult::civilDawn
QDateTime civilDawn
The datetime of civil dawn, when the geometric center of the sun is 6 degrees below the horizon in th...
Definition
qgssunpositioncalculator.h:56
QgsSunPositionResult::nauticalDawn
QDateTime nauticalDawn
The datetime of nautical dawn, when the geometric center of the sun is 12 degrees below the horizon i...
Definition
qgssunpositioncalculator.h:62
QgsSunPositionResult::azimuth
double azimuth
Azimuth angle in degrees clockwise from North.
Definition
qgssunpositioncalculator.h:35
QgsSunPositionResult::solarTransit
QDateTime solarTransit
The datetime of solar transit (solar noon) when the sun reaches its highest elevation (in UTC).
Definition
qgssunpositioncalculator.h:44
QgsSunPositionResult::solarMidnightAfter
QDateTime solarMidnightAfter
The datetime of the solar midnight following the calculation time (in UTC).
Definition
qgssunpositioncalculator.h:47
QgsSunPositionResult::sunrise
QDateTime sunrise
The datetime of sunrise, defined as the moment the upper edge of the sun's disk becomes visible above...
Definition
qgssunpositioncalculator.h:50
QgsSunPositionResult::sunset
QDateTime sunset
The datetime of sunset, defined as the moment the upper edge of the sun's disk disappears below the h...
Definition
qgssunpositioncalculator.h:53
QgsSunPositionResult::nauticalDusk
QDateTime nauticalDusk
The datetime of nautical dusk, when the geometric center of the sun is 12 degrees below the horizon i...
Definition
qgssunpositioncalculator.h:65
QgsSunPositionResult::solarMidnightBefore
QDateTime solarMidnightBefore
The datetime of the solar midnight preceding the calculation time (in UTC).
Definition
qgssunpositioncalculator.h:41
QgsSunPositionResult::civilDusk
QDateTime civilDusk
The datetime of civil dusk, when the geometric center of the sun is 6 degrees below the horizon in th...
Definition
qgssunpositioncalculator.h:59
QgsSunPositionResult::apparentElevation
double apparentElevation
Apparent topocentric elevation angle in degrees (corrected for atmospheric refraction).
Definition
qgssunpositioncalculator.h:38
Generated on
for QGIS API Documentation by
1.17.0