2022-01-06 08:18:09 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight 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.
|
|
|
|
//
|
|
|
|
// ResInsight 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimMultipleSummaryPlotNameHelper.h"
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimMultiSummaryPlotNameHelper::RimMultiSummaryPlotNameHelper( std::vector<const RimSummaryNameHelper*> nameHelpers )
|
|
|
|
: m_nameHelpers( nameHelpers )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimMultiSummaryPlotNameHelper::plotTitle() const
|
|
|
|
{
|
|
|
|
if ( m_nameHelpers.size() == 1 ) return m_nameHelpers.front()->plotTitle();
|
|
|
|
|
|
|
|
if ( m_nameHelpers.size() == 2 )
|
|
|
|
{
|
|
|
|
auto first = m_nameHelpers[0];
|
|
|
|
auto second = m_nameHelpers[1];
|
|
|
|
|
|
|
|
return first->aggregatedPlotTitle( *second );
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Plot Title";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-05-06 09:34:37 -05:00
|
|
|
bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const
|
2022-01-06 08:18:09 -06:00
|
|
|
{
|
|
|
|
int plotCountWithSingleQuantity = 0;
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
2022-05-06 09:34:37 -05:00
|
|
|
if ( nameHelper->isPlotDisplayingSingleVectorName() ) plotCountWithSingleQuantity++;
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
2023-06-26 06:12:41 -05:00
|
|
|
return plotCountWithSingleQuantity == 1;
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isWellNameInTitle() const
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isWellNameInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-04-07 14:06:40 -05:00
|
|
|
bool RimMultiSummaryPlotNameHelper::isGroupNameInTitle() const
|
2022-01-06 08:18:09 -06:00
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isGroupNameInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
2023-08-14 04:18:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isNetworkInTitle() const
|
|
|
|
{
|
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isNetworkInTitle(); } );
|
|
|
|
}
|
|
|
|
|
2022-01-06 08:18:09 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isRegionInTitle() const
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isRegionInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isCaseInTitle() const
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isCaseInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isBlockInTitle() const
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isBlockInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isSegmentInTitle() const
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isSegmentInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimMultiSummaryPlotNameHelper::isCompletionInTitle() const
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { return nameHelper->isCompletionInTitle(); } );
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
2022-11-01 02:00:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::set<std::string> RimMultiSummaryPlotNameHelper::vectorNames() const
|
|
|
|
{
|
|
|
|
std::set<std::string> allNames;
|
|
|
|
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
auto nameHelperVectorNames = nameHelper->vectorNames();
|
|
|
|
allNames.insert( nameHelperVectorNames.begin(), nameHelperVectorNames.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
return allNames;
|
|
|
|
}
|
|
|
|
|
2022-01-06 08:18:09 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimMultiSummaryPlotNameHelper::caseName() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isCaseInTitle() ) return nameHelper->caseName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-05-06 09:34:37 -05:00
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleVectorName() const
|
2022-01-06 08:18:09 -06:00
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
2022-05-06 09:34:37 -05:00
|
|
|
if ( nameHelper->isPlotDisplayingSingleVectorName() ) return nameHelper->titleVectorName();
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleWellName() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isWellNameInTitle() ) return nameHelper->titleWellName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-04-07 14:06:40 -05:00
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleGroupName() const
|
2022-01-06 08:18:09 -06:00
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
2022-04-07 14:06:40 -05:00
|
|
|
if ( nameHelper->isGroupNameInTitle() ) return nameHelper->titleGroupName();
|
2022-01-06 08:18:09 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2023-08-14 04:18:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleNetwork() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isNetworkInTitle() ) return nameHelper->titleNetwork();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2022-01-06 08:18:09 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleRegion() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isRegionInTitle() ) return nameHelper->titleRegion();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleBlock() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isBlockInTitle() ) return nameHelper->titleBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleSegment() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isSegmentInTitle() ) return nameHelper->titleSegment();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::string RimMultiSummaryPlotNameHelper::titleCompletion() const
|
|
|
|
{
|
|
|
|
for ( auto nameHelper : m_nameHelpers )
|
|
|
|
{
|
|
|
|
if ( nameHelper->isCompletionInTitle() ) return nameHelper->titleCompletion();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|