Stellarium  HEAD
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
StelLocation Class Reference

Store the information for a location on a planet. More...

#include <StelLocation.hpp>

Public Member Functions

 StelLocation (const QString &lName, const QString &lState, const QString &lRegion, const float lng, const float lat, const int alt, const int populationK, const QString &timeZone, const int bortleIndex, const QChar roleKey='X', const QString &landscapeID=QString())
 constructors for ad-hoc locations. More...
 
 StelLocation (const QString &lName, const QString &lState, const QString &lRegion, const QString &plName, const float lng, const float lat, const int alt, const int populationK, const QString &timeZone, const int bortleIndex, const QChar roleKey, const QString &landscapeID)
 
QString getID () const
 Return a short string which can be used in a list view.
 
bool isValid () const
 
QString serializeToLine () const
 Output the location as a string ready to be stored in the user_location file.
 
float distanceDegrees (const float otherLong, const float otherLat) const
 Compute great-circle distance from other location. More...
 
double distanceKm (const double otherLong, const double otherLat) const
 Compute great-circle distance from other location. More...
 
double getAzimuthForLocation (double longTarget, double latTarget) const
 Compute azimuth towards Target. More...
 
float getLatitude (bool suppressObserver=false) const
 longitude and latitude are private to force use of special getters. More...
 
float getLongitude (bool suppressObserver=false) const
 
void setLatitude (float l)
 
void setLongitude (float l)
 

Static Public Member Functions

static StelLocation createFromLine (const QString &line)
 Parse a location from a line serialization.
 
static float distanceDegrees (const float long1, const float lat1, const float long2, const float lat2)
 Compute great-circle distance between two locations on a spherical body arguments given in decimal degrees.
 
static double distanceKm (Planet *planet, const double long1, const double lat1, const double long2, const double lat2)
 Compute great-circle distance between two locations on the current planet (takes flattening into account) arguments given in decimal degrees Source: Jean Meeus, Astronomical Algorithms, 2nd edition, ch.11.
 
static double getAzimuthForLocation (double longObs, double latObs, double longTarget, double latTarget)
 Compute azimuth from Obs towards Target. More...
 

Data Fields

QString name
 Location/city name.
 
QString region
 English region name (Northern Europe for example) or empty string.
 
QString state
 State/region name (useful if 2 locations of the same country have the same name)
 
QString planetName
 English planet name.
 
int altitude
 Altitude in meter.
 
QVariant lightPollutionLuminance
 Zenith luminance at moonless night as could be measured by a Sky Quality Meter, in cd/m²
 
QString landscapeKey
 A hint for associating a landscape to the location.
 
int population
 Population in thousands of inhabitants.
 
QChar role
 Location role code. More...
 
QString ianaTimeZone
 IANA identificator of time zone. More...
 
bool isUserLocation
 Used privately by the StelLocationMgr.
 

Static Public Attributes

static const float DEFAULT_LIGHT_POLLUTION_LUMINANCE
 

Detailed Description

Store the information for a location on a planet.

Constructor & Destructor Documentation

◆ StelLocation()

StelLocation::StelLocation ( const QString &  lName,
const QString &  lState,
const QString &  lRegion,
const float  lng,
const float  lat,
const int  alt,
const int  populationK,
const QString &  timeZone,
const int  bortleIndex,
const QChar  roleKey = 'X',
const QString &  landscapeID = QString() 
)

constructors for ad-hoc locations.

The first, shorter version is only for earth locations

  • lName location name
  • lState may be usedful if region has more than one such name
  • lRegion must be the long name of UN UM49 only! (E.g., "Western Europe")
  • plName planetName. This must be identical to the englishName of a solar system object.
  • lng geographical longitude, east-positive, degrees
  • lat geographical latitude, north-positive, degrees
  • alt altitude above mean sea level
  • populationK population in thousands
  • timeZone IANA timezone string like "Europe/Vienna" or "UT-7"
  • bortleIndex light pollution hint
  • roleKey code for location role.
  • landscapeID a fitting landscape

Member Function Documentation

◆ distanceDegrees()

float StelLocation::distanceDegrees ( const float  otherLong,
const float  otherLat 
) const
inline

Compute great-circle distance from other location.

arguments given in decimal degrees

◆ distanceKm()

double StelLocation::distanceKm ( const double  otherLong,
const double  otherLat 
) const

Compute great-circle distance from other location.

arguments given in decimal degrees

◆ getAzimuthForLocation() [1/2]

static double StelLocation::getAzimuthForLocation ( double  longObs,
double  latObs,
double  longTarget,
double  latTarget 
)
static

Compute azimuth from Obs towards Target.

All angles (args and result) are in degrees.

Returns
azimuth counted from north or south as set in the StelApp preferences, in [0...360].

◆ getAzimuthForLocation() [2/2]

double StelLocation::getAzimuthForLocation ( double  longTarget,
double  latTarget 
) const

Compute azimuth towards Target.

All angles (args and result) are in degrees.

Returns
azimuth counted from north or south as set in the StelApp preferences, in [0...360].

◆ getLatitude()

float StelLocation::getLatitude ( bool  suppressObserver = false) const

longitude and latitude are private to force use of special getters.

These return a location on the north pole if we are located on an "Observer" (when "role" == 'o'). By this we force useful view orientation when on an observer pseudo-planet.

Parameters
suppressObserverset to true to return the actual number in every case. (Required for some UI elements)

Field Documentation

◆ ianaTimeZone

QString StelLocation::ianaTimeZone

IANA identificator of time zone.

Note that timezone names under various OSes may be different than those used in Stellarium's location database (e.g. Ubuntu:Asia/Kolkata=Windows:Asia/Calcutta), which requires some translation effort during the loading process. After loading from the location DB, the ianaTimeZone should contain the full name which may differ from the database name.

◆ role

QChar StelLocation::role

Location role code.

Possible values:

  • C or B is a capital city
  • R is a regional capital
  • N is a normal city (any other type of settlement)
  • O is an observatory
  • L is a spacecraft lander
  • I is a spacecraft impact
  • A is a spacecraft crash
  • X is an unknown or user-defined location (the default value).
  • ! is an invalid location.
  • o is an "observer" pseudo-planet. This is not stored in the location database but used ad-hoc in the LocationDialog.