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

Jason Harris kstars at 30doradus.org
Fri Sep 7 15:35:34 CEST 2007


SVN commit 709421 by harris:

Take the StarColorMode into account when drawing stars.

Removed internal storage of star color mode and star color instensity
in StarComponent; the accessor functions in this class now just
retrieve the values straight from the color scheme.

CCMAIL: kstars-devel at kde.org



 M  +0 -11     opscolors.cpp  
 M  +0 -8      skycomponents/skymapcomposite.cpp  
 M  +11 -7     skycomponents/starcomponent.cpp  
 M  +23 -38    skycomponents/starcomponent.h  


--- trunk/KDE/kdeedu/kstars/kstars/opscolors.cpp #709420:709421
@@ -148,12 +148,6 @@
 	kcfg_StarColorMode->setCurrentIndex( ksw->data()->colorScheme()->starColorMode() );
 	kcfg_StarColorIntensity->setValue( ksw->data()->colorScheme()->starColorIntensity() );
 
-	if ( ksw->data()->skyComposite()->starColorMode() != ksw->data()->colorScheme()->starColorMode() )
-		ksw->data()->skyComposite()->setStarColorMode( ksw->data()->colorScheme()->starColorMode() );
-
-	if ( ksw->data()->skyComposite()->starColorIntensity() != ksw->data()->colorScheme()->starColorIntensity() )
-		ksw->data()->skyComposite()->setStarColorIntensity( ksw->data()->colorScheme()->starColorIntensity() );
-
 	for ( unsigned int i=0; i < ksw->data()->colorScheme()->numberOfColors(); ++i ) {
 		QColor itemColor( ksw->data()->colorScheme()->colorAt( i ) );
 		temp.fill( itemColor );
@@ -239,8 +233,6 @@
 
 void OpsColors::slotStarColorMode( int i ) {
 	ksw->data()->colorScheme()->setStarColorMode( i );
-	if ( ksw->data()->skyComposite()->starColorMode() != ksw->data()->colorScheme()->starColorMode() )
-		ksw->data()->skyComposite()->setStarColorMode( ksw->data()->colorScheme()->starColorMode() );
 
 	if ( ksw->data()->colorScheme()->starColorMode() != 0 ) //mode is not "Real Colors"
 		kcfg_StarColorIntensity->setEnabled( false );
@@ -250,9 +242,6 @@
 
 void OpsColors::slotStarColorIntensity( int i ) {
 	ksw->data()->colorScheme()->setStarColorIntensity( i );
-	if ( ksw->data()->skyComposite()->starColorIntensity() != ksw->data()->colorScheme()->starColorIntensity() )
-		ksw->data()->skyComposite()->setStarColorIntensity( ksw->data()->colorScheme()->starColorIntensity() );
-
 }
 
 #include "opscolors.moc"
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #709420:709421
@@ -351,14 +351,6 @@
 	}
 }
 
-void SkyMapComposite::setStarColorMode( int newMode ) {
-	m_Stars->setStarColorMode( newMode );
-}
-
-void SkyMapComposite::setStarColorIntensity( int newIntensity ) {
-	m_Stars->setStarColorIntensity( newIntensity );
-}
-
 QHash<int, QStringList>& SkyMapComposite::objectNames() {
 	return m_ObjectNames;
 }
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #709420:709421
@@ -71,8 +71,6 @@
 void StarComponent::init(KStarsData *data)
 {
 	emitProgressText( i18n("Loading stars" ) );
-	m_ColorMode = data->colorScheme()->starColorMode(); 
-	m_ColorIntensity = data->colorScheme()->starColorIntensity();
 	m_Data = data;
 
 	readLineNumbers();
@@ -224,16 +222,16 @@
 		//Strictly speaking, we don't need to do this every time, but once per 
 		//draw loop isn't too expensive.
 		StarObject::updateColors( (! Options::useAntialias() || 
-				map->isSlewing()), ks->data()->colorScheme()->starColorIntensity() );
+				map->isSlewing()), starColorIntensity() );
 
-    double zoom = Options::zoomFactor();
+	double zoom = Options::zoomFactor();
 
-    bool drawMag = Options::showStarMagnitudes();
+	bool drawMag = Options::showStarMagnitudes();
 	bool drawName = Options::showStarNames();
 
 	//Loop for drawing star images
