当前位置: 首页>>代码示例>>C++>>正文


C++ Universe::getStarCatalog方法代码示例

本文整理汇总了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 "";
    }
}
开发者ID:sanyaade-embedded-systems,项目名称:STA,代码行数:30,代码来源:url.cpp

示例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();
}
开发者ID:nisselarsson,项目名称:Celestia,代码行数:49,代码来源:qtappwin.cpp

示例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();
    }
}
开发者ID:sanyaade-embedded-systems,项目名称:STA,代码行数:45,代码来源:qtsolarsystembrowser.cpp


注:本文中的Universe::getStarCatalog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。