Commit 0fd74e12 authored by nobody's avatar nobody

This commit was manufactured by cvs2svn to create tag

'KDE_3_0_5A_RELEASE'.

svn path=/tags/KDE_3_0_5A_RELEASE/kdeedu/kstars/; revision=195119
parents b45ceb27 36897f00
......@@ -278,3 +278,63 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
......@@ -15,6 +15,9 @@
* *
***************************************************************************/
//commenting out until we have universal solution
// needed for sincos() in math.h
//#define _GNU_SOURCE
#include <stdlib.h>
#include <qstring.h>
......@@ -85,19 +88,28 @@ dms dms::operator- (dms angle)
//---------------------------------------------------------------------------
void dms::SinCos(double &sina, double &cosa) {
sina = sin( radians() );
cosa = cos( radians() );
// This is the old implementation of sincos which is standard C compliant
register double rad = radians();
sina = sin( rad );
cosa = cos( rad );
/**The sincos function computes sin and cos at once (hardware accelareted / fsincos in assembler).
*It's ~33% faster than computing sin and cos separate. But sincos() is not a standard C/C++
*function and requires #define _GNU_SOURCE. It's defined in math.h.
*/
//Leave commented out for now, until we have a universal solution
// sincos(radians(), &sina, &cosa);
}
//---------------------------------------------------------------------------
double dms::radians( void ) {
double Rad = Degrees()*PI()/180.0;
double Rad = Degrees()*PI/180.0;
return Rad;
}
//---------------------------------------------------------------------------
void dms::setRadians( double Rad ) {
setD( Rad*180.0/PI() );
setD( Rad*180.0/PI );
}
//---------------------------------------------------------------------------
......@@ -109,4 +121,6 @@ dms dms::reduce( void ) const {
}
//---------------------------------------------------------------------------
double PI( void ) { return acos(-1.0); }
//double PI( void ) { return acos(-1.0); }
//M_PI is defined in math.h
const double dms::PI = M_PI;
......@@ -240,10 +240,15 @@ public:
*/
dms reduce( void ) const;
/**
* PI is a const static member; it's public so that it can be used anywhere,
* as long as dms.h is included.
*/
static const double PI;
private:
int Deg, Min, Sec;
double D;
};
double PI( void );
#endif
......@@ -129,8 +129,8 @@ void KSMoon::findPosition( long double Epoch ) {
sumB += ( -2235.0*sin( L ) + 382.0*sin( A3 ) + 175.0*sin( A1-F ) + 175.0*sin( A1+F ) + 127.0*sin( L-M1 ) - 115.0*sin( L+M1 ) );
//Geocentric coordinates
setEcLong( ( L + DegtoRad*sumL/1000000.0 ) * 180./PI() ); //convert radians to degrees
setEcLat( ( DegtoRad*sumB/1000000.0 ) * 180./PI() );
setEcLong( ( L + DegtoRad*sumL/1000000.0 ) * 180./dms::PI ); //convert radians to degrees
setEcLat( ( DegtoRad*sumB/1000000.0 ) * 180./dms::PI );
Rearth = 385000.56 + sumR/1000.0;
EclipticToEquatorial( Epoch );
......
......@@ -165,8 +165,8 @@ void KSPlanet::EquatorialToEcliptic( long double jd ) {
double y = sinRA*cosOb + tanDec*sinOb;
double ELongRad = atan( y/cosRA );
//resolve atan ambiguity
if ( cosRA < 0 ) ELongRad += PI();
if ( cosRA > 0 && y < 0 ) ELongRad += 2.0*PI();
if ( cosRA < 0 ) ELongRad += dms::PI;
if ( cosRA > 0 && y < 0 ) ELongRad += 2.0*dms::PI;
EcLong.setRadians( ELongRad );
EcLat.setRadians( asin( sinDec*cosOb - cosDec*sinOb*sinRA ) );
......@@ -193,8 +193,8 @@ void KSPlanet::EclipticToEquatorial( long double jd ) {
double RARad = atan( y / cosLong );
//resolve ambiguity of atan:
if ( cosLong < 0 ) RARad += PI();
if ( cosLong > 0 && y < 0 ) RARad += 2.0*PI();
if ( cosLong < 0 ) RARad += dms::PI;
if ( cosLong > 0 && y < 0 ) RARad += 2.0*dms::PI;
dms newRA, newDec;
newRA.setRadians( RARad );
......
......@@ -154,8 +154,8 @@ bool KSPluto::findPosition( long double jd, KSPlanet *Earth ) {
//Use Meeus's Eq. 32.10 to find Rsun, RA and Dec:
setRsun( sqrt( X*X + Y*Y + Z*Z ) );
RARad = atan( Y / X );
if ( X<0 ) RARad += PI();
if ( X>0 && Y<0 ) RARad += 2.0*PI();
if ( X<0 ) RARad += dms::PI;
if ( X>0 && Y<0 ) RARad += 2.0*dms::PI;
dms newRA; newRA.setRadians( RARad );
dms newDec; newDec.setRadians( asin( Z/rsun() ) );
pos()->setRA( newRA );
......
......@@ -410,7 +410,7 @@ void KStars::initMenuBar() {
actFind->setText( i18n( "&Find Object..." ) );
actFind->setToolTip( i18n( "Find Object" ) );
actFind->plug( p );
actTrack = new KAction( i18n( "&Track Object" ), BarIcon( "unlock" ), 0, this, SLOT( mTrack() ), actionCollection() );
actTrack = new KAction( i18n( "&Track Object" ), BarIcon( "decrypted" ), 0, this, SLOT( mTrack() ), actionCollection() );
actTrack->setAccel( CTRL+Key_T );
actTrack->plug( p );
p->insertSeparator();
......@@ -741,7 +741,7 @@ void KStars::initAltAz()
dec.setRadians( asin( coslat*cosAz ) );
dec.SinCos( sindec, cosdec );
HARad = acos( -1.0*(sinlat*sindec)/(coslat*cosdec) );
if ( sinAz > 0.0 ) { HARad = 2.0*PI() - HARad; }
if ( sinAz > 0.0 ) { HARad = 2.0*dms::PI - HARad; }
HA.setRadians( HARad );
RA = data()->LSTh.Degrees() - HA.Degrees();
......@@ -846,12 +846,12 @@ void KStars::mFind() {
void KStars::mTrack() {
if ( options()->isTracking ) {
options()->isTracking = false;
actTrack->setIconSet( BarIcon( "unlock" ) );
actTrack->setIconSet( BarIcon( "decrypted" ) );
skymap->setClickedObject( NULL );
skymap->setFoundObject( NULL );//no longer tracking foundObject
} else {
options()->isTracking = true;
actTrack->setIconSet( BarIcon( "lock" ) );
actTrack->setIconSet( BarIcon( "encrypted" ) );
}
}
......
......@@ -7,10 +7,10 @@ Icon=kstars.png
MiniIcon=kstars.png
DocPath=kstars/index.html
GenericName=Desktop Planetarium
GenericName[af]=Werkskerm Planetarium
GenericName[ar]=مرصد سطح المكتب
GenericName[be]=Кампутарны плянэтарый
GenericName[bg]=Планетариум за рабоно място
GenericName[bs]=Planetarium na desktopu
GenericName[cs]=Planetárium
GenericName[da]=Planetarieprogram
GenericName[de]=Das Planetarium für den Schreibtisch
......@@ -18,17 +18,20 @@ GenericName[el]=Πλανητάριο για την Επιφάνεια εργασ
GenericName[eo]=Tabula stelobservejo
GenericName[es]=Planetario para el escritorio
GenericName[et]=Töölaua planetaarium
GenericName[eu]=Mahaiganeko Planetarioa
GenericName[fi]=Työpöytäplanetaario
GenericName[fr]=Une vue des étoiles pour le bureau
GenericName[fr]=Planétarium pour le bureau
GenericName[he]=פלנטריום שולחני
GenericName[hu]=mini planetárium
GenericName[is]=Skjáborðsstjörnusalur
GenericName[it]=Planetario per il desktop
GenericName[ja]=デスクトッププラネタリウム
GenericName[lt]=Darbastalio planetariumas
GenericName[lv]=Darbvirsmas Planetārijs
GenericName[nb]=Planetarium på skrivebordet
GenericName[nl]=desktop-planetarium
GenericName[nn]=Planetarium
GenericName[pt]=Planetário do Ecrã
GenericName[pl]=Planetarium na biurku
GenericName[pt]=Planetário
GenericName[pt_BR]=Planetário do Ambiente de trabalho
GenericName[ro]=Planetariu de ecran
GenericName[ru]=Настольный планетарий
......@@ -41,12 +44,15 @@ GenericName[ven]=Vhusembedzhwa mupo ya Desikithopo
GenericName[xh]=Umenzi Mkhulu we Desktop
GenericName[xx]=xx
GenericName[zh_CN]=桌面天文馆
GenericName[zh_TW]=桌面星象儀
GenericName[zu]=Desktop Yeplanethi
Terminal=0
Name=KStars
Name[af]=K-sterre
Name[ar]=نجوم ك
Name[be]=Зоркі
Name[eo]=Steloj
Name[pl]=Gwiazdy
Name[pt_BR]=Estrelas
Name[sv]=Kstars
Name[th]=ดวงดาว - K
......
......@@ -79,6 +79,8 @@ SkyMap::SkyMap(QWidget *parent, const char *name )
sky = new QPixmap();
pmenu = new QPopupMenu();
FoundObject = NULL;
ClickedObject = NULL;
}
SkyMap::~SkyMap() {
......@@ -176,10 +178,10 @@ void SkyMap::slotCenter( void ) {
setFoundObject( ClickedObject );
if ( foundObject() != NULL ) { //set tracking to true
ksw->options()->isTracking = true;
ksw->actTrack->setIconSet( BarIcon( "lock" ) );
ksw->actTrack->setIconSet( BarIcon( "encrypted" ) );
} else {
ksw->options()->isTracking = false;
ksw->actTrack->setIconSet( BarIcon( "unlock" ) );
ksw->actTrack->setIconSet( BarIcon( "decrypted" ) );
}
ksw->showFocusCoords(); //updateinfoPanel
......@@ -423,7 +425,7 @@ void SkyMap::keyPressEvent( QKeyEvent *e ) {
setClickedObject( NULL );
setFoundObject( NULL );//no longer tracking foundObject
ksw->options()->isTracking = false;
ksw->actTrack->setIconSet( BarIcon( "unlock" ) );
ksw->actTrack->setIconSet( BarIcon( "decrypted" ) );
}
ksw->showFocusCoords();
}
......@@ -446,7 +448,7 @@ void SkyMap::mouseMoveEvent( QMouseEvent *e ) {
if (!slewing) {
slewing = true;
ksw->options()->isTracking = false; //break tracking on slew
ksw->actTrack->setIconSet( BarIcon( "unlock" ) );
ksw->actTrack->setIconSet( BarIcon( "decrypted" ) );
setClickedObject( NULL );
setFoundObject( NULL );//no longer tracking foundObject
}
......@@ -1872,7 +1874,7 @@ void SkyMap::drawSymbol( QPainter &psky, int type, int x, int y, int size, QChar
if ( QT_VERSION >=300 && size==2 ) size = 1;
star = starpix->getPixmap (&color, size);
bitBlt ((QPaintDevice *) sky, x1-star->width()/2, y1-star->height()/2, star);
bitBlt ((QPaintDevice *) sky, xa-star->width()/2, ya-star->height()/2, star);
break;
case 1: //catalog star
//Some NGC/IC objects are stars...changed their type to 1 (was double star)
......@@ -2018,8 +2020,8 @@ SkyPoint SkyMap::dXdYToRaDec( double dx, double dy, bool useAltAz, dms LSTh, dms
A = atan( yy/xx );
//resolve ambiguity of atan():
if ( xx<0 ) A = A + PI();
// if ( xx>0 && yy<0 ) A = A + 2.0*PI();
if ( xx<0 ) A = A + dms::PI;
// if ( xx>0 && yy<0 ) A = A + 2.0*dms::PI;
dms deltaAz;
deltaAz.setRadians( A );
......@@ -2048,8 +2050,8 @@ SkyPoint SkyMap::dXdYToRaDec( double dx, double dy, bool useAltAz, dms LSTh, dms
double RARad = ( atan( yy / xx ) );
//resolve ambiguity of atan():
if ( xx<0 ) RARad = RARad + PI();
// if ( xx>0 && yy<0 ) RARad = RARad + 2.0*PI();
if ( xx<0 ) RARad = RARad + dms::PI;
// if ( xx>0 && yy<0 ) RARad = RARad + 2.0*dms::PI;
dms deltaRA, Dec;
deltaRA.setRadians( RARad );
......
......@@ -40,7 +40,7 @@ void SkyPoint::EquatorialToHorizontal( dms LSTh, dms lat ) {
cosAlt = cos( AltRad );
AzRad = acos( ( sindec - sinlat*sinAlt )/( coslat*cosAlt ) );
if ( sinHA > 0.0 ) AzRad = 2.0*PI() - AzRad; // resolve acos() ambiguity
if ( sinHA > 0.0 ) AzRad = 2.0*dms::PI - AzRad; // resolve acos() ambiguity
Az.setRadians( AzRad );
Alt.setRadians( AltRad );
......@@ -65,17 +65,17 @@ void SkyPoint::HorizontalToEquatorial( dms LSTh, dms lat ) {
//Under certain circumstances, x can be very slightly less than -1.0000, or slightly
//greater than 1.0000, leading to a crash on acos(x). However, the value isn't
//*really* out of range; it's a kind of roundoff error.
if ( x < -1.0 && x > -1.000001 ) HARad = PI();
if ( x < -1.0 && x > -1.000001 ) HARad = dms::PI;
else if ( x > 1.0 && x < 1.000001 ) HARad = 0.0;
else if ( x < -1.0 ) {
kdWarning() << i18n( "Coordinate out of range!" );
HARad = PI();
HARad = dms::PI;
} else if ( x > 1.0 ) {
kdWarning() << i18n( "Coordinate out of range!" );
HARad = 0.0;
} else HARad = acos( x );
if ( sinAz > 0.0 ) HARad = 2.0*PI() - HARad; // resolve acos() ambiguity
if ( sinAz > 0.0 ) HARad = 2.0*dms::PI - HARad; // resolve acos() ambiguity
RA.setRadians( LSTh.radians() - HARad );
RA.setD( RA.reduce().Degrees() ); // 0 <= RA < 24
......@@ -100,8 +100,8 @@ void SkyPoint::setEcliptic( double ELong, double ELat, long double jd ) {
double RARad = atan( y / cosLong );
//resolve ambiguity of atan:
if ( cosLong < 0 ) RARad += PI();
if ( cosLong > 0 && y < 0 ) RARad += 2.0*PI();
if ( cosLong < 0 ) RARad += dms::PI;
if ( cosLong > 0 && y < 0 ) RARad += 2.0*dms::PI;
dms newRA, newDec;
newRA.setRadians( RARad );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment