diff --git a/ApplicationLibCode/Adm/LicenseInformation.txt b/ApplicationLibCode/Adm/LicenseInformation.txt index 40ac91b60d..b9258bb3cd 100644 --- a/ApplicationLibCode/Adm/LicenseInformation.txt +++ b/ApplicationLibCode/Adm/LicenseInformation.txt @@ -616,3 +616,47 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at for more details. +=============================================================================== + Notice for the open-vds library +=============================================================================== + +https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/open-vds/-/blob/master/LICENSE + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + +=============================================================================== + Notice for the open-zgy library +=============================================================================== + +https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/open-zgy/-/blob/master/LICENSE.txt + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + +=============================================================================== + Notice for the regression-analysis library +=============================================================================== + +https://github.com/CeetronSolutions/regression-analysis + + +Copyright (C) 2023- Equinor ASA + +regression-analysis is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +regression-analysis is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License at +for more details. diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 140c82c7f1..b008d4eb54 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -18,8 +18,10 @@ #include "RimCorrelationPlot.h" +#include "RiaColorTools.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" + #include "RiuGroupedBarChartBuilder.h" #include "RiuPlotMainWindowTools.h" #include "RiuQwtPlotItem.h" @@ -70,6 +72,10 @@ RimCorrelationPlot::RimCorrelationPlot() m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_selectedParametersList.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); + // Color taken from https://webviz-subsurface-example.azurewebsites.net/parameters-vs-rft + QColor qColor = QColor( "#3173b2" ); + CAF_PDM_InitField( &m_barColor, "BarColor", RiaColorTools::fromQColorTo3f( qColor ), "Bar Color" ); + setLegendsVisible( false ); setDeletable( true ); } @@ -90,9 +96,10 @@ RimCorrelationPlot::~RimCorrelationPlot() void RimCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { RimAbstractCorrelationPlot::fieldChangedByUi( changedField, oldValue, newValue ); + if ( changedField == &m_showAbsoluteValues || changedField == &m_sortByAbsoluteValues || changedField == &m_excludeParametersWithoutVariation || changedField == &m_selectedParametersList || - changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount ) + changedField == &m_showOnlyTopNCorrelations || changedField == &m_topNFilterCount || changedField == &m_barColor ) { if ( changedField == &m_excludeParametersWithoutVariation ) { @@ -134,6 +141,7 @@ void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder plotGroup->add( &m_titleFontSize ); plotGroup->add( &m_axisTitleFontSize ); plotGroup->add( &m_axisValueFontSize ); + plotGroup->add( &m_barColor ); m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle() ); uiOrdering.skipRemainingFields( true ); @@ -177,6 +185,8 @@ void RimCorrelationPlot::onLoadDataAndUpdate() RiuGroupedBarChartBuilder chartBuilder; + chartBuilder.setBarColor( RiaColorTools::toQColor( m_barColor() ) ); + addDataToChartBuilder( chartBuilder ); chartBuilder.addBarChartToPlot( m_plotWidget->qwtPlot(), Qt::Horizontal, m_showOnlyTopNCorrelations() ? m_topNFilterCount() : -1 ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h index e7eacfc2a9..69792c1de2 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h @@ -23,6 +23,7 @@ #include "RimAbstractCorrelationPlot.h" #include "cafAppEnum.h" +#include "cafPdmFieldCvfColor.h" #include @@ -79,4 +80,5 @@ private: caf::PdmField m_showOnlyTopNCorrelations; caf::PdmField m_topNFilterCount; caf::PdmField> m_selectedParametersList; + caf::PdmField m_barColor; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 1d3a91d673..328b2099f6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -1285,9 +1285,6 @@ void RimPlotCurve::onColorTagClicked( const SignalEmitter* emitter, size_t index if ( newColor.isValid() && newColor != sourceColor ) { - auto myColor = RiaColorTools::fromQColorTo3f( newColor ); - m_curveAppearance->setColor( myColor ); - updateCurveAppearance(); - replotParentPlot(); + m_curveAppearance->setColorWithFieldChanged( newColor ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index f5c4537d00..b48508aeec 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -21,6 +21,7 @@ #include "RiaColorTools.h" #include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiCommandSystemProxy.h" #include "cvfAssert.h" @@ -171,6 +172,15 @@ cvf::Color3f RimPlotCurveAppearance::color() const return m_curveColor; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurveAppearance::setColorWithFieldChanged( const QColor& color ) +{ + caf::PdmUiCommandSystemProxy::instance()->setUiValueToField( m_curveColor.uiCapability(), color ); + caf::PdmUiCommandSystemProxy::instance()->setUiValueToField( m_fillColor.uiCapability(), color ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h index 21787cd50a..4050d47117 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h @@ -53,6 +53,8 @@ public: void setColor( const cvf::Color3f& color ); cvf::Color3f color() const; + void setColorWithFieldChanged( const QColor& color ); + void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle ); RiuQwtPlotCurveDefines::LineStyleEnum lineStyle() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 1b95550f65..d583f0e6ca 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -212,6 +212,7 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) sumPlot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed ); sumPlot->titleChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); sumPlot->axisChangedReloadRequired.connect( this, &RimSummaryMultiPlot::onSubPlotAxisReloadRequired ); + sumPlot->autoTitleChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAutoTitleChanged ); bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE; setAutoValueStatesForPlot( sumPlot, isMinMaxOverridden, m_autoAdjustAppearance() ); @@ -417,9 +418,12 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" ); titlesGroup->setCollapsedByDefault(); + + // If a checkbox is first in the group, it is not responding to mouse clicks. Set title as first element. + // https://github.com/OPM/ResInsight/issues/10321 + titlesGroup->add( &m_plotWindowTitle ); titlesGroup->add( &m_autoPlotTitle ); titlesGroup->add( &m_showPlotWindowTitle ); - titlesGroup->add( &m_plotWindowTitle ); titlesGroup->add( &m_titleFontSize ); auto subPlotSettingsGroup = uiOrdering.addNewGroup( "Sub Plot Settings" ); @@ -500,10 +504,15 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi setAutoValueStates(); analyzePlotsAndAdjustAppearanceSettings(); } - else + else if ( changedField == &m_plotWindowTitle ) { - RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); + // If the user has changed the plot title, disable the auto plot title + // Workaround for https://github.com/OPM/ResInsight/issues/9681 + + m_autoPlotTitle = false; } + + RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); } //-------------------------------------------------------------------------------------------------- @@ -716,6 +725,7 @@ void RimSummaryMultiPlot::initAfterRead() plot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed ); plot->titleChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); plot->axisChangedReloadRequired.connect( this, &RimSummaryMultiPlot::onSubPlotAxisReloadRequired ); + plot->autoTitleChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAutoTitleChanged ); } updateStepDimensionFromDefault(); } @@ -1436,6 +1446,16 @@ void RimSummaryMultiPlot::onSubPlotAxisReloadRequired( const caf::SignalEmitter* } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::onSubPlotAutoTitleChanged( const caf::SignalEmitter* emitter, bool isEnabled ) +{ + m_autoSubPlotTitle = isEnabled; + + loadDataAndUpdate(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index a05d4bf9bd..a36d17f1bd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -146,6 +146,7 @@ private: void onSubPlotZoomed( const caf::SignalEmitter* emitter ); void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ); void onSubPlotAxisReloadRequired( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ); + void onSubPlotAutoTitleChanged( const caf::SignalEmitter* emitter, bool isEnabled ); void updateTimeAxisRangesFromFirstPlot(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 3ca83e40a9..9c79e44e89 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -127,6 +127,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) , titleChanged( this ) , m_isValid( true ) , axisChangedReloadRequired( this ) + , autoTitleChanged( this ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -1618,6 +1619,16 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { RimPlot::fieldChangedByUi( changedField, oldValue, newValue ); + if ( changedField == &m_description ) + { + m_useAutoPlotTitle = false; + } + + if ( changedField == &m_useAutoPlotTitle || changedField == &m_description ) + { + autoTitleChanged.send( m_useAutoPlotTitle() ); + } + if ( changedField == &m_showPlotTitle || changedField == &m_description || changedField == &m_useAutoPlotTitle ) { updatePlotTitle(); @@ -2600,7 +2611,6 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& mainOptions->add( &m_description ); mainOptions->add( &m_colSpan ); } - m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle ); mainOptions->add( &m_normalizeCurveYValues ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 62cefb5013..9bcd2a3846 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -84,6 +84,7 @@ public: caf::Signal<> plotZoomedByUser; caf::Signal<> titleChanged; caf::Signal axisChangedReloadRequired; + caf::Signal autoTitleChanged; public: RimSummaryPlot( bool isCrossPlot = false ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp index 4631d7e394..336a2956b7 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp @@ -18,6 +18,8 @@ #include "RimGridCaseSurface.h" +#include "RigActiveCellInfo.h" +#include "RigCaseCellResultsData.h" #include "RigMainGrid.h" #include "RigReservoirGridTools.h" #include "RigSurface.h" @@ -48,6 +50,7 @@ RimGridCaseSurface::RimGridCaseSurface() m_oneBasedSliceIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); CAF_PDM_InitScriptableField( &m_watertight, "Watertight", false, "Watertight Surface (fill gaps)" ); + CAF_PDM_InitScriptableField( &m_includeInactiveCells, "IncludeInactiveCells", false, "Include Inactive Cells" ); } //-------------------------------------------------------------------------------------------------- @@ -138,7 +141,8 @@ void RimGridCaseSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedFie { RimSurface::fieldChangedByUi( changedField, oldValue, newValue ); - if ( changedField == &m_case || changedField == &m_oneBasedSliceIndex || changedField == &m_watertight ) + if ( changedField == &m_case || changedField == &m_oneBasedSliceIndex || changedField == &m_watertight || + changedField == &m_includeInactiveCells ) { clearCachedNativeData(); updateSurfaceData(); @@ -284,6 +288,8 @@ void RimGridCaseSurface::extractGridDataUsingFourVerticesPerCell() { const RigMainGrid* grid = eclCase->mainGrid(); + auto activeCells = eclCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->activeCellInfo(); + size_t minI = 0; size_t minJ = 0; size_t maxI = grid->cellCountI(); @@ -306,6 +312,12 @@ void RimGridCaseSurface::extractGridDataUsingFourVerticesPerCell() const auto& cell = grid->cell( currentCellIndex ); if ( cell.isInvalid() ) continue; + if ( !m_includeInactiveCells() && activeCells ) + { + auto reservoirCellIndex = grid->reservoirCellIndex( currentCellIndex ); + if ( !activeCells->isActive( reservoirCellIndex ) ) continue; + } + cvf::Vec3d currentCornerVerts[8]; { diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h index 466402d56c..039e27e32e 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h @@ -85,6 +85,7 @@ private: caf::PdmPtrField m_case; caf::PdmField m_oneBasedSliceIndex; caf::PdmField m_watertight; + caf::PdmField m_includeInactiveCells; std::vector m_triangleIndices; std::vector m_vertices; diff --git a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp index 716a376a16..5ded3c9d17 100644 --- a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp +++ b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp @@ -353,9 +353,10 @@ void RiuGroupedBarChartBuilder::addBarEntry( const QString& majorTickText, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuGroupedBarChartBuilder::setLegendColorMap( const std::map& legendColors ) +void RiuGroupedBarChartBuilder::setBarColor( const QColor& color ) { - m_legendColors = legendColors; + m_useBarColor = true; + m_barColor = color; } //-------------------------------------------------------------------------------------------------- @@ -654,15 +655,11 @@ void RiuGroupedBarChartBuilder::addBarChartToPlot( QwtPlot* plot, Qt::Orientatio int idx = 0; for ( const auto& legendToBarPointsPair : legendToBarPointsMap ) { - QColor legendColor = RiaColorTables::categoryPaletteColors().cycledQColor( idx ); + QColor color = RiaColorTables::categoryPaletteColors().cycledQColor( idx ); - auto legendColorPairIt = m_legendColors.find( legendToBarPointsPair.first ); - if ( legendColorPairIt != m_legendColors.end() ) - { - legendColor = legendColorPairIt->second; - } + if ( m_useBarColor ) color = m_barColor; - addQwtBarChart( plot, legendToBarPointsPair.second, legendToBarPointsPair.first, legendColor, barOrientation ); + addQwtBarChart( plot, legendToBarPointsPair.second, legendToBarPointsPair.first, color, barOrientation ); idx++; } diff --git a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h index 9ae721aeb4..28975b0645 100644 --- a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h +++ b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include @@ -27,7 +28,6 @@ #include class QwtPlot; -class QColor; //-------------------------------------------------------------------------------------------------- /// @@ -45,7 +45,7 @@ public: const QString& barText, const double value ); - void setLegendColorMap( const std::map& legendColors ); + void setBarColor( const QColor& color ); void addBarChartToPlot( QwtPlot* plot, Qt::Orientation orientation, int maxBarCount = -1 ); void setLabelFontSize( int labelPointSize ); @@ -85,8 +85,10 @@ private: bool operator<( const BarEntry& other ) const; }; - std::multiset m_sortedBarEntries; - std::map m_legendColors; - bool m_isSortingByMaxValueInGroups; - int m_labelPointSize; + std::multiset m_sortedBarEntries; + bool m_isSortingByMaxValueInGroups; + int m_labelPointSize; + + bool m_useBarColor = false; + QColor m_barColor; }; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 97b9cc0f1d..3f459b04e9 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -31,6 +31,7 @@ #include "RimPlotWindow.h" #include "RiuDraggableOverlayFrame.h" +#include "RiuGuiTheme.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" #include "RiuPlotObjectPicker.h" @@ -1095,7 +1096,8 @@ std::pair RiuMultiPlotPage::findAvailableRowAndColumn( int startRow, i void RiuMultiPlotPage::applyLook() { QPalette newPalette( palette() ); - newPalette.setColor( QPalette::Window, Qt::white ); + auto backgroundColor = RiuGuiTheme::getColorByVariableName( "mainBackgroundColor" ); + newPalette.setColor( QPalette::Window, backgroundColor ); setPalette( newPalette ); setAutoFillBackground( true );