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

Prakash Mohan prak902000 at gmail.com
Tue Jul 14 22:23:22 CEST 2009


SVN commit 996749 by prakash:

Adding support for reading Observers from the OAL logs

CCMAIL:kstars-devel at kde.org


 M  +43 -1     log.cpp  
 M  +2 -0      log.h  
 M  +1 -0      observer.h  


--- branches/kstars/summer/kstars/kstars/comast/log.cpp #996748:996749
@@ -391,7 +391,9 @@
         if( reader->isStartElement() ) {
             if( reader->name() == "targets" )
                 readTargets();
-            if( reader->name() == "geodate" )
+           else if( reader->name() == "observers" )
+                readObservers();
+           else if( reader->name() == "geodate" )
                 readGeoDate();
             else
                 readUnknownElement();
@@ -415,6 +417,22 @@
     }
 }
 
+void Comast::Log::readObservers() {
+    while( ! reader->atEnd() ) {
+        reader->readNext();
+
+        if( reader->isEndElement() )
+            break;
+
+        if( reader->isStartElement() ) {
+            if( reader->name() == "observer" )
+                readObserver();
+            else
+                readUnknownElement();
+        }
+    }
+}
+
 void Comast::Log::readTarget() {
     SkyObject *o = NULL;
     while( ! reader->atEnd() ) {
@@ -450,6 +468,30 @@
     }
 }
 
+
+void Comast::Log::readObserver() {
+    QString name, surname, contact;
+    while( ! reader->atEnd() ) {
+        reader->readNext();
+
+        if( reader->isEndElement() )
+            break;
+
+        if( reader->isStartElement() ) {
+            if( reader->name() == "name" ) {
+                name = reader->readElementText();
+            } else if( reader->name() == "surname" ) {
+                surname = reader->readElementText();
+            } else if( reader->name() == "contact" ) {
+                contact = reader->readElementText();
+            } else
+                readUnknownElement();
+        }
+    }
+    Comast::Observer *o= new Comast::Observer( name, surname, contact );
+    m_observerList.append( o );
+}
+
 void Comast::Log::readPosition() {
     while( ! reader->atEnd() ) {
         reader->readNext();
--- branches/kstars/summer/kstars/kstars/comast/log.h #996748:996749
@@ -67,7 +67,9 @@
         void readLog();
         void readUnknownElement();
         void readTargets();
+        void readObservers();
         void readTarget();
+        void readObserver();
         void readPosition();
         void readGeoDate();
     private:
--- branches/kstars/summer/kstars/kstars/comast/observer.h #996748:996749
@@ -27,6 +27,7 @@
        QString name() { return m_Name; }
        QString surname() { return m_Surname; }
        QString contact() { return m_Contact; }
+       Observer( QString _name ="", QString _surname = "", QString _contact = "" ) { setObserver( _name, _surname, _contact ); }
        void setObserver( QString _name = "", QString _surname= "", QString _contact = "" );
     private:
         QString m_Name, m_Surname, m_Contact;


More information about the Kstars-devel mailing list