AstroCalcDialog.cpp   AstroCalcDialog.cpp 
skipping to change at line 35 skipping to change at line 35
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "Nebula.hpp" #include "Nebula.hpp"
#ifdef USE_STATIC_PLUGIN_SATELLITES
#include "../plugins/Satellites/src/Satellites.hpp"
#endif
#include "AstroCalcDialog.hpp" #include "AstroCalcDialog.hpp"
#include "ui_astroCalcDialog.h" #include "ui_astroCalcDialog.h"
#include "external/qcustomplot/qcustomplot.h" #include "external/qcustomplot/qcustomplot.h"
#include <QFileDialog> #include <QFileDialog>
#include <QDir> #include <QDir>
QVector<Vec3d> AstroCalcDialog::EphemerisListCoords; QVector<Vec3d> AstroCalcDialog::EphemerisListCoords;
QVector<QString> AstroCalcDialog::EphemerisListDates; QVector<QString> AstroCalcDialog::EphemerisListDates;
QVector<float> AstroCalcDialog::EphemerisListMagnitudes; QVector<float> AstroCalcDialog::EphemerisListMagnitudes;
skipping to change at line 182 skipping to change at line 186
ui->celestialPositionsTreeWidget, SLOT(repaint())); ui->celestialPositionsTreeWidget, SLOT(repaint()));
ui->celestialMagnitudeDoubleSpinBox->setValue(conf->value("astrocalc /celestial_magnitude_limit", 6.0).toDouble()); ui->celestialMagnitudeDoubleSpinBox->setValue(conf->value("astrocalc /celestial_magnitude_limit", 6.0).toDouble());
connect(ui->celestialMagnitudeDoubleSpinBox, SIGNAL(valueChanged(dou ble)), this, SLOT(saveCelestialPositionsMagnitudeLimit(double))); connect(ui->celestialMagnitudeDoubleSpinBox, SIGNAL(valueChanged(dou ble)), this, SLOT(saveCelestialPositionsMagnitudeLimit(double)));
ui->horizontalCoordinatesCheckBox->setChecked(conf->value("astrocalc /flag_horizontal_coordinates", false).toBool()); ui->horizontalCoordinatesCheckBox->setChecked(conf->value("astrocalc /flag_horizontal_coordinates", false).toBool());
connect(ui->horizontalCoordinatesCheckBox, SIGNAL(toggled(bool)), th is, SLOT(saveCelestialPositionsHorizontalCoordinatesFlag(bool))); connect(ui->horizontalCoordinatesCheckBox, SIGNAL(toggled(bool)), th is, SLOT(saveCelestialPositionsHorizontalCoordinatesFlag(bool)));
connect(ui->celestialPositionsTreeWidget, SIGNAL(doubleClicked(QMode lIndex)), this, SLOT(selectCurrentCelestialPosition(QModelIndex))); connect(ui->celestialPositionsTreeWidget, SIGNAL(doubleClicked(QMode lIndex)), this, SLOT(selectCurrentCelestialPosition(QModelIndex)));
connect(ui->celestialPositionsUpdateButton, SIGNAL(clicked()), this, SLOT(currentCelestialPositions())); connect(ui->celestialPositionsUpdateButton, SIGNAL(clicked()), this, SLOT(currentCelestialPositions()));
connect(ui->celestialPositionsSaveButton, SIGNAL(clicked()), this, S LOT(saveCelestialPositions()));
connect(ui->celestialCategoryComboBox, SIGNAL(currentIndexChanged(in t)), this, SLOT(saveCelestialPositionsCategory(int))); connect(ui->celestialCategoryComboBox, SIGNAL(currentIndexChanged(in t)), this, SLOT(saveCelestialPositionsCategory(int)));
connect(dsoMgr, SIGNAL(catalogFiltersChanged(Nebula::CatalogGroup)), this, SLOT(populateCelestialCategoryList()));
connect(dsoMgr, SIGNAL(catalogFiltersChanged(Nebula::CatalogGroup)), this, SLOT(currentCelestialPositions())); connect(dsoMgr, SIGNAL(catalogFiltersChanged(Nebula::CatalogGroup)), this, SLOT(currentCelestialPositions()));
connectBoolProperty(ui->ephemerisShowMarkersCheckBox, "SolarSystem.e phemerisMarkersDisplayed"); connectBoolProperty(ui->ephemerisShowMarkersCheckBox, "SolarSystem.e phemerisMarkersDisplayed");
connectBoolProperty(ui->ephemerisShowDatesCheckBox, "SolarSystem.eph emerisDatesDisplayed"); connectBoolProperty(ui->ephemerisShowDatesCheckBox, "SolarSystem.eph emerisDatesDisplayed");
connectBoolProperty(ui->ephemerisShowMagnitudesCheckBox, "SolarSyste m.ephemerisMagnitudesDisplayed"); connectBoolProperty(ui->ephemerisShowMagnitudesCheckBox, "SolarSyste m.ephemerisMagnitudesDisplayed");
connectBoolProperty(ui->ephemerisHorizontalCoordinatesCheckBox, "Sol arSystem.ephemerisHorizontalCoordinates"); connectBoolProperty(ui->ephemerisHorizontalCoordinatesCheckBox, "Sol arSystem.ephemerisHorizontalCoordinates");
initListEphemeris(); initListEphemeris();
connect(ui->ephemerisHorizontalCoordinatesCheckBox, SIGNAL(toggled(b ool)), this, SLOT(reGenerateEphemeris())); connect(ui->ephemerisHorizontalCoordinatesCheckBox, SIGNAL(toggled(b ool)), this, SLOT(reGenerateEphemeris()));
connect(ui->ephemerisPushButton, SIGNAL(clicked()), this, SLOT(gener ateEphemeris())); connect(ui->ephemerisPushButton, SIGNAL(clicked()), this, SLOT(gener ateEphemeris()));
connect(ui->ephemerisCleanupButton, SIGNAL(clicked()), this, SLOT(cl eanupEphemeris())); connect(ui->ephemerisCleanupButton, SIGNAL(clicked()), this, SLOT(cl eanupEphemeris()));
skipping to change at line 226 skipping to change at line 232
connect(ui->graphsCelestialBodyComboBox, SIGNAL(currentIndexChanged( int)), this, SLOT(saveGraphsCelestialBody(int))); connect(ui->graphsCelestialBodyComboBox, SIGNAL(currentIndexChanged( int)), this, SLOT(saveGraphsCelestialBody(int)));
connect(ui->graphsFirstComboBox, SIGNAL(currentIndexChanged(int)), t his, SLOT(saveGraphsFirstId(int))); connect(ui->graphsFirstComboBox, SIGNAL(currentIndexChanged(int)), t his, SLOT(saveGraphsFirstId(int)));
connect(ui->graphsSecondComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveGraphsSecondId(int))); connect(ui->graphsSecondComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveGraphsSecondId(int)));
connect(ui->drawGraphsPushButton, SIGNAL(clicked()), this, SLOT(draw XVsTimeGraphs())); connect(ui->drawGraphsPushButton, SIGNAL(clicked()), this, SLOT(draw XVsTimeGraphs()));
ui->wutMagnitudeDoubleSpinBox->setValue(conf->value("astrocalc/wut_m agnitude_limit", 10.0).toDouble()); ui->wutMagnitudeDoubleSpinBox->setValue(conf->value("astrocalc/wut_m agnitude_limit", 10.0).toDouble());
connect(ui->wutMagnitudeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(saveWutMagnitudeLimit(double))); connect(ui->wutMagnitudeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(saveWutMagnitudeLimit(double)));
connect(ui->wutComboBox, SIGNAL(currentIndexChanged(int)), this, SLO T(saveWutTimeInterval(int))); connect(ui->wutComboBox, SIGNAL(currentIndexChanged(int)), this, SLO T(saveWutTimeInterval(int)));
connect(ui->wutCategoryListWidget, SIGNAL(currentRowChanged(int)), t his, SLOT(calculateWutObjects())); connect(ui->wutCategoryListWidget, SIGNAL(currentRowChanged(int)), t his, SLOT(calculateWutObjects()));
connect(ui->wutMatchingObjectsListWidget, SIGNAL(currentRowChanged(i nt)), this, SLOT(selectWutObject())); connect(ui->wutMatchingObjectsListWidget, SIGNAL(currentRowChanged(i nt)), this, SLOT(selectWutObject()));
connect(ui->saveObjectsButton, SIGNAL(clicked()), this, SLOT(saveWut Objects()));
connect(dsoMgr, SIGNAL(catalogFiltersChanged(Nebula::CatalogGroup)), this, SLOT(calculateWutObjects())); connect(dsoMgr, SIGNAL(catalogFiltersChanged(Nebula::CatalogGroup)), this, SLOT(calculateWutObjects()));
connect(dsoMgr, SIGNAL(typeFiltersChanged(Nebula::TypeGroup)), this, SLOT(calculateWutObjects())); connect(dsoMgr, SIGNAL(typeFiltersChanged(Nebula::TypeGroup)), this, SLOT(calculateWutObjects()));
currentCelestialPositions(); currentCelestialPositions();
currentTimeLine = new QTimer(this); currentTimeLine = new QTimer(this);
connect(currentTimeLine, SIGNAL(timeout()), this, SLOT(drawCurrentTi meDiagram())); connect(currentTimeLine, SIGNAL(timeout()), this, SLOT(drawCurrentTi meDiagram()));
currentTimeLine->start(500); // Update 'now' line position every 0.5 seconds currentTimeLine->start(500); // Update 'now' line position every 0.5 seconds
connect(solarSystem, SIGNAL(solarSystemDataReloaded()), this, SLOT(u pdateSolarSystemData())); connect(solarSystem, SIGNAL(solarSystemDataReloaded()), this, SLOT(u pdateSolarSystemData()));
skipping to change at line 294 skipping to change at line 301
if (celType==12 || celType==102 || celType==111) // check for dark n ebulae if (celType==12 || celType==102 || celType==111) // check for dark n ebulae
{ {
//TRANSLATORS: opacity //TRANSLATORS: opacity
positionsHeader << q_("opacity"); positionsHeader << q_("opacity");
} }
else else
{ {
//TRANSLATORS: magnitude //TRANSLATORS: magnitude
positionsHeader << q_("mag"); positionsHeader << q_("mag");
} }
//TRANSLATORS: angular size, arcminutes
positionsHeader << QString("%1, '").arg(q_("A.S."));
if (celType==170) if (celType==170)
{ {
//TRANSLATORS: separation, arcseconds //TRANSLATORS: separation, arcseconds
positionsHeader << QString("%1, \"").arg(q_("sep.")); positionsHeader << QString("%1, \"").arg(q_("sep."));
} }
else if (celType==171) else if (celType==171)
{ {
//TRANSLATORS: period, days //TRANSLATORS: period, days
positionsHeader << QString("%1, %2").arg(q_("per."), qc_("d" , "days")); positionsHeader << QString("%1, %2").arg(q_("per."), qc_("d" , "days"));
} }
else if (celType==200) else if (celType==200)
{ {
//TRANSLATORS: distance, AU //TRANSLATORS: distance, AU
positionsHeader << QString("%1, %2").arg(q_("dist."), qc_("A U", "astronomical unit")); positionsHeader << QString("%1, %2").arg(q_("dist."), qc_("A U", "distance, astronomical unit"));
} }
else if (celType==172) else if (celType==172)
{ {
//TRANSLATORS: proper motion, arcsecond per year //TRANSLATORS: proper motion, arcsecond per year
positionsHeader << QString("%1, %2").arg(q_("P.M."), qc_("\" /yr", "arcsecond per year")); positionsHeader << QString("%1, %2").arg(q_("P.M."), qc_("\" /yr", "arcsecond per year"));
} }
else else
{ {
//TRANSLATORS: surface brightness //TRANSLATORS: surface brightness
skipping to change at line 346 skipping to change at line 355
void AstroCalcDialog::populateCelestialCategoryList() void AstroCalcDialog::populateCelestialCategoryList()
{ {
Q_ASSERT(ui->celestialCategoryComboBox); Q_ASSERT(ui->celestialCategoryComboBox);
QComboBox* category = ui->celestialCategoryComboBox; QComboBox* category = ui->celestialCategoryComboBox;
category->blockSignals(true); category->blockSignals(true);
int index = category->currentIndex(); int index = category->currentIndex();
QVariant selectedCategoryId = category->itemData(index); QVariant selectedCategoryId = category->itemData(index);
const Nebula::CatalogGroup& catalogFilters = dsoMgr->getCatalogFilte
rs();
category->clear(); category->clear();
// TODO: Automatic sync list with QMap<QString, QString> StelObjectM gr::objectModulesMap() data // TODO: Automatic sync list with QMap<QString, QString> StelObjectM gr::objectModulesMap() data
category->addItem(q_("Galaxies"), "0"); category->addItem(q_("Galaxies"), "0");
category->addItem(q_("Active galaxies"), "1"); category->addItem(q_("Active galaxies"), "1");
category->addItem(q_("Radio galaxies"), "2"); category->addItem(q_("Radio galaxies"), "2");
category->addItem(q_("Interacting galaxies"), "3"); category->addItem(q_("Interacting galaxies"), "3");
category->addItem(q_("Bright quasars"), "4"); category->addItem(q_("Bright quasars"), "4");
category->addItem(q_("Star clusters"), "5"); category->addItem(q_("Star clusters"), "5");
category->addItem(q_("Open star clusters"), "6"); category->addItem(q_("Open star clusters"), "6");
category->addItem(q_("Globular star clusters"), "7"); category->addItem(q_("Globular star clusters"), "7");
skipping to change at line 376 skipping to change at line 387
category->addItem(q_("Supernova remnants"), "18"); category->addItem(q_("Supernova remnants"), "18");
category->addItem(q_("Interstellar matter"), "19"); category->addItem(q_("Interstellar matter"), "19");
category->addItem(q_("Emission objects"), "20"); category->addItem(q_("Emission objects"), "20");
category->addItem(q_("BL Lac objects"), "21"); category->addItem(q_("BL Lac objects"), "21");
category->addItem(q_("Blazars"), "22"); category->addItem(q_("Blazars"), "22");
category->addItem(q_("Molecular Clouds"), "23"); category->addItem(q_("Molecular Clouds"), "23");
category->addItem(q_("Young Stellar Objects"), "24"); category->addItem(q_("Young Stellar Objects"), "24");
category->addItem(q_("Possible Quasars"), "25"); category->addItem(q_("Possible Quasars"), "25");
category->addItem(q_("Possible Planetary Nebulae"), "26"); category->addItem(q_("Possible Planetary Nebulae"), "26");
category->addItem(q_("Protoplanetary Nebulae"), "27"); category->addItem(q_("Protoplanetary Nebulae"), "27");
category->addItem(q_("Messier Catalogue"), "100"); category->addItem(q_("Symbiotic stars"), "29");
category->addItem(q_("Caldwell Catalogue"), "101"); category->addItem(q_("Emission-line stars"), "30");
category->addItem(q_("Barnard Catalogue"), "102"); category->addItem(q_("Supernova candidates"), "31");
category->addItem(q_("Sharpless Catalogue"), "103"); category->addItem(q_("Supernova remnant candidates"), "32");
category->addItem(q_("Van den Bergh Catalogue"), "104"); category->addItem(q_("Clusters of galaxies"), "33");
category->addItem(q_("The Catalogue of Rodgers, Campbell, and Whiteo if (catalogFilters&Nebula::CatM)
ak"), "105"); category->addItem(q_("Messier Catalogue"), "100");
category->addItem(q_("Collinder Catalogue"), "106"); if (catalogFilters&Nebula::CatC)
category->addItem(q_("Melotte Catalogue"), "107"); category->addItem(q_("Caldwell Catalogue"), "101");
category->addItem(q_("New General Catalogue"), "108"); if (catalogFilters&Nebula::CatB)
category->addItem(q_("Index Catalogue"), "109"); category->addItem(q_("Barnard Catalogue"), "102");
category->addItem(q_("Lynds' Catalogue of Bright Nebulae"), "110"); if (catalogFilters&Nebula::CatSh2)
category->addItem(q_("Lynds' Catalogue of Dark Nebulae"), "111"); category->addItem(q_("Sharpless Catalogue"), "103");
category->addItem(q_("Principal Galaxy Catalog"), "112"); if (catalogFilters&Nebula::CatVdB)
category->addItem(q_("The Uppsala General Catalogue of Galaxies"), " category->addItem(q_("Van den Bergh Catalogue"), "104");
113"); if (catalogFilters&Nebula::CatRCW)
category->addItem(q_("Cederblad Catalog"), "114"); category->addItem(q_("The Catalogue of Rodgers, Campbell, an
category->addItem(q_("The Catalogue of Peculiar Galaxies"), "115"); d Whiteoak"), "105");
category->addItem(q_("The Catalogue of Interacting Galaxies"), "116" if (catalogFilters&Nebula::CatCr)
); category->addItem(q_("Collinder Catalogue"), "106");
category->addItem(q_("The Catalogue of Galactic Planetary Nebulae"), if (catalogFilters&Nebula::CatMel)
"117"); category->addItem(q_("Melotte Catalogue"), "107");
if (catalogFilters&Nebula::CatNGC)
category->addItem(q_("New General Catalogue"), "108");
if (catalogFilters&Nebula::CatIC)
category->addItem(q_("Index Catalogue"), "109");
if (catalogFilters&Nebula::CatLBN)
category->addItem(q_("Lynds' Catalogue of Bright Nebulae"),
"110");
if (catalogFilters&Nebula::CatLDN)
category->addItem(q_("Lynds' Catalogue of Dark Nebulae"), "1
11");
if (catalogFilters&Nebula::CatPGC)
category->addItem(q_("Principal Galaxy Catalog"), "112");
if (catalogFilters&Nebula::CatUGC)
category->addItem(q_("The Uppsala General Catalogue of Galax
ies"), "113");
if (catalogFilters&Nebula::CatCed)
category->addItem(q_("Cederblad Catalog"), "114");
if (catalogFilters&Nebula::CatArp)
category->addItem(q_("The Catalogue of Peculiar Galaxies"),
"115");
if (catalogFilters&Nebula::CatVV)
category->addItem(q_("The Catalogue of Interacting Galaxies"
), "116");
if (catalogFilters&Nebula::CatPK)
category->addItem(q_("The Catalogue of Galactic Planetary Ne
bulae"), "117");
if (catalogFilters&Nebula::CatPNG)
category->addItem(q_("The Strasbourg-ESO Catalogue of Galact
ic Planetary Nebulae"), "118");
if (catalogFilters&Nebula::CatSNRG)
category->addItem(q_("A catalogue of Galactic supernova remn
ants"), "119");
if (catalogFilters&Nebula::CatACO)
category->addItem(q_("A Catalog of Rich Clusters of Galaxies
"), "120");
category->addItem(q_("Dwarf galaxies"), "150"); category->addItem(q_("Dwarf galaxies"), "150");
category->addItem(q_("Herschel 400 Catalogue"), "151"); category->addItem(q_("Herschel 400 Catalogue"), "151");
category->addItem(q_("Bright double stars"), "170"); category->addItem(q_("Bright double stars"), "170");
category->addItem(q_("Bright variable stars"), "171"); category->addItem(q_("Bright variable stars"), "171");
category->addItem(q_("Bright stars with high proper motion"), "172") ; category->addItem(q_("Bright stars with high proper motion"), "172") ;
category->addItem(q_("Solar system objects"), "200"); category->addItem(q_("Solar system objects"), "200");
index = category->findData(selectedCategoryId, Qt::UserRole, Qt::Mat chCaseSensitive); index = category->findData(selectedCategoryId, Qt::UserRole, Qt::Mat chCaseSensitive);
if (index<0) if (index<0) // read config data
{
// default step: Messier Catalogue
index = category->findData(conf->value("astrocalc/celestial_ category", "200").toString(), Qt::UserRole, Qt::MatchCaseSensitive); index = category->findData(conf->value("astrocalc/celestial_ category", "200").toString(), Qt::UserRole, Qt::MatchCaseSensitive);
}
if (index<0) // Unknown yet? Default step: Solar system objects
index = category->findData("200", Qt::UserRole, Qt::MatchCas
eSensitive);
category->setCurrentIndex(index); category->setCurrentIndex(index);
category->model()->sort(0); category->model()->sort(0);
category->blockSignals(false); category->blockSignals(false);
} }
void AstroCalcDialog::saveCelestialPositionsMagnitudeLimit(double mag) void AstroCalcDialog::saveCelestialPositionsMagnitudeLimit(double mag)
{ {
conf->setValue("astrocalc/celestial_magnitude_limit", QString::numbe r(mag, 'f', 2)); conf->setValue("astrocalc/celestial_magnitude_limit", QString::numbe r(mag, 'f', 2));
// Refresh the celestial bodies positions table // Refresh the celestial bodies positions table
currentCelestialPositions(); currentCelestialPositions();
skipping to change at line 438 skipping to change at line 479
Q_ASSERT(ui->celestialCategoryComboBox); Q_ASSERT(ui->celestialCategoryComboBox);
QComboBox* category = ui->celestialCategoryComboBox; QComboBox* category = ui->celestialCategoryComboBox;
conf->setValue("astrocalc/celestial_category", category->itemData(in dex).toInt()); conf->setValue("astrocalc/celestial_category", category->itemData(in dex).toInt());
// Refresh the celestial bodies positions table // Refresh the celestial bodies positions table
currentCelestialPositions(); currentCelestialPositions();
} }
void AstroCalcDialog::currentCelestialPositions() void AstroCalcDialog::currentCelestialPositions()
{ {
float ra, dec; float ra, dec;
QString raStr, decStr, extra, celObjName = "", celObjId = ""; QString raStr, decStr, extra, angularSize, celObjName = "", celObjId = "";
initListCelestialPositions(); initListCelestialPositions();
double mag = ui->celestialMagnitudeDoubleSpinBox->value(); double mag = ui->celestialMagnitudeDoubleSpinBox->value();
bool horizon = ui->horizontalCoordinatesCheckBox->isChecked(); bool horizon = ui->horizontalCoordinatesCheckBox->isChecked();
bool useSouthAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsa ge(); bool useSouthAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsa ge();
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
double JD = core->getJD(); double JD = core->getJD();
ui->celestialPositionsTimeLabel->setText(q_("Positions on %1").arg(Q String("%1 %2").arg(localeMgr->getPrintableDateLocal(JD), localeMgr->getPri ntableTimeLocal(JD)))); ui->celestialPositionsTimeLabel->setText(q_("Positions on %1").arg(Q String("%1 %2").arg(localeMgr->getPrintableDateLocal(JD), localeMgr->getPri ntableTimeLocal(JD))));
Q_ASSERT(ui->celestialCategoryComboBox); Q_ASSERT(ui->celestialCategoryComboBox);
QComboBox* category = ui->celestialCategoryComboBox; QComboBox* category = ui->celestialCategoryComboBox;
QString celType = category->itemData(category->currentIndex()).toStr ing(); QString celType = category->itemData(category->currentIndex()).toStr ing();
int celTypeId = celType.toInt(); int celTypeId = celType.toInt();
if (celTypeId<170) if (celTypeId<170)
{ {
QString mu = QString("<sup>m</sup>/%1'").arg(QChar(0x2B1C)); QString mu;
if (dsoMgr->getFlagSurfaceBrightnessArcsecUsage()) if (dsoMgr->getFlagSurfaceBrightnessShortNotationUsage())
mu = QString("<sup>m</sup>/%1\"").arg(QChar(0x2B1C)) {
; mu = QString("<sup>m</sup>/%1'").arg(QChar(0x2B1C));
if (dsoMgr->getFlagSurfaceBrightnessArcsecUsage())
mu = QString("<sup>m</sup>/%1\"").arg(QChar(
0x2B1C));
}
else
{
mu = QString("%1/%2<sup>2</sup>").arg(qc_("mag", "ma
gnitude"), q_("arcmin"));
if (dsoMgr->getFlagSurfaceBrightnessArcsecUsage())
mu = QString("%1/%2<sup>2</sup>").arg(qc_("m
ag", "magnitude"), q_("arcsec"));
}
float magOp;
QString dsoName; QString dsoName;
QString asToolTip = QString("%1, %2").arg(q_("Average angula r size"), q_("arcmin"));
// Deep-sky objects // Deep-sky objects
QList<NebulaP> celestialObjects = dsoMgr->getDeepSkyObjectsB yType(celType); QList<NebulaP> celestialObjects = dsoMgr->getDeepSkyObjectsB yType(celType);
foreach (const NebulaP& obj, celestialObjects) foreach (const NebulaP& obj, celestialObjects)
{ {
if (dsoMgr->objectInDisplayedCatalog(obj) && obj->ge if (celTypeId==12 || celTypeId==102 || celTypeId==11
tVMagnitudeWithExtinction(core)<=mag && obj->isAboveRealHorizon(core)) 1) // opacity cannot be extincted
magOp = obj->getVMagnitude(core);
else
magOp = obj->getVMagnitudeWithExtinction(cor
e);
if (obj->objectInDisplayedCatalog() && magOp<=mag &&
obj->isAboveRealHorizon(core))
{ {
if (horizon) if (horizon)
{ {
StelUtils::rectToSphe(&ra, &dec, obj ->getAltAzPosAuto(core)); StelUtils::rectToSphe(&ra, &dec, obj ->getAltAzPosAuto(core));
float direction = 3.; // N is zero, E is 90 degrees float direction = 3.; // N is zero, E is 90 degrees
if (useSouthAzimuth) if (useSouthAzimuth)
direction = 2.; direction = 2.;
ra = direction*M_PI - ra; ra = direction*M_PI - ra;
if (ra > M_PI*2) if (ra > M_PI*2)
ra -= M_PI*2; ra -= M_PI*2;
skipping to change at line 501 skipping to change at line 560
dsoName = celObjName; dsoName = celObjName;
else if (celObjName.isEmpty()) else if (celObjName.isEmpty())
dsoName = celObjId; dsoName = celObjId;
else else
dsoName = QString("%1 (%2)").arg(cel ObjId, celObjName); dsoName = QString("%1 (%2)").arg(cel ObjId, celObjName);
extra = QString::number(obj->getSurfaceBrigh tnessWithExtinction(core), 'f', 2); extra = QString::number(obj->getSurfaceBrigh tnessWithExtinction(core), 'f', 2);
if (extra.toFloat()>90.f) if (extra.toFloat()>90.f)
extra = QChar(0x2014); extra = QChar(0x2014);
// Convert to arcminutes the average angular
size of deep-sky object
angularSize = QString::number(obj->getAngula
rSize(core)*120.f, 'f', 3);
if (angularSize.toFloat()<0.01f)
angularSize = QChar(0x2014);
treeItem->setText(CColumnName, dsoName); treeItem->setText(CColumnName, dsoName);
treeItem->setText(CColumnRA, raStr); treeItem->setText(CColumnRA, raStr);
treeItem->setTextAlignment(CColumnRA, Qt::Al ignRight); treeItem->setTextAlignment(CColumnRA, Qt::Al ignRight);
treeItem->setText(CColumnDec, decStr); treeItem->setText(CColumnDec, decStr);
treeItem->setTextAlignment(CColumnDec, Qt::A lignRight); treeItem->setTextAlignment(CColumnDec, Qt::A lignRight);
treeItem->setText(CColumnMagnitude, QString: :number(obj->getVMagnitudeWithExtinction(core), 'f', 2)); treeItem->setText(CColumnMagnitude, QString: :number(magOp, 'f', 2));
treeItem->setTextAlignment(CColumnMagnitude, Qt::AlignRight); treeItem->setTextAlignment(CColumnMagnitude, Qt::AlignRight);
treeItem->setText(CColumnAngularSize, angula
rSize);
treeItem->setTextAlignment(CColumnAngularSiz
e, Qt::AlignRight);
treeItem->setToolTip(CColumnAngularSize, asT
oolTip);
treeItem->setText(CColumnExtra, extra); treeItem->setText(CColumnExtra, extra);
treeItem->setTextAlignment(CColumnExtra, Qt: :AlignRight); treeItem->setTextAlignment(CColumnExtra, Qt: :AlignRight);
treeItem->setToolTip(CColumnExtra, mu); treeItem->setToolTip(CColumnExtra, mu);
treeItem->setText(CColumnType, q_(obj->getTy peString())); treeItem->setText(CColumnType, q_(obj->getTy peString()));
} }
} }
} }
else if (celTypeId==200) else if (celTypeId==200)
{ {
QList<PlanetP> allPlanets = solarSystem->getAllPlanets(); QList<PlanetP> allPlanets = solarSystem->getAllPlanets();
QString distanceInfo = q_("Planetocentric distance"); QString distanceInfo = q_("Planetocentric distance");
if (core->getUseTopocentricCoordinates()) if (core->getUseTopocentricCoordinates())
distanceInfo = q_("Topocentric distance"); distanceInfo = q_("Topocentric distance");
QString distanceUM = qc_("AU", "astronomical unit"); QString distanceUM = qc_("AU", "distance, astronomical unit" );
QString sToolTip = QString("%1, %2").arg(distanceInfo, dista nceUM); QString sToolTip = QString("%1, %2").arg(distanceInfo, dista nceUM);
QString asToolTip = QString("%1, %2").arg(q_("Angular size ( with rings, if any)"), q_("arcmin"));
Vec3d pos; Vec3d pos;
foreach (const PlanetP& planet, allPlanets) foreach (const PlanetP& planet, allPlanets)
{ {
if ((planet->getPlanetType()!=Planet::isUNDEFINED && planet!=core->getCurrentPlanet()) && planet->getVMagnitudeWithExtinction(c ore)<=mag && planet->isAboveRealHorizon(core)) if ((planet->getPlanetType()!=Planet::isUNDEFINED && planet!=core->getCurrentPlanet()) && planet->getVMagnitudeWithExtinction(c ore)<=mag && planet->isAboveRealHorizon(core))
{ {
pos = planet->getJ2000EquatorialPos(core); pos = planet->getJ2000EquatorialPos(core);
if (horizon) if (horizon)
{ {
StelUtils::rectToSphe(&ra, &dec, pla net->getAltAzPosAuto(core)); StelUtils::rectToSphe(&ra, &dec, pla net->getAltAzPosAuto(core));
float direction = 3.; // N is zero, E is 90 degrees float direction = 3.; // N is zero, E is 90 degrees
skipping to change at line 549 skipping to change at line 617
decStr = StelUtils::radToDmsStr(dec, true); decStr = StelUtils::radToDmsStr(dec, true);
} }
else else
{ {
StelUtils::rectToSphe(&ra, &dec, pos ); StelUtils::rectToSphe(&ra, &dec, pos );
raStr = StelUtils::radToHmsStr(ra); raStr = StelUtils::radToHmsStr(ra);
decStr = StelUtils::radToDmsStr(dec, true); decStr = StelUtils::radToDmsStr(dec, true);
} }
extra = QString::number(pos.length(), 'f', 5 ); // A.U. extra = QString::number(pos.length(), 'f', 5 ); // A.U.
// Convert to arcseconds the angular size of
Solar system object (with rings, if any)
angularSize = QString::number(planet->getAng
ularSize(core)*120.f, 'f', 4);
if (angularSize.toFloat()<1e-4 || planet->ge
tPlanetType()==Planet::isComet)
angularSize = QChar(0x2014);
ACCelPosTreeWidgetItem *treeItem = new ACCel PosTreeWidgetItem(ui->celestialPositionsTreeWidget); ACCelPosTreeWidgetItem *treeItem = new ACCel PosTreeWidgetItem(ui->celestialPositionsTreeWidget);
treeItem->setText(CColumnName, planet->getNa meI18n()); treeItem->setText(CColumnName, planet->getNa meI18n());
treeItem->setText(CColumnRA, raStr); treeItem->setText(CColumnRA, raStr);
treeItem->setTextAlignment(CColumnRA, Qt::Al ignRight); treeItem->setTextAlignment(CColumnRA, Qt::Al ignRight);
treeItem->setText(CColumnDec, decStr); treeItem->setText(CColumnDec, decStr);
treeItem->setTextAlignment(CColumnDec, Qt::A lignRight); treeItem->setTextAlignment(CColumnDec, Qt::A lignRight);
treeItem->setText(CColumnMagnitude, QString: :number(planet->getVMagnitudeWithExtinction(core), 'f', 2)); treeItem->setText(CColumnMagnitude, QString: :number(planet->getVMagnitudeWithExtinction(core), 'f', 2));
treeItem->setTextAlignment(CColumnMagnitude, Qt::AlignRight); treeItem->setTextAlignment(CColumnMagnitude, Qt::AlignRight);
treeItem->setText(CColumnAngularSize, angula
rSize);
treeItem->setTextAlignment(CColumnAngularSiz
e, Qt::AlignRight);
treeItem->setToolTip(CColumnAngularSize, asT
oolTip);
treeItem->setText(CColumnExtra, extra); treeItem->setText(CColumnExtra, extra);
treeItem->setTextAlignment(CColumnExtra, Qt: :AlignRight); treeItem->setTextAlignment(CColumnExtra, Qt: :AlignRight);
treeItem->setToolTip(CColumnExtra, sToolTip) ; treeItem->setToolTip(CColumnExtra, sToolTip) ;
treeItem->setText(CColumnType, q_(planet->ge tPlanetTypeString())); treeItem->setText(CColumnType, q_(planet->ge tPlanetTypeString()));
} }
} }
} }
else else
{ {
// stars // stars
skipping to change at line 639 skipping to change at line 716
extra = QString::number(star.value(o bj), 'f', 5); // "/yr extra = QString::number(star.value(o bj), 'f', 5); // "/yr
ACCelPosTreeWidgetItem *treeItem = new ACCel PosTreeWidgetItem(ui->celestialPositionsTreeWidget); ACCelPosTreeWidgetItem *treeItem = new ACCel PosTreeWidgetItem(ui->celestialPositionsTreeWidget);
treeItem->setText(CColumnName, obj->getNameI 18n()); treeItem->setText(CColumnName, obj->getNameI 18n());
treeItem->setText(CColumnRA, raStr); treeItem->setText(CColumnRA, raStr);
treeItem->setTextAlignment(CColumnRA, Qt::Al ignRight); treeItem->setTextAlignment(CColumnRA, Qt::Al ignRight);
treeItem->setText(CColumnDec, decStr); treeItem->setText(CColumnDec, decStr);
treeItem->setTextAlignment(CColumnDec, Qt::A lignRight); treeItem->setTextAlignment(CColumnDec, Qt::A lignRight);
treeItem->setText(CColumnMagnitude, QString: :number(obj->getVMagnitudeWithExtinction(core), 'f', 2)); treeItem->setText(CColumnMagnitude, QString: :number(obj->getVMagnitudeWithExtinction(core), 'f', 2));
treeItem->setTextAlignment(CColumnMagnitude, Qt::AlignRight); treeItem->setTextAlignment(CColumnMagnitude, Qt::AlignRight);
treeItem->setText(CColumnAngularSize, QChar(
0x2014)); // No angular size of stars!
treeItem->setToolTip(CColumnAngularSize, "")
;
treeItem->setTextAlignment(CColumnAngularSiz
e, Qt::AlignRight);
treeItem->setText(CColumnExtra, extra); treeItem->setText(CColumnExtra, extra);
treeItem->setTextAlignment(CColumnExtra, Qt: :AlignRight); treeItem->setTextAlignment(CColumnExtra, Qt: :AlignRight);
treeItem->setToolTip(CColumnExtra, sToolTip) ; treeItem->setToolTip(CColumnExtra, sToolTip) ;
treeItem->setText(CColumnType, sType); treeItem->setText(CColumnType, sType);
} }
} }
} }
// adjust the column width // adjust the column width
for(int i = 0; i < CColumnCount; ++i) for(int i = 0; i < CColumnCount; ++i)
{ {
ui->celestialPositionsTreeWidget->resizeColumnToContents(i); ui->celestialPositionsTreeWidget->resizeColumnToContents(i);
} }
// sort-by-name // sort-by-name
ui->celestialPositionsTreeWidget->sortItems(CColumnName, Qt::Ascendi ngOrder); ui->celestialPositionsTreeWidget->sortItems(CColumnName, Qt::Ascendi ngOrder);
} }
void AstroCalcDialog::saveCelestialPositions()
{
QString filter = q_("CSV (Comma delimited)");
filter.append(" (*.csv)");
QString filePath = QFileDialog::getSaveFileName(0, q_("Save celestia
l positions of objects as..."), QDir::homePath() + "/positions.csv", filter
);
QFile celPos(filePath);
if (!celPos.open(QFile::WriteOnly | QFile::Truncate))
{
qWarning() << "AstroCalc: Unable to open file"
<< QDir::toNativeSeparators(filePath);
return;
}
QTextStream celPosList(&celPos);
celPosList.setCodec("UTF-8");
int count = ui->celestialPositionsTreeWidget->topLevelItemCount();
celPosList << positionsHeader.join(delimiter) << acEndl;
for (int i = 0; i < count; i++)
{
int columns = positionsHeader.size();
for (int j=0; j<columns; j++)
{
celPosList << ui->celestialPositionsTreeWidget->topL
evelItem(i)->text(j);
if (j<columns-1)
celPosList << delimiter;
else
celPosList << acEndl;
}
}
celPos.close();
}
void AstroCalcDialog::selectCurrentCelestialPosition(const QModelIndex &mod elIndex) void AstroCalcDialog::selectCurrentCelestialPosition(const QModelIndex &mod elIndex)
{ {
// Find the object // Find the object
QString nameI18n = modelIndex.sibling(modelIndex.row(), CColumnName) .data().toString(); QString nameI18n = modelIndex.sibling(modelIndex.row(), CColumnName) .data().toString();
QStringList list = nameI18n.split("("); QStringList list = nameI18n.split("(");
if (list.count()>0) if (list.count()>0 && nameI18n.lastIndexOf("(")!=0)
nameI18n = list.at(0).trimmed(); nameI18n = list.at(0).trimmed();
if (objectMgr->findAndSelectI18n(nameI18n) || objectMgr->findAndSele ct(nameI18n)) if (objectMgr->findAndSelectI18n(nameI18n) || objectMgr->findAndSele ct(nameI18n))
{ {
const QList<StelObjectP> newSelected = objectMgr->getSelecte dObject(); const QList<StelObjectP> newSelected = objectMgr->getSelecte dObject();
if (!newSelected.empty()) if (!newSelected.empty())
{ {
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementM gr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementM gr);
mvmgr->moveToObject(newSelected[0], mvmgr->getAutoMo veDuration()); mvmgr->moveToObject(newSelected[0], mvmgr->getAutoMo veDuration());
mvmgr->setFlagTracking(true); mvmgr->setFlagTracking(true);
skipping to change at line 731 skipping to change at line 846
//TRANSLATORS: right ascension //TRANSLATORS: right ascension
ephemerisHeader << q_("RA (J2000)"); ephemerisHeader << q_("RA (J2000)");
//TRANSLATORS: declination //TRANSLATORS: declination
ephemerisHeader << q_("Dec (J2000)"); ephemerisHeader << q_("Dec (J2000)");
} }
//TRANSLATORS: magnitude //TRANSLATORS: magnitude
ephemerisHeader << q_("mag"); ephemerisHeader << q_("mag");
//TRANSLATORS: phase //TRANSLATORS: phase
ephemerisHeader << q_("phase"); ephemerisHeader << q_("phase");
//TRANSLATORS: distance, AU //TRANSLATORS: distance, AU
ephemerisHeader << QString("%1, %2").arg(q_("dist."), qc_("AU", "ast ronomical unit")); ephemerisHeader << QString("%1, %2").arg(q_("dist."), qc_("AU", "dis tance, astronomical unit"));
//TRANSLATORS: elongation //TRANSLATORS: elongation
ephemerisHeader << q_("elong."); ephemerisHeader << q_("elong.");
ui->ephemerisTreeWidget->setHeaderLabels(ephemerisHeader); ui->ephemerisTreeWidget->setHeaderLabels(ephemerisHeader);
// adjust the column width // adjust the column width
for(int i = 0; i < EphemerisCount; ++i) for(int i = 0; i < EphemerisCount; ++i)
{ {
ui->ephemerisTreeWidget->resizeColumnToContents(i); ui->ephemerisTreeWidget->resizeColumnToContents(i);
} }
} }
skipping to change at line 767 skipping to change at line 882
} }
void AstroCalcDialog::generateEphemeris() void AstroCalcDialog::generateEphemeris()
{ {
float currentStep, ra, dec; float currentStep, ra, dec;
Vec3d observerHelioPos; Vec3d observerHelioPos;
QString currentPlanet = ui->celestialBodyComboBox->currentData().toS tring(); QString currentPlanet = ui->celestialBodyComboBox->currentData().toS tring();
QString distanceInfo = q_("Planetocentric distance"); QString distanceInfo = q_("Planetocentric distance");
if (core->getUseTopocentricCoordinates()) if (core->getUseTopocentricCoordinates())
distanceInfo = q_("Topocentric distance"); distanceInfo = q_("Topocentric distance");
QString distanceUM = qc_("AU", "astronomical unit"); QString distanceUM = qc_("AU", "distance, astronomical unit");
QString elongStr = "", phaseStr = ""; QString elongStr = "", phaseStr = "";
bool horizon = ui->ephemerisHorizontalCoordinatesCheckBox->isChecked (); bool horizon = ui->ephemerisHorizontalCoordinatesCheckBox->isChecked ();
bool useSouthAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsa ge(); bool useSouthAzimuth = StelApp::getInstance().getFlagSouthAzimuthUsa ge();
initListEphemeris(); initListEphemeris();
double solarDay = 1.0;
double siderealDay = 1.0;
const PlanetP& cplanet = core->getCurrentPlanet();
if (!cplanet->getEnglishName().contains("observer", Qt::CaseInsensit
ive))
{
solarDay = cplanet->getMeanSolarDay();
siderealDay = cplanet->getSiderealDay();
}
switch (ui->ephemerisStepComboBox->currentData().toInt()) { switch (ui->ephemerisStepComboBox->currentData().toInt()) {
case 1: case 1:
currentStep = 10 * StelCore::JD_MINUTE; currentStep = 10 * StelCore::JD_MINUTE;
break; break;
case 2: case 2:
currentStep = 30 * StelCore::JD_MINUTE; currentStep = 30 * StelCore::JD_MINUTE;
break; break;
case 3: case 3:
currentStep = StelCore::JD_HOUR; currentStep = StelCore::JD_HOUR;
break; break;
case 4: case 4:
currentStep = 6 * StelCore::JD_HOUR; currentStep = 6 * StelCore::JD_HOUR;
break; break;
case 5: case 5:
currentStep = 12 * StelCore::JD_HOUR; currentStep = 12 * StelCore::JD_HOUR;
break; break;
case 6: case 6:
currentStep = StelCore::JD_DAY; currentStep = solarDay;
break; break;
case 7: case 7:
currentStep = 5 * StelCore::JD_DAY; currentStep = 5 * solarDay;
break; break;
case 8: case 8:
currentStep = 10 * StelCore::JD_DAY; currentStep = 10 * solarDay;
break; break;
case 9: case 9:
currentStep = 15 * StelCore::JD_DAY; currentStep = 15 * solarDay;
break; break;
case 10: case 10:
currentStep = 30 * StelCore::JD_DAY; currentStep = 30 * solarDay;
break; break;
case 11: case 11:
currentStep = 60 * solarDay;
break;
case 12:
currentStep = StelCore::JD_DAY;
break;
case 13:
currentStep = 5 * StelCore::JD_DAY;
break;
case 14:
currentStep = 10 * StelCore::JD_DAY;
break;
case 15:
currentStep = 15 * StelCore::JD_DAY;
break;
case 16:
currentStep = 30 * StelCore::JD_DAY;
break;
case 17:
currentStep = 60 * StelCore::JD_DAY; currentStep = 60 * StelCore::JD_DAY;
break; break;
case 18:
currentStep = siderealDay;
break;
case 19:
currentStep = 5 * siderealDay;
break;
case 20:
currentStep = 10 * siderealDay;
break;
case 21:
currentStep = 15 * siderealDay;
break;
case 22:
currentStep = 30 * siderealDay;
break;
case 23:
currentStep = 60 * siderealDay;
break;
default: default:
currentStep = StelCore::JD_DAY; currentStep = solarDay;
break; break;
} }
PlanetP obj = solarSystem->searchByEnglishName(currentPlanet); PlanetP obj = solarSystem->searchByEnglishName(currentPlanet);
if (obj) if (obj)
{ {
double currentJD = core->getJD(); // save current JD double currentJD = core->getJD(); // save current JD
double firstJD = StelUtils::qDateTimeToJd(ui->dateFromDateTi meEdit->dateTime()); double firstJD = StelUtils::qDateTimeToJd(ui->dateFromDateTi meEdit->dateTime());
firstJD = firstJD - core->getUTCOffset(firstJD)/24; firstJD = firstJD - core->getUTCOffset(firstJD)/24;
int elements = (int)((StelUtils::qDateTimeToJd(ui->dateToDat eTimeEdit->dateTime()) - firstJD)/currentStep); int elements = (int)((StelUtils::qDateTimeToJd(ui->dateToDat eTimeEdit->dateTime()) - firstJD)/currentStep);
skipping to change at line 964 skipping to change at line 1124
} }
void AstroCalcDialog::populateCelestialBodyList() void AstroCalcDialog::populateCelestialBodyList()
{ {
Q_ASSERT(ui->celestialBodyComboBox); Q_ASSERT(ui->celestialBodyComboBox);
Q_ASSERT(ui->graphsCelestialBodyComboBox); Q_ASSERT(ui->graphsCelestialBodyComboBox);
QComboBox* planets = ui->celestialBodyComboBox; QComboBox* planets = ui->celestialBodyComboBox;
QComboBox* graphsp = ui->graphsCelestialBodyComboBox; QComboBox* graphsp = ui->graphsCelestialBodyComboBox;
QStringList planetNames(solarSystem->getAllPlanetEnglishNames()); QList<PlanetP> ss = solarSystem->getAllPlanets();
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr().
getSkyTranslator();
//Save the current selection to be restored later //Save the current selection to be restored later
planets->blockSignals(true); planets->blockSignals(true);
int indexP = planets->currentIndex(); int indexP = planets->currentIndex();
QVariant selectedPlanetId = planets->itemData(indexP); QVariant selectedPlanetId = planets->itemData(indexP);
planets->clear(); planets->clear();
graphsp->blockSignals(true); graphsp->blockSignals(true);
int indexG = graphsp->currentIndex(); int indexG = graphsp->currentIndex();
QVariant selectedGraphsPId = graphsp->itemData(indexG); QVariant selectedGraphsPId = graphsp->itemData(indexG);
graphsp->clear(); graphsp->clear();
//For each planet, display the localized name and store the original as user //For each planet, display the localized name and store the original as user
//data. Unfortunately, there's no other way to do this than with a c ycle. //data. Unfortunately, there's no other way to do this than with a c ycle.
foreach(const QString& name, planetNames) foreach(const PlanetP& p, ss)
{ {
if (!name.contains("Observer", Qt::CaseInsensitive) && name! =core->getCurrentPlanet()->getEnglishName()) if (!p->getEnglishName().contains("Observer", Qt::CaseInsens itive) && p->getEnglishName()!=core->getCurrentPlanet()->getEnglishName())
{ {
planets->addItem(trans.qtranslate(name), name); planets->addItem(p->getNameI18n(), p->getEnglishName
graphsp->addItem(trans.qtranslate(name), name); ());
graphsp->addItem(p->getNameI18n(), p->getEnglishName
());
} }
} }
//Restore the selection //Restore the selection
indexP = planets->findData(selectedPlanetId, Qt::UserRole, Qt::Match CaseSensitive); indexP = planets->findData(selectedPlanetId, Qt::UserRole, Qt::Match CaseSensitive);
if (indexP<0) if (indexP<0)
indexP = planets->findData(conf->value("astrocalc/ephemeris_ celestial_body", "Moon").toString(), Qt::UserRole, Qt::MatchCaseSensitive); indexP = planets->findData(conf->value("astrocalc/ephemeris_ celestial_body", "Moon").toString(), Qt::UserRole, Qt::MatchCaseSensitive);
planets->setCurrentIndex(indexP); planets->setCurrentIndex(indexP);
planets->model()->sort(0); planets->model()->sort(0);
indexG = graphsp->findData(selectedGraphsPId, Qt::UserRole, Qt::Matc hCaseSensitive); indexG = graphsp->findData(selectedGraphsPId, Qt::UserRole, Qt::Matc hCaseSensitive);
skipping to change at line 1046 skipping to change at line 1205
steps->blockSignals(true); steps->blockSignals(true);
int index = steps->currentIndex(); int index = steps->currentIndex();
QVariant selectedStepId = steps->itemData(index); QVariant selectedStepId = steps->itemData(index);
steps->clear(); steps->clear();
steps->addItem(q_("10 minutes"), "1"); steps->addItem(q_("10 minutes"), "1");
steps->addItem(q_("30 minutes"), "2"); steps->addItem(q_("30 minutes"), "2");
steps->addItem(q_("1 hour"), "3"); steps->addItem(q_("1 hour"), "3");
steps->addItem(q_("6 hours"), "4"); steps->addItem(q_("6 hours"), "4");
steps->addItem(q_("12 hours"), "5"); steps->addItem(q_("12 hours"), "5");
steps->addItem(q_("1 day"), "6"); steps->addItem(q_("1 solar day"), "6");
steps->addItem(q_("5 days"), "7"); steps->addItem(q_("5 solar days"), "7");
steps->addItem(q_("10 days"), "8"); steps->addItem(q_("10 solar days"), "8");
steps->addItem(q_("15 days"), "9"); steps->addItem(q_("15 solar days"), "9");
steps->addItem(q_("30 days"), "10"); steps->addItem(q_("30 solar days"), "10");
steps->addItem(q_("60 days"), "11"); steps->addItem(q_("60 solar days"), "11");
steps->addItem(q_("1 sidereal day"), "18");
steps->addItem(q_("5 sidereal days"), "19");
steps->addItem(q_("10 sidereal days"), "20");
steps->addItem(q_("15 sidereal days"), "21");
steps->addItem(q_("30 sidereal days"), "22");
steps->addItem(q_("60 sidereal days"), "23");
steps->addItem(q_("1 Julian day"), "12");
steps->addItem(q_("5 Julian days"), "13");
steps->addItem(q_("10 Julian days"), "14");
steps->addItem(q_("15 Julian days"), "15");
steps->addItem(q_("30 Julian days"), "16");
steps->addItem(q_("60 Julian days"), "17");
index = steps->findData(selectedStepId, Qt::UserRole, Qt::MatchCaseS ensitive); index = steps->findData(selectedStepId, Qt::UserRole, Qt::MatchCaseS ensitive);
if (index<0) if (index<0)
{ {
// default step: one day // default step: one day
index = steps->findData(conf->value("astrocalc/ephemeris_tim e_step", "6").toString(), Qt::UserRole, Qt::MatchCaseSensitive); index = steps->findData(conf->value("astrocalc/ephemeris_tim e_step", "6").toString(), Qt::UserRole, Qt::MatchCaseSensitive);
} }
steps->setCurrentIndex(index); steps->setCurrentIndex(index);
steps->blockSignals(false); steps->blockSignals(false);
} }
skipping to change at line 1141 skipping to change at line 1312
groups->addItem(q_("Oort cloud objects"), "8"); groups->addItem(q_("Oort cloud objects"), "8");
groups->addItem(q_("Sednoids"), "9"); groups->addItem(q_("Sednoids"), "9");
groups->addItem(q_("Bright stars (<%1 mag)").arg(QString::number(bri ghtLimit-5.0f, 'f', 1)), "10"); groups->addItem(q_("Bright stars (<%1 mag)").arg(QString::number(bri ghtLimit-5.0f, 'f', 1)), "10");
groups->addItem(q_("Bright double stars (<%1 mag)").arg(QString::num ber(brightLimit-5.0f, 'f', 1)), "11"); groups->addItem(q_("Bright double stars (<%1 mag)").arg(QString::num ber(brightLimit-5.0f, 'f', 1)), "11");
groups->addItem(q_("Bright variable stars (<%1 mag)").arg(QString::n umber(brightLimit-5.0f, 'f', 1)), "12"); groups->addItem(q_("Bright variable stars (<%1 mag)").arg(QString::n umber(brightLimit-5.0f, 'f', 1)), "12");
groups->addItem(q_("Bright star clusters (<%1 mag)").arg(brLimit), " 13"); groups->addItem(q_("Bright star clusters (<%1 mag)").arg(brLimit), " 13");
groups->addItem(q_("Planetary nebulae"), "14"); groups->addItem(q_("Planetary nebulae"), "14");
groups->addItem(q_("Bright nebulae (<%1 mag)").arg(brLimit), "15"); groups->addItem(q_("Bright nebulae (<%1 mag)").arg(brLimit), "15");
groups->addItem(q_("Dark nebulae"), "16"); groups->addItem(q_("Dark nebulae"), "16");
groups->addItem(q_("Bright galaxies (<%1 mag)").arg(brLimit), "17"); groups->addItem(q_("Bright galaxies (<%1 mag)").arg(brLimit), "17");
groups->addItem(q_("Symbiotic stars"), "18");
groups->addItem(q_("Emission-line stars"), "19");
index = groups->findData(selectedGroupId, Qt::UserRole, Qt::MatchCas eSensitive); index = groups->findData(selectedGroupId, Qt::UserRole, Qt::MatchCas eSensitive);
if (index<0) if (index<0)
index = groups->findData(conf->value("astrocalc/phenomena_ce lestial_group", "1").toString(), Qt::UserRole, Qt::MatchCaseSensitive); index = groups->findData(conf->value("astrocalc/phenomena_ce lestial_group", "1").toString(), Qt::UserRole, Qt::MatchCaseSensitive);
groups->setCurrentIndex(index); groups->setCurrentIndex(index);
groups->model()->sort(0); groups->model()->sort(0);
groups->blockSignals(false); groups->blockSignals(false);
} }
void AstroCalcDialog::savePhenomenaCelestialGroup(int index) void AstroCalcDialog::savePhenomenaCelestialGroup(int index)
skipping to change at line 1179 skipping to change at line 1352
conf->setValue("astrocalc/phenomena_angular_separation", QString::nu mber(v, 'f', 5)); conf->setValue("astrocalc/phenomena_angular_separation", QString::nu mber(v, 'f', 5));
} }
void AstroCalcDialog::drawAltVsTimeDiagram() void AstroCalcDialog::drawAltVsTimeDiagram()
{ {
// Avoid crash! // Avoid crash!
if(core->getCurrentPlanet()->getEnglishName().contains("->")) // We are on the spaceship! if(core->getCurrentPlanet()->getEnglishName().contains("->")) // We are on the spaceship!
return; return;
QList<StelObjectP> selectedObjects = objectMgr->getSelectedObject(); QList<StelObjectP> selectedObjects = objectMgr->getSelectedObject();
if (!selectedObjects.isEmpty()) if (!selectedObjects.isEmpty())
{ {
// X axis - time; Y axis - altitude // X axis - time; Y axis - altitude
QList<double> aX, aY; QList<double> aX, aY;
StelObjectP selectedObject = selectedObjects[0]; StelObjectP selectedObject = selectedObjects[0];
double currentJD = core->getJD(); double currentJD = core->getJD();
double noon = (int)currentJD; double noon = (int)currentJD;
double az, alt, deg; double az, alt, deg;
bool sign; bool sign;
double shift = core->getUTCOffset(currentJD)/24.0; double shift = core->getUTCOffset(currentJD)/24.0;
double xMaxY = -100.f; double xMaxY = -100.f;
for(int i=-5;i<=485;i++) // 24 hours + 15 minutes in both di int step = 180;
rections int limit = 485;
bool isSatellite = false;
if (selectedObject->getType()=="Satellite") // Reduce accura
cy for satellites
{
limit = 121;
step = 720;
isSatellite = true;
}
for(int i=-5;i<=limit;i++) // 24 hours + 15 minutes in both
directions
{ {
// A new point on the graph every 3 minutes with shi ft to right 12 hours // A new point on the graph every 3 minutes with shi ft to right 12 hours
// to get midnight at the center of diagram (i.e. ac curacy is 3 minutes) // to get midnight at the center of diagram (i.e. ac curacy is 3 minutes)
double ltime = i*180 + 43200; double ltime = i*step + 43200;
aX.append(ltime); aX.append(ltime);
double JD = noon + ltime/86400 - shift - 0.5; double JD = noon + ltime/86400 - shift - 0.5;
core->setJD(JD); core->setJD(JD);
StelUtils::rectToSphe(&az, &alt, selectedObject->get AltAzPosAuto(core)); StelUtils::rectToSphe(&az, &alt, selectedObject->get AltAzPosAuto(core));
StelUtils::radToDecDeg(alt, sign, deg); StelUtils::radToDecDeg(alt, sign, deg);
if (!sign) if (!sign)
deg *= -1; deg *= -1;
aY.append(deg); aY.append(deg);
if (deg > xMaxY) if (deg > xMaxY)
{ {
xMaxY = deg; xMaxY = deg;
transitX = ltime; transitX = ltime;
} }
core->update(0.0); if (isSatellite)
{
#ifdef USE_STATIC_PLUGIN_SATELLITES
GETSTELMODULE(Satellites)->update(0.0); // f
orce update to avoid caching! WTF???
#endif
}
else
core->update(0.0);
} }
core->setJD(currentJD); core->setJD(currentJD);
QVector<double> x = aX.toVector(), y = aY.toVector(); QVector<double> x = aX.toVector(), y = aY.toVector();
double minYa = aY.first(); double minYa = aY.first();
double maxYa = aY.first(); double maxYa = aY.first();
foreach (double temp, aY) foreach (double temp, aY)
{ {
if(maxYa < temp) maxYa = temp; if(maxYa < temp) maxYa = temp;
skipping to change at line 1236 skipping to change at line 1426
minY = minYa - 2.0; minY = minYa - 2.0;
maxY = maxYa + 2.0; maxY = maxYa + 2.0;
prepareAxesAndGraph(); prepareAxesAndGraph();
drawCurrentTimeDiagram(); drawCurrentTimeDiagram();
QString name = selectedObject->getNameI18n(); QString name = selectedObject->getNameI18n();
if (name.isEmpty() && selectedObject->getType()=="Nebula") if (name.isEmpty() && selectedObject->getType()=="Nebula")
name = GETSTELMODULE(NebulaMgr)->getLatestSelectedDS ODesignation(); name = GETSTELMODULE(NebulaMgr)->getLatestSelectedDS ODesignation();
// FIXME: Satellites have different values for equatorial co drawTransitTimeDiagram();
ordinates and same values for horizontal coordinates - a caching?
// NOTE: Drawing a line of transit time was added to else bl
ock to avoid troubles with satellites.
if (selectedObject->getType()=="Satellite")
{
x.clear();
y.clear();
}
else
drawTransitTimeDiagram();
ui->altVsTimePlot->graph(0)->setData(x, y); ui->altVsTimePlot->graph(0)->setData(x, y);
ui->altVsTimePlot->graph(0)->setName(name); ui->altVsTimePlot->graph(0)->setName(name);
ui->altVsTimePlot->replot(); ui->altVsTimePlot->replot();
} }
} }
// Added vertical line indicating "now" // Added vertical line indicating "now"
void AstroCalcDialog::drawCurrentTimeDiagram() void AstroCalcDialog::drawCurrentTimeDiagram()
{ {
skipping to change at line 1510 skipping to change at line 1692
QComboBox* first = ui->graphsFirstComboBox; QComboBox* first = ui->graphsFirstComboBox;
QComboBox* second = ui->graphsSecondComboBox; QComboBox* second = ui->graphsSecondComboBox;
first->blockSignals(true); first->blockSignals(true);
second->blockSignals(true); second->blockSignals(true);
int indexF = first->currentIndex(); int indexF = first->currentIndex();
QVariant selectedFirstId = first->itemData(indexF); QVariant selectedFirstId = first->itemData(indexF);
int indexS = second->currentIndex(); int indexS = second->currentIndex();
QVariant selectedSecondId = second->itemData(indexS); QVariant selectedSecondId = second->itemData(indexS);
first->clear();
second->clear();
foreach(const graph& f, functions) foreach(const graph& f, functions)
{ {
first->addItem(f.first, f.second); first->addItem(f.first, f.second);
second->addItem(f.first, f.second); second->addItem(f.first, f.second);
} }
indexF = first->findData(selectedFirstId, Qt::UserRole, Qt::MatchCas eSensitive); indexF = first->findData(selectedFirstId, Qt::UserRole, Qt::MatchCas eSensitive);
if (indexF<0) if (indexF<0)
indexF = first->findData(conf->value("astrocalc/graphs_first _id", GraphMagnitudeVsTime).toInt(), Qt::UserRole, Qt::MatchCaseSensitive); indexF = first->findData(conf->value("astrocalc/graphs_first _id", GraphMagnitudeVsTime).toInt(), Qt::UserRole, Qt::MatchCaseSensitive);
first->setCurrentIndex(indexF); first->setCurrentIndex(indexF);
skipping to change at line 1535 skipping to change at line 1720
second->setCurrentIndex(indexS); second->setCurrentIndex(indexS);
second->model()->sort(0); second->model()->sort(0);
first->blockSignals(false); first->blockSignals(false);
second->blockSignals(false); second->blockSignals(false);
} }
void AstroCalcDialog::prepareXVsTimeAxesAndGraph() void AstroCalcDialog::prepareXVsTimeAxesAndGraph()
{ {
QString xAxisStr = q_("Date"); QString xAxisStr = q_("Date");
QString distMU = qc_("AU", "astronomical unit"); QString distMU = qc_("AU", "distance, astronomical unit");
QString asMU = QString("'"); QString asMU = QString("'");
PlanetP ssObj = solarSystem->searchByEnglishName(ui->graphsCelestial BodyComboBox->currentData().toString()); PlanetP ssObj = solarSystem->searchByEnglishName(ui->graphsCelestial BodyComboBox->currentData().toString());
if (!ssObj.isNull()) if (!ssObj.isNull())
{ {
if (ssObj->getJ2000EquatorialPos(core).length() < 0.1) if (ssObj->getJ2000EquatorialPos(core).length() < 0.1)
{ {
// TRANSLATORS: Megameter (SI symbol: Mm; Megameter is a unit of length in the metric system, equal to one million metres) // TRANSLATORS: Megameter (SI symbol: Mm; Megameter is a unit of length in the metric system, equal to one million metres)
distMU = q_("Mm"); distMU = q_("Mm");
} }
skipping to change at line 1745 skipping to change at line 1930
ui->phenomenaTreeWidget->clear(); ui->phenomenaTreeWidget->clear();
ui->phenomenaTreeWidget->setColumnCount(PhenomenaCount); ui->phenomenaTreeWidget->setColumnCount(PhenomenaCount);
setPhenomenaHeaderNames(); setPhenomenaHeaderNames();
ui->phenomenaTreeWidget->header()->setSectionsMovable(false); ui->phenomenaTreeWidget->header()->setSectionsMovable(false);
} }
void AstroCalcDialog::selectCurrentPhenomen(const QModelIndex &modelIndex) void AstroCalcDialog::selectCurrentPhenomen(const QModelIndex &modelIndex)
{ {
// Find the object // Find the object
QString name = ui->object1ComboBox->currentData().toString(); QString name = ui->object1ComboBox->currentData().toString();
QString date = modelIndex.sibling(modelIndex.row(), PhenomenaDate).d double JD = modelIndex.sibling(modelIndex.row(), PhenomenaDate).dat
ata().toString(); a(Qt::UserRole).toDouble();
bool ok;
double JD = StelUtils::getJulianDayFromISO8601String(date.left(10)
+ "T" + date.right(8), &ok);
JD -= core->getUTCOffset(JD)/24.;
if (objectMgr->findAndSelectI18n(name) || objectMgr->findAndSelect(n ame)) if (objectMgr->findAndSelectI18n(name) || objectMgr->findAndSelect(n ame))
{ {
core->setJD(JD); core->setJD(JD);
const QList<StelObjectP> newSelected = objectMgr->getSelecte dObject(); const QList<StelObjectP> newSelected = objectMgr->getSelecte dObject();
if (!newSelected.empty()) if (!newSelected.empty())
{ {
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementM gr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementM gr);
mvmgr->moveToObject(newSelected[0], mvmgr->getAutoMo veDuration()); mvmgr->moveToObject(newSelected[0], mvmgr->getAutoMo veDuration());
mvmgr->setFlagTracking(true); mvmgr->setFlagTracking(true);
skipping to change at line 1916 skipping to change at line 2098
dso.append(object); dso.append(object);
} }
break; break;
case 17: // Galaxies case 17: // Galaxies
foreach(const NebulaP& object, allDSO) foreach(const NebulaP& object, allDSO)
{ {
if (object->getVMagnitude(core)<brightLimit && (object->getDSOType()==Nebula::NebGx || object->getDSOType()==Nebula::Ne bAGx || object->getDSOType()==Nebula::NebRGx || object->getDSOType()==Nebul a::NebQSO || object->getDSOType()==Nebula::NebPossQSO || object->getDSOType ()==Nebula::NebBLL || object->getDSOType()==Nebula::NebBLA || object->getDS OType()==Nebula::NebIGx)) if (object->getVMagnitude(core)<brightLimit && (object->getDSOType()==Nebula::NebGx || object->getDSOType()==Nebula::Ne bAGx || object->getDSOType()==Nebula::NebRGx || object->getDSOType()==Nebul a::NebQSO || object->getDSOType()==Nebula::NebPossQSO || object->getDSOType ()==Nebula::NebBLL || object->getDSOType()==Nebula::NebBLA || object->getDS OType()==Nebula::NebIGx))
dso.append(object); dso.append(object);
} }
break; break;
case 18: // Symbiotic stars
foreach(const NebulaP& object, allDSO)
{
if (object->getDSOType()==Nebula::NebSymbiot
icStar)
dso.append(object);
}
break;
case 19: // Emission-line stars
foreach(const NebulaP& object, allDSO)
{
if (object->getDSOType()==Nebula::NebEmissio
nLineStar)
dso.append(object);
}
break;
} }
PlanetP planet = solarSystem->searchByEnglishName(currentPlanet); PlanetP planet = solarSystem->searchByEnglishName(currentPlanet);
if (planet) if (planet)
{ {
double currentJD = core->getJD(); // save current JD double currentJD = core->getJD(); // save current JD
double currentJDE = core->getJDE(); // save current JDE double currentJDE = core->getJDE(); // save current JDE
double startJD = StelUtils::qDateTimeToJd(QDateTime(ui->phen omenFromDateEdit->date())); double startJD = StelUtils::qDateTimeToJd(QDateTime(ui->phen omenFromDateEdit->date()));
double stopJD = StelUtils::qDateTimeToJd(QDateTime(ui->pheno menToDateEdit->date().addDays(1))); double stopJD = StelUtils::qDateTimeToJd(QDateTime(ui->pheno menToDateEdit->date().addDays(1)));
startJD = startJD - core->getUTCOffset(startJD)/24; startJD = startJD - core->getUTCOffset(startJD)/24;
skipping to change at line 2061 skipping to change at line 2257
if (qAbs(s1-s2)<=0.05 && (object1->getEnglishName()= ="Sun" || object2->getEnglishName()=="Sun")) // 5% error of difference of s izes if (qAbs(s1-s2)<=0.05 && (object1->getEnglishName()= ="Sun" || object2->getEnglishName()=="Sun")) // 5% error of difference of s izes
phenomenType = q_("Eclipse"); phenomenType = q_("Eclipse");
occultation = true; occultation = true;
} }
ACPhenTreeWidgetItem *treeItem = new ACPhenTreeWidgetItem(ui ->phenomenaTreeWidget); ACPhenTreeWidgetItem *treeItem = new ACPhenTreeWidgetItem(ui ->phenomenaTreeWidget);
treeItem->setText(PhenomenaType, phenomenType); treeItem->setText(PhenomenaType, phenomenType);
// local date and time // local date and time
treeItem->setText(PhenomenaDate, QString("%1 %2").arg(locale Mgr->getPrintableDateLocal(it.key()), localeMgr->getPrintableTimeLocal(it.k ey()))); treeItem->setText(PhenomenaDate, QString("%1 %2").arg(locale Mgr->getPrintableDateLocal(it.key()), localeMgr->getPrintableTimeLocal(it.k ey())));
treeItem->setData(PhenomenaDate, Qt::UserRole, it.key());
treeItem->setText(PhenomenaObject1, object1->getNameI18n()); treeItem->setText(PhenomenaObject1, object1->getNameI18n());
treeItem->setText(PhenomenaObject2, object2->getNameI18n()); treeItem->setText(PhenomenaObject2, object2->getNameI18n());
if (occultation) if (occultation)
treeItem->setText(PhenomenaSeparation, QChar(0x2014) ); treeItem->setText(PhenomenaSeparation, QChar(0x2014) );
else else
treeItem->setText(PhenomenaSeparation, StelUtils::ra dToDmsStr(separation)); treeItem->setText(PhenomenaSeparation, StelUtils::ra dToDmsStr(separation));
} }
} }
QMap<double, double> AstroCalcDialog::findClosestApproach(PlanetP &object1, PlanetP &object2, double startJD, double stopJD, double maxSeparation, boo l opposition) QMap<double, double> AstroCalcDialog::findClosestApproach(PlanetP &object1, PlanetP &object2, double startJD, double stopJD, double maxSeparation, boo l opposition)
skipping to change at line 2218 skipping to change at line 2415
bool occultation = false; bool occultation = false;
if (separation<(object2->getAngularSize(core)*M_PI/180.) || separation<(object1->getSpheroidAngularSize(core)*M_PI/180.)) if (separation<(object2->getAngularSize(core)*M_PI/180.) || separation<(object1->getSpheroidAngularSize(core)*M_PI/180.))
{ {
phenomenType = q_("Occultation"); phenomenType = q_("Occultation");
occultation = true; occultation = true;
} }
ACPhenTreeWidgetItem *treeItem = new ACPhenTreeWidgetItem(ui ->phenomenaTreeWidget); ACPhenTreeWidgetItem *treeItem = new ACPhenTreeWidgetItem(ui ->phenomenaTreeWidget);
treeItem->setText(PhenomenaType, phenomenType); treeItem->setText(PhenomenaType, phenomenType);
// local date and time // local date and time
treeItem->setText(PhenomenaDate, StelUtils::jdToQDateTime(it treeItem->setText(PhenomenaDate, QString("%1 %2").arg(locale
.key() + core->getUTCOffset(it.key())/24).toString("yyyy-MM-dd hh:mm:ss")); Mgr->getPrintableDateLocal(it.key()), localeMgr->getPrintableTimeLocal(it.k
ey())));
treeItem->setData(PhenomenaDate, Qt::UserRole, it.key());
treeItem->setText(PhenomenaObject1, object1->getNameI18n()); treeItem->setText(PhenomenaObject1, object1->getNameI18n());
if (!object2->getNameI18n().isEmpty()) if (!object2->getNameI18n().isEmpty())
treeItem->setText(PhenomenaObject2, object2->getName I18n()); treeItem->setText(PhenomenaObject2, object2->getName I18n());
else else
treeItem->setText(PhenomenaObject2, object2->getDSOD esignation()); treeItem->setText(PhenomenaObject2, object2->getDSOD esignation());
if (occultation) if (occultation)
treeItem->setText(PhenomenaSeparation, QChar(0x2014) ); treeItem->setText(PhenomenaSeparation, QChar(0x2014) );
else else
treeItem->setText(PhenomenaSeparation, StelUtils::ra dToDmsStr(separation)); treeItem->setText(PhenomenaSeparation, StelUtils::ra dToDmsStr(separation));
} }
skipping to change at line 2377 skipping to change at line 2575
if (separation<(object2->getAngularSize(core)*M_PI/180.) || separation<(object1->getSpheroidAngularSize(core)*M_PI/180.)) if (separation<(object2->getAngularSize(core)*M_PI/180.) || separation<(object1->getSpheroidAngularSize(core)*M_PI/180.))
{ {
phenomenType = q_("Occultation"); phenomenType = q_("Occultation");
occultation = true; occultation = true;
} }
ACPhenTreeWidgetItem *treeItem = new ACPhenTreeWidgetItem(ui ->phenomenaTreeWidget); ACPhenTreeWidgetItem *treeItem = new ACPhenTreeWidgetItem(ui ->phenomenaTreeWidget);
treeItem->setText(PhenomenaType, phenomenType); treeItem->setText(PhenomenaType, phenomenType);
// local date and time // local date and time
treeItem->setText(PhenomenaDate, QString("%1 %2").arg(locale Mgr->getPrintableDateLocal(it.key()), localeMgr->getPrintableTimeLocal(it.k ey()))); treeItem->setText(PhenomenaDate, QString("%1 %2").arg(locale Mgr->getPrintableDateLocal(it.key()), localeMgr->getPrintableTimeLocal(it.k ey())));
treeItem->setData(PhenomenaDate, Qt::UserRole, it.key());
treeItem->setText(PhenomenaObject1, object1->getNameI18n()); treeItem->setText(PhenomenaObject1, object1->getNameI18n());
treeItem->setText(PhenomenaObject2, object2->getNameI18n()); treeItem->setText(PhenomenaObject2, object2->getNameI18n());
if (occultation) if (occultation)
treeItem->setText(PhenomenaSeparation, QChar(0x2014) ); treeItem->setText(PhenomenaSeparation, QChar(0x2014) );
else else
treeItem->setText(PhenomenaSeparation, StelUtils::ra dToDmsStr(separation)); treeItem->setText(PhenomenaSeparation, StelUtils::ra dToDmsStr(separation));
} }
} }
QMap<double, double> AstroCalcDialog::findClosestApproach(PlanetP &object1, StelObjectP &object2, double startJD, double stopJD, double maxSeparation) QMap<double, double> AstroCalcDialog::findClosestApproach(PlanetP &object1, StelObjectP &object2, double startJD, double stopJD, double maxSeparation)
skipping to change at line 2616 skipping to change at line 2815
wutCategories.insert(q_("Plutinos"), 8); wutCategories.insert(q_("Plutinos"), 8);
wutCategories.insert(q_("Dwarf planets"), 9); wutCategories.insert(q_("Dwarf planets"), 9);
wutCategories.insert(q_("Cubewanos"), 10); wutCategories.insert(q_("Cubewanos"), 10);
wutCategories.insert(q_("Scattered disc objects"), 11); wutCategories.insert(q_("Scattered disc objects"), 11);
wutCategories.insert(q_("Oort cloud objects"), 12); wutCategories.insert(q_("Oort cloud objects"), 12);
wutCategories.insert(q_("Sednoids"), 13); wutCategories.insert(q_("Sednoids"), 13);
wutCategories.insert(q_("Planetary nebulae"), 14); wutCategories.insert(q_("Planetary nebulae"), 14);
wutCategories.insert(q_("Bright double stars"), 15); wutCategories.insert(q_("Bright double stars"), 15);
wutCategories.insert(q_("Bright variable stars"), 16); wutCategories.insert(q_("Bright variable stars"), 16);
wutCategories.insert(q_("Bright stars with high proper motion"), 17) ; wutCategories.insert(q_("Bright stars with high proper motion"), 17) ;
wutCategories.insert(q_("Symbiotic stars"), 18);
wutCategories.insert(q_("Emission-line stars"), 19);
wutCategories.insert(q_("Supernova candidates"), 20);
wutCategories.insert(q_("Supernova remnant candidates"), 21);
wutCategories.insert(q_("Supernova remnants"), 22);
wutCategories.insert(q_("Clusters of galaxies"), 23);
category->clear(); category->clear();
category->addItems(wutCategories.keys()); category->addItems(wutCategories.keys());
category->sortItems(Qt::AscendingOrder); category->sortItems(Qt::AscendingOrder);
category->blockSignals(false); category->blockSignals(false);
} }
void AstroCalcDialog::saveWutMagnitudeLimit(double mag) void AstroCalcDialog::saveWutMagnitudeLimit(double mag)
{ {
skipping to change at line 2911 skipping to change at line 3116
} }
break; break;
case 17: // Bright stars with high proper mo tion case 17: // Bright stars with high proper mo tion
foreach(const StelACStarData& hpmSta r, hpmHipStars) foreach(const StelACStarData& hpmSta r, hpmHipStars)
{ {
StelObjectP object = hpmStar .firstKey(); StelObjectP object = hpmStar .firstKey();
if (object->getVMagnitudeWit hExtinction(core)<=magLimit && object->isAboveRealHorizon(core)) if (object->getVMagnitudeWit hExtinction(core)<=magLimit && object->isAboveRealHorizon(core))
wutObjects.insert(ob ject->getNameI18n(), object->getEnglishName()); wutObjects.insert(ob ject->getNameI18n(), object->getEnglishName());
} }
break; break;
case 18: // Symbiotic stars
foreach(const NebulaP& object, allDS
O)
{
Nebula::NebulaType ntype = o
bject->getDSOType();
if ((bool)(tflags & Nebula::
TypeOther) && (ntype==Nebula::NebSymbioticStar) && object->getVMagnitudeWit
hExtinction(core)<=magLimit && object->isAboveRealHorizon(core))
{
QString d = object->
getDSODesignation();
QString n = object->
getNameI18n();
if (d.isEmpty() && n
.isEmpty())
continue;
if (d.isEmpty())
wutObjects.i
nsert(n, n);
else if (n.isEmpty()
)
wutObjects.i
nsert(d, d);
else
wutObjects.i
nsert(QString("%1 (%2)").arg(d, n), d);
}
}
break;
case 19: // Emission-line stars
foreach(const NebulaP& object, allDS
O)
{
Nebula::NebulaType ntype = o
bject->getDSOType();
if ((bool)(tflags & Nebula::
TypeOther) && (ntype==Nebula::NebEmissionLineStar) && (object->getVMagnitud
eWithExtinction(core)<=magLimit) && object->isAboveRealHorizon(core))
{
QString d = object->
getDSODesignation();
QString n = object->
getNameI18n();
if (d.isEmpty() && n
.isEmpty())
continue;
if (d.isEmpty())
wutObjects.i
nsert(n, n);
else if (n.isEmpty()
)
wutObjects.i
nsert(d, d);
else
wutObjects.i
nsert(QString("%1 (%2)").arg(d, n), d);
}
}
break;
case 20: // Supernova candidates
foreach(const NebulaP& object, allDS
O)
{
Nebula::NebulaType ntype = o
bject->getDSOType();
bool visible = ((object->get
VMagnitudeWithExtinction(core)<=magLimit) || (object->getVMagnitude(core)>9
0.f && magLimit>=19.f));
if ((bool)(tflags & Nebula::
TypeSupernovaRemnants) && (ntype==Nebula::NebSNC) && visible && object->isA
boveRealHorizon(core))
{
QString d = object->
getDSODesignation();
QString n = object->
getNameI18n();
if (d.isEmpty() && n
.isEmpty())
continue;
if (d.isEmpty())
wutObjects.i
nsert(n, n);
else if (n.isEmpty()
)
wutObjects.i
nsert(d, d);
else
wutObjects.i
nsert(QString("%1 (%2)").arg(d, n), d);
}
}
break;
case 21: // Supernova remnant candidates
foreach(const NebulaP& object, allDS
O)
{
Nebula::NebulaType ntype = o
bject->getDSOType();
bool visible = ((object->get
VMagnitudeWithExtinction(core)<=magLimit) || (object->getVMagnitude(core)>9
0.f && magLimit>=19.f));
if ((bool)(tflags & Nebula::
TypeSupernovaRemnants) && (ntype==Nebula::NebSNRC) && visible && object->is
AboveRealHorizon(core))
{
QString d = object->
getDSODesignation();
QString n = object->
getNameI18n();
if (d.isEmpty() && n
.isEmpty())
continue;
if (d.isEmpty())
wutObjects.i
nsert(n, n);
else if (n.isEmpty()
)
wutObjects.i
nsert(d, d);
else
wutObjects.i
nsert(QString("%1 (%2)").arg(d, n), d);
}
}
break;
case 22: // Supernova remnants
foreach(const NebulaP& object, allDS
O)
{
Nebula::NebulaType ntype = o
bject->getDSOType();
bool visible = ((object->get
VMagnitudeWithExtinction(core)<=magLimit) || (object->getVMagnitude(core)>9
0.f && magLimit>=19.f));
if ((bool)(tflags & Nebula::
TypeSupernovaRemnants) && (ntype==Nebula::NebSNR) && visible && object->isA
boveRealHorizon(core))
{
QString d = object->
getDSODesignation();
QString n = object->
getNameI18n();
if (d.isEmpty() && n
.isEmpty())
continue;
if (d.isEmpty())
wutObjects.i
nsert(n, n);
else if (n.isEmpty()
)
wutObjects.i
nsert(d, d);
else
wutObjects.i
nsert(QString("%1 (%2)").arg(d, n), d);
}
}
break;
case 23: // Clusters of galaxies
foreach(const NebulaP& object, allDS
O)
{
Nebula::NebulaType ntype = o
bject->getDSOType();
if ((bool)(tflags & Nebula::
TypeGalaxyClusters) && (ntype==Nebula::NebGxCl) && object->getVMagnitudeWit
hExtinction(core)<=magLimit && object->isAboveRealHorizon(core))
{
QString d = object->
getDSODesignation();
QString n = object->
getNameI18n();
if (d.isEmpty() && n
.isEmpty())
continue;
if (d.isEmpty())
wutObjects.i
nsert(n, n);
else if (n.isEmpty()
)
wutObjects.i
nsert(d, d);
else
wutObjects.i
nsert(QString("%1 (%2)").arg(d, n), d);
}
}
break;
default: // Planets default: // Planets
foreach(const PlanetP& object, allOb jects) foreach(const PlanetP& object, allOb jects)
{ {
if (object->getPlanetType()= =Planet::isPlanet && object->getVMagnitudeWithExtinction(core)<=magLimit && object->isAboveRealHorizon(core)) if (object->getPlanetType()= =Planet::isPlanet && object->getVMagnitudeWithExtinction(core)<=magLimit && object->isAboveRealHorizon(core))
wutObjects.insert(ob ject->getNameI18n(), object->getEnglishName()); wutObjects.insert(ob ject->getNameI18n(), object->getEnglishName());
} }
break; break;
} }
} }
skipping to change at line 2955 skipping to change at line 3289
mvmgr->setFlagTracking(true); mvmgr->setFlagTracking(true);
} }
else else
{ {
GETSTELMODULE(StelObjectMgr)->unSele ct(); GETSTELMODULE(StelObjectMgr)->unSele ct();
} }
} }
} }
} }
} }
void AstroCalcDialog::saveWutObjects()
{
QString filter = q_("Text file");
filter.append(" (*.txt)");
QString filePath = QFileDialog::getSaveFileName(0, q_("Save list of
objects as..."), QDir::homePath() + "/wut-objects.txt", filter);
QFile objlist(filePath);
if (!objlist.open(QFile::WriteOnly | QFile::Truncate))
{
qWarning() << "AstroCalc: Unable to open file"
<< QDir::toNativeSeparators(filePath);
return;
}
QTextStream wutObjList(&objlist);
wutObjList.setCodec("UTF-8");
for(int row = 0; row < ui->wutMatchingObjectsListWidget->count(); ++
row)
{
wutObjList << ui->wutMatchingObjectsListWidget->item(row)->t
ext() << acEndl;
}
objlist.close();
}
 End of changes. 56 change blocks. 
82 lines changed or deleted 521 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/