Issues related to user course

* #9277 Observed Data : Assign case ID when importing observed data
If no case ID is assigned, the first observed case is always used when creating new plots of observed data

* #9278 Match on summary vector name when curve unit text is missing
This commit is contained in:
Magne Sjaastad 2022-09-09 13:58:28 +02:00 committed by GitHub
parent 921c90beea
commit 8887676007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 10 deletions

View File

@ -29,6 +29,7 @@
#include "RimObservedEclipseUserData.h"
#include "RimObservedFmuRftData.h"
#include "RimObservedSummaryData.h"
#include "RimProject.h"
#include "RimSummaryObservedDataFile.h"
#include "RiuPlotMainWindow.h"
@ -154,6 +155,7 @@ RimObservedSummaryData*
errorText->append( observedData->errorMessagesFromReader() );
}
RimProject::current()->assignCaseIdToSummaryCase( observedData );
updateNewObservedDataCreated( observedData );
this->updateConnectedEditors();
@ -221,6 +223,7 @@ RimObservedSummaryData*
return nullptr;
}
RimProject::current()->assignCaseIdToSummaryCase( observedData );
updateNewObservedDataCreated( observedData );
this->updateConnectedEditors();

View File

@ -2884,16 +2884,45 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
ALL_TO_LEFT,
ALL_TO_RIGHT,
ALTERNATING,
USE_MATCHING_UNIT
USE_MATCHING_UNIT,
USE_MATCHING_VECTOR
};
RiaDefines::PlotAxis plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
auto strategy = AxisAssignmentStrategy::USE_MATCHING_UNIT;
if ( strategy == AxisAssignmentStrategy::USE_MATCHING_UNIT )
{
auto destinationUnit = destinationCurve->unitNameY();
auto destinationUnit = destinationCurve->unitNameY();
if ( destinationUnit.empty() ) strategy = AxisAssignmentStrategy::USE_MATCHING_VECTOR;
auto anyCurveWithUnitText = [this, destinationCurve] {
for ( auto c : summaryCurves() )
{
if ( c == destinationCurve ) continue;
if ( !c->unitNameY().empty() ) return true;
}
return false;
};
if ( !anyCurveWithUnitText() ) strategy = AxisAssignmentStrategy::USE_MATCHING_VECTOR;
if ( strategy == AxisAssignmentStrategy::USE_MATCHING_VECTOR )
{
// Special handling if curve unit is matching. Try to match on summary vector name to avoid creation of new axis
for ( auto c : summaryCurves() )
{
if ( c == destinationCurve ) continue;
if ( c->summaryAddressY().vectorName() == destinationCurve->summaryAddressY().vectorName() )
{
destinationCurve->setLeftOrRightAxisY( c->axisY() );
return;
}
}
}
else if ( strategy == AxisAssignmentStrategy::USE_MATCHING_UNIT )
{
bool isLeftUsed = false;
bool isRightUsed = false;
@ -2936,6 +2965,8 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
strategy = AxisAssignmentStrategy::ALTERNATING;
}
RiaDefines::PlotAxis plotAxisType = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
if ( strategy == AxisAssignmentStrategy::ALTERNATING )
{
size_t axisCountLeft = 0;
@ -2948,15 +2979,15 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
axisCountRight++;
}
if ( axisCountLeft > axisCountRight ) plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_RIGHT;
if ( axisCountLeft > axisCountRight ) plotAxisType = RiaDefines::PlotAxis::PLOT_AXIS_RIGHT;
}
else if ( strategy == AxisAssignmentStrategy::ALL_TO_LEFT )
{
plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
plotAxisType = RiaDefines::PlotAxis::PLOT_AXIS_LEFT;
}
else if ( strategy == AxisAssignmentStrategy::ALL_TO_RIGHT )
{
plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_RIGHT;
plotAxisType = RiaDefines::PlotAxis::PLOT_AXIS_RIGHT;
}
RiuPlotAxis newPlotAxis = RiuPlotAxis::defaultLeft();
@ -2966,7 +2997,7 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
if ( !destinationCurve->summaryAddressY().uiText().empty() )
axisObjectName = QString::fromStdString( destinationCurve->summaryAddressY().uiText() );
newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis );
newPlotAxis = plotWidget()->createNextPlotAxis( plotAxisType );
addNewAxisProperties( newPlotAxis, axisObjectName );
}