本文整理汇总了C++中Universe::getStarCatalog方法的典型用法代码示例。如果您正苦于以下问题:C++ Universe::getStarCatalog方法的具体用法?C++ Universe::getStarCatalog怎么用?C++ Universe::getStarCatalog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Universe
的用法示例。
在下文中一共展示了Universe::getStarCatalog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBodyName
// Utility function that returns the complete path for a selection.
string
getSelectionName(const Selection& selection, CelestiaCore* appCore)
{
Universe *universe = appCore->getSimulation()->getUniverse();
switch (selection.getType())
{
case Selection::Type_Body:
return getBodyName(universe, selection.body());
case Selection::Type_Star:
return universe->getStarCatalog()->getStarName(*selection.star());
case Selection::Type_DeepSky:
return universe->getDSOCatalog()->getDSOName(selection.deepsky());
case Selection::Type_Location:
{
std::string name = selection.location()->getName();
Body* parentBody = selection.location()->getParentBody();
if (parentBody != NULL)
name = getBodyName(universe, parentBody) + ":" + name;
return name;
}
default:
return "";
}
}
示例2: slotAddBookmark
void CelestiaAppWindow::slotAddBookmark()
{
// Set the default bookmark title to the name of the current selection
Selection sel = m_appCore->getSimulation()->getSelection();
QString defaultTitle;
if (sel.body() != NULL)
{
defaultTitle = QString::fromUtf8(sel.body()->getName(true).c_str());
}
else if (sel.star() != NULL)
{
Universe* universe = m_appCore->getSimulation()->getUniverse();
defaultTitle = QString::fromUtf8(ReplaceGreekLetterAbbr(universe->getStarCatalog()->getStarName(*sel.star(), true)).c_str());
}
else if (sel.deepsky() != NULL)
{
Universe* universe = m_appCore->getSimulation()->getUniverse();
defaultTitle = QString::fromUtf8(ReplaceGreekLetterAbbr(universe->getDSOCatalog()->getDSOName(sel.deepsky(), true)).c_str());
}
else if (sel.location() != NULL)
{
defaultTitle = sel.location()->getName().c_str();
}
if (defaultTitle.isEmpty())
defaultTitle = _("New bookmark");
CelestiaState appState;
appState.captureState(m_appCore);
// Capture the current frame buffer to use as a bookmark icon.
QImage grabbedImage = glWidget->grabFrameBuffer();
int width = grabbedImage.width();
int height = grabbedImage.height();
// Crop the image to a square.
QImage iconImage;
if (width > height)
iconImage = grabbedImage.copy((width - height) / 2, 0, height, height);
else
iconImage = grabbedImage.copy(0, (height - width) / 2, width, width);
AddBookmarkDialog dialog(m_bookmarkManager, defaultTitle, appState, iconImage);
dialog.exec();
populateBookmarkMenu();
m_bookmarkToolBar->rebuild();
}
示例3: data
// Override QAbstractTableModel::data()
QVariant SolarSystemTreeModel::data(const QModelIndex& index, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
TreeItem* item = itemAtIndex(index);
// See if the tree item is a group
if (item->classification != 0)
{
if (index.column() == NameColumn)
return classificationName(item->classification);
else
return QVariant();
}
// Tree item is an object, not a group
Selection sel = item->obj;
switch (index.column())
{
case NameColumn:
if (sel.star() != NULL)
{
string starNameString = ReplaceGreekLetterAbbr(universe->getStarCatalog()->getStarName(*sel.star()));
return QString::fromUtf8(starNameString.c_str());
}
else if (sel.body() != NULL)
{
return QVariant(sel.body()->getName().c_str());
}
else
{
return QVariant();
}
case TypeColumn:
return objectTypeName(sel);
default:
return QVariant();
}
}