Merge pull request #4730 from OPM/feature-plot-color-fill

Feature plot color fill
This commit is contained in:
Gaute Lindkvist
2019-09-18 15:43:14 +02:00
committed by GitHub
17 changed files with 642 additions and 282 deletions

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

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

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

@@ -19,6 +19,7 @@
#include "RimWellLogCurve.h"
#include "RiaCurveDataTools.h"
#include "RigWellLogCurveData.h"
#include "RimWellLogPlot.h"
@@ -33,6 +34,8 @@
#include "qwt_symbol.h"
#include <algorithm>
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" );
@@ -55,9 +58,31 @@ RimWellLogCurve::~RimWellLogCurve() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::valueRange( double* minimumValue, double* maximumValue ) const
bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumValue ) const
{
return xValueRange( minimumValue, maximumValue );
CAF_ASSERT( minimumValue && maximumValue );
if ( !( minimumValue && maximumValue ) )
{
return false;
}
if ( m_curveData->xValues().empty() )
{
return false;
}
*minimumValue = std::numeric_limits<double>::infinity();
*maximumValue = -std::numeric_limits<double>::infinity();
for ( double xValue : m_curveData->xValues() )
{
if ( RiaCurveDataTools::isValidValue( xValue, false ) )
{
*minimumValue = std::min( *minimumValue, xValue );
*maximumValue = std::max( *maximumValue, xValue );
}
}
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

@@ -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, "POR", "" ) );
}
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();
@@ -321,123 +332,10 @@ 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;
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
clampBranchIndex();
RimMainPlotCollection* mainPlotCollection;
this->firstAncestorOrThisOfTypeAsserted( mainPlotCollection );
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
if ( eclipseCase )
{
if ( m_trajectoryType == WELL_PATH )
{
eclExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, eclipseCase );
}
else
{
std::vector<const RigWellPath*> simWellBranches =
RiaSimWellBranchTools::simulationWellBranches( m_simWellName, m_branchDetection );
if ( m_branchIndex >= 0 && m_branchIndex < static_cast<int>( simWellBranches.size() ) )
{
auto wellBranch = simWellBranches[m_branchIndex];
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor( m_simWellName,
eclipseCase->caseUserDescription(),
wellBranch,
eclipseCase->eclipseCaseData() );
if ( eclExtractor.notNull() )
{
m_wellPathsWithExtractors.push_back( wellBranch );
}
isUsingPseudoLength = true;
}
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath,
geomCase );
std::vector<double> values;
std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER;
if ( eclExtractor.notNull() && eclipseCase )
{
measuredDepthValues = eclExtractor->cellIntersectionMDs();
tvDepthValues = eclExtractor->cellIntersectionTVDs();
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
m_timeStep,
m_eclipseResultDefinition );
if ( resAcc.notNull() )
{
eclExtractor->curveData( resAcc.p(), &values );
}
RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if ( eclipseUnitsType == RiaEclipseUnitTools::UNITS_FIELD )
{
// See https://github.com/OPM/ResInsight/issues/538
depthUnit = RiaDefines::UNIT_FEET;
}
}
else if ( geomExtractor.notNull() ) // geomExtractor
{
measuredDepthValues = geomExtractor->cellIntersectionMDs();
tvDepthValues = geomExtractor->cellIntersectionTVDs();
findAndLoadWbsParametersFromLasFiles( m_wellPath(), geomExtractor.p() );
RimWellBoreStabilityPlot* wbsPlot;
this->firstAncestorOrThisOfType( wbsPlot );
if ( wbsPlot )
{
geomExtractor->setWbsParameters( wbsPlot->porePressureSource(),
wbsPlot->poissonRatioSource(),
wbsPlot->ucsSource(),
wbsPlot->userDefinedPoissonRatio(),
wbsPlot->userDefinedUcs() );
}
geomExtractor->setRkbDiff( rkbDiff() );
m_geomResultDefinition->loadResult();
geomExtractor->curveData( m_geomResultDefinition->resultAddress(), m_timeStep, &values );
}
m_curveData = new RigWellLogCurveData;
if ( values.size() && measuredDepthValues.size() )
{
if ( !tvDepthValues.size() )
{
m_curveData->setValuesAndMD( values, measuredDepthValues, depthUnit, true );
}
else
{
m_curveData->setValuesWithTVD( values, measuredDepthValues, tvDepthValues, depthUnit, true );
}
}
extractData( &isUsingPseudoLength );
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
@@ -464,6 +362,8 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
m_qwtPlotCurve->setLineSegmentStartStopIndices( m_curveData->polylineStartStopIndices() );
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isUsingPseudoLength )
{
RimWellLogTrack* wellLogTrack;
@@ -491,6 +391,125 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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 );
m_geomResultDefinition->setGeoMechCase( geomCase );
clampBranchIndex();
RimMainPlotCollection* mainPlotCollection;
this->firstAncestorOrThisOfTypeAsserted( mainPlotCollection );
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
if ( eclipseCase )
{
if ( m_trajectoryType == WELL_PATH )
{
eclExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, eclipseCase );
}
else
{
std::vector<const RigWellPath*> simWellBranches =
RiaSimWellBranchTools::simulationWellBranches( m_simWellName, m_branchDetection );
if ( m_branchIndex >= 0 && m_branchIndex < static_cast<int>( simWellBranches.size() ) )
{
auto wellBranch = simWellBranches[m_branchIndex];
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor( m_simWellName,
eclipseCase->caseUserDescription(),
wellBranch,
eclipseCase->eclipseCaseData() );
if ( eclExtractor.notNull() )
{
m_wellPathsWithExtractors.push_back( wellBranch );
}
*isUsingPseudoLength = true;
}
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor( m_wellPath, geomCase );
std::vector<double> values;
std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER;
if ( eclExtractor.notNull() && eclipseCase )
{
measuredDepthValues = eclExtractor->cellIntersectionMDs();
tvDepthValues = eclExtractor->cellIntersectionTVDs();
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
m_timeStep,
m_eclipseResultDefinition );
if ( resAcc.notNull() )
{
eclExtractor->curveData( resAcc.p(), &values );
}
RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if ( eclipseUnitsType == RiaEclipseUnitTools::UNITS_FIELD )
{
// See https://github.com/OPM/ResInsight/issues/538
depthUnit = RiaDefines::UNIT_FEET;
}
}
else if ( geomExtractor.notNull() ) // geomExtractor
{
measuredDepthValues = geomExtractor->cellIntersectionMDs();
tvDepthValues = geomExtractor->cellIntersectionTVDs();
findAndLoadWbsParametersFromLasFiles( m_wellPath(), geomExtractor.p() );
RimWellBoreStabilityPlot* wbsPlot;
this->firstAncestorOrThisOfType( wbsPlot );
if ( wbsPlot )
{
geomExtractor->setWbsParameters( wbsPlot->porePressureSource(),
wbsPlot->poissonRatioSource(),
wbsPlot->ucsSource(),
wbsPlot->userDefinedPoissonRatio(),
wbsPlot->userDefinedUcs() );
}
geomExtractor->setRkbDiff( rkbDiff() );
m_geomResultDefinition->loadResult();
geomExtractor->curveData( m_geomResultDefinition->resultAddress(), m_timeStep, &values );
}
m_curveData = new RigWellLogCurveData;
if ( values.size() && measuredDepthValues.size() )
{
if ( !tvDepthValues.size() )
{
m_curveData->setValuesAndMD( values, measuredDepthValues, depthUnit, true );
}
else
{
m_curveData->setValuesWithTVD( values, measuredDepthValues, tvDepthValues, depthUnit, true );
}
}
}
//--------------------------------------------------------------------------------------------------
/// Search well path for LAS-files containing Well Bore Stability data and set them in the extractor.
//--------------------------------------------------------------------------------------------------
@@ -584,14 +603,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 +631,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

@@ -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

@@ -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 )
{
@@ -769,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 )
{
@@ -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();
}
//--------------------------------------------------------------------------------------------------
@@ -1144,7 +1175,7 @@ void RimWellLogTrack::calculateXZoomRange()
if ( curve->isCurveVisible() )
{
visibleCurves++;
if ( curve->xValueRange( &minCurveValue, &maxCurveValue ) )
if ( curve->xValueRangeInData( &minCurveValue, &maxCurveValue ) )
{
if ( minCurveValue < minValue )
{
@@ -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 );