mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8995 Drag drop summary vector : Optionally include history vector
This commit is contained in:
parent
6a7e2f6033
commit
c7cf6d19f8
@ -173,6 +173,12 @@ RiaPreferencesSummary::RiaPreferencesSummary()
|
|||||||
|
|
||||||
CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" );
|
CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" );
|
||||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase );
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase );
|
||||||
|
|
||||||
|
CAF_PDM_InitField( &m_appendHistoryVectorForDragDrop,
|
||||||
|
"appendHistoryVectorForDragDrop",
|
||||||
|
false,
|
||||||
|
"Append History Vector for Drag/Drop" );
|
||||||
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendHistoryVectorForDragDrop );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -273,6 +279,7 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr
|
|||||||
|
|
||||||
uiOrdering.add( &m_defaultSummaryHistoryCurveStyle );
|
uiOrdering.add( &m_defaultSummaryHistoryCurveStyle );
|
||||||
uiOrdering.add( &m_curveColorByPhase );
|
uiOrdering.add( &m_curveColorByPhase );
|
||||||
|
uiOrdering.add( &m_appendHistoryVectorForDragDrop );
|
||||||
|
|
||||||
uiOrdering.add( &m_showSummaryTimeAsLongString );
|
uiOrdering.add( &m_showSummaryTimeAsLongString );
|
||||||
|
|
||||||
@ -346,6 +353,14 @@ bool RiaPreferencesSummary::colorCurvesByPhase() const
|
|||||||
return m_curveColorByPhase();
|
return m_curveColorByPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiaPreferencesSummary::appendHistoryVectorForDragDrop() const
|
||||||
|
{
|
||||||
|
return m_appendHistoryVectorForDragDrop();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -101,6 +101,7 @@ public:
|
|||||||
SummaryRestartFilesImportMode summaryEnsembleImportMode() const;
|
SummaryRestartFilesImportMode summaryEnsembleImportMode() const;
|
||||||
QString defaultSummaryCurvesTextFilter() const;
|
QString defaultSummaryCurvesTextFilter() const;
|
||||||
bool colorCurvesByPhase() const;
|
bool colorCurvesByPhase() const;
|
||||||
|
bool appendHistoryVectorForDragDrop() const;
|
||||||
|
|
||||||
SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const;
|
SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const;
|
||||||
|
|
||||||
@ -129,6 +130,7 @@ private:
|
|||||||
caf::PdmField<QString> m_defaultSummaryCurvesTextFilter;
|
caf::PdmField<QString> m_defaultSummaryCurvesTextFilter;
|
||||||
caf::PdmField<SummaryHistoryCurveStyleModeType> m_defaultSummaryHistoryCurveStyle;
|
caf::PdmField<SummaryHistoryCurveStyleModeType> m_defaultSummaryHistoryCurveStyle;
|
||||||
caf::PdmField<bool> m_curveColorByPhase;
|
caf::PdmField<bool> m_curveColorByPhase;
|
||||||
|
caf::PdmField<bool> m_appendHistoryVectorForDragDrop;
|
||||||
|
|
||||||
caf::PdmField<bool> m_showSummaryTimeAsLongString;
|
caf::PdmField<bool> m_showSummaryTimeAsLongString;
|
||||||
caf::PdmField<bool> m_useMultipleThreadsWhenLoadingSummaryCases;
|
caf::PdmField<bool> m_useMultipleThreadsWhenLoadingSummaryCases;
|
||||||
|
@ -23,12 +23,14 @@
|
|||||||
#include "RiaFieldHandleTools.h"
|
#include "RiaFieldHandleTools.h"
|
||||||
#include "RiaPlotDefines.h"
|
#include "RiaPlotDefines.h"
|
||||||
#include "RiaPreferences.h"
|
#include "RiaPreferences.h"
|
||||||
|
#include "RiaPreferencesSummary.h"
|
||||||
#include "RiaRegressionTestRunner.h"
|
#include "RiaRegressionTestRunner.h"
|
||||||
#include "RiaStdStringTools.h"
|
#include "RiaStdStringTools.h"
|
||||||
#include "RiaSummaryAddressAnalyzer.h"
|
#include "RiaSummaryAddressAnalyzer.h"
|
||||||
#include "RiaSummaryCurveDefinition.h"
|
#include "RiaSummaryCurveDefinition.h"
|
||||||
#include "RiaSummaryTools.h"
|
#include "RiaSummaryTools.h"
|
||||||
#include "RiaTimeHistoryCurveResampler.h"
|
#include "RiaTimeHistoryCurveResampler.h"
|
||||||
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
#include "RicfCommandObject.h"
|
#include "RicfCommandObject.h"
|
||||||
|
|
||||||
@ -1922,8 +1924,15 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryCaseD
|
|||||||
|
|
||||||
for ( auto& curve : summaryCurves() )
|
for ( auto& curve : summaryCurves() )
|
||||||
{
|
{
|
||||||
const auto curveAddress = curve->summaryAddressY();
|
const auto addr = curve->summaryAddressY();
|
||||||
dataVectorMap[curveAddress].insert( curve->summaryCaseY() );
|
dataVectorMap[addr].insert( curve->summaryCaseY() );
|
||||||
|
|
||||||
|
if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() )
|
||||||
|
{
|
||||||
|
auto historyAddr = addr;
|
||||||
|
historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() );
|
||||||
|
dataVectorMap[historyAddr].insert( curve->summaryCaseY() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( const auto& [addr, cases] : dataVectorMap )
|
for ( const auto& [addr, cases] : dataVectorMap )
|
||||||
@ -1975,32 +1984,45 @@ std::pair<int, std::vector<RimSummaryCurve*>>
|
|||||||
{
|
{
|
||||||
auto newCurveDef = curveDef;
|
auto newCurveDef = curveDef;
|
||||||
auto curveAdr = newCurveDef.summaryAddress();
|
auto curveAdr = newCurveDef.summaryAddress();
|
||||||
|
std::string objectIdentifierString;
|
||||||
if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_WELL ) &&
|
if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_WELL ) &&
|
||||||
( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) )
|
( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) )
|
||||||
{
|
{
|
||||||
auto currentObjectString = curveAdr.wellName();
|
objectIdentifierString = curveAdr.wellName();
|
||||||
curveAdr.setWellName( droppedName );
|
curveAdr.setWellName( droppedName );
|
||||||
newCurveDef.setSummaryAddress( curveAdr );
|
newCurveDef.setSummaryAddress( curveAdr );
|
||||||
newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString );
|
|
||||||
}
|
}
|
||||||
else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_GROUP ) &&
|
else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_GROUP ) &&
|
||||||
( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) )
|
( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) )
|
||||||
{
|
{
|
||||||
auto currentObjectString = curveAdr.groupName();
|
objectIdentifierString = curveAdr.groupName();
|
||||||
curveAdr.setGroupName( droppedName );
|
curveAdr.setGroupName( droppedName );
|
||||||
newCurveDef.setSummaryAddress( curveAdr );
|
newCurveDef.setSummaryAddress( curveAdr );
|
||||||
newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString );
|
|
||||||
}
|
}
|
||||||
else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_REGION ) &&
|
else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_REGION ) &&
|
||||||
( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) )
|
( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) )
|
||||||
{
|
{
|
||||||
auto currentObjectString = std::to_string( curveAdr.regionNumber() );
|
objectIdentifierString = std::to_string( curveAdr.regionNumber() );
|
||||||
|
|
||||||
int droppedRegion = std::stoi( droppedName );
|
int droppedRegion = std::stoi( droppedName );
|
||||||
|
|
||||||
curveAdr.setRegion( droppedRegion );
|
curveAdr.setRegion( droppedRegion );
|
||||||
newCurveDef.setSummaryAddress( curveAdr );
|
newCurveDef.setSummaryAddress( curveAdr );
|
||||||
newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString );
|
}
|
||||||
|
|
||||||
|
if ( !objectIdentifierString.empty() )
|
||||||
|
{
|
||||||
|
newCurveDefsWithObjectNames[newCurveDef].insert( objectIdentifierString );
|
||||||
|
const auto& addr = curveDef.summaryAddress();
|
||||||
|
if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() )
|
||||||
|
{
|
||||||
|
auto historyAddr = addr;
|
||||||
|
historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() );
|
||||||
|
|
||||||
|
auto historyCurveDef = newCurveDef;
|
||||||
|
historyCurveDef.setSummaryAddress( historyAddr );
|
||||||
|
newCurveDefsWithObjectNames[historyCurveDef].insert( objectIdentifierString );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2032,21 +2054,30 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddre
|
|||||||
int newCurves = 0;
|
int newCurves = 0;
|
||||||
std::vector<RimSummaryCurve*> curves;
|
std::vector<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
|
std::vector<RifEclipseSummaryAddress> newCurveAddresses;
|
||||||
|
newCurveAddresses.push_back( summaryAddr->address() );
|
||||||
|
if ( !summaryAddr->address().isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() )
|
||||||
|
{
|
||||||
|
auto historyAddr = summaryAddr->address();
|
||||||
|
historyAddr.setVectorName( summaryAddr->address().vectorName() + RifReaderEclipseSummary::historyIdentifier() );
|
||||||
|
newCurveAddresses.push_back( historyAddr );
|
||||||
|
}
|
||||||
|
|
||||||
if ( summaryAddr->isEnsemble() )
|
if ( summaryAddr->isEnsemble() )
|
||||||
{
|
{
|
||||||
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCaseCollection*>> dataVectorMap;
|
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCaseCollection*>> dataVectorMap;
|
||||||
|
|
||||||
for ( auto& curve : curveSets() )
|
for ( auto& curve : curveSets() )
|
||||||
{
|
{
|
||||||
const auto curveAddress = curve->summaryAddress();
|
const auto addr = curve->summaryAddress();
|
||||||
dataVectorMap[curveAddress].insert( curve->summaryCaseCollection() );
|
dataVectorMap[addr].insert( curve->summaryCaseCollection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ensemble = RiaSummaryTools::ensembleById( summaryAddr->ensembleId() );
|
auto ensemble = RiaSummaryTools::ensembleById( summaryAddr->ensembleId() );
|
||||||
if ( ensemble )
|
if ( ensemble )
|
||||||
{
|
{
|
||||||
RifEclipseSummaryAddress droppedAddress = summaryAddr->address();
|
for ( const auto& droppedAddress : newCurveAddresses )
|
||||||
|
{
|
||||||
bool skipAddress = false;
|
bool skipAddress = false;
|
||||||
|
|
||||||
if ( dataVectorMap.count( droppedAddress ) > 0 )
|
if ( dataVectorMap.count( droppedAddress ) > 0 )
|
||||||
@ -2061,21 +2092,22 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCase*>> dataVectorMap;
|
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCase*>> dataVectorMap;
|
||||||
|
|
||||||
for ( auto& curve : summaryCurves() )
|
for ( auto& curve : summaryCurves() )
|
||||||
{
|
{
|
||||||
const auto curveAddress = curve->summaryAddressY();
|
const auto addr = curve->summaryAddressY();
|
||||||
dataVectorMap[curveAddress].insert( curve->summaryCaseY() );
|
dataVectorMap[addr].insert( curve->summaryCaseY() );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() );
|
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() );
|
||||||
if ( summaryCase )
|
if ( summaryCase )
|
||||||
{
|
{
|
||||||
RifEclipseSummaryAddress droppedAddress = summaryAddr->address();
|
for ( const auto& droppedAddress : newCurveAddresses )
|
||||||
|
{
|
||||||
bool skipAddress = false;
|
bool skipAddress = false;
|
||||||
|
|
||||||
if ( dataVectorMap.count( droppedAddress ) > 0 )
|
if ( dataVectorMap.count( droppedAddress ) > 0 )
|
||||||
@ -2090,6 +2122,7 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return { newCurves, curves };
|
return { newCurves, curves };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user