Adjustments for release

* Add notification of parent object when multiple objects are updated

* Make sure unchecked curves are removed from track

* Use object names instead of "Sub Items" when possible

* Set default simulation well visualization to top of reservoir

* Show plot window after plot is created

* Allow setting plot rendering flags

* Add more plots for update when clicking in 3D view

* Seismic Difference: Fix typo for poly line data extraction

* Version RC_5
This commit is contained in:
Magne Sjaastad 2023-06-16 09:27:35 +02:00 committed by GitHub
parent 36811e7f94
commit 06b5c9afbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 184 additions and 32 deletions

View File

@ -26,6 +26,8 @@
#include "RimWellAllocationPlot.h"
#include "RimWellDistributionPlotCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
@ -77,9 +79,15 @@ void RicShowCumulativePhasePlotFeature::onActionTriggered( bool isChecked )
RimWellDistributionPlotCollection* wdp = flowPlotColl->wellDistributionPlotCollection();
if ( wdp && eclipseResultCase )
{
RiuPlotMainWindowTools::showPlotMainWindow();
wdp->setData( eclipseResultCase, wellName, timeStep );
wdp->setShowWindow( true );
wdp->loadDataAndUpdate();
wdp->updateConnectedEditors();
RiuPlotMainWindowTools::onObjectAppended( wdp );
}
}

View File

@ -50,8 +50,8 @@ void RicToggleItemsFeature::setupActionLook( QAction* actionToSetup )
{
if ( RicToggleItemsFeatureImpl::isToggleCommandsForSubItems() )
{
QString objectName = "Sub Items";
auto collectionName = RicToggleItemsFeatureImpl::findCollectionName( RicToggleItemsFeatureImpl::SelectionToggleType::TOGGLE );
QString objectName = "Sub Items";
auto collectionName = RicToggleItemsFeatureImpl::findCollectionName( RicToggleItemsFeatureImpl::SelectionToggleType::TOGGLE_SUBITEMS );
if ( !collectionName.isEmpty() ) objectName = collectionName;
actionToSetup->setText( "Toggle " + objectName );

View File

@ -148,6 +148,18 @@ void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection( SelectionToggl
field->setValue( value );
}
}
// If multiple fields are updated, we call onChildrenUpdated() on the owner of the first field
// Example: Trigger replot of curves when multiple curves are toggled
if ( fieldsToUpdate.size() > 1 )
{
auto [ownerOfChildArrayField, childArrayFieldHandle] = RicToggleItemsFeatureImpl::findOwnerAndChildArrayField( fieldsToUpdate.front() );
if ( ownerOfChildArrayField && childArrayFieldHandle )
{
std::vector<caf::PdmObjectHandle*> objs;
ownerOfChildArrayField->onChildrenUpdated( childArrayFieldHandle, objs );
}
}
}
//--------------------------------------------------------------------------------------------------
@ -178,7 +190,7 @@ QString RicToggleItemsFeatureImpl::findCollectionName( SelectionToggleType state
auto arrayField = dynamic_cast<caf::PdmChildArrayFieldHandle*>( childObj->parentField() );
if ( arrayField && arrayField->ownerObject() )
{
return arrayField->ownerObject()->uiCapability()->uiName();
return arrayField->uiCapability()->uiName();
}
}
}
@ -310,3 +322,43 @@ std::vector<caf::PdmField<bool>*> RicToggleItemsFeatureImpl::findToggleFieldsFro
return fields;
}
//--------------------------------------------------------------------------------------------------
/// Based on code in CmdUiCommandSystemImpl::fieldChangedCommand()
/// Could be merged and put into a tool class
//--------------------------------------------------------------------------------------------------
std::pair<caf::PdmObjectHandle*, caf::PdmChildArrayFieldHandle*>
RicToggleItemsFeatureImpl::findOwnerAndChildArrayField( caf::PdmFieldHandle* fieldHandle )
{
if ( !fieldHandle ) return {};
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = nullptr;
caf::PdmObjectHandle* ownerOfChildArrayField = nullptr;
// Find the first childArrayField by traversing parent field and objects. Usually, the childArrayField is
// the parent, but in some cases when we change fields in a sub-object of the object we need to traverse
// more levels
ownerOfChildArrayField = fieldHandle->ownerObject();
while ( ownerOfChildArrayField )
{
if ( ownerOfChildArrayField->parentField() )
{
childArrayFieldHandle = dynamic_cast<caf::PdmChildArrayFieldHandle*>( ownerOfChildArrayField->parentField() );
ownerOfChildArrayField = ownerOfChildArrayField->parentField()->ownerObject();
if ( childArrayFieldHandle && ownerOfChildArrayField ) break;
}
else
{
ownerOfChildArrayField = nullptr;
}
}
if ( ownerOfChildArrayField && childArrayFieldHandle )
{
return { ownerOfChildArrayField, childArrayFieldHandle };
}
return {};
}

