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 "RiuMainWindow.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
|
||||||
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
|
||||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||||
@ -84,7 +85,12 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked )
|
|||||||
addSummaryCases( cases );
|
addSummaryCases( cases );
|
||||||
if ( !cases.empty() )
|
if ( !cases.empty() )
|
||||||
{
|
{
|
||||||
RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases.front() );
|
auto objectToSelect = RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases.front() );
|
||||||
|
if ( objectToSelect )
|
||||||
|
{
|
||||||
|
RiuPlotMainWindowTools::setExpanded( objectToSelect );
|
||||||
|
RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addCasesToGroupIfRelevant( cases );
|
addCasesToGroupIfRelevant( cases );
|
||||||
@ -95,8 +101,6 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked )
|
|||||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||||
if ( mainPlotWindow && !cases.empty() )
|
if ( mainPlotWindow && !cases.empty() )
|
||||||
{
|
{
|
||||||
mainPlotWindow->selectAsCurrentItem( cases.back() );
|
|
||||||
|
|
||||||
mainPlotWindow->updateSummaryPlotToolBar();
|
mainPlotWindow->updateSummaryPlotToolBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,13 +138,17 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr
|
|||||||
addSummaryCases( *cases );
|
addSummaryCases( *cases );
|
||||||
if ( !cases->empty() && doCreateDefaultPlot )
|
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();
|
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||||
if ( mainPlotWindow && !cases->empty() )
|
if ( mainPlotWindow && !cases->empty() )
|
||||||
{
|
{
|
||||||
mainPlotWindow->selectAsCurrentItem( cases->back() );
|
|
||||||
mainPlotWindow->updateSummaryPlotToolBar();
|
mainPlotWindow->updateSummaryPlotToolBar();
|
||||||
|
|
||||||
// Close main window if there are no eclipse cases imported
|
// Close main window if there are no eclipse cases imported
|
||||||
|
@ -131,7 +131,12 @@ void RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( RimSummaryPlotCollection*
|
|||||||
{
|
{
|
||||||
if ( summaryPlotCollection->summaryPlots.empty() )
|
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 =
|
RimSummaryPlotCollection* summaryPlotCollection =
|
||||||
RiaApplication::instance()->project()->mainPlotCollection->summaryPlotCollection();
|
RiaApplication::instance()->project()->mainPlotCollection->summaryPlotCollection();
|
||||||
|
|
||||||
|
caf::PdmObject* itemToSelect = nullptr;
|
||||||
|
|
||||||
if ( summaryPlotCollection && summaryCase &&
|
if ( summaryPlotCollection && summaryCase &&
|
||||||
!RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter().isEmpty() )
|
!RiaApplication::instance()->preferences()->defaultSummaryCurvesTextFilter().isEmpty() )
|
||||||
{
|
{
|
||||||
@ -156,12 +163,17 @@ void RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summar
|
|||||||
|
|
||||||
summaryPlotCollection->updateConnectedEditors();
|
summaryPlotCollection->updateConnectedEditors();
|
||||||
|
|
||||||
caf::PdmObject* itemToSelect = plot;
|
if ( curves.size() )
|
||||||
if ( curves.size() ) itemToSelect = curves[0];
|
{
|
||||||
|
itemToSelect = curves[0];
|
||||||
RiuPlotMainWindowTools::setExpanded( itemToSelect );
|
}
|
||||||
RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect );
|
else
|
||||||
|
{
|
||||||
|
itemToSelect = plot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return itemToSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse )
|
RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse )
|
||||||
@ -275,7 +287,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin
|
|||||||
QStringList gridFileNames;
|
QStringList gridFileNames;
|
||||||
QString ensembleColoringParameter;
|
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 )
|
for ( int optionIdx = 0; optionIdx < arguments.size(); ++optionIdx )
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
class PdmObject;
|
||||||
|
}
|
||||||
|
|
||||||
class RimSummaryCurve;
|
class RimSummaryCurve;
|
||||||
class RimSummaryPlot;
|
class RimSummaryPlot;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
@ -35,7 +40,7 @@ public:
|
|||||||
static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||||
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
static std::vector<RimSummaryCurve*> addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase );
|
||||||
static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, 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 );
|
static void createSummaryPlotsFromArgumentLine( const QStringList& arguments );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user