#2958 Ensemble curve sets. Make ensemble selected by default on 'new summary plot' command

This commit is contained in:
Bjørn Erik Jensen
2018-05-28 13:26:56 +02:00
parent 135d58b57e
commit 278c8b672b
9 changed files with 44 additions and 21 deletions

View File

@@ -80,11 +80,20 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
std::vector<RimSummaryCase*> selectedCases = caf::selectedObjectsByType<RimSummaryCase*>();
std::vector<RimSummaryCaseCollection*> selectedGroups = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
std::vector<caf::PdmObject*> sourcesToSelect(selectedCases.begin(), selectedCases.end());
// Append grouped cases
for (auto group : selectedGroups)
{
auto groupCases = group->allSummaryCases();
selectedCases.insert(selectedCases.end(), groupCases.begin(), groupCases.end());
if (group->isEnsemble())
{
sourcesToSelect.push_back(group);
}
else
{
auto groupCases = group->allSummaryCases();
sourcesToSelect.insert(sourcesToSelect.end(), groupCases.begin(), groupCases.end());
}
}
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog();
@@ -98,7 +107,7 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
dialog->raise();
}
dialog->updateFromDefaultCases(selectedCases);
dialog->updateFromDefaultCases(sourcesToSelect);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -144,7 +144,7 @@ RimSummaryPlot* RicSummaryCurveCreator::previewPlot() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot, const std::vector<RimSummaryCase*>& defaultCases)
void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot, const std::vector<SummarySource*>& defaultSources)
{
if (targetPlot == nullptr || m_targetPlot != targetPlot)
{
@@ -163,7 +163,7 @@ void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot, c
}
else
{
setDefaultCurveSelection(defaultCases);
setDefaultCurveSelection(defaultSources);
m_previewPlot->enableAutoPlotTitle(true);
syncPreviewCurvesFromUiSelection();
}
@@ -706,9 +706,9 @@ void RicSummaryCurveCreator::copyEnsembleCurveAndAddToCurveSet(const RimSummaryC
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreator::setDefaultCurveSelection(const std::vector<RimSummaryCase*>& defaultCases)
void RicSummaryCurveCreator::setDefaultCurveSelection(const std::vector<SummarySource*>& defaultSources)
{
m_summaryCurveSelectionEditor->summaryAddressSelection()->setDefaultSelection(defaultCases);
m_summaryCurveSelectionEditor->summaryAddressSelection()->setDefaultSelection(defaultSources);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -36,6 +36,11 @@
#define OBSERVED_DATA_AVALUE_POSTFIX "_OBSDATA"
namespace caf
{
class PdmObject;
};
class RimSummaryCase;
class RimSummaryCurveAutoName;
class RimSummaryPlot;
@@ -62,7 +67,7 @@ public:
RimSummaryPlot* previewPlot() const;
void updateFromSummaryPlot(RimSummaryPlot* targetPlot,
const std::vector<RimSummaryCase*>& defaultCases = std::vector<RimSummaryCase*>());
const std::vector<caf::PdmObject*>& defaultSources = std::vector<caf::PdmObject*>());
QWidget* addressSelectionWidget(QWidget* parent);
@@ -90,7 +95,7 @@ private:
void updateTargetPlot();
static void copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryPlot *plot, bool forceVisible = false);
static void copyEnsembleCurveAndAddToCurveSet(const RimSummaryCurve *curve, RimEnsembleCurveSet* curveSet, bool forceVisible = false);
void setDefaultCurveSelection(const std::vector<RimSummaryCase*>& defaultCases);
void setDefaultCurveSelection(const std::vector<caf::PdmObject*>& defaultCases);
void resetAllFields();
void initCurveAppearanceCalculator(RimSummaryCurveAppearanceCalculator& curveAppearanceCalc);

View File

@@ -68,9 +68,9 @@ void RicSummaryCurveCreatorDialog::updateFromSummaryPlot(RimSummaryPlot* summary
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreatorDialog::updateFromDefaultCases(const std::vector<RimSummaryCase*> defaultCases)
void RicSummaryCurveCreatorDialog::updateFromDefaultCases(const std::vector<caf::PdmObject*> defaultSources)
{
m_curveCreatorSplitterUi->updateFromDefaultCases(defaultCases);
m_curveCreatorSplitterUi->updateFromDefaultSources(defaultSources);
m_curveCreatorSplitterUi->updateUi();
}

View File

@@ -20,6 +20,11 @@
#include <QDialog>
namespace caf
{
class PdmObject;
};
class RicSummaryCurveCreatorSplitterUi;
class RimSummaryPlot;
class RimSummaryCase;
@@ -36,7 +41,7 @@ public:
~RicSummaryCurveCreatorDialog();
void updateFromSummaryPlot(RimSummaryPlot* summaryPlot);
void updateFromDefaultCases(const std::vector<RimSummaryCase*> defaultCases);
void updateFromDefaultCases(const std::vector<caf::PdmObject*> defaultSources);
private slots:
void slotDialogFinished();

View File

@@ -70,9 +70,9 @@ void RicSummaryCurveCreatorSplitterUi::updateFromSummaryPlot(RimSummaryPlot* sum
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSummaryCurveCreatorSplitterUi::updateFromDefaultCases(const std::vector<RimSummaryCase*> defaultCases)
void RicSummaryCurveCreatorSplitterUi::updateFromDefaultSources(const std::vector<caf::PdmObject*> defaultSources)
{
m_summaryCurveCreator->updateFromSummaryPlot(nullptr, defaultCases);
m_summaryCurveCreator->updateFromSummaryPlot(nullptr, defaultSources);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -35,6 +35,7 @@ class QHBoxLayout;
class QBoxLayout;
namespace caf {
class PdmObject;
class PdmUiItem;
class PdmUiTreeView;
}
@@ -53,7 +54,7 @@ public:
~RicSummaryCurveCreatorSplitterUi();
void updateFromSummaryPlot(RimSummaryPlot* summaryPlot);
void updateFromDefaultCases(const std::vector<RimSummaryCase*> defaultCases);
void updateFromDefaultSources(const std::vector<caf::PdmObject*> defaultSources);
private:
virtual void recursivelyConfigureAndUpdateTopLevelUiItems(const std::vector<caf::PdmUiItem *>& topLevelUiItems,

View File

@@ -377,7 +377,7 @@ void RiuSummaryCurveDefSelection::setFieldChangedHandler(const std::function<voi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSummaryCurveDefSelection::setDefaultSelection(const std::vector<RimSummaryCase*>& defaultCases)
void RiuSummaryCurveDefSelection::setDefaultSelection(const std::vector<SummarySource*>& defaultSources)
{
RimProject* proj = RiaApplication::instance()->project();
auto allSumCases = proj->allSummaryCases();
@@ -385,13 +385,16 @@ void RiuSummaryCurveDefSelection::setDefaultSelection(const std::vector<RimSumma
{
RifEclipseSummaryAddress defaultAddress = RifEclipseSummaryAddress::fieldAddress("FOPT");
std::vector<RimSummaryCase*> selectTheseCases = defaultCases;
if (selectTheseCases.empty()) selectTheseCases.push_back(allSumCases[0]);
std::vector<SummarySource*> selectTheseSources = defaultSources;
if (selectTheseSources.empty()) selectTheseSources.push_back(allSumCases[0]);
std::vector<RiaSummaryCurveDefinition> curveDefs;
for(RimSummaryCase* c : selectTheseCases)
for(SummarySource* s : selectTheseSources)
{
RiaSummaryCurveDefinition curveDef(c, defaultAddress);
RimSummaryCase* sumCase = dynamic_cast<RimSummaryCase*>(s);
RimSummaryCaseCollection* ensemble = dynamic_cast<RimSummaryCaseCollection*>(s);
RiaSummaryCurveDefinition curveDef(sumCase, defaultAddress, ensemble);
curveDefs.push_back(curveDef);
}

View File

@@ -64,7 +64,7 @@ public:
void hideSummaryCases(bool hide);
void setFieldChangedHandler(const std::function<void()>& handlerFunc);
void setDefaultSelection(const std::vector<RimSummaryCase*>& defaultCases);
void setDefaultSelection(const std::vector<SummarySource*>& defaultCases);
private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,