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

Prakash Mohan prak902000 at gmail.com
Wed Jul 15 02:31:08 CEST 2009


SVN commit 996843 by prakash:

Adding support for reading the Eyepiece class from the OAL logs.

CCMAIL: kstars-devel at kde.org


 M  +1 -0      eyepiece.h  
 M  +45 -0     log.cpp  
 M  +2 -0      log.h  


--- branches/kstars/summer/kstars/kstars/comast/eyepiece.h #996842:996843
@@ -24,6 +24,7 @@
 
 class Comast::Eyepiece {
     public:
+        Eyepiece( QString id, QString model, QString vendor, double fov, QString fovUnit, double focalLength ) { setEyepiece( id, model, vendor, fov, fovUnit, focalLength ); }
         QString id() { return m_Name; }
         QString model() { return m_Model; }
         QString vendor() { return m_Vendor; }
--- branches/kstars/summer/kstars/kstars/comast/log.cpp #996842:996843
@@ -399,6 +399,8 @@
                 readSessions();
            else if( reader->name() == "scopes" )
                 readScopes();
+           else if( reader->name() == "eyepieces" )
+                readEyepieces();
            else if( reader->name() == "geodate" )
                 readGeoDate();
             else
@@ -487,6 +489,22 @@
     }
 }
 
+void Comast::Log::readEyepieces() {
+    while( ! reader->atEnd() ) {
+        reader->readNext();
+
+        if( reader->isEndElement() )
+            break;
+
+        if( reader->isStartElement() ) {
+            if( reader->name() == "eyepiece" )
+                readEyepiece( reader->attributes().value( "id" ).toString() );
+            else
+                readUnknownElement();
+        }
+    }
+}
+
 void Comast::Log::readTarget() {
     SkyObject *o = NULL;
     while( ! reader->atEnd() ) {
@@ -629,6 +647,33 @@
     m_scopeList.append( o );
 }
 
+void Comast::Log::readEyepiece( QString id ) {
+    QString model, focalLength, vendor, fov, fovUnit;
+    while( ! reader->atEnd() ) {
+        reader->readNext();
+
+        if( reader->isEndElement() )
+            break;
+
+        if( reader->isStartElement() ) {
+            if( reader->name() == "model" ) {
+                model = reader->readElementText();
+            } else if( reader->name() == "vendor" ) {
+                vendor = reader->readElementText() ;
+            } else if( reader->name() == "apparentFOV" ) {
+                fov = reader->readElementText();
+                fovUnit = reader->attributes().value( "unit" ).toString();
+            } else if( reader->name() == "focalLength" ) {
+                focalLength = reader->readElementText() ;
+            } else
+                readUnknownElement();
+        }
+    }
+    
+    Comast::Eyepiece *o= new Comast::Eyepiece( id, model, vendor, fov.toDouble(), fovUnit, focalLength.toDouble() );
+    m_eyepieceList.append( o );
+}
+
 void Comast::Log::readPosition() {
     while( ! reader->atEnd() ) {
         reader->readNext();
--- branches/kstars/summer/kstars/kstars/comast/log.h #996842:996843
@@ -71,11 +71,13 @@
         void readSites();
         void readSessions();
         void readScopes();
+        void readEyepieces();
         void readTarget();
         void readObserver();
         void readSite();
         void readSession( QString id, QString lang );
         void readScope( QString id );
+        void readEyepiece( QString id );
         void readPosition();
         void readGeoDate();
     private:


More information about the Kstars-devel mailing list