[Kstars-devel] KDE/kdeedu/kstars/kstars
Alexey Khudyakov
alexey.skladnoy at gmail.com
Thu Nov 5 12:11:29 CET 2009
SVN commit 1045114 by khudyakov:
* Merge MagellanicClouds to Milkyway [1]
* Move code for contour loading back to MilkyWay
[1] More then billion year yearlier...
CCMAIL: kstars-devel at kde.org
M +0 -1 CMakeLists.txt
D skycomponents/magellanicclouds.cpp
D skycomponents/magellanicclouds.h
M +53 -10 skycomponents/milkyway.cpp
M +9 -12 skycomponents/milkyway.h
M +0 -44 skycomponents/skiplistindex.cpp
M +0 -3 skycomponents/skiplistindex.h
M +0 -5 skycomponents/skymapcomposite.cpp
M +0 -2 skycomponents/skymapcomposite.h
--- trunk/KDE/kdeedu/kstars/kstars/CMakeLists.txt #1045113:1045114
@@ -206,7 +206,6 @@
skycomponents/equator.cpp
skycomponents/horizoncomponent.cpp
skycomponents/milkyway.cpp
- skycomponents/magellanicclouds.cpp
skycomponents/skycomponent.cpp
skycomponents/skycomposite.cpp
skycomponents/starblock.cpp
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/milkyway.cpp #1045113:1045114
@@ -41,7 +41,11 @@
void MilkyWay::init()
{
intro();
- loadSkipLists("milkyway.dat", i18n("Loading Milky Way"));
+ // Milky way
+ loadContours("milkyway.dat", i18n("Loading Milky Way"));
+ // Magellanic clouds
+ loadContours("lmc.dat", i18n("Loading Large Magellanic Clouds"));
+ loadContours("smc.dat", i18n("Loading Small Magellanic Clouds"));
summary();
}
@@ -53,20 +57,59 @@
void MilkyWay::draw( QPainter& psky )
{
- if ( !selected() ) return;
+ if ( !selected() )
+ return;
- KStarsData *data = KStarsData::Instance();
-
- QColor color = QColor( data->colorScheme()->colorNamed( "MWColor" ) );
-
+ QColor color = KStarsData::Instance()->colorScheme()->colorNamed( "MWColor" );
psky.setPen( QPen( color, 3, Qt::SolidLine ) );
psky.setBrush( QBrush( color ) );
- if ( Options::fillMilkyWay() ) {
+ if ( Options::fillMilkyWay() )
drawFilled( psky );
- }
- else {
+ else
drawLines( psky );
- }
}
+void MilkyWay::loadContours(QString fname, QString greeting) {
+
+ KSFileReader fileReader;
+ if ( !fileReader.open( fname ) )
+ return;
+ fileReader.setProgress( greeting, 2136, 5 );
+
+ SkipList *skipList = 0;
+ int iSkip = 0;
+ while ( fileReader.hasMoreLines() ) {
+ QString line = fileReader.readLine();
+ fileReader.showProgress();
+
+ QChar firstChar = line.at( 0 );
+ if ( firstChar == '#' )
+ continue;
+
+ bool okRA, okDec;
+ double ra = line.mid( 2, 8 ).toDouble(&okRA);
+ double dec = line.mid( 11, 8 ).toDouble(&okDec);
+ if( !okRA || !okDec) {
+ kDebug() << QString("%1: conversion error on line: %2\n").arg(fname).arg(fileReader.lineNumber());
+ continue;
+ }
+
+ if ( firstChar == 'M' ) {
+ if( skipList )
+ appendBoth( skipList );
+ skipList = 0;
+ iSkip = 0;
+ }
+
+ if( !skipList )
+ skipList = new SkipList();
+
+ skipList->append( new SkyPoint(ra, dec) );
+ if ( firstChar == 'S' )
+ skipList->setSkip( iSkip );
+ iSkip++;
+ }
+ if ( skipList )
+ appendBoth( skipList );
+}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/milkyway.h #1045113:1045114
@@ -30,20 +30,17 @@
class MilkyWay : public SkipListIndex
{
public:
- /**
- *@short Constructor
- *@p parent pointer to the parent SkyComponent
- */
+ /**@short Constructor
+ * @p parent pointer to the parent SkyComponent
+ */
MilkyWay( SkyComponent *parent );
- virtual void init();
+ /** Load skiplists from file */
+ void loadContours(QString fname, QString greeting);
- /**
- *@short Draw the Milky Way on the sky map
- *@p psky Reference to the QPainter on which to paint
- */
- void draw( QPainter& psky );
-
- bool selected();
+
+ virtual void init();
+ virtual void draw( QPainter& psky );
+ virtual bool selected();
};
#endif
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skiplistindex.cpp #1045113:1045114
@@ -40,47 +40,3 @@
SkipList* skipList = (SkipList*) lineList;
return skipList->skip( i );
}
-
-void SkipListIndex::loadSkipLists(QString fname, QString greeting) {
-
- KSFileReader fileReader;
- if ( !fileReader.open( fname ) )
- return;
- fileReader.setProgress( greeting, 2136, 5 );
-
- SkipList *skipList = 0;
- int iSkip = 0;
- while ( fileReader.hasMoreLines() ) {
- QString line = fileReader.readLine();
- fileReader.showProgress();
-
- QChar firstChar = line.at( 0 );
- if ( firstChar == '#' )
- continue;
-
- bool okRA, okDec;
- double ra = line.mid( 2, 8 ).toDouble(&okRA);
- double dec = line.mid( 11, 8 ).toDouble(&okDec);
- if( !okRA || !okDec) {
- kDebug() << QString("%1: conversion error on line: %2\n").arg(fname).arg(fileReader.lineNumber());
- continue;
- }
-
- if ( firstChar == 'M' ) {
- if( skipList )
- appendBoth( skipList );
- skipList = 0;
- iSkip = 0;
- }
-
- if( !skipList )
- skipList = new SkipList();
-
- skipList->append( new SkyPoint(ra, dec) );
- if ( firstChar == 'S' )
- skipList->setSkip( iSkip );
- iSkip++;
- }
- if ( skipList )
- appendBoth( skipList );
-}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skiplistindex.h #1045113:1045114
@@ -54,9 +54,6 @@
* code in LineListIndex instead of repeating it all here.
*/
bool skipAt( LineList* skpiList, int i );
-
- /** Load skiplists from file */
- void loadSkipLists(QString fname, QString greeting);
};
#endif
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #1045113:1045114
@@ -39,7 +39,6 @@
#include "ecliptic.h"
#include "horizoncomponent.h"
#include "milkyway.h"
-#include "magellanicclouds.h"
#include "solarsystemcomposite.h"
#include "starcomponent.h"
#include "deepstarcomponent.h"
@@ -64,8 +63,6 @@
//Add all components
m_MilkyWay = new MilkyWay( this );
addComponent( m_MilkyWay );
- m_MagellanicClouds = new MagellanicClouds( this );
- addComponent( m_MagellanicClouds );
//Stars must come before constellation lines
m_Stars = StarComponent::Create( this );
addComponent( m_Stars );
@@ -224,8 +221,6 @@
m_MilkyWay->draw( psky );
- m_MagellanicClouds->draw( psky );
-
m_CoordinateGrid->draw( psky );
// Draw constellation boundary lines only if we draw western constellations
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.h #1045113:1045114
@@ -41,7 +41,6 @@
class FlagComponent;
class HorizonComponent;
class MilkyWay;
-class MagellanicClouds;
class SolarSystemComposite;
class StarComponent;
class DeepStarComponent;
@@ -214,7 +213,6 @@
Ecliptic *m_Ecliptic;
HorizonComponent *m_Horizon;
MilkyWay *m_MilkyWay;
- MagellanicClouds *m_MagellanicClouds;
SolarSystemComposite *m_SolarSystem;
SkyComposite *m_CustomCatalogs;
StarComponent *m_Stars;
More information about the Kstars-devel
mailing list