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"
|
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
#include "RiaDefines.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;
|
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();
|
2019-02-21 08:42:28 -06:00
|
|
|
~RimGridCrossPlot();
|
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
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
QWidget* viewWidget() override;
|
|
|
|
RiuQwtPlotWidget* viewer() override;
|
|
|
|
|
|
|
|
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-09-06 06:17:36 -05:00
|
|
|
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
|
|
|
|
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
|
|
|
int oldFontSize,
|
|
|
|
int fontSize,
|
|
|
|
bool forceChange = false ) override;
|
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
|
|
|
|
|
|
|
void updateZoomInQwt() override;
|
|
|
|
void updateZoomFromQwt() override;
|
|
|
|
|
|
|
|
void setAutoScaleXEnabled( bool enabled ) override;
|
|
|
|
void setAutoScaleYEnabled( bool enabled ) override;
|
|
|
|
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
|
|
|
void onAxisSelected( int axis, bool toggle ) override;
|
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
protected:
|
2020-01-16 05:32:40 -06:00
|
|
|
void deleteViewWidget() override;
|
|
|
|
void onLoadDataAndUpdate() override;
|
|
|
|
void initAfterRead() 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
|
|
|
|
2019-11-15 03:12:19 -06:00
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue ) override;
|
|
|
|
|
|
|
|
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 );
|
2019-03-13 04:16:46 -05:00
|
|
|
std::vector<const QwtPlotCurve*> visibleQwtCurves() 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:
|
2020-01-16 05:32:40 -06:00
|
|
|
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
|
|
|
|
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
|
|
|
void doRemoveFromCollection() override;
|
|
|
|
QString generateInfoBoxText() const;
|
2019-11-15 06:35:39 -06:00
|
|
|
|
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;
|
2019-10-31 07:48:40 -05:00
|
|
|
caf::PdmField<bool> m_showLegend_OBSOLETE;
|
2019-09-06 06:17:36 -05:00
|
|
|
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
|
|
|
|
2019-12-18 05:25:19 -06:00
|
|
|
QPointer<RiuGridCrossQwtPlot> m_plotWidget;
|
|
|
|
QPointer<RiuDraggableOverlayFrame> m_infoBox;
|
2019-02-21 05:52:23 -06:00
|
|
|
};
|