Adjustments for release

* #9681 Disable auto plot title check box when typing a custom name
The Auto Plot Title check box is not possible to click on using the mouse. A useful workaround is to disable the check box when the user enter a custom name in the name field.

* #10361 Make sure all objects change color when selecting curve color
Add support for direct change of all selected curve objects when changing color

* Use title as first field in group to avoid Qt checkbox not reacting to mouse click

* #9681 Disable auto name when name is changed in sub plot

* #10344 Surfaces: Add option to exclude inactive cells

* #10369 Use one color for bars in tornado plot

* Update license info
This commit is contained in:
Magne Sjaastad 2023-06-09 14:09:08 +02:00 committed by GitHub
parent f5752d109d
commit 9a6e37a2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 137 additions and 26 deletions

View File

@ -616,3 +616,47 @@ FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
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 <http://www.gnu.org/licenses/gpl.html>
for more details.

View File

@ -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 );

View File

@ -23,6 +23,7 @@
#include "RimAbstractCorrelationPlot.h"
#include "cafAppEnum.h"
#include "cafPdmFieldCvfColor.h"
#include <QDateTime>
@ -79,4 +80,5 @@ private:
caf::PdmField<bool> m_showOnlyTopNCorrelations;
caf::PdmField<int> m_topNFilterCount;
caf::PdmField<std::vector<QString>> m_selectedParametersList;
caf::PdmField<cvf::Color3f> m_barColor;
};

View File

@ -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 );
}
}

View File

@ -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 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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;

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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();

View File

@ -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 );

View File

@ -84,6 +84,7 @@ public:
caf::Signal<> plotZoomedByUser;
caf::Signal<> titleChanged;
caf::Signal<RimSummaryPlot*> axisChangedReloadRequired;
caf::Signal<bool> autoTitleChanged;
public:
RimSummaryPlot( bool isCrossPlot = false );

View File

@ -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];
{

View File

@ -85,6 +85,7 @@ private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<int> m_oneBasedSliceIndex;
caf::PdmField<bool> m_watertight;
caf::PdmField<bool> m_includeInactiveCells;
std::vector<unsigned> m_triangleIndices;
std::vector<cvf::Vec3d> m_vertices;

View File

@ -353,9 +353,10 @@ void RiuGroupedBarChartBuilder::addBarEntry( const QString& majorTickText,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGroupedBarChartBuilder::setLegendColorMap( const std::map<QString, QColor>& 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++;
}

View File

@ -18,6 +18,7 @@
#pragma once
#include <QColor>
#include <QPointF>
#include <QString>
#include <QVector>
@ -27,7 +28,6 @@
#include <set>
class QwtPlot;
class QColor;
//--------------------------------------------------------------------------------------------------
///
@ -45,7 +45,7 @@ public:
const QString& barText,
const double value );
void setLegendColorMap( const std::map<QString, QColor>& legendColors );
void setBarColor( const QColor& color );
void addBarChartToPlot( QwtPlot* plot, Qt::Orientation orientation, int maxBarCount = -1 );
void setLabelFontSize( int labelPointSize );
@ -86,7 +86,9 @@ private:
};
std::multiset<BarEntry> m_sortedBarEntries;
std::map<QString, QColor> m_legendColors;
bool m_isSortingByMaxValueInGroups;
int m_labelPointSize;
bool m_useBarColor = false;
QColor m_barColor;
};

View File

@ -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<int, int> 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 );