mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4134 #4124 Refactor RiuSummaryQwtPlot on top of a base RiuQwtPlot class and use this for Cross Plots
* Get a lot of functionality included: zoom, panning, etc.
This commit is contained in:
@@ -127,6 +127,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRiuQwtPlotOwnerInterface.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
|
||||
)
|
||||
|
||||
|
||||
@@ -258,6 +260,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -17,15 +17,21 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
#include "RiuGridCrossQwtPlot.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
|
||||
#include "RimGridCrossPlotCurve.h"
|
||||
#include "RimGridCrossPlotCurveSet.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_scale_engine.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
@@ -46,6 +52,18 @@ RimGridCrossPlot::RimGridCrossPlot()
|
||||
m_nameConfig.uiCapability()->setUiTreeHidden(true);
|
||||
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "");
|
||||
m_xAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
m_xAxisProperties = new RimPlotAxisProperties;
|
||||
m_xAxisProperties->setNameAndAxis("X-Axis", QwtPlot::xBottom);
|
||||
m_xAxisProperties->setEnableTitleTextSettings(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", "");
|
||||
m_yAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
m_yAxisProperties = new RimPlotAxisProperties;
|
||||
m_yAxisProperties->setNameAndAxis("Y-Axis", QwtPlot::yLeft);
|
||||
m_yAxisProperties->setEnableTitleTextSettings(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_crossPlotCurveSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "");
|
||||
m_crossPlotCurveSets.uiCapability()->setUiHidden(true);
|
||||
|
||||
@@ -115,6 +133,11 @@ QImage RimGridCrossPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::zoomAll()
|
||||
{
|
||||
setAutoZoomForAllAxes(true);
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
|
||||
updateZoomWindowFromQwt();
|
||||
m_qwtPlot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -177,6 +200,91 @@ caf::PdmFieldHandle* RimGridCrossPlot::userDescriptionField()
|
||||
return m_nameConfig->nameField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::detachAllCurves()
|
||||
{
|
||||
for (auto curveSet : m_crossPlotCurveSets())
|
||||
{
|
||||
curveSet->detachAllCurves();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisScaling()
|
||||
{
|
||||
updateAxisDisplay();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisDisplay()
|
||||
{
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
|
||||
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
|
||||
m_qwtPlot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateZoomWindowFromQwt()
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT);
|
||||
updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM);
|
||||
|
||||
setAutoZoomForAllAxes(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::selectAxisInPropertyEditor(int axis)
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
if (axis == QwtPlot::yLeft)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_yAxisProperties);
|
||||
}
|
||||
else if (axis == QwtPlot::xBottom)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_xAxisProperties);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::setAutoZoomForAllAxes(bool enableAutoZoom)
|
||||
{
|
||||
m_xAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
m_yAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCurve* qwtCurve) const
|
||||
{
|
||||
for (auto curveSet : m_crossPlotCurveSets)
|
||||
{
|
||||
for (auto curve : curveSet->curves())
|
||||
{
|
||||
if (curve->qwtPlotCurve() == qwtCurve)
|
||||
{
|
||||
return curve;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -184,7 +292,7 @@ QWidget* RimGridCrossPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
if (!m_qwtPlot)
|
||||
{
|
||||
m_qwtPlot = new RiuGridCrossQwtPlot(this, mainWindowParent);
|
||||
m_qwtPlot = new RiuQwtPlot(this, mainWindowParent);
|
||||
|
||||
for (auto curveSet : m_crossPlotCurveSets)
|
||||
{
|
||||
@@ -223,6 +331,7 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
|
||||
|
||||
performAutoNameUpdate();
|
||||
updateAllRequiredEditors();
|
||||
|
||||
updatePlot();
|
||||
|
||||
}
|
||||
@@ -245,6 +354,21 @@ void RimGridCrossPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add("Axes", ":/Axes16x16.png");
|
||||
|
||||
axisFolder->add(&m_xAxisProperties);
|
||||
axisFolder->add(&m_yAxisProperties);
|
||||
|
||||
uiTreeOrdering.add(&m_crossPlotCurveSets);
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -300,14 +424,11 @@ void RimGridCrossPlot::updatePlot()
|
||||
{
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
m_qwtPlot->setAxisAutoScale(QwtPlot::xBottom);
|
||||
m_qwtPlot->setAxisAutoScale(QwtPlot::yLeft);
|
||||
m_qwtPlot->setAxisTitle(QwtPlot::xBottom, QwtText(xAxisParameterString()));
|
||||
m_qwtPlot->setAxisTitle(QwtPlot::yLeft, QwtText(yAxisParameterString()));
|
||||
|
||||
RiuQwtPlotTools::setCommonPlotBehaviour(m_qwtPlot);
|
||||
RiuQwtPlotTools::setDefaultAxes(m_qwtPlot);
|
||||
|
||||
updateAxisDisplay();
|
||||
|
||||
for (auto curveSet : m_crossPlotCurveSets)
|
||||
{
|
||||
curveSet->setParentQwtPlotNoReplot(m_qwtPlot);
|
||||
@@ -376,12 +497,101 @@ QString RimGridCrossPlot::yAxisParameterString() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::detachAllCurves()
|
||||
void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
|
||||
{
|
||||
for (auto curveSet : m_crossPlotCurveSets())
|
||||
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
||||
QString axisParameterString = xAxisParameterString();
|
||||
|
||||
if (axisType == RiaDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
curveSet->detachAllCurves();
|
||||
axisProperties = m_yAxisProperties();
|
||||
axisParameterString = yAxisParameterString();
|
||||
}
|
||||
|
||||
QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType();
|
||||
|
||||
if (axisProperties->isActive())
|
||||
{
|
||||
m_qwtPlot->enableAxis(qwtAxisId, true);
|
||||
|
||||
if (axisProperties->isAutoZoom())
|
||||
{
|
||||
m_qwtPlot->setAxisAutoScale(qwtAxisId);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
|
||||
}
|
||||
|
||||
QwtText axisTitle(axisParameterString);
|
||||
QFont font = m_qwtPlot->axisFont(qwtAxisId);
|
||||
font.setBold(true);
|
||||
font.setPixelSize(axisProperties->titleFontSize);
|
||||
axisTitle.setFont(font);
|
||||
|
||||
switch (axisProperties->titlePositionEnum())
|
||||
{
|
||||
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
|
||||
axisTitle.setRenderFlags(Qt::AlignCenter);
|
||||
break;
|
||||
case RimPlotAxisProperties::AXIS_TITLE_END:
|
||||
axisTitle.setRenderFlags(Qt::AlignRight);
|
||||
break;
|
||||
}
|
||||
|
||||
m_qwtPlot->setAxisTitle(qwtAxisId, axisTitle);
|
||||
|
||||
if (axisProperties->isLogarithmicScaleEnabled)
|
||||
{
|
||||
QwtLogScaleEngine* currentScaleEngine =
|
||||
dynamic_cast<QwtLogScaleEngine*>(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType()));
|
||||
if (!currentScaleEngine)
|
||||
{
|
||||
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine);
|
||||
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QwtLinearScaleEngine* currentScaleEngine =
|
||||
dynamic_cast<QwtLinearScaleEngine*>(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType()));
|
||||
if (!currentScaleEngine)
|
||||
{
|
||||
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine);
|
||||
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlot->enableAxis(qwtAxisId, false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType)
|
||||
{
|
||||
CVF_ASSERT(m_qwtPlot);
|
||||
|
||||
QwtInterval xAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::xBottom);
|
||||
QwtInterval yAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::yLeft);
|
||||
|
||||
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
|
||||
QwtInterval axisRange = xAxisRange;
|
||||
|
||||
if (axisType == RiaDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
axisProperties = m_yAxisProperties();
|
||||
axisRange = yAxisRange;
|
||||
}
|
||||
|
||||
axisProperties->visibleRangeMin = axisRange.minValue();
|
||||
axisProperties->visibleRangeMax = axisRange.maxValue();
|
||||
|
||||
axisProperties->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -21,13 +21,16 @@
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimNameConfig.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RimPlotAxisProperties;
|
||||
class RimGridCrossPlotCurveSet;
|
||||
class RiuGridCrossQwtPlot;
|
||||
class RiuQwtPlot;
|
||||
|
||||
class RimGridCrossPlotNameConfig : public RimNameConfig
|
||||
{
|
||||
@@ -42,9 +45,10 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
class RimGridCrossPlot : public RimViewWindow, public RimNameConfigHolderInterface
|
||||
class RimGridCrossPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGridCrossPlot();
|
||||
~RimGridCrossPlot();
|
||||
@@ -61,12 +65,22 @@ public:
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void detachAllCurves();
|
||||
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;
|
||||
|
||||
protected:
|
||||
QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly) override;
|
||||
@@ -76,14 +90,20 @@ protected:
|
||||
QString xAxisParameterString() const;
|
||||
QString yAxisParameterString() const;
|
||||
|
||||
void updateAxisInQwt(RiaDefines::PlotAxis axisType);
|
||||
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<int> m_legendFontSize;
|
||||
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
|
||||
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
|
||||
|
||||
caf::PdmChildArrayField<RimGridCrossPlotCurveSet*> m_crossPlotCurveSets;
|
||||
|
||||
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
|
||||
QPointer<RiuQwtPlot> m_qwtPlot;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -168,6 +168,14 @@ void RimGridCrossPlotCurveSet::detachAllCurves()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlotCurve*> RimGridCrossPlotCurveSet::curves() const
|
||||
{
|
||||
return m_crossPlotCurves.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
int indexInPlot() const;
|
||||
QString createAutoName() const override;
|
||||
void detachAllCurves();
|
||||
|
||||
std::vector< RimGridCrossPlotCurve*> curves() const;
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void onLoadDataAndUpdate(bool updateParentPlot);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
// Copyright (C) 2016-2018 Statoil ASA
|
||||
// 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
|
||||
@@ -16,10 +17,11 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimSummaryAxisProperties.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
|
||||
@@ -29,33 +31,34 @@
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum<RimSummaryAxisProperties::NumberFormatType>::setUp()
|
||||
void caf::AppEnum<RimPlotAxisProperties::NumberFormatType>::setUp()
|
||||
{
|
||||
addItem(RimSummaryAxisProperties::NUMBER_FORMAT_AUTO, "NUMBER_FORMAT_AUTO", "Auto");
|
||||
addItem(RimSummaryAxisProperties::NUMBER_FORMAT_DECIMAL, "NUMBER_FORMAT_DECIMAL", "Decimal");
|
||||
addItem(RimSummaryAxisProperties::NUMBER_FORMAT_SCIENTIFIC, "NUMBER_FORMAT_SCIENTIFIC", "Scientific");
|
||||
addItem(RimPlotAxisProperties::NUMBER_FORMAT_AUTO, "NUMBER_FORMAT_AUTO", "Auto");
|
||||
addItem(RimPlotAxisProperties::NUMBER_FORMAT_DECIMAL, "NUMBER_FORMAT_DECIMAL", "Decimal");
|
||||
addItem(RimPlotAxisProperties::NUMBER_FORMAT_SCIENTIFIC, "NUMBER_FORMAT_SCIENTIFIC", "Scientific");
|
||||
|
||||
setDefault(RimSummaryAxisProperties::NUMBER_FORMAT_AUTO);
|
||||
setDefault(RimPlotAxisProperties::NUMBER_FORMAT_AUTO);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum<RimSummaryAxisProperties::AxisTitlePositionType>::setUp()
|
||||
void caf::AppEnum<RimPlotAxisProperties::AxisTitlePositionType>::setUp()
|
||||
{
|
||||
addItem(RimSummaryAxisProperties::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center");
|
||||
addItem(RimSummaryAxisProperties::AXIS_TITLE_END, "AXIS_TITLE_END", "At End");
|
||||
addItem(RimPlotAxisProperties::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center");
|
||||
addItem(RimPlotAxisProperties::AXIS_TITLE_END, "AXIS_TITLE_END", "At End");
|
||||
|
||||
setDefault(RimSummaryAxisProperties::AXIS_TITLE_CENTER);
|
||||
setDefault(RimPlotAxisProperties::AXIS_TITLE_CENTER);
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryAxisProperties, "SummaryYAxisProperties");
|
||||
CAF_PDM_SOURCE_INIT(RimPlotAxisProperties, "SummaryYAxisProperties");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryAxisProperties::RimSummaryAxisProperties()
|
||||
RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
: m_enableTitleTextSettings(true)
|
||||
{
|
||||
CAF_PDM_InitObject("Y-Axis Properties", ":/LeftAxis16x16.png", "", "");
|
||||
CAF_PDM_InitObject("Axis Properties", ":/LeftAxis16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
||||
m_isActive.uiCapability()->setUiHidden(true);
|
||||
@@ -88,13 +91,20 @@ RimSummaryAxisProperties::RimSummaryAxisProperties()
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSummaryAxisProperties::userDescriptionField()
|
||||
void RimPlotAxisProperties::setEnableTitleTextSettings(bool enable)
|
||||
{
|
||||
m_enableTitleTextSettings = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPlotAxisProperties::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
@@ -102,7 +112,7 @@ caf::PdmFieldHandle* RimSummaryAxisProperties::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimSummaryAxisProperties::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
QList<caf::PdmOptionItemInfo> RimPlotAxisProperties::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
@@ -144,8 +154,9 @@ QList<caf::PdmOptionItemInfo> RimSummaryAxisProperties::calculateValueOptions(co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAxisProperties::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimPlotAxisProperties::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
if (m_enableTitleTextSettings)
|
||||
{
|
||||
caf::PdmUiGroup* titleTextGroup = uiOrdering.addNewGroup("Title Text");
|
||||
|
||||
@@ -192,7 +203,7 @@ void RimSummaryAxisProperties::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAxisProperties::setNameAndAxis(const QString& name, QwtPlot::Axis axis)
|
||||
void RimPlotAxisProperties::setNameAndAxis(const QString& name, QwtPlot::Axis axis)
|
||||
{
|
||||
m_name = name;
|
||||
m_axis = axis;
|
||||
@@ -204,7 +215,7 @@ void RimSummaryAxisProperties::setNameAndAxis(const QString& name, QwtPlot::Axis
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QwtPlot::Axis RimSummaryAxisProperties::qwtPlotAxisType() const
|
||||
QwtPlot::Axis RimPlotAxisProperties::qwtPlotAxisType() const
|
||||
{
|
||||
return m_axis;
|
||||
}
|
||||
@@ -212,7 +223,7 @@ QwtPlot::Axis RimSummaryAxisProperties::qwtPlotAxisType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PlotAxis RimSummaryAxisProperties::plotAxisType() const
|
||||
RiaDefines::PlotAxis RimPlotAxisProperties::plotAxisType() const
|
||||
{
|
||||
if (m_axis == QwtPlot::yRight) return RiaDefines::PLOT_AXIS_RIGHT;
|
||||
if (m_axis == QwtPlot::xBottom) return RiaDefines::PLOT_AXIS_BOTTOM;
|
||||
@@ -223,7 +234,7 @@ RiaDefines::PlotAxis RimSummaryAxisProperties::plotAxisType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryAxisProperties::useAutoTitle() const
|
||||
bool RimPlotAxisProperties::useAutoTitle() const
|
||||
{
|
||||
return isAutoTitle();
|
||||
}
|
||||
@@ -231,7 +242,7 @@ bool RimSummaryAxisProperties::useAutoTitle() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryAxisProperties::showDescription() const
|
||||
bool RimPlotAxisProperties::showDescription() const
|
||||
{
|
||||
return m_displayLongName();
|
||||
}
|
||||
@@ -239,7 +250,7 @@ bool RimSummaryAxisProperties::showDescription() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryAxisProperties::showAcronym() const
|
||||
bool RimPlotAxisProperties::showAcronym() const
|
||||
{
|
||||
return m_displayShortName();
|
||||
}
|
||||
@@ -247,7 +258,7 @@ bool RimSummaryAxisProperties::showAcronym() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryAxisProperties::showUnitText() const
|
||||
bool RimPlotAxisProperties::showUnitText() const
|
||||
{
|
||||
return m_displayUnitText();
|
||||
}
|
||||
@@ -255,7 +266,7 @@ bool RimSummaryAxisProperties::showUnitText() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryAxisProperties::isAutoZoom() const
|
||||
bool RimPlotAxisProperties::isAutoZoom() const
|
||||
{
|
||||
return m_isAutoZoom();
|
||||
}
|
||||
@@ -263,7 +274,7 @@ bool RimSummaryAxisProperties::isAutoZoom() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAxisProperties::setAutoZoom(bool enableAutoZoom)
|
||||
void RimPlotAxisProperties::setAutoZoom(bool enableAutoZoom)
|
||||
{
|
||||
m_isAutoZoom = enableAutoZoom;
|
||||
}
|
||||
@@ -271,7 +282,7 @@ void RimSummaryAxisProperties::setAutoZoom(bool enableAutoZoom)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryAxisProperties::isActive() const
|
||||
bool RimPlotAxisProperties::isActive() const
|
||||
{
|
||||
return m_isActive;
|
||||
}
|
||||
@@ -279,38 +290,37 @@ bool RimSummaryAxisProperties::isActive() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
||||
void RimPlotAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
|
||||
const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &isAutoTitle)
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimSummaryPlot);
|
||||
if (rimSummaryPlot)
|
||||
else if (changedField == &visibleRangeMax)
|
||||
{
|
||||
if (changedField == &visibleRangeMax)
|
||||
{
|
||||
if (visibleRangeMin > visibleRangeMax) visibleRangeMax = oldValue.toDouble();
|
||||
if (visibleRangeMin > visibleRangeMax) visibleRangeMax = oldValue.toDouble();
|
||||
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
else if (changedField == &visibleRangeMin)
|
||||
{
|
||||
if (visibleRangeMin > visibleRangeMax) visibleRangeMin = oldValue.toDouble();
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
else if (changedField == &visibleRangeMin)
|
||||
{
|
||||
if (visibleRangeMin > visibleRangeMax) visibleRangeMin = oldValue.toDouble();
|
||||
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
|
||||
RimRiuQwtPlotOwnerInterface* parentPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(parentPlot);
|
||||
if (parentPlot)
|
||||
{
|
||||
if (changedField == &isLogarithmicScaleEnabled)
|
||||
{
|
||||
rimSummaryPlot->loadDataAndUpdate();
|
||||
parentPlot->updateAxisScaling();
|
||||
}
|
||||
else
|
||||
{
|
||||
rimSummaryPlot->updateAxes();
|
||||
parentPlot->updateAxisDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,7 +328,7 @@ void RimSummaryAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAxisProperties::updateOptionSensitivity()
|
||||
void RimPlotAxisProperties::updateOptionSensitivity()
|
||||
{
|
||||
customTitle.uiCapability()->setUiReadOnly(isAutoTitle);
|
||||
}
|
||||
@@ -326,7 +336,7 @@ void RimSummaryAxisProperties::updateOptionSensitivity()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryAxisProperties::initAfterRead()
|
||||
void RimPlotAxisProperties::initAfterRead()
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
@@ -334,7 +344,7 @@ void RimSummaryAxisProperties::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSummaryAxisProperties::objectToggleField()
|
||||
caf::PdmFieldHandle* RimPlotAxisProperties::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
// Copyright (C) 2016-2018 Statoil ASA
|
||||
// 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
|
||||
@@ -33,7 +34,7 @@
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryAxisProperties : public caf::PdmObject
|
||||
class RimPlotAxisProperties : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -52,8 +53,9 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
RimSummaryAxisProperties();
|
||||
RimPlotAxisProperties();
|
||||
|
||||
void setEnableTitleTextSettings(bool enable);
|
||||
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
|
||||
QwtPlot::Axis qwtPlotAxisType() const;
|
||||
RiaDefines::PlotAxis plotAxisType() const;
|
||||
@@ -104,4 +106,6 @@ private:
|
||||
|
||||
caf::PdmField<QString> m_name;
|
||||
QwtPlot::Axis m_axis;
|
||||
|
||||
bool m_enableTitleTextSettings;
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimViewWindow.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
class RimRiuQwtPlotOwnerInterface
|
||||
{
|
||||
public:
|
||||
virtual void detachAllCurves() = 0;
|
||||
virtual void updateAxisScaling() = 0;
|
||||
virtual void updateAxisDisplay() = 0;
|
||||
virtual void updateZoomWindowFromQwt() = 0;
|
||||
virtual void selectAxisInPropertyEditor(int axis) = 0;
|
||||
virtual void setAutoZoomForAllAxes(bool enableAutoZoom) = 0;
|
||||
|
||||
virtual caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const = 0;
|
||||
|
||||
|
||||
};
|
||||
@@ -17,7 +17,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCrossPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryTimeAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryObservedDataFile.h
|
||||
@@ -58,7 +57,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCrossPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryTimeAxisProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAxisProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryObservedDataFile.cpp
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "qwt_date.h"
|
||||
#include "qwt_plot.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimAsciiDataCurve, "AsciiDataCurve");
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSummaryCurveDefSelectionDialog.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
#include "RimSummaryPlotSourceStepping.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEnsembleCurveSetCollection, "RimEnsembleCurveSetCollection");
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuSummaryCurveDefSelectionDialog.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
@@ -53,6 +52,7 @@
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "qwt_date.h"
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
@@ -30,11 +30,13 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotSourceStepping.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
|
||||
#include "cafPdmUiTreeViewEditor.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryCurveCollection, "RimSummaryCurveCollection");
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryAxisProperties.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimAsciiDataCurve.h"
|
||||
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotYAxisFormatter::RimSummaryPlotYAxisFormatter(RimSummaryAxisProperties* axisProperties,
|
||||
RimSummaryPlotYAxisFormatter::RimSummaryPlotYAxisFormatter(RimPlotAxisProperties* axisProperties,
|
||||
const std::vector<RimSummaryCurve*>& summaryCurves,
|
||||
const std::vector<RimAsciiDataCurve*>& asciiCurves,
|
||||
const std::set<QString>& timeHistoryCurveQuantities)
|
||||
@@ -138,10 +138,10 @@ void RimSummaryPlotYAxisFormatter::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
|
||||
|
||||
switch (m_axisProperties->titlePositionEnum())
|
||||
{
|
||||
case RimSummaryAxisProperties::AXIS_TITLE_CENTER:
|
||||
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
|
||||
axisTitleY.setRenderFlags(Qt::AlignCenter);
|
||||
break;
|
||||
case RimSummaryAxisProperties::AXIS_TITLE_END:
|
||||
case RimPlotAxisProperties::AXIS_TITLE_END:
|
||||
axisTitleY.setRenderFlags(Qt::AlignRight);
|
||||
break;
|
||||
}
|
||||
@@ -157,16 +157,16 @@ void RimSummaryPlotYAxisFormatter::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
|
||||
}
|
||||
|
||||
{
|
||||
if (m_axisProperties->numberFormat == RimSummaryAxisProperties::NUMBER_FORMAT_AUTO)
|
||||
if (m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO)
|
||||
{
|
||||
qwtPlot->setAxisScaleDraw(m_axisProperties->qwtPlotAxisType(), new QwtScaleDraw);
|
||||
}
|
||||
else if (m_axisProperties->numberFormat == RimSummaryAxisProperties::NUMBER_FORMAT_DECIMAL)
|
||||
else if (m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_DECIMAL)
|
||||
{
|
||||
qwtPlot->setAxisScaleDraw(m_axisProperties->qwtPlotAxisType(),
|
||||
new DecimalScaleDraw(m_axisProperties->scaleFactor(), m_axisProperties->numberOfDecimals()));
|
||||
}
|
||||
else if (m_axisProperties->numberFormat == RimSummaryAxisProperties::NUMBER_FORMAT_SCIENTIFIC)
|
||||
else if (m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_SCIENTIFIC)
|
||||
{
|
||||
qwtPlot->setAxisScaleDraw(m_axisProperties->qwtPlotAxisType(),
|
||||
new ScientificScaleDraw(m_axisProperties->scaleFactor(), m_axisProperties->numberOfDecimals()));
|
||||
@@ -265,7 +265,7 @@ QString RimSummaryPlotYAxisFormatter::autoAxisTitle() const
|
||||
QString assembledYAxisText;
|
||||
QString scaleFactorText = "";
|
||||
|
||||
if (m_axisProperties->numberFormat() != RimSummaryAxisProperties::NUMBER_FORMAT_AUTO)
|
||||
if (m_axisProperties->numberFormat() != RimPlotAxisProperties::NUMBER_FORMAT_AUTO)
|
||||
{
|
||||
if (m_axisProperties->scaleFactor() != 1.0)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
class RimAsciiDataCurve;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryAxisProperties;
|
||||
class RimPlotAxisProperties;
|
||||
|
||||
class RiuSummaryQwtPlot;
|
||||
|
||||
@@ -33,7 +33,7 @@ class QwtPlotCurve;
|
||||
class RimSummaryPlotYAxisFormatter
|
||||
{
|
||||
public:
|
||||
RimSummaryPlotYAxisFormatter(RimSummaryAxisProperties* axisProperties,
|
||||
RimSummaryPlotYAxisFormatter(RimPlotAxisProperties* axisProperties,
|
||||
const std::vector<RimSummaryCurve*>& summaryCurves,
|
||||
const std::vector<RimAsciiDataCurve*>& asciiCurves,
|
||||
const std::set<QString>& timeHistoryCurveQuantities);
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
static std::string shortCalculationName(const std::string& calculationName);
|
||||
|
||||
private:
|
||||
RimSummaryAxisProperties* m_axisProperties;
|
||||
RimPlotAxisProperties* m_axisProperties;
|
||||
const std::vector<RimSummaryCurve*> m_summaryCurves;
|
||||
const std::vector<RimAsciiDataCurve*> m_asciiDataCurves;
|
||||
const std::set<QString> m_timeHistoryCurveQuantities;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAxisProperties.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
@@ -160,17 +160,17 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis", "", "", "");
|
||||
m_leftYAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
m_leftYAxisProperties = new RimSummaryAxisProperties;
|
||||
m_leftYAxisProperties = new RimPlotAxisProperties;
|
||||
m_leftYAxisProperties->setNameAndAxis("Left Y-Axis", QwtPlot::yLeft);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis", "", "", "");
|
||||
m_rightYAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
m_rightYAxisProperties = new RimSummaryAxisProperties;
|
||||
m_rightYAxisProperties = new RimPlotAxisProperties;
|
||||
m_rightYAxisProperties->setNameAndAxis("Right Y-Axis", QwtPlot::yRight);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_bottomAxisProperties, "BottomAxisProperties", "Bottom X Axis", "", "", "");
|
||||
m_bottomAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
m_bottomAxisProperties = new RimSummaryAxisProperties;
|
||||
m_bottomAxisProperties = new RimPlotAxisProperties;
|
||||
m_bottomAxisProperties->setNameAndAxis("Bottom X-Axis", QwtPlot::xBottom);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeAxisProperties, "TimeAxisProperties", "Time Axis", "", "", "");
|
||||
@@ -238,33 +238,6 @@ RimSummaryTimeAxisProperties* RimSummaryPlot::timeAxisProperties()
|
||||
return m_timeAxisProperties();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::selectAxisInPropertyEditor(int axis)
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
if (axis == QwtPlot::yLeft)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_leftYAxisProperties);
|
||||
}
|
||||
else if (axis == QwtPlot::yRight)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_rightYAxisProperties);
|
||||
}
|
||||
else if (axis == QwtPlot::xBottom)
|
||||
{
|
||||
if (m_isCrossPlot)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_bottomAxisProperties);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_timeAxisProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -565,6 +538,22 @@ size_t RimSummaryPlot::singleColorCurveCount() const
|
||||
return colorIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateAxisScaling()
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateAxisDisplay()
|
||||
{
|
||||
updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -582,7 +571,7 @@ void RimSummaryPlot::updateAxis(RiaDefines::PlotAxis plotAxis)
|
||||
qwtAxis = QwtPlot::yRight;
|
||||
}
|
||||
|
||||
RimSummaryAxisProperties* yAxisProperties = yAxisPropertiesLeftOrRight(plotAxis);
|
||||
RimPlotAxisProperties* yAxisProperties = yAxisPropertiesLeftOrRight(plotAxis);
|
||||
if (yAxisProperties->isActive() && hasVisibleCurvesForAxis(plotAxis))
|
||||
{
|
||||
m_qwtPlot->enableAxis(qwtAxis, true);
|
||||
@@ -639,7 +628,7 @@ void RimSummaryPlot::updateZoomForAxis(RiaDefines::PlotAxis plotAxis)
|
||||
}
|
||||
else
|
||||
{
|
||||
RimSummaryAxisProperties* yAxisProps = yAxisPropertiesLeftOrRight(plotAxis);
|
||||
RimPlotAxisProperties* yAxisProps = yAxisPropertiesLeftOrRight(plotAxis);
|
||||
|
||||
if (yAxisProps->isAutoZoom())
|
||||
{
|
||||
@@ -764,9 +753,9 @@ bool RimSummaryPlot::hasVisibleCurvesForAxis(RiaDefines::PlotAxis plotAxis) cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryAxisProperties* RimSummaryPlot::yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const
|
||||
RimPlotAxisProperties* RimSummaryPlot::yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const
|
||||
{
|
||||
RimSummaryAxisProperties* yAxisProps = nullptr;
|
||||
RimPlotAxisProperties* yAxisProps = nullptr;
|
||||
|
||||
if (leftOrRightPlotAxis == RiaDefines::PLOT_AXIS_LEFT)
|
||||
{
|
||||
@@ -892,7 +881,7 @@ void RimSummaryPlot::updateBottomXAxis()
|
||||
|
||||
QwtPlot::Axis qwtAxis = QwtPlot::xBottom;
|
||||
|
||||
RimSummaryAxisProperties* bottomAxisProperties = m_bottomAxisProperties();
|
||||
RimPlotAxisProperties* bottomAxisProperties = m_bottomAxisProperties();
|
||||
|
||||
if (bottomAxisProperties->isActive())
|
||||
{
|
||||
@@ -1267,6 +1256,51 @@ void RimSummaryPlot::updateZoomWindowFromQwt()
|
||||
setAutoZoomForAllAxes(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::selectAxisInPropertyEditor(int axis)
|
||||
{
|
||||
RiuPlotMainWindowTools::showPlotMainWindow();
|
||||
if (axis == QwtPlot::yLeft)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_leftYAxisProperties);
|
||||
}
|
||||
else if (axis == QwtPlot::yRight)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_rightYAxisProperties);
|
||||
}
|
||||
else if (axis == QwtPlot::xBottom)
|
||||
{
|
||||
if (m_isCrossPlot)
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_bottomAxisProperties);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(m_timeAxisProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setAutoZoomForAllAxes(bool enableAutoZoom)
|
||||
{
|
||||
m_leftYAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
m_rightYAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
|
||||
if (m_isCrossPlot)
|
||||
{
|
||||
m_bottomAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1274,8 +1308,9 @@ void RimSummaryPlot::updateAxisRangesFromQwt()
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
QwtInterval leftAxis, rightAxis, timeAxis;
|
||||
m_qwtPlot->currentVisibleWindow(&leftAxis, &rightAxis, &timeAxis);
|
||||
QwtInterval leftAxis = m_qwtPlot->currentAxisRange(QwtPlot::yLeft);
|
||||
QwtInterval rightAxis = m_qwtPlot->currentAxisRange(QwtPlot::yRight);
|
||||
QwtInterval timeAxis = m_qwtPlot->currentAxisRange(QwtPlot::xBottom);
|
||||
|
||||
m_leftYAxisProperties->visibleRangeMax = leftAxis.maxValue();
|
||||
m_leftYAxisProperties->visibleRangeMin = leftAxis.minValue();
|
||||
@@ -1300,24 +1335,6 @@ void RimSummaryPlot::updateAxisRangesFromQwt()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setAutoZoomForAllAxes(bool enableAutoZoom)
|
||||
{
|
||||
m_leftYAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
m_rightYAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
|
||||
if (m_isCrossPlot)
|
||||
{
|
||||
m_bottomAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeAxisProperties->setAutoZoom(enableAutoZoom);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RimRiuQwtPlotOwnerInterface.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "qwt_plot_textlabel.h"
|
||||
@@ -44,7 +45,7 @@ class RimEnsembleCurveSet;
|
||||
class RimEnsembleCurveSetCollection;
|
||||
class RimSummaryCurveFilter_OBSOLETE;
|
||||
class RimSummaryTimeAxisProperties;
|
||||
class RimSummaryAxisProperties;
|
||||
class RimPlotAxisProperties;
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimSummaryPlotNameHelper;
|
||||
|
||||
@@ -55,7 +56,7 @@ class QwtPlotCurve;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlot : public RimViewWindow
|
||||
class RimSummaryPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -84,7 +85,6 @@ public:
|
||||
|
||||
void addAsciiDataCruve(RimAsciiDataCurve* curve);
|
||||
|
||||
caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const;
|
||||
size_t curveCount() const;
|
||||
|
||||
void detachAllCurves();
|
||||
@@ -92,19 +92,16 @@ public:
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
void updateAxes();
|
||||
void zoomAll() override;
|
||||
void zoomAll() override;
|
||||
|
||||
void updateZoomInQwt();
|
||||
void updateZoomWindowFromQwt();
|
||||
|
||||
bool isLogarithmicScaleEnabled(RiaDefines::PlotAxis plotAxis) const;
|
||||
|
||||
RimSummaryTimeAxisProperties* timeAxisProperties();
|
||||
time_t firstTimeStepOfFirstCurve();
|
||||
|
||||
void selectAxisInPropertyEditor(int axis);
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QWidget* viewWidget() override;
|
||||
|
||||
QString asciiDataForPlotExport(DateTimePeriod resamplingPeriod = DateTimePeriod::NONE) const;
|
||||
|
||||
@@ -134,8 +131,18 @@ public:
|
||||
bool containsResamplableCurves() const;
|
||||
|
||||
size_t singleColorCurveCount() const;
|
||||
// RimViewWindow overrides
|
||||
|
||||
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;
|
||||
|
||||
public:
|
||||
// RimViewWindow overrides
|
||||
QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
void deleteViewWidget() override;
|
||||
void initAfterRead() override;
|
||||
@@ -164,7 +171,7 @@ private:
|
||||
std::vector<RimAsciiDataCurve*> visibleAsciiDataCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
bool hasVisibleCurvesForAxis(RiaDefines::PlotAxis plotAxis) const;
|
||||
|
||||
RimSummaryAxisProperties* yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const;
|
||||
RimPlotAxisProperties* yAxisPropertiesLeftOrRight(RiaDefines::PlotAxis leftOrRightPlotAxis) const;
|
||||
void updateAxis(RiaDefines::PlotAxis plotAxis);
|
||||
|
||||
void updateZoomForAxis(RiaDefines::PlotAxis plotAxis);
|
||||
@@ -173,7 +180,6 @@ private:
|
||||
void updateBottomXAxis();
|
||||
|
||||
void updateAxisRangesFromQwt();
|
||||
void setAutoZoomForAllAxes(bool enableAutoZoom);
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
@@ -189,10 +195,10 @@ private:
|
||||
|
||||
caf::PdmChildArrayField<RimAsciiDataCurve*> m_asciiDataCurves;
|
||||
|
||||
caf::PdmChildField<RimSummaryAxisProperties*> m_leftYAxisProperties;
|
||||
caf::PdmChildField<RimSummaryAxisProperties*> m_rightYAxisProperties;
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_leftYAxisProperties;
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_rightYAxisProperties;
|
||||
|
||||
caf::PdmChildField<RimSummaryAxisProperties*> m_bottomAxisProperties;
|
||||
caf::PdmChildField<RimPlotAxisProperties*> m_bottomAxisProperties;
|
||||
caf::PdmChildField<RimSummaryTimeAxisProperties*> m_timeAxisProperties;
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
|
||||
Reference in New Issue
Block a user