本文整理汇总了C++中KStarsDateTime类的典型用法代码示例。如果您正苦于以下问题:C++ KStarsDateTime类的具体用法?C++ KStarsDateTime怎么用?C++ KStarsDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KStarsDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getEpoch
void modCalcAzel::slotComputeCoords()
{
SkyPoint sp;
double epoch0 = getEpoch( epochName->text() );
KStarsDateTime dt;
dt.setFromEpoch( epoch0 );
long double jd = getDateTime().djd();
long double jd0 = dt.djd();
dms LST( getDateTime().gst().Degrees() + getLongitude().Degrees() );
if(radioApCoords->isChecked()) {
sp = getEquCoords();
sp.apparentCoord(jd0, jd);
dms lat(getLatitude());
sp.EquatorialToHorizontal( &LST, &lat );
showHorCoords( sp );
} else {
sp = getHorCoords();
dms lat(getLatitude());
sp.HorizontalToEquatorial( &LST, &lat );
showEquCoords( sp );
}
}
示例2: parent
void modCalcAzel::showCurrentDateTime (void)
{
KStars *ks = (KStars*) parent()->parent()->parent();
KStarsDateTime dt = ks->data()->geo()->LTtoUT( KStarsDateTime::currentDateTime() );
datBox->setDate( dt.date() );
timBox->setTime( dt.time() );
dateBoxBatch->setDate( dt.date() );
utBoxBatch->setTime( dt.time() );
}
示例3: Q_ASSERT
SkyPoint SkyPoint::timeTransformed( const SkyPoint *p, const KStarsDateTime &dt, const GeoLocation *geo, const double hour ) {
Q_ASSERT( p );
if( !p )
return SkyPoint( NaN::d, NaN::d );
// Jasem 2015-08-24 Using correct procedure to find altitude
SkyPoint sp = *p; // make a copy
KStarsDateTime targetDateTime = dt.addSecs( hour * 3600.0 );
dms LST = geo->GSTtoLST( targetDateTime.gst() );
sp.EquatorialToHorizontal( &LST, geo->lat() );
return sp;
}
示例4: slotGoto
void ConjunctionsTool::slotGoto() {
int index = m_SortModel->mapToSource( OutputList->currentIndex() ).row(); // Get the number of the line
long double jd = outputJDList.value( index );
KStarsDateTime dt;
KStars *ks = KStars::Instance();
KStarsData *data = KStarsData::Instance();
SkyMap *map = ks->map();
// Show conjunction
data->setLocation( *geoPlace );
dt.setDJD( jd );
data->changeDateTime( dt );
map->setClickedObject( data->skyComposite()->findByName( m_Model->data( m_Model->index( index, 2 ) ).toString() ) );
map->setClickedPoint( map->clickedObject() );
map->slotCenter();
}
示例5: showEpoch
void modCalcAzel::showEpoch( const KStarsDateTime &dt )
{
double epochN = dt.epoch();
// Localization
// epochName->setText(KGlobal::locale()->formatNumber(epochN,3));
epochName->setText( KGlobal::locale()->formatNumber( epochN ) );
}
示例6: dms
QTime SkyObject::transitTimeUT( const KStarsDateTime &dt, const GeoLocation *geo ) {
dms LST = geo->GSTtoLST( dt.gst() );
//dSec is the number of seconds until the object transits.
dms HourAngle = dms( LST.Degrees() - ra()->Degrees() );
int dSec = int( -3600.*HourAngle.Hours() );
//dt0 is the first guess at the transit time.
KStarsDateTime dt0 = dt.addSecs( dSec );
//recompute object's position at UT0 and then find
//transit time of this refined position
SkyPoint sp = recomputeCoords( dt0, geo );
const dms *ram = sp.ra0();
HourAngle = dms ( LST.Degrees() - ram->Degrees() );
dSec = int( -3600.*HourAngle.Hours() );
return dt.addSecs( dSec ).time();
}
示例7: QTime
QTime SkyObject::riseSetTime( const KStarsDateTime &dt, const GeoLocation *geo, bool rst ) {
//this object does not rise or set; return an invalid time
if ( checkCircumpolar(geo->lat()) )
return QTime( 25, 0, 0 );
//First of all, if the object is below the horizon at date/time dt, adjust the time
//to bring it above the horizon
KStarsDateTime dt2 = dt;
SkyPoint p = recomputeCoords( dt, geo );
p.EquatorialToHorizontal( &(geo->GSTtoLST( dt.gst() )), geo->lat() );
if ( p.alt()->Degrees() < 0.0 ) {
if ( p.az()->Degrees() < 180.0 ) { //object has not risen yet
dt2 = dt.addSecs( 12.*3600. );
} else { //object has already set
dt2 = dt.addSecs( -12.*3600. );
}
}
return geo->UTtoLT( KStarsDateTime( dt2.date(), riseSetTimeUT( dt2, geo, rst ) ) ).time();
}
示例8: computeMoonPhase
unsigned short MoonPhaseCalendar::computeMoonPhase( const KStarsDateTime &date ) {
KSNumbers num( date.djd() );
KSPlanet earth( I18N_NOOP( "Earth" ), QString(), QColor( "white" ), 12756.28 /*diameter in km*/ );
earth.findPosition( &num );
m_Moon.findGeocentricPosition( &num, &earth );
m_Moon.findPhase();
return m_Moon.getIPhase();
}
示例9: recomputeCoords
SkyPoint SkyObject::recomputeCoords( const KStarsDateTime &dt, const GeoLocation *geo ) {
//store current position
SkyPoint original( ra(), dec() );
// compute coords for new time jd
KSNumbers num( dt.djd() );
if ( isSolarSystem() && geo ) {
dms LST = geo->GSTtoLST( dt.gst() );
updateCoords( &num, true, geo->lat(), &LST );
} else {
updateCoords( &num );
}
//the coordinates for the date dt:
SkyPoint sp = SkyPoint( ra(), dec() );
// restore original coords
setRA( original.ra()->Hours() );
setDec( original.dec()->Degrees() );
return sp;
}
示例10: qDebug
KStarsDateTime KStarsDateTime::fromString( const QString &s ) {
//DEBUG
qDebug() << "Date string: " << s;
KStarsDateTime dtResult = QDateTime::fromString( s, Qt::TextDate );
if ( dtResult.isValid() )
return dtResult;
dtResult = QDateTime::fromString( s, Qt::ISODate );
if ( dtResult.isValid() )
return dtResult;
//dtResult = QDateTime::fromString( s, QDateTime::RFCDate );
dtResult = QDateTime::fromString( s, Qt::RFC2822Date );
if ( dtResult.isValid() )
return dtResult;
qWarning() << i18n( "Could not parse Date/Time string: " ) << s ;
qWarning() << i18n( "Valid date formats: " ) ;
qWarning() << " 1950-02-25 ; 1950-02-25T05:30:00" ;
qWarning() << " 25 Feb 1950 ; 25 Feb 1950 05:30:00" ;
qWarning() << " Sat Feb 25 1950 ; Sat Feb 25 05:30:00 1950";
return KStarsDateTime( QDateTime() ); //invalid
}
示例11: auxRiseSetTimeUT
QTime SkyObject::auxRiseSetTimeUT( const KStarsDateTime &dt, const GeoLocation *geo,
const dms *righta, const dms *decl, bool riseT) {
dms LST = auxRiseSetTimeLST( geo->lat(), righta, decl, riseT );
return dt.GSTtoUT( geo->LSTtoGST( LST ) );
}
示例12: rst
dms SkyObject::riseSetTimeLST( const KStarsDateTime &dt, const GeoLocation *geo, bool riseT ) {
KStarsDateTime rst( dt.date(), riseSetTimeUT( dt, geo, riseT) );
return geo->GSTtoLST( rst.gst() );
}
示例13: ok1
void modCalcVlsr::slotCompute()
{
bool ok1(false), ok2(false);
SkyPoint sp( RA->createDms(false, &ok1), Dec->createDms(true, &ok2) );
if ( !ok1 || !ok2 ) return;
KStarsDateTime dt = Date->dateTime();
double vst[3];
geoPlace->TopocentricVelocity( vst, dt.gst() );
if ( sender()->objectName() == "VLSR" ) velocityFlag = 0;
if ( sender()->objectName() == "VHelio" ) velocityFlag = 1;
if ( sender()->objectName() == "VGeo" ) velocityFlag = 2;
if ( sender()->objectName() == "VTopo" ) velocityFlag = 3;
switch ( velocityFlag ) {
case 0: //Hold VLSR constant, compute the others
{
double vlsr = VLSR->text().toDouble();
double vhelio = sp.vHeliocentric( vlsr, dt.djd() );
double vgeo = sp.vGeocentric( vhelio, dt.djd() );
VHelio->setText( QString::number( vhelio ) );
VGeo->setText( QString::number( vgeo ) );
VTopo->setText( QString::number( sp.vTopocentric(vgeo, vst) ) );
break;
}
case 1: //Hold VHelio constant, compute the others
{
double vhelio = VHelio->text().toDouble();
double vlsr = sp.vHelioToVlsr( vhelio, dt.djd() );
double vgeo = sp.vGeocentric( vhelio, dt.djd() );
VLSR->setText( QString::number( vlsr ) );
VGeo->setText( QString::number( vgeo ) );
VTopo->setText( QString::number( sp.vTopocentric(vgeo, vst) ) );
break;
}
case 2: //Hold VGeo constant, compute the others
{
double vgeo = VGeo->text().toDouble();
double vhelio = sp.vGeoToVHelio( vgeo, dt.djd() );
double vlsr = sp.vHelioToVlsr( vhelio, dt.djd() );
VLSR->setText( QString::number( vlsr ) );
VHelio->setText( QString::number( vhelio ) );
VTopo->setText( QString::number( sp.vTopocentric(vgeo, vst) ) );
break;
}
case 3: //Hold VTopo constant, compute the others
{
double vtopo = VTopo->text().toDouble();
double vgeo = sp.vTopoToVGeo( vtopo, vst );
double vhelio = sp.vGeoToVHelio( vgeo, dt.djd() );
double vlsr = sp.vHelioToVlsr( vhelio, dt.djd() );
VLSR->setText( QString::number( vlsr ) );
VHelio->setText( QString::number( vhelio ) );
VGeo->setText( QString::number( vgeo ) );
break;
}
default: //oops
kDebug() << i18n("Error: do not know which velocity to use for input.");
break;
}
}
示例14: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "kstars", 0, ki18n("KStars"),
KSTARS_VERSION, ki18n(description), KAboutData::License_GPL,
ki18n("(c) 2001-2012, The KStars Team"), ki18n(notice), "http://edu.kde.org/kstars");
aboutData.addAuthor(ki18n("Jason Harris"),KLocalizedString(), "[email protected]", "http://www.30doradus.org");
aboutData.addAuthor(ki18n("Jasem Mutlaq"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("James Bowlin"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Pablo de Vicente"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Thomas Kabelmann"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Heiko Evermann"),KLocalizedString(), "[email protected]", "http://www.evermann.de");
aboutData.addAuthor(ki18n("Carsten Niehaus"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Mark Hollomon"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Alexey Khudyakov"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Médéric Boquien"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Akarsh Simha"), KLocalizedString(), "[email protected]", "http://www.ph.utexas.edu/~asimha");
aboutData.addAuthor(ki18n("Jérôme Sonrier"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Prakash Mohan"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Victor Cărbune"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Henry de Valence"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Samikshan Bairagya"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Rafał Kułaga"), KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Rishab Arora"), KLocalizedString(), "[email protected]");
aboutData.addCredit(ki18n("Valery Kharitonov"), ki18n("Converted labels containing technical terms to links to documentation") );
aboutData.addCredit(ki18n("Ana-Maria Constantin"), ki18n("Technical documentation on Astronomy and KStars") );
aboutData.addCredit(ki18n("Andrew Stepanenko"), ki18n("Guiding code based on lin_guider") );
aboutData.addCredit(ki18n("Nuno Pinheiro"), ki18n("Artwork") );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add("!dump", ki18n( "Dump sky image to file" ));
options.add("script ", ki18n( "Script to execute" ));
options.add("width ", ki18n( "Width of sky image" ), "640");
options.add("height ", ki18n( "Height of sky image" ), "480");
options.add("filename ", ki18n( "Filename for sky image" ), "kstars.png");
options.add("date ", ki18n( "Date and time" ));
options.add("!paused", ki18n( "Start with clock paused" ));
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication a;
if ( args->isSet( "dump" ) ) {
kDebug() << i18n( "Dumping sky image" );
//parse filename and image format
const char* format = "PNG";
QString fname = args->getOption( "filename" );
QString ext = fname.mid( fname.lastIndexOf(".")+1 );
if ( ext.toLower() == "png" ) { format = "PNG"; }
else if ( ext.toLower() == "jpg" || ext.toLower() == "jpeg" ) { format = "JPG"; }
else if ( ext.toLower() == "gif" ) { format = "GIF"; }
else if ( ext.toLower() == "pnm" ) { format = "PNM"; }
else if ( ext.toLower() == "bmp" ) { format = "BMP"; }
else { kWarning() << i18n( "Could not parse image format of %1; assuming PNG.", fname ) ; }
//parse width and height
bool ok(false);
int w(0), h(0);
w = args->getOption( "width" ).toInt( &ok );
if ( ok ) h = args->getOption( "height" ).toInt( &ok );
if ( !ok ) {
kWarning() << "Unable to parse arguments: " ;
kWarning() << "Width: " << args->getOption( "width" )
<< " Height: " << args->getOption( "height" ) << endl;
return 1;
}
KStarsData *dat = KStarsData::Create();
QObject::connect( dat, SIGNAL( progressText(QString) ), dat, SLOT( slotConsoleMessage(QString) ) );
dat->initialize();
//Set Geographic Location
dat->setLocationFromOptions();
//Set color scheme
dat->colorScheme()->loadFromConfig();
//set clock now that we have a location:
//Check to see if user provided a date/time string. If not, use current CPU time
QString datestring = args->getOption( "date" );
KStarsDateTime kdt;
if ( ! datestring.isEmpty() ) {
if ( datestring.contains( "-" ) ) { //assume ISODate format
if ( datestring.contains( ":" ) ) { //also includes time
kdt = KDateTime::fromString( datestring, KDateTime::ISODate );
} else { //string probably contains date only
kdt.setDate( QDate::fromString( datestring, Qt::ISODate ) );
kdt.setTime( QTime( 0, 0, 0 ) );
}
} else { //assume Text format for date string
kdt = dat->geo()->LTtoUT( KDateTime::fromString( datestring, KDateTime::QtTextDate ) );
}
if ( ! kdt.isValid() ) {
kWarning() << i18n( "Using CPU date/time instead." ) ;
kdt = KStarsDateTime::currentUtcDateTime();
//.........这里部分代码省略.........
示例15: KStarsDateTime
void modCalcAltAz::slotDateTimeChanged(const QDateTime &dt)
{
KStarsDateTime ut = geoPlace->LTtoUT( KStarsDateTime( dt ) );
LST = geoPlace->GSTtoLST( ut.gst() );
}