2016-10-07 03:51:08 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-02-25 07:54:36 -06:00
|
|
|
// Copyright (C) 2016-2018 Statoil ASA
|
|
|
|
// Copyright (C) 2019- Equinor ASA
|
2017-12-12 00:42:16 -06:00
|
|
|
//
|
2016-10-07 03:51:08 -05:00
|
|
|
// 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.
|
2017-12-12 00:42:16 -06:00
|
|
|
//
|
2016-10-07 03:51:08 -05:00
|
|
|
// 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.
|
2017-12-12 00:42:16 -06:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2016-10-07 03:51:08 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-06-13 08:41:52 -05:00
|
|
|
#include "RiaDefines.h"
|
2019-04-10 09:13:40 -05:00
|
|
|
#include "RimPlotAxisPropertiesInterface.h"
|
2016-11-24 03:14:26 -06:00
|
|
|
|
2016-10-07 03:51:08 -05:00
|
|
|
#include "cafAppEnum.h"
|
2017-12-12 00:42:16 -06:00
|
|
|
#include "cafPdmChildArrayField.h"
|
|
|
|
#include "cafPdmField.h"
|
|
|
|
#include "cafPdmObject.h"
|
2016-10-07 03:51:08 -05:00
|
|
|
|
2016-10-10 04:05:45 -05:00
|
|
|
#include "qwt_plot.h"
|
|
|
|
|
2016-10-07 03:51:08 -05:00
|
|
|
#include <QString>
|
|
|
|
|
2019-03-12 10:05:58 -05:00
|
|
|
class RimPlotAxisAnnotation;
|
|
|
|
|
2016-10-07 03:51:08 -05:00
|
|
|
//==================================================================================================
|
2017-12-12 00:42:16 -06:00
|
|
|
///
|
|
|
|
///
|
2016-10-07 03:51:08 -05:00
|
|
|
//==================================================================================================
|
2019-04-10 09:13:40 -05:00
|
|
|
class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface
|
2016-10-07 03:51:08 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum NumberFormatType
|
|
|
|
{
|
|
|
|
NUMBER_FORMAT_AUTO,
|
|
|
|
NUMBER_FORMAT_DECIMAL,
|
|
|
|
NUMBER_FORMAT_SCIENTIFIC
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
2019-02-25 07:54:36 -06:00
|
|
|
RimPlotAxisProperties();
|
2016-10-07 03:51:08 -05:00
|
|
|
|
2019-04-10 09:13:40 -05:00
|
|
|
void setEnableTitleTextSettings(bool enable);
|
|
|
|
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
|
|
|
|
AxisTitlePositionType titlePosition() const override;
|
|
|
|
int titleFontSize() const override;
|
|
|
|
void setTitleFontSize(int fontSize) override;
|
|
|
|
int valuesFontSize() const override;
|
|
|
|
void setValuesFontSize(int fontSize) override;
|
|
|
|
|
2017-12-12 00:42:16 -06:00
|
|
|
QwtPlot::Axis qwtPlotAxisType() const;
|
2019-03-13 02:38:18 -05:00
|
|
|
QString name() const;
|
2017-12-12 00:42:16 -06:00
|
|
|
RiaDefines::PlotAxis plotAxisType() const;
|
|
|
|
bool useAutoTitle() const;
|
|
|
|
bool showDescription() const;
|
|
|
|
bool showAcronym() const;
|
|
|
|
bool showUnitText() const;
|
2018-05-11 06:18:53 -05:00
|
|
|
bool isAutoZoom() const;
|
|
|
|
void setAutoZoom(bool enableAutoZoom);
|
2019-03-07 07:34:47 -06:00
|
|
|
bool isAxisInverted() const;
|
2019-03-19 03:07:04 -05:00
|
|
|
void setAxisInverted(bool inverted);
|
2016-10-07 03:51:08 -05:00
|
|
|
|
2019-03-12 10:05:58 -05:00
|
|
|
std::vector<RimPlotAxisAnnotation*> annotations() const;
|
2019-03-18 06:41:44 -05:00
|
|
|
void appendAnnotation(RimPlotAxisAnnotation* annotation);
|
2019-03-12 10:05:58 -05:00
|
|
|
|
2017-12-12 00:42:16 -06:00
|
|
|
caf::PdmField<QString> customTitle;
|
2017-12-11 09:41:18 -06:00
|
|
|
|
2017-12-12 00:42:16 -06:00
|
|
|
caf::PdmField<double> visibleRangeMin;
|
|
|
|
caf::PdmField<double> visibleRangeMax;
|
2016-10-07 03:51:08 -05:00
|
|
|
|
2017-12-12 00:42:16 -06:00
|
|
|
caf::PdmField<caf::AppEnum<NumberFormatType>> numberFormat;
|
|
|
|
caf::PdmField<int> numberOfDecimals;
|
|
|
|
caf::PdmField<double> scaleFactor;
|
|
|
|
caf::PdmField<bool> isLogarithmicScaleEnabled;
|
2016-10-07 03:51:08 -05:00
|
|
|
|
2017-12-12 00:42:16 -06:00
|
|
|
bool isActive() const;
|
2019-03-18 06:41:44 -05:00
|
|
|
|
|
|
|
void setInvertedAxis(bool enable);
|
|
|
|
void showAnnotationObjectsInProjectTree();
|
2019-03-07 07:34:47 -06:00
|
|
|
|
2016-10-07 03:51:08 -05:00
|
|
|
protected:
|
2018-10-18 12:45:57 -05:00
|
|
|
void initAfterRead() override;
|
|
|
|
caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
caf::PdmFieldHandle* objectToggleField() override;
|
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
2017-12-12 00:42:16 -06:00
|
|
|
const QVariant& newValue) override;
|
2018-10-18 12:45:57 -05:00
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
2017-12-12 00:42:16 -06:00
|
|
|
|
2018-10-18 12:45:57 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
2017-12-12 00:42:16 -06:00
|
|
|
bool* useOptionsOnly) override;
|
2016-10-07 03:51:08 -05:00
|
|
|
|
|
|
|
private:
|
2017-12-12 00:42:16 -06:00
|
|
|
void updateOptionSensitivity();
|
2016-10-07 03:51:08 -05:00
|
|
|
|
|
|
|
private:
|
2017-12-11 09:41:18 -06:00
|
|
|
caf::PdmField<bool> m_isActive;
|
2017-12-12 00:42:16 -06:00
|
|
|
|
2017-12-11 09:41:18 -06:00
|
|
|
caf::PdmField<bool> isAutoTitle;
|
|
|
|
caf::PdmField<bool> m_displayShortName;
|
|
|
|
caf::PdmField<bool> m_displayLongName;
|
|
|
|
caf::PdmField<bool> m_displayUnitText;
|
2018-05-11 06:18:53 -05:00
|
|
|
caf::PdmField<bool> m_isAutoZoom;
|
2019-03-07 07:34:47 -06:00
|
|
|
caf::PdmField<bool> m_isAxisInverted;
|
2017-12-11 09:41:18 -06:00
|
|
|
|
2017-12-12 00:42:16 -06:00
|
|
|
caf::PdmField<QString> m_name;
|
|
|
|
QwtPlot::Axis m_axis;
|
2019-02-25 07:54:36 -06:00
|
|
|
|
|
|
|
bool m_enableTitleTextSettings;
|
2019-03-12 10:05:58 -05:00
|
|
|
|
2019-04-10 09:13:40 -05:00
|
|
|
caf::PdmField<int> m_titleFontSize;
|
|
|
|
caf::PdmField<caf::AppEnum<AxisTitlePositionType>> m_titlePositionEnum;
|
|
|
|
caf::PdmField<int> m_valuesFontSize;
|
|
|
|
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
|
2016-10-07 03:51:08 -05:00
|
|
|
};
|
2019-03-13 02:38:18 -05:00
|
|
|
|
|
|
|
class QwtPlotCurve;
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2019-03-13 04:16:46 -05:00
|
|
|
class RimPlotAxisLogRangeCalculator
|
2019-03-13 02:38:18 -05:00
|
|
|
{
|
|
|
|
public:
|
2019-03-13 04:16:46 -05:00
|
|
|
RimPlotAxisLogRangeCalculator(QwtPlot::Axis axis,
|
|
|
|
const std::vector<const QwtPlotCurve*>& qwtCurves);
|
2019-03-13 02:38:18 -05:00
|
|
|
|
2019-03-13 04:16:46 -05:00
|
|
|
void computeAxisRange(double* minPositive, double* max) const;
|
2019-03-13 02:38:18 -05:00
|
|
|
|
|
|
|
private:
|
2019-03-13 04:16:46 -05:00
|
|
|
bool curveValueRange(const QwtPlotCurve* qwtCurve, double* minPositive, double* max) const;
|
2019-03-13 02:38:18 -05:00
|
|
|
|
|
|
|
private:
|
2019-03-13 04:16:46 -05:00
|
|
|
QwtPlot::Axis m_axis;
|
|
|
|
const std::vector<const QwtPlotCurve*> m_curves;
|
2019-03-13 02:38:18 -05:00
|
|
|
};
|