mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#491) Updating X-range fields according to changes in plots
This commit is contained in:
parent
1df537627d
commit
2653bcf1a9
@ -108,6 +108,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
plot->updateAvailableDepthRange();
|
||||
plot->setVisibleDepthRangeFromContents();
|
||||
plotTrace->updateXAxisRangeFromCurves();
|
||||
plotTrace->viewer()->replot();
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
|
@ -193,6 +193,11 @@ void RimWellLogExtractionCurve::updatePlotData()
|
||||
RimWellLogPlotTrace* plotTrace;
|
||||
firstAnchestorOrThisOfType(plotTrace);
|
||||
|
||||
if (plotTrace)
|
||||
{
|
||||
plotTrace->updateXAxisRangeFromCurves();
|
||||
}
|
||||
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
firstAnchestorOrThisOfType(wellLogPlot);
|
||||
|
||||
|
@ -119,17 +119,26 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
{
|
||||
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
RimWellLogPlot* wellLoglot;
|
||||
firstAnchestorOrThisOfType(wellLoglot);
|
||||
|
||||
RimWellLogPlotTrace* wellLoglotTrace;
|
||||
firstAnchestorOrThisOfType(wellLoglotTrace);
|
||||
|
||||
if (changedField == &m_wellPath)
|
||||
{
|
||||
this->updatePlotData();
|
||||
|
||||
RimWellLogPlot* wellLoglot;
|
||||
firstAnchestorOrThisOfType(wellLoglot);
|
||||
if (wellLoglot)
|
||||
{
|
||||
wellLoglot->updateAvailableDepthRange();
|
||||
wellLoglot->setVisibleDepthRangeFromContents();
|
||||
}
|
||||
|
||||
if (wellLoglotTrace)
|
||||
{
|
||||
wellLoglotTrace->updateXAxisRangeFromCurves();
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_wellLogChannnelName)
|
||||
{
|
||||
@ -140,8 +149,6 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
|
||||
this->updatePlotData();
|
||||
|
||||
RimWellLogPlot* wellLoglot;
|
||||
firstAnchestorOrThisOfType(wellLoglot);
|
||||
if (wellLoglot)
|
||||
{
|
||||
if (!wellLoglot->hasAvailableDepthRange())
|
||||
@ -149,6 +156,11 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
wellLoglot->updateAvailableDepthRange();
|
||||
wellLoglot->setVisibleDepthRangeFromContents();
|
||||
}
|
||||
|
||||
if (wellLoglotTrace)
|
||||
{
|
||||
wellLoglotTrace->updateXAxisRangeFromCurves();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,9 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellLogPlotCurve.h"
|
||||
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuWellLogTracePlot.h"
|
||||
#include "RiuWellLogPlotCurve.h"
|
||||
|
||||
@ -157,6 +159,26 @@ bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth)
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue) const
|
||||
{
|
||||
CVF_ASSERT(minimumValue && maximumValue);
|
||||
CVF_ASSERT(m_plotCurve);
|
||||
|
||||
if (m_plotCurve->data()->size() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*minimumValue = m_plotCurve->minXValue();
|
||||
*maximumValue = m_plotCurve->maxXValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -180,4 +202,3 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
|
||||
{
|
||||
return m_plotCurve;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
void setColor(const cvf::Color3f& color);
|
||||
|
||||
bool depthRange(double* minimumDepth, double* maximumDepth) const;
|
||||
bool valueRange(double* minimumValue, double* maximumValue) const;
|
||||
|
||||
void setPlot(RiuWellLogTracePlot* plot);
|
||||
void detachCurve();
|
||||
|
@ -172,6 +172,8 @@ void RimWellLogPlotTrace::loadDataAndUpdate()
|
||||
{
|
||||
curves[cIdx]->updatePlotData();
|
||||
}
|
||||
|
||||
updateXAxisRangeFromCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -233,6 +235,49 @@ void RimWellLogPlotTrace::updateAxisRangesAndReplot()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotTrace::updateXAxisRangeFromCurves()
|
||||
{
|
||||
double minValue = HUGE_VAL;
|
||||
double maxValue = -HUGE_VAL;
|
||||
|
||||
size_t curveCount = curves.size();
|
||||
if (curveCount < 1) return;
|
||||
|
||||
bool rangeUpdated = false;
|
||||
|
||||
for (size_t cIdx = 0; cIdx < curveCount; cIdx++)
|
||||
{
|
||||
double minCurveValue = HUGE_VAL;
|
||||
double maxCurveValue = -HUGE_VAL;
|
||||
|
||||
if (curves[cIdx]->valueRange(&minCurveValue, &maxCurveValue))
|
||||
{
|
||||
if (minCurveValue < minValue)
|
||||
{
|
||||
minValue = minCurveValue;
|
||||
rangeUpdated = true;
|
||||
}
|
||||
|
||||
if (maxCurveValue > maxValue)
|
||||
{
|
||||
maxValue = maxCurveValue;
|
||||
rangeUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeUpdated)
|
||||
{
|
||||
m_minimumValue = minValue;
|
||||
m_maximumValue = maxValue;
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
|
||||
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
|
||||
void updateAxisRangesAndReplot();
|
||||
void updateXAxisRangeFromCurves();
|
||||
|
||||
RiuWellLogTracePlot* viewer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user