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

Jason Harris kstars at 30doradus.org
Thu May 15 03:29:45 CEST 2008


SVN commit 807902 by harris:

Fix trails for comets and asteroids, and also tweak the rendering of 
comets and asteroids again.  Now, if their angular size is smaller than a 
pixel (which is true >99.9% of the time), then we draw them as a point 
rather than a small ellipse.

CCMAIL: kstars-devel at kde.org



 M  +7 -4      skycomponents/asteroidscomponent.cpp  
 M  +7 -4      skycomponents/cometscomponent.cpp  
 M  +2 -0      skycomponents/skymapcomposite.cpp  
 M  +7 -2      skycomponents/solarsystemlistcomponent.cpp  
 M  +3 -0      skycomponents/solarsystemsinglecomponent.cpp  
 M  +2 -2      skymap.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/asteroidscomponent.cpp #807901:807902
@@ -118,11 +118,14 @@
         if ( ! map->onScreen( o ) ) continue;
 
         float size = ast->angSize() * sizeFactor;
-        if ( size < 0.25 ) size = 0.25;
-        float x1 = o.x() - 0.5 * size;
-        float y1 = o.y() - 0.5 * size;
+        if ( size < 1.0 ) {
+            psky.drawPoint( o );
+	} else {
+            float x1 = o.x() - 0.5 * size;
+            float y1 = o.y() - 0.5 * size;
 
-        psky.drawEllipse( QRectF( x1, y1, size, size ) );
+            psky.drawEllipse( QRectF( x1, y1, size, size ) );
+	}
 
         if ( hideLabels || ast->mag() >= labelMagLimit ) continue;
         SkyLabeler::AddLabel( o, ast, SkyLabeler::ASTEROID_LABEL );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/cometscomponent.cpp #807901:807902
@@ -101,11 +101,14 @@
         //if ( ( o.x() >= 0. && o.x() <= Width && o.y() >= 0. && o.y() <= Height ) )
 
         float size = com->angSize() * map->scale() * dms::PI * Options::zoomFactor()/10800.0;
-				if ( size < 0.25 && Options::zoomFactor() > 10*MINZOOM ) size = 0.25;
-        float x1 = o.x() - 0.5*size;
-        float y1 = o.y() - 0.5*size;
+	if ( size < 1.0 ) {
+            psky.drawPoint( o );
+        } else {
+            float x1 = o.x() - 0.5*size;
+            float y1 = o.y() - 0.5*size;
 
-        psky.drawEllipse( QRectF( x1, y1, size, size ) );
+            psky.drawEllipse( QRectF( x1, y1, size, size ) );
+        }
 
         if ( hideLabels || com->rsun() >= rsunLabelLimit ) continue;
         SkyLabeler::AddLabel( o, com, SkyLabeler::COMET_LABEL );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #807901:807902
@@ -340,6 +340,8 @@
 
 bool SkyMapComposite::addTrail( SkyObject *o ) {
     foreach ( SkyComponent *comp, solarSystem() ) {
+      //DEBUG
+      kDebug() << "here" << endl;
         if ( comp->addTrail( o ) ) return true;
     }
     //Did not find object o
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemlistcomponent.cpp #807901:807902
@@ -63,6 +63,9 @@
 }
 
 bool SolarSystemListComponent::addTrail( SkyObject *oTarget ) {
+  //DEBUG
+  kDebug() << oTarget->name() << endl;
+
     foreach( SkyObject *o, objectList() ) {
         if ( o == oTarget ) {
             ((KSPlanetBase*)o)->addToTrail();
@@ -118,6 +121,9 @@
     QColor tcolor2 = QColor( data->colorScheme()->colorNamed( "SkyColor" ) );
 
     foreach ( SkyObject *obj, m_TrailList ) {
+        //DEBUG
+        kDebug() << obj->name() << endl;
+
         KSPlanetBase *ksp = (KSPlanetBase*)obj;
         if ( ! ksp->hasTrail() ) continue;
 
@@ -160,8 +166,7 @@
                     doDrawLine = true;
                 }
             }
+            oLast = o;
         }
-
-        oLast = o;
     }
 }
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemsinglecomponent.cpp #807901:807902
@@ -67,6 +67,9 @@
 }
 
 bool SolarSystemSingleComponent::addTrail( SkyObject *o ) {
+  //DEBUG
+  kDebug() << o->name() << endl;
+
     if ( o == skyObject() ) {
         ksp()->addToTrail();
         return true;
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #807901:807902
@@ -538,7 +538,7 @@
 void SkyMap::slotRemovePlanetTrail( void ) {
     //probably don't need this if-statement, but just to be sure...
     if ( clickedObject() && clickedObject()->isSolarSystem() ) {
-        ((KSPlanetBase*)clickedObject())->clearTrail();
+        data->skyComposite()->removeTrail( clickedObject() );
         forceUpdate();
     }
 }
@@ -546,7 +546,7 @@
 void SkyMap::slotAddPlanetTrail( void ) {
     //probably don't need this if-statement, but just to be sure...
     if ( clickedObject() && clickedObject()->isSolarSystem() ) {
-        ((KSPlanetBase*)clickedObject())->addToTrail();
+        data->skyComposite()->addTrail( clickedObject() );
         forceUpdate();
     }
 }


More information about the Kstars-devel mailing list