[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kstars/kstars/skycomponents
From:       Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date:       2010-02-09 22:33:43
Message-ID: 1265754823.532103.2727.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1087986 by khudyakov:

Remove init from ConstellationLines

 M  +18 -20    constellationlines.cpp  
 M  +10 -12    constellationlines.h  
 M  +2 -2      skymapcomposite.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/constellationlines.cpp #1087985:1087986
@@ -29,31 +29,17 @@
 #include "skyobjects/skyobject.h"
 #include "skyobjects/starobject.h"
 #include "skycomponents/starcomponent.h"
-#include "skycomponents/skymapcomposite.h"
+#include "skycomponents/culturelist.h"
 #include "skymap.h"
 
 #include "skymesh.h"
 #include "ksfilereader.h"
 
 
-ConstellationLines::ConstellationLines( SkyComposite *parent )
-        : LineListIndex( parent, i18n("Constellation Lines") ), m_reindexNum(J2000)
-{}
-
-bool ConstellationLines::selected()
+ConstellationLines::ConstellationLines( SkyComposite *parent, CultureList* cultures ) :
+    LineListIndex( parent, i18n("Constellation Lines") ),
+    m_reindexNum(J2000)
 {
-    return Options::showCLines() &&
-           ! ( Options::hideOnSlew() && Options::hideCLines() && SkyMap::IsSlewing() );
-}
-
-void ConstellationLines::preDraw( QPainter &psky )
-{
-    KStarsData *data = KStarsData::Instance();
-    QColor color = data->colorScheme()->colorNamed( "CLineColor" );
-    psky.setPen( QPen( QBrush( color ), 1, Qt::SolidLine ) );
-}
-
-void ConstellationLines::init() {
     //Create the ConstellationLinesComponents.  Each is a series of points
     //connected by line segments.  A single constellation can be composed of
     //any number of these series, and we don't need to know which series
@@ -96,7 +82,7 @@
 
         if ( mode == 'C') {
             cultureName = line.mid( 2 ).trimmed();
-            culture     = cultureName == KStarsData::Instance()->skyComposite()->currentCulture();
+            culture     = cultureName == cultures->current();
 
             i++;
             continue;
@@ -132,6 +118,19 @@
     summary();
 }
 
+bool ConstellationLines::selected()
+{
+    return Options::showCLines() &&
+           ! ( Options::hideOnSlew() && Options::hideCLines() && SkyMap::IsSlewing() );
+}
+
+void ConstellationLines::preDraw( QPainter &psky )
+{
+    KStarsData *data = KStarsData::Instance();
+    QColor color = data->colorScheme()->colorNamed( "CLineColor" );
+    psky.setPen( QPen( QBrush( color ), 1, Qt::SolidLine ) );
+}
+
 const IndexHash& ConstellationLines::getIndexHash(LineList* lineList ) {
     return skyMesh()->indexStarLine( lineList->points() );
 }
@@ -139,7 +138,6 @@
 // JIT updating makes this simple.  Star updates are called from within both
 // StarComponent and ConstellationLines.  If the update is redundant then
 // StarObject::JITupdate() simply returns without doing any work.
-
 void ConstellationLines::JITupdate( LineList* lineList )
 {
     KStarsData *data = KStarsData::Instance();
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/constellationlines.h #1087985:1087986
@@ -23,6 +23,8 @@
 #include "linelistindex.h"
 #include "ksnumbers.h"
 
+class CultureList;
+
 /*
 *@class ConstellationLines
 *Collection of lines making the 88 constellations
@@ -37,19 +39,15 @@
 public:
     /* @short Constructor
      * @p parent Pointer to the parent SkyComposite object
-    */
-    ConstellationLines( SkyComposite *parent );
+     *
+     * Constellation lines data is read from clines.dat.
+     * Each line in the file contains a command character ("M" means move to 
+     * this position without drawing a line, "D" means draw a line from 
+     * the previous position to this one), followed by the genetive name of 
+     * a star, which marks the position of the constellation node.
+     */
+    ConstellationLines( SkyComposite *parent, CultureList* cultures );
 
-    /* @short Initialize the Constellation lines
-    *
-    *Reads the constellation lines data from clines.dat.
-    *Each line in the file contains a command character ("M" means move to 
-    *this position without drawing a line, "D" means draw a line from 
-    *the previous position to this one), followed by the genetive name of 
-    *a star, which marks the position of the constellation node.
-    */
-    virtual void init();
-
     void reindex( KSNumbers *num );
 
 protected:
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #1087985:1087986
@@ -69,7 +69,7 @@
     // Do add to components.
     addComponent( m_CBoundLines = new ConstellationBoundaryLines( this ));
     m_Cultures = new CultureList();
-    addComponent( m_CLines     = new ConstellationLines( this ));
+    addComponent( m_CLines     = new ConstellationLines( this, m_Cultures ));
     addComponent( m_CNames     = new ConstellationNamesComponent( this, m_Cultures ));
     addComponent( m_Equator    = new Equator( this ));
     addComponent( m_Ecliptic   = new Ecliptic( this ));
@@ -434,7 +434,7 @@
 void SkyMapComposite::reloadCLines( ) {
     if( m_CLines ) 
         delete m_CLines;
-    m_CLines = new ConstellationLines( this );
+    m_CLines = new ConstellationLines( this, m_Cultures );
     m_CLines->init();
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic