示例#1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar()
{
    RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>(m_activePlotViewWindow.p());
    if (summaryPlot)
    {
        std::vector<caf::PdmFieldHandle*> toolBarFields;
        toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
    
        if (!m_summaryPlotToolBarEditor->isEditorDataValid(toolBarFields))
        {
            m_summaryPlotToolBarEditor->setFields(toolBarFields);
            m_summaryPlotToolBarEditor->updateUi();
        }

        m_summaryPlotToolBarEditor->show();
    }
    else
    {
        m_summaryPlotToolBarEditor->clear();

        m_summaryPlotToolBarEditor->hide();
    }

    refreshToolbars();
}
示例#2
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::updateSummaryPlotToolBar(bool forceUpdateUi)
{
    RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>(m_activePlotViewWindow.p());
    if (summaryPlot)
    {
        std::vector<caf::PdmFieldHandle*> toolBarFields;

        RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr;

        caf::PdmObjectHandle* selectedObj =
            dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());
        if (selectedObj)
        {
            selectedObj->firstAncestorOrThisOfType(ensembleCurveSetColl);
        }

        if (ensembleCurveSetColl)
        {
            toolBarFields = ensembleCurveSetColl->fieldsToShowInToolbar();
        }
        else
        {
            toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
        }

        if (!m_summaryPlotToolBarEditor->isEditorDataValid(toolBarFields))
        {
            m_summaryPlotToolBarEditor->setFields(toolBarFields);
        }
        else if (forceUpdateUi)
        {
            m_summaryPlotToolBarEditor->updateUi();
        }

        m_summaryPlotToolBarEditor->updateUi();

        m_summaryPlotToolBarEditor->show();
    }
    else
    {
        m_summaryPlotToolBarEditor->clear();

        m_summaryPlotToolBarEditor->hide();
    }

    refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicClearSourceSteppingSummaryCurveFeature::isCommandEnabled()
{
    std::vector<caf::PdmObject*> objects;
    caf::SelectionManager::instance()->objectsByType(&objects);

    if (objects.size() == 1)
    {
        auto c = objects[0];

        RimSummaryPlot* summaryPlot = nullptr;
        c->firstAncestorOrThisOfTypeAsserted(summaryPlot);
        if (summaryPlot)
        {
            if (summaryPlot->ensembleCurveSetCollection()->curveSetForSourceStepping()
                || summaryPlot->summaryCurveCollection()->curveForSourceStepping())
            {
                return true;
            }
        }
    }

    return false;
}