More work on setting default values when creating new well log plots

This commit is contained in:
Gaute Lindkvist 2019-09-11 15:54:59 +02:00
parent 96fc311668
commit 460fbb6b9c
9 changed files with 147 additions and 127 deletions

View File

@ -280,7 +280,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
curve->loadDataAndUpdate( false );
double actualMinValue = minValue, actualMaxValue = maxValue;
curve->valueRange( &actualMinValue, &actualMaxValue );
curve->xValueRangeInQwt( &actualMinValue, &actualMaxValue );
while ( maxValue < actualMaxValue )
{
maxValue += angleIncrement;

View File

@ -25,6 +25,7 @@
#include "RimProject.h"
#include "RimWellLogCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
@ -52,7 +53,8 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
curve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
plot->zoomAll();

View File

@ -649,7 +649,7 @@ void RimPlotCurve::loadDataAndUpdate( bool updateParentPlot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::xValueRange( double* minimumValue, double* maximumValue ) const
bool RimPlotCurve::xValueRangeInQwt( double* minimumValue, double* maximumValue ) const
{
CVF_ASSERT( minimumValue && maximumValue );
CVF_ASSERT( m_qwtPlotCurve );
@ -668,7 +668,7 @@ bool RimPlotCurve::xValueRange( double* minimumValue, double* maximumValue ) con
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::yValueRange( double* minimumValue, double* maximumValue ) const
bool RimPlotCurve::yValueRangeInQwt( double* minimumValue, double* maximumValue ) const
{
CVF_ASSERT( minimumValue && maximumValue );
CVF_ASSERT( m_qwtPlotCurve );

View File

@ -50,8 +50,8 @@ public:
void loadDataAndUpdate( bool updateParentPlot );
virtual bool xValueRange( double* minimumValue, double* maximumValue ) const;
virtual bool yValueRange( double* minimumValue, double* maximumValue ) const;
virtual bool xValueRangeInQwt( double* minimumValue, double* maximumValue ) const;
virtual bool yValueRangeInQwt( double* minimumValue, double* maximumValue ) const;
void setParentQwtPlotAndReplot( QwtPlot* plot );
void setParentQwtPlotNoReplot( QwtPlot* plot );

View File

@ -33,6 +33,8 @@
#include "qwt_symbol.h"
#include <algorithm>
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" );
@ -55,9 +57,16 @@ RimWellLogCurve::~RimWellLogCurve() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::valueRange( double* minimumValue, double* maximumValue ) const
bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumValue ) const
{
return xValueRange( minimumValue, maximumValue );
if ( m_curveData->xValues().empty() )
{
return false;
}
auto minMaxIteratorPair = std::minmax_element( m_curveData->xValues().begin(), m_curveData->xValues().end() );
*minimumValue = *( minMaxIteratorPair.first );
*maximumValue = *( minMaxIteratorPair.second );
return true;
}
//--------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ public:
RimWellLogCurve();
~RimWellLogCurve() override;
bool valueRange( double* minimumValue, double* maximumValue ) const;
bool xValueRangeInData( double* minimumValue, double* maximumValue ) const;
const RigWellLogCurveData* curveData() const;

View File

@ -225,7 +225,7 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
}
else if ( geomCase )
{
m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_NODAL, "POR", "" ) );
m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_ELEMENT, "POR", "" ) );
}
clearGeneratedSimWellPaths();
@ -332,13 +332,73 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() )
{
// Make sure we have set correct case data into the result definitions.
bool isUsingPseudoLength = false;
extractData( &isUsingPseudoLength );
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
if ( !wellLogPlot ) return;
displayUnit = wellLogPlot->depthUnit();
if ( wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
{
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->trueDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
isUsingPseudoLength = false;
}
else if ( wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH )
{
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->measuredDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
}
m_qwtPlotCurve->setLineSegmentStartStopIndices( m_curveData->polylineStartStopIndices() );
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isUsingPseudoLength )
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
CVF_ASSERT( wellLogTrack );
RiuWellLogTrack* viewer = wellLogTrack->viewer();
if ( viewer )
{
viewer->setDepthTitle( "PL/" + wellLogPlot->depthPlotTitle() );
}
}
if ( updateParentPlot )
{
updateZoomInParentPlot();
}
setLogScaleFromSelectedResult();
if ( m_parentQwtPlot )
{
m_parentQwtPlot->replot();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength )
{
CAF_ASSERT( isUsingPseudoLength );
// Make sure we have set correct case data into the result definitions.
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
@ -375,12 +435,11 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
m_wellPathsWithExtractors.push_back( wellBranch );
}
isUsingPseudoLength = true;
*isUsingPseudoLength = true;
}
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath,
geomCase );
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, geomCase );
std::vector<double> values;
std::vector<double> measuredDepthValues;
@ -449,57 +508,6 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
m_curveData->setValuesWithTVD( values, measuredDepthValues, tvDepthValues, depthUnit, true );
}
}
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
CVF_ASSERT( wellLogPlot );
if ( !wellLogPlot ) return;
displayUnit = wellLogPlot->depthUnit();
if ( wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
{
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->trueDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
isUsingPseudoLength = false;
}
else if ( wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH )
{
m_qwtPlotCurve->setSamples( m_curveData->xPlotValues().data(),
m_curveData->measuredDepthPlotValues( displayUnit ).data(),
static_cast<int>( m_curveData->xPlotValues().size() ) );
}
m_qwtPlotCurve->setLineSegmentStartStopIndices( m_curveData->polylineStartStopIndices() );
if ( isUsingPseudoLength )
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
CVF_ASSERT( wellLogTrack );
RiuWellLogTrack* viewer = wellLogTrack->viewer();
if ( viewer )
{
viewer->setDepthTitle( "PL/" + wellLogPlot->depthPlotTitle() );
}
}
if ( updateParentPlot )
{
updateZoomInParentPlot();
}
setLogScaleFromSelectedResult();
if ( m_parentQwtPlot )
{
m_parentQwtPlot->replot();
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -89,6 +89,7 @@ public:
protected:
QString createCurveAutoName() override;
void onLoadDataAndUpdate( bool updateParentPlot ) override;
void extractData( bool* isUsingPseudoLength );
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,

View File

@ -760,7 +760,7 @@ void RimWellLogTrack::availableDepthRange( double* minimumDepth, double* maximum
double minCurveDepth = HUGE_VAL;
double maxCurveDepth = -HUGE_VAL;
if ( curve->isCurveVisible() && curve->yValueRange( &minCurveDepth, &maxCurveDepth ) )
if ( curve->isCurveVisible() && curve->yValueRangeInQwt( &minCurveDepth, &maxCurveDepth ) )
{
if ( minCurveDepth < minDepth )
{
@ -1175,7 +1175,7 @@ void RimWellLogTrack::calculateXZoomRange()
if ( curve->isCurveVisible() )
{
visibleCurves++;
if ( curve->xValueRange( &minCurveValue, &maxCurveValue ) )
if ( curve->xValueRangeInData( &minCurveValue, &maxCurveValue ) )
{
if ( minCurveValue < minValue )
{