Stellarium 0.15.2
|
Manages all the rendering at the level of the observer's surroundings. More...
#include <LandscapeMgr.hpp>
Public Slots | |
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. Expect 10 at sunset, 6400 in daylight, >0 in dark night. More... | |
void | setAtmosphereAverageLuminance (const float overrideLuminance) |
Override autocomputed value and set average luminance [cd/m^2] of atmosphere. More... | |
QMap< QString, QString > | getNameToDirMap () const |
Return a map of landscape names to landscape IDs (directory names). More... | |
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... | |
float | getCurrentLandscapeBrightness (const bool light=false) const |
Get the current landscape or lightscape brightness (0..1) More... | |
bool | precacheLandscape (const QString &id, const bool replace=true) |
Preload a landscape into cache. More... | |
bool | removeCachedLandscape (const QString &id) |
Remove a landscape from the cache of landscapes. More... | |
void | setCacheSize (int mb) |
Set size of the landscape cache, in MB. More... | |
int | getCacheSize () const |
Retrieve total size of cache (MB). More... | |
int | getCacheFilledSize () const |
Retrieve sum of currently used memory in cache (MB, approximate) More... | |
int | getCacheCount () const |
Return number of landscapes already in the cache. More... | |
Landscape * | getCurrentLandscape () 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, objects below landscape's limiting altitude limit can be omitted. More... | |
float | getLandscapeSinMinAltitudeLimit () const |
Get the sine of current landscape's minimal altitude. Useful to construct bounding caps. 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 | getFlagLabels () const |
Get flag for displaying landscape labels. More... | |
void | setFlagLabels (const bool on) |
Set flag for displaying landscape labels. 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 | 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... | |
float | getLandscapeOpacity (Vec3f azalt) const |
float | getLandscapeOpacity (float azimuth, float altitude) const |
Forward opacity query to current landscape. More... | |
Signals | |
void | atmosphereDisplayedChanged (const bool displayed) |
void | cardinalsPointsDisplayedChanged (const bool displayed) |
void | cardinalsPointsColorChanged (const Vec3f &newColor) const |
void | fogDisplayedChanged (const bool displayed) |
void | landscapeDisplayedChanged (const bool displayed) |
void | illuminationDisplayedChanged (const bool displayed) |
void | labelsDisplayedChanged (const bool displayed) |
void | flagUseLightPollutionFromDatabaseChanged (const bool usage) |
void | flagLandscapeAutoSelectionChanged (const bool value) |
void | flagLandscapeSetsLocationChanged (const bool value) |
void | flagLandscapeUseMinimalBrightnessChanged (const bool value) |
void | flagLandscapeSetsMinimalBrightnessChanged (const bool value) |
void | defaultMinimalBrightnessChanged (const double value) |
void | setFlagAtmosphereAutoEnableChanged (const bool enabled) |
void | defaultLandscapeChanged (const QString &id) |
Emitted whenever the default landscape is changed. More... | |
void | landscapesChanged () |
Emitted when a landscape has been installed or un-installed. More... | |
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... | |
void | currentLandscapeChanged (QString currentLandscapeID, QString currentLandscapeName) |
Emitted when the current landscape was changed. 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... | |
Landscape * | createFromFile (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 |
Vec3f | cardinalsPointsColor |
bool | fogDisplayed |
bool | landscapeDisplayed |
bool | illuminationDisplayed |
bool | labelsDisplayed |
bool | flagUseLightPollutionFromDatabase |
bool | flagLandscapeAutoSelection |
bool | flagLandscapeSetsLocation |
bool | flagLandscapeUseMinimalBrightness |
Indicate use of the default minimal brightness value specified in config.ini. More... | |
bool | flagLandscapeSetsMinimalBrightness |
Indicate use of the minimal brightness value specified in the current landscape.ini, if present. More... | |
double | defaultMinimalBrightness |
A minimal brightness value to keep landscape visible. More... | |
bool | flagAtmosphereAutoEnabling |
Indicate auto-enable atmosphere for planets with atmospheres in location window. More... | |
QString | currentLandscapeID |
The ID of the currently loaded landscape. More... | |
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 StelAction * | addAction (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 (call to slot) to the StelActionMgr object. More... | |
class StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="") |
convenience methods to add an action (call to own slot) to the StelActionMgr object. More... | |
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 52 of file LandscapeMgr.hpp.
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.
landscapeFile | This is the path to a landscape.ini file. |
landscapeId | This is the landscape ID, which is also the name of the directory in which the files (textures and so on) for the landscape reside. |
|
signal |
Emitted when the current landscape was changed.
currentLandscapeID | the ID of the new landscape |
currentLandscapeName | the name of the new landscape |
|
signal |
Emitted whenever the default landscape is changed.
id | the landscape id of the new default landscape |
|
virtual |
Draw the landscape graphics, cardinal points and atmosphere.
Reimplemented from StelModule.
|
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.)
|
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.)
nameOrID | the name or the identifier of the landscape |
|
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.)
path | the path to the landscape's directory |
|
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.)
path | path to the file or directory |
|
slot |
Retrieve a list of the identifiers of all the available landscapes in the file search path sub-directories of the landscape area.
|
slot |
Retrieve a list of the names of all the available landscapes in the file search path sub-directories of the landscape area.
|
slot |
return average luminance [cd/m^2] of atmosphere. Expect 10 at sunset, 6400 in daylight, >0 in dark night.
|
slot |
Get atmosphere fade duration in s.
|
inlineslot |
Return number of landscapes already in the cache.
Definition at line 244 of file LandscapeMgr.hpp.
|
inlineslot |
Retrieve sum of currently used memory in cache (MB, approximate)
Definition at line 242 of file LandscapeMgr.hpp.
|
inlineslot |
Retrieve total size of cache (MB).
Definition at line 240 of file LandscapeMgr.hpp.
|
virtual |
Get the order in which this module will draw its objects relative to other modules.
Reimplemented from StelModule.
|
slot |
Get Cardinals Points color.
|
inlineslot |
Get the current landscape object.
Definition at line 247 of file LandscapeMgr.hpp.
|
inlineslot |
Get the current landscape or lightscape brightness (0..1)
light | true to retrieve the light layer brightness value. |
Definition at line 219 of file LandscapeMgr.hpp.
|
slot |
Return a pseudo HTML formatted string with all informations on the current landscape.
|
inlineslot |
Get the current landscape ID.
Definition at line 201 of file LandscapeMgr.hpp.
|
slot |
Get the current landscape name.
|
inlineslot |
Get the default landscape ID.
Definition at line 250 of file LandscapeMgr.hpp.
|
inlineslot |
Return the minimal brightness value of the landscape.
Definition at line 299 of file LandscapeMgr.hpp.
|
slot |
Return a pseudo HTML formatted string with information from description or ini file.
|
slot |
Get flag for displaying Atmosphere.
|
slot |
Get flag for auto-enable of atmospheres for planets.
|
slot |
Get flag for displaying Cardinals Points.
|
slot |
Get flag for displaying Fog.
|
slot |
Get flag for displaying illumination layer.
|
slot |
Get flag for displaying landscape labels.
|
slot |
Get flag for displaying Landscape.
|
slot |
Get flag for autoselect of landscapes for planets.
|
inlineslot |
Return the value of the flag determining if a change of landscape will update the observer location.
Definition at line 286 of file LandscapeMgr.hpp.
|
inlineslot |
Return the value of the flag determining if the minimal brightness should be taken from landscape.ini.
Definition at line 295 of file LandscapeMgr.hpp.
|
inlineslot |
Return the value of the flag determining if a minimal brightness should be used to keep landscape visible.
Definition at line 291 of file LandscapeMgr.hpp.
|
slot |
Return the value of flag usage light pollution (and bortle index) from locations database.
|
slot |
Get whether the landscape is currently visible. If true, objects below landscape's limiting altitude limit can be omitted.
|
inlineslot |
Forward opacity query to current landscape.
azalt | direction of view line to sample in azaltimuth coordinates. |
Definition at line 427 of file LandscapeMgr.hpp.
|
inlineslot |
Forward opacity query to current landscape.
azimuth | in degrees |
altitude | in degrees |
Definition at line 433 of file LandscapeMgr.hpp.
|
slot |
Get the sine of current landscape's minimal altitude. Useful to construct bounding caps.
|
slot |
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.
|
slot |
Return a map of landscape names to landscape IDs (directory names).
|
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 |
Initialize the LandscapeManager class.
Operations performed:
Implements StelModule.
|
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:
The landscape identifier is either:
The landscape identifier must be unique.
pathToSourceArchive | path to the source archive file. |
display | If true, the landscape will be set to be the current landscape after installation. |
forAllUsers | If 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!) |
|
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)
|
slot |
This function reads a landscape's name from its configuration file.
landscapeID | an installed landscape's identifier (the folder name) |
|
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.)
landscapeID | an installed landscape's identifier (the folder name) |
|
slot |
Preload a landscape into cache.
id | the ID of a landscape |
replace | true if existing landscape entry should be replaced (useful during development to reload after edit) |
|
slot |
Remove a landscape from the cache of landscapes.
id | the ID of a landscape |
|
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.
landscapeID | an installed landscape's identifier (the folder name) |
|
slot |
Override autocomputed value and set average luminance [cd/m^2] of atmosphere.
This is around 10 at sunset, 6400 in daylight, >0 in dark night. Usually there is no need to call this, the luminance is properly computed. This is a function which can be useful in rare cases, e.g. in scripts when you want to create images of adjacent sky regions with the same brightness setting, or for creation of a virtual camera which can deliberately show over- or underexposure. For these cases, it is advisable to first center the brightest luminary (sun or moon), call getAtmosphereAverageLuminance() and then set this value explicitly to freeze it during image export. To unfreeze, call this again with any negative value.
|
slot |
Set atmosphere fade duration in s.
|
inlineslot |
Set size of the landscape cache, in MB.
Default size is 100MB, or configured as [landscape/cache_size_mb] from config.ini. The landscape sizes returned in Landscape::getMemorySize() are only approximate, but include image and texture sizes. A big landscape may well take 150MB or more. On a 32bit system, keep this rather small. On 64bit with 16GB RAM and no other tasks, 4GB is no problem. Modern GPUs may have 4 or even 8GB of dedicated texture memory. Most of this may be filled with landscape textures. Example: a museum installation with 20 large (16384x2048) old_stype landscapes can require up to 3.5GB. Allow 4GB cache, and the system will never have to load a landscape during the show when all have been preloaded.
Definition at line 238 of file LandscapeMgr.hpp.
|
slot |
Set Cardinals Points color.
|
slot |
Change the current landscape to the landscape with the ID specified.
Emits currentLandscapeChanged() if the landscape changed (true returned)
id | the ID of the new landscape |
changeLocationDuration | the duration of the transition animation |
|
slot |
Change the current landscape to the landscape with the name specified.
Emits currentLandscapeChanged() if the landscape changed (true returned)
name | the name of the new landscape, as found in the landscape:name key of the landscape.ini file. |
changeLocationDuration | the duration of the transition animation |
|
slot |
Change the default landscape to the landscape with the ID specified.
id | the ID of the landscape to use by default |
|
inlineslot |
Set the minimal brightness value of the landscape.
Definition at line 301 of file LandscapeMgr.hpp.
|
slot |
Set flag for displaying Atmosphere.
|
slot |
Set flag for auto-enable atmosphere for planets with atmospheres in location window.
|
slot |
Set flag for displaying Cardinals Points.
|
slot |
Set flag for displaying Fog.
|
slot |
Set flag for displaying illumination layer.
|
slot |
Set flag for displaying landscape labels.
|
slot |
Set flag for displaying Landscape.
|
slot |
Set flag for autoselect of landscapes for planets.
|
inlineslot |
Set the value of the flag determining if a change of landscape will update the observer location.
Definition at line 288 of file LandscapeMgr.hpp.
|
inlineslot |
Sets the value of the flag determining if the minimal brightness should be taken from landscape.ini.
Definition at line 297 of file LandscapeMgr.hpp.
|
inlineslot |
Set the value of the flag determining if a minimal brightness should be used to keep landscape visible.
Definition at line 293 of file LandscapeMgr.hpp.
|
slot |
Sets the value of the flag usage light pollution (and bortle index) from locations database.
|
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).
d | the rotation angle in degrees as an offset from the originally loaded value. |
|
virtual |
Update time-dependent state.
Includes:
Implements StelModule.
|
readwrite |
The ID of the currently loaded landscape.
Definition at line 114 of file LandscapeMgr.hpp.
|
readwrite |
A minimal brightness value to keep landscape visible.
Definition at line 106 of file LandscapeMgr.hpp.
|
readwrite |
Indicate auto-enable atmosphere for planets with atmospheres in location window.
Definition at line 110 of file LandscapeMgr.hpp.
|
readwrite |
Indicate use of the minimal brightness value specified in the current landscape.ini, if present.
Definition at line 102 of file LandscapeMgr.hpp.
|
readwrite |
Indicate use of the default minimal brightness value specified in config.ini.
Definition at line 98 of file LandscapeMgr.hpp.