#8425 Summary Multi Plots: Add grouping on wells, groups, ...

* #8425 Multi Graph : Support grouping on object name
* #8425 Multi Graph : Improve creation of new graphs
* #8425 Multi Graph : Improve default tick mark count
* Handle history and non history as identical headers
* #8425 Multi Graph : Increase space below a graph
This commit is contained in:
Magne Sjaastad 2022-01-10 14:51:31 +01:00 committed by GitHub
parent aeb0bf0677
commit e203c76099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 586 additions and 201 deletions

View File

@ -16,7 +16,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.h
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.h
${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.h
@ -69,7 +69,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.cpp

View File

@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaStdStringTools.h"
#include "RiaSummaryCurveDefinition.h"
@ -29,14 +29,14 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer()
RiaSummaryAddressAnalyzer::RiaSummaryAddressAnalyzer()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses )
void RiaSummaryAddressAnalyzer::appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses )
{
for ( const auto& adr : allAddresses )
{
@ -47,7 +47,7 @@ void RiaSummaryCurveAnalyzer::appendAddresses( const std::vector<RifEclipseSumma
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses )
void RiaSummaryAddressAnalyzer::appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses )
{
for ( const auto& adr : allAddresses )
{
@ -58,7 +58,7 @@ void RiaSummaryCurveAnalyzer::appendAddresses( const std::set<RifEclipseSummaryA
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::quantities() const
std::set<std::string> RiaSummaryAddressAnalyzer::quantities() const
{
return m_quantities;
}
@ -66,7 +66,7 @@ std::set<std::string> RiaSummaryCurveAnalyzer::quantities() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::quantityNamesWithHistory() const
std::set<std::string> RiaSummaryAddressAnalyzer::quantityNamesWithHistory() const
{
assignCategoryToQuantities();
@ -76,7 +76,7 @@ std::set<std::string> RiaSummaryCurveAnalyzer::quantityNamesWithHistory() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::quantityNamesNoHistory() const
std::set<std::string> RiaSummaryAddressAnalyzer::quantityNamesNoHistory() const
{
assignCategoryToQuantities();
@ -86,7 +86,7 @@ std::set<std::string> RiaSummaryCurveAnalyzer::quantityNamesNoHistory() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaSummaryCurveAnalyzer::quantityNameForTitle() const
std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const
{
if ( quantityNamesWithHistory().size() == 1 && quantityNamesNoHistory().empty() )
{
@ -98,37 +98,37 @@ std::string RiaSummaryCurveAnalyzer::quantityNameForTitle() const
return *quantityNamesNoHistory().begin();
}
return std::string();
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::wellNames() const
std::set<std::string> RiaSummaryAddressAnalyzer::wellNames() const
{
return m_wellNames;
return keysInMap( m_wellNames );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::wellGroupNames() const
std::set<std::string> RiaSummaryAddressAnalyzer::wellGroupNames() const
{
return m_wellGroupNames;
return keysInMap( m_wellGroupNames );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaSummaryCurveAnalyzer::regionNumbers() const
std::set<int> RiaSummaryAddressAnalyzer::regionNumbers() const
{
return m_regionNumbers;
return keysInMap( m_regionNumbers );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::wellCompletions( const std::string& wellName ) const
std::set<std::string> RiaSummaryAddressAnalyzer::wellCompletions( const std::string& wellName ) const
{
std::set<std::string> connections;
@ -146,7 +146,7 @@ std::set<std::string> RiaSummaryCurveAnalyzer::wellCompletions( const std::strin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaSummaryCurveAnalyzer::wellSegmentNumbers( const std::string& wellName ) const
std::set<int> RiaSummaryAddressAnalyzer::wellSegmentNumbers( const std::string& wellName ) const
{
std::set<int> segmentNumberForWell;
@ -164,23 +164,23 @@ std::set<int> RiaSummaryCurveAnalyzer::wellSegmentNumbers( const std::string& we
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryCurveAnalyzer::blocks() const
std::set<std::string> RiaSummaryAddressAnalyzer::blocks() const
{
return m_blocks;
return keysInMap( m_blocks );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaSummaryCurveAnalyzer::aquifers() const
std::set<int> RiaSummaryAddressAnalyzer::aquifers() const
{
return m_aquifers;
return keysInMap( m_aquifers );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::categories() const
std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryAddressAnalyzer::categories() const
{
return m_categories;
}
@ -188,37 +188,62 @@ std::set<RifEclipseSummaryAddress::SummaryVarCategory> RiaSummaryCurveAnalyzer::
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category,
const std::string& secondaryIdentifier ) const
std::vector<std::vector<RifEclipseSummaryAddress>> RiaSummaryAddressAnalyzer::addressesGroupedByObject() const
{
auto wellAdr = valuesInMap( m_wellNames );
auto wellGroupAdr = valuesInMap( m_wellGroupNames );
auto regionAdr = valuesInMap( m_regionNumbers );
auto blockAdr = valuesInMap( m_blocks );
auto aquiferAdr = valuesInMap( m_aquifers );
std::vector<std::vector<RifEclipseSummaryAddress>> groupedByObject;
groupedByObject.insert( groupedByObject.end(), wellAdr.begin(), wellAdr.end() );
groupedByObject.insert( groupedByObject.end(), wellGroupAdr.begin(), wellGroupAdr.end() );
groupedByObject.insert( groupedByObject.end(), regionAdr.begin(), regionAdr.end() );
groupedByObject.insert( groupedByObject.end(), blockAdr.begin(), blockAdr.end() );
groupedByObject.insert( groupedByObject.end(), aquiferAdr.begin(), aquiferAdr.end() );
return groupedByObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RiaSummaryAddressAnalyzer::identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category,
const std::string& secondaryIdentifier ) const
{
std::vector<QString> identifierStrings;
if ( category == RifEclipseSummaryAddress::SUMMARY_REGION )
{
for ( const auto& regionNumber : m_regionNumbers )
auto keys = keysInMap( m_regionNumbers );
for ( const auto& key : keys )
{
identifierStrings.push_back( QString::number( regionNumber ) );
identifierStrings.push_back( QString::number( key ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL )
{
for ( const auto& wellName : m_wellNames )
auto keys = keysInMap( m_wellNames );
for ( const auto& key : keys )
{
identifierStrings.push_back( QString::fromStdString( wellName ) );
identifierStrings.push_back( QString::fromStdString( key ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP )
{
for ( const auto& wellGroupName : m_wellGroupNames )
auto keys = keysInMap( m_wellGroupNames );
for ( const auto& key : keys )
{
identifierStrings.push_back( QString::fromStdString( wellGroupName ) );
identifierStrings.push_back( QString::fromStdString( key ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_BLOCK )
{
for ( const auto& ijkBlock : m_blocks )
auto keys = keysInMap( m_blocks );
for ( const auto& key : keys )
{
identifierStrings.push_back( QString::fromStdString( ijkBlock ) );
identifierStrings.push_back( QString::fromStdString( key ) );
}
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT )
@ -239,9 +264,10 @@ std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts( RifEclipseSummary
}
else if ( category == RifEclipseSummaryAddress::SUMMARY_AQUIFER )
{
for ( const auto& aquifer : m_aquifers )
auto keys = keysInMap( m_aquifers );
for ( const auto& key : keys )
{
identifierStrings.push_back( QString::number( aquifer ) );
identifierStrings.push_back( QString::number( key ) );
}
}
@ -252,8 +278,8 @@ std::vector<QString> RiaSummaryCurveAnalyzer::identifierTexts( RifEclipseSummary
///
//--------------------------------------------------------------------------------------------------
std::vector<RifEclipseSummaryAddress>
RiaSummaryCurveAnalyzer::addressesForCategory( const std::set<RifEclipseSummaryAddress>& addresses,
RifEclipseSummaryAddress::SummaryVarCategory category )
RiaSummaryAddressAnalyzer::addressesForCategory( const std::set<RifEclipseSummaryAddress>& addresses,
RifEclipseSummaryAddress::SummaryVarCategory category )
{
std::vector<RifEclipseSummaryAddress> filteredAddresses;
@ -271,7 +297,7 @@ std::vector<RifEclipseSummaryAddress>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( const std::string& curveName )
std::string RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( const std::string& curveName )
{
static std::string historyIdentifier = "H";
@ -280,16 +306,14 @@ std::string RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( const
std::string candidate = curveName.substr( 0, curveName.size() - 1 );
return candidate;
}
else
{
return curveName + historyIdentifier;
}
return curveName + historyIdentifier;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::clear()
void RiaSummaryAddressAnalyzer::clear()
{
m_quantities.clear();
m_wellNames.clear();
@ -308,7 +332,7 @@ void RiaSummaryCurveAnalyzer::clear()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::assignCategoryToQuantities() const
void RiaSummaryAddressAnalyzer::assignCategoryToQuantities() const
{
if ( !m_quantities.empty() )
{
@ -322,7 +346,7 @@ void RiaSummaryCurveAnalyzer::assignCategoryToQuantities() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const
void RiaSummaryAddressAnalyzer::computeQuantityNamesWithHistory() const
{
m_quantitiesNoMatchingHistory.clear();
m_quantitiesWithMatchingHistory.clear();
@ -355,13 +379,13 @@ void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address )
void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address )
{
const std::string& wellName = address.wellName();
if ( !wellName.empty() )
{
m_wellNames.insert( wellName );
m_wellNames.insert( { wellName, address } );
}
if ( !address.quantityName().empty() )
@ -371,12 +395,12 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddre
if ( !address.wellGroupName().empty() )
{
m_wellGroupNames.insert( address.wellGroupName() );
m_wellGroupNames.insert( { address.wellGroupName(), address } );
}
if ( address.regionNumber() != -1 )
{
m_regionNumbers.insert( address.regionNumber() );
m_regionNumbers.insert( { address.regionNumber(), address } );
}
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION )
@ -392,11 +416,12 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddre
else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_BLOCK )
{
auto text = address.blockAsString();
m_blocks.insert( text );
m_blocks.insert( { text, address } );
}
else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_AQUIFER )
{
m_aquifers.insert( address.aquiferNumber() );
m_aquifers.insert( { address.aquiferNumber(), address } );
}
if ( address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID )
@ -404,3 +429,77 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddre
m_categories.insert( address.category() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RiaSummaryAddressAnalyzer::keysInMap( const std::multimap<std::string, RifEclipseSummaryAddress>& map )
{
std::set<std::string> keys;
for ( const auto& [key, value] : map )
{
keys.insert( key );
}
return keys;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<int> RiaSummaryAddressAnalyzer::keysInMap( const std::multimap<int, RifEclipseSummaryAddress>& map )
{
std::set<int> keys;
for ( const auto& [key, value] : map )
{
keys.insert( key );
}
return keys;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<RifEclipseSummaryAddress>>
RiaSummaryAddressAnalyzer::valuesInMap( const std::multimap<std::string, RifEclipseSummaryAddress>& map )
{
std::vector<std::vector<RifEclipseSummaryAddress>> groupedAddresses;
auto uniqueKeys = keysInMap( map );
for ( const auto& key : uniqueKeys )
{
auto range = map.equal_range( key );
std::vector<RifEclipseSummaryAddress> addresses;
for ( auto i = range.first; i != range.second; ++i )
{
addresses.push_back( i->second );
}
groupedAddresses.push_back( addresses );
}
return groupedAddresses;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<RifEclipseSummaryAddress>>
RiaSummaryAddressAnalyzer::valuesInMap( const std::multimap<int, RifEclipseSummaryAddress>& map )
{
std::vector<std::vector<RifEclipseSummaryAddress>> groupedAddresses;
auto uniqueKeys = keysInMap( map );
for ( const auto& key : uniqueKeys )
{
auto range = map.equal_range( key );
std::vector<RifEclipseSummaryAddress> addresses;
for ( auto i = range.first; i != range.second; ++i )
{
addresses.push_back( i->second );
}
groupedAddresses.push_back( addresses );
}
return groupedAddresses;
}

View File

@ -32,10 +32,10 @@ class QString;
//==================================================================================================
//
//==================================================================================================
class RiaSummaryCurveAnalyzer
class RiaSummaryAddressAnalyzer
{
public:
RiaSummaryCurveAnalyzer();
RiaSummaryAddressAnalyzer();
void appendAddresses( const std::set<RifEclipseSummaryAddress>& allAddresses );
void appendAddresses( const std::vector<RifEclipseSummaryAddress>& allAddresses );
@ -58,6 +58,7 @@ public:
std::set<int> aquifers() const;
std::set<RifEclipseSummaryAddress::SummaryVarCategory> categories() const;
std::vector<std::vector<RifEclipseSummaryAddress>> addressesGroupedByObject() const;
std::vector<QString> identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category,
const std::string& secondaryIdentifier ) const;
@ -74,18 +75,27 @@ private:
void analyzeSingleAddress( const RifEclipseSummaryAddress& address );
static std::set<std::string> keysInMap( const std::multimap<std::string, RifEclipseSummaryAddress>& map );
static std::set<int> keysInMap( const std::multimap<int, RifEclipseSummaryAddress>& map );
static std::vector<std::vector<RifEclipseSummaryAddress>>
valuesInMap( const std::multimap<std::string, RifEclipseSummaryAddress>& map );
static std::vector<std::vector<RifEclipseSummaryAddress>>
valuesInMap( const std::multimap<int, RifEclipseSummaryAddress>& map );
private:
std::set<std::string> m_quantities;
mutable std::set<std::string> m_quantitiesWithMatchingHistory;
mutable std::set<std::string> m_quantitiesNoMatchingHistory;
std::set<std::string> m_wellNames;
std::set<std::string> m_wellGroupNames;
std::set<int> m_regionNumbers;
std::set<std::pair<std::string, std::string>> m_wellCompletions;
std::set<std::pair<std::string, int>> m_wellSegmentNumbers;
std::set<std::string> m_blocks;
std::set<int> m_aquifers;
std::multimap<std::string, RifEclipseSummaryAddress> m_wellNames;
std::multimap<std::string, RifEclipseSummaryAddress> m_wellGroupNames;
std::multimap<int, RifEclipseSummaryAddress> m_regionNumbers;
std::set<std::pair<std::string, std::string>> m_wellCompletions;
std::set<std::pair<std::string, int>> m_wellSegmentNumbers;
std::multimap<std::string, RifEclipseSummaryAddress> m_blocks;
std::multimap<int, RifEclipseSummaryAddress> m_aquifers;
std::set<RifEclipseSummaryAddress::SummaryVarCategory> m_categories;
};

View File

@ -41,7 +41,7 @@ RicNewSummaryMultiPlotFeature::RicNewSummaryMultiPlotFeature()
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicNewSummaryMultiPlotFeature::execute()
{
std::vector<RimPlot*> plots;
std::vector<RimSummaryPlot*> plots;
RimSummaryMultiPlot::createAndAppendMultiPlot( plots );
return caf::PdmScriptResponse();

View File

@ -18,6 +18,7 @@
#include "RicSummaryPlotBuilder.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryTools.h"
#include "RifEclipseSummaryAddress.h"
@ -43,6 +44,8 @@
///
//--------------------------------------------------------------------------------------------------
RicSummaryPlotBuilder::RicSummaryPlotBuilder()
: m_individualPlotPerDataSource( false )
, m_graphCurveGrouping( RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE )
{
}
@ -67,17 +70,17 @@ void RicSummaryPlotBuilder::setAddresses( const std::set<RifEclipseSummaryAddres
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryPlotBuilder::setIndividualPlotPerAddress( bool enable )
void RicSummaryPlotBuilder::setIndividualPlotPerDataSource( bool enable )
{
m_individualPlotPerAddress = enable;
m_individualPlotPerDataSource = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryPlotBuilder::setIndividualPlotPerDataSource( bool enable )
void RicSummaryPlotBuilder::setGrouping( RicGraphCurveGrouping groping )
{
m_individualPlotPerDataSource = enable;
m_graphCurveGrouping = groping;
}
//--------------------------------------------------------------------------------------------------
@ -87,49 +90,121 @@ std::vector<RimSummaryPlot*> RicSummaryPlotBuilder::createPlots() const
{
std::vector<RimSummaryPlot*> plots;
if ( m_individualPlotPerDataSource && m_individualPlotPerAddress )
if ( m_individualPlotPerDataSource )
{
for ( auto adr : m_addresses )
if ( m_graphCurveGrouping == RicGraphCurveGrouping::SINGLE_CURVES )
{
for ( const auto& adr : m_addresses )
{
for ( auto summaryCase : m_summaryCases )
{
auto plot = createPlot( { adr }, { summaryCase }, {} );
plots.push_back( plot );
}
for ( auto ensemble : m_ensembles )
{
auto plot = createPlot( { adr }, {}, { ensemble } );
plots.push_back( plot );
}
}
}
else if ( m_graphCurveGrouping == RicGraphCurveGrouping::CURVES_FOR_OBJECT )
{
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( m_addresses );
auto groups = analyzer.addressesGroupedByObject();
for ( const auto& group : groups )
{
std::set<RifEclipseSummaryAddress> addresses;
addresses.insert( group.begin(), group.end() );
for ( auto summaryCase : m_summaryCases )
{
auto plot = createPlot( addresses, { summaryCase }, {} );
plots.push_back( plot );
}
for ( auto ensemble : m_ensembles )
{
auto plot = createPlot( addresses, {}, { ensemble } );
plots.push_back( plot );
}
}
}
else if ( m_graphCurveGrouping == RicGraphCurveGrouping::NONE )
{
for ( auto summaryCase : m_summaryCases )
{
auto plot = createPlot( { adr }, { summaryCase }, {} );
auto plot = createPlot( m_addresses, { summaryCase }, {} );
plots.push_back( plot );
}
for ( auto ensemble : m_ensembles )
{
auto plot = createPlot( { adr }, {}, { ensemble } );
auto plot = createPlot( m_addresses, {}, { ensemble } );
plots.push_back( plot );
}
}
}
else if ( m_individualPlotPerAddress )
else // all data sources in same plot
{
for ( auto adr : m_addresses )
if ( m_graphCurveGrouping == RicGraphCurveGrouping::SINGLE_CURVES )
{
auto plot = createPlot( { adr }, m_summaryCases, m_ensembles );
plots.push_back( plot );
}
}
else if ( m_individualPlotPerDataSource )
{
for ( auto summaryCase : m_summaryCases )
{
auto plot = createPlot( m_addresses, { summaryCase }, {} );
plots.push_back( plot );
}
for ( const auto& adr : m_addresses )
{
if ( !m_summaryCases.empty() )
{
auto plot = createPlot( { adr }, m_summaryCases, {} );
plots.push_back( plot );
}
for ( auto ensemble : m_ensembles )
{
auto plot = createPlot( m_addresses, {}, { ensemble } );
plots.push_back( plot );
if ( !m_ensembles.empty() )
{
auto plot = createPlot( { adr }, {}, m_ensembles );
plots.push_back( plot );
}
}
}
else if ( m_graphCurveGrouping == RicGraphCurveGrouping::CURVES_FOR_OBJECT )
{
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( m_addresses );
auto groups = analyzer.addressesGroupedByObject();
for ( const auto& group : groups )
{
std::set<RifEclipseSummaryAddress> addresses;
addresses.insert( group.begin(), group.end() );
if ( !m_summaryCases.empty() )
{
auto plot = createPlot( addresses, m_summaryCases, {} );
plots.push_back( plot );
}
if ( !m_ensembles.empty() )
{
auto plot = createPlot( addresses, {}, m_ensembles );
plots.push_back( plot );
}
}
}
else if ( m_graphCurveGrouping == RicGraphCurveGrouping::NONE )
{
if ( !m_summaryCases.empty() )
{
auto plot = createPlot( m_addresses, m_summaryCases, {} );
plots.push_back( plot );
}
if ( !m_ensembles.empty() )
{
auto plot = createPlot( m_addresses, {}, m_ensembles );
plots.push_back( plot );
}
}
}
else
{
auto plot = createPlot( m_addresses, m_summaryCases, m_ensembles );
plots.push_back( plot );
}
return plots;
@ -225,7 +300,7 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector
RimProject* project = RimProject::current();
RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection();
RimMultiPlot* plotWindow = new RimMultiPlot;
auto* plotWindow = new RimMultiPlot;
plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) );
plotWindow->setAsPlotMdiWindow();
plotCollection->addMultiPlot( plotWindow );
@ -267,7 +342,7 @@ RimSummaryPlot* RicSummaryPlotBuilder::createPlot( const std::set<RifEclipseSumm
const std::vector<RimSummaryCase*>& summaryCases,
const std::vector<RimSummaryCaseCollection*>& ensembles )
{
RimSummaryPlot* plot = new RimSummaryPlot();
auto* plot = new RimSummaryPlot();
plot->enableAutoPlotTitle( true );
appendCurvesToPlot( plot, addresses, summaryCases, ensembles );

View File

@ -40,6 +40,14 @@ class PdmObject;
//==================================================================================================
class RicSummaryPlotBuilder
{
public:
enum class RicGraphCurveGrouping
{
SINGLE_CURVES,
CURVES_FOR_OBJECT,
NONE
};
public:
RicSummaryPlotBuilder();
@ -48,8 +56,8 @@ public:
void setAddresses( const std::set<RifEclipseSummaryAddress>& addresses );
void setIndividualPlotPerAddress( bool enable );
void setIndividualPlotPerDataSource( bool enable );
void setGrouping( RicGraphCurveGrouping groping );
std::vector<RimSummaryPlot*> createPlots() const;
@ -77,6 +85,7 @@ private:
std::vector<RimSummaryCase*> m_summaryCases;
std::vector<RimSummaryCaseCollection*> m_ensembles;
bool m_individualPlotPerAddress;
bool m_individualPlotPerDataSource;
RicGraphCurveGrouping m_graphCurveGrouping;
};

View File

@ -21,7 +21,7 @@
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RicSelectPlotTemplateUi.h"
@ -241,14 +241,14 @@ QString RicSummaryPlotTemplateTools::htmlTextFromPlotAndSelection( const RimSumm
{
QString text;
RiaSummaryCurveAnalyzer selectionAnalyzer;
RiaSummaryAddressAnalyzer selectionAnalyzer;
selectionAnalyzer.appendAddresses( selectedSummaryAddresses );
if ( templatePlot )
{
std::set<QString> templateSources;
RiaSummaryCurveAnalyzer templateAnalyzer;
std::set<QString> templateSources;
RiaSummaryAddressAnalyzer templateAnalyzer;
{
std::set<RifEclipseSummaryAddress> templateAddresses;

View File

@ -20,7 +20,7 @@
#include "RiaFilePathTools.h"
#include "RiaStringEncodingTools.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RifSummaryReaderInterface.h"
#include "cafAppEnum.h"
@ -142,7 +142,7 @@ void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEcli
RifEclipseSummaryAddress::SummaryVarCategory( category );
std::vector<RifEclipseSummaryAddress> catAddresses =
RiaSummaryCurveAnalyzer::addressesForCategory( addresses, categoryEnum );
RiaSummaryAddressAnalyzer::addressesForCategory( addresses, categoryEnum );
if ( !catAddresses.empty() )
{

View File

@ -18,7 +18,7 @@
#include "RimDataSourceSteppingTools.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "cafPdmUiFieldHandle.h"
@ -174,8 +174,8 @@ bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( cons
return true;
}
std::string correspondingOldString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( oldString );
std::string correspondingNewString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( newString );
std::string correspondingOldString = RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( oldString );
std::string correspondingNewString = RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( newString );
if ( adr->quantityName() == correspondingOldString )
{

View File

@ -52,11 +52,11 @@ void RimMultiPlot::ColumnCountEnum::setUp()
template <>
void RimMultiPlot::RowCountEnum::setUp()
{
addItem( RimMultiPlot::ROWS_1, "1", "1 Row" );
addItem( RimMultiPlot::ROWS_2, "2", "2 Rows" );
addItem( RimMultiPlot::ROWS_3, "3", "3 Rows" );
addItem( RimMultiPlot::ROWS_4, "4", "4 Rows" );
setDefault( RimMultiPlot::ROWS_2 );
addItem( RimMultiPlot::RowCount::ROWS_1, "1", "1 Row" );
addItem( RimMultiPlot::RowCount::ROWS_2, "2", "2 Rows" );
addItem( RimMultiPlot::RowCount::ROWS_3, "3", "3 Rows" );
addItem( RimMultiPlot::RowCount::ROWS_4, "4", "4 Rows" );
setDefault( RimMultiPlot::RowCount::ROWS_2 );
}
} // namespace caf
@ -190,6 +190,8 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
{
if ( plot )
{
setTickmarkCount( plot, m_majorTickmarkCount() );
m_plots.insert( index, plot );
if ( m_viewer )
@ -265,6 +267,7 @@ void RimMultiPlot::insertPlots( const std::vector<RimPlot*>& plots )
{
if ( plot )
{
setTickmarkCount( plot, m_majorTickmarkCount() );
m_plots.insert( -1, plot );
if ( m_viewer )
@ -418,6 +421,43 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setColumnCount( RiuMultiPlotPage::ColumnCount columnCount )
{
m_columnCount = columnCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setRowCount( RowCount rowCount )
{
m_rowsPerPage = rowCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount )
{
m_majorTickmarkCount = tickmarkCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount )
{
std::vector<RimSummaryTimeAxisProperties*> timeAxisProps;
plot->descendantsIncludingThisOfType( timeAxisProps );
for ( auto tap : timeAxisProps )
{
tap->setMajorTickmarkCount( tickmarkCount );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -435,7 +475,29 @@ int RimMultiPlot::columnCount() const
//--------------------------------------------------------------------------------------------------
int RimMultiPlot::rowsPerPage() const
{
return static_cast<int>( m_rowsPerPage() );
RimMultiPlot::RowCount rowEnum = m_rowsPerPage().value();
int rowCount = 2;
switch ( rowEnum )
{
case RimMultiPlot::RowCount::ROWS_1:
rowCount = 1;
break;
case RimMultiPlot::RowCount::ROWS_2:
rowCount = 2;
break;
case RimMultiPlot::RowCount::ROWS_3:
rowCount = 3;
break;
case RimMultiPlot::RowCount::ROWS_4:
rowCount = 4;
break;
default:
break;
}
return rowCount;
}
//--------------------------------------------------------------------------------------------------
@ -462,6 +524,14 @@ caf::PdmFieldHandle* RimMultiPlot::pagePreviewField()
return &m_pagePreviewMode;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::setShowPlotTitles( bool enable )
{
m_showIndividualPlotTitles = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -644,12 +714,7 @@ void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co
{
for ( RimPlot* plot : plots() )
{
std::vector<RimSummaryTimeAxisProperties*> timeAxisProps;
plot->descendantsIncludingThisOfType( timeAxisProps );
for ( auto tap : timeAxisProps )
{
tap->setMajorTickmarkCount( m_majorTickmarkCount() );
}
setTickmarkCount( plot, m_majorTickmarkCount() );
}
updatePlots();

View File

@ -46,7 +46,7 @@ public:
using ColumnCount = RiuMultiPlotBook::ColumnCount;
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
enum RowCount
enum class RowCount
{
ROWS_1 = 1,
ROWS_2 = 2,
@ -91,12 +91,18 @@ public:
void setAutoScaleXEnabled( bool enabled );
void setAutoScaleYEnabled( bool enabled );
void setColumnCount( RiuMultiPlotPage::ColumnCount columnCount );
void setRowCount( RimMultiPlot::RowCount rowCount );
void setTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount );
int columnCount() const override;
int rowsPerPage() const;
caf::PdmFieldHandle* columnCountField();
caf::PdmFieldHandle* rowsPerPageField();
caf::PdmFieldHandle* pagePreviewField();
bool showPlotTitles() const;
void setShowPlotTitles( bool enable );
bool showPlotTitles() const;
void zoomAll() override;
@ -144,6 +150,8 @@ private:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
static void setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount );
protected:
caf::PdmField<bool> m_showPlotWindowTitle;
caf::PdmField<QString> m_plotWindowTitle;

View File

@ -34,6 +34,7 @@ void caf::AppEnum<RimPlotAxisPropertiesInterface::AxisTitlePositionType>::setUp(
template <>
void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp()
{
addItem(RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few");
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW, "Few", "Few" );
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT, "Default", "Default" );
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY, "Many", "Many" );

View File

@ -35,6 +35,7 @@ public:
enum class LegendTickmarkCount
{
TICKMARK_VERY_FEW,
TICKMARK_FEW,
TICKMARK_DEFAULT,
TICKMARK_MANY,

View File

@ -22,7 +22,7 @@
#include "RiaGuiApplication.h"
#include "RiaPreferences.h"
#include "RiaResultNames.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryCurveDefinition.h"
#include "RiaTimeTTools.h"

View File

@ -18,6 +18,7 @@
#include "RimMultiPlot.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryStringTools.h"
#include "RimEnsembleCurveSet.h"
@ -28,6 +29,7 @@
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotNameHelper.h"
@ -53,6 +55,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
m_filterText.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" );
CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" );
CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" );
CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", false, "Auto Plot Titles" );
CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", false, "Auto Plot Titles Sub Plots" );
@ -118,7 +121,7 @@ QString RimSummaryMultiPlot::description() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::addPlot( RimPlot* plot )
void RimSummaryMultiPlot::addPlot( RimSummaryPlot* plot )
{
m_multiPlot->addPlot( plot );
}
@ -126,7 +129,7 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector<RimPlot*>& plots )
RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector<RimSummaryPlot*>& plots )
{
RimProject* project = RimProject::current();
auto* plotCollection = project->mainPlotCollection()->multiPlotCollection();
@ -135,19 +138,9 @@ RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::v
plotWindow->setAsPlotMdiWindow();
plotCollection->addMultiSummaryPlot( plotWindow );
for ( auto plot : plots )
{
plotWindow->addPlot( plot );
plot->resolveReferencesRecursively();
plot->revokeMdiWindowStatus();
plot->setShowWindow( true );
plot->loadDataAndUpdate();
}
insertGraphsIntoPlot( plotWindow, plots );
plotCollection->updateAllRequiredEditors();
plotWindow->loadDataAndUpdate();
return plotWindow;
}
@ -296,20 +289,26 @@ QList<caf::PdmOptionItemInfo> RimSummaryMultiPlot::calculateValueOptions( const
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_filterText );
uiOrdering.add( &m_individualPlotPerVector );
uiOrdering.add( &m_individualPlotPerDataSource );
uiOrdering.add( &m_autoPlotTitles );
uiOrdering.add( &m_autoPlotTitlesOnSubPlots );
auto group = uiOrdering.addNewGroup( "Multi Plot Options" );
m_multiPlot->uiOrderingForSummaryMultiPlot( *group );
{
auto group = uiOrdering.addNewGroup( "Data Source" );
m_sourceStepping()->uiOrdering( uiConfigName, *group );
}
auto group = uiOrdering.addNewGroup( "Multi Plot Options" );
m_multiPlot->uiOrderingForSummaryMultiPlot( *group );
{
auto group = uiOrdering.addNewGroup( "Graph Building" );
group->setCollapsedByDefault( true );
group->add( &m_filterText );
group->add( &m_individualPlotPerVector );
group->add( &m_individualPlotPerDataSource );
group->add( &m_individualPlotPerObject );
}
uiOrdering.add( &m_showMultiPlotInProjectTree );
uiOrdering.skipRemainingFields();
@ -335,7 +334,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
}
}
else if ( changedField == &m_filterText || changedField == &m_individualPlotPerDataSource ||
changedField == &m_individualPlotPerVector )
changedField == &m_individualPlotPerVector || changedField == &m_individualPlotPerObject )
{
updatePlots();
}
@ -404,20 +403,16 @@ void RimSummaryMultiPlot::updatePlots()
RicSummaryPlotBuilder plotBuilder;
plotBuilder.setAddresses( filteredAddresses );
plotBuilder.setDataSources( matchingSummaryCases, matchingEnsembles );
plotBuilder.setIndividualPlotPerAddress( m_individualPlotPerVector );
plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource );
RicSummaryPlotBuilder::RicGraphCurveGrouping groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE;
if ( m_individualPlotPerVector ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::SINGLE_CURVES;
if ( m_individualPlotPerObject ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::CURVES_FOR_OBJECT;
plotBuilder.setGrouping( groping );
auto plots = plotBuilder.createPlots();
for ( auto plot : plots )
{
this->addPlot( plot );
plot->resolveReferencesRecursively();
plot->revokeMdiWindowStatus();
plot->setShowWindow( true );
}
onLoadDataAndUpdate();
insertGraphsIntoPlot( this, plots );
}
}
@ -440,7 +435,7 @@ void RimSummaryMultiPlot::updatePlotTitles()
// Disable auto plot, as this is required to be able to include the information in the multi plot title
plot->enableAutoPlotTitle( false );
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper.get() );
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper );
plot->setDescription( plotName );
plot->updatePlotTitle();
}
@ -455,6 +450,22 @@ const RimSummaryNameHelper* RimSummaryMultiPlot::nameHelper() const
return m_nameHelper.get();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::setAutoTitlePlot( bool enable )
{
m_autoPlotTitles = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::setAutoTitleGraphs( bool enable )
{
m_autoPlotTitlesOnSubPlots = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -470,3 +481,59 @@ std::vector<RimSummaryPlot*> RimSummaryMultiPlot::summaryPlots() const
return typedPlots;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector<RimSummaryPlot*>& graphs )
{
auto columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_2;
auto rowCount = RimMultiPlot::RowCount::ROWS_2;
auto tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT;
bool showTitleSubGraph = true;
if ( graphs.size() == 1 )
{
showTitleSubGraph = false;
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY;
}
else if ( 4 < graphs.size() && graphs.size() <= 6 )
{
columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_3;
rowCount = RimMultiPlot::RowCount::ROWS_2;
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW;
}
else if ( 6 < graphs.size() && graphs.size() <= 12 )
{
columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4;
rowCount = RimMultiPlot::RowCount::ROWS_3;
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW;
}
else
{
columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4;
rowCount = RimMultiPlot::RowCount::ROWS_4;
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW;
}
plot->setAutoTitlePlot( true );
plot->setAutoTitleGraphs( showTitleSubGraph );
plot->m_multiPlot->setColumnCount( columnCount );
plot->m_multiPlot->setRowCount( rowCount );
plot->m_multiPlot->setShowPlotTitles( showTitleSubGraph );
plot->m_multiPlot->setTickmarkCount( tickmarkCount );
for ( auto graph : graphs )
{
plot->addPlot( graph );
graph->resolveReferencesRecursively();
graph->revokeMdiWindowStatus();
graph->setShowWindow( true );
graph->loadDataAndUpdate();
}
plot->loadDataAndUpdate();
}

View File

@ -48,12 +48,15 @@ public:
void zoomAll() override;
QString description() const override;
void addPlot( RimPlot* plot );
void addPlot( RimSummaryPlot* plot );
void updatePlotTitles();
const RimSummaryNameHelper* nameHelper() const;
static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector<RimPlot*>& plots );
void setAutoTitlePlot( bool enable );
void setAutoTitleGraphs( bool enable );
static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector<RimSummaryPlot*>& plots );
std::vector<RimSummaryDataSourceStepping::Axis> availableAxes() const override;
std::vector<RimSummaryCurve*> curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override;
@ -82,10 +85,13 @@ private:
std::vector<RimSummaryPlot*> summaryPlots() const;
static void insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector<RimSummaryPlot*>& graphs );
private:
caf::PdmField<QString> m_filterText;
caf::PdmField<bool> m_individualPlotPerVector;
caf::PdmField<bool> m_individualPlotPerDataSource;
caf::PdmField<bool> m_individualPlotPerObject;
caf::PdmField<bool> m_autoPlotTitles;
caf::PdmField<bool> m_autoPlotTitlesOnSubPlots;

View File

@ -20,7 +20,7 @@
#include "RiaColorTables.h"
#include "RiaFieldHandleTools.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryCurveDefinition.h"
#include "RiaSummaryTools.h"
#include "RiaTimeHistoryCurveResampler.h"
@ -662,10 +662,9 @@ std::vector<RimSummaryCurve*> RimSummaryPlot::visibleStackedSummaryCurvesForAxis
void RimSummaryPlot::updatePlotTitle()
{
m_nameHelperAllCurves->clear();
updateNameHelperWithCurveData( m_nameHelperAllCurves.get() );
if ( m_useAutoPlotTitle )
{
updateNameHelperWithCurveData( m_nameHelperAllCurves.get() );
m_description = m_nameHelperAllCurves->plotTitle();
}
@ -1199,6 +1198,9 @@ void RimSummaryPlot::updateTimeAxis()
switch ( tickmarkCountEnum )
{
case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_VERY_FEW:
maxTickmarkCount = 2;
break;
case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_FEW:
maxTickmarkCount = 4;
break;

View File

@ -109,9 +109,17 @@ RimSummaryPlotManager::RimSummaryPlotManager()
m_labelB.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() );
m_labelB.xmlCapability()->disableIO();
CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerObject );
CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerVector );
CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerDataSource );
CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", false, "Create Multiple Plots in One Window" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_createMultiPlot );
}
//--------------------------------------------------------------------------------------------------
@ -330,8 +338,9 @@ void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
uiOrdering.add( &m_selectedDataSources, false );
uiOrdering.add( &m_individualPlotPerVector );
uiOrdering.add( &m_individualPlotPerDataSource );
uiOrdering.add( &m_createMultiPlot );
uiOrdering.add( &m_individualPlotPerDataSource, false );
uiOrdering.add( &m_individualPlotPerObject );
uiOrdering.add( &m_createMultiPlot, false );
uiOrdering.add( &m_pushButtonAppend );
uiOrdering.add( &m_pushButtonReplace, { false } );
@ -379,30 +388,34 @@ void RimSummaryPlotManager::createNewPlot()
RicSummaryPlotBuilder plotBuilder;
plotBuilder.setAddresses( filteredAddressesFromSource );
plotBuilder.setDataSources( summaryCases, ensembles );
plotBuilder.setIndividualPlotPerAddress( m_individualPlotPerVector );
plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource );
RicSummaryPlotBuilder::RicGraphCurveGrouping groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE;
if ( m_individualPlotPerVector ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::SINGLE_CURVES;
if ( m_individualPlotPerObject ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::CURVES_FOR_OBJECT;
plotBuilder.setGrouping( groping );
auto plots = plotBuilder.createPlots();
if ( m_createMultiPlot )
{
std::vector<RimPlot*> plotsForMultiPlot;
for ( auto p : plots )
{
p->loadDataAndUpdate();
plotsForMultiPlot.push_back( dynamic_cast<RimPlot*>( p ) );
auto summaryPlots = plotBuilder.createPlots();
auto plot = RimSummaryMultiPlot::createAndAppendMultiPlot( summaryPlots );
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
}
RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot );
bool createStandardMultiPlot = false;
if ( createStandardMultiPlot )
{
auto myCopyOfPlots = plotBuilder.createPlots();
std::vector<RimPlot*> myRimPlots;
for ( auto p : myCopyOfPlots )
// Code to generate a standard multi plot
std::vector<RimPlot*> plotsForMultiPlot;
for ( auto p : plots )
{
p->loadDataAndUpdate();
myRimPlots.push_back( dynamic_cast<RimPlot*>( p ) );
plotsForMultiPlot.push_back( dynamic_cast<RimPlot*>( p ) );
}
RimSummaryMultiPlot::createAndAppendMultiPlot( myRimPlots );
RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot );
}
}
else

View File

@ -101,6 +101,7 @@ private:
caf::PdmField<bool> m_individualPlotPerVector;
caf::PdmField<bool> m_individualPlotPerDataSource;
caf::PdmField<bool> m_individualPlotPerObject;
caf::PdmField<bool> m_createMultiPlot;
caf::PdmField<QString> m_labelA;

View File

@ -18,18 +18,19 @@
#include "RimSummaryPlotNameHelper.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RifEclipseSummaryAddress.h"
#include "RimObjectiveFunctionTools.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RiuSummaryQuantityNameInfoProvider.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlotNameHelper::RimSummaryPlotNameHelper()
{
m_analyzer = std::make_unique<RiaSummaryAddressAnalyzer>();
}
//--------------------------------------------------------------------------------------------------
@ -39,7 +40,7 @@ void RimSummaryPlotNameHelper::clear()
{
m_summaryCases.clear();
m_ensembleCases.clear();
m_analyzer.clear();
m_analyzer->clear();
clearTitleSubStrings();
}
@ -49,7 +50,7 @@ void RimSummaryPlotNameHelper::clear()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotNameHelper::appendAddresses( const std::vector<RifEclipseSummaryAddress>& addresses )
{
m_analyzer.appendAddresses( addresses );
m_analyzer->appendAddresses( addresses );
extractPlotTitleSubStrings();
}
@ -103,7 +104,19 @@ QString RimSummaryPlotNameHelper::plotTitle() const
//--------------------------------------------------------------------------------------------------
bool RimSummaryPlotNameHelper::isPlotDisplayingSingleQuantity() const
{
return m_analyzer.quantities().size() == 1;
if ( m_analyzer->quantities().size() == 2 )
{
std::vector<std::string> strings;
for ( const auto& q : m_analyzer->quantities() )
strings.push_back( q );
auto first = RimObjectiveFunctionTools::nativeQuantityName( strings[0] );
auto second = RimObjectiveFunctionTools::nativeQuantityName( strings[1] );
if ( first == second ) return true;
}
return m_analyzer->quantities().size() == 1;
}
//--------------------------------------------------------------------------------------------------
@ -249,22 +262,22 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
{
clearTitleSubStrings();
auto wellNames = m_analyzer.wellNames();
auto wellGroupNames = m_analyzer.wellGroupNames();
auto regions = m_analyzer.regionNumbers();
auto blocks = m_analyzer.blocks();
auto categories = m_analyzer.categories();
auto wellNames = m_analyzer->wellNames();
auto wellGroupNames = m_analyzer->wellGroupNames();
auto regions = m_analyzer->regionNumbers();
auto blocks = m_analyzer->blocks();
auto categories = m_analyzer->categories();
if ( categories.size() == 1 )
{
m_titleQuantity = m_analyzer.quantityNameForTitle();
m_titleQuantity = m_analyzer->quantityNameForTitle();
if ( wellNames.size() == 1 )
{
m_titleWellName = *( wellNames.begin() );
{
auto segments = m_analyzer.wellSegmentNumbers( m_titleWellName );
auto segments = m_analyzer->wellSegmentNumbers( m_titleWellName );
if ( segments.size() == 1 )
{
m_titleSegment = std::to_string( *( segments.begin() ) );
@ -272,7 +285,7 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings()
}
{
auto completions = m_analyzer.wellCompletions( m_titleWellName );
auto completions = m_analyzer->wellCompletions( m_titleWellName );
if ( completions.size() == 1 )
{
m_titleCompletion = *( completions.begin() );

View File

@ -20,19 +20,20 @@
#include "RimSummaryNameHelper.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RifEclipseSummaryAddress.h"
#include "cafPdmPointer.h"
#include <QString>
#include <memory>
#include <string>
#include <vector>
class RimSummaryCurve;
class RimSummaryCase;
class RimSummaryCaseCollection;
class RiaSummaryAddressAnalyzer;
//==================================================================================================
//
@ -77,7 +78,7 @@ private:
std::set<RimSummaryCaseCollection*> setOfEnsembleCases() const;
private:
RiaSummaryCurveAnalyzer m_analyzer;
std::unique_ptr<RiaSummaryAddressAnalyzer> m_analyzer;
std::vector<caf::PdmPointer<RimSummaryCase>> m_summaryCases;
std::vector<caf::PdmPointer<RimSummaryCaseCollection>> m_ensembleCases;

View File

@ -20,7 +20,7 @@
#include "RiaGuiApplication.h"
#include "RiaStdStringTools.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryCurveDefinition.h"
#include "RimDataSourceSteppingTools.h"
@ -235,12 +235,12 @@ QList<caf::PdmOptionItemInfo>
std::map<QString, QString> displayAndValueStrings;
{
RiaSummaryCurveAnalyzer quantityAnalyzer;
RiaSummaryAddressAnalyzer quantityAnalyzer;
auto subset = RiaSummaryCurveAnalyzer::addressesForCategory( addresses, category );
auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category );
quantityAnalyzer.appendAddresses( subset );
RiaSummaryCurveAnalyzer analyzerForVisibleCurves;
RiaSummaryAddressAnalyzer analyzerForVisibleCurves;
analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses );
if ( analyzerForVisibleCurves.quantityNamesWithHistory().empty() )
@ -327,7 +327,7 @@ QList<caf::PdmOptionItemInfo>
if ( category != RifEclipseSummaryAddress::SUMMARY_INVALID )
{
RiaSummaryCurveAnalyzer analyzer;
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( addresses );
identifierTexts = analyzer.identifierTexts( category, secondaryIdentifier );
@ -586,7 +586,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
//--------------------------------------------------------------------------------------------------
caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify()
{
RiaSummaryCurveAnalyzer analyzer;
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( addressesForCurvesInPlot() );
if ( analyzer.wellNames().size() == 1 )
@ -779,7 +779,7 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::computeVisibleFi
std::vector<caf::PdmFieldHandle*> fieldsCommonForAllCurves;
{
RiaSummaryCurveAnalyzer analyzer;
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( addressesForCurvesInPlot() );
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;

View File

@ -60,7 +60,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseCollection-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifWellMeasurementReader-Test.cpp

View File

@ -1,11 +1,11 @@
#include "gtest/gtest.h"
#include "RiaSummaryCurveAnalyzer.h"
#include "RiaSummaryAddressAnalyzer.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSummaryCurveAnalyzer, WellCompletions )
TEST( RiaSummaryAddressAnalyzer, WellCompletions )
{
std::vector<RifEclipseSummaryAddress> addresses;
@ -45,7 +45,7 @@ TEST( RiaSummaryCurveAnalyzer, WellCompletions )
addresses.push_back( adr );
}
RiaSummaryCurveAnalyzer analyzer;
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( addresses );
EXPECT_EQ( 2u, analyzer.wellNames().size() );
@ -62,7 +62,7 @@ TEST( RiaSummaryCurveAnalyzer, WellCompletions )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSummaryCurveAnalyzer, WellSegments )
TEST( RiaSummaryAddressAnalyzer, WellSegments )
{
std::vector<RifEclipseSummaryAddress> addresses;
@ -96,7 +96,7 @@ TEST( RiaSummaryCurveAnalyzer, WellSegments )
addresses.push_back( adr );
}
RiaSummaryCurveAnalyzer analyzer;
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( addresses );
EXPECT_EQ( 2u, analyzer.wellNames().size() );
@ -111,7 +111,7 @@ TEST( RiaSummaryCurveAnalyzer, WellSegments )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSummaryCurveAnalyzer, CellBlocks )
TEST( RiaSummaryAddressAnalyzer, CellBlocks )
{
std::vector<RifEclipseSummaryAddress> addresses;
@ -132,7 +132,7 @@ TEST( RiaSummaryCurveAnalyzer, CellBlocks )
addresses.push_back( adr );
}
RiaSummaryCurveAnalyzer analyzer;
RiaSummaryAddressAnalyzer analyzer;
analyzer.appendAddresses( addresses );
auto blocks = analyzer.blocks();

View File

@ -621,6 +621,20 @@ void RiuMultiPlotPage::reinsertPlotWidgets()
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, showYAxis( row, column ) );
plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize );
{
int left = 0;
int top = 0;
int right = 0;
int bot = 0;
plotWidgets[visibleIndex]->getContentsMargins( &left, &top, &right, &bot );
bot = 40;
// Adjust the space below a graph to make sure the heading of the row below is closest to the
// corresponding graph
plotWidgets[visibleIndex]->setContentsMargins( left, top, right, bot );
}
plotWidgets[visibleIndex]->show();
if ( legends[visibleIndex] )