LandscapeMgr.hpp   LandscapeMgr.hpp 
skipping to change at line 60 skipping to change at line 60
WRITE setFlagCardinalsPoints WRITE setFlagCardinalsPoints
NOTIFY cardinalsPointsDisplayedChanged) NOTIFY cardinalsPointsDisplayedChanged)
Q_PROPERTY(bool fogDisplayed Q_PROPERTY(bool fogDisplayed
READ getFlagFog READ getFlagFog
WRITE setFlagFog WRITE setFlagFog
NOTIFY fogDisplayedChanged) NOTIFY fogDisplayedChanged)
Q_PROPERTY(bool landscapeDisplayed Q_PROPERTY(bool landscapeDisplayed
READ getFlagLandscape READ getFlagLandscape
WRITE setFlagLandscape WRITE setFlagLandscape
NOTIFY landscapeDisplayedChanged) NOTIFY landscapeDisplayedChanged)
Q_PROPERTY(bool databaseUsage
READ getFlagUseLightPollutionFromDatabase
WRITE setFlagUseLightPollutionFromDatabase
NOTIFY lightPollutionUsageChanged)
public: public:
LandscapeMgr(); LandscapeMgr();
virtual ~LandscapeMgr(); virtual ~LandscapeMgr();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
//! Initialize the LandscapeManager class. //! Initialize the LandscapeManager class.
//! Operations performed: //! Operations performed:
//! - Load the default landscape as specified in the application con figuration //! - Load the default landscape as specified in the application con figuration
//! - Set up landscape-releated display flags from ini parser object //! - Set up landscape-releated display flags from ini parser object
virtual void init(); virtual void init();
//! Draw the landscape graphics, cardinal points and atmosphere. //! Draw the landscape graphics, cardinal points and atmosphere.
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
//! Update time-dependent state. //! Update time-dependent state.
//! Includes: //! Includes:
//! - Landscape, atmosphere and cardinal point on/off fading. //! - Landscape, atmosphere and cardinal point on/off fading.
//! - Atmophere colour calulation based on location, position of sun //! - Atmophere colour calulation based on location, position of sun
//! and moon. //! and moon.
//! - updates adaptation lumenescence lased on visible bright object s. //! - updates adaptation lumenescence lased on visible bright object s.
virtual void update(double deltaTime); virtual void update(double deltaTime);
//! Get the order in which this module will draw it's objects relati ve to other modules. //! Get the order in which this module will draw it's objects relati ve to other modules.
virtual double getCallOrder(StelModuleActionName actionName) const; virtual double getCallOrder(StelModuleActionName actionName) const;
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Method specific to the landscape manager // Method specific to the landscape manager
//! Return the global landscape luminance, for being used e.g for se //! Return the global landscape luminance [0..1], for being used e.g
tting eye adaptation. for setting eye adaptation.
float getLuminance(); //! GZ 2014-01-03: THIS IS MISLEADING. Returns 1 if atmosphere drawi
ng is on and no eclipse underway, 0 if atmosphere is switched off.
//! The actual brightness is of no concern here. You may use getAtmo
sphereAverageLuminance() for this.
float getLuminance() const;
//! return average luminance [cd/m^2] of atmosphere. Around 10 at su
nset, 6400 in daylight, >0 in dark night.
float getAtmosphereAverageLuminance() const;
//! Load a landscape based on a hash of parameters mirroring the lan dscape.ini //! Load a landscape based on a hash of parameters mirroring the lan dscape.ini
//! file and make it the current landscape. //! file and make it the current landscape.
bool loadLandscape(QMap<QString, QString>& param); bool loadLandscape(QMap<QString, QString>& param);
//! Create a new landscape from the files which describe it. //! Create a new landscape from the files which describe it.
//! Reads a landscape.ini file which is passed as the first paramete r, determines //! Reads a landscape.ini file which is passed as the first paramete r, determines
//! the landscape type, and creates a new object for the landscape o f the proper //! the landscape type, and creates a new object for the landscape o f the proper
//! type. The load member is then called, passing both parameters. //! type. The load member is then called, passing both parameters.
//! @param landscapeFile This is the path to a landscape.ini file. //! @param landscapeFile This is the path to a landscape.ini file.
//! @param landscapeId This is the landscape ID, which is also the n ame of the //! @param landscapeId This is the landscape ID, which is also the n ame of the
//! directory in which the files (textures and so on) for the landsc ape reside. //! directory in which the files (textures and so on) for the landsc ape reside.
//! @return A pointer to the newly created landscape object. //! @return A pointer to the newly created landscape object.
Landscape* createFromFile(const QString& landscapeFile, const QStrin g& landscapeId); Landscape* createFromFile(const QString& landscapeFile, const QStrin g& landscapeId);
// GZ: implement StelModule's method. For test purposes only, we imp
lement a manual transparency sampler.
// TODO: comment this away for final builds
// virtual void handleMouseClicks(class QMouseEvent*);
public slots: public slots:
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods callable from script and GUI // Methods callable from script and GUI
//! Retrieve a list of the names of all the available landscapes in //! Retrieve a list of the names of all the available landscapes in
//! the file search path sub-directories of the landscape area //! the file search path sub-directories of the landscape area
//! @return the names of the landscapes, which are the values of the name parameter in the landscape.ini files //! @return the names of the landscapes, which are the values of the name parameter in the landscape.ini files
QStringList getAllLandscapeNames() const; QStringList getAllLandscapeNames() const;
//! Retrieve a list of the identifiers of all the available landscap es in //! Retrieve a list of the identifiers of all the available landscap es in
//! the file search path sub-directories of the landscape area //! the file search path sub-directories of the landscape area
skipping to change at line 155 skipping to change at line 167
QString getCurrentLandscapeHtmlDescription() const; QString getCurrentLandscapeHtmlDescription() const;
//! Return a pseudo HTML formated string with information from descr iption or ini file //! Return a pseudo HTML formated string with information from descr iption or ini file
QString getDescription() const; QString getDescription() const;
//! Get flag for displaying Landscape. //! Get flag for displaying Landscape.
bool getFlagLandscape() const; bool getFlagLandscape() const;
//! Set flag for displaying Landscape. //! Set flag for displaying Landscape.
void setFlagLandscape(const bool displayed); void setFlagLandscape(const bool displayed);
//! Get whether the landscape is currently visible. If true, object
below landscape must be rendered.
bool getIsLandscapeFullyVisible() const;
//! Get flag for displaying Fog. //! Get flag for displaying Fog.
bool getFlagFog() const; bool getFlagFog() const;
//! Set flag for displaying Fog. //! Set flag for displaying Fog.
void setFlagFog(const bool displayed); void setFlagFog(const bool displayed);
//! Return the value of the flag determining if a change of landscap e will update the observer location. //! Return the value of the flag determining if a change of landscap e will update the observer location.
bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsL ocation;} bool getFlagLandscapeSetsLocation() const {return flagLandscapeSetsL ocation;}
//! Set the value of the flag determining if a change of landscape w ill update the observer location. //! Set the value of the flag determining if a change of landscape w ill update the observer location.
void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation =b;} void setFlagLandscapeSetsLocation(bool b) {flagLandscapeSetsLocation =b;}
//! Return the value of the flag determining if an using brightness //! Return the value of the flag determining if a minimal brightness
for night landscape. should be used to keep landscape visible.
bool getFlagLandscapeNightBrightness() const {return flagLandscapeNi bool getFlagLandscapeUseMinimalBrightness() const {return flagLandsc
ghtBrightness;} apeUseMinimalBrightness; }
//! Set the value of the flag determining if an using brightness for //! Set the value of the flag determining if a minimal brightness sh
night landscape. ould be used to keep landscape visible.
void setFlagLandscapeNightBrightness(bool b) {flagLandscapeNightBrig void setFlagLandscapeUseMinimalBrightness(bool b) {flagLandscapeUseM
htness=b;} inimalBrightness=b; }
//! Return the value of the flag determining if the minimal brightne
ss should be taken from landscape.ini
bool getFlagLandscapeSetsMinimalBrightness() const {return flagLands
capeSetsMinimalBrightness;}
//! Sets the value of the flag determining if the minimal brightness
should be taken from landscape.ini
void setFlagLandscapeSetsMinimalBrightness(bool b) {flagLandscapeSet
sMinimalBrightness=b;}
//! Return the minimal brightness value of the landscape
float getDefaultMinimalBrightness() const {return defaultMinimalBrig
htness;}
//! Set the minimal brightness value of the landscape.
void setDefaultMinimalBrightness(const float b) {defaultMinimalBrigh
tness=b;}
//! Sets the value of the flag usage light pollution (and bortle ind
ex) from locations database.
void setFlagUseLightPollutionFromDatabase(const bool usage);
//! Return the value of flag usage light pollution (and bortle index
) from locations database.
bool getFlagUseLightPollutionFromDatabase() const;
//! Get flag for displaying Cardinals Points. //! Get flag for displaying Cardinals Points.
bool getFlagCardinalsPoints() const; bool getFlagCardinalsPoints() const;
//! Set flag for displaying Cardinals Points. //! Set flag for displaying Cardinals Points.
void setFlagCardinalsPoints(const bool displayed); void setFlagCardinalsPoints(const bool displayed);
//! Get Cardinals Points color. //! Get Cardinals Points color.
Vec3f getColorCardinalPoints() const; Vec3f getColorCardinalPoints() const;
//! Set Cardinals Points color. //! Set Cardinals Points color.
void setColorCardinalPoints(const Vec3f& v); void setColorCardinalPoints(const Vec3f& v);
//! Get flag for displaying Atmosphere. //! Get flag for displaying Atmosphere.
bool getFlagAtmosphere() const; bool getFlagAtmosphere() const;
//! Set flag for displaying Atmosphere. //! Set flag for displaying Atmosphere.
void setFlagAtmosphere(const bool displayed); void setFlagAtmosphere(const bool displayed);
//! Get atmosphere fade duration in s. //! Get atmosphere fade duration in s.
float getAtmosphereFadeDuration() const; float getAtmosphereFadeDuration() const;
//! Set atmosphere fade duration in s. //! Set atmosphere fade duration in s.
void setAtmosphereFadeDuration(float f); void setAtmosphereFadeDuration(const float f);
//! Set the light pollution following the Bortle Scale //! Set the light pollution following the Bortle Scale
void setAtmosphereBortleLightPollution(int bIndex); void setAtmosphereBortleLightPollution(const int bIndex);
//! Get the light pollution following the Bortle Scale //! Get the light pollution following the Bortle Scale
int getAtmosphereBortleLightPollution(); int getAtmosphereBortleLightPollution() const;
//! Set the rotation of the landscape about the z-axis. //! Set the rotation of the landscape about the z-axis.
//! This is intended for special uses such as when the landscape con sists of //! This is intended for special uses such as when the landscape con sists of
//! a vehicle which might change orientation over time (e.g. a ship) . //! a vehicle which might change orientation over time (e.g. a ship) .
//! @param d the rotation angle in degrees as an offset from the ori ginally loaded value. //! @param d the rotation angle in degrees as an offset from the ori ginally loaded value.
void setZRotation(float d); void setZRotation(const float d);
//! Install a landscape from a ZIP archive. //! Install a landscape from a ZIP archive.
//! This function searches for a file named "landscape.ini" in the r oot //! This function searches for a file named "landscape.ini" in the r oot
//! directory of the archive. If it is not found there, the function //! directory of the archive. If it is not found there, the function
//! searches inside the topmost sub-directories (if any), but no dee per. //! searches inside the topmost sub-directories (if any), but no dee per.
//! If a landscape configuration file is found: //! If a landscape configuration file is found:
//! - if a "landscapes" directory does not exist in the user data //! - if a "landscapes" directory does not exist in the user data
//! directory, it is created; //! directory, it is created;
//! - inside it, a sub-directory is created with the landscape iden tifier //! - inside it, a sub-directory is created with the landscape iden tifier
//! for a name; //! for a name;
skipping to change at line 231 skipping to change at line 258
//! @param pathToSourceArchive path to the source archive file. //! @param pathToSourceArchive path to the source archive file.
//! @param display If true, the landscape will be set to be the curr ent //! @param display If true, the landscape will be set to be the curr ent
//! landscape after installation. //! landscape after installation.
//! @param forAllUsers If true, this function will try to install th e //! @param forAllUsers If true, this function will try to install th e
//! landscape in a way that meakes it is available to all users of t his //! landscape in a way that meakes it is available to all users of t his
//! computer. May require running Stellarium as an administrator (ro ot) //! computer. May require running Stellarium as an administrator (ro ot)
//! on some Windows or *nix systems. (NOT IMPLEMENTED!) //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
//! @returns the installed landscape's identifier, or //! @returns the installed landscape's identifier, or
//! an empty string on failure. //! an empty string on failure.
//! @todo Find a better way to pass error messages. //! @todo Find a better way to pass error messages.
QString installLandscapeFromArchive(QString pathToSourceArchive, boo l display = false, bool forAllUsers = false); QString installLandscapeFromArchive(QString pathToSourceArchive, con st bool display = false, const bool forAllUsers = false);
// //! Install a landscape from a directory. /* GZ: leaving doc without the method confuses Doxygen. Commenting o
// //! Expected directory structure: the name of the directory that ut completely.
contains //! Install a landscape from a directory.
// //! a landscape.ini file is assumed to be the landscape ID and sh //! Expected directory structure: the name of the directory that con
ould be tains
// //! unique. //! a landscape.ini file is assumed to be the landscape ID and shoul
// //! This directory and all files in it will be installed, but its d be
// //! subdirectories will be skipped along with any other files or //! unique.
// //! directories in the archive. //! This directory and all files in it will be installed, but its
// //! @param pathToSourceLandscapeIni path to a landscape.ini file. //! subdirectories will be skipped along with any other files or
Its parent //! directories in the archive.
// //! directory is assumed to be the landscape source directory. //! @param pathToSourceLandscapeIni path to a landscape.ini file. It
// //! @param display If true, the landscape will be set to be the c s parent
urrent //! directory is assumed to be the landscape source directory.
// //! landscape after installation. //! @param display If true, the landscape will be set to be the curr
// //! @param forAllUsers If true, this function will try to install ent
the //! landscape after installation.
// //! landscape in a way that meakes it is available to all users o //! @param forAllUsers If true, this function will try to install th
f this e
// //! computer. May require running Stellarium as an administrator //! landscape in a way that meakes it is available to all users of t
(root) his
// //! on some Windows or *nix systems. (NOT IMPLEMENTED!) //! computer. May require running Stellarium as an administrator (ro
// //! @returns the installed landscape's identifier (the folder nam ot)
e), or //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
// //! an empty string on failure. //! @returns the installed landscape's identifier (the folder name),
// QString installLandscapeFromDirectory(QString pathToSourceLandsca or
peIni, bool display = false, bool forAllUsers = false); //! an empty string on failure.
//QString installLandscapeFromDirectory(QString pathToSourceLandscap
eIni, bool display = false, bool forAllUsers = false);
*/
//! This function removes a landscape from the user data directory. //! This function removes a landscape from the user data directory.
//! It tries to recursively delete all files in the landscape direct ory //! It tries to recursively delete all files in the landscape direct ory
//! and then remove it from the list of available landscapes. //! and then remove it from the list of available landscapes.
//! If the function encounters any file that can't be deleted //! If the function encounters any file that can't be deleted
//! it aborts the operation (previously deleted files are not restor ed). //! it aborts the operation (previously deleted files are not restor ed).
//! Landscapes that were packaged with Stellarium can't be removed, //! Landscapes that were packaged with Stellarium can't be removed,
//! thanks to the #packagedLandscapeIDs list. //! thanks to the #packagedtLandscapeIDs list.
//! @param landscapeID an installed landscape's identifier (the fold er name) //! @param landscapeID an installed landscape's identifier (the fold er name)
//! @todo Find a better way to pass error messages. //! @todo Find a better way to pass error messages.
bool removeLandscape(QString landscapeID); bool removeLandscape(const QString landscapeID);
//! This function reads a landscape's name from its configuration fi le. //! This function reads a landscape's name from its configuration fi le.
//! @param landscapeID an installed landscape's identifier (the fold er name) //! @param landscapeID an installed landscape's identifier (the fold er name)
//! @returns an empty string if there is no such landscape or some o ther //! @returns an empty string if there is no such landscape or some o ther
//! error occurs //! error occurs
QString loadLandscapeName(QString landscapeID); QString loadLandscapeName(const QString landscapeID);
//! This function calculates and returns a landscape's disc size in bytes. //! 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 //! 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 anywa y.) //! that there are no sub-directories. (There shouldn't be any anywa y.)
//! @param landscapeID an installed landscape's identifier (the fold er name) //! @param landscapeID an installed landscape's identifier (the fold er name)
quint64 loadLandscapeSize(QString landscapeID); quint64 loadLandscapeSize(const QString landscapeID) const;
//! Get flag for autoselect of landscapes for planets. //! Get flag for autoselect of landscapes for planets.
bool getFlagLandscapeAutoSelection() const; bool getFlagLandscapeAutoSelection() const;
//! Set flag for autoselect of landscapes for planets. //! Set flag for autoselect of landscapes for planets.
void setFlagLandscapeAutoSelection(bool enableAutoSelect); void setFlagLandscapeAutoSelection(bool enableAutoSelect);
//! Get flag for auto-enable of atmospheres for planets.
bool getFlagAtmosphereAutoEnable() const;
//! Set flag for auto-enable atmosphere for planets with atmospheres
in location window
void setFlagAtmosphereAutoEnable(bool b);
signals: signals:
void atmosphereDisplayedChanged(const bool displayed); void atmosphereDisplayedChanged(const bool displayed);
void cardinalsPointsDisplayedChanged(const bool displayed); void cardinalsPointsDisplayedChanged(const bool displayed);
void fogDisplayedChanged(const bool displayed); void fogDisplayedChanged(const bool displayed);
void landscapeDisplayedChanged(const bool displayed); void landscapeDisplayedChanged(const bool displayed);
void lightPollutionUsageChanged(const bool usage);
//! Emitted when a landscape has been installed or un-installed. //! Emitted when a landscape has been installed or un-installed.
//! For example, it is used to update the list of landscapes in //! For example, it is used to update the list of landscapes in
//! the Sky and viewing options window (the ViewDialog class) //! the Sky and viewing options window (the ViewDialog class)
void landscapesChanged(); void landscapesChanged();
void lightPollutionChanged();
//! Emitted when installLandscapeFromArchive() can't read from, writ e to or //! Emitted when installLandscapeFromArchive() can't read from, writ e to or
//! create a file or a directory. //! create a file or a directory.
//! (A way of moving the need for translatable error messages to the GUI.) //! (A way of moving the need for translatable error messages to the GUI.)
//! \param path path to the file or directory //! \param path path to the file or directory
void errorUnableToOpen(QString path); void errorUnableToOpen(QString path);
//! Emitted when the file passed to installLandscapeFromArchive() is not a //! Emitted when the file passed to installLandscapeFromArchive() is not a
//! ZIP archive or does not contain a valid landscape. //! ZIP archive or does not contain a valid landscape.
//! (A way of moving the need for translatable error messages to the GUI.) //! (A way of moving the need for translatable error messages to the GUI.)
void errorNotArchive(); void errorNotArchive();
//! Emitted when installLandscapeFromArchive() tries to install a la ndscape //! Emitted when installLandscapeFromArchive() tries to install a la ndscape
skipping to change at line 318 skipping to change at line 355
//! \param path the path to the landscape's directory //! \param path the path to the landscape's directory
void errorRemoveManually(QString path); void errorRemoveManually(QString path);
private slots: private slots:
//! Load a color scheme from a configuration object //! Load a color scheme from a configuration object
void setStelStyle(const QString& section); void setStelStyle(const QString& section);
//! Translate labels to new language settings. //! Translate labels to new language settings.
void updateI18n(); void updateI18n();
//! Return the value of the initial brightness of landscape
float getInitialLandscapeBrightness() const {return initialLandscape
Brightness;}
//! Set the value of the initial brightness of landscape.
void setInitialLandscapeBrightness(float b) {initialLandscapeBrightn
ess=b;}
private: private:
//! Get light pollution luminance level. //! Get light pollution luminance level.
float getAtmosphereLightPollutionLuminance() const; float getAtmosphereLightPollutionLuminance() const;
//! Set light pollution luminance level. //! Set light pollution luminance level.
void setAtmosphereLightPollutionLuminance(float f); void setAtmosphereLightPollutionLuminance(const float f);
//! For a given landscape name, return the landscape ID. //! For a given landscape name, return the landscape ID.
//! This takes a name of the landscape, as described in the landscap e:name item in the //! This takes a name of the landscape, as described in the landscap e:name item in the
//! landscape.ini, and returns the landscape ID which corresponds to that name. //! landscape.ini, and returns the landscape ID which corresponds to that name.
QString nameToID(const QString& name); QString nameToID(const QString& name) const;
//! Return a map of landscape name to landscape ID (directory name). //! Return a map of landscape name to landscape ID (directory name).
QMap<QString,QString> getNameToDirMap() const; QMap<QString,QString> getNameToDirMap() const;
//! Returns the path to an installed landscape's directory. //! Returns the path to an installed landscape's directory.
//! It uses StelFileMgr to look for it in the possible directories. //! It uses StelFileMgr to look for it in the possible directories.
//! @param landscapeID an installed landscape's identifier (the fold er name) //! @param landscapeID an installed landscape's identifier (the fold er name)
//! @returns an empty string, if no such landscape was found. //! @returns an empty string, if no such landscape was found.
QString getLandscapePath(QString landscapeID); QString getLandscapePath(const QString landscapeID) const;
Atmosphere* atmosphere; // Atmosphere Atmosphere* atmosphere; // Atmosphere
Cardinals* cardinalsPoints; // Cardinals points Cardinals* cardinalsPoints; // Cardinals points
Landscape* landscape; // The landscape i.e. the fo g, the ground and "decor" Landscape* landscape; // The landscape i.e. the fo g, the ground and "decor"
// Define whether the observer location is to be updated when the la ndscape is updated. // Define whether the observer location is to be updated when the la ndscape is updated.
bool flagLandscapeSetsLocation; bool flagLandscapeSetsLocation;
bool flagLandscapeAutoSelection; bool flagLandscapeAutoSelection;
bool flagLandscapeNightBrightness; bool flagLightPollutionFromDatabase;
//! Indicate use of the default minimal brightness value specified i
n config.ini.
bool flagLandscapeUseMinimalBrightness;
//! A minimal brightness value to keep landscape visible.
float defaultMinimalBrightness;
//! Indicate use of the minimal brightness value specified in the cu
rrent landscape.ini, if present.
bool flagLandscapeSetsMinimalBrightness;
//! Indicate auto-enable atmosphere for planets with atmospheres in
location window
bool flagAtmosphereAutoEnabling;
// The ID of the currently loaded landscape // The ID of the currently loaded landscape
QString currentLandscapeID; QString currentLandscapeID;
// The ID of the default landscape // The ID of the default landscape
QString defaultLandscapeID; QString defaultLandscapeID;
//! List of the IDs of the landscapes packaged by default with Stell arium. //! List of the IDs of the landscapes packaged by default with Stell arium.
//! (So that they can't be removed.) //! (So that they can't be removed.)
//! It is populated in LandscapeMgr() and has to be updated //! It is populated in LandscapeMgr() and has to be updated
//! manually on changes. //! manually on changes.
//! @todo Find a way to update it automatically. //! @todo Find a way to update it automatically.
QStringList packagedLandscapeIDs; QStringList packagedLandscapeIDs;
float initialLandscapeBrightness;
}; };
#endif // _LANDSCAPEMGR_HPP_ #endif // _LANDSCAPEMGR_HPP_
 End of changes. 25 change blocks. 
60 lines changed or deleted 116 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/