Stellarium  0.17.0
Data Structures | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
Landscape Class Referenceabstract

Store and manages the displaying of the Landscape. More...

#include <Landscape.hpp>

Data Structures

struct  LandscapeLabel
 

Public Types

enum  horizonListMode {
  azDeg_altDeg = 0, azDeg_zdDeg = 1, azRad_altRad = 2, azRad_zdRad = 3,
  azGrad_altGrad = 4, azGrad_zdGrad = 5
}
 The list of azimuths (counted from True North towards East) and altitudes can come in various formats. We read the first two elements, which can be of formats: More...
 

Public Member Functions

 Landscape (float _radius=2.f)
 
virtual void load (const QSettings &landscapeIni, const QString &landscapeId)=0
 Load landscape. More...
 
virtual unsigned int getMemorySize () const
 Return approximate memory footprint in bytes (required for cache cost estimate in LandscapeMgr) The returned value is only approximate, content of QStrings and other small containers like the horizon polygon are not put in in detail. More...
 
virtual void draw (StelCore *core)=0
 
void update (double deltaTime)
 
void setBrightness (const float b, const float pollutionBrightness=0.0f)
 Set the brightness of the landscape plus brightness of optional add-on night lightscape. More...
 
float getBrightness () const
 Returns the current brightness level.
 
float getLightscapeBrightness () const
 Returns the lightscape brightness.
 
float getTargetLightscapeBrightness () const
 Returns the lightscape brighness modulated with the fader's target state (i.e. binary on/off)
 
float getEffectiveLightscapeBrightness () const
 Gets the currently effective lightscape brightness (modulated by the fader)
 
void setFlagShow (const bool b)
 Set whether landscape is displayed (does not concern fog)
 
bool getFlagShow () const
 Get whether landscape is displayed (does not concern fog)
 
float getEffectiveLandFadeValue ()
 Returns the currently effective land fade value.
 
void setFlagShowFog (const bool b)
 Set whether fog is displayed.
 
bool getFlagShowFog () const
 Get whether fog is displayed.
 
void setFlagShowIllumination (const bool b)
 Set whether illumination is displayed.
 
bool getFlagShowIllumination () const
 Get whether illumination is displayed.
 
void setFlagShowLabels (const bool b)
 Set whether labels are displayed.
 
bool getFlagShowLabels () const
 Get whether labels are displayed.
 
void setLabelFontSize (const int size)
 change font and fontsize for landscape labels
 
QString getName () const
 Get landscape name.
 
QString getAuthorName () const
 Get landscape author name.
 
QString getDescription () const
 Get landscape description.
 
QString getId () const
 Get landscape id. This is the landscape directory name, used for cache handling.
 
const StelLocationgetLocation () const
 Return the associated location (may be empty!)
 
bool hasLocation () const
 Return if the location is valid (a valid location has a valid planetName!)
 
int getDefaultBortleIndex () const
 Return default Bortle index (light pollution value) or -1 (unknown/no change)
 
int getDefaultFogSetting () const
 Return default fog setting (0/1) or -1 (no change)
 
float getDefaultAtmosphericExtinction () const
 Return default atmosperic extinction [mag/airmass], or -1 (no change)
 
float getDefaultAtmosphericTemperature () const
 Return configured atmospheric temperature [degrees Celsius], for refraction computation, or -1000 for "unknown/no change".
 
float getDefaultAtmosphericPressure () const
 Return configured atmospheric pressure [mbar], for refraction computation. More...
 
float getLandscapeMinimalBrightness () const
 Return minimal brightness for landscape returns -1 to signal "standard conditions" (use default value from config.ini)
 
void setZRotation (float d)
 Set an additional z-axis (azimuth) rotation after landscape has been loaded. More...
 
bool getIsFullyVisible () const
 Get whether the landscape is currently fully visible (i.e. opaque).
 
float getSinMinAltitudeLimit () const
 Get the sine of the limiting altitude (can be used to short-cut drawing below horizon, like star fields). There is no set here, value is only from landscape.ini.
 
virtual float getOpacity (Vec3d azalt) const
 Find opacity in a certain direction. More...
 
void loadLabels (const QString &landscapeId)
 Load descriptive labels from optional file gazetteer.LANG.utf8.
 

Protected Member Functions

void loadCommon (const QSettings &landscapeIni, const QString &landscapeId)
 Load attributes common to all landscapes. More...
 
void drawLabels (StelCore *core, StelPainter *painter)
 Draw optional labels on the landscape.
 
void createPolygonalHorizon (const QString &lineFileName, const float polyAngleRotateZ=0.0f, const QString &listMode="azDeg_altDeg", const bool polygonInverted=false)
 Create a StelSphericalPolygon that describes a measured horizon line. More...
 
const QString getTexturePath (const QString &basename, const QString &landscapeId) const
 search for a texture in landscape directory, else global textures directory More...
 

Protected Attributes

float radius
 
QString name
 
QString author
 Read from landscape.ini:[landscape]name.
 
QString description
 Read from landscape.ini:[landscape]author.
 
QString id
 Read from landscape.ini:[landscape]description.
 
float minBrightness
 Set during load. Required for consistent caching.
 
float landscapeBrightness
 Read from landscape.ini:[landscape]minimal_brightness. Allows minimum visibility that cannot be underpowered.
 
float lightScapeBrightness
 brightness [0..1] to draw the landscape. Computed by the LandscapeMgr.
 
bool validLandscape
 can be used to draw nightscape texture (e.g. city light pollution), if available. Computed by the LandscapeMgr.
 
LinearFader landFader
 was a landscape loaded properly?
 
LinearFader fogFader
 Used to slowly fade in/out landscape painting.
 
LinearFader illumFader
 Used to slowly fade in/out fog painting.
 
LinearFader labelFader
 Used to slowly fade in/out illumination painting.
 
int rows
 Used to slowly fade in/out landscape feature labels.
 
int cols
 horizontal rows. May be given in landscape.ini:[landscape]tesselate_rows. More indicates higher accuracy, but is slower.
 
float angleRotateZ
 vertical columns. May be given in landscape.ini:[landscape]tesselate_cols. More indicates higher accuracy, but is slower.
 
float angleRotateZOffset
 [radians] if pano does not have its left border in the east, rotate in azimuth. Configured in landscape.ini[landscape]angle_rotatez (or decor_angle_rotatez for old_style landscapes)
 
float sinMinAltitudeLimit
 [radians] This is a rotation changeable at runtime via setZRotation (called by LandscapeMgr::setZRotation). More...
 
StelLocation location
 Minimal altitude of landscape cover. Can be used to construct bounding caps, so that e.g. no stars are drawn below this altitude. Default -0.035, i.e. sin(-2 degrees).
 
int defaultBortleIndex
 OPTIONAL. If present, can be used to set location.
 
int defaultFogSetting
 May be given in landscape.ini:[location]light_pollution. Default: -1 (no change).
 
float defaultExtinctionCoefficient
 May be given in landscape.ini:[location]display_fog: -1(no change), 0(off), 1(on). Default: -1.
 
float defaultTemperature
 May be given in landscape.ini:[location]atmospheric_extinction_coefficient. Default -1 (no change).
 
float defaultPressure
 [Celsius] May be given in landscape.ini:[location]atmospheric_temperature. default: -1000.0 (no change)
 
SphericalRegionP horizonPolygon
 [mbar] May be given in landscape.ini:[location]atmospheric_pressure. Default -1.0 (compute from [location]/altitude), use -2 to indicate "no change".
 
Vec3f horizonPolygonLineColor
 Optional element describing the horizon line. More...
 
QList< LandscapeLabellandscapeLabels
 for all horizon types, the horizonPolygon line, if specified, will be drawn in this color More...
 
int fontSize
 
Vec3f labelColor
 Used for landscape labels (optionally indicating landscape features)
 

Detailed Description

Don't use this class directly, use the LandscapeMgr. A landscape's most important element is a photo panorama, or at least a polygon that describes the true horizon visible from your observing location. Optional components include:

We discern:

Parameters
LandscapeIdThe directory name of the landscape.
nameThe landscape name as specified in the LandscapeIni (may contain spaces, translatable, UTF8, ...)

