2020-02-12 09:48:25 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2020 Equinor 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
|
|
|
|
|
2020-02-24 03:44:51 -06:00
|
|
|
#include "RiaSummaryCurveDefinition.h"
|
|
|
|
|
2020-02-12 09:48:25 -06:00
|
|
|
#include "RimPlot.h"
|
|
|
|
|
|
|
|
#include <QDateTime>
|
|
|
|
|
|
|
|
class RiuSummaryQwtPlot;
|
|
|
|
class RimAnalysisPlotDataEntry;
|
2020-02-17 04:11:27 -06:00
|
|
|
class RiuGroupedBarChartBuilder;
|
2020-02-12 09:48:25 -06:00
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
class RimAnalysisPlot : public RimPlot
|
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
RimAnalysisPlot();
|
|
|
|
~RimAnalysisPlot() override;
|
|
|
|
|
|
|
|
bool showPlotTitle() const;
|
|
|
|
void setShowPlotTitle( bool showTitle );
|
|
|
|
|
|
|
|
void detachAllCurves() override;
|
|
|
|
void reattachAllCurves() override;
|
|
|
|
|
|
|
|
void updateAxes() override;
|
|
|
|
QWidget* viewWidget() override;
|
|
|
|
RiuQwtPlotWidget* viewer() override;
|
|
|
|
|
|
|
|
QString asciiDataForPlotExport() const override;
|
|
|
|
|
|
|
|
void updateLegend() override;
|
|
|
|
|
|
|
|
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
|
|
|
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
|
|
|
int oldFontSize,
|
|
|
|
int fontSize,
|
|
|
|
bool forceChange = false ) override;
|
|
|
|
|
|
|
|
void setAutoScaleXEnabled( bool enabled ) override;
|
|
|
|
void setAutoScaleYEnabled( bool enabled ) override;
|
|
|
|
|
|
|
|
void zoomAll() override;
|
|
|
|
void updateZoomInQwt() override;
|
|
|
|
void updateZoomFromQwt() override;
|
|
|
|
|
|
|
|
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
|
|
|
|
|
|
|
void onAxisSelected( int axis, bool toggle ) override;
|
|
|
|
|
|
|
|
// RimViewWindow overrides
|
|
|
|
void deleteViewWidget() override;
|
|
|
|
|
|
|
|
enum SortGroupType
|
|
|
|
{
|
|
|
|
SUMMARY_ITEM,
|
|
|
|
CASE,
|
|
|
|
ENSEMBLE,
|
|
|
|
VALUE,
|
|
|
|
ABS_VALUE,
|
|
|
|
OTHER_VALUE,
|
|
|
|
ABS_OTHER_VALUE,
|
|
|
|
TIME_STEP,
|
|
|
|
};
|
|
|
|
|
|
|
|
QString description() const override;
|
|
|
|
|
|
|
|
void updateCaseNameHasChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
|
|
|
void cleanupBeforeClose();
|
|
|
|
|
|
|
|
void doUpdateLayout() override;
|
|
|
|
|
|
|
|
void doRemoveFromCollection() override;
|
|
|
|
|
|
|
|
QImage snapshotWindowContent() override;
|
|
|
|
|
|
|
|
// Overridden PDM methods
|
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
2020-02-18 04:48:04 -06:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
2020-02-12 09:48:25 -06:00
|
|
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
void onLoadDataAndUpdate() override;
|
|
|
|
|
2020-02-24 03:18:43 -06:00
|
|
|
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
|
2020-02-17 04:11:27 -06:00
|
|
|
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
2020-02-18 04:48:04 -06:00
|
|
|
void updatePlotTitle();
|
2020-02-17 04:11:27 -06:00
|
|
|
|
2020-02-24 03:44:51 -06:00
|
|
|
std::vector<RiaSummaryCurveDefinition> curveDefinitions();
|
|
|
|
|
2020-02-12 09:48:25 -06:00
|
|
|
private:
|
|
|
|
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
|
|
|
|
|
|
|
caf::PdmField<bool> m_showPlotTitle;
|
|
|
|
caf::PdmField<bool> m_useAutoPlotTitle;
|
|
|
|
caf::PdmField<QString> m_description;
|
|
|
|
|
2020-02-19 05:03:41 -06:00
|
|
|
public:
|
|
|
|
enum BarOrientation
|
|
|
|
{
|
2020-02-24 03:18:43 -06:00
|
|
|
BARS_HORIZONTAL,
|
2020-02-19 05:03:41 -06:00
|
|
|
BARS_VERTICAL
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
caf::PdmField<caf::AppEnum<BarOrientation>> m_barOrientation;
|
|
|
|
|
2020-02-18 04:48:04 -06:00
|
|
|
caf::PdmField<QString> m_selectedVarsUiField;
|
|
|
|
caf::PdmField<bool> m_selectVariablesButtonField;
|
|
|
|
|
2020-02-12 09:48:25 -06:00
|
|
|
caf::PdmChildArrayField<RimAnalysisPlotDataEntry*> m_data;
|
|
|
|
|
|
|
|
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
|
|
|
|
|
|
|
caf::PdmField<std::vector<caf::AppEnum<SortGroupType>>> m_sortGroupSortingOrder;
|
|
|
|
caf::PdmField<std::vector<caf::AppEnum<SortGroupType>>> m_sortGroupsToGroup;
|
|
|
|
|
|
|
|
caf::PdmField<caf::AppEnum<SortGroupType>> m_sortGroupForLegend;
|
|
|
|
};
|