7#include "modcalcapcoord.h"
11#include "ksnotification.h"
12#include "kstarsdatetime.h"
13#include "dialogs/finddialog.h"
14#include "skyobjects/skypoint.h"
15#include "skyobjects/skyobject.h"
25 RACat->setUnits(dmsBox::HOURS);
26 DecCat->setUnits(dmsBox::DEGREES);
28 connect(ObjectButton, SIGNAL(clicked()),
this, SLOT(slotObject()));
29 connect(NowButton, SIGNAL(clicked()),
this, SLOT(showCurrentTime()));
30 connect(RACat, SIGNAL(editingFinished()),
this, SLOT(slotCompute()));
31 connect(DecCat, SIGNAL(editingFinished()),
this, SLOT(slotCompute()));
32 connect(UT, SIGNAL(timeChanged(
QTime)),
this, SLOT(slotCompute()));
33 connect(Date, SIGNAL(dateChanged(
QDate)),
this, SLOT(slotCompute()));
35 connect(utCheckBatch, SIGNAL(clicked()),
this, SLOT(slotUtCheckedBatch()));
36 connect(dateCheckBatch, SIGNAL(clicked()),
this, SLOT(slotDateCheckedBatch()));
37 connect(raCheckBatch, SIGNAL(clicked()),
this, SLOT(slotRaCheckedBatch()));
38 connect(decCheckBatch, SIGNAL(clicked()),
this, SLOT(slotDecCheckedBatch()));
39 connect(epochCheckBatch, SIGNAL(clicked()),
this, SLOT(slotEpochCheckedBatch()));
40 connect(runButtonBatch, SIGNAL(clicked()),
this, SLOT(slotRunBatch()));
45void modCalcApCoord::showCurrentTime(
void)
48 Date->setDate(dt.date());
49 UT->setTime(dt.time());
53void modCalcApCoord::slotCompute()
56 long double jd = dt.djd();
58 dt.setFromEpoch(EpochCat->value());
59 long double jd0 = dt.djd();
61 SkyPoint sp(RACat->createDms(), DecCat->createDms());
62 sp.apparentCoord(jd0, jd);
64 RA->setText(sp.ra().toHMSString());
65 Dec->setText(sp.dec().toDMSString());
68void modCalcApCoord::slotObject()
73 RACat->show(o->
ra0());
74 DecCat->show(o->
dec0());
75 EpochCat->setValue(2000.0);
81void modCalcApCoord::slotUtCheckedBatch()
83 if (utCheckBatch->isChecked())
84 utBoxBatch->setEnabled(
false);
87 utBoxBatch->setEnabled(
true);
91void modCalcApCoord::slotDateCheckedBatch()
93 if (dateCheckBatch->isChecked())
94 dateBoxBatch->setEnabled(
false);
97 dateBoxBatch->setEnabled(
true);
101void modCalcApCoord::slotRaCheckedBatch()
103 if (raCheckBatch->isChecked())
104 raBoxBatch->setEnabled(
false);
107 raBoxBatch->setEnabled(
true);
111void modCalcApCoord::slotDecCheckedBatch()
113 if (decCheckBatch->isChecked())
114 decBoxBatch->setEnabled(
false);
117 decBoxBatch->setEnabled(
true);
121void modCalcApCoord::slotEpochCheckedBatch()
123 if (epochCheckBatch->isChecked())
124 epochBoxBatch->setEnabled(
false);
127 epochBoxBatch->setEnabled(
true);
131void modCalcApCoord::slotRunBatch()
133 QString inputFileName = InputLineEditBatch->url().toLocalFile();
139 QFile f(inputFileName);
142 KSNotification::sorry(
i18n(
"Could not open file %1.", f.fileName()),
i18n(
"Could Not Open File"));
143 inputFileName.
clear();
155 KSNotification::sorry(
i18n(
"Invalid file: %1", inputFileName),
i18n(
"Invalid file"));
156 inputFileName.
clear();
157 InputLineEditBatch->setText(inputFileName);
169 outputFileName = OutputLineEditBatch->text();
170 QFile fOut(outputFileName);
184 while (!istream.
atEnd())
197 if (utCheckBatch->isChecked())
203 utB = utBoxBatch->time();
205 if (allRadioBatch->isChecked())
207 else if (utCheckBatch->isChecked())
212 if (dateCheckBatch->isChecked())
218 dtB = dateBoxBatch->date();
220 if (allRadioBatch->isChecked())
222 else if (dateCheckBatch->isChecked())
227 if (raCheckBatch->isChecked())
233 raB = raBoxBatch->createDms();
235 if (allRadioBatch->isChecked())
237 else if (raCheckBatch->isChecked())
242 if (decCheckBatch->isChecked())
248 decB = decBoxBatch->createDms();
250 if (allRadioBatch->isChecked())
252 else if (decCheckBatch->isChecked())
257 if (epochCheckBatch->isChecked())
263 epoch0B = epochBoxBatch->text();
265 if (allRadioBatch->isChecked())
267 else if (decCheckBatch->isChecked())
SkyObject * targetObject()
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
bool setFromEpoch(double e, EpochType type)
Set the Date/Time from an epoch value, represented as a double.
static KStarsDateTime currentDateTime()
Provides all necessary information about an object in the sky: its coordinates, name(s),...
The sky coordinates of a point in the sky.
void apparentCoord(long double jd0, long double jdf)
Computes the apparent coordinates for this SkyPoint for any epoch, accounting for the effects of prec...
const CachingDms & dec() const
const CachingDms & ra0() const
const CachingDms & ra() const
const CachingDms & dec0() const
An angle, stored as degrees, but expressible in many ways.
static dms fromString(const QString &s, bool deg)
Static function to create a DMS object from a QString.
const QString toDMSString(const bool forceSign=false, const bool machineReadable=false, const bool highPrecision=false) const
const QString toHMSString(const bool machineReadable=false, const bool highPrecision=false) const
void processLines(QTextStream &istream)
Process Lines.
modCalcApCoord(QWidget *p)
Constructor.
QString i18n(const char *text, const TYPE &arg...)
QDate fromString(QStringView string, QStringView format, QCalendar cal)
bool exists() const const
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
virtual void close() override
QString toString(QDate date, FormatType format) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QString & append(QChar ch)
QString number(double n, char format, int precision)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QString trimmed() const const
QString readLine(qint64 maxlen)
QTime fromString(QStringView string, QStringView format)