Landscape.hpp   Landscape.hpp 
skipping to change at line 34 skipping to change at line 34
#include "StelToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTextureTypes.hpp" #include "StelTextureTypes.hpp"
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include <QMap> #include <QMap>
#include <QImage> #include <QImage>
#include <QList>
#include <QFont>
class QSettings; class QSettings;
class StelLocation; class StelLocation;
class StelCore; class StelCore;
class StelPainter; class StelPainter;
//! @class Landscape //! @class Landscape
//! Store and manages the displaying of the Landscape. //! Store and manages the displaying of the Landscape.
//! Don't use this class directly, use the LandscapeMgr. //! 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 locati on. //! A landscape's most important element is a photo panorama, or at least a polygon that describes the true horizon visible from your observing locati on.
skipping to change at line 59 skipping to change at line 61
//! - A night texture that gets blended over the dimmed daylight panorama. (All landscapes except Polygonal.) //! - A night texture that gets blended over the dimmed daylight panorama. (All landscapes except Polygonal.)
//! - A polygonal horizon line (required for PolygonalLandscape). If prese nt, defines a measured horizon line, which can be plotted or queried for ri se/set predictions. //! - A polygonal horizon line (required for PolygonalLandscape). If prese nt, defines a measured horizon line, which can be plotted or queried for ri se/set predictions.
//! - You can set a minimum brightness level to prevent too dark landscape . There is //! - You can set a minimum brightness level to prevent too dark landscape . There is
//! a global activation setting (config.ini[landscape]flag_minimal_brigh tness), //! a global activation setting (config.ini[landscape]flag_minimal_brigh tness),
//! a global value (config.ini[landscape]minimal_brightness), //! a global value (config.ini[landscape]minimal_brightness),
//! and, if config.ini[landscape]flag_landscape_sets_minimal_brightness= true, //! and, if config.ini[landscape]flag_landscape_sets_minimal_brightness= true,
//! optional individual values given in landscape.ini[landscape]minimal_ brightness are used. //! optional individual values given in landscape.ini[landscape]minimal_ brightness are used.
//! //!
//! We discern: //! We discern:
//! @param LandscapeId: The directory name of the landscape. //! @param LandscapeId: The directory name of the landscape.
//! @param name: The landscape name as specified in the LandscapeIni (may contain spaces, UTF8, ...) //! @param name: The landscape name as specified in the LandscapeIni (may contain spaces, translatable, UTF8, ...)
class Landscape class Landscape
{ {
public: public:
typedef struct
{
QString name;
Vec3d featurePoint; // start of the line: mountain peak, bui
lding, ...
Vec3d labelPoint; // end of the line, where the centered l
abel best fits.
} LandscapeLabel;
Landscape(float _radius = 2.f); Landscape(float _radius = 2.f);
virtual ~Landscape(); virtual ~Landscape();
//! Load landscape. //! Load landscape.
//! @param landscapeIni A reference to an existing QSettings object which describes the landscape //! @param landscapeIni A reference to an existing QSettings object which describes the landscape
//! @param landscapeId The name of the directory for the landscape f iles (e.g. "ocean") //! @param landscapeId The name of the directory for the landscape f iles (e.g. "ocean")
virtual void load(const QSettings& landscapeIni, const QString& land scapeId) = 0; virtual void load(const QSettings& landscapeIni, const QString& land scapeId) = 0;
virtual void draw(StelCore* core) = 0; virtual void draw(StelCore* core) = 0;
void update(double deltaTime) void update(double deltaTime)
{ {
landFader.update((int)(deltaTime*1000)); landFader.update((int)(deltaTime*1000));
fogFader.update((int)(deltaTime*1000)); fogFader.update((int)(deltaTime*1000));
illumFader.update((int)(deltaTime*1000)); illumFader.update((int)(deltaTime*1000));
labelFader.update((int)(deltaTime*1000));
} }
//! Set the brightness of the landscape plus brightness of optional add-on night lightscape. //! Set the brightness of the landscape plus brightness of optional add-on night lightscape.
//! This is called in each draw(). //! This is called in each draw().
void setBrightness(const float b, const float pollutionBrightness=0. 0f) {landscapeBrightness = b; lightScapeBrightness=pollutionBrightness; } void setBrightness(const float b, const float pollutionBrightness=0. 0f) {landscapeBrightness = b; lightScapeBrightness=pollutionBrightness; }
//! Returns the current brightness level //! Returns the current brightness level
float getBrightness() const { return landscapeBrightness; } float getBrightness() const { return landscapeBrightness; }
//! Returns the lightscape brightness //! Returns the lightscape brightness
float getLightscapeBrightness() const { return lightScapeBrightness; } float getLightscapeBrightness() const { return lightScapeBrightness; }
skipping to change at line 104 skipping to change at line 114
//! Returns the currently effective land fade value //! Returns the currently effective land fade value
float getEffectiveLandFadeValue() { return landFader.getInterstate() ; } float getEffectiveLandFadeValue() { return landFader.getInterstate() ; }
//! Set whether fog is displayed //! Set whether fog is displayed
void setFlagShowFog(const bool b) {fogFader=b;} void setFlagShowFog(const bool b) {fogFader=b;}
//! Get whether fog is displayed //! Get whether fog is displayed
bool getFlagShowFog() const {return (bool)fogFader;} bool getFlagShowFog() const {return (bool)fogFader;}
//! Set whether illumination is displayed //! Set whether illumination is displayed
void setFlagShowIllumination(const bool b) {illumFader=b;} void setFlagShowIllumination(const bool b) {illumFader=b;}
//! Get whether illumination is displayed //! Get whether illumination is displayed
bool getFlagShowIllumination() const {return (bool)illumFader;} bool getFlagShowIllumination() const {return (bool)illumFader;}
//! Set whether labels are displayed
void setFlagShowLabels(const bool b) {labelFader=b;}
//! Get whether labels are displayed
bool getFlagShowLabels() const {return (bool)labelFader;}
//! change font and fontsize for landscape labels
void setLabelFontSize(const int size){fontSize=size;}
//! Get landscape name //! Get landscape name
QString getName() const {return name;} QString getName() const {return name;}
//! Get landscape author name //! Get landscape author name
QString getAuthorName() const {return author;} QString getAuthorName() const {return author;}
//! Get landscape description //! Get landscape description
QString getDescription() const {return description;} QString getDescription() const {return description;}
//! Return the associated location (may be empty!) //! Return the associated location (may be empty!)
const StelLocation& getLocation() const {return location;} const StelLocation& getLocation() const {return location;}
//! Return if the location is valid (a valid location has a valid pl anetName!) //! Return if the location is valid (a valid location has a valid pl anetName!)
skipping to change at line 140 skipping to change at line 157
//! Set an additional z-axis (azimuth) rotation after landscape has been loaded. //! Set an additional z-axis (azimuth) rotation after landscape has been loaded.
//! 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) . It is called //! 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 a zimuth rotation //! e.g. by the LandscapeMgr. Contrary to that, the purpose of the a zimuth rotation
//! (landscape/[decor_]angle_rotatez) in landscape.ini is to orient the pano. //! (landscape/[decor_]angle_rotatez) in landscape.ini is to orient the pano.
//! @param d the rotation angle in degrees. //! @param d the rotation angle in degrees.
void setZRotation(float d) {angleRotateZOffset = d * M_PI/180.0f;} void setZRotation(float d) {angleRotateZOffset = d * M_PI/180.0f;}
//! Get whether the landscape is currently fully visible (i.e. opaqu e). //! Get whether the landscape is currently fully visible (i.e. opaqu e).
bool getIsFullyVisible() const {return landFader.getInterstate() >= 0.999f;} bool getIsFullyVisible() const {return landFader.getInterstate() >= 0.999f;}
//! 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 on
ly from landscape.ini
float getSinMinAltitudeLimit() const {return sinMinAltitudeLimit;}
// GZ: NEW FUNCTION: //! Find opacity in a certain direction. (New in V0.13 series)
//! can be used to find sunrise or visibility questions on the real- world landscape horizon. //! can be used to find sunrise or visibility questions on the real- world landscape horizon.
//! Default implementation indicates the horizon equals math horizon . //! Default implementation indicates the horizon equals math horizon .
virtual float getOpacity(Vec3d azalt) const {return (azalt[2]<0 ? 1. // TBD: Maybe change this to azalt[2]<sinMinAltitudeLimit ? (But nev
0f : 0.0f); } er called in practice, reimplemented by the subclasses...)
virtual float getOpacity(Vec3d azalt) const { Q_ASSERT(0); return (a
zalt[2]<0 ? 1.0f : 0.0f); }
//! The list of azimuths (counted from True North towards East) and altitudes can come in various formats. We read the first two elements, whic h can be of formats: //! The list of azimuths (counted from True North towards East) and altitudes can come in various formats. We read the first two elements, whic h can be of formats:
enum horizonListMode { enum horizonListMode {
azDeg_altDeg = 0, //! azimuth[degrees] altitude[degrees] azDeg_altDeg = 0, //! azimuth[degrees] altitude[degrees]
azDeg_zdDeg = 1, //! azimuth[degrees] zenithDistance[degr ees] azDeg_zdDeg = 1, //! azimuth[degrees] zenithDistance[degr ees]
azRad_altRad = 2, //! azimuth[radians] altitude[radians] azRad_altRad = 2, //! azimuth[radians] altitude[radians]
azRad_zdRad = 3, //! azimuth[radians] zenithDistance[radi ans] azRad_zdRad = 3, //! azimuth[radians] zenithDistance[radi ans]
azGrad_altGrad = 4, //! azimuth[new_degrees] altitude[new_de grees] (may be found on theodolites) azGrad_altGrad = 4, //! azimuth[new_degrees] altitude[new_de grees] (may be found on theodolites)
azGrad_zdGrad = 5 //! azimuth[new_degrees] zenithDistance[ new_degrees] (may be found on theodolites) azGrad_zdGrad = 5 //! azimuth[new_degrees] zenithDistance[ new_degrees] (may be found on theodolites)
}; };
//! Load descriptive labels from optional file gazetteer.LANG.utf8.
void loadLabels(const QString& landscapeId);
protected: protected:
//! Load attributes common to all landscapes //! Load attributes common to all landscapes
//! @param landscapeIni A reference to an existing QSettings object which describes the landscape //! @param landscapeIni A reference to an existing QSettings object which describes the landscape
//! @param landscapeId The name of the directory for the landscape f iles (e.g. "ocean") //! @param landscapeId The name of the directory for the landscape f iles (e.g. "ocean")
void loadCommon(const QSettings& landscapeIni, const QString& landsc apeId); void loadCommon(const QSettings& landscapeIni, const QString& landsc apeId);
//! Draw optional labels on the landscape
void drawLabels(StelCore *core, StelPainter *painter);
//! Create a StelSphericalPolygon that describes a measured horizon line. If present, this can be used to draw a horizon line //! Create a StelSphericalPolygon that describes a measured horizon line. If present, this can be used to draw a horizon line
//! or simplify the functionality to discern if an object is below t he horizon. //! or simplify the functionality to discern if an object is below t he horizon.
//! @param _lineFileName A text file with lines that are either empt y or comment lines starting with # or azimuth altitude [degrees] //! @param _lineFileName A text file with lines that are either empt y or comment lines starting with # or azimuth altitude [degrees]
//! @param _polyAngleRotateZ possibility to set some final calibrati on offset like meridian convergence correction. //! @param _polyAngleRotateZ possibility to set some final calibrati on offset like meridian convergence correction.
void createPolygonalHorizon(const QString& lineFileName, const float polyAngleRotateZ=0.0f, const QString &listMode="azDeg_altDeg"); void createPolygonalHorizon(const QString& lineFileName, const float polyAngleRotateZ=0.0f, const QString &listMode="azDeg_altDeg");
//! search for a texture in landscape directory, else global texture s directory //! search for a texture in landscape directory, else global texture s directory
//! @param basename The name of a texture file, e.g. "fog.png" //! @param basename The name of a texture file, e.g. "fog.png"
//! @param landscapeId The landscape ID (directory name) to which th e texture belongs //! @param landscapeId The landscape ID (directory name) to which th e texture belongs
//! @exception misc possibility of throwing "file not found" excepti ons //! @exception misc possibility of throwing "file not found" excepti ons
skipping to change at line 183 skipping to change at line 210
QString author; //! Read from landscape.ini:[landscape]author QString author; //! Read from landscape.ini:[landscape]author
QString description; //! Read from landscape.ini:[landscape]descri ption QString description; //! Read from landscape.ini:[landscape]descri ption
float minBrightness; //! Read from landscape.ini:[landscape]minima l_brightness. Allows minimum visibility that cannot be underpowered. float minBrightness; //! Read from landscape.ini:[landscape]minima l_brightness. Allows minimum visibility that cannot be underpowered.
float landscapeBrightness; //! brightness [0..1] to draw the landsc ape. Computed by the LandscapeMgr. float landscapeBrightness; //! brightness [0..1] to draw the landsc ape. Computed by the LandscapeMgr.
float lightScapeBrightness; //! can be used to draw nightscape textu re (e.g. city light pollution), if available. Computed by the LandscapeMgr. float lightScapeBrightness; //! can be used to draw nightscape textu re (e.g. city light pollution), if available. Computed by the LandscapeMgr.
bool validLandscape; //! was a landscape loaded properly? bool validLandscape; //! was a landscape loaded properly?
LinearFader landFader; //! Used to slowly fade in/out landscape pain ting. LinearFader landFader; //! Used to slowly fade in/out landscape pain ting.
LinearFader fogFader; //! Used to slowly fade in/out fog painting. LinearFader fogFader; //! Used to slowly fade in/out fog painting.
LinearFader illumFader;//! Used to slowly fade in/out illumination p ainting. LinearFader illumFader;//! Used to slowly fade in/out illumination p ainting.
LinearFader labelFader;//! Used to slowly fade in/out landscape feat ure labels.
int rows; //! horizontal rows. May be given in landscape.ini:[lands cape]tesselate_rows. More indicates higher accuracy, but is slower. int rows; //! horizontal rows. May be given in landscape.ini:[lands cape]tesselate_rows. More indicates higher accuracy, but is slower.
int cols; //! vertical columns. May be given in landscape.ini:[lands cape]tesselate_cols. More indicates higher accuracy, but is slower. int cols; //! vertical columns. May be given in landscape.ini:[lands cape]tesselate_cols. More indicates higher accuracy, but is slower.
float angleRotateZ; //! [radians] if pano does not have its left border in the east, rotate in azimuth. Configured in landscape.ini[landscap e]angle_rotatez (or decor_angle_rotatez for old_style landscapes) float angleRotateZ; //! [radians] if pano does not have its left border in the east, rotate in azimuth. Configured in landscape.ini[landscap e]angle_rotatez (or decor_angle_rotatez for old_style landscapes)
float angleRotateZOffset; //! [radians] This is a rotation changeabl e at runtime via setZRotation (called by LandscapeMgr::setZRotation). float angleRotateZOffset; //! [radians] This is a rotation changeabl e at runtime via setZRotation (called by LandscapeMgr::setZRotation).
//! Not in landscape.ini: Used in special cases where the horizon may rotate, e.g. on a ship. //! Not in landscape.ini: Used in special cases where the horizon may rotate, e.g. on a ship.
float sinMinAltitudeLimit; //! Minimal altitude of landscape cover.
Can be used to construct bounding caps, so that e.g. no stars are drawn bel
ow this altitude. Default -0.035, i.e. sin(-2 degrees).
StelLocation location; //! OPTIONAL. If present, can be used to set location. StelLocation location; //! OPTIONAL. If present, can be used to set location.
int defaultBortleIndex; //! May be given in landscape.ini:[location] light_pollution. Default: -1 (no change). int defaultBortleIndex; //! May be given in landscape.ini:[location] light_pollution. Default: -1 (no change).
int defaultFogSetting; //! May be given in landscape.ini:[location] display_fog: -1(no change), 0(off), 1(on). Default: -1. int defaultFogSetting; //! May be given in landscape.ini:[location] display_fog: -1(no change), 0(off), 1(on). Default: -1.
float defaultExtinctionCoefficient; //! May be given in landscape.in i:[location]atmospheric_extinction_coefficient. Default -1 (no change). float defaultExtinctionCoefficient; //! May be given in landscape.in i:[location]atmospheric_extinction_coefficient. Default -1 (no change).
float defaultTemperature; //! [Celsius] May be given in landscape.in i:[location]atmospheric_temperature. default: -1000.0 (no change) float defaultTemperature; //! [Celsius] May be given in landscape.in i:[location]atmospheric_temperature. default: -1000.0 (no change)
float defaultPressure; //! [mbar] May be given in landscape.in i:[location]atmospheric_pressure. Default -1.0 (compute from [location]/alt itude), use -2 to indicate "no change". float defaultPressure; //! [mbar] May be given in landscape.in i:[location]atmospheric_pressure. Default -1.0 (compute from [location]/alt itude), use -2 to indicate "no change".
// Optional elements which, if present, describe a horizon polygon. They can be used to render a line or a filled region, esp. in LandscapePoly gonal // Optional elements which, if present, describe a horizon polygon. They can be used to render a line or a filled region, esp. in LandscapePoly gonal
SphericalRegionP horizonPolygon; //! Optional element describing t he horizon line. SphericalRegionP horizonPolygon; //! Optional element describing t he horizon line.
//! Data shall be read from the f ile given as landscape.ini[landscape]polygonal_horizon_list //! Data shall be read from the f ile given as landscape.ini[landscape]polygonal_horizon_list
//! For LandscapePolygonal, this is the only horizon data item. //! For LandscapePolygonal, this is the only horizon data item.
Vec3f horizonPolygonLineColor ; //! for all horizon types, the ho rizonPolygon line, if specified, will be drawn in this color Vec3f horizonPolygonLineColor; //! for all horizon types, the ho rizonPolygon line, if specified, will be drawn in this color
//! specified in landscape.ini[la ndscape]horizon_line_color. Negative red (default) indicated "don't draw". //! specified in landscape.ini[la ndscape]horizon_line_color. Negative red (default) indicated "don't draw".
// Optional element: labels for landscape features.
QList<LandscapeLabel> landscapeLabels;
int fontSize; //! Used for landscape labels (optionally indicati
ng landscape features)
Vec3f labelColor; //! Color for the landscape labels.
}; };
//! @class LandscapeOldStyle //! @class LandscapeOldStyle
//! This was the original landscape, introduced for decorative purposes. It segments the horizon in several tiles //! This was the original landscape, introduced for decorative purposes. It segments the horizon in several tiles
//! (usually 4 or 8), therefore allowing very high resolution horizons also on limited hardware, //! (usually 4 or 8), therefore allowing very high resolution horizons also on limited hardware,
//! and closes the ground with a separate bottom piece. (You may want to co nfigure a map with pointers to surrounding mountains or a compass rose inst ead!) //! and closes the ground with a separate bottom piece. (You may want to co nfigure a map with pointers to surrounding mountains or a compass rose inst ead!)
//! You can use panoramas created in equirectangular or cylindrical coordin ates, for the latter case set //! You can use panoramas created in equirectangular or cylindrical coordin ates, for the latter case set
//! [landscape]tan_mode=true. //! [landscape]tan_mode=true.
//! Until V0.10.5 there was an undetected bug involving vertical positionin g. For historical reasons (many landscapes //! Until V0.10.5 there was an undetected bug involving vertical positionin g. For historical reasons (many landscapes
//! were already configured and published), it was decided to keep this bug as feature, but a fix for new landscapes is //! were already configured and published), it was decided to keep this bug as feature, but a fix for new landscapes is
 End of changes. 14 change blocks. 
5 lines changed or deleted 47 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/