本文整理汇总了C++中KStarsDateTime::epoch方法的典型用法代码示例。如果您正苦于以下问题:C++ KStarsDateTime::epoch方法的具体用法?C++ KStarsDateTime::epoch怎么用?C++ KStarsDateTime::epoch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KStarsDateTime
的用法示例。
在下文中一共展示了KStarsDateTime::epoch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 ) );
}
示例2: createCoordinatesTable
void DetailsTable::createCoordinatesTable(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo)
{
clearContents();
QTextCursor cursor = m_Document->rootFrame()->firstCursorPosition();
// Set column width constraints
QVector<QTextLength> constraints;
constraints << QTextLength(QTextLength::PercentageLength, 25)
<< QTextLength(QTextLength::PercentageLength, 25)
<< QTextLength(QTextLength::PercentageLength, 25)
<< QTextLength(QTextLength::PercentageLength, 25);
m_TableFormat.setColumnWidthConstraints(constraints);
// Insert table & row containing table name
QTextTable *table = cursor.insertTable(4, 4, m_TableFormat);
table->mergeCells(0, 0, 1, 4);
QTextBlockFormat centered;
centered.setAlignment(Qt::AlignCenter);
table->cellAt(0, 0).firstCursorPosition().setBlockFormat(centered);
table->cellAt(0, 0).firstCursorPosition().insertText(i18n("Coordinates"), m_TableTitleCharFormat);
//Coordinates Section:
//Don't use KLocale::formatNumber() for the epoch string,
//because we don't want a thousands-place separator!
QString sEpoch = QString::number(ut.epoch(), 'f', 1);
//Replace the decimal point with localized decimal symbol
sEpoch.replace('.', KGlobal::locale()->decimalSymbol());
table->cellAt(1, 0).firstCursorPosition().insertText(i18n("RA (%1):", sEpoch), m_ItemNameCharFormat);
table->cellAt(1, 0).firstCursorPosition().setBlockFormat(centered);
table->cellAt(1, 1).firstCursorPosition().insertText(obj->ra().toHMSString(), m_ItemValueCharFormat);
table->cellAt(2, 0).firstCursorPosition().insertText(i18n("Dec (%1):", sEpoch), m_ItemNameCharFormat);
table->cellAt(2, 0).firstCursorPosition().setBlockFormat(centered);
table->cellAt(2, 1).firstCursorPosition().insertText(obj->dec().toDMSString(), m_ItemValueCharFormat);
table->cellAt(3, 0).firstCursorPosition().insertText(i18n("Hour angle:"), m_ItemNameCharFormat);
table->cellAt(3, 0).firstCursorPosition().setBlockFormat(centered);
//Hour Angle can be negative, but dms HMS expressions cannot.
//Here's a kludgy workaround:
dms lst = geo->GSTtoLST(ut.gst());
dms ha(lst.Degrees() - obj->ra().Degrees());
QChar sgn('+');
if(ha.Hours() > 12.0)
{
ha.setH(24.0 - ha.Hours());
sgn = '-';
}
table->cellAt(3, 1).firstCursorPosition().insertText(QString("%1%2").arg(sgn).arg(ha.toHMSString()), m_ItemValueCharFormat);
table->cellAt(1, 2).firstCursorPosition().insertText(i18n("Azimuth:"), m_ItemNameCharFormat);
table->cellAt(1, 2).firstCursorPosition().setBlockFormat(centered);
table->cellAt(1, 3).firstCursorPosition().insertText(obj->az().toDMSString(), m_ItemValueCharFormat);
table->cellAt(2, 2).firstCursorPosition().insertText(i18n("Altitude:"), m_ItemNameCharFormat);
table->cellAt(2, 2).firstCursorPosition().setBlockFormat(centered);
dms a;
if(Options::useAltAz())
{
a = obj->alt();
}
else
{
a = obj->altRefracted();
}
table->cellAt(2, 3).firstCursorPosition().insertText(a.toDMSString(), m_ItemValueCharFormat);
table->cellAt(3, 2).firstCursorPosition().insertText(i18n("Airmass:"), m_ItemNameCharFormat);
table->cellAt(3, 2).firstCursorPosition().setBlockFormat(centered);
//Airmass is approximated as the secant of the zenith distance,
//equivalent to 1./sin(Alt). Beware of Inf at Alt=0!
QString aMassStr;
if(obj->alt().Degrees() > 0.0)
{
aMassStr = KGlobal::locale()->formatNumber(1./sin(obj->alt().radians() ), 2);
}
else
{
aMassStr = "--";
}
table->cellAt(3, 3).firstCursorPosition().insertText(aMassStr, m_ItemValueCharFormat);
// Restore the position and other time-dependent parameters
obj->recomputeCoords(ut, geo);
}