mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4926 Summary Templates : Set curve as selected object when case is imported
This commit is contained in:
parent
29c3ce0d06
commit
f2fad7a975
@ -41,6 +41,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
@ -84,7 +85,12 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked )
|
||||
addSummaryCases( cases );
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases.front() );
|
||||
auto objectToSelect = RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases.front() );
|
||||
if ( objectToSelect )
|
||||
{
|
||||
RiuPlotMainWindowTools::setExpanded( objectToSelect );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||
}
|
||||
}
|
||||
|
||||
addCasesToGroupIfRelevant( cases );
|
||||
@ -95,8 +101,6 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked )
|
||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||
if ( mainPlotWindow && !cases.empty() )
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem( cases.back() );
|
||||
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
@ -134,13 +138,17 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr
|
||||
addSummaryCases( *cases );
|
||||
if ( !cases->empty() && doCreateDefaultPlot )
|
||||
{
|
||||
RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases->back() );
|
||||
auto objectToSelect = RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases->back() );
|
||||
if ( objectToSelect )
|
||||
{
|
||||
RiuPlotMainWindowTools::setExpanded( objectToSelect );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||
}
|
||||
}
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||
if ( mainPlotWindow && !cases->empty() )
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem( cases->back() );
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
|
||||
// Close main window if there are no eclipse cases imported
|
||||
|
@ -131,7 +131,12 @@ void RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( RimSummaryPlotCollection*
|
||||
{
|
||||
if ( summaryPlotCollection->summaryPlots.empty() )
|
||||
{
|
||||
createDefaultSummaryPlot( summaryCase );
|
||||
auto objectToSelect = createDefaultSummaryPlot( summaryCase );
|
||||
if ( objectToSelect )
|
||||
{
|
||||
RiuPlotMainWindowTools::setExpanded( objectToSelect );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -139,11 +144,13 @@ void RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( RimSummaryPlotCollection*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summaryCase )
|
||||
caf::PdmObject* RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summaryCase )
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotCollection =
|
||||
RiaApplication::instance()->project()->mainPlotCollection->summaryPlotCollection();
|
||||
|
||||
caf::PdmObject* itemToSelect = nullptr;
|
||||
|
||||
if ( summaryPlotCollection && summaryCase &&
|
||||
!RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter().isEmpty() )
|
||||
{
|
||||
@ -156,12 +163,17 @@ void RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summar
|
||||
|
||||
summaryPlotCollection->updateConnectedEditors();
|
||||
|
||||
caf::PdmObject* itemToSelect = plot;
|
||||
if ( curves.size() ) itemToSelect = curves[0];
|
||||
|
||||
RiuPlotMainWindowTools::setExpanded( itemToSelect );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect );
|
||||
if ( curves.size() )
|
||||
{
|
||||
itemToSelect = curves[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
itemToSelect = plot;
|
||||
}
|
||||
}
|
||||
|
||||
return itemToSelect;
|
||||
}
|
||||
|
||||
RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse )
|
||||
@ -275,7 +287,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
||||
QStringList gridFileNames;
|
||||
QString ensembleColoringParameter;
|
||||
|
||||
std::set<QString> validOptions = {"-help", "-h", "-nl", "-s", "-n", "-e", "-c", "-cl"};
|
||||
std::set<QString> validOptions = { "-help", "-h", "-nl", "-s", "-n", "-e", "-c", "-cl" };
|
||||
|
||||
for ( int optionIdx = 0; optionIdx < arguments.size(); ++optionIdx )
|
||||
{
|
||||
|
@ -22,6 +22,11 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryCase;
|
||||
@ -35,7 +40,7 @@ public:
|
||||
static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||
static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase );
|
||||
static void createDefaultSummaryPlot( RimSummaryCase* summaryCase );
|
||||
static caf::PdmObject* createDefaultSummaryPlot( RimSummaryCase* summaryCase );
|
||||
|
||||
static void createSummaryPlotsFromArgumentLine( const QStringList& arguments );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user