mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#840) Summary : Added properties for time axis
This commit is contained in:
parent
b8f1099d32
commit
62411301da
@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicSummaryCurveSwitchAxisFeature, "RicSummaryCurveSwitchAxis
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSummaryCurveSwitchAxisFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -61,7 +61,7 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
summaryCurve->firstAncestorOrThisOfType(plot);
|
||||
if (plot) plot->updateLeftAndRightYAxis();
|
||||
if (plot) plot->updateAxes();
|
||||
}
|
||||
else if (summaryCurveFilter)
|
||||
{
|
||||
|
@ -94,6 +94,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryYAxisProperties.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCurvesCalculator.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryTimeAxisProperties.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -186,6 +187,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryYAxisProperties.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCurvesCalculator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryTimeAxisProperties.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -57,7 +57,7 @@ namespace caf
|
||||
void caf::AppEnum< RimDefines::PlotAxis >::setUp()
|
||||
{
|
||||
addItem(RimDefines::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left");
|
||||
addItem(RimDefines::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right");
|
||||
//addItem(RimDefines::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right");
|
||||
|
||||
setDefault(RimDefines::PLOT_AXIS_LEFT);
|
||||
}
|
||||
|
@ -468,11 +468,11 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
|
||||
this->loadDataAndUpdate();
|
||||
|
||||
plot->updateLeftAndRightYAxis();
|
||||
plot->updateAxes();
|
||||
}
|
||||
else if (&m_showCurve == changedField)
|
||||
{
|
||||
plot->updateLeftAndRightYAxis();
|
||||
plot->updateAxes();
|
||||
}
|
||||
else if (changedField == &m_addCaseNameToCurveName)
|
||||
{
|
||||
@ -483,7 +483,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
updateQwtPlotAxis();
|
||||
|
||||
plot->updateLeftAndRightYAxis();
|
||||
plot->updateAxes();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ void RimSummaryCurveFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateLeftAndRightYAxis();
|
||||
plot->updateAxes();
|
||||
}
|
||||
else if (changedField == &m_showCurves)
|
||||
{
|
||||
@ -386,11 +386,11 @@ void RimSummaryCurveFilter::updatePlotAxisForCurves()
|
||||
{
|
||||
curve->setPlotAxis(m_plotAxis());
|
||||
curve->updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateLeftAndRightYAxis();
|
||||
}
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -531,15 +531,7 @@ void RimSummaryCurveFilter::setPlotAxis(RimDefines::PlotAxis plotAxis)
|
||||
m_plotAxis = plotAxis;
|
||||
updateConnectedEditors();
|
||||
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setPlotAxis(m_plotAxis());
|
||||
curve->updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateLeftAndRightYAxis();
|
||||
}
|
||||
updatePlotAxisForCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -60,15 +60,18 @@ private:
|
||||
static int calculatePrecision(double value)
|
||||
{
|
||||
double absVal = fabs(value);
|
||||
|
||||
const int numberOfDigits = 2;
|
||||
|
||||
if (1e-16 < absVal && absVal < 1.0e3)
|
||||
{
|
||||
int logVal = static_cast<int>(log10(absVal));
|
||||
int numDigitsAfterPoint = abs(logVal - 6);
|
||||
int numDigitsAfterPoint = abs(logVal - numberOfDigits);
|
||||
return numDigitsAfterPoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 3;
|
||||
return numberOfDigits;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryCurvesCalculator.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
#include "RimSummaryYAxisProperties.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
@ -33,12 +34,13 @@
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QRectF>
|
||||
|
||||
#include "qwt_plot_curve.h"
|
||||
#include "qwt_plot_renderer.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
|
||||
@ -60,9 +62,6 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
CAF_PDM_InitFieldNoDefault(&m_curves, "SummaryCurves", "", "", "", "");
|
||||
m_curves.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_visibleWindow, "VisibleWindow", std::vector<float>(), "Visible Display Window", "", "", "");
|
||||
m_visibleWindow.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis", "", "", "");
|
||||
m_leftYAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
@ -76,6 +75,15 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
m_rightYAxisPropertiesObject = std::unique_ptr<RimSummaryYAxisProperties>(new RimSummaryYAxisProperties);
|
||||
m_rightYAxisPropertiesObject->setNameAndAxis("Right Y-Axis", QwtPlot::yRight);
|
||||
m_rightYAxisProperties = m_rightYAxisPropertiesObject.get();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_timeAxisProperties, "TimeAxisProperties", "Time Axis", "", "", "");
|
||||
m_timeAxisProperties.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
m_timeAxisPropertiesObject = std::unique_ptr<RimSummaryTimeAxisProperties>(new RimSummaryTimeAxisProperties);
|
||||
m_timeAxisProperties = m_timeAxisPropertiesObject.get();
|
||||
|
||||
CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Auto Zoom", "", "", "");
|
||||
m_isAutoZoom.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -109,12 +117,12 @@ void RimSummaryPlot::deletePlotWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateLeftAndRightYAxis()
|
||||
void RimSummaryPlot::updateAxes()
|
||||
{
|
||||
updateAxis(RimDefines::PLOT_AXIS_LEFT);
|
||||
updateAxis(RimDefines::PLOT_AXIS_RIGHT);
|
||||
|
||||
if (m_qwtPlot) m_qwtPlot->replot();
|
||||
updateZoomInQwt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -220,18 +228,16 @@ void RimSummaryPlot::setZoomWindow(const QRectF& zoomWindow)
|
||||
{
|
||||
if(!zoomWindow.isEmpty())
|
||||
{
|
||||
std::vector<float> window;
|
||||
window.push_back(zoomWindow.left());
|
||||
window.push_back(zoomWindow.top());
|
||||
window.push_back(zoomWindow.width());
|
||||
window.push_back(zoomWindow.height());
|
||||
|
||||
m_visibleWindow = window;
|
||||
|
||||
m_leftYAxisProperties->visibleRangeMax = zoomWindow.bottom();
|
||||
m_leftYAxisProperties->visibleRangeMin = zoomWindow.top();
|
||||
m_leftYAxisProperties->updateConnectedEditors();
|
||||
|
||||
m_timeAxisProperties->setVisibleRangeMin(zoomWindow.left());
|
||||
m_timeAxisProperties->setVisibleRangeMax(zoomWindow.right());
|
||||
m_timeAxisProperties->updateConnectedEditors();
|
||||
}
|
||||
|
||||
disableAutoZoom();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -244,6 +250,8 @@ void RimSummaryPlot::zoomAll()
|
||||
m_qwtPlot->zoomAll();
|
||||
this->setZoomWindow(m_qwtPlot->currentVisibleWindow());
|
||||
}
|
||||
|
||||
m_isAutoZoom = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -257,7 +265,7 @@ void RimSummaryPlot::addCurve(RimSummaryCurve* curve)
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
curve->setParentQwtPlot(m_qwtPlot);
|
||||
this->updateLeftAndRightYAxis();
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -273,7 +281,7 @@ void RimSummaryPlot::addCurveFilter(RimSummaryCurveFilter* curveFilter)
|
||||
if(m_qwtPlot)
|
||||
{
|
||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||
this->updateLeftAndRightYAxis();
|
||||
this->updateAxes();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -307,14 +315,9 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_qwtPlot)
|
||||
if (m_qwtPlot && RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_qwtPlot));
|
||||
}
|
||||
|
||||
this->setZoomWindow(m_qwtPlot->currentVisibleWindow());
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_qwtPlot));
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,10 +348,12 @@ QImage RimSummaryPlot::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.add(&m_timeAxisProperties);
|
||||
uiTreeOrdering.add(&m_leftYAxisProperties);
|
||||
uiTreeOrdering.add(&m_rightYAxisProperties);
|
||||
//uiTreeOrdering.add(&m_rightYAxisProperties);
|
||||
uiTreeOrdering.add(&m_curveFilters);
|
||||
uiTreeOrdering.add(&m_curves);
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -368,7 +373,7 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
this->updateLeftAndRightYAxis();
|
||||
this->updateAxes();
|
||||
|
||||
updateZoomInQwt();
|
||||
}
|
||||
@ -379,17 +384,31 @@ void RimSummaryPlot::loadDataAndUpdate()
|
||||
void RimSummaryPlot::updateZoomInQwt()
|
||||
{
|
||||
if (!m_qwtPlot) return;
|
||||
|
||||
// Todo: introduce autoscale
|
||||
|
||||
if(m_visibleWindow().size() == 4)
|
||||
|
||||
if (m_isAutoZoom)
|
||||
{
|
||||
QRectF visibleWindow(m_visibleWindow()[0], m_visibleWindow()[1], m_visibleWindow()[2], m_visibleWindow()[3]);
|
||||
zoomAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
QRectF visibleWindow;
|
||||
visibleWindow.setBottom(m_leftYAxisProperties->visibleRangeMin());
|
||||
visibleWindow.setTop(m_leftYAxisProperties->visibleRangeMax());
|
||||
visibleWindow.setLeft(m_timeAxisProperties->visibleRangeMin());
|
||||
visibleWindow.setRight(m_timeAxisProperties->visibleRangeMax());
|
||||
|
||||
m_qwtPlot->setZoomWindow(visibleWindow);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::disableAutoZoom()
|
||||
{
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -36,6 +36,7 @@ class RiuSummaryQwtPlot;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCurveFilter;
|
||||
class RimSummaryYAxisProperties;
|
||||
class RimSummaryTimeAxisProperties;
|
||||
class PdmUiTreeOrdering;
|
||||
|
||||
class QwtPlotCurve;
|
||||
@ -68,8 +69,9 @@ public:
|
||||
void setZoomWindow(const QRectF& zoomWindow);
|
||||
virtual void zoomAll() override;
|
||||
void updateZoomInQwt();
|
||||
void disableAutoZoom();
|
||||
|
||||
void updateLeftAndRightYAxis();
|
||||
void updateAxes();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
@ -81,8 +83,6 @@ protected:
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void updateViewerWidget();
|
||||
void updateViewerWidgetWindowTitle();
|
||||
@ -91,17 +91,21 @@ private:
|
||||
|
||||
void updateAxis(RimDefines::PlotAxis plotAxis);
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
caf::PdmField<QString> m_userName;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
caf::PdmChildArrayField<RimSummaryCurveFilter*> m_curveFilters;
|
||||
caf::PdmField<std::vector<float> > m_visibleWindow;
|
||||
|
||||
caf::PdmField<bool> m_isAutoZoom;
|
||||
caf::PdmChildField<RimSummaryYAxisProperties*> m_leftYAxisProperties;
|
||||
caf::PdmChildField<RimSummaryYAxisProperties*> m_rightYAxisProperties;
|
||||
caf::PdmChildField<RimSummaryTimeAxisProperties*> m_timeAxisProperties;
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
|
||||
// Internal objects managed by unique_ptr
|
||||
std::unique_ptr<RimSummaryYAxisProperties> m_leftYAxisPropertiesObject;
|
||||
std::unique_ptr<RimSummaryYAxisProperties> m_rightYAxisPropertiesObject;
|
||||
std::unique_ptr<RimSummaryTimeAxisProperties> m_timeAxisPropertiesObject;
|
||||
};
|
||||
|
@ -0,0 +1,135 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryTimeAxisProperties, "SummaryTimeAxisProperties");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryTimeAxisProperties::RimSummaryTimeAxisProperties()
|
||||
{
|
||||
CAF_PDM_InitObject("Time Axis", ":/SummaryPlot16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&fontSize, "FontSize", 11, "Font Size", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_visibleRangeMax, "VisibleRangeMax", "Max", "", "", "");
|
||||
m_visibleRangeMax.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_visibleRangeMin, "VisibleRangeMin", "Min", "", "", "");
|
||||
m_visibleRangeMin.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSummaryTimeAxisProperties::visibleRangeMin() const
|
||||
{
|
||||
return m_visibleRangeMin().toMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSummaryTimeAxisProperties::visibleRangeMax() const
|
||||
{
|
||||
return m_visibleRangeMax().toMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::setVisibleRangeMin(double value)
|
||||
{
|
||||
m_visibleRangeMin = QDateTime::fromMSecsSinceEpoch(value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::setVisibleRangeMax(double value)
|
||||
{
|
||||
m_visibleRangeMax = QDateTime::fromMSecsSinceEpoch(value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimSummaryTimeAxisProperties::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
*useOptionsOnly = true;
|
||||
|
||||
if (&fontSize == fieldNeedingOptions)
|
||||
{
|
||||
std::vector<int> fontSizes;
|
||||
fontSizes.push_back(8);
|
||||
fontSizes.push_back(10);
|
||||
fontSizes.push_back(11);
|
||||
fontSizes.push_back(12);
|
||||
fontSizes.push_back(16);
|
||||
fontSizes.push_back(24);
|
||||
|
||||
for (int value : fontSizes)
|
||||
{
|
||||
QString text = QString("%1").arg(value);
|
||||
options.push_back(caf::PdmOptionItemInfo(text, value));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimSummaryPlot);
|
||||
|
||||
if (changedField == &m_visibleRangeMax)
|
||||
{
|
||||
QDateTime test = newValue.toDateTime();
|
||||
if (!test.isValid())
|
||||
{
|
||||
m_visibleRangeMax = oldValue.toDateTime();
|
||||
}
|
||||
|
||||
rimSummaryPlot->disableAutoZoom();
|
||||
}
|
||||
else if (changedField == &m_visibleRangeMin)
|
||||
{
|
||||
QDateTime test = newValue.toDateTime();
|
||||
if (!test.isValid())
|
||||
{
|
||||
m_visibleRangeMin = oldValue.toDateTime();
|
||||
}
|
||||
|
||||
rimSummaryPlot->disableAutoZoom();
|
||||
}
|
||||
|
||||
rimSummaryPlot->updateAxes();
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryTimeAxisProperties : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSummaryTimeAxisProperties();
|
||||
|
||||
caf::PdmField<int> fontSize;
|
||||
|
||||
double visibleRangeMin() const;
|
||||
double visibleRangeMax() const;
|
||||
|
||||
void setVisibleRangeMin(double value);
|
||||
void setVisibleRangeMax(double value);
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
//virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QDateTime> m_visibleRangeMin;
|
||||
caf::PdmField<QDateTime> m_visibleRangeMax;
|
||||
};
|
@ -119,14 +119,27 @@ QwtPlot::Axis RimSummaryYAxisProperties::axis() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryYAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimSummaryPlot);
|
||||
|
||||
if (changedField == &isAutoTitle)
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
else if (changedField == &visibleRangeMax)
|
||||
{
|
||||
if (visibleRangeMin > visibleRangeMax) visibleRangeMax = oldValue.toDouble();
|
||||
|
||||
rimSummaryPlot->disableAutoZoom();
|
||||
}
|
||||
else if (changedField == &visibleRangeMin)
|
||||
{
|
||||
if (visibleRangeMin > visibleRangeMax) visibleRangeMin = oldValue.toDouble();
|
||||
|
||||
rimSummaryPlot->disableAutoZoom();
|
||||
}
|
||||
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimSummaryPlot);
|
||||
rimSummaryPlot->updateLeftAndRightYAxis();
|
||||
rimSummaryPlot->updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user