mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #4730 from OPM/feature-plot-color-fill
Feature plot color fill
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
@@ -275,7 +280,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
|
||||
curve->loadDataAndUpdate( false );
|
||||
|
||||
double actualMinValue = minValue, actualMaxValue = maxValue;
|
||||
curve->valueRange( &actualMinValue, &actualMaxValue );
|
||||
curve->xValueRangeInQwt( &actualMinValue, &actualMaxValue );
|
||||
while ( maxValue < actualMaxValue )
|
||||
{
|
||||
maxValue += angleIncrement;
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
@@ -51,8 +52,12 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||
RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
|
||||
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve( plotTrack, nullptr, nullptr, nullptr, -1, true );
|
||||
curve->loadDataAndUpdate( true );
|
||||
RimWellLogPlot* plot = nullptr;
|
||||
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
plot->zoomAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user