Stellarium 0.13.3
List of all members | Public Slots | Signals | Public Member Functions | Properties
LandscapeMgr Class Reference

Manages all the rendering at the level of the observer's surroundings. More...

#include <LandscapeMgr.hpp>

Public Slots

QStringList getAllLandscapeNames () const
 Retrieve a list of the names of all the available landscapes in the file search path sub-directories of the landscape area. More...
 
QStringList getAllLandscapeIDs () const
 Retrieve a list of the identifiers of all the available landscapes in the file search path sub-directories of the landscape area. More...
 
QStringList getUserLandscapeIDs () const
 Retrieve a list of the identifiers of all user-installed landscapes. More...
 
const QString & getCurrentLandscapeID () const
 Get the current landscape ID. More...
 
bool setCurrentLandscapeID (const QString &id, const double changeLocationDuration=1.0)
 Change the current landscape to the landscape with the ID specified. More...
 
QString getCurrentLandscapeName () const
 Get the current landscape name. More...
 
bool setCurrentLandscapeName (const QString &name, const double changeLocationDuration=1.0)
 Change the current landscape to the landscape with the name specified. More...
 
LandscapegetCurrentLandscape () const
 Get the current landscape object. More...
 
const QString & getDefaultLandscapeID () const
 Get the default landscape ID. More...
 
bool setDefaultLandscapeID (const QString &id)
 Change the default landscape to the landscape with the ID specified. More...
 
QString getCurrentLandscapeHtmlDescription () const
 Return a pseudo HTML formatted string with all informations on the current landscape. More...
 
QString getDescription () const
 Return a pseudo HTML formatted string with information from description or ini file. More...
 
bool getFlagLandscape () const
 Get flag for displaying Landscape. More...
 
void setFlagLandscape (const bool displayed)
 Set flag for displaying Landscape. More...
 
bool getIsLandscapeFullyVisible () const
 Get whether the landscape is currently visible. If true, object below landscape must be rendered. More...
 
bool getFlagFog () const
 Get flag for displaying Fog. More...
 
void setFlagFog (const bool displayed)
 Set flag for displaying Fog. More...
 
bool getFlagIllumination () const
 Get flag for displaying illumination layer. More...
 
void setFlagIllumination (const bool on)
 Set flag for displaying illumination layer. More...
 
bool getFlagLandscapeSetsLocation () const
 Return the value of the flag determining if a change of landscape will update the observer location. More...
 
void setFlagLandscapeSetsLocation (bool b)
 Set the value of the flag determining if a change of landscape will update the observer location. More...
 
bool getFlagLandscapeUseMinimalBrightness () const
 Return the value of the flag determining if a minimal brightness should be used to keep landscape visible. More...
 
void setFlagLandscapeUseMinimalBrightness (bool b)
 Set the value of the flag determining if a minimal brightness should be used to keep landscape visible. More...
 
bool getFlagLandscapeSetsMinimalBrightness () const
 Return the value of the flag determining if the minimal brightness should be taken from landscape.ini. More...
 
void setFlagLandscapeSetsMinimalBrightness (bool b)
 Sets the value of the flag determining if the minimal brightness should be taken from landscape.ini. More...
 
double getDefaultMinimalBrightness () const
 Return the minimal brightness value of the landscape. More...
 
void setDefaultMinimalBrightness (const double b)
 Set the minimal brightness value of the landscape. More...
 
void setFlagUseLightPollutionFromDatabase (const bool usage)
 Sets the value of the flag usage light pollution (and bortle index) from locations database. More...
 
bool getFlagUseLightPollutionFromDatabase () const
 Return the value of flag usage light pollution (and bortle index) from locations database. More...
 
bool getFlagCardinalsPoints () const
 Get flag for displaying Cardinals Points. More...
 
void setFlagCardinalsPoints (const bool displayed)
 Set flag for displaying Cardinals Points. More...
 
Vec3f getColorCardinalPoints () const
 Get Cardinals Points color. More...
 
