mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support cross plot curves in plot templates
This commit is contained in:
parent
f07a5db559
commit
b87fa0bc74
@ -182,6 +182,28 @@ QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPl
|
||||
replaceStrings( sourceStrings, summaryFieldKeyword, RicSummaryPlotTemplateTools::placeholderTextForSummaryCase(), objectAsText );
|
||||
}
|
||||
|
||||
{
|
||||
std::set<QString> sourceStrings;
|
||||
|
||||
const QString summaryFieldKeyword = RicSummaryPlotTemplateTools::summaryCaseXFieldKeyword();
|
||||
for ( const auto& curve : summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) )
|
||||
{
|
||||
if ( curve->axisTypeX() != RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) continue;
|
||||
|
||||
auto fieldHandle = curve->findField( summaryFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
auto reference = caf::PdmReferenceHelper::referenceFromFieldToObject( fieldHandle, curve->summaryCaseX() );
|
||||
|
||||
sourceStrings.insert( reference );
|
||||
}
|
||||
|
||||
addresses.push_back( curve->summaryAddressX() );
|
||||
}
|
||||
|
||||
replaceStrings( sourceStrings, summaryFieldKeyword, RicSummaryPlotTemplateTools::placeholderTextForSummaryCaseX(), objectAsText );
|
||||
}
|
||||
|
||||
{
|
||||
std::set<QString> ensembleReferenceStrings;
|
||||
|
||||
|
@ -250,13 +250,13 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot*
|
||||
auto summaryCurves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS );
|
||||
for ( const auto& curve : summaryCurves )
|
||||
{
|
||||
auto fieldHandle = curve->findField( RicSummaryPlotTemplateTools::summaryCaseFieldKeyword() );
|
||||
if ( fieldHandle )
|
||||
auto summaryCaseHandle = curve->findField( RicSummaryPlotTemplateTools::summaryCaseFieldKeyword() );
|
||||
if ( summaryCaseHandle )
|
||||
{
|
||||
bool conversionOk = false;
|
||||
const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryCase();
|
||||
|
||||
auto referenceString = fieldHandle->xmlCapability()->referenceString();
|
||||
auto referenceString = summaryCaseHandle->xmlCapability()->referenceString();
|
||||
int indexValue = RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk );
|
||||
|
||||
if ( conversionOk && indexValue >= 0 && indexValue < static_cast<int>( selectedSummaryCases.size() ) )
|
||||
@ -266,12 +266,37 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot*
|
||||
}
|
||||
}
|
||||
|
||||
auto summaryCaseXHandle = curve->findField( RicSummaryPlotTemplateTools::summaryCaseXFieldKeyword() );
|
||||
if ( summaryCaseXHandle )
|
||||
{
|
||||
bool conversionOk = false;
|
||||
const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryCaseX();
|
||||
|
||||
auto referenceString = summaryCaseXHandle->xmlCapability()->referenceString();
|
||||
int indexValue = RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk );
|
||||
|
||||
if ( conversionOk && indexValue >= 0 && indexValue < static_cast<int>( selectedSummaryCases.size() ) )
|
||||
{
|
||||
auto summaryCase = selectedSummaryCases[static_cast<int>( indexValue )];
|
||||
curve->setSummaryCaseX( summaryCase );
|
||||
}
|
||||
}
|
||||
|
||||
// Replace placeholders with object names from selection
|
||||
auto curveAdr = curve->summaryAddressY();
|
||||
setPlaceholderWellName( &curveAdr, wellNames );
|
||||
setPlaceholderGroupName( &curveAdr, groupNames );
|
||||
setPlaceholderRegion( &curveAdr, regions );
|
||||
curve->setSummaryAddressY( curveAdr );
|
||||
|
||||
if ( curve->axisTypeX() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR )
|
||||
{
|
||||
auto curveAdr = curve->summaryAddressX();
|
||||
setPlaceholderWellName( &curveAdr, wellNames );
|
||||
setPlaceholderGroupName( &curveAdr, groupNames );
|
||||
setPlaceholderRegion( &curveAdr, regions );
|
||||
curve->setSummaryAddressX( curveAdr );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const auto& curveSet : summaryPlot->curveSets() )
|
||||
@ -493,6 +518,14 @@ QString RicSummaryPlotTemplateTools::summaryCaseFieldKeyword()
|
||||
return "SummaryCase";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicSummaryPlotTemplateTools::summaryCaseXFieldKeyword()
|
||||
{
|
||||
return "SummaryCaseX";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -509,6 +542,14 @@ QString RicSummaryPlotTemplateTools::placeholderTextForSummaryCase()
|
||||
return "__CASE_NAME__";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicSummaryPlotTemplateTools::placeholderTextForSummaryCaseX()
|
||||
{
|
||||
return "__CASE_NAME_X__";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -51,9 +51,11 @@ public:
|
||||
static std::vector<QString> selectDefaultPlotTemplates( std::vector<QString> currentSelection );
|
||||
|
||||
static QString summaryCaseFieldKeyword();
|
||||
static QString summaryCaseXFieldKeyword();
|
||||
static QString summaryGroupFieldKeyword();
|
||||
|
||||
static QString placeholderTextForSummaryCase();
|
||||
static QString placeholderTextForSummaryCaseX();
|
||||
static QString placeholderTextForSummaryGroup();
|
||||
static QString placeholderTextForWell();
|
||||
static QString placeholderTextForGroup();
|
||||
|
Loading…
Reference in New Issue
Block a user