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"
|
|
|
|
#include "RimRiuQwtPlotOwnerInterface.h"
|
2019-02-21 05:52:23 -06:00
|
|
|
#include "RimNameConfig.h"
|
|
|
|
#include "RimViewWindow.h"
|
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
class RimPlotAxisProperties;
|
2019-02-21 05:52:23 -06:00
|
|
|
class RimGridCrossPlotCurveSet;
|
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;
|
|
|
|
public:
|
|
|
|
RimGridCrossPlotNameConfig(RimNameConfigHolderInterface* holder = nullptr);
|
|
|
|
public:
|
|
|
|
caf::PdmField<bool> addDataSetNames;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
class RimGridCrossPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
|
2019-02-21 05:52:23 -06:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
2019-02-25 07:54:36 -06: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
|
|
|
|
|
|
|
RimGridCrossPlotCurveSet* createCurveSet();
|
|
|
|
int indexOfCurveSet(const RimGridCrossPlotCurveSet* curveSet) const;
|
2019-03-12 08:46:51 -05:00
|
|
|
void addCurveSet(RimGridCrossPlotCurveSet* curveSet);
|
2019-03-04 08:35:48 -06:00
|
|
|
|
|
|
|
std::vector<RimGridCrossPlotCurveSet*> curveSets() const;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
|
|
|
QWidget* viewWidget() override;
|
|
|
|
QImage snapshotWindowContent() override;
|
|
|
|
void zoomAll() override;
|
|
|
|
void calculateZoomRangeAndUpdateQwt();
|
|
|
|
void reattachCurvesToQwtAndReplot();
|
|
|
|
QString createAutoName() const override;
|
|
|
|
|
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
2019-02-21 08:42:28 -06:00
|
|
|
void detachAllCurves();
|
2019-02-27 05:45:02 -06:00
|
|
|
void performAutoNameUpdate() override;
|
2019-03-04 03:19:02 -06:00
|
|
|
void updateCurveNamesAndPlotTitle();
|
2019-03-13 02:38:18 -05:00
|
|
|
void swapAxes();
|
2019-03-11 05:39:23 -05:00
|
|
|
QString asciiTitleForPlotExport(int curveSetIndex) const;
|
|
|
|
QString asciiDataForPlotExport(int curveSetIndex) const;
|
2019-03-04 08:35:48 -06:00
|
|
|
RiuGridCrossQwtPlot* qwtPlot() const;
|
2019-03-13 04:16:46 -05:00
|
|
|
bool isXAxisLogarithmic() const;
|
|
|
|
bool isYAxisLogarithmic() const;
|
2019-03-11 05:39:23 -05:00
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
public:
|
|
|
|
// Rim2dPlotInterface overrides
|
|
|
|
void updateAxisScaling() override;
|
|
|
|
void updateAxisDisplay() override;
|
|
|
|
void updateZoomWindowFromQwt() override;
|
|
|
|
void selectAxisInPropertyEditor(int axis) override;
|
|
|
|
void setAutoZoomForAllAxes(bool enableAutoZoom) override;
|
|
|
|
caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const override;
|
2019-02-21 05:52:23 -06:00
|
|
|
|
|
|
|
protected:
|
|
|
|
QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
|
|
|
void deleteViewWidget() override;
|
|
|
|
void onLoadDataAndUpdate() override;
|
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
2019-02-25 07:54:36 -06:00
|
|
|
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly) override;
|
|
|
|
|
2019-02-21 08:42:28 -06:00
|
|
|
void updatePlot();
|
2019-03-04 03:19:02 -06:00
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
QString xAxisParameterString() const;
|
|
|
|
QString yAxisParameterString() const;
|
|
|
|
|
2019-02-25 07:54:36 -06: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-02-21 05:52:23 -06:00
|
|
|
private:
|
|
|
|
caf::PdmField<bool> m_showLegend;
|
|
|
|
caf::PdmField<int> m_legendFontSize;
|
|
|
|
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
|
|
|
|
|
2019-02-25 07:54:36 -06:00
|
|
|
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
|
|
|
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
caf::PdmChildArrayField<RimGridCrossPlotCurveSet*> m_crossPlotCurveSets;
|
|
|
|
|
2019-03-04 08:35:48 -06:00
|
|
|
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
|
2019-03-13 04:16:46 -05:00
|
|
|
|
2019-02-21 05:52:23 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|