void setColorCardinalPoints (const Vec3f &v)
 Set Cardinals Points color. More...
 
bool getFlagAtmosphere () const
 Get flag for displaying Atmosphere. More...
 
void setFlagAtmosphere (const bool displayed)
 Set flag for displaying Atmosphere. More...
 
float getAtmosphereFadeDuration () const
 Get atmosphere fade duration in s. More...
 
void setAtmosphereFadeDuration (const float f)
 Set atmosphere fade duration in s. More...
 
void setAtmosphereBortleLightPollution (const int bIndex)
 Set the light pollution following the Bortle Scale. More...
 
int getAtmosphereBortleLightPollution () const
 Get the light pollution following the Bortle Scale. More...
 
void setZRotation (const float d)
 Set the rotation of the landscape about the z-axis. More...
 
QString installLandscapeFromArchive (QString pathToSourceArchive, const bool display=false, const bool forAllUsers=false)
 Install a landscape from a ZIP archive. More...
 
bool removeLandscape (const QString landscapeID)
 This function removes a landscape from the user data directory. More...
 
QString loadLandscapeName (const QString landscapeID)
 This function reads a landscape's name from its configuration file. More...
 
quint64 loadLandscapeSize (const QString landscapeID) const
 This function calculates and returns a landscape's disc size in bytes. More...
 
bool getFlagLandscapeAutoSelection () const
 Get flag for autoselect of landscapes for planets. More...
 
void setFlagLandscapeAutoSelection (bool enableAutoSelect)
 Set flag for autoselect of landscapes for planets. More...
 
bool getFlagAtmosphereAutoEnable () const
 Get flag for auto-enable of atmospheres for planets. More...
 
void setFlagAtmosphereAutoEnable (bool b)
 Set flag for auto-enable atmosphere for planets with atmospheres in location window. More...
 
float getLandscapeOpacity (Vec3d azalt) const
 Forward opacity query to current landscape. More...
 

Signals

void atmosphereDisplayedChanged (const bool displayed)
 
void cardinalsPointsDisplayedChanged (const bool displayed)
 
void fogDisplayedChanged (const bool displayed)
 
void landscapeDisplayedChanged (const bool displayed)
 
void illuminationDisplayedChanged (const bool displayed)
 
void lightPollutionUsageChanged (const bool usage)
 
void landscapesChanged ()
 Emitted when a landscape has been installed or un-installed. More...
 
void lightPollutionChanged ()
 
void errorUnableToOpen (QString path)
 Emitted when installLandscapeFromArchive() can't read from, write to or create a file or a directory. More...
 
void errorNotArchive ()
 Emitted when the file passed to installLandscapeFromArchive() is not a ZIP archive or does not contain a valid landscape. More...
 
void errorNotUnique (QString nameOrID)
 Emitted when installLandscapeFromArchive() tries to install a landscape with the same name or identifier as an already installed one. More...
 
void errorRemoveManually (QString path)
 Emitted when removeLandscape() is unable to remove all the files of a landscape. More...
 

Public Member Functions

virtual void init ()
 Initialize the LandscapeManager class. More...
 
virtual void draw (StelCore *core)
 Draw the landscape graphics, cardinal points and atmosphere. More...
 
virtual void update (double deltaTime)
 Update time-dependent state. More...
 
virtual double getCallOrder (StelModuleActionName actionName) const
 Get the order in which this module will draw its objects relative to other modules. More...
 
float getLuminance () const
 Return the global landscape luminance [0..1], for being used e.g for setting eye adaptation. More...
 
float getAtmosphereAverageLuminance () const
 return average luminance [cd/m^2] of atmosphere. Around 10 at sunset, 6400 in daylight, >0 in dark night. More...
 
bool loadLandscape (QMap< QString, QString > &param)
 Load a landscape based on a hash of parameters mirroring the landscape.ini file and make it the current landscape. More...
 
LandscapecreateFromFile (const QString &landscapeFile, const QString &landscapeId)
 Create a new landscape from the files which describe it. More...
 
