Files
ResInsight/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h
T

188 lines
6.3 KiB
C++
Raw Normal View History

2021-12-23 09:30:36 +01:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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
2022-03-04 10:52:17 +01:00
#include "RimMultiPlot.h"
2022-01-06 15:18:09 +01:00
#include "RimSummaryDataSourceStepping.h"
2021-12-23 09:30:36 +01:00
#include "cafPdmChildField.h"
#include "cafPdmObject.h"
#include "cafPdmUiItem.h"
#include "cafSignal.h"
2021-12-23 09:30:36 +01:00
#include <QList>
2022-03-04 10:52:17 +01:00
#include <vector>
2022-01-06 15:18:09 +01:00
class RimSummaryPlot;
class RimSummaryPlotSourceStepping;
class RimSummaryPlotNameHelper;
class RimSummaryNameHelper;
2022-09-13 17:45:41 +02:00
class RimPlotAxisProperties;
2021-12-23 09:30:36 +01:00
//==================================================================================================
///
///
//==================================================================================================
2022-03-04 10:52:17 +01:00
class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStepping
2021-12-23 09:30:36 +01:00
{
CAF_PDM_HEADER_INIT;
public:
caf::Signal<RimSummaryMultiPlot*> duplicatePlot;
2021-12-23 09:30:36 +01:00
public:
enum class AxisRangeAggregation
{
2022-06-02 10:33:05 +02:00
NONE,
SUB_PLOTS,
REGIONS,
WELLS,
REALIZATIONS
};
2021-12-23 09:30:36 +01:00
RimSummaryMultiPlot();
2021-12-24 02:21:23 +00:00
~RimSummaryMultiPlot() override;
2021-12-23 09:30:36 +01:00
2022-01-06 15:18:09 +01:00
const RimSummaryNameHelper* nameHelper() const;
void setLayoutInfo( RimSummaryPlot* summaryPlot, int row, int col );
void clearLayoutInfo();
2022-06-21 14:40:54 +02:00
void setAutoPlotTitle( bool enable );
void setAutoSubPlotTitle( bool enable );
2022-01-06 15:18:09 +01:00
std::vector<RimSummaryDataSourceStepping::Axis> availableAxes() const override;
std::vector<RimSummaryCurve*> curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override;
std::vector<RimEnsembleCurveSet*> curveSets() const override;
std::vector<RimSummaryCurve*> allCurves( RimSummaryDataSourceStepping::Axis axis ) const override;
2022-03-04 10:52:17 +01:00
void addPlot( RimPlot* plot ) override;
void insertPlot( RimPlot* plot, size_t index ) override;
void removePlot( RimPlot* plot ) override;
2021-12-23 09:30:36 +01:00
void removePlotNoUpdate( RimPlot* plot ) override;
void updateAfterPlotRemove() override;
void updatePlotTitles() override;
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar() override;
2021-12-23 09:30:36 +01:00
void syncAxisRanges();
2023-01-02 10:22:44 +01:00
void syncTimeAxisRanges( RimSummaryPlot* sourceSummaryPlot );
void handleDroppedObjects( const std::vector<caf::PdmObjectHandle*>& objects );
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
std::vector<RimSummaryPlot*> summaryPlots() const;
std::vector<RimSummaryPlot*> visibleSummaryPlots() const;
void makeSureIsVisible( RimSummaryPlot* plot );
void setSubPlotAxesLinked( bool enable );
bool isSubPlotAxesLinked() const;
2022-09-09 16:06:56 +02:00
void setTimeAxisLinked( bool enable );
2022-06-21 15:33:00 +02:00
bool isTimeAxisLinked() const;
std::pair<int, int> gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const;
void zoomAll() override;
void setDefaultRangeAggregationSteppingDimension();
2022-09-13 17:45:41 +02:00
void analyzePlotsAndAdjustAppearanceSettings();
2022-05-03 11:30:09 +02:00
void keepVisiblePageAfterUpdate( bool keepPage );
void storeStepDimensionFromToolbar();
void updateStepDimensionFromDefault();
void selectWell( QString wellName );
2022-03-04 10:52:17 +01:00
protected:
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
2021-12-23 09:30:36 +01:00
void initAfterRead() override;
void onLoadDataAndUpdate() override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
2022-03-04 10:52:17 +01:00
private:
2021-12-23 09:30:36 +01:00
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
2021-12-23 09:30:36 +01:00
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
2022-01-06 15:18:09 +01:00
void populateNameHelper( RimSummaryPlotNameHelper* nameHelper );
void computeAggregatedAxisRange();
2022-05-03 11:30:09 +02:00
void updateSourceStepper();
2022-03-04 10:52:17 +01:00
void updatePlotVisibility();
2022-09-09 16:06:56 +02:00
void setAutoValueStates();
2022-09-05 14:12:49 +02:00
static void
2022-09-09 16:06:56 +02:00
setAutoValueStatesForPlot( RimSummaryPlot* summaryPlot, bool isMinMaxOverridden, bool isAppearanceOverridden );
void duplicate();
2022-05-03 11:30:09 +02:00
void appendSubPlotByStepping( int direction );
void appendCurveByStepping( int direction );
2022-05-03 11:30:09 +02:00
void onSubPlotChanged( const caf::SignalEmitter* emitter );
2022-09-09 16:06:56 +02:00
void onSubPlotZoomed( const caf::SignalEmitter* emitter );
void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot );
2023-01-02 10:22:44 +01:00
void onSubPlotAxisReloadRequired( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot );
void updateTimeAxisRangesFromFirstPlot();
2022-09-09 16:06:56 +02:00
void updateReadOnlyState();
2022-09-13 17:45:41 +02:00
std::pair<double, double> adjustedMinMax( const RimPlotAxisProperties* axis, double min, double max ) const;
2021-12-23 09:30:36 +01:00
private:
2022-06-21 14:40:54 +02:00
caf::PdmField<bool> m_autoPlotTitle;
caf::PdmField<bool> m_autoSubPlotTitle;
caf::PdmField<bool> m_disableWheelZoom;
caf::PdmField<bool> m_createPlotDuplicate;
caf::PdmField<bool> m_linkSubPlotAxes;
2022-06-21 15:33:00 +02:00
caf::PdmField<bool> m_linkTimeAxis;
caf::PdmField<bool> m_autoAdjustAppearance;
caf::PdmField<bool> m_allow3DSelectionLink;
2022-01-06 15:18:09 +01:00
caf::PdmField<bool> m_hidePlotsWithValuesBelow;
caf::PdmField<double> m_plotFilterYAxisThreshold;
2022-05-03 11:30:09 +02:00
caf::PdmField<bool> m_appendNextPlot;
caf::PdmField<bool> m_appendPrevPlot;
caf::PdmField<bool> m_appendNextCurve;
caf::PdmField<bool> m_appendPrevCurve;
caf::PdmField<caf::AppEnum<RimSummaryDataSourceStepping::SourceSteppingDimension>> m_defaultStepDimension;
caf::PdmField<caf::AppEnum<AxisRangeAggregation>> m_axisRangeAggregation;
2022-01-06 15:18:09 +01:00
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_sourceStepping;
std::unique_ptr<RimSummaryPlotNameHelper> m_nameHelper;
std::map<RimSummaryPlot*, std::pair<int, int>> m_gridLayoutInfo;
2021-12-23 09:30:36 +01:00
};