mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 15:26:48 -06:00
(#425) Resetting X-axis range to default when all curves are removed
This commit is contained in:
parent
f16b2af600
commit
98efbf863f
@ -34,6 +34,7 @@
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimView.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotTrace.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
@ -115,6 +116,13 @@ void RicDeleteItemExec::redo()
|
||||
wellLogPlot->updateAvailableDepthRange();
|
||||
}
|
||||
|
||||
RimWellLogPlotTrace* wellLogPlotTrace;
|
||||
parentObj->firstAnchestorOrThisOfType(wellLogPlotTrace);
|
||||
if (wellLogPlotTrace)
|
||||
{
|
||||
wellLogPlotTrace->updateAxisRanges();
|
||||
}
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotCollection = NULL;
|
||||
parentObj->firstAnchestorOrThisOfType(wellLogPlotCollection);
|
||||
if (wellLogPlotCollection)
|
||||
|
@ -31,6 +31,10 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define RI_LOGPLOTTRACE_MINX_DEFAULT -10.0
|
||||
#define RI_LOGPLOTTRACE_MAXX_DEFAULT 100.0
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellLogPlotTrace, "WellLogPlotTrace");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -46,9 +50,8 @@ RimWellLogPlotTrace::RimWellLogPlotTrace()
|
||||
CAF_PDM_InitFieldNoDefault(&curves, "Curves", "", "", "", "");
|
||||
curves.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_minimumValue, "MinimumValue", -10.0, "Minimum value", "", "", "");
|
||||
CAF_PDM_InitField(&m_maximumValue, "MaximumValue", 100.0, "Maximum value", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_minimumValue, "MinimumValue", RI_LOGPLOTTRACE_MINX_DEFAULT, "Minimum value", "", "", "");
|
||||
CAF_PDM_InitField(&m_maximumValue, "MaximumValue", RI_LOGPLOTTRACE_MAXX_DEFAULT, "Maximum value", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -188,3 +191,37 @@ void RimWellLogPlotTrace::detachAllCurves()
|
||||
curves[cIdx]->detachCurve();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotTrace::updateAxisRanges()
|
||||
{
|
||||
bool rangesChanged = false;
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
firstAnchestorOrThisOfType(wellLogPlot);
|
||||
if (wellLogPlot)
|
||||
{
|
||||
double minimumDepth, maximumDepth;
|
||||
wellLogPlot->visibleDepthRange(&minimumDepth, &maximumDepth);
|
||||
|
||||
m_viewer->setAxisScale(QwtPlot::yLeft, minimumDepth, maximumDepth);
|
||||
rangesChanged = true;
|
||||
}
|
||||
|
||||
// Assume auto-scaling on X-axis as long as curves exist, reset to default if not
|
||||
if (curves.size() < 1)
|
||||
{
|
||||
m_viewer->setAxisScale(QwtPlot::xTop, RI_LOGPLOTTRACE_MINX_DEFAULT, RI_LOGPLOTTRACE_MAXX_DEFAULT);
|
||||
rangesChanged = true;
|
||||
}
|
||||
|
||||
if (rangesChanged)
|
||||
{
|
||||
m_viewer->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
void loadDataAndUpdate();
|
||||
|
||||
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
|
||||
void updateAxisRanges();
|
||||
|
||||
RiuWellLogTracePlot* viewer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user