QString KStars::getObjectDataXML( const QString &objectName ) { SkyObject *target = data()->objectNamed( objectName ); if ( !target ) { return QString( "<xml></xml>" ); } QString output; QXmlStreamWriter stream( &output ); stream.setAutoFormatting( true ); stream.writeStartDocument(); stream.writeStartElement( "object" ); stream.writeTextElement( "Name", target->name() ); stream.writeTextElement( "Alt_Name", target->name2() ); stream.writeTextElement( "Long_Name", target->longname() ); stream.writeTextElement( "Constellation", KStarsData::Instance()->skyComposite()->getConstellationBoundary()->constellationName( target ) ); stream.writeTextElement( "RA_HMS", target->ra().toHMSString() ); stream.writeTextElement( "Dec_DMS", target->dec().toDMSString() ); stream.writeTextElement( "RA_J2000_HMS", target->ra0().toHMSString() ); stream.writeTextElement( "Dec_J2000_DMS", target->dec0().toDMSString() ); stream.writeTextElement( "RA_Degrees", QString::number( target->ra().Degrees() ) ); stream.writeTextElement( "Dec_Degrees", QString::number( target->dec().Degrees() ) ); stream.writeTextElement( "RA_J2000_Degrees", QString::number( target->ra0().Degrees() ) ); stream.writeTextElement( "Dec_J2000_Degrees", QString::number( target->dec0().Degrees() ) ); stream.writeTextElement( "Type", target->typeName() ); stream.writeTextElement( "Magnitude", QString::number( target->mag(), 'g', 2 ) ); stream.writeTextElement( "Position_Angle", QString::number( target->pa(), 'g', 3 ) ); StarObject *star = dynamic_cast< StarObject* >( target ); DeepSkyObject *dso = dynamic_cast< DeepSkyObject* >( target ); if ( star ) { stream.writeTextElement( "Spectral_Type", star->sptype() ); stream.writeTextElement( "Genetive_Name", star->gname() ); stream.writeTextElement( "Greek_Letter", star->greekLetter() ); stream.writeTextElement( "Proper_Motion", QString::number( star->pmMagnitude() ) ); stream.writeTextElement( "Proper_Motion_RA", QString::number( star->pmRA() ) ); stream.writeTextElement( "Proper_Motion_Dec", QString::number( star->pmDec() ) ); stream.writeTextElement( "Parallax_mas", QString::number( star->parallax() ) ); stream.writeTextElement( "Distance_pc", QString::number( star->distance() ) ); stream.writeTextElement( "Henry_Draper", QString::number( star->getHDIndex() ) ); stream.writeTextElement( "BV_Index", QString::number( star->getBVIndex() ) ); } else if ( dso ) { stream.writeTextElement( "Catalog", dso->catalog() ); stream.writeTextElement( "Major_Axis", QString::number( dso->a() ) ); stream.writeTextElement( "Minor_Axis", QString::number( dso->a() * dso->e() ) ); } stream.writeEndElement(); // object stream.writeEndDocument(); return output; }
void modCalcVlsr::slotFindObject() { QPointer<FindDialog> fd = new FindDialog( KStars::Instance() ); if ( fd->exec() == QDialog::Accepted ) { SkyObject *o = fd->selectedObject(); RA->showInHours( o->ra0() ); Dec->showInDegrees( o->dec0() ); } delete fd; }