From b28bcaa4e45a4413dca28b8456069506468ed0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Fri, 22 Sep 2017 15:38:28 +0200 Subject: [PATCH] #1927 Paste Ascii data command. Create an empty summary plot --- .../RicPasteAsciiDataToSummaryPlotFeature.cpp | 20 +++++++++++++------ .../RicPasteAsciiDataToSummaryPlotFeature.h | 4 ++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp index df88ea2875..7208182813 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -96,12 +96,7 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered(bool isChecked) { return; } - summaryPlot = RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotCollection, nullptr); - if (!summaryPlot) - { - return; - } - summaryPlot->setDescription(pasteOptions.plotTitle()); + summaryPlot = createSummaryPlotAndAddToPlotCollection(summaryPlotCollection); } caf::PdmSettings::writeFieldsToApplicationStore(&pasteOptions); @@ -240,3 +235,16 @@ RicPasteAsciiDataToSummaryPlotFeature::CurveType RicPasteAsciiDataToSummaryPlotF } return CURVE_UNKNOWN; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlot* RicPasteAsciiDataToSummaryPlotFeature::createSummaryPlotAndAddToPlotCollection(RimSummaryPlotCollection *plotCollection) +{ + auto summaryPlot = new RimSummaryPlot(); + summaryPlot->setDescription(QString("Summary Plot %1").arg(plotCollection->summaryPlots.size() + 1)); + plotCollection->summaryPlots().push_back(summaryPlot); + plotCollection->updateConnectedEditors(); + summaryPlot->loadDataAndUpdate(); + return summaryPlot; +} diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h index f9e55c20a1..c8dccb9efb 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h @@ -29,6 +29,8 @@ class RimSummaryCurve; class RimAsciiDataCurve; class RicPasteAsciiDataToSummaryPlotFeatureUi; +class RimSummaryPlotCollection; +class RimSummaryPlot; //================================================================================================== /// @@ -58,4 +60,6 @@ private: static std::vector parseCurves(QString& data, const RicPasteAsciiDataToSummaryPlotFeatureUi& settings); static CurveType guessCurveType(const QString& curveName); + + static RimSummaryPlot* createSummaryPlotAndAddToPlotCollection(RimSummaryPlotCollection *plotCollection); };