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

James Bowlin bowlin at mindspring.com
Wed Aug 15 19:38:29 CEST 2007


SVN commit 700494 by jbowlin:

Cleaned up the SkyLabeler static interface.

The names of all static methods now start with an uppercase letter.

Added static versions of addLabel() and addOffsetLabel().

CCMAIL: kstars-devel at kde.org


 M  +1 -1      asteroidscomponent.cpp  
 M  +1 -1      cometscomponent.cpp  
 M  +1 -1      constellationnamescomponent.cpp  
 M  +1 -1      jupitermoonscomponent.cpp  
 M  +4 -4      skylabeler.cpp  
 M  +17 -2     skylabeler.h  
 M  +1 -1      solarsystemsinglecomponent.cpp  
 M  +1 -1      starcomponent.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/asteroidscomponent.cpp #700493:700494
@@ -133,7 +133,7 @@
 			psky.drawEllipse( QRect( int(x1), int(y1), int(size), int(size) ) );
 
 		if ( hideLabels || ast->mag() >= labelMagLimit ) continue;
-		SkyLabeler::Instance()->addOffsetLabel( o, ast->translatedName(), ASTEROID_LABEL );
+		SkyLabeler::AddOffsetLabel( o, ast->translatedName(), ASTEROID_LABEL );
     }
 }
 
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/cometscomponent.cpp #700493:700494
@@ -113,6 +113,6 @@
 			psky.drawEllipse( QRect( int(x1), int(y1), int(size), int(size) ) );
 
 		if ( hideLabels || com->rsun() >= rsunLabelLimit ) continue;
-		SkyLabeler::Instance()->addOffsetLabel( o, com->translatedName(), COMET_LABEL );
+		SkyLabeler::AddOffsetLabel( o, com->translatedName(), COMET_LABEL );
 	}
 }
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/constellationnamescomponent.cpp #700493:700494
@@ -122,7 +122,7 @@
 
         float dx = 5.*( name.length() );
         o.setX( o.x() - dx );
-		SkyLabeler::Instance()->addLabel( o, name, CONSTEL_NAME_LABEL);
+		SkyLabeler::AddLabel( o, name, CONSTEL_NAME_LABEL);
     }
 
     //m_skyLabeler->resetFont( psky );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/jupitermoonscomponent.cpp #700493:700494
@@ -116,7 +116,7 @@
    		//if ( ( o.x() >= 0. && o.x() <= Width && o.y() >= 0. && o.y() <= Height ) ) {
    		float offset = 3.0 * scale;
 
-		SkyLabeler::Instance()->addLabel( QPointF( o.x() + offset, o.y() + offset), 
+		SkyLabeler::AddLabel( QPointF( o.x() + offset, o.y() + offset), 
                 jmoons->name(i), JUPITER_MOON_LABEL );
    	}
 }
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skylabeler.cpp #700493:700494
@@ -51,7 +51,7 @@
 }
 
 
-void SkyLabeler::setZoomFont( QPainter& psky )
+void SkyLabeler::SetZoomFont( QPainter& psky )
 {
     QFont font( psky.font() );
     int deltaSize = 0;
@@ -66,7 +66,7 @@
     }
 }
 
-double SkyLabeler::zoomOffset( double scale )
+double SkyLabeler::ZoomOffset( double scale )
 {
     double offset = scale * dms::PI * Options::zoomFactor()/10800.0;
     return 4.0 + offset * 0.5;
@@ -214,14 +214,14 @@
     // ----- Set up Zoom Dependent Font -----
 
     m_stdFont = QFont( psky.font() );
-    SkyLabeler::setZoomFont( psky );
+    SkyLabeler::SetZoomFont( psky );
     m_skyFont = psky.font( );
     m_fontMetrics = QFontMetrics( m_skyFont );
     m_minDeltaX = (int) m_fontMetrics.width("MMMMM");
 
     // ----- Set up Zoom Dependent Offset -----
 
-    m_offset = SkyLabeler::zoomOffset( scale );
+    m_offset = SkyLabeler::ZoomOffset( scale );
 
     
     // ----- Prepare Virtual Screen -----
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skylabeler.h #700493:700494
@@ -140,15 +140,30 @@
 		 * can be used without a SkyLabeler instance.  This is used in SkyObject
 		 * and StarObject in addition to be used in this class.
 		 */
-		static void setZoomFont( QPainter& psky );
+		static void SetZoomFont( QPainter& psky );
 
 		/* @short returns the zoom dependent label offset.  This is used in this
 		 * class and in SkyObject.  It is important that the offsets be the same
 		 * so highlighted labels are always drawn exactly on top of the normally
 		 * drawn labels.
 		 */
-		static double zoomOffset( double scale );
+		static double ZoomOffset( double scale );
 
+		/* @short static version of addOffsetLabel() below.
+		 */
+		inline static void AddOffsetLabel( const QPointF& p, const QString& text, label_t type )
+		{
+			pinstance->addOffsetLabel( p, text, type );
+		}
+
+		/* @short static version of addLabel() below.
+		 */
+		inline static void AddLabel( const QPointF& p, const QString& text, label_t type )
+		{
+			pinstance->addLabel( p, text, type );
+		}
+
+
 		//--------------------------------------------------------------------//
 		~SkyLabeler();
 
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemsinglecomponent.cpp #700493:700494
@@ -173,7 +173,7 @@
    	if ( ! Options::showPlanetNames() ) return;
 
     float offset = ksp()->labelOffset();
-	SkyLabeler::Instance()->addLabel( QPointF( o.x() + offset, o.y() + offset ), 
+	SkyLabeler::AddLabel( QPointF( o.x() + offset, o.y() + offset ), 
 			ksp()->translatedName(), PLANET_LABEL );
 }
 
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #700493:700494
@@ -214,7 +214,7 @@
 
             float offset = scale * (6. + 0.5*( 5.0 - mag ) + 0.01*( zoom/500. ) );
 			QString sName = curStar->nameLabel( drawName, drawMag );
-			SkyLabeler::Instance()->addLabel( QPointF( o.x() + offset, o.y() + offset), sName, STAR_LABEL );
+			SkyLabeler::AddLabel( QPointF( o.x() + offset, o.y() + offset), sName, STAR_LABEL );
 	    }
     }
 }


More information about the Kstars-devel mailing list