[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    [Kstars-devel] GSoC project on seamless DSO data download
From:       Akarsh Simha <akarshsimha () gmail ! com>
Date:       2016-03-13 23:47:21
Message-ID: CA+9k5tx4x3MYTBnkPMoDrC-0v8ayz=qLRkVGT7fSS1U1g5KDnw () mail ! gmail ! com
[Download RAW message or body]

Hi

Attached are some baby-steps I took a few months ago towards this
project's goals. My progress is very rudimentary. I'm sharing it
mostly to help any applicants.

Regards
Akarsh

["dso-add-tools.patch" (text/x-patch)]

diff --git a/kstars/skyobjects/deepskyobjectdata.h \
b/kstars/skyobjects/deepskyobjectdata.h new file mode 100644
index 0000000..6e669d3
--- /dev/null
+++ b/kstars/skyobjects/deepskyobjectdata.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+               deepskyobjectdata.h  -  K Desktop Planetarium
+                             -------------------
+    begin                : Sun 24 Aug 2014 03:36:32 CDT
+    copyright            : (c) 2014 by Akarsh Simha
+    email                : akarsh.simha@kdemail.net
+***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+
+#ifndef DEEPSKYOBJECTDATA_H
+#define DEEPSKYOBJECTDATA_H
+/**
+ * @struct DeepSkyObjectData
+ * @short A struct to contain information about a deep sky object, independent of \
its existence as a DeepSkyObject + * @author Akarsh Simha <akarsh.simha@kdemail.net>
+ */
+
+struct DeepSkyObjectData {
+
+    /**
+     * @short Constructor
+     */
+    inline DeepSkyObjectData(): catalogIDNumber(-1), B( NaN::f ), V( NaN::f ), type( \
SkyObject::TYPE::TYPE_UNKNOWN ),  +                                majorAxis( NaN::f \
), minorAxis( NaN::f ), positionAngle( NaN::f ) { +    }
+
+    /**
+     * Data
+     */
+
+    /* Designation */
+    QString name; // Primary designation
+    QString altName; // Alternate designation
+    QString longName; // Trivial name
+    QString catalog; // Catalog corresponding to primary designation
+    QString catalogID; // Catalog ID corresponding to primary designation
+    int catalogIDNumber; // approximation to catalogID, by stripping suffixes and \
the like (eg: NGC6027B = 6027) +
+    /* Positional -- J2000.0 */
+    dms RA;
+    dms Dec;
+
+    /* Fluxes */
+    float B;
+    float V;
+
+    /* Type */
+    QString typeString; // detailed type
+    enum SkyObject::TYPE type; // type "rounded-off" to one of KStars' types
+    QString classification; // morphology etc.
+
+    /* Dimension */
+    float majorAxis; // Major axis in arcmin
+    float minorAxis; // Minor axis in arcmin
+    float positionAngle;
+
+};
+
+#endif
diff --git a/kstars/tools/adddeepskyobject.ui b/kstars/tools/adddeepskyobject.ui
new file mode 100644
index 0000000..64fee79
--- /dev/null
+++ b/kstars/tools/adddeepskyobject.ui
@@ -0,0 +1,536 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>708</width>
+    <height>468</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Add/Edit Deep Sky Object</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>350</x>
+     <y>430</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QGroupBox" name="groupBox">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>681</width>
+     <height>150</height>
+    </rect>
+   </property>
+   <property name="sizePolicy">
+    <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+     <horstretch>0</horstretch>
+     <verstretch>0</verstretch>
+    </sizepolicy>
+   </property>
+   <property name="minimumSize">
+    <size>
+     <width>0</width>
+     <height>150</height>
+    </size>
+   </property>
+   <property name="title">
+    <string>Designation</string>
+   </property>
+   <widget class="QFrame" name="gridFrame">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>30</y>
+      <width>661</width>
+      <height>61</height>
+     </rect>
+    </property>
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="1" column="3">
+      <widget class="QComboBox" name="catalogComboBox">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="editable">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="3" colspan="3">
+      <widget class="QLineEdit" name="longNameEdit"/>
+     </item>
+     <item row="1" column="4">
+      <widget class="QLabel" name="label_3">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Numeric ID*:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="2">
+      <widget class="QLabel" name="label_2">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Catalog:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="5">
+      <widget class="QSpinBox" name="catalogIDInput">
+       <property name="maximum">
+        <number>99999999</number>
+       </property>
+       <property name="value">
+        <number>1</number>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="2" colspan="4">
+      <widget class="Line" name="line">
+       <property name="frameShadow">
+        <enum>QFrame::Sunken</enum>
+       </property>
+       <property name="midLineWidth">
+        <number>0</number>
+       </property>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+      </widget>
+     </item>
+     <item row="3" column="2">
+      <widget class="QLabel" name="label_5">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Long Name:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+   <widget class="QLabel" name="label_4">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>100</y>
+      <width>631</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>*As of this version the primary designation necessarily has to have a \
catalog and a unique numeric ID with no suffix. As a workaround when needed, consider \
using alternate designations, or create fake catalogs of miscellaneous objects, and \
use the long name to include the designation of your choice.</string> +    \
</property> +    <property name="wordWrap">
+     <bool>true</bool>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QGroupBox" name="groupBox_2">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>170</y>
+     <width>461</width>
+     <height>91</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Coordinates (J2000)</string>
+   </property>
+   <widget class="QWidget" name="horizontalLayoutWidget">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>30</y>
+      <width>421</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>RA:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="dmsBox" name="raInput" native="true"/>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_6">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Dec:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="dmsBox" name="decInput" native="true"/>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QGroupBox" name="groupBox_3">
+   <property name="geometry">
+    <rect>
+     <x>310</x>
+     <y>270</y>
+     <width>381</width>
+     <height>101</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Dimensions**</string>
+   </property>
+   <widget class="QWidget" name="horizontalLayoutWidget_2">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>30</y>
+      <width>341</width>
+      <height>61</height>
+     </rect>
+    </property>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <layout class="QFormLayout" name="formLayout_3">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::ExpandingFieldsGrow</enum>
+       </property>
+       <item row="0" column="1">
+        <widget class="QDoubleSpinBox" name="majorAxisInput">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0">
+        <widget class="QLabel" name="label_13">
+         <property name="text">
+          <string>Major Axis:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QDoubleSpinBox" name="minorAxisInput">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_14">
+         <property name="text">
+          <string>Minor Axis:</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QFormLayout" name="formLayout_4">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::ExpandingFieldsGrow</enum>
+       </property>
+       <item row="0" column="1">
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::MinimumExpanding</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="1">
+        <widget class="QDoubleSpinBox" name="positionAngleInput">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximum">
+          <double>359.990000000000009</double>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_12">
+         <property name="text">
+          <string>Position Angle:</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QGroupBox" name="groupBox_4">
+   <property name="geometry">
+    <rect>
+     <x>480</x>
+     <y>170</y>
+     <width>211</width>
+     <height>91</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Magnitudes</string>
+   </property>
+   <widget class="QWidget" name="formLayoutWidget">
+    <property name="geometry">
+     <rect>
+      <x>19</x>
+      <y>30</y>
+      <width>171</width>
+      <height>74</height>
+     </rect>
+    </property>
+    <layout class="QFormLayout" name="formLayout">
+     <property name="fieldGrowthPolicy">
+      <enum>QFormLayout::ExpandingFieldsGrow</enum>
+     </property>
+     <item row="0" column="0">
+      <widget class="QLabel" name="label_7">
+       <property name="text">
+        <string>Blue:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="label_8">
+       <property name="text">
+        <string>Visual:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="QDoubleSpinBox" name="visualMagnitudeInput">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="value">
+        <double>99.989999999999995</double>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QDoubleSpinBox" name="blueMagnitudeInput">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="singleStep">
+        <double>0.100000000000000</double>
+       </property>
+       <property name="value">
+        <double>99.989999999999995</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QGroupBox" name="groupBox_5">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>270</y>
+     <width>291</width>
+     <height>101</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Object Type*</string>
+   </property>
+   <widget class="QWidget" name="formLayoutWidget_2">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>30</y>
+      <width>251</width>
+      <height>61</height>
+     </rect>
+    </property>
+    <layout class="QFormLayout" name="formLayout_2">
+     <item row="0" column="0">
+      <widget class="QLabel" name="label_9">
+       <property name="text">
+        <string>Actual Type:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="QComboBox" name="typeComboBox">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="label_10">
+       <property name="text">
+        <string>Generic Type:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QLineEdit" name="actualTypeDisplay">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="readOnly">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QLabel" name="label_11">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>380</y>
+     <width>681</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>*The actual type may be shown as a guideline to choose the generic type. \
The generic type is what KStars understands. The actual type has no consequence as of \
this version. Choose the generic type that best approximates the actual \
type.</string> +   </property>
+   <property name="wordWrap">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_15">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>410</y>
+     <width>681</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>** Major and minor axes are in arcminutes, position angle is in \
degrees.</string> +   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>Dialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>Dialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/kstars/tools/nameresolver.cpp b/kstars/tools/nameresolver.cpp
new file mode 100644
index 0000000..4f49240
--- /dev/null
+++ b/kstars/tools/nameresolver.cpp
@@ -0,0 +1,133 @@
+/***************************************************************************
+                 nameresolver.cpp  -  K Desktop Planetarium
+                             -------------------
+    begin                : Sun 24 Aug 2014 02:28:09 CDT
+    copyright            : (c) 2014 by Akarsh Simha
+    email                : akarsh.simha@kdemail.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+/* Project Includes */
+#include "nameresolver.h"
+#include "skyobjects/deepskyobjectdata.h"
+
+/* KDE Includes */
+#include <kio/jobclasses.h> // TODO: To port to KF5, replace by kio/filecopyjob.h
+
+/* Qt Includes */
+#include <QUrl>
+#include <QTemporaryFile>
+
+NameResolver::resolveName( const QString &name ) {
+    struct DeepSkyObjectData data;
+
+    data.name = name;
+
+    if( !NameResolverInternals::sesameResolver( &data, name ) ) {
+        qDebug() << "Error: sesameResolver failed. Could not resolve name on CDS \
Sesame!"; +        return data; // default data structure with no information
+    }
+    // More to be done here if the resolved name is SIMBAD
+    return data;
+
+}
+
+NameResolver::NameResolverInternals::sesameResolver( struct DeepSkyObjectData &data, \
const QString &name ) { +
+    QTemporaryFile tmpFile;
+    if( tmpFile.open() ) {
+        KIO::FileCopyJob *job = KIO::file_copy( QUrl( QString( \
"http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/-oxpFI/SNV?%1" ).arg( name ) ), +      \
QUrl( tmpFile.fileName() ), -1, KIO::Overwrite | KIO::HideProgressInfo ); +        \
job->exec(); +    }
+    else {
+        qDebug() << "Could not create temporary file to retrieve XML from CDS \
Sesame"; +        return false;
+    }
+    tmpFile.seek( 0 ); // just in case
+    QXmlStreamReader xml( &tmpFile );
+
+    if( xml.atEnd() ) {
+        // file is empty
+        qDebug() << "Empty file instead of the expected XML from CDS Sesame! Maybe \
bad internet connection?"; +        return false;
+    }
+
+    while( !xml.atEnd() && !xml.hasError() ) {
+        QXmlStreamReader::TokenType token = xml.readNext();
+        if( token == QXmlStreamReader::StartDocument )
+            continue;
+        if( token == QXmlStreamReader::StartElement ) {
+            if( xml.name() == "Resolver" ) {
+                // This is the section we want
+                char resolver;
+                QXmlStreamAttributes attributes = xml.attributes();
+                if( attributes.hasAttribute( "name" ) )
+                    resolver = attributes.value("name").at( 0 ).toAscii(); // \
Expected to be S (Simbad), V (VizieR), or N (NED) +                else {
+                    resolver = 0; // NUL character for unknown resolver
+                    qWarning() << "Warning: Unknown resolver " << attributes.value( \
"name " ) << " while reading output from CDS Sesame"; +                }
+
+                // Start reading the data to pick out the relevant ones
+                while( xml.readNextStartElement() ) {
+                    if( xml.name() == "otype" ) {
+                        data.typeString = xml.readElementText();
+                        data.type = \
NameResolver::NameResolverInternals::interpretObjectType( data.typeString ); +        \
} +                    else if( xml.name() == "jradeg" ) {
+                        data.RA.setD( xml.readElementText().toDouble() );
+                    }
+                    else if( xml.name() == "jdedeg" ) {
+                        data.Dec.setD( xml.readElementText().toDouble() );
+                    }
+                    else if( xml.name() == "mag" ) {
+                        attributes = xml.attributes();
+                        char band;
+                        if( attributes.hasAttribute( "band" ) ) {
+                            attributes.value("band").at(0).toAscii();
+                        }
+                        else {
+                            qWarning() << "Warning: Magnitude of unknown band found \
while reading output from CDS Sesame"; +                            band = 0;
+                        }
+
+                        if( band == 'V' ) {
+                            data.V = xml.readElementText().toFloat();
+                        }
+                        else if( band == 'B' ) {
+                            data.B = xml.readElementText().toFloat();
+                        }
+                        // Don't know what to do with other magnitudes, until we \
have a magnitude hash +                    }
+                    else
+                        xml.skipCurrentElement();
+                    // TODO: Parse aliases for common names
+                }
+                break;
+
+            }
+            else
+                continue;
+        }
+    }
+    if( xml.hasError() ) {
+        qDebug() << "Error parsing XML from CDS Sesame: " << xml.errorString();
+        return false;
+    }
+    return true;
+}
+
+NameResolver::NameResolverInternals::getDataFromSimbad( struct DeepSkyObjectData \
&data ) { +    // TODO: Implement
+    // QUrl( QString( \
"http://simbad.u-strasbg.fr/simbad/sim-script?script=output%20console=off%20script=off%0Aformat%20object%20%22%25DIM%22%0A" \
) + data.name ); +}
diff --git a/kstars/tools/nameresolver.h b/kstars/tools/nameresolver.h
new file mode 100644
index 0000000..68f9c8f
--- /dev/null
+++ b/kstars/tools/nameresolver.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+                  nameresolver.h  -  K Desktop Planetarium
+                             -------------------
+    begin                : Sat 23 Aug 2014 23:38:42 CDT
+    copyright            : (c) 2014 by Akarsh Simha
+    email                : akarsh.simha@kdemail.net
+***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+
+#ifndef NAMERESOLVER_H
+#define NAMERESOLVER_H
+/**
+ * @namespace NameResolver
+ *
+ * @short Uses name resolver services to get coordinates and
+ * information about deep-sky objects, given their names
+ *
+ * This class uses the CDS Sesame name resolver (and potentially other
+ * resolvers) to resolve the names of deep-sky objects, and obtain
+ * coordinates, fluxes, alternate designations, and possibly other
+ * data.
+ *
+ * @author Akarsh Simha <akarsh.simha@kdemail.net>
+ */
+
+namespace NameResolver {
+
+    /**
+     * @short Resolve the name of the given DSO and extract data from
+     * various sources
+     */
+    struct DeepSkyObjectData resolveName( const QString &name );
+
+    namespace NameResolverInternals {
+
+        /**
+         * @short Resolve the name and obtain basic data using CDS Sesame service
+         *
+         * @param data the structure to fill with the obtained data
+         * @param name the name (identifier) to resolve
+         * @return Success value
+         */
+        bool sesameResolver( struct DeepSkyObjectData &data, const QString &name );
+
+        /**
+         * @short Retrieve additional data from SIMBAD
+         *
+         * If the object was resolved by SIMBAD, obtain additional data
+         * that is not available through CDS Sesame, such as the major and
+         * minor axes and position angle of the object.
+         *
+         * @param data the structure containing data from Sesame, to be
+         * filled with additional data
+         * @return Success value
+         */
+        bool getDataFromSimbad( struct DeepSkyObjectData &data );
+
+    }
+
+};
+
+#endif


[Attachment #4 (text/plain)]

_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic