mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Remove obsolete template commands (#8851)
* Remove obsolete template commands Use first object in object list when creating plots for templates and a case is selected. (use first well in well list, first group in group list, ...) * Always create the reference string
This commit is contained in:
@@ -18,25 +18,11 @@
|
||||
|
||||
#include "RicCreateMultiPlotFromSelectionFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RicSummaryPlotTemplateTools.h"
|
||||
|
||||
#include "PlotTemplates/RimPlotTemplateFileItem.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateMultiPlotFromSelectionFeature, "RicCreateMultiPlotFromSelectionFeature" );
|
||||
@@ -54,67 +40,9 @@ bool RicCreateMultiPlotFromSelectionFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath();
|
||||
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();
|
||||
auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections();
|
||||
QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath();
|
||||
|
||||
auto summaryAddressCollections = RicSummaryPlotTemplateTools::selectedSummaryAddressCollections();
|
||||
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<QString> groupNames;
|
||||
std::vector<QString> regions;
|
||||
std::set<RimSummaryCase*> caseSet;
|
||||
std::set<RimSummaryCaseCollection*> caseCollectionSet;
|
||||
|
||||
for ( auto a : summaryAddressCollections )
|
||||
{
|
||||
if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL )
|
||||
{
|
||||
wellNames.push_back( a->name() );
|
||||
}
|
||||
else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP )
|
||||
{
|
||||
groupNames.push_back( a->name() );
|
||||
}
|
||||
else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION )
|
||||
{
|
||||
regions.push_back( a->name() );
|
||||
}
|
||||
|
||||
auto sumCase = RiaSummaryTools::summaryCaseById( a->caseId() );
|
||||
if ( sumCase ) caseSet.insert( sumCase );
|
||||
|
||||
auto ensemble = RiaSummaryTools::ensembleById( a->ensembleId() );
|
||||
if ( ensemble ) caseCollectionSet.insert( ensemble );
|
||||
}
|
||||
|
||||
for ( auto sumCase : caseSet )
|
||||
{
|
||||
sumCases.push_back( sumCase );
|
||||
}
|
||||
for ( auto sumCaseCollection : caseCollectionSet )
|
||||
{
|
||||
sumCaseCollections.push_back( sumCaseCollection );
|
||||
}
|
||||
|
||||
auto proj = RimProject::current();
|
||||
auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection();
|
||||
|
||||
auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName );
|
||||
if ( !newSummaryPlot ) return;
|
||||
|
||||
collections->addSummaryMultiPlot( newSummaryPlot );
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
||||
RicSummaryPlotTemplateTools::setValuesForPlaceholders( newSummaryPlot,
|
||||
sumCases,
|
||||
sumCaseCollections,
|
||||
wellNames,
|
||||
groupNames,
|
||||
regions );
|
||||
newSummaryPlot->initAfterReadRecursively();
|
||||
newSummaryPlot->loadDataAndUpdate();
|
||||
collections->updateConnectedEditors();
|
||||
auto newSummaryPlot = RicSummaryPlotTemplateTools::create( fileName );
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newSummaryPlot );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user