[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Tue Mar 7 06:50:22 CET 2006


SVN commit 516431 by harris:

+ Fix moon: calculation of phase and automatic pixmap selection now 
works (so you actually see the image of the moon with the right phase)

+ Draw ground polygon in Equatorial coordinates (we always used to make 
the ground invisible in Equatorial mode, now the ground polygon gets 
drawn).  There are still some problems with this, but it generally 
works.

CCMAIL: kstars-devel at kde.org


 M  +0 -1      ksmoon.cpp  
 M  +4 -1      skycomponents/horizoncomponent.cpp  
 M  +1 -8      skycomponents/skymapcomposite.cpp  
 M  +0 -2      skycomponents/skymapcomposite.h  
 M  +14 -8     skycomponents/solarsystemcomposite.cpp  
 M  +8 -3      skycomponents/solarsystemcomposite.h  
 M  +2 -0      skymap.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/ksmoon.cpp #516430:516431
@@ -195,7 +195,6 @@
 		imFile.close();
 		image0()->load( imFile.name() );
 		image()->load( imFile.name() );
-
 	}
 }
 
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/horizoncomponent.cpp #516430:516431
@@ -142,13 +142,16 @@
 	if ( ! Options::useAltAz() ) { //compute t1,t2
 		//groundPoly.last() is the point on the Horizon that intersects 
 		//the visible sky circle on the right
-		t1 = acos( groundPoly.last().x()/r0 )/dms::DegToRad; //angle in degrees
+		t1 = -1.0*acos( (groundPoly.last().x() - 0.5*Width)/r0/Options::zoomFactor() )/dms::DegToRad; //angle in degrees
 		//Resolve quadrant ambiguity
 		if ( groundPoly.last().y() < 0. ) t1 = 360. - t1;
 
 		t2 = t1 - 180.;
 	}
 
+// 	//DEBUG
+// 	kDebug() << "groundPoly last x: " << groundPoly.last().x() << " : " << r0*Options::zoomFactor() << endl;
+
 	for ( double t=t1; t >= t2; t-=2. ) {  //step along circumference
 		dms a( t );
 		double sa(0.), ca(0.);
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #516430:516431
@@ -77,9 +77,6 @@
 	
 	m_SolarSystem = new SolarSystemComposite( this, data );
 	addComponent( m_SolarSystem );
-	m_JupiterMoons = new JupiterMoonsComponent( this, &Options::showJupiter);
-	addComponent( m_JupiterMoons );
-
 	m_Telescopes = new TelescopeComponent(this, &Options::indiCrosshairs);
 	addComponent(m_Telescopes);
 
@@ -95,8 +92,7 @@
 
 void SkyMapComposite::updateMoons(KStarsData *data, KSNumbers *num )
 {
-	foreach (SkyComponent *component, solarSystem() )
-		component->updateMoons( data, num );
+	m_SolarSystem->updateMoons( data, num );
 }
 
 //Reimplement draw function so that we have control over the order of 
@@ -129,9 +125,6 @@
 	m_Stars->draw( ks, psky, scale );
 	//11. Solar system
 	m_SolarSystem->draw( ks, psky, scale );
-	//12. Jupiter moons
-	//FIXME: can we make this a member of m_SolarSystem?
-	m_JupiterMoons->draw( ks, psky, scale );
 
 	//Draw object name labels
 	ks->map()->drawObjectLabels( labelObjects(), psky, scale );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.h #516430:516431
@@ -50,7 +50,6 @@
 class EclipticComponent;
 class EquatorComponent;
 class HorizonComponent;
-class JupiterMoonsComponent;
 class MilkyWayComposite;
 //class SolarSystemComposite;
 //class StarComponent;
@@ -181,7 +180,6 @@
 		EquatorComponent *m_Equator;
 		EclipticComponent *m_Ecliptic;
 		HorizonComponent *m_Horizon;
-		JupiterMoonsComponent *m_JupiterMoons;
 		MilkyWayComposite *m_MilkyWay;
 		SolarSystemComposite *m_SolarSystem;
 		SkyComposite *m_CustomCatalogs;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemcomposite.cpp #516430:516431
@@ -37,15 +37,19 @@
 SolarSystemComposite::SolarSystemComposite(SkyComponent *parent, KStarsData *data)
   : SkyComposite(parent)
 {
-	Earth = new KSPlanet( data, I18N_NOOP( "Earth" ), QString(), 12756.28 /*diameter in km*/ );
+	m_Earth = new KSPlanet( data, I18N_NOOP( "Earth" ), QString(), 12756.28 /*diameter in km*/ );
 
 	//FIXME: KSSun and KSPluto ctors doesn't need filename and diameter args!
-	addComponent( new SolarSystemSingleComponent( this, new KSSun(data), Options::showSun, 8 ) );
-	addComponent( new SolarSystemSingleComponent( this, new KSMoon(data), Options::showMoon, 8 ) );
+	m_Sun = new KSSun(data);
+	addComponent( new SolarSystemSingleComponent( this, m_Sun, Options::showSun, 8 ) );
+	m_Moon = new KSMoon(data);
+	addComponent( new SolarSystemSingleComponent( this, m_Moon, Options::showMoon, 8 ) );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP("Mercury"), "mercury.png", 4879.4 /*diameter in km*/ ), Options::showMercury, 4 ) );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP("Venus"), "venus.png", 12103.6 /*diameter in km*/ ), Options::showVenus, 4 ) );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP( "Mars" ), "mars.png", 6792.4 /*diameter in km*/ ), Options::showMars, 4 ) );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP( "Jupiter" ), "jupiter.png", 142984. /*diameter in km*/ ), Options::showJupiter, 4 ) );
+	m_JupiterMoons = new JupiterMoonsComponent( this, &Options::showJupiter);
+	addComponent( m_JupiterMoons );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP( "Saturn" ), "saturn.png", 120536. /*diameter in km*/ ), Options::showSaturn, 4 ) );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP( "Uranus" ), "uranus.png", 51118. /*diameter in km*/ ), Options::showUranus, 4 ) );
 	addComponent( new SolarSystemSingleComponent( this, new KSPlanet( data, I18N_NOOP( "Neptune" ), "neptune.png", 49572. /*diameter in km*/ ), Options::showNeptune, 4 ) );