Data Structure Documentation

struct Landscape::LandscapeLabel
Data Fields
Vec3d featurePoint
Vec3d labelPoint
QString name

Member Enumeration Documentation

Enumerator
azDeg_zdDeg 

azimuth[degrees] altitude[degrees]

azRad_altRad 

azimuth[degrees] zenithDistance[degrees]

azRad_zdRad 

azimuth[radians] altitude[radians]

azGrad_altGrad 

azimuth[radians] zenithDistance[radians]

azGrad_zdGrad 

azimuth[new_degrees] altitude[new_degrees] (may be found on theodolites)

Member Function Documentation

void Landscape::createPolygonalHorizon ( const QString &  lineFileName,
const float  polyAngleRotateZ = 0.0f,
const QString &  listMode = "azDeg_altDeg",
const bool  polygonInverted = false 
)
protected

If present, this can be used to draw a horizon line or simplify the functionality to discern if an object is below the horizon.

Parameters
lineFileNameA text file with lines that are either empty or comment lines starting with # or azimuth altitude [degrees]
polyAngleRotateZpossibility to set some final calibration offset like meridian convergence correction.
listModekeys which indicate angular units for the angles
polygonInvertedMust be true to use horizons which are on average below mathematical horizon (Solution for bug LP:1554639)
float Landscape::getDefaultAtmosphericPressure ( ) const
inline

returns -1 to signal "standard conditions" [compute from altitude], or -2 for "unknown/invalid/no change"

virtual unsigned int Landscape::getMemorySize ( ) const
inlinevirtual

However, texture image sizes must be computed in subclasses. The value returned is a sum of RAM and texture memory requirements.

Reimplemented in LandscapeSpherical, LandscapeFisheye, LandscapePolygonal, and LandscapeOldStyle.

virtual float Landscape::getOpacity ( Vec3d  azalt) const
inlinevirtual

(New in V0.13 series) can be used to find sunrise or visibility questions on the real-world landscape horizon. Default implementation indicates the horizon equals math horizon.

Reimplemented in LandscapeSpherical, LandscapeFisheye, LandscapePolygonal, and LandscapeOldStyle.

const QString Landscape::getTexturePath ( const QString &  basename,
const QString &  landscapeId 
) const
protected
Parameters
basenameThe name of a texture file, e.g. "fog.png"
landscapeIdThe landscape ID (directory name) to which the texture belongs
Exceptions
miscpossibility of throwing "file not found" exceptions
virtual void Landscape::load ( const QSettings &  landscapeIni,
const QString &  landscapeId 
)
pure virtual
Parameters
landscapeIniA reference to an existing QSettings object which describes the landscape
landscapeIdThe name of the directory for the landscape files (e.g. "ocean")

Implemented in LandscapeSpherical, LandscapeFisheye, LandscapePolygonal, and LandscapeOldStyle.

void Landscape::loadCommon ( const QSettings &  landscapeIni,
const QString &  landscapeId 
)
protected
Parameters
landscapeIniA reference to an existing QSettings object which describes the landscape
landscapeIdThe name of the directory for the landscape files (e.g. "ocean")
void Landscape::setBrightness ( const float  b,
const float  pollutionBrightness = 0.0f 
)
inline

This is called in each draw().

void Landscape::setZRotation ( float  d)
inline

This is intended for special uses such as when the landscape consists of a vehicle which might change orientation over time (e.g. a ship). It is called e.g. by the LandscapeMgr. Contrary to that, the purpose of the azimuth rotation (landscape/[decor_]angle_rotatez) in landscape.ini is to orient the pano.

Parameters
dthe rotation angle in degrees.

Field Documentation

Vec3f Landscape::horizonPolygonLineColor
protected

Data shall be read from the file given as landscape.ini[landscape]polygonal_horizon_list For LandscapePolygonal, this is the only horizon data item.

QList<LandscapeLabel> Landscape::landscapeLabels
protected

specified in landscape.ini[landscape]horizon_line_color. Negative red (default) indicated "don't draw".

float Landscape::sinMinAltitudeLimit
protected

Not in landscape.ini: Used in special cases where the horizon may rotate, e.g. on a ship.