2016-05-09 12:13:54 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2016 Statoil ASA
|
|
|
|
|
//
|
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "cafPdmChildArrayField.h"
|
2016-10-07 10:51:08 +02:00
|
|
|
|
2017-06-13 15:41:52 +02:00
|
|
|
#include "RiaDefines.h"
|
2018-06-19 15:39:27 +02:00
|
|
|
#include "RiaQDateTimeTools.h"
|
2017-12-13 07:40:37 +01:00
|
|
|
|
|
|
|
|
#include "RifEclipseSummaryAddress.h"
|
|
|
|
|
|
2016-10-07 10:51:08 +02:00
|
|
|
#include "RimViewWindow.h"
|
2016-05-09 12:13:54 +02:00
|
|
|
|
2018-06-27 13:10:39 +02:00
|
|
|
#include "qwt_plot_textlabel.h"
|
2016-05-09 12:13:54 +02:00
|
|
|
#include <QPointer>
|
|
|
|
|
|
2017-12-13 07:40:37 +01:00
|
|
|
#include <set>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
2017-09-14 13:56:50 +02:00
|
|
|
class PdmUiTreeOrdering;
|
|
|
|
|
class RimAsciiDataCurve;
|
|
|
|
|
class RimGridTimeHistoryCurve;
|
2017-09-05 13:26:50 +02:00
|
|
|
class RimSummaryCase;
|
2017-09-14 13:56:50 +02:00
|
|
|
class RimSummaryCurve;
|
2017-09-08 14:49:41 +02:00
|
|
|
class RimSummaryCurveCollection;
|
2018-04-19 14:00:00 +02:00
|
|
|
class RimEnsembleCurveSet;
|
|
|
|
|
class RimEnsembleCurveSetCollection;
|
2017-11-30 11:05:30 +01:00
|
|
|
class RimSummaryCurveFilter_OBSOLETE;
|
2016-10-11 19:40:45 +02:00
|
|
|
class RimSummaryTimeAxisProperties;
|
2017-11-14 12:33:24 +01:00
|
|
|
class RimSummaryAxisProperties;
|
2017-09-14 13:56:50 +02:00
|
|
|
class RiuSummaryQwtPlot;
|
2017-12-13 07:40:37 +01:00
|
|
|
class RimSummaryPlotNameHelper;
|
2016-10-07 10:51:08 +02:00
|
|
|
|
2016-10-13 09:33:50 +02:00
|
|
|
class QwtInterval;
|
2017-09-14 13:56:50 +02:00
|
|
|
class QwtPlotCurve;
|
2016-05-09 12:13:54 +02:00
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
//==================================================================================================
|
2016-05-24 10:37:10 +02:00
|
|
|
class RimSummaryPlot : public RimViewWindow
|
2016-05-09 12:13:54 +02:00
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
RimSummaryPlot();
|
2018-10-18 19:45:57 +02:00
|
|
|
~RimSummaryPlot() override;
|
2016-05-09 12:13:54 +02:00
|
|
|
|
2016-06-13 14:50:28 +02:00
|
|
|
void setDescription(const QString& description);
|
2016-10-27 11:03:13 +02:00
|
|
|
QString description() const;
|
2017-12-14 09:59:11 +01:00
|
|
|
|
|
|
|
|
void enableShowPlotTitle(bool enable);
|
|
|
|
|
void enableAutoPlotTitle(bool enable);
|
|
|
|
|
bool autoPlotTitle() const;
|
2016-10-27 11:03:13 +02:00
|
|
|
|
2017-09-23 08:47:04 +02:00
|
|
|
void addCurveAndUpdate(RimSummaryCurve* curve);
|
|
|
|
|
void addCurveNoUpdate(RimSummaryCurve* curve);
|
|
|
|
|
|
2017-09-12 15:26:11 +02:00
|
|
|
void deleteCurve(RimSummaryCurve* curve);
|
2018-09-13 12:38:17 +02:00
|
|
|
void deleteCurves(const std::vector<RimSummaryCurve*>& curves);
|
|
|
|
|
|
2017-09-14 13:56:50 +02:00
|
|
|
void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
|
2016-06-22 11:34:26 +02:00
|
|
|
|
2018-05-10 21:29:55 +02:00
|
|
|
RimEnsembleCurveSetCollection* ensembleCurveSetCollection() const;
|
2018-04-06 08:16:14 +02:00
|
|
|
|
2017-03-19 08:45:29 +01:00
|
|
|
void addGridTimeHistoryCurve(RimGridTimeHistoryCurve* curve);
|
|
|
|
|
|
2017-08-11 11:20:40 +02:00
|
|
|
void addAsciiDataCruve(RimAsciiDataCurve* curve);
|
|
|
|
|
|
2018-04-20 12:30:59 +02:00
|
|
|
caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const;
|
2017-02-10 08:39:25 +01:00
|
|
|
size_t curveCount() const;
|
2016-06-13 14:50:28 +02:00
|
|
|
|
2017-01-17 13:06:57 +01:00
|
|
|
void detachAllCurves();
|
2018-09-07 14:26:14 +02:00
|
|
|
void reattachAllCurves();
|
2016-07-06 13:35:24 +02:00
|
|
|
void updateCaseNameHasChanged();
|
2016-06-27 21:01:17 +02:00
|
|
|
|
2016-10-13 09:33:50 +02:00
|
|
|
void updateAxes();
|
2018-10-18 19:45:57 +02:00
|
|
|
void zoomAll() override;
|
2016-10-13 09:33:50 +02:00
|
|
|
|
2016-10-05 13:56:27 +02:00
|
|
|
void updateZoomInQwt();
|
2017-03-19 08:45:29 +01:00
|
|
|
void updateZoomWindowFromQwt();
|
2016-10-13 09:33:50 +02:00
|
|
|
|
2017-06-13 15:41:52 +02:00
|
|
|
bool isLogarithmicScaleEnabled(RiaDefines::PlotAxis plotAxis) const;
|
2016-10-07 15:36:52 +02:00
|
|
|
|
2016-11-22 11:13:34 +01:00
|
|
|
RimSummaryTimeAxisProperties* timeAxisProperties();
|
|
|
|
|
time_t firstTimeStepOfFirstCurve();
|
|
|
|
|
|
2016-10-14 15:38:21 +02:00
|
|
|
void selectAxisInPropertyEditor(int axis);
|
|
|
|
|
|
2018-10-18 19:45:57 +02:00
|
|
|
QWidget* viewWidget() override;
|
2016-10-27 11:03:13 +02:00
|
|
|
|
2018-06-19 15:39:27 +02:00
|
|
|
QString asciiDataForPlotExport(DateTimePeriod resamplingPeriod = DateTimePeriod::NONE) const;
|
2017-03-08 12:25:32 +01:00
|
|
|
|
2018-05-10 21:29:55 +02:00
|
|
|
std::vector<RimSummaryCurve*> summaryAndEnsembleCurves() const;
|
2017-09-14 15:40:41 +02:00
|
|
|
std::vector<RimSummaryCurve*> summaryCurves() const;
|
2017-09-15 14:34:33 +02:00
|
|
|
void deleteAllSummaryCurves();
|
2017-09-19 09:29:24 +02:00
|
|
|
RimSummaryCurveCollection* summaryCurveCollection() const;
|
2017-09-23 08:47:04 +02:00
|
|
|
RiuSummaryQwtPlot* qwtPlot() const;
|
|
|
|
|
|
2018-08-14 11:01:19 +02:00
|
|
|
std::vector<RimEnsembleCurveSet*> curveSets() const;
|
|
|
|
|
|
2017-11-23 14:12:05 +01:00
|
|
|
void updatePlotTitle();
|
|
|
|
|
|
2018-05-15 08:43:36 +02:00
|
|
|
const RimSummaryPlotNameHelper* activePlotTitleHelperAllCurves() const;
|
2017-12-14 09:59:11 +01:00
|
|
|
void updateCurveNames();
|
2018-05-15 08:43:36 +02:00
|
|
|
QString generatedPlotTitleFromAllCurves() const;
|
2017-12-13 07:40:37 +01:00
|
|
|
|
2018-01-25 21:16:24 +01:00
|
|
|
void copyAxisPropertiesFromOther(const RimSummaryPlot& sourceSummaryPlot);
|
|
|
|
|
|
2018-06-01 15:37:47 +02:00
|
|
|
void updateAll();
|
2018-09-07 14:26:14 +02:00
|
|
|
void updateAllLegendItems();
|
2018-06-01 15:37:47 +02:00
|
|
|
|
2018-06-27 13:10:39 +02:00
|
|
|
void setPlotInfoLabel(const QString& label);
|
|
|
|
|
void showPlotInfoLabel(bool show);
|
|
|
|
|
void updatePlotInfoLabel();
|
|
|
|
|
|
2018-07-02 13:06:07 +02:00
|
|
|
bool containsResamplableCurves() const;
|
2018-12-20 10:46:48 +01:00
|
|
|
|
|
|
|
|
size_t singleColorCurveCount() const;
|
2017-09-13 18:55:58 +02:00
|
|
|
// RimViewWindow overrides
|
|
|
|
|
public:
|
2018-10-18 19:45:57 +02:00
|
|
|
QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
|
|
|
|
void deleteViewWidget() override;
|
|
|
|
|
void initAfterRead() override;
|
2017-09-13 18:55:58 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updateMdiWindowTitle() override;
|
2018-05-15 08:43:36 +02:00
|
|
|
void updateNameHelperWithCurveData(RimSummaryPlotNameHelper* nameHelper) const;
|
2017-09-13 18:55:58 +02:00
|
|
|
|
2016-05-09 12:13:54 +02:00
|
|
|
protected:
|
|
|
|
|
// Overridden PDM methods
|
2018-10-18 19:45:57 +02:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
|
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
|
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
|
|
|
|
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
|
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
|
|
|
|
void onLoadDataAndUpdate() override;
|
|
|
|
|
|
|
|
|
|
QImage snapshotWindowContent() override;
|
2016-06-27 21:01:17 +02:00
|
|
|
|
2017-11-14 12:50:21 +01:00
|
|
|
void setAsCrossPlot();
|
|
|
|
|
|
2016-05-09 12:13:54 +02:00
|
|
|
private:
|
2017-06-13 15:41:52 +02:00
|
|
|
std::vector<RimSummaryCurve*> visibleSummaryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
|
|
|
|
std::vector<RimGridTimeHistoryCurve*> visibleTimeHistoryCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
2017-08-17 14:24:49 +02:00
|
|
|
std::vector<RimAsciiDataCurve*> visibleAsciiDataCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
2017-06-13 15:41:52 +02:00
|
|
|
bool hasVisibleCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
2016-05-25 13:15:17 +02:00
|
|
|
|
2017-12-12 08:35:37 +01:00
|
|
|
RimSummaryAxisProperties* yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const;
|
2017-06-13 15:41:52 +02:00
|
|
|
void updateAxis(RiaDefines::PlotAxis plotAxis);
|
2018-05-11 13:18:53 +02:00
|
|
|
|
2017-06-13 15:41:52 +02:00
|
|
|
void updateZoomForAxis(RiaDefines::PlotAxis plotAxis);
|
2017-03-19 08:45:29 +01:00
|
|
|
|
2016-10-12 13:58:47 +02:00
|
|
|
void updateTimeAxis();
|
2017-11-14 13:54:19 +01:00
|
|
|
void updateBottomXAxis();
|
2018-05-11 13:18:53 +02:00
|
|
|
|
|
|
|
|
void updateAxisRangesFromQwt();
|
|
|
|
|
void setAutoZoomForAllAxes(bool enableAutoZoom);
|
2016-10-12 13:58:47 +02:00
|
|
|
|
2016-10-11 19:40:45 +02:00
|
|
|
private:
|
2017-03-19 08:45:29 +01:00
|
|
|
caf::PdmField<bool> m_showPlotTitle;
|
2017-04-24 16:42:01 +02:00
|
|
|
caf::PdmField<bool> m_showLegend;
|
2017-12-11 13:09:51 +01:00
|
|
|
caf::PdmField<int> m_legendFontSize;
|
2017-11-23 14:12:05 +01:00
|
|
|
|
2017-12-14 09:59:11 +01:00
|
|
|
caf::PdmField<bool> m_useAutoPlotTitle;
|
2017-11-23 14:12:05 +01:00
|
|
|
caf::PdmField<QString> m_userDefinedPlotTitle;
|
2016-10-14 15:38:21 +02:00
|
|
|
|
2017-03-19 08:45:29 +01:00
|
|
|
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;
|
2018-05-15 08:43:36 +02:00
|
|
|
caf::PdmChildField<RimSummaryCurveCollection*> m_summaryCurveCollection;
|
2018-04-19 14:00:00 +02:00
|
|
|
caf::PdmChildField<RimEnsembleCurveSetCollection*> m_ensembleCurveSetCollection;
|
2018-04-06 08:16:14 +02:00
|
|
|
|
2017-08-11 11:20:40 +02:00
|
|
|
caf::PdmChildArrayField<RimAsciiDataCurve*> m_asciiDataCurves;
|
2016-10-07 10:51:08 +02:00
|
|
|
|
2017-11-14 12:33:24 +01:00
|
|
|
caf::PdmChildField<RimSummaryAxisProperties*> m_leftYAxisProperties;
|
|
|
|
|
caf::PdmChildField<RimSummaryAxisProperties*> m_rightYAxisProperties;
|
2017-11-13 08:09:59 +01:00
|
|
|
|
2017-11-14 12:33:24 +01:00
|
|
|
caf::PdmChildField<RimSummaryAxisProperties*> m_bottomAxisProperties;
|
2017-03-19 08:45:29 +01:00
|
|
|
caf::PdmChildField<RimSummaryTimeAxisProperties*> m_timeAxisProperties;
|
2016-10-07 10:51:08 +02:00
|
|
|
|
2017-03-19 08:45:29 +01:00
|
|
|
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
2018-06-27 13:10:39 +02:00
|
|
|
std::unique_ptr<QwtPlotTextLabel> m_plotInfoLabel;
|
2017-11-13 08:09:59 +01:00
|
|
|
|
2017-11-14 12:50:21 +01:00
|
|
|
bool m_isCrossPlot;
|
2017-12-13 07:40:37 +01:00
|
|
|
|
2018-05-15 08:43:36 +02:00
|
|
|
std::unique_ptr<RimSummaryPlotNameHelper> m_nameHelperAllCurves;
|
2017-12-13 07:40:37 +01:00
|
|
|
|
|
|
|
|
// Obsolete fields
|
|
|
|
|
caf::PdmChildArrayField<RimSummaryCurve*> m_summaryCurves_OBSOLETE;
|
|
|
|
|
caf::PdmChildArrayField<RimSummaryCurveFilter_OBSOLETE*> m_curveFilters_OBSOLETE;
|
2018-05-11 13:18:53 +02:00
|
|
|
caf::PdmField<bool> m_isAutoZoom_OBSOLETE;
|
|
|
|
|
|
2016-05-09 12:13:54 +02:00
|
|
|
};
|