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

Prakash Mohan prak902000 at gmail.com
Wed Jul 15 01:48:57 CEST 2009


SVN commit 996834 by prakash:

Adding support for reading Scope class from the OAL logs.

CCMAIL: kstars-devel at kde.org


 M  +44 -0     log.cpp  
 M  +2 -0      log.h  
 M  +1 -0      scope.h  


--- branches/kstars/summer/kstars/kstars/comast/log.cpp #996833:996834
@@ -397,6 +397,8 @@
                 readSites();
            else if( reader->name() == "sessions" )
                 readSessions();
+           else if( reader->name() == "scopes" )
+                readScopes();
            else if( reader->name() == "geodate" )
                 readGeoDate();
             else
@@ -469,6 +471,22 @@
     }
 }
 
+void Comast::Log::readScopes() {
+    while( ! reader->atEnd() ) {
+        reader->readNext();
+
+        if( reader->isEndElement() )
+            break;
+
+        if( reader->isStartElement() ) {
+            if( reader->name() == "scope" )
+                readScope( reader->attributes().value( "id" ).toString() );
+            else
+                readUnknownElement();
+        }
+    }
+}
+
 void Comast::Log::readTarget() {
     SkyObject *o = NULL;
     while( ! reader->atEnd() ) {
@@ -585,6 +603,32 @@
     m_sessionList.append( o );
 }
 
+void Comast::Log::readScope( QString id ) {
+    QString model, focalLength, vendor, type;
+    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() == "type" ) {
+                type = reader->readElementText() ;
+            } else if( reader->name() == "focalLength" ) {
+                focalLength = reader->readElementText() ;
+            } else
+                readUnknownElement();
+        }
+    }
+    
+    Comast::Scope *o= new Comast::Scope( id, model, vendor, type, focalLength.toDouble() );
+    m_scopeList.append( o );
+}
+
 void Comast::Log::readPosition() {
     while( ! reader->atEnd() ) {
         reader->readNext();
--- branches/kstars/summer/kstars/kstars/comast/log.h #996833:996834
@@ -70,10 +70,12 @@
         void readObservers();
         void readSites();
         void readSessions();
+        void readScopes();
         void readTarget();
         void readObserver();
         void readSite();
         void readSession( QString id, QString lang );
+        void readScope( QString id );
         void readPosition();
         void readGeoDate();
     private:
--- branches/kstars/summer/kstars/kstars/comast/scope.h #996833:996834
@@ -24,6 +24,7 @@
 
 class Comast::Scope {
     public:
+        Scope( QString name, QString model, QString vendor, QString type, double focalLength ) { setScope( name, model, vendor, type, focalLength ); }
         QString id() { return m_Name; }
         QString model() { return m_Model; }
         QString vendor() { return m_Vendor; }


More information about the Kstars-devel mailing list