#4696 Sensible defaults for well log plot and improve reliability of common date source

This commit is contained in:
Gaute Lindkvist 2019-09-11 12:51:25 +02:00
parent baa266f0f9
commit fb12ad7db0
12 changed files with 480 additions and 156 deletions

View File

@ -25,6 +25,7 @@
#include "RimEclipseResultCase.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
@ -178,23 +179,90 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor );
if ( wellPath )
{
curve->setWellPath( wellPath );
plotTrack->setFormationWellPath( wellPath );
plotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
if ( simWell )
{
curve->setFromSimulationWellName( simWell->name(), branchIndex, useBranchDetection );
plotTrack->setFormationSimWellName( simWell->name() );
plotTrack->setFormationBranchIndex( branchIndex );
plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
}
RimCase* caseToApply = nullptr;
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
if ( view )
{
plotTrack->setFormationCase( view->ownerCase() );
caseToApply = view->ownerCase();
}
else if ( commonDataSource->caseToApply() )
{
caseToApply = commonDataSource->caseToApply();
}
else if ( plotTrack->formationNamesCase() )
{
caseToApply = plotTrack->formationNamesCase();
}
else
{
std::vector<RimCase*> allCases;
RiaApplication::instance()->project()->allCases( allCases );
if ( !allCases.empty() ) caseToApply = allCases.front();
}
QString ownerSimWellName;
if ( !wellPath )
{
if ( commonDataSource->wellPathToApply() )
{
wellPath = commonDataSource->wellPathToApply();
}
else if ( plotTrack->formationWellPath() )
{
wellPath = plotTrack->formationWellPath();
}
else
{
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
if ( !allWellPaths.empty() )
{
wellPath = allWellPaths.front();
}
}
}
if ( !simWell )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( caseToApply );
if ( eclipseCase )
{
if ( !commonDataSource->simWellNameToApply().isEmpty() )
{
ownerSimWellName = commonDataSource->simWellNameToApply();
}
else if ( !plotTrack->formationSimWellName().isEmpty() )
{
ownerSimWellName = plotTrack->formationSimWellName();
}
else
{
auto allSimWells = eclipseCase->sortedSimWellNames();
if ( !allSimWells.empty() )
{
ownerSimWellName = *allSimWells.begin();
}
}
}
}
if ( simWell || !ownerSimWellName.isEmpty() )
{
QString simWellName = simWell ? simWell->name() : ownerSimWellName;
curve->setFromSimulationWellName( simWellName, branchIndex, useBranchDetection );
}
if ( wellPath )
{
curve->setWellPath( wellPath );
curve->setTrajectoryType( RimWellLogExtractionCurve::WELL_PATH );
}
if ( caseToApply )
{
curve->setCase( caseToApply );
}
curve->setPropertiesFromView( view );
@ -212,7 +280,6 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
return curve;
}

View File

@ -166,7 +166,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
formationTrack->setFormationWellPath( wellPath );
formationTrack->setFormationCase( geoMechCase );
formationTrack->setShowFormations( true );
formationTrack->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
}
@ -182,7 +182,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
casingShoeTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setShowFormations( true );
casingShoeTrack->setShowFormations( RiuPlotAnnotationTool::DARK_LINES );
casingShoeTrack->setShowFormationLabels( false );
casingShoeTrack->setShowWellPathAttributes( true );
casingShoeTrack->setWellPathAttributesSource( wellPath );
@ -207,7 +207,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
stabilityCurvesTrack->setFormationWellPath( wellPath );
stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
stabilityCurvesTrack->setShowFormations( true );
stabilityCurvesTrack->setShowFormations( RiuPlotAnnotationTool::NONE );
stabilityCurvesTrack->setShowFormationLabels( false );
std::vector<QString> resultNames = RiaDefines::wellPathStabilityResultNames();
@ -227,8 +227,13 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addExtractionCurve( stabilityCurvesTrack, geoMechView, wellPath, nullptr, 0, false, false );
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( stabilityCurvesTrack,
geoMechView,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName );
@ -263,7 +268,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addExtractionCurve( wellPathAnglesTrack, geoMechView, wellPath, nullptr, 0, false, false );
RicWellLogTools::addExtractionCurve( wellPathAnglesTrack, geoMechView, wellPath, nullptr, -1, false, false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName );
@ -293,6 +298,6 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
wellPathAnglesTrack->setFormationWellPath( wellPath );
wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() );
wellPathAnglesTrack->setShowFormations( true );
wellPathAnglesTrack->setShowFormations( RiuPlotAnnotationTool::NONE );
wellPathAnglesTrack->setShowFormationLabels( false );
}

