Exemplo n.º 1
0
void JMoonTool::initPlotObjects() {
    KPlotObject *orbit[4];
    KPlotObject *jpath;
    long double jd0 = ksw->data()->ut().djd();
    KSSun *ksun = (KSSun*)ksw->data()->skyComposite()->findByName( "Sun" );
    KSPlanet *jup = (KSPlanet*)ksw->data()->skyComposite()->findByName( i18n("Jupiter") );
    JupiterMoons jm;

    pw->removeAllPlotObjects();

    orbit[0] = new KPlotObject( colIo, KPlotObject::Lines, 1.0 );
    orbit[1] = new KPlotObject( colEu, KPlotObject::Lines, 1.0 );
    orbit[2] = new KPlotObject( colGn, KPlotObject::Lines, 1.0 );
    orbit[3] = new KPlotObject( colCa, KPlotObject::Lines, 1.0 );
    jpath    = new KPlotObject( colJp, KPlotObject::Lines, 1.0 );

    QRectF dataRect = pw->dataRect();
    double dy = 0.01*dataRect.height();

    //t is the offset from jd0, in days.
    for ( double t=dataRect.y(); t<=dataRect.bottom(); t+=dy ) {
        KSNumbers num( jd0 + t );
        jm.findPosition( &num, jup, ksun );

        //jm.x(i) tells the offset from Jupiter, in units of Jupiter's angular radius.
        //multiply by 0.5*jup->angSize() to get arcminutes
        for ( unsigned int i=0; i<4; ++i )
            orbit[i]->addPoint( 0.5*jup->angSize()*jm.x(i), t );

        jpath->addPoint( 0.0, t );
    }

    for ( unsigned int i=0; i<4; ++i )
        pw->addPlotObject( orbit[i] );

    pw->addPlotObject( jpath );
}
Exemplo n.º 2
0
void JMoonTool::initPlotObjects() {
	KPlotObject *orbit[4];
	KPlotObject *jpath;
	long double jd0 = ksw->data()->ut().djd();
	KSSun *ksun = (KSSun*)ksw->data()->PCat->findByName( "Sun" );
	KSPlanet *jup = (KSPlanet*)ksw->data()->PCat->findByName( "Jupiter" );
	JupiterMoons jm;
	
	if ( pw->objectCount() ) pw->clearObjectList();
	
	orbit[0] = new KPlotObject( "io", colIo, KPlotObject::CURVE, 1, KPlotObject::SOLID );
	orbit[1] = new KPlotObject( "europa", colEu, KPlotObject::CURVE, 1, KPlotObject::SOLID );
	orbit[2] = new KPlotObject( "ganymede", colGn, KPlotObject::CURVE, 1, KPlotObject::SOLID );
	orbit[3] = new KPlotObject( "callisto", colCa, KPlotObject::CURVE, 1, KPlotObject::SOLID );
	jpath    = new KPlotObject( "jupiter", colJp, KPlotObject::CURVE, 1, KPlotObject::SOLID );
	
	double dy = 0.01*pw->dataHeight();
	
	//t is the offset from jd0, in hours.
	for ( double t=pw->y(); t<=pw->y2(); t+=dy ) {
		KSNumbers num( jd0 + t/24.0 );
		jm.findPosition( &num, jup, ksun );
		
		//jm.x(i) tells the offset from Jupiter, in units of Jupiter's angular radius.
		//multiply by 0.5*jup->angSize() to get arcminutes
		for ( unsigned int i=0; i<4; ++i ) 
			orbit[i]->addPoint( new DPoint( 0.5*jup->angSize()*jm.x(i), t ) );
		
		jpath->addPoint( new DPoint( 0.0, t ) );
	}

	for ( unsigned int i=0; i<4; ++i ) 
		pw->addObject( orbit[i] );

	pw->addObject( jpath );
}