From 1d23e8f5c92fd41d0c8067f6a00cc7b48feac130 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 13 Oct 2022 13:03:55 +0200 Subject: [PATCH] Show packer in RFT topology track * Show packers in topology track * Support optional display of property axis values * Add legend item clickable option to RimPlotWindow --- .../RicNewMultiPhaseRftSegmentPlotFeature.cpp | 1 + .../RicNewRftSegmentWellLogPlotFeature.cpp | 11 +- .../FileInterface/RifRftSegment.cpp | 26 +++ .../FileInterface/RifRftSegment.h | 1 + .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 2 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 2 +- .../RimContextCommandBuilder.cpp | 3 +- .../ProjectDataModel/RimPlotWindow.cpp | 25 ++- .../ProjectDataModel/RimPlotWindow.h | 6 +- .../WellLog/RimRftTopologyCurve.cpp | 159 +++++++++++++----- .../WellLog/RimRftTopologyCurve.h | 17 +- .../WellLog/RimWellLogTrack.cpp | 114 ++++++++----- .../WellLog/RimWellLogTrack.h | 39 +++-- .../UserInterface/RiuMultiPlotPage.cpp | 20 ++- .../UserInterface/RiuQwtPlotLegend.cpp | 7 +- .../UserInterface/RiuWellLogPlot.cpp | 23 ++- .../UserInterface/RiuWellLogPlot.h | 2 +- 17 files changed, 331 insertions(+), 127 deletions(-) diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp index 2219993305..5e6fc2f635 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewMultiPhaseRftSegmentPlotFeature.cpp @@ -68,6 +68,7 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked ) RiaDefines::namingVariableWellBranch() + ", " + RiaDefines::namingVariableTime(); plot->setNameTemplateText( templateText ); plot->setPlotTitleVisible( true ); + plot->setLegendItemsClickable( false ); QString wellName = "Unknown"; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp index e49ebb7248..3c0945f582 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftSegmentWellLogPlotFeature.cpp @@ -67,6 +67,7 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked ) RiaDefines::namingVariableWellBranch() + ", " + RiaDefines::namingVariableTime(); plot->setNameTemplateText( templateText ); plot->setPlotTitleVisible( true ); + plot->setLegendItemsClickable( false ); QString wellName = "Unknown"; @@ -140,6 +141,7 @@ void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* pl auto track = new RimWellLogTrack(); track->setDescription( "Topology" ); + track->enablePropertyAxis( false ); plot->addPlot( track ); @@ -149,8 +151,13 @@ void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* pl for ( auto branchType : branchTypes ) { - auto curve = new RimRftTopologyCurve; - curve->setDataSource( summaryCase, dateTime, wellName, branchIndex, branchType ); + auto curve = RimRftTopologyCurve::createTopologyCurve( summaryCase, dateTime, wellName, branchIndex, branchType ); + curve->applyDefaultAppearance(); + track->addCurve( curve ); + } + + { + auto curve = RimRftTopologyCurve::createPackerCurve( summaryCase, dateTime, wellName, branchIndex ); curve->applyDefaultAppearance(); track->addCurve( curve ); } diff --git a/ApplicationLibCode/FileInterface/RifRftSegment.cpp b/ApplicationLibCode/FileInterface/RifRftSegment.cpp index 1c2c99458d..317a5ee995 100644 --- a/ApplicationLibCode/FileInterface/RifRftSegment.cpp +++ b/ApplicationLibCode/FileInterface/RifRftSegment.cpp @@ -313,6 +313,32 @@ std::vector RifRftSegment::segmentIndicesForBranchIndex( int branchIndex return v; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifRftSegment::packerSegmentIndicesOnAnnulus( int branchIndex ) const +{ + auto segmentIndices = segmentIndicesForBranchIndex( branchIndex, RiaDefines::RftBranchType::RFT_ANNULUS ); + + std::vector packerSegmentIndices; + + for ( auto segmentIndex : segmentIndices ) + { + auto segment = m_topology[segmentIndex]; + auto outflowSegmentNumber = segment.segNext(); + + auto candidateSegment = segmentData( outflowSegmentNumber ); + auto candidateBranchType = branchType( candidateSegment->segBrno() ); + + if ( candidateBranchType == RiaDefines::RftBranchType::RFT_DEVICE ) + { + packerSegmentIndices.push_back( segmentIndex ); + } + } + + return packerSegmentIndices; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifRftSegment.h b/ApplicationLibCode/FileInterface/RifRftSegment.h index 8e738f2779..3c8226188a 100644 --- a/ApplicationLibCode/FileInterface/RifRftSegment.h +++ b/ApplicationLibCode/FileInterface/RifRftSegment.h @@ -75,6 +75,7 @@ public: std::vector segmentIndicesForBranchNumber( int branchNumber ) const; std::vector segmentIndicesForBranchIndex( int branchIndex, RiaDefines::RftBranchType branchType ) const; + std::vector packerSegmentIndicesOnAnnulus( int branchIndex ) const; std::vector segmentNumbersForBranchIndex( int oneBasedBranchIndex, RiaDefines::RftBranchType branchType ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index d7c6fc3ffa..3c49b97d80 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -975,7 +975,7 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& if ( track ) { track->uiOrderingForRftPltFormations( uiOrdering ); - track->uiOrderingForXAxisSettings( uiOrdering ); + track->uiOrderingForPropertyAxisSettings( uiOrdering ); caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis Settings" ); uiOrderingForDepthAxis( uiConfigName, *depthGroup ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 08d2c8ee87..0f4108a110 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -974,7 +974,7 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& if ( track ) { track->uiOrderingForRftPltFormations( uiOrdering ); - track->uiOrderingForXAxisSettings( uiOrdering ); + track->uiOrderingForPropertyAxisSettings( uiOrdering ); caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis Settings" ); uiOrderingForDepthAxis( uiConfigName, *depthGroup ); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index b7c349ad88..ed8f64912f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1086,9 +1086,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() } else if ( dynamic_cast( firstUiItem ) ) { - menuBuilder << "RicNewRftWellLogPlotFeature"; menuBuilder << "RicNewRftSegmentWellLogPlotFeature"; menuBuilder << "RicNewMultiPhaseRftSegmentPlotFeature"; + menuBuilder.addSeparator(); + menuBuilder << "RicNewRftWellLogPlotFeature"; } if ( dynamic_cast( firstUiItem ) ) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index 15bb532566..ccb8f8610f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -41,7 +41,8 @@ template <> void caf::AppEnum::setUp() { addItem( RimPlotWindow::LegendPosition::ABOVE, "ABOVE", "Above" ); - addItem( RimPlotWindow::LegendPosition::INSIDE, "INSIDE", "Inside" ); + addItem( RimPlotWindow::LegendPosition::INSIDE_UPPER_RIGHT, "INSIDE_UPPER_RIGHT", "Inside Right", { "INSIDE" } ); + addItem( RimPlotWindow::LegendPosition::INSIDE_UPPER_LEFT, "INSIDE_UPPER_LEFT", "Inside Left" ); setDefault( RimPlotWindow::LegendPosition::ABOVE ); } }; // namespace caf @@ -68,6 +69,7 @@ RimPlotWindow::RimPlotWindow() CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title" ); CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends" ); CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation" ); + CAF_PDM_InitField( &m_legendItemsClickable, "LegendItemsClickable", true, "Legend Items Clickable" ); m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleFontSize", "Title Font Size" ); @@ -101,6 +103,7 @@ RimPlotWindow& RimPlotWindow::operator=( RimPlotWindow&& rhs ) m_showPlotTitle = rhs.m_showPlotTitle(); m_showPlotLegends = rhs.m_showPlotLegends(); m_plotLegendsHorizontal = rhs.m_plotLegendsHorizontal(); + m_legendItemsClickable = rhs.m_legendItemsClickable(); m_titleFontSize = rhs.m_titleFontSize(); m_legendFontSize = rhs.m_legendFontSize(); m_legendPosition = rhs.m_legendPosition(); @@ -155,6 +158,22 @@ void RimPlotWindow::setLegendsHorizontal( bool horizontal ) m_plotLegendsHorizontal = horizontal; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotWindow::legendItemsClickable() const +{ + return m_legendItemsClickable(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotWindow::setLegendItemsClickable( bool clickable ) +{ + m_legendItemsClickable = clickable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -282,7 +301,8 @@ void RimPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } if ( changedField == &m_showPlotLegends || changedField == &m_plotLegendsHorizontal || - changedField == &m_legendFontSize || changedField == &m_titleFontSize || changedField == &m_legendPosition ) + changedField == &m_legendFontSize || changedField == &m_titleFontSize || changedField == &m_legendPosition || + changedField == &m_legendItemsClickable ) { updateLayout(); } @@ -316,6 +336,7 @@ void RimPlotWindow::uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrd { uiOrdering.add( &m_showPlotLegends ); uiOrdering.add( &m_plotLegendsHorizontal ); + uiOrdering.add( &m_legendItemsClickable ); if ( showLegendPosition ) { uiOrdering.add( &m_legendPosition ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h index 5cf02e815e..90eaef4b95 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h @@ -47,7 +47,8 @@ public: enum class LegendPosition { ABOVE, - INSIDE, + INSIDE_UPPER_RIGHT, + INSIDE_UPPER_LEFT, }; RimPlotWindow(); @@ -65,6 +66,8 @@ public: void setLegendsVisible( bool doShow ); bool legendsHorizontal() const; void setLegendsHorizontal( bool horizontal ); + bool legendItemsClickable() const; + void setLegendItemsClickable( bool clickable ); void setLegendPosition( RimPlotWindow::LegendPosition legendPosition ); RimPlotWindow::LegendPosition legendPosition() const; @@ -112,6 +115,7 @@ protected: caf::PdmField m_showPlotTitle; caf::PdmField m_showPlotLegends; caf::PdmField m_plotLegendsHorizontal; + caf::PdmField m_legendItemsClickable; caf::PdmField> m_legendPosition; caf::PdmField m_titleFontSize; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp index ad274946c4..87fb04ec39 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.cpp @@ -19,6 +19,7 @@ #include "RimRftTopologyCurve.h" #include "RiaColorTables.h" +#include "RiaColorTools.h" #include "RiaSummaryTools.h" #include "RifReaderOpmRft.h" @@ -50,20 +51,39 @@ RimRftTopologyCurve::RimRftTopologyCurve() CAF_PDM_InitField( &m_segmentBranchIndex, "SegmentBranchIndex", -1, "Branch" ); CAF_PDM_InitFieldNoDefault( &m_segmentBranchType, "SegmentBranchType", "Completion" ); + + CAF_PDM_InitField( &m_isPackerCurve, "IsPackerCurve", false, "Packer Curve" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimRftTopologyCurve::setDataSource( RimSummaryCase* summaryCase, - const QDateTime& timeStep, - const QString& wellName, - int segmentBranchIndex, - RiaDefines::RftBranchType branchType ) +RimRftTopologyCurve* RimRftTopologyCurve::createPackerCurve( RimSummaryCase* summaryCase, + const QDateTime& timeStep, + const QString& wellName, + int segmentBranchIndex ) { - setDataSource( summaryCase, timeStep, wellName, segmentBranchIndex ); + RimRftTopologyCurve* curve = new RimRftTopologyCurve(); + curve->setDataSource( summaryCase, timeStep, wellName, segmentBranchIndex ); + curve->m_isPackerCurve = true; - m_segmentBranchType = branchType; + return curve; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimRftTopologyCurve* RimRftTopologyCurve::createTopologyCurve( RimSummaryCase* summaryCase, + const QDateTime& timeStep, + const QString& wellName, + int segmentBranchIndex, + RiaDefines::RftBranchType branchType ) +{ + RimRftTopologyCurve* curve = new RimRftTopologyCurve(); + curve->setDataSource( summaryCase, timeStep, wellName, segmentBranchIndex ); + curve->m_segmentBranchType = branchType; + + return curve; } //-------------------------------------------------------------------------------------------------- @@ -85,7 +105,7 @@ void RimRftTopologyCurve::setDataSource( RimSummaryCase* summaryCase, //-------------------------------------------------------------------------------------------------- QString RimRftTopologyCurve::wellName() const { - return "Topology curve"; + return m_wellName; } //-------------------------------------------------------------------------------------------------- @@ -111,9 +131,16 @@ QString RimRftTopologyCurve::createCurveAutoName() { QString text; - if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) text += "Annulus"; - if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) text += "Device"; - if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) text += "Tubing"; + if ( m_isPackerCurve() ) + { + text += "Packer"; + } + else + { + if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) text += "Annulus"; + if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) text += "Device"; + if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) text += "Tubing"; + } text += QString( " (%1)" ).arg( m_segmentBranchIndex() ); @@ -131,8 +158,13 @@ void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde curveDataGroup->add( &m_summaryCase ); curveDataGroup->add( &m_wellName ); curveDataGroup->add( &m_timeStep ); + curveDataGroup->add( &m_isPackerCurve ); + curveDataGroup->add( &m_segmentBranchIndex ); - curveDataGroup->add( &m_segmentBranchType ); + if ( !m_isPackerCurve() ) + { + curveDataGroup->add( &m_segmentBranchType ); + } caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" ); RimStackablePlotCurve::stackingUiOrdering( *stackingGroup ); @@ -225,23 +257,44 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot ) std::vector depths; std::vector propertyValues; - // Assign a static property value to each type of curve to make sure they all are separated and easily - // visible + // Assign a static property value to each type of curve to make sure they all are separated and + // easily visible double curveValue = 1.0; if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) curveValue = 2.0; if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) curveValue = 3.0; if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) curveValue = 4.0; + if ( m_isPackerCurve ) + { + curveValue = 3.5; + } + // Adjust the location of each branch if multiple branches are visible at the same time curveValue += m_segmentBranchIndex() * 0.2; - for ( auto segmentIndex : segmentIndices ) + if ( m_isPackerCurve ) { - depths.push_back( seglenstValues[segmentIndex] ); - depths.push_back( seglenenValues[segmentIndex] ); + auto packerSegmentIndices = segment.packerSegmentIndicesOnAnnulus( m_segmentBranchIndex() ); - propertyValues.push_back( curveValue ); - propertyValues.push_back( curveValue ); + for ( auto segmentIndex : packerSegmentIndices ) + { + depths.push_back( seglenstValues[segmentIndex] ); + depths.push_back( seglenenValues[segmentIndex] ); + + propertyValues.push_back( curveValue ); + propertyValues.push_back( curveValue ); + } + } + else + { + for ( auto segmentIndex : segmentIndices ) + { + depths.push_back( seglenstValues[segmentIndex] ); + depths.push_back( seglenenValues[segmentIndex] ); + + propertyValues.push_back( curveValue ); + propertyValues.push_back( curveValue ); + } } RimDepthTrackPlot* wellLogPlot; @@ -255,16 +308,16 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot ) // Assign curve values based on horizontal or vertical plot setPropertyAndDepthValuesToPlotCurve( propertyValues, depths ); + } - if ( updateParentPlot ) - { - updateZoomInParentPlot(); - } + if ( updateParentPlot ) + { + updateZoomInParentPlot(); + } - if ( m_parentPlot ) - { - m_parentPlot->replot(); - } + if ( m_parentPlot ) + { + m_parentPlot->replot(); } } } @@ -275,23 +328,41 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot ) //-------------------------------------------------------------------------------------------------- void RimRftTopologyCurve::applyDefaultAppearance() { - cvf::Color3f color = cvf::Color3f::BLUE; - if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) + if ( m_isPackerCurve() ) { - color = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f( 0 ); - } - else if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) - { - color = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f( 1 ); - setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - } - else if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) - { - color = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f( 2 ); - setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - } + auto color = RiaColorTools::fromQColorTo3f( QColor( "DarkGoldenRod" ) ); + int adjustedSymbolSize = symbolSize() * 2; - setColor( color ); - setLineThickness( 5.0 ); - setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_ELLIPSE ); + setColor( color ); + setSymbolSize( adjustedSymbolSize ); + setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); + setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_RECT ); + } + else + { + if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) + { + auto color = RiaColorTools::fromQColorTo3f( QColor( "ForestGreen" ) ); + setColor( color ); + setLineThickness( 5.0 ); + } + else if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) + { + auto color = RiaColorTools::fromQColorTo3f( QColor( "IndianRed" ) ); + setColor( color ); + setSymbolEdgeColor( color ); + setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); + } + else if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) + { + auto color = RiaColorTools::fromQColorTo3f( QColor( "DeepSkyBlue" ) ); + setColor( color ); + setSymbolEdgeColor( color ); + setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); + } + + int adjustedSymbolSize = symbolSize() * 1.5; + setSymbolSize( adjustedSymbolSize ); + setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_ELLIPSE ); + } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h index 8b3c42f8f9..b0b0c7072f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTopologyCurve.h @@ -38,11 +38,16 @@ class RimRftTopologyCurve : public RimWellLogCurve public: RimRftTopologyCurve(); - void setDataSource( RimSummaryCase* summaryCase, - const QDateTime& timeStep, - const QString& wellName, - int segmentBranchIndex, - RiaDefines::RftBranchType branchType ); + static RimRftTopologyCurve* createPackerCurve( RimSummaryCase* summaryCase, + const QDateTime& timeStep, + const QString& wellName, + int segmentBranchIndex ); + + static RimRftTopologyCurve* createTopologyCurve( RimSummaryCase* summaryCase, + const QDateTime& timeStep, + const QString& wellName, + int segmentBranchIndex, + RiaDefines::RftBranchType branchType ); void setDataSource( RimSummaryCase* summaryCase, const QDateTime& timeStep, const QString& wellName, int segmentBranchIndex ); @@ -67,4 +72,6 @@ private: caf::PdmField m_wellName; caf::PdmField m_segmentBranchIndex; caf::PdmField> m_segmentBranchType; + + caf::PdmField m_isPackerCurve; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 8b07a080d6..e0e7e11f77 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -206,17 +206,18 @@ RimWellLogTrack::RimWellLogTrack() CAF_PDM_InitField( &m_isAutoScalePropertyValuesEnabled, "AutoScaleX", true, "Auto Scale" ); m_isAutoScalePropertyValuesEnabled.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScaleX", false, "Logarithmic Scale" ); + CAF_PDM_InitField( &m_isPropertyLogarithmicScaleEnabled, "LogarithmicScaleX", false, "Logarithmic Scale" ); CAF_PDM_InitField( &m_invertPropertyValueAxis, "InvertPropertyValueAxis", false, "Invert Axis Range" ); + CAF_PDM_InitField( &m_isPropertyAxisEnabled, "IsPropertyAxisEnabled", true, "Show Axis" ); CAF_PDM_InitFieldNoDefault( &m_propertyValueAxisGridVisibility, "ShowXGridLines", "Show Grid Lines" ); - CAF_PDM_InitField( &m_explicitTickIntervals, "ExplicitTickIntervals", false, "Manually Set Tick Intervals" ); - CAF_PDM_InitField( &m_minAndMaxTicksOnly, "MinAndMaxTicksOnly", false, "Show Ticks at Min and Max" ); - CAF_PDM_InitField( &m_majorTickInterval, "MajorTickIntervals", 0.0, "Major Tick Interval" ); - CAF_PDM_InitField( &m_minorTickInterval, "MinorTickIntervals", 0.0, "Minor Tick Interval" ); - m_majorTickInterval.uiCapability()->setUiHidden( true ); - m_minorTickInterval.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_explicitTickIntervalsPropertyValueAxis, "ExplicitTickIntervals", false, "Manually Set Tick Intervals" ); + CAF_PDM_InitField( &m_propertyAxisMinAndMaxTicksOnly, "MinAndMaxTicksOnly", false, "Show Ticks at Min and Max" ); + CAF_PDM_InitField( &m_majorTickIntervalPropertyAxis, "MajorTickIntervals", 0.0, "Major Tick Interval" ); + CAF_PDM_InitField( &m_minorTickIntervalPropertyAxis, "MinorTickIntervals", 0.0, "Minor Tick Interval" ); + m_majorTickIntervalPropertyAxis.uiCapability()->setUiHidden( true ); + m_minorTickIntervalPropertyAxis.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_axisFontSize, "AxisFontSize", "Axis Font Size" ); @@ -402,9 +403,9 @@ void RimWellLogTrack::calculatePropertyValueZoomRange() minValue = 0; maxValue = 0; } - else if ( m_minorTickInterval() != 0.0 ) + else if ( m_minorTickIntervalPropertyAxis() != 0.0 ) { - std::tie( minValue, maxValue ) = adjustXRange( minValue, maxValue, m_minorTickInterval() ); + std::tie( minValue, maxValue ) = adjustXRange( minValue, maxValue, m_minorTickIntervalPropertyAxis() ); } else { @@ -488,7 +489,7 @@ void RimWellLogTrack::updatePropertyValueZoom() m_visiblePropertyValueRangeMin = m_availablePropertyValueRangeMin; m_visiblePropertyValueRangeMax = m_availablePropertyValueRangeMax; - if ( !visibleStackedCurves().empty() && !m_isLogarithmicScaleEnabled ) + if ( !visibleStackedCurves().empty() && !m_isPropertyLogarithmicScaleEnabled ) { // Try to ensure we include the base line whether the values are negative or positive. m_visiblePropertyValueRangeMin = std::min( m_visiblePropertyValueRangeMin(), 0.0 ); @@ -583,22 +584,27 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { updateParentLayout(); } - else if ( changedField == &m_explicitTickIntervals ) + else if ( changedField == &m_explicitTickIntervalsPropertyValueAxis ) { if ( m_plotWidget ) { - m_majorTickInterval = m_plotWidget->majorTickInterval( valueAxis() ); - m_minorTickInterval = m_plotWidget->minorTickInterval( valueAxis() ); + m_majorTickIntervalPropertyAxis = m_plotWidget->majorTickInterval( valueAxis() ); + m_minorTickIntervalPropertyAxis = m_plotWidget->minorTickInterval( valueAxis() ); } - m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); - m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); - if ( !m_explicitTickIntervals() ) + m_majorTickIntervalPropertyAxis.uiCapability()->setUiHidden( !m_explicitTickIntervalsPropertyValueAxis() ); + m_minorTickIntervalPropertyAxis.uiCapability()->setUiHidden( !m_explicitTickIntervalsPropertyValueAxis() ); + if ( !m_explicitTickIntervalsPropertyValueAxis() ) { updatePropertyValueAxisAndGridTickIntervals(); } } - else if ( changedField == &m_propertyValueAxisGridVisibility || changedField == &m_majorTickInterval || - changedField == &m_minorTickInterval || changedField == &m_minAndMaxTicksOnly || + else if ( changedField == &m_isPropertyAxisEnabled ) + { + updatePropertyValueAxisAndGridTickIntervals(); + updateParentLayout(); + } + else if ( changedField == &m_propertyValueAxisGridVisibility || changedField == &m_majorTickIntervalPropertyAxis || + changedField == &m_minorTickIntervalPropertyAxis || changedField == &m_propertyAxisMinAndMaxTicksOnly || changedField == &m_invertPropertyValueAxis ) { updatePropertyValueAxisAndGridTickIntervals(); @@ -606,7 +612,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, else if ( changedField == &m_visiblePropertyValueRangeMin || changedField == &m_visiblePropertyValueRangeMax ) { bool emptyRange = isEmptyVisiblePropertyRange(); - m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange ); + m_explicitTickIntervalsPropertyValueAxis.uiCapability()->setUiReadOnly( emptyRange ); m_propertyValueAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); m_isAutoScalePropertyValuesEnabled = false; @@ -624,14 +630,14 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, m_plotWidget->scheduleReplot(); } } - else if ( changedField == &m_isLogarithmicScaleEnabled ) + else if ( changedField == &m_isPropertyLogarithmicScaleEnabled ) { updateAxisScaleEngine(); - if ( m_isLogarithmicScaleEnabled() ) + if ( m_isPropertyLogarithmicScaleEnabled() ) { - m_explicitTickIntervals = false; + m_explicitTickIntervalsPropertyValueAxis = false; } - m_explicitTickIntervals.uiCapability()->setUiHidden( m_isLogarithmicScaleEnabled() ); + m_explicitTickIntervalsPropertyValueAxis.uiCapability()->setUiHidden( m_isPropertyLogarithmicScaleEnabled() ); updatePropertyValueZoom(); loadDataAndUpdate(); @@ -822,7 +828,7 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() auto rangeBoundaryB = m_visiblePropertyValueRangeMax(); if ( m_invertPropertyValueAxis() ) std::swap( rangeBoundaryA, rangeBoundaryB ); - if ( m_minAndMaxTicksOnly ) + if ( m_propertyAxisMinAndMaxTicksOnly ) { auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) { if ( value == 0.0 ) return 0.0; @@ -867,11 +873,11 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtAxis::YLeft, div ); } } - else if ( m_explicitTickIntervals ) + else if ( m_explicitTickIntervalsPropertyValueAxis ) { m_plotWidget->setMajorAndMinorTickIntervals( valueAxis(), - m_majorTickInterval(), - m_minorTickInterval(), + m_majorTickIntervalPropertyAxis(), + m_minorTickIntervalPropertyAxis(), rangeBoundaryA, rangeBoundaryB ); } @@ -896,6 +902,9 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR, wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR ); } + + m_plotWidget->enableAxisNumberLabels( valueAxis(), m_isPropertyAxisEnabled() ); + m_plotWidget->scheduleReplot(); } @@ -1375,11 +1384,11 @@ void RimWellLogTrack::onLoadDataAndUpdate() } this->updatePropertyValueAxisAndGridTickIntervals(); - m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); - m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); + m_majorTickIntervalPropertyAxis.uiCapability()->setUiHidden( !m_explicitTickIntervalsPropertyValueAxis() ); + m_minorTickIntervalPropertyAxis.uiCapability()->setUiHidden( !m_explicitTickIntervalsPropertyValueAxis() ); bool emptyRange = isEmptyVisiblePropertyRange(); - m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange ); + m_explicitTickIntervalsPropertyValueAxis.uiCapability()->setUiReadOnly( emptyRange ); m_propertyValueAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); updateDepthZoom(); @@ -1742,9 +1751,9 @@ void RimWellLogTrack::updateZoomInParentPlot() //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::setTickIntervals( double majorTickInterval, double minorTickInterval ) { - m_explicitTickIntervals = true; - m_majorTickInterval = majorTickInterval; - m_minorTickInterval = minorTickInterval; + m_explicitTickIntervalsPropertyValueAxis = true; + m_majorTickIntervalPropertyAxis = majorTickInterval; + m_minorTickIntervalPropertyAxis = minorTickInterval; } //-------------------------------------------------------------------------------------------------- @@ -1752,7 +1761,7 @@ void RimWellLogTrack::setTickIntervals( double majorTickInterval, double minorTi //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::setMinAndMaxTicksOnly( bool enable ) { - m_minAndMaxTicksOnly = enable; + m_propertyAxisMinAndMaxTicksOnly = enable; } //-------------------------------------------------------------------------------------------------- @@ -2043,7 +2052,7 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering uiOrdering.add( &m_ensembleWellLogCurveSet ); - uiOrderingForXAxisSettings( uiOrdering ); + uiOrderingForPropertyAxisSettings( uiOrdering ); uiOrdering.skipRemainingFields( true ); } @@ -2119,7 +2128,7 @@ void RimWellLogTrack::updateAxisScaleEngine() { m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true ); - if ( m_isLogarithmicScaleEnabled ) + if ( m_isPropertyLogarithmicScaleEnabled ) { m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XTop, new QwtLogScaleEngine ); @@ -2138,7 +2147,7 @@ void RimWellLogTrack::updateAxisScaleEngine() { m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), false ); - if ( m_isLogarithmicScaleEnabled ) + if ( m_isPropertyLogarithmicScaleEnabled ) { m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new QwtLogScaleEngine ); @@ -2332,7 +2341,7 @@ void RimWellLogTrack::connectCurveSignals( RimWellLogCurve* curve ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::computeAndSetPropertyValueRangeMinForLogarithmicScale() { - if ( m_isAutoScalePropertyValuesEnabled && m_isLogarithmicScaleEnabled ) + if ( m_isAutoScalePropertyValuesEnabled && m_isPropertyLogarithmicScaleEnabled ) { double pos = HUGE_VAL; double neg = -HUGE_VAL; @@ -2359,7 +2368,7 @@ void RimWellLogTrack::computeAndSetPropertyValueRangeMinForLogarithmicScale() //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::setLogarithmicScale( bool enable ) { - m_isLogarithmicScaleEnabled = enable; + m_isPropertyLogarithmicScaleEnabled = enable; updateAxisScaleEngine(); computeAndSetPropertyValueRangeMinForLogarithmicScale(); @@ -2370,7 +2379,7 @@ void RimWellLogTrack::setLogarithmicScale( bool enable ) //-------------------------------------------------------------------------------------------------- bool RimWellLogTrack::isLogarithmicScale() const { - return m_isLogarithmicScaleEnabled; + return m_isPropertyLogarithmicScaleEnabled; } //-------------------------------------------------------------------------------------------------- @@ -2451,15 +2460,16 @@ void RimWellLogTrack::uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrder //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering ) +void RimWellLogTrack::uiOrderingForPropertyAxisSettings( caf::PdmUiOrdering& uiOrdering ) { caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Property Axis Settings" ); - gridGroup->add( &m_isLogarithmicScaleEnabled ); + gridGroup->add( &m_isPropertyAxisEnabled ); + gridGroup->add( &m_isPropertyLogarithmicScaleEnabled ); gridGroup->add( &m_visiblePropertyValueRangeMin ); gridGroup->add( &m_visiblePropertyValueRangeMax ); gridGroup->add( &m_invertPropertyValueAxis ); gridGroup->add( &m_propertyValueAxisGridVisibility ); - gridGroup->add( &m_minAndMaxTicksOnly ); + gridGroup->add( &m_propertyAxisMinAndMaxTicksOnly ); // TODO Revisit if these settings are required // See issue https://github.com/OPM/ResInsight/issues/4367 @@ -2468,6 +2478,22 @@ void RimWellLogTrack::uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering // gridGroup->add( &m_minorTickInterval ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::enablePropertyAxis( bool enable ) +{ + m_isPropertyAxisEnabled = enable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellLogTrack::isPropertyAxisEnabled() const +{ + return m_isPropertyAxisEnabled(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2724,7 +2750,7 @@ void RimWellLogTrack::updateStackedCurveData() 0.0, displayUnit, false, - m_isLogarithmicScaleEnabled ); + m_isPropertyLogarithmicScaleEnabled ); auto plotDepthValues = tempCurveData.depths( depthType ); auto polyLineStartStopIndices = tempCurveData.polylineStartStopIndices(); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index f17165f3f8..85f3b48e18 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -202,7 +202,9 @@ public: std::vector visibleCurves() const; void uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrdering ); - void uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering ); + void uiOrderingForPropertyAxisSettings( caf::PdmUiOrdering& uiOrdering ); + void enablePropertyAxis( bool enable ); + bool isPropertyAxisEnabled() const; void setFormationsForCaseWithSimWellOnly( bool caseWithSimWellOnly ); void updatePropertyValueAxisAndGridTickIntervals(); @@ -316,25 +318,25 @@ private: bool isEmptyVisiblePropertyRange() const; private: - QString m_propertyValueAxisTitle; - - caf::PdmField m_description; - + caf::PdmField m_description; caf::PdmChildArrayField m_curves; - caf::PdmField m_visiblePropertyValueRangeMin; - caf::PdmField m_visiblePropertyValueRangeMax; - caf::PdmField m_visibleDepthRangeMin; - caf::PdmField m_visibleDepthRangeMax; + // Property value axis + caf::PdmField m_isPropertyAxisEnabled; + caf::PdmField m_visiblePropertyValueRangeMin; + caf::PdmField m_visiblePropertyValueRangeMax; caf::PdmField m_isAutoScalePropertyValuesEnabled; - caf::PdmField m_isLogarithmicScaleEnabled; + caf::PdmField m_isPropertyLogarithmicScaleEnabled; caf::PdmField m_invertPropertyValueAxis; caf::PdmField m_propertyValueAxisGridVisibility; + caf::PdmField m_propertyAxisMinAndMaxTicksOnly; + caf::PdmField m_explicitTickIntervalsPropertyValueAxis; + caf::PdmField m_majorTickIntervalPropertyAxis; + caf::PdmField m_minorTickIntervalPropertyAxis; - caf::PdmField m_explicitTickIntervals; - caf::PdmField m_minAndMaxTicksOnly; - caf::PdmField m_majorTickInterval; - caf::PdmField m_minorTickInterval; + // Depth axis + caf::PdmField m_visibleDepthRangeMin; + caf::PdmField m_visibleDepthRangeMax; caf::PdmField m_axisFontSize; @@ -374,8 +376,9 @@ private: QPointer m_plotWidget; std::unique_ptr m_annotationTool; - double m_availablePropertyValueRangeMin; - double m_availablePropertyValueRangeMax; - double m_availableDepthRangeMin; - double m_availableDepthRangeMax; + QString m_propertyValueAxisTitle; + double m_availablePropertyValueRangeMin; + double m_availablePropertyValueRangeMax; + double m_availableDepthRangeMin; + double m_availableDepthRangeMax; }; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 7527605b50..d98593b23b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -193,7 +193,12 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index ) legend->setMaxColumns( legendColumns ); legend->horizontalScrollBar()->setVisible( false ); legend->verticalScrollBar()->setVisible( false ); - legend->setDefaultItemMode( QwtLegendData::Clickable ); + + // The legend item mode must be set before the widget is created + // See https://qwt.sourceforge.io/class_qwt_legend.html#af977ff3e749f8281ee8ad4b926542b50 + auto legendItemMode = m_plotDefinition->legendItemsClickable() ? QwtLegendData::Clickable : QwtLegendData::ReadOnly; + legend->setDefaultItemMode( legendItemMode ); + if ( qwtPlotWidget ) { legend->connect( qwtPlotWidget->qwtPlot(), @@ -744,11 +749,17 @@ void RiuMultiPlotPage::addLegendWidget( RiuPlotWidget* plotWidget, } else { - CAF_ASSERT( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE ); + auto anchor = RiuDraggableOverlayFrame::AnchorCorner::TopRight; + + if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE_UPPER_RIGHT ) + anchor = RiuDraggableOverlayFrame::AnchorCorner::TopRight; + else if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE_UPPER_LEFT ) + anchor = RiuDraggableOverlayFrame::AnchorCorner::TopLeft; + auto overlayFrame = new RiuQwtLegendOverlayContentFrame; overlayFrame->setLegend( legend ); legendFrame->setContentFrame( overlayFrame ); - legendFrame->setAnchorCorner( RiuDraggableOverlayFrame::AnchorCorner::TopRight ); + legendFrame->setAnchorCorner( anchor ); plotWidget->removeOverlayFrame( legendFrame ); plotWidget->addOverlayFrame( legendFrame ); } @@ -769,7 +780,8 @@ void RiuMultiPlotPage::updateLegendVisibility( RiuPlotWidget* plotWid updateLegendFont( legend ); legend->show(); - if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE ) + if ( m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE_UPPER_LEFT || + m_plotDefinition->legendPosition() == RimPlotWindow::LegendPosition::INSIDE_UPPER_RIGHT ) { plotWidget->addOverlayFrame( legendFrame ); legendFrame->show(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp index ec518927cb..da51eb448a 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp @@ -51,7 +51,12 @@ RiuQwtPlotLegend::RiuQwtPlotLegend( QWidget* parent /*= nullptr */ ) void RiuQwtPlotLegend::resizeEvent( QResizeEvent* event ) { QWidget::resizeEvent( event ); - QSize size = event->size(); + + QSize size = event->size(); + + // Avoid updating geometry if height is very small + if ( size.height() < 10 ) return; + const QwtDynGridLayout* legendLayout = qobject_cast( contentsWidget()->layout() ); if ( legendLayout ) { diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp index 47fb3c94bb..afabf5c843 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp @@ -2,6 +2,7 @@ #include "RimDepthTrackPlot.h" #include "RimPlotWindow.h" +#include "RimWellLogTrack.h" #include "RiuQwtPlotWidget.h" #include "RiuWellLogTrack.h" @@ -39,7 +40,7 @@ RiuWellLogPlot::RiuWellLogPlot( RimDepthTrackPlot* plotDefinition, QWidget* pare //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDepthTrackPlot* RiuWellLogPlot::depthTrackPlot() +RimDepthTrackPlot* RiuWellLogPlot::depthTrackPlot() const { auto* wellLogPlot = dynamic_cast( m_plotDefinition.p() ); CAF_ASSERT( wellLogPlot ); @@ -101,7 +102,25 @@ void RiuWellLogPlot::renderTo( QPaintDevice* paintDevice ) //-------------------------------------------------------------------------------------------------- bool RiuWellLogPlot::showYAxis( int row, int column ) const { - return column == 0; + if ( depthTrackPlot() ) + { + if ( depthTrackPlot()->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + return column == 0; + } + + auto index = static_cast( std::max( row, column ) ); + if ( index < depthTrackPlot()->plots().size() ) + { + auto track = dynamic_cast( depthTrackPlot()->plotByIndex( index ) ); + if ( track ) + { + return track->isPropertyAxisEnabled(); + } + } + } + + return true; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.h b/ApplicationLibCode/UserInterface/RiuWellLogPlot.h index 9be0f46575..e0f2a16c8a 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.h @@ -41,7 +41,7 @@ protected: void alignScrollbar( int offset ); private: - RimDepthTrackPlot* depthTrackPlot(); + RimDepthTrackPlot* depthTrackPlot() const; private slots: void slotSetMinDepth( int value );