#5585 Improve the way we decide on autozoom for the X-range in Well Log Tracks

This commit is contained in:
Gaute Lindkvist
2020-04-15 09:29:04 +02:00
committed by Magne Sjaastad
parent 0b47e27e89
commit 7b445a7fb7
2 changed files with 30 additions and 25 deletions

View File

@@ -148,8 +148,8 @@ void RimWellLogCurve::setValuesWithMdAndTVD( const std::vector<double>& xValues,
bool isExtractionCurve, bool isExtractionCurve,
const QString& xUnits ) const QString& xUnits )
{ {
std::map<RiaDefines::DepthTypeEnum, std::vector<double>> depths = {{RiaDefines::MEASURED_DEPTH, measuredDepths}, std::map<RiaDefines::DepthTypeEnum, std::vector<double>> depths = { { RiaDefines::MEASURED_DEPTH, measuredDepths },
{RiaDefines::TRUE_VERTICAL_DEPTH, tvdMSL}}; { RiaDefines::TRUE_VERTICAL_DEPTH, tvdMSL } };
setValuesAndDepths( xValues, depths, rkbDiff, depthUnit, isExtractionCurve, xUnits ); setValuesAndDepths( xValues, depths, rkbDiff, depthUnit, isExtractionCurve, xUnits );
} }
@@ -263,7 +263,7 @@ void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& newValue ) const QVariant& newValue )
{ {
RimPlotCurve::fieldChangedByUi( changedField, oldValue, newValue ); RimPlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_showCurve ) if ( changedField == &m_showCurve && m_showCurve() )
{ {
updateZoomInParentPlot(); updateZoomInParentPlot();
} }

View File

@@ -82,6 +82,8 @@
#include <QWheelEvent> #include <QWheelEvent>
#include <algorithm>
#define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0 #define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0
#define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0 #define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0
#define RI_SCROLLWHEEL_ZOOMFACTOR 1.1 #define RI_SCROLLWHEEL_ZOOMFACTOR 1.1
@@ -1252,17 +1254,20 @@ void RimWellLogTrack::setAutoScaleYEnabled( bool enabled )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setAutoScaleXIfNecessary() void RimWellLogTrack::setAutoScaleXIfNecessary()
{ {
const double eps = 1.0e-8;
calculateXZoomRange(); calculateXZoomRange();
// If the new range is larger than the existing
if ( m_availableXRangeMin < m_visibleXRangeMin || m_availableXRangeMax > m_visibleXRangeMax ) double maxRange = std::max( m_visibleXRangeMax - m_visibleXRangeMin, m_availableXRangeMax - m_availableXRangeMin );
{
setAutoScaleXEnabled( true ); double maxLow = std::max( m_visibleXRangeMin(), m_availableXRangeMin );
} double minHigh = std::min( m_visibleXRangeMax(), m_availableXRangeMax );
// If the new range is much smaller than the existing double overlap = minHigh - maxLow;
if ( std::abs( m_availableXRangeMax - m_availableXRangeMin ) < 0.1 * std::abs( m_visibleXRangeMax - m_visibleXRangeMin ) )
if ( maxRange < eps || overlap < eps * maxRange )
{ {
setAutoScaleXEnabled( true ); setAutoScaleXEnabled( true );
} }
updateXZoom(); updateXZoom();
} }
@@ -1925,21 +1930,21 @@ std::vector<std::pair<double, double>> RimWellLogTrack::waterAndRockRegions( Ria
} }
double waterEndMD = extractor->cellIntersectionMDs().front(); double waterEndMD = extractor->cellIntersectionMDs().front();
double rockEndMD = extractor->cellIntersectionMDs().back(); double rockEndMD = extractor->cellIntersectionMDs().back();
return {{waterStartMD, waterEndMD}, {waterEndMD, rockEndMD}}; return { { waterStartMD, waterEndMD }, { waterEndMD, rockEndMD } };
} }
else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH )
{ {
double waterStartTVD = 0.0; double waterStartTVD = 0.0;
double waterEndTVD = extractor->cellIntersectionTVDs().front(); double waterEndTVD = extractor->cellIntersectionTVDs().front();
double rockEndTVD = extractor->cellIntersectionTVDs().back(); double rockEndTVD = extractor->cellIntersectionTVDs().back();
return {{waterStartTVD, waterEndTVD}, {waterEndTVD, rockEndTVD}}; return { { waterStartTVD, waterEndTVD }, { waterEndTVD, rockEndTVD } };
} }
else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH_RKB ) else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH_RKB )
{ {
double waterStartTVDRKB = extractor->wellPathData()->rkbDiff(); double waterStartTVDRKB = extractor->wellPathData()->rkbDiff();
double waterEndTVDRKB = extractor->cellIntersectionTVDs().front() + extractor->wellPathData()->rkbDiff(); double waterEndTVDRKB = extractor->cellIntersectionTVDs().front() + extractor->wellPathData()->rkbDiff();
double rockEndTVDRKB = extractor->cellIntersectionTVDs().back() + extractor->wellPathData()->rkbDiff(); double rockEndTVDRKB = extractor->cellIntersectionTVDs().back() + extractor->wellPathData()->rkbDiff();
return {{waterStartTVDRKB, waterEndTVDRKB}, {waterEndTVDRKB, rockEndTVDRKB}}; return { { waterStartTVDRKB, waterEndTVDRKB }, { waterEndTVDRKB, rockEndTVDRKB } };
} }
return {}; return {};
} }
@@ -2379,7 +2384,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
const std::vector<std::pair<double, double>> waterAndRockIntervals = const std::vector<std::pair<double, double>> waterAndRockIntervals =
waterAndRockRegions( plot->depthType(), extractor ); waterAndRockRegions( plot->depthType(), extractor );
m_annotationTool->attachNamedRegions( m_plotWidget, m_annotationTool->attachNamedRegions( m_plotWidget,
{"Sea Level", ""}, { "Sea Level", "" },
xRange, xRange,
waterAndRockIntervals, waterAndRockIntervals,
m_regionAnnotationDisplay(), m_regionAnnotationDisplay(),
@@ -2387,7 +2392,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
( ( 100 - m_colorShadingTransparency ) * 255 ) / 100, ( ( 100 - m_colorShadingTransparency ) * 255 ) / 100,
m_showRegionLabels(), m_showRegionLabels(),
RiuPlotAnnotationTool::LEFT_COLUMN, RiuPlotAnnotationTool::LEFT_COLUMN,
{Qt::SolidPattern, Qt::Dense6Pattern} ); { Qt::SolidPattern, Qt::Dense6Pattern } );
} }
if ( m_formationSource == CASE ) if ( m_formationSource == CASE )
@@ -2585,16 +2590,16 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
} }
} }
const std::map<RiaDefines::WellPathComponentType, int> sortIndices = {{RiaDefines::WELL_PATH, 0}, const std::map<RiaDefines::WellPathComponentType, int> sortIndices = { { RiaDefines::WELL_PATH, 0 },
{RiaDefines::CASING, 1}, { RiaDefines::CASING, 1 },
{RiaDefines::LINER, 2}, { RiaDefines::LINER, 2 },
{RiaDefines::PERFORATION_INTERVAL, 3}, { RiaDefines::PERFORATION_INTERVAL, 3 },
{RiaDefines::FISHBONES, 4}, { RiaDefines::FISHBONES, 4 },
{RiaDefines::FRACTURE, 5}, { RiaDefines::FRACTURE, 5 },
{RiaDefines::PACKER, 6}, { RiaDefines::PACKER, 6 },
{RiaDefines::ICD, 7}, { RiaDefines::ICD, 7 },
{RiaDefines::AICD, 8}, { RiaDefines::AICD, 8 },
{RiaDefines::ICV, 9}}; { RiaDefines::ICV, 9 } };
std::stable_sort( allWellPathComponents.begin(), std::stable_sort( allWellPathComponents.begin(),
allWellPathComponents.end(), allWellPathComponents.end(),