mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
724 lines
26 KiB
C++
724 lines
26 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2015- Statoil ASA
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
//
|
|
// 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.
|
|
//
|
|
// 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.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "RimWellLogPlot.h"
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RigWellLogCurveData.h"
|
|
#include "RigWellPath.h"
|
|
|
|
#include "RimEclipseCase.h"
|
|
#include "RimGeoMechCase.h"
|
|
#include "RimWellLogCurve.h"
|
|
#include "RimWellLogCurveCommonDataSource.h"
|
|
#include "RimWellLogTrack.h"
|
|
|
|
#include "RiuGridPlotWindow.h"
|
|
#include "RiuPlotMainWindow.h"
|
|
#include "RiuPlotMainWindowTools.h"
|
|
#include "RiuQwtPlotWidget.h"
|
|
#include "RiuWellLogPlot.h"
|
|
|
|
#include "cafPdmUiComboBoxEditor.h"
|
|
#include "cvfAssert.h"
|
|
|
|
#include <QKeyEvent>
|
|
|
|
#include <cmath>
|
|
|
|
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
|
|
#define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0
|
|
|
|
namespace caf
|
|
{
|
|
template <>
|
|
void caf::AppEnum<RimWellLogPlot::DepthTypeEnum>::setUp()
|
|
{
|
|
addItem( RimWellLogPlot::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" );
|
|
addItem( RimWellLogPlot::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" );
|
|
addItem( RimWellLogPlot::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" );
|
|
addItem( RimWellLogPlot::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" );
|
|
setDefault( RimWellLogPlot::MEASURED_DEPTH );
|
|
}
|
|
|
|
template <>
|
|
void RimWellLogPlot::AxisGridEnum::setUp()
|
|
{
|
|
addItem( RimWellLogPlot::AXIS_GRID_NONE, "GRID_X_NONE", "No Grid Lines" );
|
|
addItem( RimWellLogPlot::AXIS_GRID_MAJOR, "GRID_X_MAJOR", "Major Only" );
|
|
addItem( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR, "GRID_X_MAJOR_AND_MINOR", "Major and Minor" );
|
|
setDefault( RimWellLogPlot::AXIS_GRID_MAJOR );
|
|
}
|
|
|
|
} // End namespace caf
|
|
|
|
CAF_PDM_SOURCE_INIT( RimWellLogPlot, "WellLogPlot" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellLogPlot::RimWellLogPlot()
|
|
{
|
|
CAF_PDM_InitObject( "Well Log Plot", ":/WellLogPlot16x16.png", "", "" );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_commonDataSource,
|
|
"CommonDataSource",
|
|
"Data Source",
|
|
"",
|
|
"Change the Data Source of All Curves in the Plot",
|
|
"" );
|
|
m_commonDataSource.uiCapability()->setUiTreeHidden( true );
|
|
m_commonDataSource.uiCapability()->setUiTreeChildrenHidden( true );
|
|
m_commonDataSource.xmlCapability()->disableIO();
|
|
m_commonDataSource = new RimWellLogCurveCommonDataSource;
|
|
|
|
caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = MEASURED_DEPTH;
|
|
CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" );
|
|
|
|
caf::AppEnum<RiaDefines::DepthUnitType> depthUnit = RiaDefines::UNIT_METER;
|
|
CAF_PDM_InitField( &m_depthUnit, "DepthUnit", depthUnit, "Unit", "", "", "" );
|
|
|
|
CAF_PDM_InitField( &m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "" );
|
|
CAF_PDM_InitField( &m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "" );
|
|
CAF_PDM_InitFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", "" );
|
|
CAF_PDM_InitField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "" );
|
|
m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden( true );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
|
|
m_nameConfig.uiCapability()->setUiTreeHidden( true );
|
|
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
|
|
m_nameConfig = new RimWellLogPlotNameConfig();
|
|
|
|
m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET};
|
|
m_availableDepthTypes = {MEASURED_DEPTH, TRUE_VERTICAL_DEPTH};
|
|
|
|
m_minAvailableDepth = HUGE_VAL;
|
|
m_maxAvailableDepth = -HUGE_VAL;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// Move-assignment operator. Argument has to be passed with std::move()
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
|
|
{
|
|
RimGridPlotWindow::operator=( std::move( rhs ) );
|
|
|
|
auto dataSource = rhs.m_commonDataSource();
|
|
rhs.m_commonDataSource.removeChildObject( dataSource );
|
|
m_commonDataSource = dataSource;
|
|
|
|
m_depthType = rhs.m_depthType();
|
|
m_depthUnit = rhs.m_depthUnit();
|
|
m_minVisibleDepth = rhs.m_minVisibleDepth();
|
|
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
|
|
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
|
|
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
|
|
|
|
auto nameConfig = rhs.m_nameConfig();
|
|
rhs.m_nameConfig.removeChildObject( nameConfig );
|
|
m_nameConfig = nameConfig;
|
|
|
|
m_minAvailableDepth = rhs.m_minAvailableDepth;
|
|
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
|
|
return *this;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellLogPlot::~RimWellLogPlot()
|
|
{
|
|
delete m_commonDataSource;
|
|
delete m_nameConfig;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QWidget* RimWellLogPlot::createPlotWidget( QWidget* mainWindowParent /*= nullptr */ )
|
|
{
|
|
return createViewWidget( mainWindowParent );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QString RimWellLogPlot::fullPlotTitle() const
|
|
{
|
|
return createAutoName();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::updateZoom()
|
|
{
|
|
if ( m_isAutoScaleDepthEnabled )
|
|
{
|
|
calculateAvailableDepthRange();
|
|
if ( m_minAvailableDepth < HUGE_VAL && m_maxAvailableDepth > -HUGE_VAL )
|
|
{
|
|
m_minVisibleDepth = m_minAvailableDepth;
|
|
m_maxVisibleDepth = m_maxAvailableDepth + 0.01 * ( m_maxAvailableDepth - m_minAvailableDepth );
|
|
}
|
|
}
|
|
|
|
for ( RimPlotInterface* plot : plots() )
|
|
{
|
|
static_cast<RimWellLogTrack*>( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() );
|
|
}
|
|
m_viewer->updateVerticalScrollBar( m_minVisibleDepth(), m_maxVisibleDepth(), m_minAvailableDepth, m_maxAvailableDepth );
|
|
|
|
RimGridPlotWindow::updateZoom();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setDepthAxisRangeByFactorAndCenter( double zoomFactor, double zoomCenter )
|
|
{
|
|
double newMinimum = zoomCenter - ( zoomCenter - m_minVisibleDepth ) * zoomFactor;
|
|
double newMaximum = zoomCenter + ( m_maxVisibleDepth - zoomCenter ) * zoomFactor;
|
|
|
|
setDepthAxisRange( newMinimum, newMaximum );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setDepthAxisRangeByPanDepth( double panFactor )
|
|
{
|
|
double delta = panFactor * ( m_maxVisibleDepth - m_minVisibleDepth );
|
|
setDepthAxisRange( m_minVisibleDepth + delta, m_maxVisibleDepth + delta );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setDepthAxisRange( double minimumDepth, double maximumDepth )
|
|
{
|
|
m_minVisibleDepth = minimumDepth;
|
|
m_maxVisibleDepth = maximumDepth;
|
|
|
|
m_minVisibleDepth.uiCapability()->updateConnectedEditors();
|
|
m_maxVisibleDepth.uiCapability()->updateConnectedEditors();
|
|
|
|
setAutoScaleYEnabled( false );
|
|
updateZoom();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::calculateAvailableDepthRange()
|
|
{
|
|
double minDepth = HUGE_VAL;
|
|
double maxDepth = -HUGE_VAL;
|
|
|
|
auto plots = this->plots();
|
|
|
|
for ( size_t tIdx = 0; tIdx < plots.size(); tIdx++ )
|
|
{
|
|
double minTrackDepth = HUGE_VAL;
|
|
double maxTrackDepth = -HUGE_VAL;
|
|
|
|
if ( plots[tIdx]->isChecked() )
|
|
{
|
|
static_cast<RimWellLogTrack*>( plots[tIdx] )->availableDepthRange( &minTrackDepth, &maxTrackDepth );
|
|
|
|
if ( minTrackDepth < minDepth )
|
|
{
|
|
minDepth = minTrackDepth;
|
|
}
|
|
|
|
if ( maxTrackDepth > maxDepth )
|
|
{
|
|
maxDepth = maxTrackDepth;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( minDepth < HUGE_VAL && maxDepth > -HUGE_VAL )
|
|
{
|
|
m_minAvailableDepth = minDepth;
|
|
m_maxAvailableDepth = maxDepth;
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::availableDepthRange( double* minimumDepth, double* maximumDepth ) const
|
|
{
|
|
*minimumDepth = m_minAvailableDepth;
|
|
*maximumDepth = m_maxAvailableDepth;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setAutoScaleYEnabled( bool on )
|
|
{
|
|
m_isAutoScaleDepthEnabled = on;
|
|
m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::enableAllAutoNameTags( bool enable )
|
|
{
|
|
m_nameConfig->enableAllAutoNameTags( enable );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
|
|
{
|
|
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Depth Axis" );
|
|
|
|
if ( m_availableDepthTypes.size() > 1u )
|
|
{
|
|
gridGroup->add( &m_depthType );
|
|
}
|
|
|
|
if ( m_availableDepthUnits.size() > 1u )
|
|
{
|
|
gridGroup->add( &m_depthUnit );
|
|
}
|
|
|
|
gridGroup->add( &m_minVisibleDepth );
|
|
gridGroup->add( &m_maxVisibleDepth );
|
|
gridGroup->add( &m_depthAxisGridVisibility );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
caf::PdmUiGroup* RimWellLogPlot::createPlotSettingsUiGroup( caf::PdmUiOrdering& uiOrdering )
|
|
{
|
|
caf::PdmUiGroup* titleAndLegendsGroup = RimGridPlotWindow::createPlotSettingsUiGroup( uiOrdering );
|
|
m_nameConfig->uiOrdering( "", *titleAndLegendsGroup );
|
|
return titleAndLegendsGroup;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QString RimWellLogPlot::createAutoName() const
|
|
{
|
|
QStringList generatedCurveName;
|
|
|
|
if ( !m_nameConfig->customName().isEmpty() )
|
|
{
|
|
generatedCurveName.push_back( m_nameConfig->customName() );
|
|
}
|
|
|
|
RimCase* commonCase = m_commonDataSource->caseToApply();
|
|
RimWellPath* commonWellPath = m_commonDataSource->wellPathToApply();
|
|
|
|
QStringList generatedAutoTags;
|
|
if ( m_nameConfig->addCaseName() && commonCase )
|
|
{
|
|
generatedAutoTags.push_back( commonCase->caseUserDescription() );
|
|
}
|
|
|
|
if ( m_nameConfig->addWellName() )
|
|
{
|
|
if ( commonWellPath && !commonWellPath->name().isEmpty() )
|
|
{
|
|
generatedAutoTags.push_back( commonWellPath->name() );
|
|
}
|
|
else if ( !m_commonDataSource->simWellNameToApply().isEmpty() )
|
|
{
|
|
generatedAutoTags.push_back( m_commonDataSource->simWellNameToApply() );
|
|
}
|
|
}
|
|
|
|
if ( m_nameConfig->addTimeStep() )
|
|
{
|
|
if ( commonCase && m_commonDataSource->timeStepToApply() != -1 )
|
|
{
|
|
generatedAutoTags.push_back( commonCase->timeStepName( m_commonDataSource->timeStepToApply() ) );
|
|
}
|
|
}
|
|
|
|
if ( m_nameConfig->addAirGap() )
|
|
{
|
|
if ( commonWellPath )
|
|
{
|
|
RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry();
|
|
if ( wellPathGeometry )
|
|
{
|
|
double rkb = wellPathGeometry->rkbDiff();
|
|
generatedAutoTags.push_back( QString( "Air Gap = %1 m" ).arg( rkb ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( m_nameConfig->addWaterDepth() )
|
|
{
|
|
if ( commonWellPath )
|
|
{
|
|
RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry();
|
|
if ( wellPathGeometry )
|
|
{
|
|
const std::vector<cvf::Vec3d>& wellPathPoints = wellPathGeometry->wellPathPoints();
|
|
if ( !wellPathPoints.empty() )
|
|
{
|
|
double tvdmsl = std::abs( wellPathPoints.front()[2] );
|
|
generatedAutoTags.push_back( QString( "Water Depth = %1 m" ).arg( tvdmsl ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( !generatedAutoTags.empty() )
|
|
{
|
|
generatedCurveName.push_back( generatedAutoTags.join( ", " ) );
|
|
}
|
|
return generatedCurveName.join( ": " );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent )
|
|
{
|
|
m_viewer = new RiuWellLogPlot( this, mainWindowParent );
|
|
recreatePlotWidgets();
|
|
return m_viewer;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::performAutoNameUpdate()
|
|
{
|
|
updateCommonDataSource();
|
|
this->setPlotTitleInWidget( this->createAutoName() );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::handleKeyPressEvent( QKeyEvent* keyEvent )
|
|
{
|
|
if ( keyEvent->key() == Qt::Key_PageUp )
|
|
{
|
|
if ( keyEvent->modifiers() & Qt::ShiftModifier )
|
|
{
|
|
m_commonDataSource->applyPrevCase();
|
|
keyEvent->accept();
|
|
}
|
|
else if ( keyEvent->modifiers() & Qt::ControlModifier )
|
|
{
|
|
m_commonDataSource->applyPrevWell();
|
|
keyEvent->accept();
|
|
}
|
|
else
|
|
{
|
|
m_commonDataSource->applyPrevTimeStep();
|
|
keyEvent->accept();
|
|
}
|
|
}
|
|
else if ( keyEvent->key() == Qt::Key_PageDown )
|
|
{
|
|
if ( keyEvent->modifiers() & Qt::ShiftModifier )
|
|
{
|
|
m_commonDataSource->applyNextCase();
|
|
keyEvent->accept();
|
|
}
|
|
else if ( keyEvent->modifiers() & Qt::ControlModifier )
|
|
{
|
|
m_commonDataSource->applyNextWell();
|
|
keyEvent->accept();
|
|
}
|
|
else
|
|
{
|
|
m_commonDataSource->applyNextTimeStep();
|
|
keyEvent->accept();
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellLogCurveCommonDataSource* RimWellLogPlot::commonDataSource() const
|
|
{
|
|
return m_commonDataSource;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::updateCommonDataSource()
|
|
{
|
|
m_commonDataSource->updateDefaultOptions();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits )
|
|
{
|
|
m_availableDepthUnits = depthUnits;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setAvailableDepthTypes( const std::set<DepthTypeEnum>& depthTypes )
|
|
{
|
|
m_availableDepthTypes = depthTypes;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::onPlotAdditionOrRemoval()
|
|
{
|
|
calculateAvailableDepthRange();
|
|
updateZoom();
|
|
RimGridPlotWindow::onPlotAdditionOrRemoval();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
caf::PdmFieldHandle* RimWellLogPlot::userDescriptionField()
|
|
{
|
|
return m_nameConfig->nameField();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
const QVariant& oldValue,
|
|
const QVariant& newValue )
|
|
{
|
|
RimGridPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
|
|
|
if ( changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth )
|
|
{
|
|
m_isAutoScaleDepthEnabled = false;
|
|
updateZoom();
|
|
}
|
|
else if ( changedField == &m_depthAxisGridVisibility )
|
|
{
|
|
updateLayout();
|
|
}
|
|
else if ( changedField == &m_isAutoScaleDepthEnabled )
|
|
{
|
|
if ( m_isAutoScaleDepthEnabled )
|
|
{
|
|
updateZoom();
|
|
}
|
|
}
|
|
else if ( changedField == &m_depthType )
|
|
{
|
|
m_isAutoScaleDepthEnabled = true;
|
|
loadDataAndUpdate();
|
|
}
|
|
else if ( changedField == &m_depthUnit )
|
|
{
|
|
m_isAutoScaleDepthEnabled = true;
|
|
updateZoom();
|
|
}
|
|
|
|
updateConnectedEditors();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
|
{
|
|
RimGridPlotWindow::defineUiOrdering( uiConfigName, uiOrdering );
|
|
|
|
uiOrderingForDepthAxis( uiOrdering );
|
|
createPlotSettingsUiGroup( uiOrdering );
|
|
|
|
uiOrdering.skipRemainingFields( true );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
bool* useOptionsOnly )
|
|
{
|
|
QList<caf::PdmOptionItemInfo> options = RimGridPlotWindow::calculateValueOptions( fieldNeedingOptions,
|
|
useOptionsOnly );
|
|
|
|
if ( fieldNeedingOptions == &m_depthType )
|
|
{
|
|
using DepthAppEnum = caf::AppEnum<DepthTypeEnum>;
|
|
for ( size_t i = 0; i < DepthAppEnum::size(); ++i )
|
|
{
|
|
DepthTypeEnum enumVal = DepthAppEnum::fromIndex( i );
|
|
|
|
if ( m_availableDepthTypes.count( enumVal ) )
|
|
{
|
|
options.push_back( caf::PdmOptionItemInfo( DepthAppEnum::uiText( enumVal ), enumVal ) );
|
|
}
|
|
}
|
|
}
|
|
else if ( fieldNeedingOptions == &m_depthUnit )
|
|
{
|
|
using UnitAppEnum = caf::AppEnum<RiaDefines::DepthUnitType>;
|
|
for ( auto depthUnit : m_availableDepthUnits )
|
|
{
|
|
options.push_back( caf::PdmOptionItemInfo( UnitAppEnum::uiText( depthUnit ), depthUnit ) );
|
|
}
|
|
}
|
|
|
|
( *useOptionsOnly ) = true;
|
|
return options;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::initAfterRead()
|
|
{
|
|
RimGridPlotWindow::initAfterRead();
|
|
|
|
updateCommonDataSource();
|
|
if ( !m_description().isEmpty() )
|
|
{
|
|
m_nameConfig->setCustomName( m_description() );
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
|
QString uiConfigName,
|
|
caf::PdmUiEditorAttribute* attribute )
|
|
{
|
|
if ( field == &m_columnCountEnum )
|
|
{
|
|
auto comboAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
|
|
if ( comboAttr )
|
|
{
|
|
comboAttr->iconSize = QSize( 24, 14 );
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const
|
|
{
|
|
return m_depthType.value();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setDepthType( DepthTypeEnum depthType )
|
|
{
|
|
m_depthType = depthType;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RiaDefines::DepthUnitType RimWellLogPlot::depthUnit() const
|
|
{
|
|
return m_depthUnit.value();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
QString RimWellLogPlot::depthAxisTitle() const
|
|
{
|
|
QString depthTitle = "Depth";
|
|
|
|
switch ( m_depthType.value() )
|
|
{
|
|
case MEASURED_DEPTH:
|
|
depthTitle = "MD";
|
|
break;
|
|
|
|
case TRUE_VERTICAL_DEPTH:
|
|
depthTitle = "TVDMSL";
|
|
break;
|
|
|
|
case PSEUDO_LENGTH:
|
|
depthTitle = "PL";
|
|
break;
|
|
|
|
case CONNECTION_NUMBER:
|
|
depthTitle = "Connection";
|
|
break;
|
|
}
|
|
|
|
if ( m_depthType() == CONNECTION_NUMBER ) return depthTitle;
|
|
|
|
if ( m_depthUnit == RiaDefines::UNIT_METER )
|
|
{
|
|
depthTitle += " [m]";
|
|
}
|
|
else if ( m_depthUnit == RiaDefines::UNIT_FEET )
|
|
{
|
|
depthTitle += " [ft]";
|
|
}
|
|
else if ( m_depthUnit == RiaDefines::UNIT_NONE )
|
|
{
|
|
depthTitle += "";
|
|
}
|
|
|
|
return depthTitle;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::enableDepthAxisGridLines( AxisGridVisibility gridVisibility )
|
|
{
|
|
m_depthAxisGridVisibility = gridVisibility;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellLogPlot::AxisGridVisibility RimWellLogPlot::depthAxisGridLinesEnabled() const
|
|
{
|
|
return m_depthAxisGridVisibility();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellLogPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
|
|
{
|
|
m_depthUnit = depthUnit;
|
|
|
|
updateLayout();
|
|
}
|