- Public Member Functions inherited from StelModule
virtual void deinit ()
 Called before the module will be delete, and before the openGL context is suppressed. More...
 
virtual QString getModuleVersion () const
 Get the version of the module, default is stellarium main version. More...
 
virtual QString getAuthorName () const
 Get the name of the module author. More...
 
virtual QString getAuthorEmail () const
 Get the email adress of the module author. More...
 
virtual void handleMouseClicks (class QMouseEvent *)
 Handle mouse clicks. More...
 
virtual void handleMouseWheel (class QWheelEvent *)
 Handle mouse wheel. More...
 
virtual bool handleMouseMoves (int x, int y, Qt::MouseButtons b)
 Handle mouse moves. More...
 
virtual void handleKeys (class QKeyEvent *e)
 Handle key events. More...
 
virtual bool handlePinch (qreal scale, bool started)
 Handle pinch gesture events. More...
 
virtual bool configureGui (bool show=true)
 Detect or show the configuration GUI elements for the module. More...
 

Properties

bool atmosphereDisplayed
 
bool cardinalsPointsDisplayed
 
bool fogDisplayed
 
bool landscapeDisplayed
 
bool illuminationDisplayed
 
bool databaseUsage
 

Additional Inherited Members

- Public Types inherited from StelModule
enum  StelModuleSelectAction { AddToSelection, ReplaceSelection, RemoveFromSelection }
 Enum used when selecting objects to define whether to add to, replace, or remove from the existing selection list. More...
 
enum  StelModuleActionName {
  ActionDraw, ActionUpdate, ActionHandleMouseClicks, ActionHandleMouseMoves,
  ActionHandleKeys
}
 Define the possible action for which an order is defined. More...
 
- Protected Member Functions inherited from StelModule
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action to the StelActionMgr object. More...
 
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action to the StelActionMgr object. More...
 

Detailed Description

Manages all the rendering at the level of the observer's surroundings.

This includes landscape textures, fog, atmosphere and cardinal points. I decided to put all these elements together in a single class because they are inherently linked, especially when we start moving the observer in altitude.

Definition at line 41 of file LandscapeMgr.hpp.

Member Function Documentation

Landscape* LandscapeMgr::createFromFile ( const QString &  landscapeFile,
const QString &  landscapeId 
)

Create a new landscape from the files which describe it.

Reads a landscape.ini file which is passed as the first parameter, determines the landscape type, and creates a new object for the landscape of the proper type. The load member is then called, passing both parameters.

Parameters
landscapeFileThis is the path to a landscape.ini file.
landscapeIdThis is the landscape ID, which is also the name of the directory in which the files (textures and so on) for the landscape reside.
Returns
A pointer to the newly created landscape object.
virtual void LandscapeMgr::draw ( StelCore core)
virtual

Draw the landscape graphics, cardinal points and atmosphere.

Reimplemented from StelModule.

void LandscapeMgr::errorNotArchive ( )
signal

Emitted when the file passed to installLandscapeFromArchive() is not a ZIP archive or does not contain a valid landscape.

(A way of moving the need for translatable error messages to the GUI.)

void LandscapeMgr::errorNotUnique ( QString  nameOrID)
signal

Emitted when installLandscapeFromArchive() tries to install a landscape with the same name or identifier as an already installed one.

(A way of moving the need for translatable error messages to the GUI.)

Parameters
nameOrIDthe name or the identifier of the landscape
void LandscapeMgr::errorRemoveManually ( QString  path)
signal

Emitted when removeLandscape() is unable to remove all the files of a landscape.

(A way of moving the need for translatable error messages to the GUI.)

Parameters
paththe path to the landscape's directory
void LandscapeMgr::errorUnableToOpen ( QString  path)
signal

Emitted when installLandscapeFromArchive() can't read from, write to or create a file or a directory.

(A way of moving the need for translatable error messages to the GUI.)

Parameters
pathpath to the file or directory
QStringList LandscapeMgr::getAllLandscapeIDs ( ) const
slot

