[Kstars-devel] branches/kstars/summer/kstars/kstars/comast

Prakash Mohan prak902000 at gmail.com
Wed Jul 15 03:39:20 CEST 2009


SVN commit 996855 by prakash:

Adding support for readin the Observation class from the OAL XML logs.

CCMAIL: kstars-devel at kde.org


 M  +40 -0     log.cpp  
 M  +2 -0      log.h  
 M  +3 -0      observation.h  


--- branches/kstars/summer/kstars/kstars/comast/log.cpp #996854:996855
@@ -403,6 +403,8 @@
                 readEyepieces();
            else if( reader->name() =="lenses" )
                 readLenses();
+           else if( reader->name() == "observation" ) 
+                readObservation( reader->attributes().value( "id" ).toString() );
            else if( reader->name() == "geodate" )
                 readGeoDate();
             else
@@ -775,6 +777,44 @@
         }
     }
 }
+
+void Comast::Log::readObservation( QString id ) {
+    QString observer, site, session, target, faintestStar, seeing, scope, eyepiece, result, lang;
+    KStarsDateTime begin;
+    while( ! reader->atEnd() ) {
+        reader->readNext();
+        if( reader->isEndElement() )
+            break;
+        if( reader->isStartElement() ) {
+            if( reader->name() == "observer" )
+                observer = reader->readElementText();
+            else if( reader->name() == "site" )
+                site = reader->readElementText();
+            else if( reader->name() == "session" )
+                session = reader->readElementText();
+            else if( reader->name() == "target" )
+                target = reader->readElementText();
+            else if( reader->name() == "begin" )
+                begin.fromString( reader->readElementText() );
+            else if( reader->name() == "faintestStar" )
+                faintestStar = reader->readElementText();
+            else if( reader->name() == "seeing" )
+                seeing = reader->readElementText();
+            else if( reader->name() == "scope" )
+                scope = reader->readElementText();
+            else if( reader->name() == "eyepiece" )
+                eyepiece = reader->readElementText();
+            else if( reader->name() == "result" ) {
+                result = reader->readElementText();
+                lang = reader->attributes().value( "lang" ).toString();
+            } else
+                readUnknownElement();
+        }
+    }
+        Comast::Observation *o = new Comast::Observation( id, observer, site, session, target, begin, faintestStar.toDouble(), seeing.toDouble(), scope, eyepiece, result, lang );
+        m_observationList.append( o );
+}
+
 void Comast::Log::readGeoDate() {
     QString name, province, country, date;
     while( ! reader->atEnd() ) {
--- branches/kstars/summer/kstars/kstars/comast/log.h #996854:996855
@@ -74,6 +74,7 @@
         void readEyepieces();
         void readLenses();
         void readFilters();
+        void readObservation( QString id );
         void readTarget();
         void readObserver();
         void readSite();
@@ -96,6 +97,7 @@
         QList<Comast::Site *> m_siteList;
         QList<Comast::Session *> m_sessionList;
         QList<Comast::Scope *> m_scopeList;
+        QList<Comast::Observation *> m_observationList;
         QString output;
         bool native;
         dms ra, dec;
--- branches/kstars/summer/kstars/kstars/comast/observation.h #996854:996855
@@ -25,6 +25,9 @@
 
 class Comast::Observation {
     public:
+        Observation( QString id, QString observer, QString site, QString session, QString target, KStarsDateTime begin, double faintestStar, double seeing, QString scope, QString eyepiece, QString result, QString lang ) {
+            setObservation( id, observer, site, session, target, begin, faintestStar, seeing, scope, eyepiece, result, lang );
+        }
         QString id() { return m_Name; }
         QString target() { return m_Target; }
         QString observer() { return m_Observer; }


More information about the Kstars-devel mailing list