@@ -59,12 +63,12 @@
 
 SolarSystemComposite::~SolarSystemComposite()
 {
-	delete Earth;
+	delete m_Earth;
 }
 
 void SolarSystemComposite::init(KStarsData *data)
 {
-	if (!Earth->loadData())
+	if (!m_Earth->loadData())
 		return; //stop initializing
 
 	emitProgressText( i18n("Loading solar system" ) );
@@ -75,14 +79,16 @@
 
 void SolarSystemComposite::updatePlanets( KStarsData *data, KSNumbers *num )
 {
-	Earth->findPosition(num);
+	m_Earth->findPosition( num );
 	SkyComposite::updatePlanets( data, num );
 }
 
 void SolarSystemComposite::updateMoons( KStarsData *data, KSNumbers *num )
 {
-	Earth->findPosition(num);
-	SkyComposite::updateMoons( data, num );
+	m_Sun->findPosition( num );
+	m_Moon->findPosition( num, data->geo()->lat(), data->lst() );
+	m_Moon->findPhase( m_Sun );
+	m_JupiterMoons->updateMoons( data, num );
 }
 
 void SolarSystemComposite::draw(KStars *ks, QPainter& psky, double scale)
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemcomposite.h #516430:516431
@@ -21,6 +21,9 @@
 #include "skycomposite.h"
 
 class KSPlanet;
+class KSSun;
+class KSMoon;
+class JupiterMoonsComponent;
 class AsteroidsComponent;
 class CometsComponent;
 
@@ -39,7 +42,7 @@
 		SolarSystemComposite(SkyComponent *parent, KStarsData *data);
 		~SolarSystemComposite();
 		
-		KSPlanet* earth() { return Earth; }
+		KSPlanet* earth() { return m_Earth; }
 		QList<SkyObject*>& asteroids();
 		QList<SkyObject*>& comets();
 
@@ -60,8 +63,10 @@
 		void reloadComets( KStarsData *data );
 
 	private:
-		KSPlanet *Earth;
-
+		KSPlanet *m_Earth;
+		KSSun *m_Sun;
+		KSMoon *m_Moon;
+		JupiterMoonsComponent *m_JupiterMoons;
 		AsteroidsComponent *m_AsteroidsComponent;
 		CometsComponent *m_CometsComponent;
 };
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #516430:516431
@@ -1010,6 +1010,8 @@
 
 void SkyMap::setDefaultMouseCursor()
 {
+	mouseMoveCursor = false;        // no mousemove cursor
+
 	QPainter p;
 	QPixmap cursorPix (32, 32); // size 32x32 (this size is compatible to all systems)
 // the center of the pixmap


More information about the Kstars-devel mailing list