mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Allow drag'n'drop of realizations into summary plots
Improve "Create Summary Case Group" feature to not delete selected realizations from the source collection.
This commit is contained in:
parent
93f754102d
commit
85d3f98f91
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RicCreateSummaryCaseCollectionFeature.h"
|
||||
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
@ -38,11 +40,9 @@ RimSummaryCaseCollection* RicCreateSummaryCaseCollectionFeature::groupSummaryCas
|
||||
const QString& groupName,
|
||||
bool isEnsemble )
|
||||
{
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection = nullptr;
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection();
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
cases[0]->firstAncestorOrThisOfTypeAsserted( summaryCaseMainCollection );
|
||||
|
||||
auto newGroup = summaryCaseMainCollection->addCaseCollection( cases, groupName, isEnsemble );
|
||||
summaryCaseMainCollection->updateConnectedEditors();
|
||||
|
||||
@ -84,7 +84,17 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
if ( selection.size() == 0 ) return;
|
||||
|
||||
groupSummaryCases( selection, "" );
|
||||
std::vector<RimSummaryCase*> duplicates;
|
||||
|
||||
for ( const auto sumCase : selection )
|
||||
{
|
||||
auto copy =
|
||||
dynamic_cast<RimSummaryCase*>( sumCase->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
duplicates.push_back( copy );
|
||||
}
|
||||
|
||||
groupSummaryCases( duplicates, "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -92,6 +102,6 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateSummaryCaseCollectionFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Group Summary Cases" );
|
||||
actionToSetup->setText( "Create Summary Case Group" );
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryGroup16x16.png" ) );
|
||||
}
|
||||
|
@ -1005,10 +1005,13 @@ void RimSummaryCaseCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
|
||||
}
|
||||
m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering );
|
||||
|
||||
auto subnode = uiTreeOrdering.add( "Realizations", ":/Folder.png" );
|
||||
for ( auto& smcase : m_cases )
|
||||
if ( !m_cases.empty() )
|
||||
{
|
||||
subnode->add( smcase );
|
||||
auto subnode = uiTreeOrdering.add( "Realizations", ":/Folder.png" );
|
||||
for ( auto& smcase : m_cases )
|
||||
{
|
||||
subnode->add( smcase );
|
||||
}
|
||||
}
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
#include "RimSummaryPlotSourceStepping.h"
|
||||
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
#include "RiuSummaryVectorSelectionUi.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
@ -1823,6 +1823,115 @@ bool RimSummaryPlot::autoPlotTitle() const
|
||||
return m_useAutoPlotTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase )
|
||||
{
|
||||
int newCurves = 0;
|
||||
|
||||
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCase*>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
dataVectorMap[curveAddress].insert( curve->summaryCaseY() );
|
||||
}
|
||||
|
||||
for ( const auto& [addr, cases] : dataVectorMap )
|
||||
{
|
||||
if ( cases.count( summaryCase ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( addr, summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
|
||||
return newCurves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* addressCollection )
|
||||
{
|
||||
int newCurves = 0;
|
||||
auto droppedName = addressCollection->name().toStdString();
|
||||
|
||||
if ( addressCollection->isEnsemble() ) return 0;
|
||||
|
||||
auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() );
|
||||
if ( summaryCase )
|
||||
{
|
||||
if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL )
|
||||
{
|
||||
std::map<std::string, std::set<std::string>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL )
|
||||
{
|
||||
dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellName() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto& [vectorName, wellNames] : dataVectorMap )
|
||||
{
|
||||
if ( wellNames.count( droppedName ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( RifEclipseSummaryAddress::wellAddress( vectorName, droppedName ), summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP )
|
||||
{
|
||||
std::map<std::string, std::set<std::string>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP )
|
||||
{
|
||||
dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellGroupName() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto& [vectorName, wellGroupNames] : dataVectorMap )
|
||||
{
|
||||
if ( wellGroupNames.count( droppedName ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( RifEclipseSummaryAddress::wellGroupAddress( vectorName, droppedName ), summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION )
|
||||
{
|
||||
std::map<std::string, std::set<int>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION )
|
||||
{
|
||||
dataVectorMap[curveAddress.quantityName()].insert( curveAddress.regionNumber() );
|
||||
}
|
||||
}
|
||||
|
||||
int droppedRegion = std::stoi( droppedName );
|
||||
|
||||
for ( auto& [vectorName, regionNumbers] : dataVectorMap )
|
||||
{
|
||||
if ( regionNumbers.count( droppedRegion ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( RifEclipseSummaryAddress::regionAddress( vectorName, droppedRegion ), summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newCurves;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1832,6 +1941,13 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
||||
|
||||
for ( auto obj : objects )
|
||||
{
|
||||
auto summaryCase = dynamic_cast<RimSummaryCase*>( obj );
|
||||
if ( summaryCase )
|
||||
{
|
||||
newCurves += handleSummaryCaseDrop( summaryCase );
|
||||
continue;
|
||||
}
|
||||
|
||||
auto summaryAdr = dynamic_cast<RimSummaryAddress*>( obj );
|
||||
if ( summaryAdr )
|
||||
{
|
||||
@ -1843,7 +1959,6 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
||||
addNewEnsembleCurveY( summaryAdr->address(), ensemble );
|
||||
newCurves++;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1859,79 +1974,7 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
||||
auto addressCollection = dynamic_cast<RimSummaryAddressCollection*>( obj );
|
||||
if ( addressCollection )
|
||||
{
|
||||
auto droppedName = addressCollection->name().toStdString();
|
||||
|
||||
if ( addressCollection->isEnsemble() ) continue;
|
||||
|
||||
auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() );
|
||||
if ( summaryCase )
|
||||
{
|
||||
if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL )
|
||||
{
|
||||
std::map<std::string, std::set<std::string>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL )
|
||||
{
|
||||
dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellName() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto& [vectorName, wellNames] : dataVectorMap )
|
||||
{
|
||||
if ( wellNames.count( droppedName ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( RifEclipseSummaryAddress::wellAddress( vectorName, droppedName ), summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP )
|
||||
{
|
||||
std::map<std::string, std::set<std::string>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP )
|
||||
{
|
||||
dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellGroupName() );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto& [vectorName, wellGroupNames] : dataVectorMap )
|
||||
{
|
||||
if ( wellGroupNames.count( droppedName ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( RifEclipseSummaryAddress::wellGroupAddress( vectorName, droppedName ), summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION )
|
||||
{
|
||||
std::map<std::string, std::set<int>> dataVectorMap;
|
||||
|
||||
for ( auto& curve : summaryCurves() )
|
||||
{
|
||||
const auto curveAddress = curve->summaryAddressY();
|
||||
if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION )
|
||||
{
|
||||
dataVectorMap[curveAddress.quantityName()].insert( curveAddress.regionNumber() );
|
||||
}
|
||||
}
|
||||
|
||||
int droppedRegion = std::stoi( droppedName );
|
||||
|
||||
for ( auto& [vectorName, regionNumbers] : dataVectorMap )
|
||||
{
|
||||
if ( regionNumbers.count( droppedRegion ) > 0 ) continue;
|
||||
|
||||
addNewCurveY( RifEclipseSummaryAddress::regionAddress( vectorName, droppedRegion ), summaryCase );
|
||||
newCurves++;
|
||||
}
|
||||
}
|
||||
}
|
||||
newCurves += handleAddressCollectionDrop( addressCollection );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
class PdmUiTreeOrdering;
|
||||
class RimAsciiDataCurve;
|
||||
class RimGridTimeHistoryCurve;
|
||||
class RimSummaryAddressCollection;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimSummaryCurve;
|
||||
@ -276,6 +277,9 @@ private:
|
||||
bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
|
||||
bool updateStackedCurveDataForRelevantAxes();
|
||||
|
||||
int handleSummaryCaseDrop( RimSummaryCase* summaryCase );
|
||||
int handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl );
|
||||
|
||||
private:
|
||||
#ifdef USE_QTCHARTS
|
||||
caf::PdmField<bool> m_useQtChartsPlot;
|
||||
|
Loading…
Reference in New Issue
Block a user