2016-05-23 17:33:44 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2016- Statoil 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
|
|
|
|
|
|
2018-07-10 13:55:54 +02:00
|
|
|
#include "RifEclipseSummaryAddress.h"
|
2018-09-04 09:08:29 +02:00
|
|
|
#include "RiuQwtSymbol.h"
|
|
|
|
|
#include "RiuQwtPlotCurve.h"
|
2018-07-10 13:55:54 +02:00
|
|
|
|
2016-05-23 17:33:44 +02:00
|
|
|
#include "cafPdmField.h"
|
|
|
|
|
#include "cafPdmFieldCvfColor.h"
|
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
|
|
|
|
|
class QwtPlot;
|
|
|
|
|
class QwtPlotCurve;
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
class RimPlotCurve : public caf::PdmObject
|
|
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
public:
|
2018-09-04 09:08:29 +02:00
|
|
|
typedef caf::AppEnum<RiuQwtPlotCurve::CurveInterpolationEnum> CurveInterpolation;
|
|
|
|
|
typedef caf::AppEnum<RiuQwtPlotCurve::LineStyleEnum> LineStyle;
|
|
|
|
|
typedef caf::AppEnum<RiuQwtSymbol::PointSymbolEnum> PointSymbol;
|
2017-08-22 15:24:35 +02:00
|
|
|
|
2016-05-23 17:33:44 +02:00
|
|
|
public:
|
|
|
|
|
RimPlotCurve();
|
2018-10-18 19:45:57 +02:00
|
|
|
~RimPlotCurve() override;
|
2016-05-23 17:33:44 +02:00
|
|
|
|
2017-09-23 08:47:04 +02:00
|
|
|
void loadDataAndUpdate(bool updateParentPlot);
|
2016-05-23 17:33:44 +02:00
|
|
|
|
2018-08-30 14:03:58 +02:00
|
|
|
virtual bool xValueRange(double* minimumValue, double* maximumValue) const;
|
|
|
|
|
virtual bool yValueRange(double* minimumValue, double* maximumValue) const;
|
|
|
|
|
|
2017-09-23 08:47:04 +02:00
|
|
|
void setParentQwtPlotAndReplot(QwtPlot* plot);
|
|
|
|
|
void setParentQwtPlotNoReplot(QwtPlot* plot);
|
2016-05-23 17:33:44 +02:00
|
|
|
void detachQwtCurve();
|
2018-09-07 13:39:50 +02:00
|
|
|
void reattachQwtCurve();
|
2016-05-23 17:33:44 +02:00
|
|
|
QwtPlotCurve* qwtPlotCurve() const;
|
|
|
|
|
|
|
|
|
|
void setColor(const cvf::Color3f& color);
|
2016-08-08 15:14:34 +02:00
|
|
|
cvf::Color3f color() const { return m_curveColor; }
|
2018-09-04 09:08:29 +02:00
|
|
|
void setLineStyle(RiuQwtPlotCurve::LineStyleEnum lineStyle);
|
|
|
|
|
void setSymbol(RiuQwtSymbol::PointSymbolEnum symbolStyle);
|
2018-09-04 11:40:21 +02:00
|
|
|
RiuQwtSymbol::PointSymbolEnum symbol();
|
2018-06-27 11:35:29 +02:00
|
|
|
void setSymbolSkipDistance(float distance);
|
2018-06-14 14:10:37 +02:00
|
|
|
void setSymbolLabel(const QString& label);
|
2018-06-27 14:24:19 +02:00
|
|
|
void setSymbolSize(int sizeInPixels);
|
2016-08-08 15:14:34 +02:00
|
|
|
void setLineThickness(int thickness);
|
2017-09-19 15:19:48 +02:00
|
|
|
void resetAppearance();
|
2017-10-02 08:53:29 +02:00
|
|
|
|
2016-05-23 17:33:44 +02:00
|
|
|
bool isCurveVisible() const;
|
2017-09-18 10:45:31 +02:00
|
|
|
void setCurveVisiblity(bool visible);
|
|
|
|
|
|
2018-08-07 13:34:13 +02:00
|
|
|
void updateCurveNameAndUpdatePlotLegendAndTitle();
|
2017-09-23 08:47:04 +02:00
|
|
|
void updateCurveNameNoLegendUpdate();
|
|
|
|
|
|
2016-05-23 17:33:44 +02:00
|
|
|
QString curveName() const { return m_curveName; }
|
2018-07-10 13:55:54 +02:00
|
|
|
virtual QString curveExportDescription(const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress()) const { return m_curveName; }
|
2018-06-29 11:32:32 +02:00
|
|
|
void setCustomName(const QString& customName);
|
2018-01-29 10:47:54 +01:00
|
|
|
void updateCurveVisibility(bool updateParentPlot);
|
2017-09-23 08:47:04 +02:00
|
|
|
void updateLegendEntryVisibilityAndPlotLegend();
|
|
|
|
|
void updateLegendEntryVisibilityNoPlotUpdate();
|
2017-04-24 16:42:01 +02:00
|
|
|
|
|
|
|
|
void showLegend(bool show);
|
2016-10-05 12:01:43 +02:00
|
|
|
|
2017-10-17 15:59:05 +02:00
|
|
|
void setZOrder(double z);
|
|
|
|
|
|
2018-04-06 08:16:14 +02:00
|
|
|
virtual void updateCurveAppearance();
|
2018-05-25 11:10:03 +02:00
|
|
|
bool isCrossPlotCurve() const;
|
2018-04-06 08:16:14 +02:00
|
|
|
|
2016-05-23 17:33:44 +02:00
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual QString createCurveAutoName() = 0;
|
2016-09-13 09:59:34 +02:00
|
|
|
virtual void updateZoomInParentPlot() = 0;
|
2017-09-23 08:47:04 +02:00
|
|
|
virtual void onLoadDataAndUpdate(bool updateParentPlot) = 0;
|
2018-10-18 19:45:57 +02:00
|
|
|
void initAfterRead() override;
|
2018-08-07 13:34:13 +02:00
|
|
|
void updateCurvePresentation(bool updatePlotLegendAndTitle);
|
2016-05-23 17:33:44 +02:00
|
|
|
|
|
|
|
|
void updateOptionSensitivity();
|
2018-08-07 13:34:13 +02:00
|
|
|
void updatePlotTitle();
|
2018-09-07 13:39:50 +02:00
|
|
|
virtual void updateLegendsInPlot();
|
2016-05-23 17:33:44 +02:00
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// Overridden PDM methods
|
2018-10-18 19:45:57 +02:00
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
|
caf::PdmFieldHandle* objectToggleField() override;
|
|
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
2017-04-07 14:43:26 +02:00
|
|
|
void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
|
|
|
|
void curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
2016-05-23 17:33:44 +02:00
|
|
|
|
2018-12-16 09:45:52 +01:00
|
|
|
private:
|
|
|
|
|
bool canCurveBeAttached() const;
|
|
|
|
|
|
2016-05-23 17:33:44 +02:00
|
|
|
protected:
|
2018-09-04 09:08:29 +02:00
|
|
|
QPointer<QwtPlot> m_parentQwtPlot;
|
2018-09-07 13:39:50 +02:00
|
|
|
RiuQwtPlotCurve* m_qwtPlotCurve;
|
2018-09-04 09:08:29 +02:00
|
|
|
|
|
|
|
|
caf::PdmField<bool> m_showCurve;
|
|
|
|
|
caf::PdmField<QString> m_curveName;
|
|
|
|
|
caf::PdmField<QString> m_customCurveName;
|
|
|
|
|
caf::PdmField<bool> m_showLegend;
|
|
|
|
|
QString m_symbolLabel;
|
|
|
|
|
caf::PdmField<int> m_symbolSize;
|
|
|
|
|
|
|
|
|
|
caf::PdmField<bool> m_isUsingAutoName;
|
|
|
|
|
caf::PdmField<cvf::Color3f> m_curveColor;
|
|
|
|
|
caf::PdmField<int> m_curveThickness;
|
|
|
|
|
caf::PdmField<float> m_symbolSkipPixelDistance;
|
|
|
|
|
caf::PdmField<bool> m_showErrorBars;
|
|
|
|
|
|
|
|
|
|
caf::PdmField<PointSymbol> m_pointSymbol;
|
|
|
|
|
caf::PdmField<LineStyle> m_lineStyle;
|
|
|
|
|
caf::PdmField<CurveInterpolation> m_curveInterpolation;
|
2018-09-07 13:39:50 +02:00
|
|
|
RiuQwtSymbol::LabelPosition m_symbolLabelPosition;
|
2016-05-23 17:33:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|