Exemple #1
0
void PlanetViewer::updatePlanets() {
    KSNumbers num( ut.djd() );
    bool changed(false);

    //Check each planet to see if it needs to be updated
    for ( unsigned int i=0; i<9; ++i ) {
        if ( abs( int(ut.date().jd()) - LastUpdate[i] ) > UpdateInterval[i] ) {
            KSPlanetBase *p = PCat.findByName( pName[i] );
            p->findPosition( &num );

            double s, c, s2, c2;
            p->helEcLong()->SinCos( s, c );
            p->helEcLat()->SinCos( s2, c2 );
            planet[i]->point(0)->setX( p->rsun()*c*c2 );
            planet[i]->point(0)->setY( p->rsun()*s*c2 );
            planetLabel[i]->point(0)->setX( p->rsun()*c*c2 );
            planetLabel[i]->point(0)->setY( p->rsun()*s*c2 );

            if ( centerPlanet() == pName[i] ) {
                double xc = (pw->map->x2() + pw->map->x())*0.5;
                double yc = (pw->map->y2() + pw->map->y())*0.5;
                double dx = planet[i]->point(0)->x() - xc;
                double dy = planet[i]->point(0)->y() - yc;
                pw->map->setLimits( pw->map->x() + dx, pw->map->x2() + dx,
                                    pw->map->y() + dy, pw->map->y2() + dy );
            }

            LastUpdate[i] = int(ut.date().jd());
            changed = true;
        }
    }

    if ( changed ) pw->map->update();
}
Exemple #2
0
void PlanetCatalog::findPosition( const KSNumbers *num, const dms *lat, const dms *LST ) {
	Earth->findPosition(num);
	for (KSPlanetBase * ksp = planets.first(); ksp != 0; ksp = planets.next()) {
		ksp->findPosition(num, lat, LST, Earth);
	}
}