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

Jason Harris kstars at 30doradus.org
Tue Sep 6 08:45:15 CEST 2005


SVN commit 457604 by harris:

Fix some refraction-related inconsistincies:

Display the "apparent" altitude (i.e., including refraction) in the
statusbar and focus infobox.

The displayed RA/Dec coords in the infobox were not correct when
refraction was active.

When switching between Equatorial and Horizontal coordinates, the
focus position would be slightly offset because it was not properly
accounting for refraction.

TODO: the refract(dms*, bool) function determines the apparent altitude
from the true altitude when invoked as refract(dms*, true), and
determines the true altitude from apparent altitude when invoked as
refract(dms, false).  However, there seems to be a slight
inconsistency:

  dms a( 45.0 );
  dms b = refract( &a, true );
  dms c = refract( &b, false );
  //c should be equal to a, but it is slightly smaller

CCMAIL: kstars-devel at kde.org



 M  +13 -0     kstarsactions.cpp  
 M  +14 -13    skymap.cpp  
 M  +1 -1      skymap.h  
 M  +1 -1      skymapdraw.cpp  
 M  +6 -3      skymapevents.cpp  


--- branches/KDE/3.5/kdeedu/kstars/kstars/kstarsactions.cpp #457603:457604
@@ -782,9 +782,22 @@
 void KStars::slotCoordSys() {
 	if ( Options::useAltAz() ) {
 		Options::setUseAltAz( false );
+		if ( Options::useRefraction() ) {
+			if ( map()->focusObject() ) //simply update focus to focusObject's position
+				map()->setFocus( map()->focusObject() );
+			else { //need to recompute focus for unrefracted position
+				map()->setFocusAltAz( map()->refract( map()->focus()->alt(), false ).Degrees(), 
+						map()->focus()->az()->Degrees() );
+				map()->focus()->HorizontalToEquatorial( data()->lst(), geo()->lat() );
+			}
+		}
 		actCoordSys->turnOn();
 	} else {
 		Options::setUseAltAz( true );
+		if ( Options::useRefraction() ) {
+			map()->setFocusAltAz( map()->refract( map()->focus()->alt(), true ).Degrees(), 
+					map()->focus()->az()->Degrees() );
+		}
 		actCoordSys->turnOff();
 	}
 	map()->forceUpdate();
--- branches/KDE/3.5/kdeedu/kstars/kstars/skymap.cpp #457603:457604
@@ -168,19 +168,22 @@
 }
 
 
-void SkyMap::showFocusCoords( void ) {
-	//display object info in infoBoxes
-	QString oname;
-	oname = i18n( "nothing" );
-	if ( focusObject() != NULL && Options::isTracking() ) 
-		oname = focusObject()->translatedLongName();
-	
-	infoBoxes()->focusObjChanged(oname);
+void SkyMap::showFocusCoords( bool coordsOnly ) {
+	if ( ! coordsOnly ) {
+		//display object info in infoBoxes
+		QString oname;
+		oname = i18n( "nothing" );
+		if ( focusObject() != NULL && Options::isTracking() ) 
+			oname = focusObject()->translatedLongName();
+		
+		infoBoxes()->focusObjChanged(oname);
+	}
 
 	if ( Options::useAltAz() && Options::useRefraction() ) {
 		SkyPoint corrFocus( *(focus()) );
 		corrFocus.setAlt( refract( focus()->alt(), false ) );
 		corrFocus.HorizontalToEquatorial( data->LST, data->geo()->lat() );
+		corrFocus.setAlt( refract( focus()->alt(), true ) );
 		infoBoxes()->focusCoordChanged( &corrFocus );
 	} else {
 		infoBoxes()->focusCoordChanged( focus() );
@@ -527,17 +530,15 @@
 
 	//update the destination to the selected coordinates
 	if ( Options::useAltAz() ) { 
-		if ( Options::useRefraction() )
-			setDestinationAltAz( refract( focusPoint()->alt(), true ).Degrees(), focusPoint()->az()->Degrees() );
-		else
-			setDestinationAltAz( focusPoint()->alt()->Degrees(), focusPoint()->az()->Degrees() );
+		setDestinationAltAz( refract( focusPoint()->alt(), true ).Degrees(), focusPoint()->az()->Degrees() );
 	} else {
 		setDestination( focusPoint() );
 	}
 
 	//display coordinates in statusBar
 	if ( ksw ) {
-		QString s = focusPoint()->az()->toDMSString() + ",  " + focusPoint()->alt()->toDMSString(true);
+		QString s = focusPoint()->az()->toDMSString() + ",  " 
+			+ refract( focusPoint()->alt(), true ).toDMSString(true);
 		ksw->statusBar()->changeItem( s, 1 );
 		s = focusPoint()->ra()->toHMSString() + ",  " + focusPoint()->dec()->toDMSString(true);
 		ksw->statusBar()->changeItem( s, 2 );
--- branches/KDE/3.5/kdeedu/kstars/kstars/skymap.h #457603:457604
@@ -77,7 +77,7 @@
 
 /**@short Update object name and coordinates in the Focus InfoBox
 	*/
-	void showFocusCoords();
+	void showFocusCoords( bool coordsOnly = false );
 
 /**@short Update the focus position according to current options.
 	*/
--- branches/KDE/3.5/kdeedu/kstars/kstars/skymapdraw.cpp #457603:457604
@@ -52,7 +52,7 @@
 		QPainter p;
 		p.begin( pm );
 
-		infoBoxes()->focusCoordChanged( focus() );
+		showFocusCoords( true );
 		drawBoxes( p );
 
 		//draw FOV symbol
--- branches/KDE/3.5/kdeedu/kstars/kstars/skymapevents.cpp #457603:457604
@@ -423,7 +423,7 @@
 			else
 				setDestination( focus() );
 
-			showFocusCoords();
+			showFocusCoords( true );
 			forceUpdate();	// Need a full update to draw faint objects that are not drawn while slewing.
 			break;
 	}
@@ -536,7 +536,7 @@
 
 		++scrollCount;
 		if ( scrollCount > 4 ) {
-			showFocusCoords();
+			showFocusCoords( true );
 			scrollCount = 0;
 		}
 
@@ -556,7 +556,10 @@
 		if ( ksw ) {
 			QString sX, sY, s;
 			sX = mousePoint()->az()->toDMSString(true);  //true = force +/- symbol
-			sY = mousePoint()->alt()->toDMSString(true); //true = force +/- symbol
+			sY = mousePoint()->alt()->toDMSString(true); //true=force +/- symbol
+			if ( Options::useAltAz() && Options::useRefraction() ) 
+				sY = refract( mousePoint()->alt(), true ).toDMSString(true);
+
 			s = sX + ",  " + sY;
 			ksw->statusBar()->changeItem( s, 1 );
 			


More information about the Kstars-devel mailing list