RFT segment plot adjustments (#9912)

* Delete RFT plot when associated case is deleted
* Rename
* Hide track/curves with no data
This commit is contained in:
Magne Sjaastad 2023-03-06 14:34:22 +01:00 committed by GitHub
parent 8f786fed5d
commit c248c9fb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 355 additions and 169 deletions

View File

@ -21,6 +21,8 @@
#include "RiaGuiApplication.h"
#include "RiaSummaryTools.h"
#include "RicDeleteItemFeature.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
@ -28,6 +30,7 @@
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RimWellLogPlot.h"
#include "RiuPlotMainWindow.h"
@ -59,6 +62,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection();
std::set<RimSummaryMultiPlot*> plotsToUpdate;
std::set<RimWellLogPlot*> wellLogPlotsToDelete;
for ( RimSummaryCase* summaryCase : cases )
{
@ -70,6 +74,23 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
}
plotsToUpdate.insert( multiPlot );
}
std::vector<caf::PdmObjectHandle*> referringObjects;
summaryCase->objectsWithReferringPtrFields( referringObjects );
for ( auto object : referringObjects )
{
if ( !object ) continue;
RimWellLogPlot* wellLogPlot = nullptr;
object->firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot ) wellLogPlotsToDelete.insert( wellLogPlot );
}
}
for ( auto wellLogPlot : wellLogPlotsToDelete )
{
RicDeleteItemFeature::deleteObject( wellLogPlot );
}
summaryCaseMainCollection->removeCases( cases );

View File

@ -44,12 +44,12 @@ bool RicDeleteItemFeature::isCommandEnabled()
for ( caf::PdmUiItem* item : items )
{
caf::PdmObject* currentPdmObject = dynamic_cast<caf::PdmObject*>( item );
auto* currentPdmObject = dynamic_cast<caf::PdmObject*>( item );
if ( !currentPdmObject ) return false;
if ( !currentPdmObject->isDeletable() ) return false;
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = dynamic_cast<caf::PdmChildArrayFieldHandle*>( currentPdmObject->parentField() );
auto* childArrayFieldHandle = dynamic_cast<caf::PdmChildArrayFieldHandle*>( currentPdmObject->parentField() );
if ( !childArrayFieldHandle ) return false;
}
@ -63,68 +63,75 @@ void RicDeleteItemFeature::onActionTriggered( bool isChecked )
{
std::vector<caf::PdmUiItem*> items;
caf::SelectionManager::instance()->selectedItems( items );
assert( items.size() > 0 );
for ( caf::PdmUiItem* item : items )
{
caf::PdmObject* currentPdmObject = dynamic_cast<caf::PdmObject*>( item );
auto* currentPdmObject = dynamic_cast<caf::PdmObject*>( item );
if ( !currentPdmObject ) continue;
if ( !currentPdmObject->isDeletable() ) continue;
deleteObject( currentPdmObject );
}
}
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = dynamic_cast<caf::PdmChildArrayFieldHandle*>( currentPdmObject->parentField() );
if ( !childArrayFieldHandle ) continue;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteItemFeature::deleteObject( caf::PdmObject* objectToDelete )
{
if ( !objectToDelete || !objectToDelete->isDeletable() ) return;
int indexAfter = -1;
auto* childArrayFieldHandle = dynamic_cast<caf::PdmChildArrayFieldHandle*>( objectToDelete->parentField() );
if ( !childArrayFieldHandle ) return;
std::vector<caf::PdmObjectHandle*> childObjects;
childArrayFieldHandle->children( &childObjects );
int indexToObject = -1;
for ( size_t i = 0; i < childObjects.size(); i++ )
std::vector<caf::PdmObjectHandle*> childObjects;
childArrayFieldHandle->children( &childObjects );
for ( size_t i = 0; i < childObjects.size(); i++ )
{
if ( childObjects[i] == objectToDelete )
{
if ( childObjects[i] == currentPdmObject )
{
indexAfter = static_cast<int>( i );
}
indexToObject = static_cast<int>( i );
}
}
// Did not find currently selected pdm object in the current list field
assert( indexAfter != -1 );
// Did not find object in the current list field
if ( indexToObject == -1 ) return;
RicDeleteItemExec* executeCmd = new RicDeleteItemExec( caf::SelectionManager::instance()->notificationCenter() );
auto* executeCmd = new RicDeleteItemExec( caf::SelectionManager::instance()->notificationCenter() );
RicDeleteItemExecData& data = executeCmd->commandData();
data.m_rootObject = caf::PdmReferenceHelper::findRoot( childArrayFieldHandle );
data.m_pathToField = caf::PdmReferenceHelper::referenceFromRootToField( data.m_rootObject, childArrayFieldHandle );
data.m_indexToObject = indexAfter;
RicDeleteItemExecData& data = executeCmd->commandData();
data.m_rootObject = caf::PdmReferenceHelper::findRoot( childArrayFieldHandle );
data.m_pathToField = caf::PdmReferenceHelper::referenceFromRootToField( data.m_rootObject, childArrayFieldHandle );
data.m_indexToObject = indexToObject;
{
QString desc;
if ( objectToDelete->userDescriptionField() )
{
QString desc;
if ( currentPdmObject->userDescriptionField() )
{
desc = currentPdmObject->userDescriptionField()->uiCapability()->uiValue().toString();
}
else
{
desc = currentPdmObject->uiName();
}
data.m_description = desc + " (delete)";
}
// When the delete feature is ready for redo/undo, activate by using the line below
// Temporarily do not insert these object into undo/redo system as this requires a lot of testing
// for reinserting objects.
bool useUndoRedo = false;
if ( useUndoRedo )
{
caf::CmdExecCommandManager::instance()->processExecuteCommand( executeCmd );
desc = objectToDelete->userDescriptionField()->uiCapability()->uiValue().toString();
}
else
{
executeCmd->redo();
delete executeCmd;
desc = objectToDelete->uiName();
}
data.m_description = desc + " (delete)";
}
// When the delete feature is ready for redo/undo, activate by using the line below
// Temporarily do not insert these object into undo/redo system as this requires a lot of testing
// for reinserting objects.
bool useUndoRedo = false;
if ( useUndoRedo )
{
caf::CmdExecCommandManager::instance()->processExecuteCommand( executeCmd );
}
else
{
executeCmd->redo();
delete executeCmd;
}
}