Retrieve a list of the identifiers of all the available landscapes in the file search path sub-directories of the landscape area.

Returns
the identifiers of the landscapes, which are the names of the directories containing the landscapes' files
QStringList LandscapeMgr::getAllLandscapeNames ( ) const
slot

Retrieve a list of the names of all the available landscapes in the file search path sub-directories of the landscape area.

Returns
the names of the landscapes, which are the values of the name parameter in the landscape.ini files
float LandscapeMgr::getAtmosphereAverageLuminance ( ) const

return average luminance [cd/m^2] of atmosphere. Around 10 at sunset, 6400 in daylight, >0 in dark night.

int LandscapeMgr::getAtmosphereBortleLightPollution ( ) const
slot

Get the light pollution following the Bortle Scale.

float LandscapeMgr::getAtmosphereFadeDuration ( ) const
slot

Get atmosphere fade duration in s.

virtual double LandscapeMgr::getCallOrder ( StelModuleActionName  actionName) const
virtual

Get the order in which this module will draw its objects relative to other modules.

Reimplemented from StelModule.

Vec3f LandscapeMgr::getColorCardinalPoints ( ) const
slot

Get Cardinals Points color.

Landscape* LandscapeMgr::getCurrentLandscape ( ) const
inlineslot

Get the current landscape object.

Definition at line 157 of file LandscapeMgr.hpp.

QString LandscapeMgr::getCurrentLandscapeHtmlDescription ( ) const
slot

Return a pseudo HTML formatted string with all informations on the current landscape.

const QString& LandscapeMgr::getCurrentLandscapeID ( ) const
inlineslot

Get the current landscape ID.

Definition at line 142 of file LandscapeMgr.hpp.

QString LandscapeMgr::getCurrentLandscapeName ( ) const
slot

Get the current landscape name.

const QString& LandscapeMgr::getDefaultLandscapeID ( ) const
inlineslot

Get the default landscape ID.

Definition at line 160 of file LandscapeMgr.hpp.

double LandscapeMgr::getDefaultMinimalBrightness ( ) const
inlineslot

Return the minimal brightness value of the landscape.

Definition at line 203 of file LandscapeMgr.hpp.

QString LandscapeMgr::getDescription ( ) const
slot

Return a pseudo HTML formatted string with information from description or ini file.

bool LandscapeMgr::getFlagAtmosphere ( ) const
slot

Get flag for displaying Atmosphere.

bool LandscapeMgr::getFlagAtmosphereAutoEnable ( ) const
slot

Get flag for auto-enable of atmospheres for planets.

bool LandscapeMgr::getFlagCardinalsPoints ( ) const
slot

Get flag for displaying Cardinals Points.

bool LandscapeMgr::getFlagFog ( ) const
slot

Get flag for displaying Fog.

bool LandscapeMgr::getFlagIllumination ( ) const
slot

Get flag for displaying illumination layer.

bool LandscapeMgr::getFlagLandscape ( ) const
slot

Get flag for displaying Landscape.

bool LandscapeMgr::getFlagLandscapeAutoSelection ( ) const
slot

Get flag for autoselect of landscapes for planets.

bool LandscapeMgr::getFlagLandscapeSetsLocation ( ) const
inlineslot

Return the value of the flag determining if a change of landscape will update the observer location.

Definition at line 190 of file LandscapeMgr.hpp.

bool LandscapeMgr::getFlagLandscapeSetsMinimalBrightness ( ) const
inlineslot

Return the value of the flag determining if the minimal brightness should be taken from landscape.ini.

Definition at line 199 of file LandscapeMgr.hpp.

bool LandscapeMgr::getFlagLandscapeUseMinimalBrightness ( ) const
inlineslot

Return the value of the flag determining if a minimal brightness should be used to keep landscape visible.

Definition at line 195 of file LandscapeMgr.hpp.

bool LandscapeMgr::getFlagUseLightPollutionFromDatabase ( ) const
slot

Return the value of flag usage light pollution (and bortle index) from locations database.

