//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- 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(); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection(RimSummaryPlot *sourcePlot) { RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlotCollection*>(); if (plotColl) { RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>(sourcePlot->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance())); CVF_ASSERT(newSummaryPlot); plotColl->summaryPlots.push_back(newSummaryPlot); // Resolve references after object has been inserted into the data model newSummaryPlot->resolveReferencesRecursively(); newSummaryPlot->initAfterReadRecursively(); QString nameOfCopy = QString("Copy of ") + newSummaryPlot->description(); newSummaryPlot->setDescription(nameOfCopy); plotColl->updateConnectedEditors(); newSummaryPlot->loadDataAndUpdate(); } }