View File

@ -70,6 +70,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
RimWellLogPlot* wellLogPlot = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlot>();
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
@ -77,10 +78,10 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
}
else
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
int branchIndex = -1;
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex );
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
int branchIndex = -1;
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex );
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool useBranchDetection = true;
RimSimWellInViewCollection* simWellColl = nullptr;
if ( simWell )
@ -91,11 +92,29 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
if ( wellPath || simWell )
{
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( true,
"",
wellLogPlot );
if ( wellPath )
{
newWellLogPlotTrack->setFormationWellPath( wellPath );
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
else
{
newWellLogPlotTrack->setFormationSimWellName( simWell->name() );
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
newWellLogPlotTrack->setFormationBranchIndex( branchIndex );
newWellLogPlotTrack->setFormationBranchDetection( useBranchDetection );
}
if ( view )
{
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
}
RimWellLogExtractionCurve* plotCurve = RicWellLogTools::addExtractionCurve( newWellLogPlotTrack,
RiaApplication::instance()
->activeReservoirView(),
view,
wellPath,
simWell,
branchIndex,
@ -103,11 +122,10 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
plotCurve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
newWellLogPlotTrack->firstAncestorOrThisOfType( plot );
if ( plot && plotCurve->curveData() )
newWellLogPlotTrack->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot && plotCurve->curveData() )
{
plot->setDepthUnit( plotCurve->curveData()->depthUnit() );
wellLogPlot->setDepthUnit( plotCurve->curveData()->depthUnit() );
}
plotCurve->updateConnectedEditors();

View File

@ -53,6 +53,9 @@ void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
plot->zoomAll();
}
//--------------------------------------------------------------------------------------------------

View File

@ -19,12 +19,18 @@
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RiaGuiApplication.h"
@ -114,6 +120,48 @@ RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( bool
plot = createWellLogPlot();
}
RimCase* caseToApply = nullptr;
RimWellPath* wellPathToApply = nullptr;
QString simWellToApply;
RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
caseToApply = commonDataSource->caseToApply();
wellPathToApply = commonDataSource->wellPathToApply();
simWellToApply = commonDataSource->simWellNameToApply();
caf::Tristate branchDetectionToApply = commonDataSource->branchDetectionToApply();
int branchIndexToApply = commonDataSource->branchIndexToApply();
if ( !caseToApply )
{
std::vector<RimCase*> allCases;
RiaApplication::instance()->project()->allCases( allCases );
if ( !allCases.empty() )
{
caseToApply = allCases.front();
}
}
if ( !wellPathToApply && caseToApply )
{
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
if ( !allWellPaths.empty() )
{
wellPathToApply = allWellPaths.front();
}
}
if ( simWellToApply.isEmpty() && caseToApply )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( caseToApply );
if ( eclipseCase )
{
auto allSimWells = eclipseCase->sortedSimWellNames();
if ( !allSimWells.empty() )
{
simWellToApply = *allSimWells.begin();
}
}
}
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addTrack( plotTrack );
if ( !trackDescription.isEmpty() )
@ -125,6 +173,40 @@ RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( bool
plotTrack->setDescription( QString( "Track %1" ).arg( plot->trackCount() ) );
}
if ( caseToApply )
{
plotTrack->setFormationCase( caseToApply );
}
if ( wellPathToApply )
{
plotTrack->setFormationWellPath( wellPathToApply );
}
if ( !simWellToApply.isEmpty() )
{
plotTrack->setFormationSimWellName( simWellToApply );
}
if ( wellPathToApply )
{
plotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
else if ( !simWellToApply.isEmpty() )
{
plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
}
if ( !branchDetectionToApply.isPartiallyTrue() )
{
plotTrack->setFormationBranchDetection( branchDetectionToApply.isTrue() );
}
if ( branchIndexToApply >= 0 )
{
plotTrack->setFormationBranchIndex( branchIndexToApply );
}
if ( updateAfter )
{
updateAfterCreation( plot );

View File

@ -1097,7 +1097,7 @@ void RimWellPltPlot::onLoadDataAndUpdate()
{
if ( trackCount() > 0 )
{
trackByIndex( 0 )->setShowFormations( true );
trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
}
m_isOnLoad = false;
}

View File

@ -927,7 +927,7 @@ void RimWellRftPlot::onLoadDataAndUpdate()
{
if ( trackCount() > 0 )
{
trackByIndex( 0 )->setShowFormations( true );
trackByIndex( 0 )->setShowFormations( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
}
m_isOnLoad = false;

View File

@ -52,7 +52,7 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource()
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" );
CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "None" ), "Well Name", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_simWellName, "SimulationWellName", "Well Name", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_branchDetection,
"BranchDetection",
"Branch Detection",
@ -117,6 +117,14 @@ void RimWellLogCurveCommonDataSource::setWellPathToApply( RimWellPath* val )
m_wellPath = val;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogCurveCommonDataSource::branchIndexToApply() const
{
return m_branchIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -125,6 +133,14 @@ void RimWellLogCurveCommonDataSource::setBranchIndexToApply( int val )
m_branchIndex = val;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::Tristate RimWellLogCurveCommonDataSource::branchDetectionToApply() const
{
return m_branchDetection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -177,6 +193,13 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions()
setBranchDetectionToApply( caf::Tristate::State::PartiallyTrue );
setSimWellNameToApply( QString( "" ) );
setTimeStepToApply( -1 );
m_uniqueCases.clear();
m_uniqueTrajectoryTypes.clear();
m_uniqueWellPaths.clear();
m_uniqueWellNames.clear();
m_uniqueTimeSteps.clear();
m_uniqueBranchIndices.clear();
}
//--------------------------------------------------------------------------------------------------
@ -189,13 +212,6 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
resetDefaultOptions();
// Check to see if the parameters are unique
std::set<RimCase*> uniqueCases;
std::set<int> uniqueTrajectoryTypes;
std::set<RimWellPath*> uniqueWellPaths;
std::set<QString> uniqueWellNames;
std::set<int> uniqueTimeSteps;
std::set<bool> uniqueBranchDetection;
std::set<int> uniqueBranchIndex;
for ( RimWellLogCurve* curve : curves )
{
if ( !curve->isCurveVisible() )
@ -206,65 +222,93 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector<Ri
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
if ( extractionCurve )
{
uniqueCases.insert( extractionCurve->rimCase() );
uniqueTrajectoryTypes.insert( static_cast<int>( extractionCurve->trajectoryType() ) );
uniqueWellPaths.insert( extractionCurve->wellPath() );
uniqueWellNames.insert( extractionCurve->wellName() );
uniqueTimeSteps.insert( extractionCurve->currentTimeStep() );
uniqueBranchDetection.insert( extractionCurve->branchDetection() );
uniqueBranchIndex.insert( extractionCurve->branchIndex() );
if ( extractionCurve->rimCase() )
{
m_uniqueCases.insert( extractionCurve->rimCase() );
}
m_uniqueTrajectoryTypes.insert( static_cast<int>( extractionCurve->trajectoryType() ) );
if ( extractionCurve->trajectoryType() == RimWellLogTrack::WELL_PATH )
{
if ( extractionCurve->wellPath() )
{
m_uniqueWellPaths.insert( extractionCurve->wellPath() );
}
}
else if ( extractionCurve->trajectoryType() == RimWellLogTrack::SIMULATION_WELL )
{
if ( !extractionCurve->wellName().isEmpty() )
{
m_uniqueWellNames.insert( extractionCurve->wellName() );
}
}
m_uniqueTimeSteps.insert( extractionCurve->currentTimeStep() );
m_uniqueBranchDetection.insert( extractionCurve->branchDetection() );
m_uniqueBranchIndices.insert( extractionCurve->branchIndex() );
}
else if ( fileCurve )
{
uniqueWellPaths.insert( fileCurve->wellPath() );
uniqueWellNames.insert( fileCurve->wellName() );
m_uniqueWellPaths.insert( fileCurve->wellPath() );
m_uniqueWellNames.insert( fileCurve->wellName() );
}
}
for ( RimWellLogTrack* track : tracks )
{
if ( track->showWellPathAttributes() )
{
uniqueTrajectoryTypes.insert( static_cast<int>( RimWellLogExtractionCurve::WELL_PATH ) );
uniqueWellPaths.insert( track->wellPathAttributeSource() );
m_uniqueTrajectoryTypes.insert( static_cast<int>( RimWellLogExtractionCurve::WELL_PATH ) );
m_uniqueWellPaths.insert( track->wellPathAttributeSource() );
}
if ( track->showFormations() )
{
uniqueCases.insert( track->formationNamesCase() );
uniqueWellPaths.insert( track->formationWellPath() );
m_uniqueTrajectoryTypes.insert( track->formationTrajectoryType() );
if ( track->formationTrajectoryType() == RimWellLogTrack::WELL_PATH )
{
m_uniqueWellPaths.insert( track->formationWellPath() );
}
else if ( track->formationTrajectoryType() == RimWellLogTrack::SIMULATION_WELL )
{
m_uniqueWellNames.insert( track->formationSimWellName() );
}
m_uniqueBranchDetection.insert( track->formationBranchDetection() );
m_uniqueBranchIndices.insert( track->formationBranchIndex() );
m_uniqueCases.insert( track->formationNamesCase() );
m_uniqueWellPaths.insert( track->formationWellPath() );
}
}
if ( uniqueCases.size() == 1u )
if ( m_uniqueCases.size() == 1u )
{
setCaseToApply( *uniqueCases.begin() );
setCaseToApply( *m_uniqueCases.begin() );
}
if ( uniqueTrajectoryTypes.size() == 1u )
if ( m_uniqueTrajectoryTypes.size() == 1u )
{
m_trajectoryType = *uniqueTrajectoryTypes.begin();
m_trajectoryType = *m_uniqueTrajectoryTypes.begin();
if ( uniqueWellPaths.size() == 1u )
if ( m_uniqueWellPaths.size() == 1u )
{
setWellPathToApply( *uniqueWellPaths.begin() );
setWellPathToApply( *m_uniqueWellPaths.begin() );
}
if ( uniqueBranchIndex.size() == 1u )
if ( m_uniqueBranchIndices.size() == 1u )
{
setBranchIndexToApply( *uniqueBranchIndex.begin() );
setBranchIndexToApply( *m_uniqueBranchIndices.begin() );
}
if ( uniqueBranchDetection.size() == 1u )
if ( m_uniqueBranchDetection.size() == 1u )
{
setBranchDetectionToApply( *uniqueBranchDetection.begin() == true ? caf::Tristate::State::True
: caf::Tristate::State::False );
setBranchDetectionToApply( *m_uniqueBranchDetection.begin() == true ? caf::Tristate::State::True
: caf::Tristate::State::False );
}
if ( uniqueWellNames.size() == 1u )
if ( m_uniqueWellNames.size() == 1u )
{
setSimWellNameToApply( *uniqueWellNames.begin() );
setSimWellNameToApply( *m_uniqueWellNames.begin() );
}
}
if ( uniqueTimeSteps.size() == 1u )
if ( m_uniqueTimeSteps.size() == 1u )
{
setTimeStepToApply( *uniqueTimeSteps.begin() );
setTimeStepToApply( *m_uniqueTimeSteps.begin() );
}
}
@ -379,29 +423,48 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( std::vector<RimWell
for ( RimWellLogTrack* track : tracks )
{
bool updatedSomething = false;
if ( caseToApply() != nullptr )
{
if ( track->showFormations() )
{
track->setFormationCase( caseToApply() );
updatedSomething = true;
}
}
if ( wellPathToApply() != nullptr )
if ( track->showWellPathAttributes() )
{
if ( track->showWellPathAttributes() )
if ( wellPathToApply() )
{
track->setWellPathAttributesSource( wellPathToApply() );
updatedSomething = true;
}
if ( track->showFormations() )
}
if ( track->showFormations() )
{
if ( caseToApply() != nullptr )
{
track->setFormationCase( caseToApply() );
updatedSomething = true;
}
if ( wellPathToApply() != nullptr )
{
track->setFormationWellPath( wellPathToApply() );
updatedSomething = true;
}
}
if ( !simWellNameToApply().isEmpty() )
{
track->setFormationSimWellName( simWellNameToApply() );
updatedSomething = true;
}
if ( !branchDetectionToApply().isPartiallyTrue() )
{
track->setFormationSimWellName( simWellNameToApply() );
updatedSomething = true;
}
if ( branchIndexToApply() >= 0 )
{
track->setFormationBranchIndex( branchIndexToApply() );
updatedSomething = true;
}
}
if ( updatedSomething )
{
RimWellLogPlot* parentPlot = nullptr;
@ -560,14 +623,28 @@ QList<caf::PdmOptionItemInfo>
if ( caseToApply() == nullptr )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Cases", nullptr ) );
if ( !m_uniqueCases.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Cases", nullptr ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
}
}
else if ( fieldNeedingOptions == &m_trajectoryType )
{
if ( m_trajectoryType() == -1 )
{
options.push_back( caf::PdmOptionItemInfo( "Mixed Trajectory Types", -1 ) );
if ( !m_uniqueTrajectoryTypes.empty() )
{
options.push_back( caf::PdmOptionItemInfo( "Mixed Trajectory Types", -1 ) );
}
else
{
options.push_back( caf::PdmOptionItemInfo( "No Trajectory Types", -1 ) );
}
}
std::vector<RimWellLogExtractionCurve::TrajectoryType> trajectoryTypes =
{RimWellLogExtractionCurve::WELL_PATH, RimWellLogExtractionCurve::SIMULATION_WELL};
@ -583,7 +660,14 @@ QList<caf::PdmOptionItemInfo>
RimTools::wellPathOptionItems( &options );
if ( wellPathToApply() == nullptr )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Paths", nullptr ) );
if ( !m_uniqueWellPaths.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Paths", nullptr ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
}
}
else if ( fieldNeedingOptions == &m_timeStep )
@ -602,7 +686,14 @@ QList<caf::PdmOptionItemInfo>
if ( timeStepToApply() == -1 )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Time Steps", -1 ) );
if ( !m_uniqueTimeSteps.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Time Steps", -1 ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "No Time Steps", -1 ) );
}
}
}
else if ( fieldNeedingOptions == &m_simWellName )
@ -618,14 +709,16 @@ QList<caf::PdmOptionItemInfo>
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
}
if ( options.size() == 0 )
if ( m_simWellName().isEmpty() )
{
options.push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
if ( m_simWellName == QString( "" ) )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Names", "" ) );
if ( !m_uniqueWellNames.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Well Names", "" ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
}
}
}
@ -641,7 +734,14 @@ QList<caf::PdmOptionItemInfo>
if ( m_branchIndex() == -1 )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Branches", -1 ) );
if ( !m_uniqueBranchIndices.empty() )
{
options.push_front( caf::PdmOptionItemInfo( "Mixed Branches", -1 ) );
}
else
{
options.push_front( caf::PdmOptionItemInfo( "No Branches", -1 ) );
}
}
}
}