bool LandscapeMgr::getIsLandscapeFullyVisible ( ) const
slot

Get whether the landscape is currently visible. If true, object below landscape must be rendered.

float LandscapeMgr::getLandscapeOpacity ( Vec3d  azalt) const
inlineslot

Forward opacity query to current landscape.

Parameters
azaltdirection of view line to sample in azaltimuth coordinates.

Definition at line 330 of file LandscapeMgr.hpp.

float LandscapeMgr::getLuminance ( ) const

Return the global landscape luminance [0..1], for being used e.g for setting eye adaptation.

It returns 1 if atmosphere drawing is on and no eclipse underway, 0 if atmosphere is switched off. The actual brightness is of no concern here. You may use getAtmosphereAverageLuminance() for this.

QStringList LandscapeMgr::getUserLandscapeIDs ( ) const
slot

Retrieve a list of the identifiers of all user-installed landscapes.

Effectively, this returns the results of getAllLandscapeIDs() without the landscapes specified in the #packagedLandscapeIDs list.

virtual void LandscapeMgr::init ( )
virtual

Initialize the LandscapeManager class.

Operations performed:

  • Load the default landscape as specified in the application configuration
  • Set up landscape-related display flags from ini parser object

Implements StelModule.

QString LandscapeMgr::installLandscapeFromArchive ( QString  pathToSourceArchive,
const bool  display = false,
const bool  forAllUsers = false 
)
slot

Install a landscape from a ZIP archive.

This function searches for a file named "landscape.ini" in the root directory of the archive. If it is not found there, the function searches inside the topmost sub-directories (if any), but no deeper. If a landscape configuration file is found:

  • if a "landscapes" directory does not exist in the user data directory, it is created;
  • inside it, a sub-directory is created with the landscape identifier for a name;
  • all files in the archive directory that contains the "landscape.ini" file are extracted to the new sub-directory of "landscapes";
  • all sub-directories of that archive directory will be skipped along with any other files or directories in the archive.

The landscape identifier is either:

  • the name of the folder in the archive that contains "landscape.ini",
  • or the first 65 (or less) characters of the archive name, if the "landscape.ini" file is in the nameless root directory of the archive.

The landscape identifier must be unique.

Parameters
pathToSourceArchivepath to the source archive file.
displayIf true, the landscape will be set to be the current landscape after installation.
forAllUsersIf true, this function will try to install the landscape in a way that meakes it is available to all users of this computer. May require running Stellarium as an administrator (root) on some Windows or *nix systems. (NOT IMPLEMENTED!)
Returns
the installed landscape's identifier, or an empty string on failure.
void LandscapeMgr::landscapesChanged ( )
signal

Emitted when a landscape has been installed or un-installed.

For example, it is used to update the list of landscapes in the Sky and viewing options window (the ViewDialog class)

bool LandscapeMgr::loadLandscape ( QMap< QString, QString > &  param)

Load a landscape based on a hash of parameters mirroring the landscape.ini file and make it the current landscape.

QString LandscapeMgr::loadLandscapeName ( const QString  landscapeID)
slot

This function reads a landscape's name from its configuration file.

Parameters
landscapeIDan installed landscape's identifier (the folder name)
Returns
an empty string if there is no such landscape or some other error occurs
quint64 LandscapeMgr::loadLandscapeSize ( const QString  landscapeID) const
slot

This function calculates and returns a landscape's disc size in bytes.

It adds up the sizes of all files in the landscape's folder. It assumes that there are no sub-directories. (There shouldn't be any anyway.)

Parameters
landscapeIDan installed landscape's identifier (the folder name)
bool LandscapeMgr::removeLandscape ( const QString  landscapeID)
slot

This function removes a landscape from the user data directory.

It tries to recursively delete all files in the landscape directory and then remove it from the list of available landscapes. If the function encounters any file that can't be deleted it aborts the operation (previously deleted files are not restored). Landscapes that were packaged with Stellarium can't be removed, thanks to the #packagedLandscapeIDs list.

