Exemplo n.º 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();
        }
    }
}