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


C++ Selection::deepsky方法代码示例

本文整理汇总了C++中Selection::deepsky方法的典型用法代码示例。如果您正苦于以下问题:C++ Selection::deepsky方法的具体用法?C++ Selection::deepsky怎么用?C++ Selection::deepsky使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Selection的用法示例。


在下文中一共展示了Selection::deepsky方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: buildInfoPage

void InfoPanel::buildInfoPage(Selection sel,
                              Universe* universe,
                              double tdb)
{
    QString pageText;
    QTextStream stream(&pageText, QIODevice::WriteOnly);

    pageHeader(stream);

    if (sel.body() != NULL)
    {
        buildSolarSystemBodyPage(sel.body(), tdb, stream);
    }
    else if (sel.star() != NULL)
    {
        buildStarPage(sel.star(), universe, tdb, stream);
    }
    else if (sel.deepsky() != NULL)
    {
        buildDSOPage(sel.deepsky(), universe, stream);
    }
    else
    {
        stream << "Error: no object selected!\n";
    }

    pageFooter(stream);

    textBrowser->setHtml(pageText);
}
开发者ID:sanyaade-embedded-systems,项目名称:STA,代码行数:30,代码来源:qtinfopanel.cpp

示例2: 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

示例3: object_setvisible

// Set the object visibility flag.
static int object_setvisible(lua_State* l)
{
    CelxLua celx(l);
    celx.checkArgs(2, 2, "One argument expected to object:setvisible()");
    
    Selection* sel = this_object(l);
    bool visible = celx.safeGetBoolean(2, AllErrors, "Argument to object:setvisible() must be a boolean");
    if (sel->body() != NULL)
    {
        sel->body()->setVisible(visible);
    }
    else if (sel->deepsky() != NULL)
    {
        sel->deepsky()->setVisible(visible);
    }
    
    return 0;
}
开发者ID:jpcoles,项目名称:ZM,代码行数:19,代码来源:celx_object.cpp

示例4: 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

示例5: if

SelectionPopup::SelectionPopup(const Selection& sel,
                               CelestiaCore* _appCore,
                               QWidget* parent) :
    QMenu(parent),
    selection(sel),
    appCore(_appCore),
    centerAction(NULL),
    gotoAction(NULL)
{
    Simulation* sim = appCore->getSimulation();
    Vec3d v = sel.getPosition(sim->getTime()) - sim->getObserver().getPosition();

    if (sel.body() != NULL)
    {
        addAction(boldTextItem(QString::fromUtf8(sel.body()->getName(true).c_str())));

        // Start and end dates
        double startTime = 0.0;
        double endTime = 0.0;
        sel.body()->getLifespan(startTime, endTime);
        
        if (startTime > -1.0e9 || endTime < 1.0e9)
        {
            addSeparator();

            if (startTime > -1.0e9)
            {
                ostringstream startDateStr;
                startDateStr << "Start: " << astro::TDBtoUTC(startTime);
                QAction* startDateAct = new QAction(startDateStr.str().c_str(), this);
                connect(startDateAct, SIGNAL(triggered()),
                        this, SLOT(slotGotoStartDate()));
                addAction(startDateAct);
            }

            if (endTime < 1.0e9)
            {
                ostringstream endDateStr;
                endDateStr << "End: " << astro::TDBtoUTC(endTime);
                QAction* endDateAct = new QAction(endDateStr.str().c_str(), this);
                connect(endDateAct, SIGNAL(triggered()),
                        this, SLOT(slotGotoEndDate()));
                addAction(endDateAct);
            }
        }

    }
    else if (sel.star() != NULL)
    {
        std::string name = sim->getUniverse()->getStarCatalog()->getStarName(*sel.star());
        addAction(boldTextItem(QString::fromUtf8(ReplaceGreekLetterAbbr(name).c_str())));
        
        // Add some text items giving additional information about
        // the star.
        double distance = v.length() * 1e-6;
        char buff[50];

        setlocale(LC_NUMERIC, "");

        if (abs(distance) >= astro::AUtoLightYears(1000.0f))
            sprintf(buff, "%.3f %s", distance, ("ly"));
        else if (abs(distance) >= astro::kilometersToLightYears(10000000.0))
            sprintf(buff, "%.3f %s", astro::lightYearsToAU(distance), ("au"));
        else if (abs(distance) > astro::kilometersToLightYears(1.0f))
            sprintf(buff, "%.3f km", astro::lightYearsToKilometers(distance));
        else
            sprintf(buff, "%.3f m", astro::lightYearsToKilometers(distance) * 1000.0f);

        addAction(italicTextItem(tr("Distance: ") + QString::fromUtf8(buff)));

        sprintf(buff, "%.2f (%.2f)",
                sel.star()->getAbsoluteMagnitude(),
                astro::absToAppMag(sel.star()->getAbsoluteMagnitude(),
                                   (float) distance));
        addAction(italicTextItem(tr("Abs (app) mag: ") + QString::fromUtf8(buff)));

        sprintf(buff, "%s", sel.star()->getSpectralType());
        addAction(italicTextItem(tr("Class: ") + QString::fromUtf8(buff)));

        setlocale(LC_NUMERIC, "C");
    }
    else if (sel.deepsky() != NULL)
    {
        addAction(boldTextItem(QString::fromUtf8(sim->getUniverse()->getDSOCatalog()->getDSOName(sel.deepsky()).c_str())));
    }

    addSeparator();

    QAction* selectAction = new QAction(tr("&Select"), this);
    connect(selectAction, SIGNAL(triggered()), this, SLOT(slotSelect()));
    addAction(selectAction);

    centerAction = new QAction(tr("&Center"), this);
    connect(centerAction, SIGNAL(triggered()), this, SLOT(slotCenterSelection()));
    addAction(centerAction);

    gotoAction = new QAction(tr("&Goto"), this);
    connect(gotoAction, SIGNAL(triggered()), this, SLOT(slotGotoSelection()));
    addAction(gotoAction);

//.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:STA,代码行数:101,代码来源:qtselectionpopup.cpp


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