View File

@ -21,6 +21,11 @@
#include "cafCmdFeature.h"
namespace caf
{
class PdmObject;
}
//==================================================================================================
///
//==================================================================================================
@ -28,8 +33,12 @@ class RicDeleteItemFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void deleteObject( caf::PdmObject* objectToDelete );
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -681,7 +681,7 @@ void RicSummaryPlotEditorUi::updateTargetPlot()
// Add edited curves to target plot
for ( const auto& editedCurve : m_previewPlot->summaryCurves() )
{
if ( !editedCurve->isCurveVisible() )
if ( !editedCurve->isChecked() )
{
continue;
}
@ -724,7 +724,7 @@ void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve
if ( forceVisible )
{
curveCopy->setCurveVisibility( true );
curveCopy->setCheckState( true );
}
plot->addCurveNoUpdate( curveCopy, false );
@ -747,7 +747,7 @@ void RicSummaryPlotEditorUi::copyEnsembleCurveAndAddToCurveSet( const RimSummary
if ( forceVisible )
{
curveCopy->setCurveVisibility( true );
curveCopy->setCheckState( true );
}
curveSet->addCurve( curveCopy );
@ -951,7 +951,7 @@ void RicSummaryPlotEditorUi::setInitialCurveVisibility( const RimSummaryPlot* ta
auto curveDef = std::make_pair( curve->summaryCaseY(), curve->summaryAddressY() );
if ( sourceCurveDefs.count( curveDef ) == 0 )
{
curve->setCurveVisibility( false );
curve->setCheckState( false );
}
}

View File

@ -80,7 +80,7 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
if ( !wellNames.empty() ) wellName = *wellNames.begin();
appendTrackAndCurveForBranchType( plot,
"Connection Rates",
"Reservoir Rates",
{ "CONGRAT", "CONORAT", "CONWRAT" },
wellName,
RiaDefines::RftBranchType::RFT_ANNULUS,
@ -90,7 +90,10 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
for ( auto branchType :
{ RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE, RiaDefines::RftBranchType::RFT_TUBING } )
{
appendTrackAndCurveForBranchType( plot, "Segment Rates", { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, summaryCase );
QString trackName = caf::AppEnum<RiaDefines::RftBranchType>::uiText( branchType );
trackName += " Rates";
appendTrackAndCurveForBranchType( plot, trackName, { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, summaryCase );
}
}
@ -99,6 +102,7 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( plot, wellName, summaryCase );
plot->loadDataAndUpdate();
plot->updateTrackVisibility();
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
plot->updateLayout();
@ -116,12 +120,10 @@ void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( Ri
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
auto plotTrack = new RimWellLogTrack();
auto plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogTrackWithAutoUpdate();
plot->addPlot( plotTrack );
plotTrack->setDescription( trackName );
plot->loadDataAndUpdate();
for ( const auto& resultName : resultNames )
{
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase );
@ -137,7 +139,6 @@ void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( Ri
curve->setFillStyle( Qt::SolidPattern );
curve->setIsStacked( true );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
}

View File

@ -79,9 +79,9 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
if ( !wellNames.empty() ) wellName = *wellNames.begin();
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogTrackWithAutoUpdate();
plot->addPlot( plotTrack );
plotTrack->setDescription( "Connection Rates" );
plotTrack->setDescription( "Reservoir Rates" );
auto curve = createAndAddCurve( plotTrack, "CONGRAT", wellName, RiaDefines::RftBranchType::RFT_ANNULUS, summaryCase );
curve->setScaleFactor( 1e-3 );
@ -92,8 +92,9 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
{ RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE, RiaDefines::RftBranchType::RFT_TUBING } )
{
QString resultName = "SEGGRAT";
QString trackName = "Segment Rates";
auto curve = appendTrackAndCurveForBranchType( plot, trackName, resultName, wellName, branchType, summaryCase );
QString trackName = caf::AppEnum<RiaDefines::RftBranchType>::uiText( branchType );
trackName += " Rates";
auto curve = appendTrackAndCurveForBranchType( plot, trackName, resultName, wellName, branchType, summaryCase );
curve->setScaleFactor( 1e-3 );
curve->setFillStyle( Qt::SolidPattern );
}
@ -103,6 +104,7 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
appendTopologyTrack( plot, wellName, summaryCase );
plot->loadDataAndUpdate();
plot->updateTrackVisibility();
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
plot->updateLayout();
@ -120,15 +122,12 @@ RimWellLogRftCurve* RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBr
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogTrackWithAutoUpdate();
plot->addPlot( plotTrack );
plotTrack->setDescription( trackName );
plot->loadDataAndUpdate();
auto curve = createAndAddCurve( plotTrack, resultName, wellName, branchType, summaryCase );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
return curve;
@ -231,7 +230,8 @@ void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* pl
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase )
{
auto track = new RimWellLogTrack();
auto track = RicNewWellLogPlotFeatureImpl::createWellLogTrackWithAutoUpdate();
track->setAutoCheckStateBasedOnCurveData( true );
track->setDescription( "Pressure" );
plot->addPlot( track );
@ -244,10 +244,12 @@ void RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( RimWellLogPlot* pl
auto color = RimRftTopologyCurve::colorForRftBranchType( branchType );
curve->setColor( color );
curve->setLineThickness( 3 );
curve->setAutoCheckStateBasedOnCurveData( true );
}
auto curve = createAndAddCurve( track, "PRESSURE", wellName, RiaDefines::RftBranchType::RFT_ANNULUS, summaryCase );
curve->setLineThickness( 3 );
curve->setAutoCheckStateBasedOnCurveData( true );
track->updateAllRequiredEditors();
}

View File

@ -341,7 +341,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
curve->setSmoothingThreshold( 0.002 );
if ( resultNames[i] == RiaResultNames::wbsSHMkResult() )
{
curve->setCurveVisibility( false );
curve->setCheckState( false );
}
}

View File

@ -104,6 +104,17 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot()
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogTrackWithAutoUpdate()
{
auto track = new RimWellLogTrack();
track->setAutoCheckStateBasedOnCurveData( true );
return track;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,8 @@ public:
const QString& plotDescription = QString( "" ),
const RimWbsParameters* params = nullptr );
static RimWellLogPlot* createHorizontalWellLogPlot();
static RimWellLogPlot* createHorizontalWellLogPlot();
static RimWellLogTrack* createWellLogTrackWithAutoUpdate();
static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true, const QString& plotDescription = QString( "" ) );

View File

@ -217,7 +217,7 @@ void RimWellAllocationPlot::updateFromWell()
{
for ( auto c : t->curves() )
{
if ( !c->isCurveVisible() )
if ( !c->isChecked() )
{
uncheckedCurveNames.insert( c->curveName() );
}
@ -462,7 +462,7 @@ void RimWellAllocationPlot::addStackedCurve( const QString& tracerNa
plotTrack->addCurve( curve );
curve->loadDataAndUpdate( true );
curve->setCurveVisibility( showCurve );
curve->setCheckState( showCurve );
}
//--------------------------------------------------------------------------------------------------

View File

@ -968,7 +968,7 @@ std::vector<const RimPlotCurve*> RimGridCrossPlot::visibleCurves() const
{
for ( auto curve : dataSet->curves() )
{
if ( curve->isCurveVisible() )
if ( curve->isChecked() )
{
plotCurves.push_back( curve );
}

View File

@ -705,7 +705,7 @@ size_t RimGridCrossPlotDataSet::visibleCurveCount() const
size_t visibleCurves = 0;
for ( auto curve : m_crossPlotCurves )
{
if ( curve && curve->isCurveVisible() ) visibleCurves++;
if ( curve && curve->isChecked() ) visibleCurves++;
}
return visibleCurves;
}
@ -718,7 +718,7 @@ size_t RimGridCrossPlotDataSet::sampleCount() const
size_t sampleCount = 0;
for ( auto curve : m_crossPlotCurves )
{
if ( curve && curve->isCurveVisible() ) sampleCount += curve->sampleCount();
if ( curve && curve->isChecked() ) sampleCount += curve->sampleCount();
}
return sampleCount;
}

View File

@ -1530,6 +1530,17 @@ RiuPlotAxis RimDepthTrackPlot::annotationAxis( RiaDefines::Orientation depthOrie
return RiuPlotAxis( oppositeAxis );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::updateTrackVisibility()
{
for ( auto& track : m_plots )
{
track->updateCheckStateBasedOnCurveData();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -172,6 +172,8 @@ public:
static RiuPlotAxis valueAxis( RiaDefines::Orientation depthOrientation );
static RiuPlotAxis annotationAxis( RiaDefines::Orientation depthOrientation );
void updateTrackVisibility();
protected:
QImage snapshotWindowContent() override;

View File

@ -383,7 +383,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() && m_plotCurve )
if ( isChecked() && m_plotCurve )
{
std::vector<double> values;

View File

@ -60,6 +60,8 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve" );
m_showCurve.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_autoCheckStateBasedOnCurveData, "AutoCheckStateBasedOnCurveData", false, "Hide Curve If No Curve Data" );
CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "" );
auto templateText = QString( "%1, %2" ).arg( RiaDefines::namingVariableCase() ).arg( RiaDefines::namingVariableResultName() );
@ -158,6 +160,10 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
if ( m_showCurve() ) loadDataAndUpdate( false );
visibilityChanged.send( m_showCurve() );
}
else if ( changedField == &m_autoCheckStateBasedOnCurveData )
{
updateCheckStateBasedOnCurveData();
}
else if ( changedField == &m_curveName )
{
updateCurveNameAndUpdatePlotLegendAndTitle();
@ -359,7 +365,7 @@ cvf::Color3f RimPlotCurve::color() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::isCurveVisible() const
bool RimPlotCurve::isChecked() const
{
return m_showCurve;
}
@ -367,9 +373,27 @@ bool RimPlotCurve::isCurveVisible() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setCurveVisibility( bool visible )
void RimPlotCurve::setCheckState( bool isChecked )
{
m_showCurve = visible;
m_showCurve = isChecked;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::setAutoCheckStateBasedOnCurveData( bool enable )
{
m_autoCheckStateBasedOnCurveData = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateCheckStateBasedOnCurveData()
{
if ( !m_autoCheckStateBasedOnCurveData ) return;
setCheckState( isAnyCurveDataPresent() );
}
//--------------------------------------------------------------------------------------------------
@ -861,6 +885,14 @@ void RimPlotCurve::updateAxisInPlot( RiuPlotAxis plotAxis )
if ( m_plotCurve ) m_plotCurve->setYAxis( plotAxis );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPlotCurve::isAnyCurveDataPresent() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -79,8 +79,14 @@ public:
void setFillStyle( Qt::BrushStyle brushStyle );
void setFillColor( const cvf::Color3f& fillColor );
bool isCurveVisible() const;
void setCurveVisibility( bool visible );
bool isChecked() const;
void setCheckState( bool isChecked );
// The check state of the curve (m_showCurve) can automatically be updated based on presens of curve data. The virtual method
// isAnyCurveDataPresent() can be overridden. Similar concept is used in RimWellLogTrack
void setAutoCheckStateBasedOnCurveData( bool enable );
void updateCheckStateBasedOnCurveData();
virtual bool isAnyCurveDataPresent() const;
void updateCurveName();
void updateCurveNameAndUpdatePlotLegendAndTitle();
@ -184,6 +190,7 @@ private:
protected:
caf::PdmField<bool> m_showCurve;
caf::PdmField<bool> m_autoCheckStateBasedOnCurveData;
caf::PdmField<QString> m_curveName;
caf::PdmField<QString> m_curveNameTemplateText;

View File

@ -127,7 +127,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() )
if ( isChecked() )
{
std::vector<time_t> dateTimes = this->timeSteps();
std::vector<double> values = this->yValues();

View File

@ -598,7 +598,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
setZIndexFromCurveInfo();
if ( isCurveVisible() )
if ( isChecked() )
{
std::vector<double> curveValuesY = this->valuesY();

View File

@ -178,7 +178,7 @@ void RimSummaryCurveCollection::reattachPlotCurves()
{
for ( RimSummaryCurve* curve : m_curves )
{
if ( curve->isCurveVisible() ) curve->reattach();
if ( curve->isChecked() ) curve->reattach();
}
}

View File

@ -43,7 +43,7 @@ void RimSummaryCurvesData::populateTimeHistoryCurvesData( std::vector<RimGridTim
for ( RimGridTimeHistoryCurve* curve : curves )
{
if ( !curve->isCurveVisible() ) continue;
if ( !curve->isChecked() ) continue;
QString curveCaseName = curve->caseName();
CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() };
@ -63,7 +63,7 @@ void RimSummaryCurvesData::populateAsciiDataCurvesData( std::vector<RimAsciiData
for ( RimAsciiDataCurve* curve : curves )
{
if ( !curve->isCurveVisible() ) continue;
if ( !curve->isChecked() ) continue;
CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() };
@ -188,7 +188,7 @@ void RimSummaryCurvesData::populateSummaryCurvesData( std::vector<RimSummaryCurv
{
bool isObservedCurve = curve->summaryCaseY() ? curve->summaryCaseY()->isObservedData() : false;
if ( !curve->isCurveVisible() ) continue;
if ( !curve->isChecked() ) continue;
if ( isObservedCurve && ( curveType != SummaryCurveType::CURVE_TYPE_OBSERVED ) ) continue;
if ( !isObservedCurve && ( curveType != SummaryCurveType::CURVE_TYPE_GRID ) ) continue;
if ( !curve->summaryCaseY() ) continue;

View File

@ -1171,7 +1171,7 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis( RiuPl
{
for ( RimSummaryCurve* curve : m_summaryCurveCollection->curves() )
{
if ( curve->isCurveVisible() )
if ( curve->isChecked() )
{
curves.push_back( curve );
}
@ -1184,7 +1184,7 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis( RiuPl
{
for ( RimSummaryCurve* curve : m_summaryCurveCollection->curves() )
{
if ( curve->isCurveVisible() && curve->axisY() == plotAxis )
if ( curve->isChecked() && curve->axisY() == plotAxis )
{
curves.push_back( curve );
}
@ -1197,7 +1197,7 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleSummaryCurvesForAxis( RiuPl
{
for ( RimSummaryCurve* curve : curveSet->curves() )
{
if ( curve->isCurveVisible() && curve->axisY() == plotAxis )
if ( curve->isChecked() && curve->axisY() == plotAxis )
{
curves.push_back( curve );
}
@ -1254,7 +1254,7 @@ std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::visibleTimeHistoryCurvesFo
for ( const auto& c : m_gridTimeHistoryCurves )
{
if ( c->isCurveVisible() )
if ( c->isChecked() )
{
if ( c->yAxis() == plotAxis || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
@ -1275,7 +1275,7 @@ std::vector<RimAsciiDataCurve*> RimSummaryPlot::visibleAsciiDataCurvesForAxis( R
for ( const auto& c : m_asciiDataCurves )
{
if ( c->isCurveVisible() )
if ( c->isChecked() )
{
if ( c->yAxis() == plotAxis || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
@ -2041,7 +2041,7 @@ std::vector<RimPlotCurve*> RimSummaryPlot::visibleCurvesForLegend()
for ( auto c : summaryCurves() )
{
if ( !c->isCurveVisible() ) continue;
if ( !c->isChecked() ) continue;
if ( !c->showInLegend() ) continue;
curves.push_back( c );
}
@ -2815,7 +2815,7 @@ void RimSummaryPlot::updateCurveNames()
{
for ( auto c : summaryCurves() )
{
if ( c->isCurveVisible() )
if ( c->isChecked() )
{
c->updateCurveNameNoLegendUpdate();
}

View File

@ -179,6 +179,14 @@ void RimWellLogCurve::setPropertyAndDepthsAndErrors( const std::vector<double>&
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::clearCurveData()
{
m_curveData->clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -458,3 +466,11 @@ RiuPlotAxis RimWellLogCurve::valueAxis() const
return depthTrackPlot->valueAxis();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::isAnyCurveDataPresent() const
{
return !m_curveData->propertyValues().empty();
}

View File

@ -48,6 +48,7 @@ public:
bool depthValueRangeInData( double* minimumValue, double* maximumValue ) const;
const RigWellLogCurveData* curveData() const;
bool isAnyCurveDataPresent() const override;
void updateCurveAppearance() override;
@ -105,6 +106,8 @@ protected:
const std::vector<double>& depthValues,
const std::vector<double>& errorValues );
void clearCurveData();
bool isVerticalCurve() const;
RiuPlotAxis depthAxis() const;
RiuPlotAxis valueAxis() const;

View File

@ -328,10 +328,6 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector<
// Check to see if the parameters are unique
for ( RimWellLogCurve* curve : curves )
{
if ( !curve->isCurveVisible() )
{
continue;
}
auto* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
auto* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
auto* flowRateCurve = dynamic_cast<RimWellFlowRateCurve*>( curve );
@ -521,10 +517,6 @@ void RimWellLogCurveCommonDataSource::applyDataSourceChanges( const std::vector<
std::set<RimWellLogPlot*> plots;
for ( RimWellLogCurve* curve : curves )
{
if ( !curve->isCurveVisible() )
{
continue;
}
auto* fileCurve = dynamic_cast<RimWellLogFileCurve*>( curve );
auto* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
auto* measurementCurve = dynamic_cast<RimWellMeasurementCurve*>( curve );
@ -719,6 +711,11 @@ void RimWellLogCurveCommonDataSource::applyDataSourceChanges()
parentPlot->descendantsIncludingThisOfType( tracks );
this->applyDataSourceChanges( curves, tracks );
for ( auto& track : tracks )
{
track->updateCheckStateBasedOnCurveData();
}
}
}

View File

@ -344,7 +344,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
if ( isCurveVisible() )
if ( isChecked() )
{
bool isUsingPseudoLength = false;
performDataExtraction( &isUsingPseudoLength );

View File

@ -78,7 +78,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
if ( isCurveVisible() )
if ( isChecked() )
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );

View File

@ -648,7 +648,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
DerivedMDSource derivedMDSource = DerivedMDSource::NO_SOURCE;
if ( isCurveVisible() )
if ( m_autoCheckStateBasedOnCurveData() || isChecked() )
{
RimDepthTrackPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
@ -666,6 +666,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( values.empty() || values.size() != tvDepthVector.size() )
{
clearCurveData();
this->detach( true );
return;
}
@ -747,78 +748,81 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
displayUnit = wellLogPlot->depthUnit();
}
if ( wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::MEASURED_DEPTH )
if ( m_plotCurve )
{
m_plotCurve->setPerPointLabels( perPointLabels );
auto propertyValues = this->curveData()->propertyValuesByIntervals();
auto depthValues = this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit );
if ( !errors.empty() )
if ( wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::MEASURED_DEPTH )
{
setPropertyAndDepthsAndErrors( propertyValues, depthValues, errors );
}
else
{
setPropertyAndDepthValuesToPlotCurve( propertyValues, depthValues );
}
m_plotCurve->setPerPointLabels( perPointLabels );
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
auto propertyValues = this->curveData()->propertyValuesByIntervals();
auto depthValues = this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit );
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
CVF_ASSERT( wellLogTrack );
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
if ( viewer )
{
QString text;
if ( derivedMDSource != DerivedMDSource::NO_SOURCE )
if ( !errors.empty() )
{
if ( derivedMDSource == DerivedMDSource::WELL_PATH )
{
text = "WELL/" + wellLogPlot->depthAxisTitle();
}
else
{
text = "OBS/" + wellLogPlot->depthAxisTitle();
}
}
else // Standard depth title set from plot
{
text = wellLogPlot->depthAxisTitle();
}
viewer->setAxisTitleText( wellLogPlot->depthAxis(), text );
}
}
else
{
m_plotCurve->setPerPointLabels( perPointLabels );
auto propertyValues = this->curveData()->propertyValuesByIntervals();
auto depthValues = this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, displayUnit );
bool useLogarithmicScale = false;
if ( !errors.empty() )
{
setPropertyAndDepthsAndErrors( propertyValues, depthValues, errors );
}
else
{
if ( isVerticalCurve() )
{
m_plotCurve->setSamplesFromXValuesAndYValues( propertyValues, depthValues, useLogarithmicScale );
setPropertyAndDepthsAndErrors( propertyValues, depthValues, errors );
}
else
{
m_plotCurve->setSamplesFromXValuesAndYValues( depthValues, propertyValues, useLogarithmicScale );
setPropertyAndDepthValuesToPlotCurve( propertyValues, depthValues );
}
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
CVF_ASSERT( wellLogTrack );
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
if ( viewer )
{
QString text;
if ( derivedMDSource != DerivedMDSource::NO_SOURCE )
{
if ( derivedMDSource == DerivedMDSource::WELL_PATH )
{
text = "WELL/" + wellLogPlot->depthAxisTitle();
}
else
{
text = "OBS/" + wellLogPlot->depthAxisTitle();
}
}
else // Standard depth title set from plot
{
text = wellLogPlot->depthAxisTitle();
}
viewer->setAxisTitleText( wellLogPlot->depthAxis(), text );
}
}
}
else
{
m_plotCurve->setPerPointLabels( perPointLabels );
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
auto propertyValues = this->curveData()->propertyValuesByIntervals();
auto depthValues = this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, displayUnit );
bool useLogarithmicScale = false;
if ( !errors.empty() )
{
setPropertyAndDepthsAndErrors( propertyValues, depthValues, errors );
}
else
{
if ( isVerticalCurve() )
{
m_plotCurve->setSamplesFromXValuesAndYValues( propertyValues, depthValues, useLogarithmicScale );
}
else
{
m_plotCurve->setSamplesFromXValuesAndYValues( depthValues, propertyValues, useLogarithmicScale );
}
}
}
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
}
if ( updateParentPlot )
{
@ -847,6 +851,10 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
curveDataGroup->add( &m_rftDataType );
curveDataGroup->add( &m_scaleFactor );
caf::PdmUiGroup* automationGroup = uiOrdering.addNewGroup( "Automation" );
automationGroup->setCollapsedByDefault();
automationGroup->add( &m_autoCheckStateBasedOnCurveData );
if ( m_rftDataType() == RimWellLogRftCurve::RftDataType::RFT_DATA )
{
curveDataGroup->add( &m_wellLogChannelName );

View File

@ -270,6 +270,8 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitFieldNoDefault( &m_wellPathComponentSource, "AttributesWellPathSource", "Well Path" );
CAF_PDM_InitFieldNoDefault( &m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes" );
CAF_PDM_InitField( &m_autoCheckStateBasedOnCurveData, "AutoCheckStateBasedOnCurveData", false, "Hide Track if No Curve Data" );
CAF_PDM_InitField( &m_overburdenHeight, "OverburdenHeight", 0.0, "Overburden Height" );
m_overburdenHeight.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_underburdenHeight, "UnderburdenHeight", 0.0, "Underburden Height" );
@ -379,7 +381,7 @@ void RimWellLogTrack::calculatePropertyValueZoomRange()
double minCurveValue = HUGE_VAL;
double maxCurveValue = -HUGE_VAL;
if ( curve->isCurveVisible() )
if ( curve->isChecked() )
{
visibleCurves++;
if ( curve->propertyValueRangeInData( &minCurveValue, &maxCurveValue ) )
@ -443,7 +445,7 @@ void RimWellLogTrack::calculateDepthZoomRange()
double minCurveDepth = HUGE_VAL;
double maxCurveDepth = -HUGE_VAL;
if ( curve->isCurveVisible() && curve->depthValueRangeInData( &minCurveDepth, &maxCurveDepth ) )
if ( curve->isChecked() && curve->depthValueRangeInData( &minCurveDepth, &maxCurveDepth ) )
{
if ( minCurveDepth < minDepth )
{
@ -759,6 +761,10 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
updateParentLayout();
RiuPlotMainWindowTools::refreshToolbars();
}
else if ( changedField == &m_autoCheckStateBasedOnCurveData )
{
updateCheckStateBasedOnCurveData();
}
}
//--------------------------------------------------------------------------------------------------
@ -954,7 +960,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
for ( RimWellLogCurve* curve : m_curves() )
{
if ( !curve->isCurveVisible() ) continue;
if ( !curve->isChecked() ) continue;
const RigWellLogCurveData* curveData = curve->curveData();
if ( !curveData ) continue;
@ -1281,6 +1287,36 @@ bool RimWellLogTrack::isEmptyVisiblePropertyRange() const
1.0e-6 * std::max( 1.0, std::max( m_visiblePropertyValueRangeMax(), m_visiblePropertyValueRangeMin() ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setAutoCheckStateBasedOnCurveData( bool enable )
{
m_autoCheckStateBasedOnCurveData = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateCheckStateBasedOnCurveData()
{
bool curveDataPresent = false;
for ( const auto& curve : curves() )
{
curve->updateCheckStateBasedOnCurveData();
curve->updateCurveVisibility();
if ( curve->isAnyCurveDataPresent() ) curveDataPresent = true;
}
// As the visibility of a curve might have changed, update the legend
updateLegend();
if ( !m_autoCheckStateBasedOnCurveData ) return;
setShowWindow( curveDataPresent );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1999,6 +2035,10 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
else
uiOrdering.add( &m_colSpan );
caf::PdmUiGroup* automationGroup = uiOrdering.addNewGroup( "Automation" );
automationGroup->setCollapsedByDefault();
automationGroup->add( &m_autoCheckStateBasedOnCurveData );
caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" );
annotationGroup->setCollapsedByDefault();
@ -2373,11 +2413,11 @@ void RimWellLogTrack::computeAndSetPropertyValueRangeMinForLogarithmicScale()
double pos = HUGE_VAL;
double neg = -HUGE_VAL;
for ( size_t cIdx = 0; cIdx < m_curves.size(); cIdx++ )
for ( const auto& curve : m_curves )
{
if ( m_curves[cIdx]->isCurveVisible() && m_curves[cIdx]->curveData() )
if ( curve->isChecked() && curve->curveData() )
{
RigStatisticsCalculator::posNegClosestToZero( m_curves[cIdx]->curveData()->propertyValuesByIntervals(), pos, neg );
RigStatisticsCalculator::posNegClosestToZero( curve->curveData()->propertyValuesByIntervals(), pos, neg );
}
}
@ -2415,7 +2455,7 @@ std::map<int, std::vector<RimWellLogCurve*>> RimWellLogTrack::visibleStackedCurv
std::map<int, std::vector<RimWellLogCurve*>> stackedCurves;
for ( RimWellLogCurve* curve : m_curves )
{
if ( curve && curve->isCurveVisible() )
if ( curve && curve->isChecked() )
{
RimWellFlowRateCurve* wfrCurve = dynamic_cast<RimWellFlowRateCurve*>( curve );
if ( wfrCurve != nullptr ) // Flow rate curves are always stacked
@ -2449,7 +2489,7 @@ std::vector<RimWellLogCurve*> RimWellLogTrack::visibleCurves() const
for ( RimWellLogCurve* curve : m_curves.children() )
{
if ( curve->isCurveVisible() )
if ( curve->isChecked() )
{
curvesVector.push_back( curve );
}

View File

@ -236,6 +236,9 @@ public:
void updateAxesVisibility( RiaDefines::Orientation orientation, bool isFirstTrack, bool isLastTrack );
void updateDepthMarkerLine();
void setAutoCheckStateBasedOnCurveData( bool enable );
void updateCheckStateBasedOnCurveData();
protected:
// RimViewWindow overrides
void deleteViewWidget() override;
@ -361,6 +364,8 @@ private:
caf::PdmField<double> m_underburdenHeight;
caf::PdmChildField<RimEnsembleWellLogCurveSet*> m_ensembleWellLogCurveSet;
caf::PdmField<bool> m_autoCheckStateBasedOnCurveData;
std::vector<std::unique_ptr<RiuWellPathComponentPlotItem>> m_wellPathAttributePlotObjects;
bool m_formationsForCaseWithSimWellOnly;

View File

@ -47,6 +47,17 @@ RigWellLogCurveData::~RigWellLogCurveData()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::clear()
{
m_propertyValues.clear();
m_depths.clear();
m_intervalsOfContinousValidValues.clear();
m_propertyValueUnitString.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -41,6 +41,8 @@ public:
RigWellLogCurveData();
~RigWellLogCurveData() override;
void clear();
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
void setValuesAndDepths( const std::vector<double>& propertyValues,