View File

@ -28,6 +28,7 @@ namespace caf
class PdmUiItem;
class PdmUiTreeOrdering;
class PdmUiTreeView;
class PdmChildArrayFieldHandle;
}; // namespace caf
//==================================================================================================
@ -55,4 +56,6 @@ private:
static caf::PdmUiTreeView* findTreeView( const caf::PdmUiItem* uiItem );
static caf::PdmUiTreeOrdering* findTreeItemFromSelectedUiItem( const caf::PdmUiItem* uiItem );
static std::vector<caf::PdmField<bool>*> findToggleFieldsFromSelection( SelectionToggleType state );
static std::pair<caf::PdmObjectHandle*, caf::PdmChildArrayFieldHandle*> findOwnerAndChildArrayField( caf::PdmFieldHandle* fieldHandle );
};

View File

@ -220,7 +220,7 @@ bool RicWellPathPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& event
RiuMainWindow::instance()->setResultInfo( wellPathText );
RiuPlotMainWindow::onWellSelected( wellPathSourceInfo->wellPath()->name() );
RiuPlotMainWindow::onWellSelected( wellPathSourceInfo->wellPath()->name(), rimView->currentTimeStep() );
if ( objectToSelect )
{

View File

@ -170,6 +170,15 @@ void RimWellAllocationOverTimePlot::setFromSimulationWell( RimSimWellInView* sim
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationOverTimePlot::setWellName( const QString& wellName )
{
m_wellName = wellName;
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -68,6 +68,7 @@ public:
void setDescription( const QString& description );
void setFromSimulationWell( RimSimWellInView* simWell );
void setWellName( const QString& wellName );
// RimPlot implementations
RiuPlotWidget* plotWidget() override;

View File

@ -185,6 +185,26 @@ void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell )
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::setWellName( const QString& wellName )
{
m_wellName = wellName;
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::setTimeStep( int timeStep )
{
if ( timeStep < 0 ) return;
m_timeStep = timeStep;
onLoadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -68,6 +68,8 @@ public:
int id() const final;
void setFromSimulationWell( RimSimWellInView* simWell );
void setWellName( const QString& wellName );
void setTimeStep( int timeStep );
void setDescription( const QString& description );
QString description() const;

View File

@ -150,13 +150,7 @@ void RimWellDistributionPlot::updateLegend()
return;
}
// Hide the legend when in multiplot mode, as the legend is handeled by the multi plot grid layout
bool doShowLegend = false;
if ( isMdiWindow() )
{
doShowLegend = m_showPlotLegends;
}
bool doShowLegend = true;
if ( doShowLegend )
{
QwtLegend* legend = new QwtLegend( m_plotWidget );
@ -315,14 +309,7 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
// cvf::Trace::show("RimWellDistributionPlot::onLoadDataAndUpdate()");
// cvf::DebugTimer tim("RimWellDistributionPlot::onLoadDataAndUpdate()");
if ( isMdiWindow() )
{
updateMdiWindowVisibility();
}
else
{
updateParentLayout();
}
updateParentLayout();
if ( !m_plotWidget )
{
@ -363,6 +350,7 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
const QString timeStepName = m_case ? m_case->timeStepName( m_timeStepIndex ) : "N/A";
const QString plotTitleStr = QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
m_plotWidget->setPlotTitleRenderingFlags( Qt::AlignHCenter | Qt::TextWordWrap );
m_plotWidget->setPlotTitle( plotTitleStr );
m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "TOF [years]" );

View File

@ -110,6 +110,30 @@ void RimWellDistributionPlotCollection::setData( RimEclipseResultCase* eclipseCa
applyPlotParametersToContainedPlots();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellDistributionPlotCollection::setWellName( const QString& wellName )
{
m_wellName = wellName;
applyPlotParametersToContainedPlots();
loadDataAndUpdate();
if ( m_viewer ) m_viewer->scheduleUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellDistributionPlotCollection::setTimeStep( int timeStep )
{
if ( timeStep < 0 ) return;
m_timeStepIndex = timeStep;
applyPlotParametersToContainedPlots();
loadDataAndUpdate();
if ( m_viewer ) m_viewer->scheduleUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -308,6 +332,11 @@ void RimWellDistributionPlotCollection::fieldChangedByUi( const caf::PdmFieldHan
{
applyPlotParametersToContainedPlots();
shouldRecalculatePlotData = true;
if ( changedField == &m_showOil || changedField == &m_showGas || changedField == &m_showWater || changedField == &m_showWindow )
{
if ( m_viewer ) m_viewer->scheduleUpdate();
}
}
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );

View File

@ -52,6 +52,8 @@ public:
~RimWellDistributionPlotCollection() override;
void setData( RimEclipseResultCase* eclipseCase, QString wellName, int timeStepIndex );
void setWellName( const QString& wellName );
void setTimeStep( int timeStep );
QWidget* viewWidget() override;
QString description() const override;

View File

@ -154,7 +154,7 @@ RimDepthTrackPlot::RimDepthTrackPlot()
CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set" );
CAF_PDM_InitFieldNoDefault( &m_depthEqualization, "DepthEqualization", "Depth Equalization" );
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "" );
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "Tracks" );
m_plots.uiCapability()->setUiTreeHidden( true );
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered );

View File

@ -48,6 +48,9 @@
#include "RimSummaryTableCollection.h"
#include "RimVfpPlotCollection.h"
#include "RimViewWindow.h"
#include "RimWellAllocationOverTimePlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellDistributionPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPltPlot.h"
@ -399,7 +402,7 @@ void RimMainPlotCollection::loadDataAndUpdateAllPlots()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMainPlotCollection::updateSelectedWell( QString wellName )
void RimMainPlotCollection::updateSelectedWell( const QString& wellName, int timeStep )
{
for ( auto plot : summaryMultiPlotCollection()->multiPlots() )
{
@ -410,6 +413,23 @@ void RimMainPlotCollection::updateSelectedWell( QString wellName )
{
plot->selectWell( wellName );
}
if ( auto plot = flowPlotCollection()->defaultWellAllocOverTimePlot() )
{
plot->setWellName( wellName );
}
if ( auto plot = flowPlotCollection()->defaultWellAllocPlot() )
{
plot->setWellName( wellName );
plot->setTimeStep( timeStep );
}
if ( auto plot = flowPlotCollection()->wellDistributionPlotCollection() )
{
plot->setWellName( wellName );
plot->setTimeStep( timeStep );
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -91,7 +91,7 @@ public:
void deleteAllCachedData();
void ensureDefaultFlowPlotsAreCreated();
void loadDataAndUpdateAllPlots();
void updateSelectedWell( QString wellName );
void updateSelectedWell( const QString& wellName, int timeStep );
protected:
void initAfterRead() override;

View File

@ -203,7 +203,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection()
"Toggle whether the well pipe visualization will try to detect when a part of the well \nis "
"really a branch, and thus is starting from wellhead",
"" );
CAF_PDM_InitField( &wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum( WELLHEAD_POS_TOP_COLUMN ), "Well Head Position" );
CAF_PDM_InitField( &wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum( WELLHEAD_POS_ACTIVE_CELLS_BB ), "Well Head Position" );
CAF_PDM_InitFieldNoDefault( &wells, "Wells", "Wells" );
wells.uiCapability()->setUiTreeHidden( true );

View File

@ -462,7 +462,7 @@ std::shared_ptr<ZGYAccess::SeismicSliceData>
if ( !isInputDataOK() ) return nullptr;
auto data1 = m_seismicData1->sliceData( worldX1, worldY1, worldX2, worldY2, zMin, zMax );
auto data2 = m_seismicData1->sliceData( worldX1, worldY1, worldX2, worldY2, zMin, zMax );
auto data2 = m_seismicData2->sliceData( worldX1, worldY1, worldX2, worldY2, zMin, zMax );
if ( ( data1 == nullptr ) || ( data2 == nullptr ) ) return nullptr;

View File

@ -51,7 +51,7 @@ RimSummaryCurveCollection::RimSummaryCurveCollection()
{
CAF_PDM_InitObject( "Summary Curves", ":/SummaryCurveFilter16x16.png" );
CAF_PDM_InitFieldNoDefault( &m_curves, "CollectionCurves", "Collection Curves" );
CAF_PDM_InitFieldNoDefault( &m_curves, "CollectionCurves", "Curves" );
m_curves.uiCapability()->setUiTreeHidden( true );
m_curves.uiCapability()->setUiTreeChildrenHidden( false );
caf::PdmFieldReorderCapability::addToFieldWithCallback( &m_curves, this, &RimSummaryCurveCollection::onCurvesReordered );

View File

@ -185,7 +185,7 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name" );
CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "" );
CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "Curves" );
m_curves.uiCapability()->setUiTreeHidden( true );
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_curves );
reorderability->orderChanged.connect( this, &RimWellLogTrack::curveDataChanged );
@ -1368,6 +1368,10 @@ void RimWellLogTrack::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArr
{
if ( childArray == &m_curves )
{
// If multiple curves are unchecked, we need to attach/reattach to make sure the unchecked curves are not visible
detachAllCurves();
reattachAllCurves();
loadDataAndUpdate();
}
}

View File

@ -156,14 +156,14 @@ RiuPlotMainWindow* RiuPlotMainWindow::instance()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::onWellSelected( QString wellName )
void RiuPlotMainWindow::onWellSelected( const QString& wellName, int timeStep )
{
RiuPlotMainWindow* plotWnd = instance();
if ( !plotWnd ) return;
if ( !plotWnd->selection3DLinkEnabled() ) return;
RimMainPlotCollection::current()->updateSelectedWell( wellName );
RimMainPlotCollection::current()->updateSelectedWell( wellName, timeStep );
}
//--------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ public:
~RiuPlotMainWindow() override;
static RiuPlotMainWindow* instance();
static void onWellSelected( QString wellName );
static void onWellSelected( const QString& wellName, int timeStep );
QString mainWindowName() override;

View File

@ -78,6 +78,7 @@
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent )
: RiuPlotWidget( plotDefinition, parent )
, m_titleRenderingFlags( Qt::AlignHCenter | Qt::TextSingleLine )
{
auto* layout = new QVBoxLayout;
layout->setContentsMargins( 0, 0, 0, 0 );
@ -248,9 +249,18 @@ void RiuQwtPlotWidget::setPlotTitleFontSize( int titleFontSize )
QFont font = title.font();
font.setPixelSize( caf::FontTools::pointSizeToPixelSize( titleFontSize ) );
title.setFont( font );
title.setRenderFlags( title.renderFlags() | Qt::TextWordWrap );
m_plot->setTitle( title );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::setPlotTitleRenderingFlags( int flags )
{
m_titleRenderingFlags = flags;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -668,7 +678,7 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt()
{
QString plotTitleToApply = m_plotTitleEnabled ? m_plotTitle : QString( "" );
QwtText plotTitle = m_plot->title();
plotTitle.setRenderFlags( Qt::AlignHCenter | Qt::TextSingleLine );
plotTitle.setRenderFlags( m_titleRenderingFlags );
if ( plotTitleToApply != plotTitle.text() )
{
plotTitle.setText( plotTitleToApply );

View File

@ -101,6 +101,7 @@ public:
void setPlotTitleEnabled( bool enabled ) override;
bool plotTitleEnabled() const override;
void setPlotTitleFontSize( int titleFontSize ) override;
void setPlotTitleRenderingFlags( int flags );
void setLegendFontSize( int fontSize ) override;
void setInternalLegendVisible( bool visible ) override;
@ -234,4 +235,6 @@ private:
std::map<RiuPlotAxis, QwtAxisId> m_axisMapping;
QPointer<QwtPlot> m_plot;
int m_titleRenderingFlags;
};

View File

@ -832,7 +832,8 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
{
bool allowActiveViewChange = dynamic_cast<Rim2dIntersectionView*>( m_viewer->ownerViewWindow() ) == nullptr;
RiuPlotMainWindow::onWellSelected( eclipseWellSourceInfo->well()->name() );
RiuPlotMainWindow::onWellSelected( eclipseWellSourceInfo->well()->name(), mainOrComparisonView->currentTimeStep() );
RiuMainWindow::instance()->selectAsCurrentItem( eclipseWellSourceInfo->well(), allowActiveViewChange );
}
else if ( wellConnectionSourceInfo )

View File

@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0)
# Opional text with no restrictions
#set(RESINSIGHT_VERSION_TEXT "-dev")
set(RESINSIGHT_VERSION_TEXT "-RC_04")
set(RESINSIGHT_VERSION_TEXT "-RC_05")
# Optional text
# Must be unique and increasing within one combination of major/minor/patch version