From 0baf2226a244b39a6f31b69038c141125b017bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Mon, 2 Jul 2018 13:06:07 +0200 Subject: [PATCH] #3087 Show plot data. Do not display tabs when only ascii data curves exist. Bugfixes --- .../Tools/RiaTimeHistoryCurveResampler.cpp | 2 +- .../ApplicationCommands/RicShowPlotDataFeature.cpp | 11 +++++++++-- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 13 +++++++++++-- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 ++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp b/ApplicationCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp index dc3b6fc919..7609d38ff7 100644 --- a/ApplicationCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp +++ b/ApplicationCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp @@ -90,7 +90,7 @@ const std::vector& RiaTimeHistoryCurveResampler::resampledValues() const //-------------------------------------------------------------------------------------------------- std::vector RiaTimeHistoryCurveResampler::timeStepsFromTimeRange(DateTimePeriod period, time_t minTime, time_t maxTime) { - CVF_ASSERT(minTime <= maxTime); + if(minTime > maxTime) return std::vector(); auto firstOriginalTimeStep = QDT::fromTime_t(minTime); auto lastOriginalTimeStep = QDT::fromTime_t(maxTime); diff --git a/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp index 21e27cbe88..78dbe0b98f 100644 --- a/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp +++ b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp @@ -88,9 +88,16 @@ void RicShowPlotDataFeature::onActionTriggered(bool isChecked) for (RimSummaryPlot* summaryPlot : selectedSummaryPlots) { QString title = summaryPlot->description(); - QString text = summaryPlot->asciiDataForPlotExport(); - RicShowPlotDataFeature::showTabbedTextWindow(title, [summaryPlot](DateTimePeriod period) { return summaryPlot->asciiDataForPlotExport(period); }); + if (summaryPlot->containsResamplableCurves()) + { + RicShowPlotDataFeature::showTabbedTextWindow(title, [summaryPlot](DateTimePeriod period) { return summaryPlot->asciiDataForPlotExport(period); }); + } + else + { + QString text = summaryPlot->asciiDataForPlotExport(); + RicShowPlotDataFeature::showTextWindow(title, text); + } } for (RimWellLogPlot* wellLogPlot : wellLogPlots) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 9c02401945..99de43e049 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -511,6 +511,14 @@ void RimSummaryPlot::updatePlotInfoLabel() showPlotInfoLabel(anyCurveSetFiltered); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlot::containsResamplableCurves() const +{ + return !m_gridTimeHistoryCurves.empty() || !summaryAndEnsembleCurves().empty(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1739,6 +1747,9 @@ void prepareCaseCurvesForExport(DateTimePeriod period, ResampleAlgorithm algorit if (period != DateTimePeriod::NONE) { + // Prepare result data + resultCurvesData->resamplePeriod = period; + for (size_t i = 0; i < inputCurvesData.caseNames.size(); i++) { // Shortcuts to input data @@ -1747,8 +1758,6 @@ void prepareCaseCurvesForExport(DateTimePeriod period, ResampleAlgorithm algorit auto& caseCurveData = inputCurvesData.allCurveData[i]; // Prepare result data - resultCurvesData->resamplePeriod = period; - //resultCurvesData->resampleAlgorithm = algorithm; resultCurvesData->caseNames.push_back(caseName); resultCurvesData->allCurveData.push_back(std::vector()); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h index 1beb5cee24..7ac24b7c6b 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -126,6 +126,8 @@ public: void showPlotInfoLabel(bool show); void updatePlotInfoLabel(); + bool containsResamplableCurves() const; + // RimViewWindow overrides public: virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;