10214 ensemble appearance

* Regression Analysis: Use only positive values for Power Fit regression.

* Add visible tag short cut for changning curve color.
* #10214 Ensemble Curve Set: Fix color mode text.
* #10214 Ensemble: Switch P10 and P90 symbols to point towards mean.
* Cache hit rects for tree item tags.
* #10214 Ensemble curve set: allow reordering with tree view tag
* #10214 Keep curve legend text when ensemble curves are hidden
This commit is contained in:
Kristian Bendiksen
2023-05-23 08:10:35 +02:00
committed by GitHub
parent 329a199863
commit 94f7bd3c1a
10 changed files with 92 additions and 46 deletions

View File

@@ -32,13 +32,16 @@
#include "RimSummaryCurveCollection.h"
#include "RimSummaryPlot.h"
#include "RiuGuiTheme.h"
#include "RiuPlotCurve.h"
#include "RiuPlotCurveSymbol.h"
#include "RiuPlotMainWindowTools.h"
#include "RiuPlotWidget.h"
#include "cafAssert.h"
#include "cafPdmUiColorEditor.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiTreeAttributes.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include <QPen>
@@ -1243,3 +1246,48 @@ QString RimPlotCurve::curveExportDescription( const RifEclipseSummaryAddress& ad
{
return m_curveName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
{
treeItemAttribute->tags.clear();
auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create();
// Blend with background for a nice look
auto backgroundColor = RiuGuiTheme::getColorByVariableName( "backgroundColor1" );
auto color = RiaColorTools::toQColor( m_curveAppearance->color() );
auto sourceWeight = 100;
double transparency = 0.3;
int backgroundWeight = std::max( 1, static_cast<int>( sourceWeight * 10 * transparency ) );
auto blendedColor = RiaColorTools::blendQColors( backgroundColor, color, backgroundWeight, sourceWeight );
tag->bgColor = blendedColor;
tag->fgColor = RiaColorTools::toQColor( m_curveAppearance->color() );
tag->text = "---";
tag->clicked.connect( this, &RimPlotCurve::onColorTagClicked );
treeItemAttribute->tags.push_back( std::move( tag ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::onColorTagClicked( const SignalEmitter* emitter, size_t index )
{
QColor sourceColor = RiaColorTools::toQColor( m_curveAppearance->color() );
QColor newColor = caf::PdmUiColorEditor::getColor( sourceColor );
if ( newColor.isValid() && newColor != sourceColor )
{
auto myColor = RiaColorTools::fromQColorTo3f( newColor );
m_curveAppearance->setColor( myColor );
updateCurveAppearance();
replotParentPlot();
}
}