mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -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:
parent
b030e617c6
commit
172f891be9
@ -1,10 +1,8 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromSelectionFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateByShortcutFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.h
|
||||
@ -13,11 +11,9 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromSelectionFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateByShortcutFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.cpp
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor 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 "RicCreatePlotFromSelectionFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RicSummaryPlotTemplateTools.h"
|
||||
|
||||
#include "PlotTemplates/RimPlotTemplateFileItem.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreatePlotFromSelectionFeature, "RicCreatePlotFromSelectionFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreatePlotFromSelectionFeature::isCommandEnabled()
|
||||
{
|
||||
bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty();
|
||||
bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty();
|
||||
|
||||
return ( anySummaryCases || anySummaryCaseCollections );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreatePlotFromSelectionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath();
|
||||
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();
|
||||
auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections();
|
||||
|
||||
RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName );
|
||||
RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreatePlotFromSelectionFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Create Plot from Template" );
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimSummaryCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreatePlotFromSelectionFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -23,11 +23,10 @@
|
||||
|
||||
#include "RicSummaryPlotTemplateTools.h"
|
||||
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFile>
|
||||
@ -40,10 +39,7 @@ CAF_CMD_SOURCE_INIT( RicCreatePlotFromTemplateByShortcutFeature, "RicCreatePlotF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreatePlotFromTemplateByShortcutFeature::isCommandEnabled()
|
||||
{
|
||||
bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty();
|
||||
bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty();
|
||||
|
||||
return ( anySummaryCases || anySummaryCaseCollections );
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -70,11 +66,9 @@ void RicCreatePlotFromTemplateByShortcutFeature::onActionTriggered( bool isCheck
|
||||
fileName = fileNameSelectedInUi;
|
||||
}
|
||||
|
||||
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();
|
||||
auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections();
|
||||
auto newSummaryPlot = RicSummaryPlotTemplateTools::create( fileName );
|
||||
|
||||
RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName );
|
||||
RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( newSummaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -1,63 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor 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 "RicCreatePlotFromTemplateFeature.h"
|
||||
|
||||
#include "RicSummaryPlotTemplateTools.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreatePlotFromTemplateFeature, "RicCreatePlotFromTemplateFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreatePlotFromTemplateFeature::isCommandEnabled()
|
||||
{
|
||||
bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty();
|
||||
bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty();
|
||||
|
||||
return ( anySummaryCases || anySummaryCaseCollections );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreatePlotFromTemplateFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QString fileName = userData().toString();
|
||||
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();
|
||||
auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections();
|
||||
|
||||
RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName );
|
||||
|
||||
RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreatePlotFromTemplateFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Create Plot from Template" );
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) );
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreatePlotFromTemplateFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -163,7 +163,9 @@ QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPl
|
||||
auto fieldHandle = curve->findField( summaryFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
auto reference = fieldHandle->xmlCapability()->referenceString();
|
||||
auto reference =
|
||||
caf::PdmReferenceHelper::referenceFromFieldToObject( fieldHandle, curve->summaryCaseY() );
|
||||
|
||||
sourceStrings.insert( reference );
|
||||
}
|
||||
|
||||
@ -186,7 +188,9 @@ QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPl
|
||||
auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword );
|
||||
if ( fieldHandle )
|
||||
{
|
||||
auto reference = fieldHandle->xmlCapability()->referenceString();
|
||||
auto reference =
|
||||
caf::PdmReferenceHelper::referenceFromFieldToObject( fieldHandle,
|
||||
curveSet->summaryCaseCollection() );
|
||||
ensembleReferenceStrings.insert( reference );
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,9 @@ RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" );
|
||||
|
||||
CAF_PDM_InitField( &m_replaceWells, "ReplaceWells", true, "Wells" );
|
||||
CAF_PDM_InitField( &m_replaceGroups, "ReplaceGroups", true, "Groups" );
|
||||
CAF_PDM_InitField( &m_replaceRegions, "ReplaceRegions", true, "Regions" );
|
||||
CAF_PDM_InitField( &m_persistObjectNameForWells, "PersistObjectNameWells", false, "Wells" );
|
||||
CAF_PDM_InitField( &m_persistObjectNameGroups, "PersistObjectNameGroups", false, "Groups" );
|
||||
CAF_PDM_InitField( &m_persistObjectNameRegions, "PersistObjectNameRegions", false, "Regions" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -55,7 +55,7 @@ QString RicSaveMultiPlotTemplateFeatureSettings::filePath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWells() const
|
||||
{
|
||||
return m_replaceWells;
|
||||
return !m_persistObjectNameForWells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,7 +63,7 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWells() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForGroups() const
|
||||
{
|
||||
return m_replaceGroups;
|
||||
return !m_persistObjectNameGroups;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -71,7 +71,7 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForGroups() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForRegions() const
|
||||
{
|
||||
return m_replaceRegions;
|
||||
return !m_persistObjectNameRegions;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -82,10 +82,11 @@ void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfig
|
||||
uiOrdering.add( &m_filePath );
|
||||
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( "Use Placeholders for Objects" );
|
||||
group->add( &m_replaceWells );
|
||||
group->add( &m_replaceGroups );
|
||||
group->add( &m_replaceRegions );
|
||||
auto group = uiOrdering.addNewGroup( "Persist Object Names" );
|
||||
group->setCollapsedByDefault( true );
|
||||
group->add( &m_persistObjectNameForWells );
|
||||
group->add( &m_persistObjectNameGroups );
|
||||
group->add( &m_persistObjectNameRegions );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,8 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
caf::PdmField<bool> m_replaceWells;
|
||||
caf::PdmField<bool> m_replaceGroups;
|
||||
caf::PdmField<bool> m_replaceRegions;
|
||||
|
||||
caf::PdmField<bool> m_persistObjectNameForWells;
|
||||
caf::PdmField<bool> m_persistObjectNameGroups;
|
||||
caf::PdmField<bool> m_persistObjectNameRegions;
|
||||
};
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaSummaryAddressAnalyzer.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "PlotBuilderCommands/RicSummaryPlotBuilder.h"
|
||||
#include "RicSelectPlotTemplateUi.h"
|
||||
@ -38,6 +39,7 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
@ -72,6 +74,108 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFil
|
||||
return dynamic_cast<RimSummaryMultiPlot*>( obj );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileName )
|
||||
{
|
||||
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();
|
||||
auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections();
|
||||
|
||||
auto summaryAddressCollections = RicSummaryPlotTemplateTools::selectedSummaryAddressCollections();
|
||||
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<QString> groupNames;
|
||||
std::vector<QString> regions;
|
||||
std::set<RimSummaryCase*> caseSet;
|
||||
std::set<RimSummaryCaseCollection*> caseCollectionSet;
|
||||
|
||||
if ( summaryAddressCollections.empty() )
|
||||
{
|
||||
RiaSummaryAddressAnalyzer analyzer;
|
||||
|
||||
if ( !sumCases.empty() )
|
||||
{
|
||||
auto firstCase = sumCases.front();
|
||||
|
||||
analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() );
|
||||
}
|
||||
else if ( !sumCaseCollections.empty() )
|
||||
{
|
||||
auto caseCollection = sumCaseCollections.front();
|
||||
|
||||
if ( !caseCollection->allSummaryCases().empty() )
|
||||
{
|
||||
auto firstCase = caseCollection->allSummaryCases().front();
|
||||
|
||||
analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !analyzer.wellNames().empty() )
|
||||
wellNames.push_back( QString::fromStdString( *( analyzer.wellNames().begin() ) ) );
|
||||
if ( !analyzer.groupNames().empty() )
|
||||
groupNames.push_back( QString::fromStdString( *( analyzer.groupNames().begin() ) ) );
|
||||
if ( !analyzer.regionNumbers().empty() )
|
||||
regions.push_back( QString::number( *( analyzer.regionNumbers().begin() ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
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 nullptr;
|
||||
|
||||
collections->addSummaryMultiPlot( newSummaryPlot );
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
||||
RicSummaryPlotTemplateTools::setValuesForPlaceholders( newSummaryPlot,
|
||||
sumCases,
|
||||
sumCaseCollections,
|
||||
wellNames,
|
||||
groupNames,
|
||||
regions );
|
||||
newSummaryPlot->initAfterReadRecursively();
|
||||
newSummaryPlot->loadDataAndUpdate();
|
||||
collections->updateConnectedEditors();
|
||||
|
||||
return newSummaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,6 +43,8 @@ class RicSummaryPlotTemplateTools
|
||||
public:
|
||||
static RimSummaryMultiPlot* createMultiPlotFromTemplateFile( const QString& fileName );
|
||||
|
||||
static RimSummaryMultiPlot* create( const QString& fileName );
|
||||
|
||||
static void setValuesForPlaceholders( RimSummaryMultiPlot* summaryMultiPlot,
|
||||
const std::vector<RimSummaryCase*>& selectedSummaryCases,
|
||||
const std::vector<RimSummaryCaseCollection*>& selectedEnsembles,
|
||||
|
@ -1039,6 +1039,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
else if ( dynamic_cast<RimSummaryAddressCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicCreateMultiPlotFromSelectionFeature";
|
||||
menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature";
|
||||
}
|
||||
|
||||
if ( dynamic_cast<Rim3dView*>( firstUiItem ) )
|
||||
@ -1101,7 +1102,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
|
||||
if ( dynamic_cast<RimSummaryCase*>( firstUiItem ) || dynamic_cast<RimSummaryCaseCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicCreatePlotFromSelectionFeature";
|
||||
menuBuilder << "RicCreateMultiPlotFromSelectionFeature";
|
||||
menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user