-    MeshIterator region(m_skyMesh, DRAW_BUF);
-    while ( region.hasNext() ) {
+	MeshIterator region(m_skyMesh, DRAW_BUF);
+	while ( region.hasNext() ) {
         StarList* starList = m_starIndex->at( region.next() );
         for (int i=0; i < starList->size(); ++i) {
 		    StarObject *curStar = (StarObject*) starList->at( i );
@@ -510,4 +508,10 @@
 	return (SkyObject*) oBest;
 }
 
+int StarComponent::starColorMode( void ) const { 
+	return m_Data->colorScheme()->starColorMode(); 
+}
 
+int StarComponent::starColorIntensity( void ) const { 
+	return m_Data->colorScheme()->starColorIntensity(); 
+}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.h #709420:709421
@@ -73,13 +73,8 @@
 /**@return the current setting of the color mode for stars (0=real colors, 
 	*1=solid red, 2=solid white or 3=solid black).
 	*/
-	    int starColorMode( void ) const { return m_ColorMode; }
+	int starColorMode( void ) const;
 
-/**@short Set the color mode for stars (0=real colors, 1=solid red, 2=solid
-	*white or 3=solid black).
-	*/
-	    void setStarColorMode( int mode ) { m_ColorMode = mode; }
-
 /**@short Retrieve the color-intensity value for stars.
 	*
 	*When using the "realistic colors" mode for stars, stars are rendered as 
@@ -88,46 +83,37 @@
 	*the color-saturation level for star images.
 	*@return the current setting of the color intensity setting for stars.
 	*/
-	    int starColorIntensity( void ) const { return m_ColorIntensity; }
+	int starColorIntensity( void ) const;
 
-/**@short Sets the color-intensity value for stars.
-	*
-	*When using the "realistic colors" mode for stars, stars are rendered as 
-	*white circles with a colored border.  The "color intensity" setting modulates
-	*the relative thickness of this colored border, so it effectively adjusts
-	*the color-saturation level for star images.
-	*/
-	    void setStarColorIntensity( int value ) { m_ColorIntensity = value; }
+	float faintMagnitude() const { return m_FaintMagnitude; }
 
-	    float faintMagnitude() const { return m_FaintMagnitude; }
+	void readData( float newMagnitude );
 
-	    void readData( float newMagnitude );
+	SkyObject* objectNearest(SkyPoint *p, double &maxrad );
 
-        SkyObject* objectNearest(SkyPoint *p, double &maxrad );
+	SkyObject* findStarByGenetiveName( const QString name );
 
-        SkyObject* findStarByGenetiveName( const QString name );
+	/* @short usually does nothing.  If we are drawing faint stars and if
+		* Options:::magLimitDrawStar() is greater than m_faaintMagnitude then
+		* the first time we are called we just pop up a splash screen. Then
+		* the second time we are called we actually re-read the data file and
+		* finally erase the pop up.
+		*/
+	void rereadData();
 
-		/* @short usually does nothing.  If we are drawing faint stars and if
-		 * Options:::magLimitDrawStar() is greater than m_faaintMagnitude then
-		 * the first time we are called we just pop up a splash screen. Then
-		 * the second time we are called we actually re-read the data file and
-		 * finally erase the pop up.
-		 */
-		void rereadData();
+	/* @short reads in the small starlnum.idx file that contains the line
+		* numbers from the stars.dat file that correspond to rough 90
+		* different magnitudes.  This allows us to estimate the number of
+		* lines that need to get read when partially reading stars.dat.
+		*/
+	void readLineNumbers();
 
-		/* @short reads in the small starlnum.idx file that contains the line
-		 * numbers from the stars.dat file that correspond to rough 90
-		 * different magnitudes.  This allows us to estimate the number of
-		 * lines that need to get read when partially reading stars.dat.
-		 */
-		void readLineNumbers();
+	/* @short returns an estimate of the stars.dat line number for a given
+		* star magnitude.
+		*/
+	int lineNumber( float mag );
 
-		/* @short returns an estimate of the stars.dat line number for a given
-		 * star magnitude.
-		 */
-		int lineNumber( float mag );
 
-
 	private:
         SkyMesh*       m_skyMesh;
         StarIndex*     m_starIndex;
@@ -145,7 +131,6 @@
 		KStarsData*    m_Data;
 		float          m_FaintMagnitude;
 		float          m_zoomMagLimit;
-		int            m_ColorMode, m_ColorIntensity;
 
 		KStarsSplash*  m_reloadSplash;
 		KStarsSplash*  m_reindexSplash;


More information about the Kstars-devel mailing list