本文整理汇总了C++中StelObjectP::getVMagnitude方法的典型用法代码示例。如果您正苦于以下问题:C++ StelObjectP::getVMagnitude方法的具体用法?C++ StelObjectP::getVMagnitude怎么用?C++ StelObjectP::getVMagnitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StelObjectP
的用法示例。
在下文中一共展示了StelObjectP::getVMagnitude方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTargetFromSelection
void TargetsDialog::createTargetFromSelection()
{
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) {
QList<StelObjectP> selectedObjects = StelApp::getInstance().getStelObjectMgr().getSelectedObject();
QListIterator<StelObjectP> objectIterator(selectedObjects);
StelCore* core = StelApp::getInstance().getCore();
while (objectIterator.hasNext()) {
StelObjectP stelObject = objectIterator.next();
QString type = stelObject->getType();
QString englishName = stelObject->getEnglishName();
if (englishName == "") {
englishName = "No Name";
}
float magnatude = stelObject->getVMagnitude(core);
double angularSize = stelObject->getAngularSize(core);
Vec3d pos;
double ra, dec;
// ra/dec in J2000
pos = stelObject->getJ2000EquatorialPos(core);
StelUtils::rectToSphe(&ra, &dec, pos);
QSqlField field1("name", QVariant::String);
QSqlField field2("right_ascension", QVariant::Double);
QSqlField field3("declination", QVariant::Double);
QSqlField field4("target_type_id", QVariant::Int);
QSqlField field5("magnitude", QVariant::Double);
QSqlField field6("size", QVariant::Double);
field1.setValue(QVariant(englishName));
field2.setValue(QVariant(ra));
field3.setValue(QVariant(dec));
field4.setValue(QVariant(1));
field5.setValue(QVariant(magnatude));
field6.setValue(QVariant(angularSize));
QSqlRecord newRecord = QSqlRecord();
newRecord.append(field1);
newRecord.append(field2);
newRecord.append(field3);
newRecord.append(field4);
newRecord.append(field5);
newRecord.append(field6);
if (tableModel->insertRecord(-1, newRecord)) {
ui->targetsListView->setCurrentIndex(tableModel->index(tableModel->rowCount() - 1, 1));
} else {
qWarning() << "LogBook: could not insert new target. The error is: " << tableModel->lastError();
}
}
} else {
qDebug() << "====> Nothing selected.";
}
}