diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index df4ab24312..410ba406e1 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -246,13 +246,16 @@ void RimWellFlowRateCurve::updateStackedPlotData() bool isFirstTrack = ( wellLogTrack == wellLogPlot->plotByIndex( 0 ) ); RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType(); - RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE; + RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit(); + if ( depthType == RiaDefines::CONNECTION_NUMBER ) + { + displayUnit = RiaDefines::UNIT_NONE; + } std::vector depthValues; std::vector stackedValues; std::vector> polyLineStartStopIndices; - double zPos = -10000.0 + - 100 * groupId(); // Z-position of curve, to draw them in correct order hiding the things behind + double zPos = -10000.0 + 100 * groupId(); // Z-position of curve, to draw them in correct order // Starting way behind the grid (z == 0) at -10000 giving room for 100 groups with 100 curves each before getting above the grid { std::map> stackedCurveGroups = wellLogTrack->visibleStackedCurves(); @@ -284,7 +287,7 @@ void RimWellFlowRateCurve::updateStackedPlotData() } RigWellLogCurveData tempCurveData; - tempCurveData.setValuesAndDepths( allStackedValues, allDepthValues, depthType, RiaDefines::UNIT_NONE, false ); + tempCurveData.setValuesAndDepths( allStackedValues, allDepthValues, depthType, displayUnit, false ); depthValues = tempCurveData.depthPlotValues( depthType, displayUnit ); stackedValues = tempCurveData.xPlotValues(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp index 56e1ffdb47..140de1aae4 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.cpp @@ -99,22 +99,10 @@ bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumVa RimWellLogPlot* wellLogPlot = nullptr; firstAncestorOrThisOfTypeAsserted( wellLogPlot ); + auto depthType = wellLogPlot->depthType(); + auto displayUnit = wellLogPlot->depthUnit(); - auto depthRangeIt = m_curveDataDepthRange.find( wellLogPlot->depthType() ); - if ( depthRangeIt == m_curveDataDepthRange.end() ) - { - return false; - } - - if ( depthRangeIt->second.first == -std::numeric_limits::infinity() || - depthRangeIt->second.second == std::numeric_limits::infinity() ) - { - return false; - } - *minimumValue = depthRangeIt->second.first; - *maximumValue = depthRangeIt->second.second; - - return true; + return m_curveData->calculateDepthRange( depthType, displayUnit, minimumValue, maximumValue ); } //-------------------------------------------------------------------------------------------------- @@ -127,7 +115,7 @@ void RimWellLogCurve::setValuesAndDepths( const std::vector& xValues, bool isExtractionCurve ) { m_curveData->setValuesAndDepths( xValues, measuredDepths, depthType, depthUnit, isExtractionCurve ); - calculateCurveDataRanges(); + calculateCurveDataXRange(); } //-------------------------------------------------------------------------------------------------- @@ -139,7 +127,7 @@ void RimWellLogCurve::setValuesAndDepths( const std::vector& bool isExtractionCurve ) { m_curveData->setValuesAndDepths( xValues, depths, depthUnit, isExtractionCurve ); - calculateCurveDataRanges(); + calculateCurveDataXRange(); } //-------------------------------------------------------------------------------------------------- @@ -202,22 +190,11 @@ void RimWellLogCurve::setOverrideCurveDataXRange( double minimumValue, double ma //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::calculateCurveDataRanges() +void RimWellLogCurve::calculateCurveDataXRange() { // Invalidate range first m_curveDataXRange = std::make_pair( std::numeric_limits::infinity(), -std::numeric_limits::infinity() ); - - for ( auto depthType : m_curveData->availableDepthTypes() ) - { - m_curveDataDepthRange[depthType] = std::make_pair( std::numeric_limits::infinity(), - -std::numeric_limits::infinity() ); - - m_curveData->calculateDepthRange( depthType, - &m_curveDataDepthRange[depthType].first, - &m_curveDataDepthRange[depthType].second ); - } - for ( double xValue : m_curveData->xValues() ) { if ( RiaCurveDataTools::isValidValue( xValue, false ) ) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h index b54e6de656..d5034016ed 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogCurve.h @@ -70,12 +70,9 @@ protected: void updateZoomInParentPlot() override; void updateLegendsInPlot() override; void setOverrideCurveDataXRange( double minimumValue, double maximumValue ); + void calculateCurveDataXRange(); private: - void calculateCurveDataRanges(); - -private: - cvf::ref m_curveData; - std::pair m_curveDataXRange; - std::map> m_curveDataDepthRange; + cvf::ref m_curveData; + std::pair m_curveDataXRange; }; diff --git a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp index b343fa61fb..e1d2d09e45 100644 --- a/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp +++ b/ApplicationCode/ReservoirDataModel/RigLasFileExporter.cpp @@ -251,7 +251,7 @@ public: double minDepth = 0.0; double maxDepth = 0.0; - firstCurveData->calculateDepthRange( RiaDefines::MEASURED_DEPTH, &minDepth, &maxDepth ); + firstCurveData->calculateDepthRange( RiaDefines::MEASURED_DEPTH, firstCurveData->depthUnit(), &minDepth, &maxDepth ); lasFile->setStartDepth( minDepth ); lasFile->setStopDepth( maxDepth ); diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp index 5ef038a91e..11aae2ea1d 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.cpp @@ -326,6 +326,7 @@ void RigWellLogCurveData::splitIntervalAtEmptySpace( const std::vector& /// //-------------------------------------------------------------------------------------------------- bool RigWellLogCurveData::calculateDepthRange( RiaDefines::DepthTypeEnum depthType, + RiaDefines::DepthUnitType depthUnit, double* minimumDepth, double* maximumDepth ) const { @@ -334,9 +335,10 @@ bool RigWellLogCurveData::calculateDepthRange( RiaDefines::DepthTypeEnum depthTy double minValue = HUGE_VAL; double maxValue = -HUGE_VAL; - for ( size_t vIdx = 0; vIdx < depths( depthType ).size(); vIdx++ ) + std::vector depthValues = depthPlotValues( depthType, depthUnit ); + for ( size_t vIdx = 0; vIdx < depthValues.size(); vIdx++ ) { - double value = depths( depthType )[vIdx]; + double value = depthValues[vIdx]; if ( value < minValue ) { @@ -406,12 +408,13 @@ std::vector RigWellLogCurveData::convertDepthValues( RiaDefines::DepthUn { CVF_ASSERT( destinationDepthUnit != m_depthUnit ); - if ( destinationDepthUnit == RiaDefines::UNIT_METER ) + if ( destinationDepthUnit == RiaDefines::UNIT_METER && m_depthUnit == RiaDefines::UNIT_FEET ) { return convertFromFeetToMeter( values ); } - else + else if ( destinationDepthUnit == RiaDefines::UNIT_FEET && m_depthUnit == RiaDefines::UNIT_METER ) { return convertFromMeterToFeet( values ); } + return values; } diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h index c47572406d..002e6699a1 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogCurveData.h @@ -54,7 +54,10 @@ public: std::set availableDepthTypes() const; - bool calculateDepthRange( RiaDefines::DepthTypeEnum depthType, double* minMD, double* maxMD ) const; + bool calculateDepthRange( RiaDefines::DepthTypeEnum depthType, + RiaDefines::DepthUnitType depthUnit, + double* minMD, + double* maxMD ) const; RiaDefines::DepthUnitType depthUnit() const;