View File

@ -42,18 +42,21 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject
public:
RimWellLogCurveCommonDataSource();
RimCase* caseToApply() const;
void setCaseToApply( RimCase* val );
int trajectoryTypeToApply() const;
void setTrajectoryTypeToApply( int val );
RimWellPath* wellPathToApply() const;
void setWellPathToApply( RimWellPath* val );
void setBranchIndexToApply( int val );
void setBranchDetectionToApply( caf::Tristate::State val );
QString simWellNameToApply() const;
void setSimWellNameToApply( const QString& val );
int timeStepToApply() const;
void setTimeStepToApply( int val );
RimCase* caseToApply() const;
void setCaseToApply( RimCase* val );
int trajectoryTypeToApply() const;
void setTrajectoryTypeToApply( int val );
RimWellPath* wellPathToApply() const;
void setWellPathToApply( RimWellPath* val );
int branchIndexToApply() const;
void setBranchIndexToApply( int val );
caf::Tristate branchDetectionToApply() const;
void setBranchDetectionToApply( caf::Tristate::State val );
QString simWellNameToApply() const;
void setSimWellNameToApply( const QString& val );
int timeStepToApply() const;
void setTimeStepToApply( int val );
void resetDefaultOptions();
void updateDefaultOptions( const std::vector<RimWellLogCurve*>& curves, const std::vector<RimWellLogTrack*>& tracks );
@ -90,4 +93,12 @@ private:
caf::PdmField<int> m_branchIndex;
caf::PdmField<caf::Tristate> m_branchDetection;
caf::PdmField<int> m_timeStep;
std::set<RimCase*> m_uniqueCases;
std::set<int> m_uniqueTrajectoryTypes;
std::set<RimWellPath*> m_uniqueWellPaths;
std::set<QString> m_uniqueWellNames;
std::set<int> m_uniqueTimeSteps;
std::set<bool> m_uniqueBranchDetection;
std::set<int> m_uniqueBranchIndices;
};

