mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Ensemble curve issues
* #12298 Make it possible to edit curve from a realization in an ensemble * #12299 Fix highlight of single realization curves * Disable serialization of ensemble curve set curves * Ensemble Curves: Make sure replot is called only once during reattach * Performance: Use a small set of header file names to compute name
This commit is contained in:
1 parent
f91a655fda
commit
7b269c43d4
7 files changed
+44
-46
No files matched your search
@@ -414,12 +414,20 @@ QString RiaEnsembleNameTools::uniqueShortNameForEnsembleCase( RimSummaryCase* su
|
||||
QStringList summaryFilePaths;
|
||||
summaryFilePaths.push_back( summaryCase->summaryHeaderFilename() );
|
||||
|
||||
for ( auto otherSummaryCase : summaryCases )
|
||||
// Use a small number of names to find a short name for the ensemble, as RiaEnsembleNameTools::uniqueShortName is slow
|
||||
if ( !summaryCases.empty() )
|
||||
{
|
||||
if ( otherSummaryCase != summaryCase )
|
||||
const int maxNameCount = 4;
|
||||
for ( int i = 0; i < std::min( maxNameCount, static_cast<int>( summaryCases.size() ) ); ++i )
|
||||
{
|
||||
summaryFilePaths.push_back( otherSummaryCase->summaryHeaderFilename() );
|
||||
auto otherSummaryCase = summaryCases[i];
|
||||
if ( otherSummaryCase != summaryCase )
|
||||
{
|
||||
summaryFilePaths.push_back( otherSummaryCase->summaryHeaderFilename() );
|
||||
}
|
||||
}
|
||||
|
||||
summaryFilePaths.push_back( summaryCases.back()->summaryHeaderFilename() );
|
||||
}
|
||||
|
||||
return RiaEnsembleNameTools::uniqueShortName( summaryCase->summaryHeaderFilename(), summaryFilePaths, ensembleCaseName );
|
||||
|
||||
@@ -1194,9 +1194,16 @@ void RimPlotCurve::detach( bool deletePlotCurve )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::reattach()
|
||||
void RimPlotCurve::reattach( bool updateParentPlot )
|
||||
{
|
||||
if ( m_parentPlot && canCurveBeAttached() ) attach( m_parentPlot );
|
||||
if ( m_parentPlot && canCurveBeAttached() )
|
||||
{
|
||||
setParentPlotNoReplot( m_parentPlot );
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
m_parentPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
void attach( RiuPlotWidget* );
|
||||
void detach( bool deletePlotCurve = false );
|
||||
void reattach();
|
||||
void reattach( bool updateParentPlot = true );
|
||||
bool isSameCurve( const RiuPlotCurve* plotCurve ) const;
|
||||
void deletePlotCurve();
|
||||
RiuPlotCurve* plotCurve() const;
|
||||
|
||||
@@ -125,6 +125,9 @@ RimEnsembleCurveSet::RimEnsembleCurveSet()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set" );
|
||||
m_curves.uiCapability()->setUiTreeChildrenHidden( false );
|
||||
// The summary curves are always recreated in loadDataAndUpdate(), so we can disable IO for curves. This will reduce the size of the
|
||||
// project files.
|
||||
m_curves.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" );
|
||||
m_showCurves.uiCapability()->setUiHidden( true );
|
||||
@@ -396,7 +399,15 @@ void RimEnsembleCurveSet::reattachPlotCurves()
|
||||
{
|
||||
for ( RimSummaryCurve* curve : m_curves )
|
||||
{
|
||||
curve->reattach();
|
||||
bool updateParentPlot = false;
|
||||
curve->reattach( updateParentPlot );
|
||||
}
|
||||
|
||||
if ( !m_curves.empty() )
|
||||
{
|
||||
auto firstCurve = m_curves[0];
|
||||
|
||||
firstCurve->replotParentPlot();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,10 +114,6 @@ RimSummaryCurve::RimSummaryCurve()
|
||||
|
||||
m_xValuesSummaryAddress = new RimSummaryAddress;
|
||||
|
||||
// Other members
|
||||
CAF_PDM_InitFieldNoDefault( &m_isEnsembleCurve, "IsEnsembleCurve", "Ensemble Curve" );
|
||||
m_isEnsembleCurve.v() = caf::Tristate::State::PartiallyTrue;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plotAxis_OBSOLETE, "PlotAxis", "Axis" );
|
||||
m_plotAxis_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
@@ -178,11 +174,6 @@ void RimSummaryCurve::setSummaryCaseY( RimSummaryCase* sumCase )
|
||||
clearErrorBars();
|
||||
}
|
||||
|
||||
bool isEnsembleCurve = false;
|
||||
if ( sumCase && sumCase->ensemble() ) isEnsembleCurve = true;
|
||||
|
||||
setIsEnsembleCurve( isEnsembleCurve );
|
||||
|
||||
m_yValuesSummaryCase = sumCase;
|
||||
}
|
||||
|
||||
@@ -446,11 +437,6 @@ RiaDefines::HorizontalAxisType RimSummaryCurve::axisTypeX() const
|
||||
void RimSummaryCurve::setSummaryCaseX( RimSummaryCase* sumCase )
|
||||
{
|
||||
m_xValuesSummaryCase = sumCase;
|
||||
|
||||
bool isEnsembleCurve = false;
|
||||
if ( sumCase && sumCase->ensemble() ) isEnsembleCurve = true;
|
||||
|
||||
setIsEnsembleCurve( isEnsembleCurve );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -490,15 +476,8 @@ RiuPlotAxis RimSummaryCurve::axisY() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCurve::isEnsembleCurve() const
|
||||
{
|
||||
return m_isEnsembleCurve().isTrue();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::setIsEnsembleCurve( bool isEnsembleCurve )
|
||||
{
|
||||
m_isEnsembleCurve.v() = isEnsembleCurve ? caf::Tristate::State::True : caf::Tristate::State::False;
|
||||
auto curveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
return curveSet != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -818,11 +797,6 @@ void RimSummaryCurve::initAfterRead()
|
||||
if ( plot ) m_yPlotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
|
||||
}
|
||||
|
||||
if ( m_isEnsembleCurve().isPartiallyTrue() )
|
||||
{
|
||||
m_isEnsembleCurve.v() = ( summaryCaseY() && summaryCaseY()->ensemble() ) ? caf::Tristate::State::True : caf::Tristate::State::False;
|
||||
}
|
||||
|
||||
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2024.3" ) )
|
||||
{
|
||||
calculateCurveInterpolationFromAddress();
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "RimStackablePlotCurve.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
class RifSummaryReaderInterface;
|
||||
class RimSummaryCase;
|
||||
@@ -93,7 +92,6 @@ public:
|
||||
|
||||
// Other
|
||||
bool isEnsembleCurve() const;
|
||||
void setIsEnsembleCurve( bool isEnsembleCurve );
|
||||
|
||||
void updatePlotAxis();
|
||||
void enableVectorNameInCurveName( bool enable );
|
||||
@@ -166,9 +164,6 @@ private:
|
||||
caf::PdmField<bool> m_xPushButtonSelectSummaryAddress;
|
||||
caf::PdmPtrField<RimPlotAxisPropertiesInterface*> m_xPlotAxisProperties;
|
||||
|
||||
// Other fields
|
||||
caf::PdmField<caf::Tristate> m_isEnsembleCurve;
|
||||
|
||||
caf::PdmChildField<RimSummaryCurveAutoName*> m_curveNameConfig;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::PlotAxis>> m_plotAxis_OBSOLETE;
|
||||
caf::PdmField<bool> m_isTopZWithinCategory;
|
||||
|
||||
@@ -407,16 +407,19 @@ void RimSummaryEnsembleTools::highlightCurvesForSummaryCases( const std::vector<
|
||||
auto plotWidget = dynamic_cast<RiuQwtPlotWidget*>( plot->plotWidget() );
|
||||
if ( !plotWidget ) continue;
|
||||
|
||||
auto summaryCurves = plot->summaryAndEnsembleCurves();
|
||||
// Do nothing if no curve sets are present, as this will cause the single curve highlight to be removed
|
||||
if ( plot->curveSets().empty() ) continue;
|
||||
|
||||
std::vector<RimPlotCurve*> curvesForSameRealization;
|
||||
|
||||
for ( auto curve : summaryCurves )
|
||||
for ( const auto& curveSet : plot->curveSets() )
|
||||
{
|
||||
auto summaryCaseY = curve->summaryCaseY();
|
||||
if ( std::find( sourceCases.begin(), sourceCases.end(), summaryCaseY ) != sourceCases.end() )
|
||||
for ( auto ensembleCurve : curveSet->curves() )
|
||||
{
|
||||
curvesForSameRealization.push_back( curve );
|
||||
auto summaryCaseY = ensembleCurve->summaryCaseY();
|
||||
if ( std::find( sourceCases.begin(), sourceCases.end(), summaryCaseY ) != sourceCases.end() )
|
||||
{
|
||||
curvesForSameRealization.push_back( ensembleCurve );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user