2015-08-26 05:27:29 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-08-26 05:27:29 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-08-26 05:27:29 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-08-26 05:27:29 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-11-04 09:22:53 -06:00
|
|
|
#include "RimWellLogCurve.h"
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2019-09-17 09:26:03 -05:00
|
|
|
#include "RiaCurveDataTools.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RigWellLogCurveData.h"
|
2015-09-18 03:50:01 -05:00
|
|
|
|
2017-02-24 07:14:29 -06:00
|
|
|
#include "RimWellLogPlot.h"
|
2015-11-04 09:14:42 -06:00
|
|
|
#include "RimWellLogTrack.h"
|
2015-09-22 04:17:24 -05:00
|
|
|
|
2018-09-04 02:08:29 -05:00
|
|
|
#include "RiuQwtPlotCurve.h"
|
2019-10-11 08:54:19 -05:00
|
|
|
#include "RiuQwtPlotWidget.h"
|
2015-09-17 11:42:35 -05:00
|
|
|
|
2015-12-01 09:22:18 -06:00
|
|
|
#include "cafPdmUiComboBoxEditor.h"
|
|
|
|
|
2015-08-30 19:06:37 -05:00
|
|
|
#include "cvfAssert.h"
|
2015-08-27 09:13:49 -05:00
|
|
|
|
2015-12-08 13:39:06 -06:00
|
|
|
#include "qwt_symbol.h"
|
|
|
|
|
2019-09-11 08:54:59 -05:00
|
|
|
#include <algorithm>
|
|
|
|
|
2015-09-18 06:02:33 -05:00
|
|
|
// NB! Special macro for pure virtual class
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" );
|
2015-12-08 13:39:06 -06:00
|
|
|
|
2015-08-27 09:13:49 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-08-27 09:13:49 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-11-04 09:19:38 -06:00
|
|
|
RimWellLogCurve::RimWellLogCurve()
|
2016-05-23 08:44:15 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png", "", "" );
|
2016-05-23 08:44:15 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setXAxis( QwtPlot::xTop );
|
2019-11-25 02:43:38 -06:00
|
|
|
m_qwtCurveErrorBars->setXAxis( QwtPlot::xTop );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_qwtPlotCurve->setYAxis( QwtPlot::yLeft );
|
2019-09-30 02:48:05 -05:00
|
|
|
|
2019-10-29 03:29:15 -05:00
|
|
|
m_curveData = new RigWellLogCurveData;
|
|
|
|
|
2019-11-19 06:19:56 -06:00
|
|
|
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(),
|
2019-09-30 02:48:05 -05:00
|
|
|
-std::numeric_limits<double>::infinity() );
|
2016-05-23 08:44:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-05-23 08:44:15 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RimWellLogCurve::~RimWellLogCurve() {}
|
2016-05-23 08:44:15 -05:00
|
|
|
|
2015-09-18 03:50:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-08-30 07:03:58 -05:00
|
|
|
///
|
2015-09-18 03:50:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-11 08:54:59 -05:00
|
|
|
bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumValue ) const
|
2015-09-18 03:50:01 -05:00
|
|
|
{
|
2019-09-17 09:26:03 -05:00
|
|
|
CAF_ASSERT( minimumValue && maximumValue );
|
|
|
|
|
|
|
|
if ( !( minimumValue && maximumValue ) )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2019-09-30 02:48:05 -05:00
|
|
|
|
|
|
|
if ( m_curveDataXRange.first == -std::numeric_limits<double>::infinity() ||
|
|
|
|
m_curveDataXRange.second == std::numeric_limits<double>::infinity() )
|
2019-09-11 08:54:59 -05:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2019-09-17 09:26:03 -05:00
|
|
|
|
2019-09-30 02:48:05 -05:00
|
|
|
*minimumValue = m_curveDataXRange.first;
|
|
|
|
*maximumValue = m_curveDataXRange.second;
|
2019-09-17 09:26:03 -05:00
|
|
|
|
2019-09-11 08:54:59 -05:00
|
|
|
return true;
|
2015-09-18 03:50:01 -05:00
|
|
|
}
|
|
|
|
|
2019-10-11 08:54:19 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumValue ) const
|
|
|
|
{
|
|
|
|
CAF_ASSERT( minimumValue && maximumValue );
|
|
|
|
|
|
|
|
if ( !( minimumValue && maximumValue ) )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
RimWellLogPlot* wellLogPlot = nullptr;
|
|
|
|
firstAncestorOrThisOfTypeAsserted( wellLogPlot );
|
|
|
|
|
2019-11-19 06:19:56 -06:00
|
|
|
auto depthRangeIt = m_curveDataDepthRange.find( wellLogPlot->depthType() );
|
|
|
|
if ( depthRangeIt == m_curveDataDepthRange.end() )
|
2019-10-11 08:54:19 -05:00
|
|
|
{
|
2019-11-19 06:19:56 -06:00
|
|
|
return false;
|
2019-10-11 08:54:19 -05:00
|
|
|
}
|
|
|
|
|
2019-11-19 06:19:56 -06:00
|
|
|
if ( depthRangeIt->second.first == -std::numeric_limits<double>::infinity() ||
|
|
|
|
depthRangeIt->second.second == std::numeric_limits<double>::infinity() )
|
|
|
|
{
|
|
|
|
return false;
|
2019-10-11 08:54:19 -05:00
|
|
|
}
|
2019-11-19 06:19:56 -06:00
|
|
|
*minimumValue = depthRangeIt->second.first;
|
|
|
|
*maximumValue = depthRangeIt->second.second;
|
2019-10-11 08:54:19 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-09-30 02:48:05 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-19 06:19:56 -06:00
|
|
|
void RimWellLogCurve::setValuesAndDepths( const std::vector<double>& xValues,
|
|
|
|
const std::vector<double>& measuredDepths,
|
|
|
|
RiaDefines::DepthTypeEnum depthType,
|
|
|
|
RiaDefines::DepthUnitType depthUnit,
|
|
|
|
bool isExtractionCurve )
|
|
|
|
{
|
|
|
|
m_curveData->setValuesAndDepths( xValues, measuredDepths, depthType, depthUnit, isExtractionCurve );
|
|
|
|
calculateCurveDataRanges();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogCurve::setValuesAndDepths( const std::vector<double>& xValues,
|
|
|
|
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
|
|
|
|
RiaDefines::DepthUnitType depthUnit,
|
|
|
|
bool isExtractionCurve )
|
2019-09-30 02:48:05 -05:00
|
|
|
{
|
2019-11-19 06:19:56 -06:00
|
|
|
m_curveData->setValuesAndDepths( xValues, depths, depthUnit, isExtractionCurve );
|
2019-10-11 08:54:19 -05:00
|
|
|
calculateCurveDataRanges();
|
2019-09-30 02:48:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogCurve::setValuesWithTVD( const std::vector<double>& xValues,
|
|
|
|
const std::vector<double>& measuredDepths,
|
|
|
|
const std::vector<double>& tvDepths,
|
|
|
|
RiaDefines::DepthUnitType depthUnit,
|
|
|
|
bool isExtractionCurve )
|
|
|
|
{
|
2019-11-19 06:19:56 -06:00
|
|
|
std::map<RiaDefines::DepthTypeEnum, std::vector<double>> depths = {{RiaDefines::MEASURED_DEPTH, measuredDepths},
|
|
|
|
{RiaDefines::TRUE_VERTICAL_DEPTH, tvDepths}};
|
|
|
|
setValuesAndDepths( xValues, depths, depthUnit, isExtractionCurve );
|
2019-09-30 02:48:05 -05:00
|
|
|
}
|
|
|
|
|
2018-09-07 06:39:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-07 06:39:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
const RigWellLogCurveData* RimWellLogCurve::curveData() const
|
|
|
|
{
|
|
|
|
return m_curveData.p();
|
|
|
|
}
|
|
|
|
|
2015-09-22 04:17:24 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-09-22 04:17:24 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-13 02:59:34 -05:00
|
|
|
void RimWellLogCurve::updateZoomInParentPlot()
|
2015-09-22 04:17:24 -05:00
|
|
|
{
|
|
|
|
RimWellLogPlot* wellLogPlot;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( wellLogPlot );
|
|
|
|
if ( wellLogPlot )
|
2015-09-22 04:17:24 -05:00
|
|
|
{
|
2019-10-11 08:54:19 -05:00
|
|
|
wellLogPlot->setAutoScaleYEnabled( true );
|
|
|
|
wellLogPlot->updateZoom();
|
2015-09-22 04:17:24 -05:00
|
|
|
}
|
|
|
|
}
|
2015-09-22 08:23:52 -05:00
|
|
|
|
2015-10-15 04:27:12 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-07 06:39:50 -05:00
|
|
|
///
|
2015-10-15 04:27:12 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-07 06:39:50 -05:00
|
|
|
void RimWellLogCurve::updateLegendsInPlot()
|
2015-10-15 04:27:12 -05:00
|
|
|
{
|
2018-09-07 06:39:50 -05:00
|
|
|
RimWellLogTrack* wellLogTrack;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfType( wellLogTrack );
|
|
|
|
if ( wellLogTrack )
|
2018-09-07 06:39:50 -05:00
|
|
|
{
|
2019-11-15 06:35:39 -06:00
|
|
|
wellLogTrack->updateLegend();
|
2018-09-07 06:39:50 -05:00
|
|
|
}
|
2015-10-15 04:27:12 -05:00
|
|
|
}
|
2019-09-30 02:48:05 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellLogCurve::setOverrideCurveDataXRange( double minimumValue, double maximumValue )
|
|
|
|
{
|
|
|
|
m_curveDataXRange = std::make_pair( minimumValue, maximumValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-10-11 08:54:19 -05:00
|
|
|
void RimWellLogCurve::calculateCurveDataRanges()
|
2019-09-30 02:48:05 -05:00
|
|
|
{
|
|
|
|
// Invalidate range first
|
2019-11-19 06:19:56 -06:00
|
|
|
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(),
|
2019-09-30 02:48:05 -05:00
|
|
|
-std::numeric_limits<double>::infinity() );
|
2019-10-11 08:54:19 -05:00
|
|
|
|
2019-11-19 06:19:56 -06:00
|
|
|
for ( auto depthType : m_curveData->availableDepthTypes() )
|
|
|
|
{
|
|
|
|
m_curveDataDepthRange[depthType] = std::make_pair( std::numeric_limits<double>::infinity(),
|
|
|
|
-std::numeric_limits<double>::infinity() );
|
|
|
|
|
|
|
|
m_curveData->calculateDepthRange( depthType,
|
|
|
|
&m_curveDataDepthRange[depthType].first,
|
|
|
|
&m_curveDataDepthRange[depthType].second );
|
|
|
|
}
|
2019-09-30 02:48:05 -05:00
|
|
|
|
|
|
|
for ( double xValue : m_curveData->xValues() )
|
|
|
|
{
|
|
|
|
if ( RiaCurveDataTools::isValidValue( xValue, false ) )
|
|
|
|
{
|
|
|
|
m_curveDataXRange.first = std::min( m_curveDataXRange.first, xValue );
|
|
|
|
m_curveDataXRange.second = std::max( m_curveDataXRange.second, xValue );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|