20 #include <QTextStream>
23 #include <kfiledialog.h>
24 #include <kmessagebox.h>
25 #include <kurlrequester.h>
39 RA->setDegType(
false);
43 kdt = DateTime->dateTime();
45 connect(NowButton, SIGNAL(clicked()),
this, SLOT(
slotNow()));
46 connect(ObjectButton, SIGNAL(clicked()),
this, SLOT(
slotObject()));
47 connect(DateTime, SIGNAL(dateTimeChanged(
const QDateTime&)),
this, SLOT(
slotDateTimeChanged(
const QDateTime&)));
49 connect(RA, SIGNAL(editingFinished()),
this, SLOT(
slotCompute()));
50 connect(Dec, SIGNAL(editingFinished()),
this, SLOT(
slotCompute()));
51 connect(EcLong, SIGNAL(editingFinished()),
this, SLOT(
slotCompute()));
52 connect(EcLat, SIGNAL(editingFinished()),
this, SLOT(
slotCompute()));
59 connect(runButtonBatch, SIGNAL(clicked()),
this, SLOT(
slotRunBatch()));
74 if ( fd->exec() == QDialog::Accepted ) {
76 RA->showInHours( o->
ra() );
77 Dec->showInDegrees( o->
dec() );
93 if ( sender()->objectName() ==
"EcLong" || sender()->objectName() ==
"EcLat" ) {
97 dms elong = EcLong->createDms(
true, &ok );
98 if ( ok ) elat = EcLat->createDms(
true, &ok );
102 RA->showInHours( sp.
ra() );
103 Dec->showInDegrees( sp.
dec() );
110 dms dec = Dec->createDms(
true, &ok );
111 if ( ok ) ra = RA->createDms(
false, &ok );
116 EcLong->showInDegrees( elong );
117 EcLat->showInDegrees( elat );
122 void modCalcEclCoords::eclCheck() {
124 ecLatCheckBatch->setChecked(
false);
125 ecLatBoxBatch->setEnabled(
false);
126 ecLongCheckBatch->setChecked(
false);
127 ecLongBoxBatch->setEnabled(
false);
132 void modCalcEclCoords::equCheck() {
134 raCheckBatch->setChecked(
false);
135 raBoxBatch->setEnabled(
false);
136 decCheckBatch->setChecked(
false);
137 decBoxBatch->setEnabled(
false);
145 if ( raCheckBatch->isChecked() ) {
146 raBoxBatch->setEnabled(
false );
149 raBoxBatch->setEnabled(
true );
155 if ( decCheckBatch->isChecked() ) {
156 decBoxBatch->setEnabled(
false );
159 decBoxBatch->setEnabled(
true );
165 if ( epochCheckBatch->isChecked() ) {
166 epochBoxBatch->setEnabled(
false );
168 epochBoxBatch->setEnabled(
true );
175 if ( ecLatCheckBatch->isChecked() ) {
176 ecLatBoxBatch->setEnabled(
false );
179 ecLatBoxBatch->setEnabled(
true );
185 if ( ecLongCheckBatch->isChecked() ) {
186 ecLongBoxBatch->setEnabled(
false );
189 ecLongBoxBatch->setEnabled(
true );
195 QString inputFileName = InputFileBoxBatch->url().toLocalFile();
199 if ( QFile::exists(inputFileName) ) {
200 QFile
f( inputFileName );
201 if ( !f.open( QIODevice::ReadOnly) ) {
202 QString message = i18n(
"Could not open file %1.", f.fileName() );
203 KMessageBox::sorry( 0, message, i18n(
"Could Not Open File" ) );
204 inputFileName.clear();
210 processLines(istream);
214 QString message = i18n(
"Invalid file: %1", inputFileName );
215 KMessageBox::sorry( 0, message, i18n(
"Invalid file" ) );
216 inputFileName.clear();
217 InputFileBoxBatch->setUrl( inputFileName );
222 void modCalcEclCoords::processLines(
QTextStream &istream ) {
227 QString outputFileName = OutputFileBoxBatch->url().toLocalFile();
228 QFile fOut( outputFileName );
229 fOut.open(QIODevice::WriteOnly);
236 dms raB, decB, eclLatB, eclLongB;
239 while ( ! istream.atEnd() ) {
240 line = istream.readLine();
245 QStringList fields = line.split(
' ' );
306 if(raCheckBatch->isChecked() ) {
307 raB = dms::fromString( fields[i],
false);
310 raB = raBoxBatch->createDms(
false);
312 if ( allRadioBatch->isChecked() )
313 ostream << raB.toHMSString() << space;
315 if(raCheckBatch->isChecked() )
316 ostream << raB.toHMSString() << space;
320 if(decCheckBatch->isChecked() ) {
321 decB = dms::fromString( fields[i],
true);
324 decB = decBoxBatch->createDms();
326 if ( allRadioBatch->isChecked() )
327 ostream << decB.toDMSString() << space;
329 if(decCheckBatch->isChecked() )
330 ostream << decB.toDMSString() << space;
334 if(epochCheckBatch->isChecked() ) {
338 epoch0B = epochBoxBatch->text();
340 if ( allRadioBatch->isChecked() )
341 ostream << epoch0B << space;
343 if(epochCheckBatch->isChecked() )
344 ostream << epoch0B << space;
351 ostream << eclLongB.toDMSString() << space << eclLatB.toDMSString() << endl;
362 #include "modcalceclipticcoords.moc"
void slotEclLatCheckedBatch(void)
void findEcliptic(const dms *Obliquity, dms &EcLong, dms &EcLat)
Determine the Ecliptic coordinates of the SkyPoint, given the Julian Date.
static KStarsData * Instance()
static KStars * Instance()
bool setFromEpoch(double e)
Set the Date/Time from an epoch value, represented as a double.
void slotEpochCheckedBatch(void)
The sky coordinates of a point in the sky.
static KStarsDateTime currentDateTime(KDateTime::Spec ts=KDateTime::Spec::ClockTime())
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
const dms * obliquity() const
void setFromEcliptic(const dms *Obliquity, const dms &EcLong, const dms &EcLat)
Set the current (RA, Dec) coordinates of the SkyPoint, given pointers to its Ecliptic (Long...
void slotDateTimeChanged(const QDateTime &edt)
An angle, stored as degrees, but expressible in many ways.
There are several time-dependent values used in position calculations, that are not specific to an ob...
void slotDecCheckedBatch(void)
modCalcEclCoords(QWidget *p)
void slotRaCheckedBatch(void)
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
void slotEclLongCheckedBatch(void)