AstroCalcDialog.hpp   AstroCalcDialog.hpp 
skipping to change at line 38 skipping to change at line 38
#include <QVector> #include <QVector>
#include <QTimer> #include <QTimer>
#include "StelDialog.hpp" #include "StelDialog.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "Nebula.hpp" #include "Nebula.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "StelUtils.hpp"
class Ui_astroCalcDialogForm; class Ui_astroCalcDialogForm;
class QListWidgetItem; class QListWidgetItem;
class AstroCalcDialog : public StelDialog class AstroCalcDialog : public StelDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Defines the number and the order of the columns in the table tha //! Defines the number and the order of the columns in the table tha
t lists planetary positions t lists celestial bodies positions
//! @enum PlanetaryPositionsColumns //! @enum CPositionsColumns
enum PlanetaryPositionsColumns { enum CPositionsColumns {
ColumnName, //! name of object CColumnName, //! name of object
ColumnRA, //! right ascension CColumnRA, //! right ascension
ColumnDec, //! declination CColumnDec, //! declination
ColumnMagnitude, //! magnitude CColumnMagnitude, //! magnitude
ColumnType, //! type of object CColumnExtra, //! extra data (surface brightness,
ColumnCount //! total number of columns separation, period, etc.)
CColumnType, //! type of object
CColumnCount //! total number of columns
}; };
//! Defines the number and the order of the columns in the ephemeris table //! Defines the number and the order of the columns in the ephemeris table
//! @enum EphemerisColumns //! @enum EphemerisColumns
enum EphemerisColumns { enum EphemerisColumns {
EphemerisDate, //! date and time of ephemeris EphemerisDate, //! date and time of ephemeris
EphemerisJD, //! JD EphemerisJD, //! JD
EphemerisRA, //! right ascension EphemerisRA, //! right ascension
EphemerisDec, //! declination EphemerisDec, //! declination
EphemerisMagnitude, //! magnitude EphemerisMagnitude, //! magnitude
EphemerisPhase, //! phase
EphemerisDistance, //! distance
EphemerisElongation, //! elongation
EphemerisCount //! total number of columns EphemerisCount //! total number of columns
}; };
//! Defines the number and the order of the columns in the phenomena table //! Defines the number and the order of the columns in the phenomena table
//! @enum PhenomenaColumns //! @enum PhenomenaColumns
enum PhenomenaColumns { enum PhenomenaColumns {
PhenomenaType, //! type of phenomena PhenomenaType, //! type of phenomena
PhenomenaDate, //! date and time of ephemeris PhenomenaDate, //! date and time of ephemeris
PhenomenaObject1, //! first object PhenomenaObject1, //! first object
PhenomenaObject2, //! second object PhenomenaObject2, //! second object
PhenomenaSeparation, //! angular separation PhenomenaSeparation, //! angular separation
PhenomenaCount //! total number of columns PhenomenaCount //! total number of columns
}; };
//! Defines the type of graphs
//! @enum GraphsTypes
enum GraphsTypes {
GraphMagnitudeVsTime = 1,
GraphPhaseVsTime = 2,
GraphDistanceVsTime = 3,
GraphElongationVsTime = 4,
GraphAngularSizeVsTime = 5,
GraphPhaseAngleVsTime = 6
};
AstroCalcDialog(QObject* parent); AstroCalcDialog(QObject* parent);
virtual ~AstroCalcDialog(); virtual ~AstroCalcDialog();
//! Notify that the application style changed //! Notify that the application style changed
void styleChanged(); void styleChanged();
static QVector<Vec3d> EphemerisListJ2000; static QVector<Vec3d> EphemerisListCoords;
static QVector<QString> EphemerisListDates; static QVector<QString> EphemerisListDates;
static QVector<float> EphemerisListMagnitudes;
static int DisplayedPositionIndex; static int DisplayedPositionIndex;
public slots: public slots:
void retranslate(); void retranslate();
protected: protected:
//! Initialize the dialog widgets and connect the signals/slots. //! Initialize the dialog widgets and connect the signals/slots.
virtual void createDialogContent(); virtual void createDialogContent();
Ui_astroCalcDialogForm *ui; Ui_astroCalcDialogForm *ui;
private slots: private slots:
//! Search planetary positions and fill the list. void currentCelestialPositions();
void currentPlanetaryPositions(); void selectCurrentCelestialPosition(const QModelIndex &modelIndex);
void selectCurrentPlanetaryPosition(const QModelIndex &modelIndex);
void onChangedEphemerisPosition(const QModelIndex &modelIndex); void saveCelestialPositionsMagnitudeLimit(double mag);
void saveCelestialPositionsHorizontalCoordinatesFlag(bool b);
void saveCelestialPositionsCategory(int index);
//! Calculate ephemeris for selected celestial body and fill the lis t. //! Calculate ephemeris for selected celestial body and fill the lis t.
void generateEphemeris(); void generateEphemeris();
void cleanupEphemeris(); void cleanupEphemeris();
void selectCurrentEphemeride(const QModelIndex &modelIndex); void selectCurrentEphemeride(const QModelIndex &modelIndex);
void saveEphemeris(); void saveEphemeris();
void onChangedEphemerisPosition(const QModelIndex &modelIndex);
void reGenerateEphemeris();
void saveEphemerisCelestialBody(int index);
void saveEphemerisTimeStep(int index);
//! Calculate phenomena for selected celestial body and fill the lis t. //! Calculate phenomena for selected celestial body and fill the lis t.
void calculatePhenomena(); void calculatePhenomena();
void cleanupPhenomena();
void selectCurrentPhenomen(const QModelIndex &modelIndex); void selectCurrentPhenomen(const QModelIndex &modelIndex);
void savePhenomena(); void savePhenomena();
void savePhenomenaAngularSeparation(double v);
void savePhenomenaCelestialBody(int index);
void savePhenomenaCelestialGroup(int index);
void savePhenomenaOppositionFlag(bool b);
//! Draw diagram 'Altitude vs. Time'
void drawAltVsTimeDiagram(); void drawAltVsTimeDiagram();
//! Draw vertical line 'Now' on diagram 'Altitude vs. Time'
void drawCurrentTimeDiagram(); void drawCurrentTimeDiagram();
//! Draw vertical line of meridian passage time on diagram 'Altitude
vs. Time'
void drawTransitTimeDiagram();
//! Show info from graphs under mouse cursor
void mouseOverLine(QMouseEvent *event); void mouseOverLine(QMouseEvent *event);
void saveGraphsCelestialBody(int index);
void saveGraphsFirstId(int index);
void saveGraphsSecondId(int index);
void drawXVsTimeGraphs();
// WUT
void saveWutMagnitudeLimit(double mag);
void saveWutTimeInterval(int index);
void calculateWutObjects();
void selectWutObject();
void updateAstroCalcData();
void changePage(QListWidgetItem *current, QListWidgetItem *previous) ; void changePage(QListWidgetItem *current, QListWidgetItem *previous) ;
void updateSolarSystemData(); void updateSolarSystemData();
private: private:
class StelCore* core; class StelCore* core;
class SolarSystem* solarSystem; class SolarSystem* solarSystem;
class NebulaMgr* dsoMgr; class NebulaMgr* dsoMgr;
class StarMgr* starMgr; class StarMgr* starMgr;
class StelObjectMgr* objectMgr; class StelObjectMgr* objectMgr;
class StelLocaleMgr* localeMgr;
QSettings* conf;
QTimer *currentTimeLine; QTimer *currentTimeLine;
QHash<QString,QString> wutObjects;
QHash<QString,int> wutCategories;
//! Update header names for planetary positions table //! Update header names for celestial positions tables
void setPlanetaryPositionsHeaderNames(); void setCelestialPositionsHeaderNames();
//! Update header names for ephemeris table //! Update header names for ephemeris table
void setEphemerisHeaderNames(); void setEphemerisHeaderNames();
//! Update header names for phenomena table //! Update header names for phenomena table
void setPhenomenaHeaderNames(); void setPhenomenaHeaderNames();
//! Init header and list of planetary positions //! Init header and list of celestial positions
void initListPlanetaryPositions(); void initListCelestialPositions();
//! Init header and list of ephemeris //! Init header and list of ephemeris
void initListEphemeris(); void initListEphemeris();
//! Init header and list of phenomena //! Init header and list of phenomena
void initListPhenomena(); void initListPhenomena();
//! Populates the drop-down list of celestial bodies. //! Populates the drop-down list of celestial bodies.
//! The displayed names are localized in the current interface langu age. //! The displayed names are localized in the current interface langu age.
//! The original names are kept in the user data field of each QComb oBox //! The original names are kept in the user data field of each QComb oBox
//! item. //! item.
void populateCelestialBodyList(); void populateCelestialBodyList();
void populateCelestialCategoryList();
//! Populates the drop-down list of time steps. //! Populates the drop-down list of time steps.
void populateEphemerisTimeStepsList(); void populateEphemerisTimeStepsList();
//! Populates the drop-down list of major planets. //! Populates the drop-down list of major planets.
void populateMajorPlanetList(); void populateMajorPlanetList();
//! Populates the drop-down list of groups of celestial bodies. //! Populates the drop-down list of groups of celestial bodies.
void populateGroupCelestialBodyList(); void populateGroupCelestialBodyList();
//! Prepare graph settings //! Prepare graph settings
void prepareAxesAndGraph(); void prepareAxesAndGraph();
void prepareXVsTimeAxesAndGraph();
//! Populates the drop-down list of time intervals for WUT tool.
void populateTimeIntervalsList();
//! Populates the list of groups for WUT tool.
void populateWutGroups();
void populateFunctionsList();
//! Calculation conjunctions and oppositions. //! Calculation conjunctions and oppositions.
//! @note Ported from KStars, should be improved, because this featu re calculate //! @note Ported from KStars, should be improved, because this featu re calculate
//! angular separation ("conjunction" defined as equality of right a scension //! angular separation ("conjunction" defined as equality of right a scension
//! of two body) and current solution is not accurate and slow. //! of two body) and current solution is not accurate and slow.
QMap<double, double> findClosestApproach(PlanetP& object1, PlanetP& object2, double startJD, double stopJD, double maxSeparation, bool oppositi on); QMap<double, double> findClosestApproach(PlanetP& object1, PlanetP& object2, double startJD, double stopJD, double maxSeparation, bool oppositi on);
double findDistance(double JD, PlanetP object1, PlanetP object2, boo l opposition); double findDistance(double JD, PlanetP object1, PlanetP object2, boo l opposition);
bool findPrecise(QPair<double, double>* out, PlanetP object1, Planet P object2, double JD, double step, int prevSign, bool opposition); bool findPrecise(QPair<double, double>* out, PlanetP object1, Planet P object2, double JD, double step, int prevSign, bool opposition);
void fillPhenomenaTable(const QMap<double, double> list, const Plane tP object1, const PlanetP object2, bool opposition); void fillPhenomenaTable(const QMap<double, double> list, const Plane tP object1, const PlanetP object2, bool opposition);
skipping to change at line 179 skipping to change at line 239
double findDistance(double JD, PlanetP object1, NebulaP object2); double findDistance(double JD, PlanetP object1, NebulaP object2);
bool findPrecise(QPair<double, double>* out, PlanetP object1, Nebula P object2, double JD, double step, int prevSign); bool findPrecise(QPair<double, double>* out, PlanetP object1, Nebula P object2, double JD, double step, int prevSign);
void fillPhenomenaTable(const QMap<double, double> list, const Plane tP object1, const NebulaP object2); void fillPhenomenaTable(const QMap<double, double> list, const Plane tP object1, const NebulaP object2);
QMap<double, double> findClosestApproach(PlanetP& object1, StelObjec tP& object2, double startJD, double stopJD, double maxSeparation); QMap<double, double> findClosestApproach(PlanetP& object1, StelObjec tP& object2, double startJD, double stopJD, double maxSeparation);
double findDistance(double JD, PlanetP object1, StelObjectP object2) ; double findDistance(double JD, PlanetP object1, StelObjectP object2) ;
bool findPrecise(QPair<double, double>* out, PlanetP object1, StelOb jectP object2, double JD, double step, int prevSign); bool findPrecise(QPair<double, double>* out, PlanetP object1, StelOb jectP object2, double JD, double step, int prevSign);
void fillPhenomenaTable(const QMap<double, double> list, const Plane tP object1, const StelObjectP object2); void fillPhenomenaTable(const QMap<double, double> list, const Plane tP object1, const StelObjectP object2);
QString delimiter, acEndl; QString delimiter, acEndl;
QStringList ephemerisHeader, phenomenaHeader, planetaryPositionsHead er; QStringList ephemerisHeader, phenomenaHeader, positionsHeader;
static float brightLimit; static float brightLimit;
static float minY, maxY; static float minY, maxY, transitX, minY1, maxY1, minY2, maxY2;
static QString yAxis1Legend, yAxis2Legend;
//! Make sure that no tabs icons are outside of the viewport. //! Make sure that no tabs icons are outside of the viewport.
//! @todo Limit the width to the width of the screen *available to t he window*. //! @todo Limit the width to the width of the screen *available to t he window*.
void updateTabBarListWidgetWidth(); void updateTabBarListWidgetWidth();
}; };
// Reimplements the QTreeWidgetItem class to fix the sorting bug // Reimplements the QTreeWidgetItem class to fix the sorting bug
class ACTreeWidgetItem : public QTreeWidgetItem class ACCelPosTreeWidgetItem : public QTreeWidgetItem
{ {
public: public:
ACTreeWidgetItem(QTreeWidget* parent) ACCelPosTreeWidgetItem(QTreeWidget* parent)
: QTreeWidgetItem(parent) : QTreeWidgetItem(parent)
{ {
} }
private: private:
bool operator < (const QTreeWidgetItem &other) const bool operator < (const QTreeWidgetItem &other) const
{ {
int column = treeWidget()->sortColumn(); int column = treeWidget()->sortColumn();
if (column == AstroCalcDialog::ColumnMagnitude) if (column == AstroCalcDialog::CColumnName)
{
QRegExp dso("^(\\w+)\\s*(\\d+)\\s*(.*)$");
int a = 0, b = 0;
if (dso.exactMatch(text(column)))
a = dso.capturedTexts().at(2).toInt();
if (dso.exactMatch(other.text(column)))
b = dso.capturedTexts().at(2).toInt();
if (a>0 && b>0)
return a < b;
else
return text(column).toLower() < other.text(c
olumn).toLower();
}
else if (column == AstroCalcDialog::CColumnRA || column == A
stroCalcDialog::CColumnDec)
{
return StelUtils::getDecAngle(text(column)) < StelUt
ils::getDecAngle(other.text(column));
}
else if (column == AstroCalcDialog::CColumnMagnitude || colu
mn == AstroCalcDialog::CColumnExtra)
{ {
return text(column).toFloat() < other.text(column).t oFloat(); return text(column).toFloat() < other.text(column).t oFloat();
} }
else else
{ {
return text(column).toLower() < other.text(column).t oLower(); return text(column).toLower() < other.text(column).t oLower();
} }
} }
}; };
// Reimplements the QTreeWidgetItem class to fix the sorting bug
class ACEphemTreeWidgetItem : public QTreeWidgetItem
{
public:
ACEphemTreeWidgetItem(QTreeWidget* parent)
: QTreeWidgetItem(parent)
{
}
private:
bool operator < (const QTreeWidgetItem &other) const
{
int column = treeWidget()->sortColumn();
if (column == AstroCalcDialog::EphemerisRA || column == Astr
oCalcDialog::EphemerisDec)
{
return StelUtils::getDecAngle(text(column)) < StelUt
ils::getDecAngle(other.text(column));
}
else if (column == AstroCalcDialog::EphemerisMagnitude || co
lumn == AstroCalcDialog::EphemerisJD)
{
return text(column).toFloat() < other.text(column).t
oFloat();
}
else
{
return text(column).toLower() < other.text(column).t
oLower();
}
}
};
// Reimplements the QTreeWidgetItem class to fix the sorting bug
class ACPhenTreeWidgetItem : public QTreeWidgetItem
{
public:
ACPhenTreeWidgetItem(QTreeWidget* parent)
: QTreeWidgetItem(parent)
{
}
private:
bool operator < (const QTreeWidgetItem &other) const
{
int column = treeWidget()->sortColumn();
if (column == AstroCalcDialog::PhenomenaSeparation)
{
return StelUtils::getDecAngle(text(column)) < StelUt
ils::getDecAngle(other.text(column));
}
else
{
return text(column).toLower() < other.text(column).t
oLower();
}
}
};
#endif // _ASTROCALCDIALOG_HPP_ #endif // _ASTROCALCDIALOG_HPP_
 End of changes. 26 change blocks. 
24 lines changed or deleted 169 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/