[Kstars-devel] branches/kstars/carbonix/kstars/kstars

Victor Carbune victor.carbune at gmail.com
Sat Jun 19 18:38:53 CEST 2010


SVN commit 1139958 by vcarbune:

Focusing objects on click. 
Requesting comments about the dialog.

CCMAIL:kstars-devel at kde.org, asimha at gmail.com


 M  +1 -2      ksobjectlist.cpp  
 M  +42 -47    tools/objectlist.cpp  
 M  +1 -0      tools/objectlist.h  


--- branches/kstars/carbonix/kstars/kstars/ksobjectlist.cpp #1139957:1139958
@@ -29,8 +29,7 @@
 
     pmenu = new ObjListPopupMenu();
 
-    m_showAVT = true;
-    m_showAddToSession = m_showCenter = m_showDetails = m_showScope = m_showLinks = false;
+    m_showAVT = m_showAddToSession = m_showCenter = m_showDetails = m_showScope = m_showLinks = false;
     m_showAddVisibleTonight = m_showRemoveFromWishList = m_showRemoveFromSessionPlan = false;
 }
 
--- branches/kstars/carbonix/kstars/kstars/tools/objectlist.cpp #1139957:1139958
@@ -53,8 +53,10 @@
 #include "ksutils.h"
 #include "dialogs/locationdialog.h"
 #include "skyobjects/skyobject.h"
+#include "skyobjects/deepskyobject.h"
 #include "skyobjects/starobject.h"
 #include "skycomponents/skymapcomposite.h"
+#include "skycomponents/skymesh.h"
 #include "skymap.h"
 #include "dialogs/detaildialog.h"
 #include "dialogs/finddialog.h"
@@ -205,13 +207,43 @@
 
 void ObjectList::selectObject(const QModelIndex &index)
 {
-    qDebug() << m_TableModel->record(index.row()).field(2).value();
-/*
+//  qDebug() << m_TableModel->record(index.row()).field(2).value();
+    drawObject(m_TableModel->record(index.row()).field(2).value().toLongLong());
+
+    // some additional operations might be done here
+}
+
+void ObjectList::drawObject(qlonglong id)
+{
+    SkyMesh *skyMesh = SkyMesh::Instance();
+    KStarsData *data = KStarsData::Instance();
+
+    // Variables needed to load all the data
+    QString line, con, ss, name[10], longname;
+    QString cat[10];
+
+    // Magnitude, Right Ascension (seconds), Semimajor and Semiminor axis
+    float mag, ras, a, b;
+
+    // RA Hours, Minutes, DSO Type, NGC Index, Messier Index
+    int rah, ram, type;
+
+    // Dec Degrees, Minutes, Seconds, Position Angle, Sign
+    int dd, dm, ds, pa, sgn;
+
+    // PGC Index, UGC Index, Catalogs number
+    int pgc = 0, ugc = 0, k = 0;
+
+    // Index flag, nameflag, counter
+    QChar iflag; bool hasName; int i;
+
+    QSqlQuery query, dsoquery;
+
     QString queryStatement =  QString("SELECT o.rah, o.ram, o.ras, ") +
                                 QString("o.sgn, o.decd, o.decm, o.decs, ") +
                                 QString("o.bmag, o.type, o.pa, o.minor, o.major, ") +
                                 QString("o.longname, o.rowid FROM dso AS o ") +
-                                QString("WHERE o.rowid = ") + QString::number(m_TableModel->record(index.row()).field(2).value());
+                                QString("WHERE o.rowid = ") + QString::number(id);
 
     if (!query.exec(queryStatement)) {
         qDebug() << "Deep Sky select statement error: " << query.lastError();
@@ -273,52 +305,15 @@
         o = new DeepSkyObject( type, r, d, mag, name[0], name[1], longname, cat[0], a, b, pa, pgc, ugc );
         o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
 
-        // Add the name(s) to the nameHash for fast lookup -jbb
-        if (hasName == true) {
-            // hash the default name
-            nameHash[name[0].toLower()] = o;
-            // hash the longname
-            if (!longname.isEmpty())
-                nameHash[longname.toLower()] = o;
+//      Trixel trixel = skyMesh->index( (SkyPoint*) o );
 
-            // hash all the other names (catalog designations) of the object
-            for (i = 1; i < k; i++)
-                if (!name[i].isEmpty())
-                    nameHash[name[i].toLower()] = o;
-        }
+        SkyMap *map = KStars::Instance()->map();
+        SkyMapComposite *skyComp = data->skyComposite();
 
-        Trixel trixel = m_skyMesh->index( (SkyPoint*) o );
+        map->setClickedObject( o );
+        map->setClickedPoint( o );
+        map->slotCenter();
 
-        // Assign object to general DeepSkyObjects list,
-        // and a secondary list based on its catalog.
-        m_DeepSkyList.append( o );
-        appendIndex( o, &m_DeepSkyIndex, trixel );
-
-        if ( o->isCatalogM()) {
-            m_MessierList.append( o );
-            appendIndex( o, &m_MessierIndex, trixel );
-        }
-        else if (o->isCatalogNGC() ) {
-            m_NGCList.append( o );
-            appendIndex( o, &m_NGCIndex, trixel );
-        }
-        else if ( o->isCatalogIC() ) {
-            m_ICList.append( o );
-            appendIndex( o, &m_ICIndex, trixel );
-        }
-        else {
-            m_OtherList.append( o );
-            appendIndex( o, &m_OtherIndex, trixel );
-        }
-
-        // Add name to the list of object names
-        if (!name[0].isEmpty())
-            objectNames(type).append(name[0]);
-
-        // Add longname to the list of object names
-        if (!longname.isEmpty() && longname != name)
-            objectNames(type).append(longname);
-
         // Load the images associated to the deep sky object (this was done in KStarsData::readUrlData)
         dsoquery.prepare("SELECT url, title, type FROM dso_url WHERE idDSO = :iddso");
         dsoquery.bindValue(":iddso", query.value(13).toInt());
@@ -340,7 +335,7 @@
                 }
             }
         }
-    */
 }
+}
 
 #include "objectlist.moc"
--- branches/kstars/carbonix/kstars/kstars/tools/objectlist.h #1139957:1139958
@@ -94,6 +94,7 @@
 
 private:
     QString processSearchText();
+    void drawObject(qlonglong);
 
     KStars *ks;
     ObjectListUI *ui;


More information about the Kstars-devel mailing list