StarMgr.hpp   StarMgr.hpp 
skipping to change at line 25 skipping to change at line 25
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STARMGR_HPP_ #ifndef _STARMGR_HPP_
#define _STARMGR_HPP_ #define _STARMGR_HPP_
#include <QFont> #include <QFont>
#include <QVariantMap> #include <QVariantMap>
#include <QVector>
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelObjectModule.hpp" #include "StelObjectModule.hpp"
#include "StelTextureTypes.hpp"
#include "StelProjectorType.hpp" #include "StelProjectorType.hpp"
class StelObject; class StelObject;
class StelToneReproducer; class StelToneReproducer;
class StelProjector; class StelProjector;
class StelPainter;
class QSettings; class QSettings;
namespace BigStarCatalogExtension { class ZoneArray;
class ZoneArray; struct HipIndexStruct;
struct HipIndexStruct;
}
static const int RCMAG_TABLE_SIZE = 4096; static const int RCMAG_TABLE_SIZE = 4096;
typedef struct typedef struct
{ {
QString designation; //! GCVS designation QString designation; //! GCVS designation
QString vtype; //! Type of variability QString vtype; //! Type of variability
float maxmag; //! Magnitude at maximum brightness float maxmag; //! Magnitude at maximum brightness
int mflag; //! Magnitude flag code int mflag; //! Magnitude flag code
float min1mag; //! First minimum magnitude or amplitude float min1mag; //! First minimum magnitude or amplitude
skipping to change at line 82 skipping to change at line 83
//! thus it is necessary to determine the vector from the observer //! thus it is necessary to determine the vector from the observer
//! to the centre of a zone, and add the star's offsets to find the //! to the centre of a zone, and add the star's offsets to find the
//! absolute position of the star on the celestial sphere. //! absolute position of the star on the celestial sphere.
//! //!
//! This position for a star is expressed as a 3-dimensional vector //! This position for a star is expressed as a 3-dimensional vector
//! which points from the observer (at the centre of the geodesic sphere) //! which points from the observer (at the centre of the geodesic sphere)
//! to the position of the star as observed on the celestial sphere. //! to the position of the star as observed on the celestial sphere.
class StarMgr : public StelObjectModule class StarMgr : public StelObjectModule
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool flagStarsDisplayed
READ getFlagStars
WRITE setFlagStars
NOTIFY starsDisplayedChanged)
Q_PROPERTY(bool flagLabelsDisplayed
READ getFlagLabels
WRITE setFlagLabels
NOTIFY starLabelsDisplayedChanged)
public: public:
StarMgr(void); StarMgr(void);
~StarMgr(void); ~StarMgr(void);
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
//! Initialize the StarMgr. //! Initialize the StarMgr.
//! - Loads the star catalogue data into memory //! - Loads the star catalogue data into memory
//! - Sets up the star color table //! - Sets up the star color table
//! - Loads the star texture //! - Loads the star texture
//! - Loads the star font (for labels on named stars) //! - Loads the star font (for labels on named stars)
//! - Loads the texture of the sar selection indicator //! - Loads the texture of the sar selection indicator
//! - Lets various display flags from the ini parser object //! - Lets various display flags from the ini parser object
virtual void init(); virtual void init();
//! Draw the stars and the star selection indicator if necessary. //! Draw the stars and the star selection indicator if necessary.
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
//! Update any time-dependent features. //! Update any time-dependent features.
//! Includes fading in and out stars and labels when they are turned on and off. //! Includes fading in and out stars and labels when they are turned on and off.
virtual void update(double deltaTime) {labelsFader.update((int)(delt aTime*1000)); starsFader.update((int)(deltaTime*1000));} virtual void update(double deltaTime) {labelsFader.update((int)(delt aTime*1000)); starsFader.update((int)(deltaTime*1000));}
//! Used to determine the order in which the various StelModules are drawn. //! Used to determine the order in which the various StelModules are drawn.
virtual double getCallOrder(StelModuleActionName actionName) const; virtual double getCallOrder(StelModuleActionName actionName) const;
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in StelObjectManager class // Methods defined in StelObjectManager class
skipping to change at line 142 skipping to change at line 151
//! @return a list of matching object name by order of relevance, or an empty list if nothing match //! @return a list of matching object name by order of relevance, or an empty list if nothing match
virtual QStringList listMatchingObjects(const QString& objPrefix, in t maxNbItem=5, bool useStartOfWords=false) const; virtual QStringList listMatchingObjects(const QString& objPrefix, in t maxNbItem=5, bool useStartOfWords=false) const;
// empty, as there's too much stars for displaying at once // empty, as there's too much stars for displaying at once
virtual QStringList listAllObjects(bool inEnglish) const { Q_UNUSED( inEnglish) return QStringList(); } virtual QStringList listAllObjects(bool inEnglish) const { Q_UNUSED( inEnglish) return QStringList(); }
virtual QString getName() const { return "Stars"; } virtual QString getName() const { return "Stars"; }
public slots: public slots:
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods callable from script and GUI // Methods callable from script and GUI
//! Set the color used to label bright stars. //! Set the color used to label bright stars.
//! @param c The color of the bright stars labels
//! @code
//! // example of usage in scripts
//! StarMgr.setLabelColor(Vec3f(1.0,0.0,0.0));
//! @endcode
void setLabelColor(const Vec3f& c) {labelColor = c;} void setLabelColor(const Vec3f& c) {labelColor = c;}
//! Get the current color used to label bright stars. //! Get the current color used to label bright stars.
Vec3f getLabelColor(void) const {return labelColor;} Vec3f getLabelColor(void) const {return labelColor;}
//! Set display flag for Stars. //! Set display flag for Stars.
void setFlagStars(bool b) {starsFader=b;} void setFlagStars(bool b) {starsFader=b;}
//! Get display flag for Stars //! Get display flag for Stars
bool getFlagStars(void) const {return starsFader==true;} bool getFlagStars(void) const {return starsFader==true;}
//! Set display flag for Star names (labels). //! Set display flag for Star names (labels).
skipping to change at line 165 skipping to change at line 179
//! Set the amount of star labels. The real amount is also proportio nal with FOV. //! Set the amount of star labels. The real amount is also proportio nal with FOV.
//! The limit is set in function of the stars magnitude //! The limit is set in function of the stars magnitude
//! @param a the amount between 0 and 10. 0 is no labels, 10 is maxi mum of labels //! @param a the amount between 0 and 10. 0 is no labels, 10 is maxi mum of labels
void setLabelsAmount(float a) {labelsAmount=a;} void setLabelsAmount(float a) {labelsAmount=a;}
//! Get the amount of star labels. The real amount is also proportio nal with FOV. //! Get the amount of star labels. The real amount is also proportio nal with FOV.
//! @return the amount between 0 and 10. 0 is no labels, 10 is maxim um of labels //! @return the amount between 0 and 10. 0 is no labels, 10 is maxim um of labels
float getLabelsAmount(void) const {return labelsAmount;} float getLabelsAmount(void) const {return labelsAmount;}
//! Define font size to use for star names display. //! Define font size to use for star names display.
void setFontSize(double newFontSize); void setFontSize(float newFontSize);
//! Show scientific or catalog names on stars without common names. //! Show scientific or catalog names on stars without common names.
static void setFlagSciNames(bool f) {flagSciNames = f;} static void setFlagSciNames(bool f) {flagSciNames = f;}
static bool getFlagSciNames(void) {return flagSciNames;} static bool getFlagSciNames(void) {return flagSciNames;}
public: public:
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Other methods // Other methods
//! Search by Hipparcos catalogue number. //! Search by Hipparcos catalogue number.
//! @param hip the Hipparcos catalogue number of the star which is r equired. //! @param hip the Hipparcos catalogue number of the star which is r equired.
//! @return the requested StelObjectP or an empty objecy if the requ ested //! @return the requested StelObjectP or an empty objecy if the requ ested
//! one was not found. //! one was not found.
StelObjectP searchHP(int hip) const; StelObjectP searchHP(int hip) const;
//! Get the (translated) common name for a star with a specified //! Get the (translated) common name for a star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return translated common name of star
static QString getCommonName(int hip); static QString getCommonName(int hip);
//! Get the (translated) scientific name for a star with a specified //! Get the (translated) scientific name for a star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return translated scientific name of star
static QString getSciName(int hip); static QString getSciName(int hip);
//! Get the (translated) additional scientific name for a star with a //! Get the (translated) additional scientific name for a star with a
//! specified Hipparcos catalogue number. //! specified Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return translated additional scientific name of star
static QString getSciAdditionalName(int hip); static QString getSciAdditionalName(int hip);
//! Get the (translated) scientific name for a variable star with a specified //! Get the (translated) scientific name for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return translated scientific name of variable star
static QString getGcvsName(int hip); static QString getGcvsName(int hip);
//! Get the type of variability for a variable star with a specified //! Get the type of variability for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return type of variability
static QString getGcvsVariabilityType(int hip); static QString getGcvsVariabilityType(int hip);
//! Get the magnitude at maximum brightness for a variable star with a specified //! Get the magnitude at maximum brightness for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return the magnitude at maximum brightness for a variable star
static float getGcvsMaxMagnitude(int hip); static float getGcvsMaxMagnitude(int hip);
//! Get the magnitude flag code for a variable star with a specified //! Get the magnitude flag code for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return the magnitude flag code for a variable star
static int getGcvsMagnitudeFlag(int hip); static int getGcvsMagnitudeFlag(int hip);
//! Get the minimum magnitude or amplitude for a variable star with a specified //! Get the minimum magnitude or amplitude for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @param firstMinimumFlag
//! @return the minimum magnitude or amplitude for a variable star
static float getGcvsMinMagnitude(int hip, bool firstMinimumFlag=true ); static float getGcvsMinMagnitude(int hip, bool firstMinimumFlag=true );
//! Get the photometric system for a variable star with a specified //! Get the photometric system for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return the photometric system for a variable star
static QString getGcvsPhotometricSystem(int hip); static QString getGcvsPhotometricSystem(int hip);
//! Get Epoch for maximum light for a variable star with a specified //! Get Epoch for maximum light for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return Epoch for maximum light for a variable star
static double getGcvsEpoch(int hip); static double getGcvsEpoch(int hip);
//! Get the period for a variable star with a specified //! Get the period for a variable star with a specified
//! Hipparcos catalogue number. //! Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return the period of variable star
static double getGcvsPeriod(int hip); static double getGcvsPeriod(int hip);
//! Get the rising time or duration of eclipse for a variable star w ith a //! Get the rising time or duration of eclipse for a variable star w ith a
//! specified Hipparcos catalogue number. //! specified Hipparcos catalogue number.
//! @param hip The Hipparcos number of star
//! @return the rising time or duration of eclipse for variable star
static int getGcvsMM(int hip); static int getGcvsMM(int hip);
static QString convertToSpectralType(int index); static QString convertToSpectralType(int index);
static QString convertToComponentIds(int index); static QString convertToComponentIds(int index);
QVariantList getCatalogsDescription() const {return catalogsDescript ion;} QVariantList getCatalogsDescription() const {return catalogsDescript ion;}
//! Try to load the given catalog, even if it is marched as unchecke d. //! Try to load the given catalog, even if it is marched as unchecke d.
//! Mark it as checked if checksum is correct. //! Mark it as checked if checksum is correct.
//! @return false in case of failure. //! @return false in case of failure.
bool checkAndLoadCatalog(QVariantMap m); bool checkAndLoadCatalog(const QVariantMap& m);
private slots: private slots:
void setStelStyle(const QString& section); void setStelStyle(const QString& section);
//! Translate text. //! Translate text.
void updateI18n(); void updateI18n();
//! Called when the sky culture is updated. //! Called when the sky culture is updated.
//! Loads common and scientific names of stars for a given sky cultu re. //! Loads common and scientific names of stars for a given sky cultu re.
//! @param skyCultureDir the name of the directory containing the sk y culture to use. //! @param skyCultureDir the name of the directory containing the sk y culture to use.
void updateSkyCulture(const QString& skyCultureDir); void updateSkyCulture(const QString& skyCultureDir);
signals:
void starLabelsDisplayedChanged(const bool displayed);
void starsDisplayedChanged(const bool displayed);
private: private:
void setCheckFlag(const QString& catalogId, bool b); void setCheckFlag(const QString& catalogId, bool b);
void copyDefaultConfigFile(); void copyDefaultConfigFile();
//! Loads common names for stars from a file. //! Loads common names for stars from a file.
//! Called when the SkyCulture is updated. //! Called when the SkyCulture is updated.
//! @param the path to a file containing the common names for bright stars. //! @param the path to a file containing the common names for bright stars.
int loadCommonNames(const QString& commonNameFile); int loadCommonNames(const QString& commonNameFile);
skipping to change at line 276 skipping to change at line 319
void loadGcvs(const QString& GcvsFile); void loadGcvs(const QString& GcvsFile);
//! Gets the maximum search level. //! Gets the maximum search level.
// TODO: add a non-lame description - what is the purpose of the max search level? // TODO: add a non-lame description - what is the purpose of the max search level?
int getMaxSearchLevel() const; int getMaxSearchLevel() const;
//! Load all the stars from the files. //! Load all the stars from the files.
void loadData(QVariantMap starsConfigFile); void loadData(QVariantMap starsConfigFile);
//! Draw a nice animated pointer around the object. //! Draw a nice animated pointer around the object.
void drawPointer(class StelRenderer* renderer, StelProjectorP projec tor, const StelCore* core); void drawPointer(StelPainter& sPainter, const StelCore* core);
LinearFader labelsFader; LinearFader labelsFader;
LinearFader starsFader; LinearFader starsFader;
bool flagStarName; bool flagStarName;
float labelsAmount; float labelsAmount;
bool gravityLabel; bool gravityLabel;
int maxGeodesicGridLevel; int maxGeodesicGridLevel;
int lastMaxSearchLevel; int lastMaxSearchLevel;
typedef QHash<int,BigStarCatalogExtension::ZoneArray*> ZoneArrayMap;
ZoneArrayMap zoneArrays; // index is the grid level // A ZoneArray per grid level
QVector<ZoneArray*> gridLevels;
static void initTriangleFunc(int lev, int index, static void initTriangleFunc(int lev, int index,
const Vec3f &c0, const Vec3f &c0,
const Vec3f &c1, const Vec3f &c1,
const Vec3f &c2, const Vec3f &c2,
void *conte xt) void *conte xt)
{ {
reinterpret_cast<StarMgr*>(context)->initTriangle(lev, index , c0, c1, c2); reinterpret_cast<StarMgr*>(context)->initTriangle(lev, index , c0, c1, c2);
} }
void initTriangle(int lev, int index, void initTriangle(int lev, int index,
const Vec3f &c0, const Vec3f &c0,
const Vec3f &c1, const Vec3f &c1,
const Vec3f &c2); const Vec3f &c2);
BigStarCatalogExtension::HipIndexStruct *hipIndex; // array of hipar cos stars HipIndexStruct *hipIndex; // array of hiparcos stars
static QHash<int, QString> commonNamesMap; static QHash<int, QString> commonNamesMap;
static QHash<int, QString> commonNamesMapI18n; static QHash<int, QString> commonNamesMapI18n;
static QMap<QString, int> commonNamesIndexI18n; static QMap<QString, int> commonNamesIndexI18n;
static QMap<QString, int> commonNamesIndex; static QMap<QString, int> commonNamesIndex;
static QHash<int, QString> sciNamesMapI18n; static QHash<int, QString> sciNamesMapI18n;
static QMap<QString, int> sciNamesIndexI18n; static QMap<QString, int> sciNamesIndexI18n;
static QHash<int, QString> sciAdditionalNamesMapI18n; static QHash<int, QString> sciAdditionalNamesMapI18n;
static QMap<QString, int> sciAdditionalNamesIndexI18n; static QMap<QString, int> sciAdditionalNamesIndexI18n;
static QHash<int, varstar> varStarsMapI18n; static QHash<int, varstar> varStarsMapI18n;
static QMap<QString, int> varStarsIndexI18n; static QMap<QString, int> varStarsIndexI18n;
QFont starFont; QFont starFont;
static bool flagSciNames; static bool flagSciNames;
Vec3f labelColor; Vec3f labelColor;
class StelTextureNew* texPointer; // The selection poi nter texture StelTextureSP texPointer; // The selection pointer tex ture
class StelObjectMgr* objectMgr; class StelObjectMgr* objectMgr;
QString starConfigFileFullPath; QString starConfigFileFullPath;
QVariantMap starSettings; QVariantMap starSettings;
QVariantList catalogsDescription; QVariantList catalogsDescription;
}; };
#endif // _STARMGR_HPP_ #endif // _STARMGR_HPP_
 End of changes. 26 change blocks. 
12 lines changed or deleted 56 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/