Parameters
landscapeIDan installed landscape's identifier (the folder name)
void LandscapeMgr::setAtmosphereBortleLightPollution ( const int  bIndex)
slot

Set the light pollution following the Bortle Scale.

void LandscapeMgr::setAtmosphereFadeDuration ( const float  f)
slot

Set atmosphere fade duration in s.

void LandscapeMgr::setColorCardinalPoints ( const Vec3f v)
slot

Set Cardinals Points color.

bool LandscapeMgr::setCurrentLandscapeID ( const QString &  id,
const double  changeLocationDuration = 1.0 
)
slot

Change the current landscape to the landscape with the ID specified.

Parameters
idthe ID of the new landscape
changeLocationDurationthe duration of the transition animation
Returns
false if the new landscape could not be set (e.g. no landscape of that ID was found).
bool LandscapeMgr::setCurrentLandscapeName ( const QString &  name,
const double  changeLocationDuration = 1.0 
)
slot

Change the current landscape to the landscape with the name specified.

Parameters
namethe name of the new landscape, as found in the landscape:name key of the landscape.ini file.
changeLocationDurationthe duration of the transition animation
bool LandscapeMgr::setDefaultLandscapeID ( const QString &  id)
slot

Change the default landscape to the landscape with the ID specified.

Parameters
idthe ID of the landscape to use by default
Returns
false if the new landscape could not be set (e.g. no landscape of that ID was found). True on success.
void LandscapeMgr::setDefaultMinimalBrightness ( const double  b)
inlineslot

Set the minimal brightness value of the landscape.

Definition at line 205 of file LandscapeMgr.hpp.

void LandscapeMgr::setFlagAtmosphere ( const bool  displayed)
slot

Set flag for displaying Atmosphere.

void LandscapeMgr::setFlagAtmosphereAutoEnable ( bool  b)
slot

Set flag for auto-enable atmosphere for planets with atmospheres in location window.

void LandscapeMgr::setFlagCardinalsPoints ( const bool  displayed)
slot

Set flag for displaying Cardinals Points.

void LandscapeMgr::setFlagFog ( const bool  displayed)
slot

Set flag for displaying Fog.

void LandscapeMgr::setFlagIllumination ( const bool  on)
slot

Set flag for displaying illumination layer.

void LandscapeMgr::setFlagLandscape ( const bool  displayed)
slot

Set flag for displaying Landscape.

void LandscapeMgr::setFlagLandscapeAutoSelection ( bool  enableAutoSelect)
slot

Set flag for autoselect of landscapes for planets.

void LandscapeMgr::setFlagLandscapeSetsLocation ( bool  b)
inlineslot

Set the value of the flag determining if a change of landscape will update the observer location.

Definition at line 192 of file LandscapeMgr.hpp.

void LandscapeMgr::setFlagLandscapeSetsMinimalBrightness ( bool  b)
inlineslot

Sets the value of the flag determining if the minimal brightness should be taken from landscape.ini.

Definition at line 201 of file LandscapeMgr.hpp.

void LandscapeMgr::setFlagLandscapeUseMinimalBrightness ( bool  b)
inlineslot

Set the value of the flag determining if a minimal brightness should be used to keep landscape visible.

Definition at line 197 of file LandscapeMgr.hpp.

void LandscapeMgr::setFlagUseLightPollutionFromDatabase ( const bool  usage)
slot

Sets the value of the flag usage light pollution (and bortle index) from locations database.

void LandscapeMgr::setZRotation ( const float  d)
slot

Set the rotation of the landscape about the z-axis.

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).

Parameters
dthe rotation angle in degrees as an offset from the originally loaded value.
virtual void LandscapeMgr::update ( double  deltaTime)
virtual

Update time-dependent state.

Includes:

  • Landscape, atmosphere and cardinal point on/off fading.
  • Atmophere colour calculation based on location, position of sun and moon.
  • updates adaptation luminescence based on visible bright objects.

Implements StelModule.


The documentation for this class was generated from the following file: