Merge pull request #8527 from OPM/horizontal-well-log-plot

Horizontal well log plot
This commit is contained in:
Magne Sjaastad 2022-02-12 16:14:13 +01:00 committed by GitHub
commit 64bb5c3351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 108 additions and 18 deletions

View File

@ -974,6 +974,7 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
plotLayoutGroup->setCollapsedByDefault( true );
RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *plotLayoutGroup );
RimWellLogPlot::uiOrderingForPlotLayout( uiConfigName, *plotLayoutGroup );
plotLayoutGroup->add( &m_depthOrientation );
}
}

View File

@ -36,6 +36,7 @@
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimPlot.h"
#include "RimPlotWindow.h"
#include "RimProject.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
@ -74,6 +75,14 @@ void RimDepthTrackPlot::AxisGridEnum::setUp()
setDefault( RimDepthTrackPlot::AXIS_GRID_MAJOR );
}
template <>
void caf::AppEnum<RimDepthTrackPlot::DepthOrientation>::setUp()
{
addItem( RimDepthTrackPlot::DepthOrientation::HORIZONTAL, "HORIZONTAL", "Horizontal" );
addItem( RimDepthTrackPlot::DepthOrientation::VERTICAL, "VERTICAL", "Vertical" );
setDefault( RimDepthTrackPlot::DepthOrientation::VERTICAL );
}
} // End namespace caf
CAF_PDM_SOURCE_INIT( RimDepthTrackPlot, "DepthTrackPlot" );
@ -131,6 +140,8 @@ RimDepthTrackPlot::RimDepthTrackPlot()
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered );
CAF_PDM_InitFieldNoDefault( &m_depthOrientation, "DepthOrientation", "Orientation" );
m_availableDepthUnits = { RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET };
m_availableDepthTypes = { RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
@ -276,6 +287,17 @@ std::vector<RimPlot*> RimDepthTrackPlot::visiblePlots() const
return allVisiblePlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimDepthTrackPlot::columnCount() const
{
if ( depthOrientation() == DepthOrientation::VERTICAL )
return RimPlotWindow::columnCount();
else
return 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -829,6 +851,10 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
m_isAutoScaleDepthEnabled = true;
onLoadDataAndUpdate();
}
else if ( changedField == &m_depthOrientation )
{
onLoadDataAndUpdate();
}
else if ( changedField == &m_subTitleFontSize || changedField == &m_axisTitleFontSize ||
changedField == &m_axisValueFontSize )
{
@ -883,6 +909,7 @@ void RimDepthTrackPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
plotLayoutGroup->add( &m_subTitleFontSize );
plotLayoutGroup->add( &m_axisTitleFontSize );
plotLayoutGroup->add( &m_axisValueFontSize );
plotLayoutGroup->add( &m_depthOrientation );
std::vector<RimEnsembleWellLogCurveSet*> ensembleWellLogCurveSets;
descendantsOfType( ensembleWellLogCurveSets );
@ -1141,6 +1168,14 @@ RimDepthTrackPlot::AxisGridVisibility RimDepthTrackPlot::depthAxisGridLinesEnabl
return m_depthAxisGridVisibility();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDepthTrackPlot::DepthOrientation RimDepthTrackPlot::depthOrientation() const
{
return m_depthOrientation();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -65,6 +65,12 @@ public:
typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum;
using DepthTypeEnum = RiaDefines::DepthTypeEnum;
enum class DepthOrientation
{
HORIZONTAL,
VERTICAL
};
public:
RimDepthTrackPlot();
~RimDepthTrackPlot() override;
@ -79,6 +85,8 @@ public:
size_t plotIndex( const RimPlot* plot ) const;
RimPlot* plotByIndex( size_t index ) const;
int columnCount() const override;
std::vector<RimPlot*> plots() const override;
std::vector<RimPlot*> visiblePlots() const;
void insertPlot( RimPlot* plot, size_t index ) final;
@ -94,6 +102,8 @@ public:
void enableDepthAxisGridLines( AxisGridVisibility gridVisibility );
AxisGridVisibility depthAxisGridLinesEnabled() const;
RimDepthTrackPlot::DepthOrientation depthOrientation() const;
void setAutoScaleXEnabled( bool enabled );
void setAutoScaleDepthEnabled( bool enabled );
@ -183,6 +193,8 @@ protected:
caf::PdmField<caf::AppEnum<RimEnsembleWellLogStatistics::DepthEqualization>> m_depthEqualization;
caf::PdmPtrField<RimEnsembleCurveSet*> m_ensembleCurveSet;
caf::PdmField<caf::AppEnum<DepthOrientation>> m_depthOrientation;
QPointer<RiuWellLogPlot> m_viewer;
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;
std::set<DepthTypeEnum> m_availableDepthTypes;

View File

@ -369,7 +369,12 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
std::vector<double> xPlotValues = curveData()->xPlotValues();
std::vector<double> depthPlotValues = curveData()->depthPlotValues( depthType, displayUnit );
CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() );
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, isLogCurve );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL )
m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, isLogCurve );
else
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, isLogCurve );
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );

View File

@ -23,6 +23,7 @@
#include "RiaExtractionTools.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RiaPlotDefines.h"
#include "RiaPreferences.h"
#include "RiaSimWellBranchTools.h"
#include "RiaWellLogCurveMerger.h"
@ -77,6 +78,7 @@
#include "RiuMainWindow.h"
#include "RiuPlotAnnotationTool.h"
#include "RiuPlotAxis.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuQwtLinearScaleEngine.h"
@ -503,7 +505,7 @@ void RimWellLogTrack::updateYZoom()
{
if ( !m_plotWidget ) return;
m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
m_plotWidget->setAxisRange( getDepthAxis(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
}
//--------------------------------------------------------------------------------------------------
@ -540,8 +542,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
if ( m_plotWidget )
{
m_majorTickInterval = m_plotWidget->majorTickInterval( RiuPlotAxis::defaultTop() );
m_minorTickInterval = m_plotWidget->minorTickInterval( RiuPlotAxis::defaultTop() );
m_majorTickInterval = m_plotWidget->majorTickInterval( getValueAxis() );
m_minorTickInterval = m_plotWidget->minorTickInterval( getValueAxis() );
}
m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
@ -762,13 +764,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
bool emptyRange = isEmptyVisibleXRange();
if ( emptyRange )
{
m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), false, false );
m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), 0.0, 1.0 );
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), false, false );
m_plotWidget->enableGridLines( getValueAxis(), false, false );
m_plotWidget->setAxisRange( getValueAxis(), 0.0, 1.0 );
m_plotWidget->setAxisLabelsAndTicksEnabled( getValueAxis(), false, false );
}
else
{
m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), true, true );
m_plotWidget->setAxisLabelsAndTicksEnabled( getValueAxis(), true, true );
if ( m_minAndMaxTicksOnly )
{
auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) {
@ -807,7 +809,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
}
else if ( m_explicitTickIntervals )
{
m_plotWidget->setMajorAndMinorTickIntervals( RiuPlotAxis::defaultTop(),
m_plotWidget->setMajorAndMinorTickIntervals( getValueAxis(),
m_majorTickInterval(),
m_minorTickInterval(),
m_visibleXRangeMin(),
@ -817,11 +819,11 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
{
int majorTickIntervals = 5;
int minorTickIntervals = 10;
m_plotWidget->setAutoTickIntervalCounts( RiuPlotAxis::defaultTop(), majorTickIntervals, minorTickIntervals );
m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), m_visibleXRangeMin, m_visibleXRangeMax );
m_plotWidget->setAutoTickIntervalCounts( getValueAxis(), majorTickIntervals, minorTickIntervals );
m_plotWidget->setAxisRange( getValueAxis(), m_visibleXRangeMin, m_visibleXRangeMax );
}
m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(),
m_plotWidget->enableGridLines( getValueAxis(),
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
}
@ -830,7 +832,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
this->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot )
{
m_plotWidget->enableGridLines( RiuPlotAxis::defaultLeft(),
m_plotWidget->enableGridLines( getDepthAxis(),
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR,
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR );
}
@ -1006,8 +1008,8 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateZoomFromParentPlot()
{
auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultTop() );
auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultLeft() );
auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( getValueAxis() );
auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( getDepthAxis() );
m_visibleXRangeMin = xIntervalMin;
m_visibleXRangeMax = xIntervalMax;
@ -1226,8 +1228,8 @@ void RimWellLogTrack::onLoadDataAndUpdate()
if ( wellLogPlot && m_plotWidget )
{
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultTop(), m_xAxisTitle );
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() );
m_plotWidget->setAxisTitleText( getValueAxis(), m_xAxisTitle );
m_plotWidget->setAxisTitleText( getDepthAxis(), wellLogPlot->depthAxisTitle() );
}
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
@ -1505,7 +1507,7 @@ RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParen
if ( m_plotWidget == nullptr )
{
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true );
m_plotWidget->setAxisInverted( getDepthAxis(), true );
updateAxisScaleEngine();
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
@ -3212,3 +3214,31 @@ void RimWellLogTrack::setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* cu
{
m_ensembleWellLogCurveSet = curveSet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimWellLogTrack::getDepthAxis() const
{
RimDepthTrackPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
return RiuPlotAxis::defaultLeft();
else
return RiuPlotAxis::defaultTop();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimWellLogTrack::getValueAxis() const
{
RimDepthTrackPlot* wellLogPlot;
this->firstAncestorOrThisOfTypeAsserted( wellLogPlot );
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
return RiuPlotAxis::defaultTop();
else
return RiuPlotAxis::defaultLeft();
}

View File

@ -26,6 +26,8 @@
#include "RimPlot.h"
#include "RiuPlotAxis.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
@ -248,6 +250,9 @@ private:
void updateXZoom();
void updateYZoom();
RiuPlotAxis getDepthAxis() const;
RiuPlotAxis getValueAxis() const;
int axisFontSize() const;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;

View File

@ -226,6 +226,8 @@ void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUi
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
nameGroup->add( &m_showLegend );
RimPlotCurve::curveNameUiOrdering( *nameGroup );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------