[Kstars-devel] [kstars] kstars: FEATURE Supernovae introduced to KStars as small orange '+' signs on the skymap.

Samikshan Bairagya samikshan at gmail.com
Sun Aug 14 21:32:00 UTC 2011


Git commit 2b3e15a053ddaf0b1a42698db7570df6aaad2e6f by Samikshan Bairagya.
Committed on 14/08/2011 at 00:43.
Pushed by bairagya into branch 'master'.

FEATURE Supernovae introduced to KStars as small orange '+' signs on the skymap.
http://www.cbat.eps.harvard.edu/lists/RecentSupernovae.html provides data for Recent Supernova Updates.
CCMAIL: kstars-devel at kde.org

M  +4    -0    kstars/skycomponents/skymapcomposite.h
M  +2    -0    kstars/CMakeLists.txt
M  +29   -2    kstars/skycomponents/skymapcomposite.cpp
M  +1    -1    kstars/skyobjects/skyobject.h
M  +15   -0    kstars/kstars.kcfg
M  +1    -0    kstars/kstarsdata.cpp
M  +5    -0    kstars/kstars.h
M  +6    -0    kstars/kstarsinit.cpp
M  +11   -0    kstars/kstarsactions.cpp

http://commits.kde.org/kstars/2b3e15a053ddaf0b1a42698db7570df6aaad2e6f

diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 0c335b6..775362f 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -200,6 +200,7 @@ set(libkstarscomponents_SRCS
    skycomponents/constellationboundarylines.cpp 
    skycomponents/constellationlines.cpp 
    skycomponents/constellationnamescomponent.cpp 
+   skycomponents/supernovaecomponent.cpp
    skycomponents/coordinategrid.cpp 
    skycomponents/ecliptic.cpp 
    skycomponents/equator.cpp 
@@ -273,6 +274,7 @@ set(kstars_skyobjects_SRCS
   skyobjects/starobject.cpp
   skyobjects/trailobject.cpp
   skyobjects/satellite.cpp
+  skyobjects/supernova.cpp
 )
 
 set(kstars_dialogs_SRCS
diff --git a/kstars/kstars.h b/kstars/kstars.h
index 6516f9e..1bac59e 100644
--- a/kstars/kstars.h
+++ b/kstars/kstars.h
@@ -58,6 +58,7 @@ class OpsCatalog;
 class OpsGuides;
 class OpsSolarSystem;
 class OpsSatellites;
+//class OpsSupernovae;
 class OpsColors;
 class OpsAdvanced;
 class OpsINDI;
@@ -591,6 +592,9 @@ private slots:
     /**Update asteroids orbital elements*/
     void slotUpdateAsteroids();
 
+    /**Update list of recent supernovae*/
+    void slotUpdateSupernovae();
+
 private:
     /** Load FOV information and repopulate menu. */
     void repopulateFOV();
@@ -647,6 +651,7 @@ private:
     OpsGuides *opguides;
     OpsSolarSystem *opsolsys;
     OpsSatellites *opssatellites;
+    //OpsSupernovae *opsupernovae;
     OpsColors *opcolors;
     OpsAdvanced *opadvanced;
     OpsINDI *opsindi;
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index 1e8f5ef..e8c9bf7 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -353,6 +353,16 @@
 			<whatsthis>Toggle whether comet name labels are drawn in the sky map.</whatsthis>
 			<default>false</default>
 		</entry>
+		<entry name="ShowSupernovae" type="Bool">
+			<label>Draw supernovae in the sky map?</label>
+			<whatsthis>Toggle whether supernovae are drawn in the sky map.</whatsthis>
+			<default>true</default>
+		</entry>
+		<entry name="ShowSupernovaNames" type="Bool">
+			<label>Label Supernova Names in the sky map?</label>
+			<whatsthis>Toggle whether supernova name labels are drawn in the sky map.</whatsthis>
+			<default>false</default>
+		</entry>
 		<entry name="ShowCBounds" type="Bool">
 			<label>Draw constellation boundaries in the sky map?</label>
 			<whatsthis>Toggle whether constellation boundaries are drawn in the sky map.</whatsthis>
@@ -854,6 +864,11 @@
             <whatsthis>Color of satellites labels.</whatsthis>
             <default>#640000</default>
         </entry>
+        <entry name="SupernovaColor" type="String">
+            <label>Color of supernovae</label>
+            <whatsthis>Color of supernova</whatsthis>
+            <default>#FFA500</default>
+        </entry>
 		<entry name="UserLabelColor" type="String">
 			<label>Color of user-added labels</label>
 			<whatsthis>The color for user-added object labels.</whatsthis>
diff --git a/kstars/kstarsactions.cpp b/kstars/kstarsactions.cpp
index b65ee5a..f079e39 100644
--- a/kstars/kstarsactions.cpp
+++ b/kstars/kstarsactions.cpp
@@ -92,6 +92,7 @@
 #include "skycomponents/solarsystemcomposite.h"
 #include "skycomponents/cometscomponent.h"
 #include "skycomponents/asteroidscomponent.h"
+#include "skycomponents/supernovaecomponent.h"
 
 #ifdef HAVE_CFITSIO_H
 #include "fitsviewer/fitsviewer.h"
@@ -172,6 +173,11 @@ void KStars::slotViewToolBar() {
         if ( kcd ) {
             opssatellites->kcfg_ShowSatellites->setChecked( a->isChecked() );
         }
+    } else if ( a == actionCollection()->action( "show_supernovae" ) ) {
+        Options::setShowSupernovae( a->isChecked() );
+//         if ( kcd ) {
+//             opsupernovae->kcfg_ShowSupernovae->setChecked ( a->isChecked() ) ;
+//         }
     }
 
     // update time for all objects because they might be not initialized
@@ -1057,3 +1063,8 @@ void KStars::slotUpdateComets() {
 void KStars::slotUpdateAsteroids() {
     data()->skyComposite()->solarSystemComposite()->asteroidsComponent()->updateDataFile();
 }
+
+void KStars::slotUpdateSupernovae()
+{
+    data()->skyComposite()->supernovaeComponent()->updateDataFile();
+}
diff --git a/kstars/kstarsdata.cpp b/kstars/kstarsdata.cpp
index 2303c5f..44cd366 100644
--- a/kstars/kstarsdata.cpp
+++ b/kstars/kstarsdata.cpp
@@ -1047,6 +1047,7 @@ bool KStarsData::executeScript( const QString &scriptname, SkyMap *map ) {
                 if ( fn[1] == "ShowComets"      && bOk ) { Options::setShowComets(   bVal ); cmdCount++; }
                 if ( fn[1] == "ShowSolarSystem" && bOk ) { Options::setShowSolarSystem( bVal ); cmdCount++; }
                 if ( fn[1] == "ShowDeepSky"     && bOk ) { Options::setShowDeepSky(  bVal ); cmdCount++; }
+                if ( fn[1] == "ShowSupernovae"  && bOk ) { Options::setShowSupernovae( bVal ); cmdCount++; }
                 if ( fn[1] == "ShowStarNames"      && bOk ) { Options::setShowStarNames(      bVal ); cmdCount++; }
                 if ( fn[1] == "ShowStarMagnitudes" && bOk ) { Options::setShowStarMagnitudes( bVal ); cmdCount++; }
                 if ( fn[1] == "ShowAsteroidNames"  && bOk ) { Options::setShowAsteroidNames(  bVal ); cmdCount++; }
diff --git a/kstars/kstarsinit.cpp b/kstars/kstarsinit.cpp
index 30c871a..3e42094 100644
--- a/kstars/kstarsinit.cpp
+++ b/kstars/kstarsinit.cpp
@@ -350,6 +350,8 @@ void KStars::initActions() {
         << i18n( "Update comets orbital elements" );
     actionCollection()->addAction( "update_asteroids", this, SLOT( slotUpdateAsteroids() ) )
         << i18n( "Update asteroids orbital elements" );
+    actionCollection()->addAction("update_supernovae", this, SLOT(slotUpdateSupernovae() ) )
+        << i18n( "Update Recent Supernovae data" );
 
     //Tools Menu:
     actionCollection()->addAction("astrocalculator", this, SLOT( slotCalculator() ) )
@@ -487,6 +489,10 @@ void KStars::initActions() {
         << i18nc("Toggle satellites in the display", "Satellites" )
         << KIcon("kstars_satellites" )
         << ToolTip( i18n("Toggle satellites") );
+    actionCollection()->add<KToggleAction>("show_supernovae", this, SLOT( slotViewToolBar() ) )
+        << i18nc("Toggle supernovae in the display", "Supernovae" )
+        << KIcon("kstars_supernovae" )
+        << ToolTip( i18n("Toggle supernovae") );
 
     setXMLFile("kstarsui.rc" );
 
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index 82fef8a..efd8c25 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -44,6 +44,7 @@
 #include "deepstarcomponent.h"
 #include "flagcomponent.h"
 #include "satellitescomponent.h"
+#include "supernovaecomponent.h"
 
 
 #include "skymesh.h"
@@ -96,6 +97,7 @@ SkyMapComposite::SkyMapComposite(SkyComposite *parent ) :
                                                              &Options::obsListSymbol, &Options::obsListText ) );
     addComponent( m_StarHopRouteList = new TargetListComponent( this , 0, QPen() ) );
     addComponent( m_Satellites       = new SatellitesComponent( this ) );
+    addComponent( m_Supernovae       = new SupernovaeComponent( this ) );
 
     connect( this, SIGNAL( progressText( const QString & ) ),
              KStarsData::Instance(), SIGNAL( progressText( const QString & ) ) );
@@ -138,7 +140,9 @@ void SkyMapComposite::update(KSNumbers *num )
     m_SolarSystem->update( num );
     //13. Satellites
     m_Satellites->update( num );
-    //14. Horizon
+    //14. Supernovae
+    m_Supernovae->update(num);
+    //15. Horizon
     m_Horizon->update( num );
 }
 
@@ -236,9 +240,11 @@ void SkyMapComposite::draw( SkyPainter *skyp )
 
     m_SolarSystem->drawTrails( skyp );
     m_SolarSystem->draw( skyp );
-    
+
     m_Satellites->draw( skyp );
 
+    m_Supernovae->draw(skyp);
+
     m_Horizon->draw( skyp );
 
     map->drawObjectLabels( labelObjects() );
@@ -337,6 +343,15 @@ SkyObject* SkyMapComposite::objectNearest( SkyPoint *p, double &maxrad ) {
         rBest = rTry;
         oBest = oTry;
     }
+
+    rTry = maxrad;
+    oTry = m_Supernovae->objectNearest(p,rTry);
+    //kDebug()<<rTry<<rBest<<maxrad;
+    if ( rTry < rBest ) {
+        rBest = rTry;
+        oBest = oTry;
+    }
+
     if ( oBest )
         kDebug() << "OBEST=" << oBest->name() << " - " << oBest->name2();
     maxrad = rBest;
@@ -407,6 +422,8 @@ SkyObject* SkyMapComposite::findByName( const QString &name ) {
     if ( o ) return o;
     o = m_Stars->findByName( name );
     if ( o ) return o;
+    o = m_Supernovae->findByName(name);
+    if ( o ) return o;
 
     return 0;
 }
@@ -496,6 +513,11 @@ const QList<SkyObject*>& SkyMapComposite::comets() const {
     return m_SolarSystem->comets();
 }
 
+const QList<SkyObject*>& SkyMapComposite::supernovae() const
+{
+    return m_Supernovae->objectList();
+}
+
 KSPlanet* SkyMapComposite::earth() {
     return m_SolarSystem->earth();
 }
@@ -533,4 +555,9 @@ SolarSystemComposite* SkyMapComposite::solarSystemComposite()
     return m_SolarSystem;
 }
 
+SupernovaeComponent* SkyMapComposite::supernovaeComponent()
+{
+    return m_Supernovae;
+}
+
 #include "skymapcomposite.moc"
diff --git a/kstars/skycomponents/skymapcomposite.h b/kstars/skycomponents/skymapcomposite.h
index adf496d..bc93f7f 100644
--- a/kstars/skycomponents/skymapcomposite.h
+++ b/kstars/skycomponents/skymapcomposite.h
@@ -46,6 +46,7 @@ class DeepStarComponent;
 class TargetListComponent;
 class TargetListComponent;
 class SatellitesComponent;
+class SupernovaeComponent;
 
 class DeepSkyObject;
 class KSPlanetBase;
@@ -165,6 +166,7 @@ public:
 
     FlagComponent* flags();
     SatellitesComponent* satellites();
+    SupernovaeComponent* supernovaeComponent();
 
     //Accessors for StarComponent
     SkyObject* findStarByGenetiveName( const QString name );
@@ -176,6 +178,7 @@ public:
     const QList<SkyObject*>& stars() const;
     const QList<SkyObject*>& asteroids() const;
     const QList<SkyObject*>& comets() const;
+    const QList<SkyObject*>& supernovae() const;
 
     KSPlanet* earth();
     KSPlanetBase* planet( int n );
@@ -215,6 +218,7 @@ private:
     TargetListComponent         *m_ObservingList;
     TargetListComponent         *m_StarHopRouteList;
     SatellitesComponent         *m_Satellites;
+    SupernovaeComponent         *m_Supernovae;
 
     SkyMesh*                m_skyMesh;
     SkyLabeler*             m_skyLabeler;
diff --git a/kstars/skyobjects/skyobject.h b/kstars/skyobjects/skyobject.h
index 3a6122f..884051a 100644
--- a/kstars/skyobjects/skyobject.h
+++ b/kstars/skyobjects/skyobject.h
@@ -108,7 +108,7 @@ public:
                 GASEOUS_NEBULA=5, PLANETARY_NEBULA=6, SUPERNOVA_REMNANT=7, GALAXY=8,
                 COMET=9, ASTEROID=10, CONSTELLATION=11, MOON=12, ASTERISM=13, 
                 GALAXY_CLUSTER=14, DARK_NEBULA=15, QUASAR=16, MULT_STAR=17, RADIO_SOURCE=18,
-                SATELLITE=19, TYPE_UNKNOWN };
+                SATELLITE=19, SUPERNOVA=20, TYPE_UNKNOWN };
 
     /**
      *@return object's primary name.



More information about the Kstars-devel mailing list