Example #1
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::createNewPlot()
{
    RimProject* proj = RiaApplication::instance()->project();

    RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection();
    if (summaryPlotColl)
    {
        RimSummaryPlot* newSummaryPlot = nullptr;
        if (m_useAutoPlotTitleProxy())
        {
            newSummaryPlot = summaryPlotColl->createSummaryPlotWithAutoTitle();
        }
        else
        {
            QString candidatePlotName;
            if (m_previewPlot)
            {
                candidatePlotName = m_previewPlot->generatedPlotTitleFromAllCurves();
            }

            {
                bool ok           = false;
                candidatePlotName = QInputDialog::getText(nullptr,
                                                          "New Summary Plot Name",
                                                          "New Summary Plot Name",
                                                          QLineEdit::Normal,
                                                          candidatePlotName,
                                                          &ok,
                                                          RiuTools::defaultDialogFlags());
                if (!ok)
                {
                    return;
                }

                newSummaryPlot = summaryPlotColl->createNamedSummaryPlot(candidatePlotName);
            }
        }

        if (newSummaryPlot)
        {
            newSummaryPlot->loadDataAndUpdate();

            summaryPlotColl->updateConnectedEditors();

            m_targetPlot = newSummaryPlot;
            updateTargetPlot();
        }
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSummaryCaseCollection* ensemble)
{
    RiaApplication* app  = RiaApplication::instance();
    RimProject*     proj = app->project();

    RimSummaryPlotCollection* summaryPlotCollection = proj->mainPlotCollection->summaryPlotCollection();
    RimSummaryPlot*           plot                  = summaryPlotCollection->createSummaryPlotWithAutoTitle();

    RimEnsembleCurveSet* curveSet = RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet(plot, ensemble);
    plot->loadDataAndUpdate();
    summaryPlotCollection->updateConnectedEditors();

    RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
    if (mainPlotWindow)
    {
        mainPlotWindow->selectAsCurrentItem(curveSet);
        mainPlotWindow->updateSummaryPlotToolBar();
    }
}