Commit c65185ee authored by Jasem Mutlaq's avatar Jasem Mutlaq

Enable align process regardless of astrometry.net installation. This will...

Enable align process regardless of astrometry.net installation. This will enable KStars build with the alignment process without this dependency and the user can install astrometry.net to enable this feature at any time.
parent 3f1a97f3
......@@ -71,6 +71,7 @@ if (CFITSIO_FOUND)
ekos/capture.cpp
ekos/focus.cpp
ekos/guide.cpp
ekos/align.cpp
ekos/opsekos.cpp
ekos/QProgressIndicator.cpp
ekos/guide/common.cpp
......@@ -80,11 +81,8 @@ if (CFITSIO_FOUND)
ekos/guide/rcalibration.cpp
ekos/guide/scroll_graph.cpp
ekos/guide/vect.cpp
)
if (ASTROMETRYNET_FOUND)
set(align_SRCS ekos/align.cpp)
endif(ASTROMETRYNET_FOUND)
)
endif(CFITSIO_FOUND)
......@@ -447,7 +445,7 @@ set(printingui_SRCS
)
##set(kstars_SRCS ${indi_SRCS} ${ekos_SRCS} ${fits_SRCS}
set(kstars_SRCS ${indi_SRCS} ${fits_SRCS} ${ekos_SRCS} ${align_SRCS}
set(kstars_SRCS ${indi_SRCS} ${fits_SRCS} ${ekos_SRCS}
${libkstarswidgets_SRCS} ${libkstarscomponents_SRCS} ${libkstarstools_SRCS}
${kstars_extra_SRCS} ${kstars_gl_SRCS} ${kstars_projection_SRCS} ${xplanet_SRCS}
${kstars_options_SRCS} ${kstars_skyobjects_SRCS} ${kstars_dialogs_SRCS} ${oal_SRCS}
......
......@@ -98,6 +98,16 @@ Align::Align()
astrometryIndex[1400] = "index-4218";
astrometryIndex[2000] = "index-4219";
if (astrometryNetOK() == false)
{
KMessageBox::information(NULL, i18n("Failed to find astrometry.net binaries. Please ensure astrometry.net is installed and try again."),
i18n("Missing astrometry files"), i18n("Do not show again"));
setEnabled(false);
}
}
Align::~Align()
......@@ -1157,6 +1167,16 @@ void Align::getFormattedCoords(double ra, double dec, QString &ra_str, QString &
dec_str = QString("%1:%2:%3").arg(dec_s.degree(), 2, 10, QChar('0')).arg(dec_s.arcmin(), 2, 10, QChar('0')).arg(dec_s.arcsec(), 2, 10, QChar('0'));
}
bool Align::astrometryNetOK()
{
bool solverOK=false, wcsinfoOK=false;
solverOK = (0==access(Options::astrometrySolver().toLatin1(), 0));
wcsinfoOK = (0==access(Options::astrometryWCSInfo().toLatin1(), 0));
return (solverOK && wcsinfoOK);
}
}
#include "align.moc"
......@@ -45,6 +45,7 @@ public:
void startSovling(const QString &filename);
void appendLogText(const QString &);
void clearLog();
bool astrometryNetOK();
QString getLogText() { return logText.join("\n"); }
public slots:
......
......@@ -842,13 +842,10 @@ void EkosManager::setCCD(ISD::GDInterface *ccdDevice)
ccdStarted = true;
// TODO: Add check #ifdef for astrometrynet & WSC here
#ifdef HAVE_ASTROMETRYNET
initAlign();
alignProcess->setCCD(ccd);
if (scope && scope->isConnected())
alignProcess->setTelescope(scope);
#endif
// If guider is the same driver as the CCD
if (useGuiderFromCCD == true)
......@@ -941,13 +938,11 @@ void EkosManager::processNewNumber(INumberVectorProperty *nvp)
guideProcess->syncTelescopeInfo();
}
#ifdef HAVE_ASTROMETRYNET
if (alignProcess)
{
alignProcess->setTelescope(scope);
alignProcess->syncTelescopeInfo();
}
#endif
}
......@@ -1013,10 +1008,16 @@ void EkosManager::updateLog()
if (currentWidget == setupTab)
ekosLogOut->setPlainText(logText.join("\n"));
#ifdef HAVE_ASTROMETRYNET
else if (currentWidget == alignProcess)
{
if (alignProcess->isEnabled() == false)
{
if (alignProcess->astrometryNetOK())
alignProcess->setEnabled(true);
}
ekosLogOut->setPlainText(alignProcess->getLogText());
#endif
}
else if (currentWidget == captureProcess)
ekosLogOut->setPlainText(captureProcess->getLogText());
else if (currentWidget == focusProcess)
......@@ -1043,10 +1044,8 @@ void EkosManager::clearLog()
logText.clear();
updateLog();
}
#ifdef HAVE_ASTROMETRYNET
else if (currentWidget == alignProcess)
alignProcess->clearLog();
#endif
else if (currentWidget == captureProcess)
captureProcess->clearLog();
else if (currentWidget == focusProcess)
......@@ -1068,14 +1067,12 @@ void EkosManager::initCapture()
void EkosManager::initAlign()
{
#ifdef HAVE_ASTROMETRYNET
if (alignProcess)
return;
alignProcess = new Ekos::Align();
toolsWidget->addTab( alignProcess, i18n("Alignment"));
connect(alignProcess, SIGNAL(newLog()), this, SLOT(updateLog()));
#endif
}
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>505</height>
<height>579</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
......@@ -274,16 +274,57 @@
<property name="title">
<string>Astrometry.net</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>solver:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="kcfg_astrometrySolver">
<property name="toolTip">
<string>Astrometry.net solve-field binary</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>wcsinfo:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="kcfg_astrometryWCSInfo">
<property name="toolTip">
<string>Astrometry.net wcsinfo binary</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Conf. File</string>
<string>config:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="kcfg_astrometryConfFile"/>
<item row="2" column="1">
<widget class="QLineEdit" name="kcfg_astrometryConfFile">
<property name="toolTip">
<string>Astrometry.net configuration file</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
......
......@@ -1299,6 +1299,16 @@
<label>Always load device default configuration upon successful connection?</label>
<default>false</default>
</entry>
<entry name="astrometrySolver" type="String">
<label>astrometry.net solve-field binary</label>
<whatsthis>Path to astrometry.net solver location.</whatsthis>
<default>/usr/bin/solve-field</default>
</entry>
<entry name="astrometryWCSInfo" type="String">
<label>astrometry.net wcsinfo binary</label>
<whatsthis>Path to astrometry.net wcsinfp location.</whatsthis>
<default>/usr/bin/wcsinfo</default>
</entry>
<entry name="astrometryConfFile" type="String">
<label>astrometry.net configuration file</label>
<whatsthis>Path to astrometry.net file location.</whatsthis>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment