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