View File

@ -96,7 +96,7 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" );
m_wellPath.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "None" ), "Well Name", "", "", "" );
CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "" ), "Well Name", "", "", "" );
CAF_PDM_InitField( &m_branchDetection,
"BranchDetection",
true,
@ -195,7 +195,10 @@ RimCase* RimWellLogExtractionCurve::rimCase() const
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
{
m_case = view ? view->ownerCase() : nullptr;
if ( view )
{
m_case = view->ownerCase();
}
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
@ -209,6 +212,10 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
m_timeStep = eclipseView->currentTimeStep();
}
else if ( eclipseCase )
{
m_eclipseResultDefinition->setResultVariable( "SOIL" );
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( geoMechView )
@ -216,6 +223,10 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
m_geomResultDefinition->setResultAddress( geoMechView->cellResultResultDefinition()->resultAddress() );
m_timeStep = geoMechView->currentTimeStep();
}
else if ( geomCase )
{
m_geomResultDefinition->setResultAddress( RigFemResultAddress( RIG_ELEMENT_NODAL, "POR-Bar", "" ) );
}
clearGeneratedSimWellPaths();
}
@ -276,7 +287,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
clampTimestep();
auto wellNameSet = sortedSimWellNames();
if ( !wellNameSet.count( m_simWellName() ) ) m_simWellName = "None";
if ( !wellNameSet.count( m_simWellName() ) ) m_simWellName = "";
clearGeneratedSimWellPaths();
@ -584,14 +595,10 @@ QList<caf::PdmOptionItemInfo>
if ( fieldNeedingOptions == &m_wellPath )
{
RimTools::wellPathOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_case )
{
RimTools::caseOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_timeStep )
{
@ -616,11 +623,6 @@ QList<caf::PdmOptionItemInfo>
{
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
}
if ( options.size() == 0 )
{
options.push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
}
else if ( fieldNeedingOptions == &m_branchIndex )
{

View File

@ -289,11 +289,6 @@ void RimWellLogTrack::simWellOptionItems( QList<caf::PdmOptionItemInfo>* options
{
options->push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
}
if ( options->size() == 0 )
{
options->push_front( caf::PdmOptionItemInfo( "None", "None" ) );
}
}
//--------------------------------------------------------------------------------------------------
@ -606,18 +601,14 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions( const caf:
if ( fieldNeedingOptions == &m_formationWellPathForSourceCase )
{
RimTools::wellPathOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_formationWellPathForSourceWellPath )
{
RimTools::wellPathWithFormationsOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_formationCase )
{
RimTools::caseOptionItems( &options );
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if ( fieldNeedingOptions == &m_formationSimWellName )
{
@ -986,6 +977,30 @@ void RimWellLogTrack::setFormationSimWellName( const QString& simWellName )
m_formationSimWellName = simWellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogTrack::formationSimWellName() const
{
return m_formationSimWellName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setFormationBranchDetection( bool branchDetection )
{
m_formationBranchDetection = branchDetection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::formationBranchDetection() const
{
return m_formationBranchDetection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -994,6 +1009,14 @@ void RimWellLogTrack::setFormationBranchIndex( int branchIndex )
m_formationBranchIndex = branchIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogTrack::formationBranchIndex() const
{
return m_formationBranchIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1002,6 +1025,14 @@ void RimWellLogTrack::setFormationCase( RimCase* rimCase )
m_formationCase = rimCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCase* RimWellLogTrack::formationNamesCase() const
{
return m_formationCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1013,9 +1044,9 @@ void RimWellLogTrack::setFormationTrajectoryType( TrajectoryType trajectoryType
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCase* RimWellLogTrack::formationNamesCase() const
RimWellLogTrack::TrajectoryType RimWellLogTrack::formationTrajectoryType() const
{
return m_formationCase();
return m_formationTrajectoryType();
}
//--------------------------------------------------------------------------------------------------
@ -1248,9 +1279,9 @@ void RimWellLogTrack::setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowFormations( bool on )
void RimWellLogTrack::setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay )
{
m_showFormations_OBSOLETE = on;
m_formationDisplay = formationDisplay;
}
//--------------------------------------------------------------------------------------------------
@ -1258,7 +1289,7 @@ void RimWellLogTrack::setShowFormations( bool on )
//--------------------------------------------------------------------------------------------------
bool RimWellLogTrack::showFormations() const
{
return m_showFormations_OBSOLETE;
return m_formationDisplay() != RiuPlotAnnotationTool::NONE;
}
//--------------------------------------------------------------------------------------------------
@ -1324,23 +1355,23 @@ RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve( const QwtPlotCurve*
void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_userName );
caf::PdmUiGroup* formationGroup = uiOrdering.addNewGroup( "Zonation/Formation Names" );
caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" );
formationGroup->add( &m_formationDisplay );
annotationGroup->add( &m_formationDisplay );
if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING ||
m_formationDisplay() & RiuPlotAnnotationTool::COLORED_LINES )
{
formationGroup->add( &m_colorShadingPalette );
annotationGroup->add( &m_colorShadingPalette );
if ( m_formationDisplay() & RiuPlotAnnotationTool::COLOR_SHADING )
{
formationGroup->add( &m_colorShadingTransparency );
annotationGroup->add( &m_colorShadingTransparency );
}
}
formationGroup->add( &m_showFormationLabels );
annotationGroup->add( &m_showFormationLabels );
if ( !m_formationsForCaseWithSimWellOnly )
{
formationGroup->add( &m_formationSource );
annotationGroup->add( &m_formationSource );
}
else
{
@ -1349,23 +1380,23 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
if ( m_formationSource() == CASE )
{
formationGroup->add( &m_formationCase );
annotationGroup->add( &m_formationCase );
if ( !m_formationsForCaseWithSimWellOnly )
{
formationGroup->add( &m_formationTrajectoryType );
annotationGroup->add( &m_formationTrajectoryType );
if ( m_formationTrajectoryType() == WELL_PATH )
{
formationGroup->add( &m_formationWellPathForSourceCase );
annotationGroup->add( &m_formationWellPathForSourceCase );
}
}
if ( m_formationsForCaseWithSimWellOnly || m_formationTrajectoryType() == SIMULATION_WELL )
{
formationGroup->add( &m_formationSimWellName );
annotationGroup->add( &m_formationSimWellName );
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName( formationGroup,
RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromSimWellName( annotationGroup,
m_formationSimWellName,
m_formationBranchDetection,
m_formationBranchIndex );
@ -1373,11 +1404,11 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
}
else if ( m_formationSource() == WELL_PICK_FILTER )
{
formationGroup->add( &m_formationWellPathForSourceWellPath );
annotationGroup->add( &m_formationWellPathForSourceWellPath );
if ( m_formationWellPathForSourceWellPath() )
{
formationGroup->add( &m_formationLevel );
formationGroup->add( &m_showformationFluids );
annotationGroup->add( &m_formationLevel );
annotationGroup->add( &m_showformationFluids );
}
}
@ -1653,7 +1684,7 @@ RigEclipseWellLogExtractor* RimWellLogTrack::createSimWellExtractor( RimWellLogP
if ( wellPaths.size() == 0 ) return nullptr;
CVF_ASSERT( branchIndex < static_cast<int>( wellPaths.size() ) );
CVF_ASSERT( branchIndex >= 0 && branchIndex < static_cast<int>( wellPaths.size() ) );
return ( wellLogCollection->findOrCreateSimWellExtractor( simWellName,
QString( "Find or create sim well extractor" ),

View File

@ -108,13 +108,18 @@ public:
int widthScaleFactor() const;
void setWidthScaleFactor( WidthScaleFactor scaleFactor );
void setFormationWellPath( RimWellPath* wellPath );
RimWellPath* formationWellPath() const;
void setFormationSimWellName( const QString& simWellName );
void setFormationBranchIndex( int branchIndex );
void setFormationCase( RimCase* rimCase );
void setFormationTrajectoryType( TrajectoryType trajectoryType );
RimCase* formationNamesCase() const;
void setFormationWellPath( RimWellPath* wellPath );
RimWellPath* formationWellPath() const;
void setFormationSimWellName( const QString& simWellName );
QString formationSimWellName() const;
void setFormationBranchDetection( bool branchDetection );
bool formationBranchDetection() const;
void setFormationBranchIndex( int branchIndex );
int formationBranchIndex() const;
void setFormationCase( RimCase* rimCase );
RimCase* formationNamesCase() const;
void setFormationTrajectoryType( TrajectoryType trajectoryType );
TrajectoryType formationTrajectoryType() const;
void recreateViewer();
void detachAllCurves();
@ -140,7 +145,7 @@ public:
void setVisibleXRange( double minValue, double maxValue );
void setTickIntervals( double majorTickInterval, double minorTickInterval );
void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines );
void setShowFormations( bool on );
void setShowFormations( RiuPlotAnnotationTool::FormationDisplay formationDisplay );
bool showFormations() const;
void setShowFormationLabels( bool on );