2019-02-21 05:52:23 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2019- 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
|
|
|
|
|
|
|
|
#include "cafPdmChildArrayField.h"
|
|
|
|
#include "cafPdmChildField.h"
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
2022-01-17 06:14:21 -06:00
|
|
|
#include "RiaPlotDefines.h"
|
2019-02-21 05:52:23 -06:00
|
|
|
#include "RimNameConfig.h"
|
2019-11-15 03:12:19 -06:00
|
|
|
#include "RimPlot.h"
|
2019-02-21 05:52:23 -06:00
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
2019-04-10 09:13:40 -05:00
|
|
|
#include <set>
|
|
|
|
|
|
|
|
class RimPlotAxisPropertiesInterface;
|
2019-02-25 07:54:36 -06:00
|
|
|
class RimPlotAxisProperties;
|
2019-03-29 07:17:39 -05:00
|
|
|
class RimGridCrossPlotDataSet;
|
2019-12-18 05:25:19 -06:00
|
|
|
class RiuDraggableOverlayFrame;
|
2019-03-04 08:35:48 -06:00
|
|
|
class RiuGridCrossQwtPlot;
|
2022-01-17 06:14:21 -06:00
|
|
|
class RimPlotCurve;
|
2022-09-14 09:10:52 -05:00
|
|
|
class RiuTextOverlayContentFrame;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
|
|
|
class RimGridCrossPlotNameConfig : public RimNameConfig
|
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 06:17:36 -05:00
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
public:
|
2019-09-06 03:59:04 -05:00
|
|
|
RimGridCrossPlotNameConfig();
|
2019-09-06 06:17:36 -05:00
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
public:
|
|
|
|
caf::PdmField<bool> addDataSetNames;
|
|
|
|
|
|
|
|
protected:
|
2019-11-25 05:38:00 -06:00
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void doEnableAllAutoNameTags( bool enable ) override;
|
2019-02-21 05:52:23 -06:00
|
|
|
};
|
|
|
|
|
2019-11-15 03:12:19 -06:00
|
|
|
class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface
|
2019-02-21 05:52:23 -06:00
|
|
|
{
|
2020-01-16 05:32:40 -06:00
|
|
|
Q_OBJECT;
|
2019-02-21 05:52:23 -06:00
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-09-06 06:17:36 -05:00
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
public:
|
|
|
|
RimGridCrossPlot();
|
2021-04-14 21:14:51 -05:00
|
|
|
~RimGridCrossPlot() override;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
2019-10-31 07:48:40 -05:00
|
|
|
QString description() const override;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2019-03-29 07:17:39 -05:00
|
|
|
RimGridCrossPlotDataSet* createDataSet();
|
2019-09-06 06:17:36 -05:00
|
|
|
int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const;
|
|
|
|
void addDataSet( RimGridCrossPlotDataSet* dataSet );
|
|
|
|
|
2019-03-29 07:17:39 -05:00
|
|
|
std::vector<RimGridCrossPlotDataSet*> dataSets() const;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
2022-01-17 06:14:21 -06:00
|
|
|
QWidget* viewWidget() override;
|
|
|
|
RiuPlotWidget* plotWidget() override;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
QImage snapshotWindowContent() override;
|
|
|
|
void zoomAll() override;
|
|
|
|
void calculateZoomRangeAndUpdateQwt();
|
|
|
|
QString createAutoName() const override;
|
2019-09-06 06:17:36 -05:00
|
|
|
|
2019-03-25 08:47:55 -05:00
|
|
|
bool showInfoBox() const;
|
2019-12-18 05:25:19 -06:00
|
|
|
void updateInfoBox();
|
2019-02-21 05:52:23 -06:00
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
2019-11-22 08:42:40 -06:00
|
|
|
|
|
|
|
void detachAllCurves() override;
|
|
|
|
void reattachAllCurves() override;
|
|
|
|
|
|
|
|
void performAutoNameUpdate() override;
|
|
|
|
void updateCurveNamesAndPlotTitle();
|
|
|
|
void swapAxes();
|
2019-11-15 03:12:19 -06:00
|
|
|
|
|
|
|
QString asciiDataForPlotExport() const override;
|
|
|
|
QString asciiTitleForPlotExport( int dataSetIndex ) const;
|
|
|
|
QString asciiDataForGridCrossPlotExport( int dataSetIndex ) const;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
bool isXAxisLogarithmic() const;
|
|
|
|
bool isYAxisLogarithmic() const;
|
|
|
|
void setYAxisInverted( bool inverted );
|
2019-04-10 09:13:40 -05:00
|
|
|
|
2019-11-15 06:35:39 -06:00
|
|
|
void updateLegend() override;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2022-01-17 06:14:21 -06:00
|
|
|
void updateZoomInParentPlot() override;
|
|
|
|
void updateZoomFromParentPlot() override;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2022-03-08 01:42:21 -06:00
|
|
|
void setAutoScaleXEnabled( bool enabled ) override;
|
|
|
|
void setAutoScaleYEnabled( bool enabled ) override;
|
2022-01-17 06:14:21 -06:00
|
|
|
caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override;
|
2022-04-01 08:57:11 -05:00
|
|
|
void onAxisSelected( RiuPlotAxis axis, bool toggle ) override;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2020-05-18 09:02:27 -05:00
|
|
|
bool isDeletable() const override;
|
2023-05-26 04:47:26 -05:00
|
|
|
bool isCurveHighlightSupported() const override;
|
2020-05-18 09:02:27 -05:00
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
protected:
|
2020-01-16 05:32:40 -06:00
|
|
|
void deleteViewWidget() override;
|
|
|
|
void onLoadDataAndUpdate() override;
|
|
|
|
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
|
|
|
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
2019-02-25 07:54:36 -06:00
|
|
|
|
2020-02-12 04:43:15 -06:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
2019-11-15 03:12:19 -06:00
|
|
|
|
|
|
|
void updateAxes() override;
|
|
|
|
void updatePlot();
|
2019-03-04 03:19:02 -06:00
|
|
|
|
2019-03-22 09:56:06 -05:00
|
|
|
virtual QString xAxisParameterString() const;
|
2019-09-06 06:17:36 -05:00
|
|
|
QString yAxisParameterString() const;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
2019-09-06 06:17:36 -05:00
|
|
|
void updateAxisInQwt( RiaDefines::PlotAxis axisType );
|
|
|
|
void updateAxisFromQwt( RiaDefines::PlotAxis axisType );
|
2022-01-17 06:14:21 -06:00
|
|
|
std::vector<const RimPlotCurve*> visibleCurves() const;
|
2019-03-04 08:35:48 -06:00
|
|
|
|
2019-03-18 06:41:44 -05:00
|
|
|
RimPlotAxisProperties* xAxisProperties();
|
|
|
|
RimPlotAxisProperties* yAxisProperties();
|
|
|
|
|
2019-03-18 08:31:06 -05:00
|
|
|
RimGridCrossPlotNameConfig* nameConfig();
|
2019-09-06 06:17:36 -05:00
|
|
|
void setShowInfoBox( bool enable );
|
2019-03-18 08:31:06 -05:00
|
|
|
|
2019-04-10 09:13:40 -05:00
|
|
|
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
2019-09-06 06:17:36 -05:00
|
|
|
|
2019-11-07 01:48:11 -06:00
|
|
|
private:
|
2022-01-17 06:14:21 -06:00
|
|
|
RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
2020-01-16 05:32:40 -06:00
|
|
|
|
2019-11-15 06:35:39 -06:00
|
|
|
void doUpdateLayout() override;
|
2019-11-07 01:48:11 -06:00
|
|
|
void cleanupBeforeClose();
|
|
|
|
|
2019-12-18 05:25:19 -06:00
|
|
|
QString generateInfoBoxText() const;
|
2019-11-15 06:35:39 -06:00
|
|
|
|
2020-07-02 06:06:31 -05:00
|
|
|
void connectAxisSignals( RimPlotAxisProperties* axis );
|
|
|
|
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
|
|
|
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
|
|
|
|
2020-01-16 05:32:40 -06:00
|
|
|
private slots:
|
|
|
|
void onPlotZoomed();
|
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
private:
|
2019-09-06 06:17:36 -05:00
|
|
|
caf::PdmField<bool> m_showInfoBox;
|
|
|
|
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
2019-09-06 06:17:36 -05:00
|
|
|
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
|
|
|
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
2019-02-25 07:54:36 -06:00
|
|
|
|
2019-09-06 06:17:36 -05:00
|
|
|
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
2022-09-14 09:10:52 -05:00
|
|
|
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
|
|
|
|
QPointer<RiuDraggableOverlayFrame> m_infoBox;
|
|
|
|
QPointer<RiuTextOverlayContentFrame> m_infoBoxTextFrame;
|
2019-02-21 05:52:23 -06:00
|
|
|
};
|