#4121 Set default case and parameters when creating Cross Plot

This commit is contained in:
Gaute Lindkvist 2019-02-22 09:37:59 +01:00
parent 1536645e7c
commit 0aa7dc1777
4 changed files with 35 additions and 5 deletions

View File

@ -49,6 +49,7 @@ void RicCreateGridCrossPlotFeature::onActionTriggered(bool isChecked)
RimGridCrossPlotCollection* collection = project->mainPlotCollection()->gridCrossPlotCollection();
RimGridCrossPlot* plot = collection->createGridCrossPlot();
plot->createCurveSet();
plot->loadDataAndUpdate();
plot->updateConnectedEditors();

View File

@ -49,9 +49,7 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitFieldNoDefault(&m_crossPlotCurveSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "");
m_crossPlotCurveSets.uiCapability()->setUiHidden(true);
m_nameConfig = new RimGridCrossPlotNameConfig(this);
createCurveSet();
m_nameConfig = new RimGridCrossPlotNameConfig(this);
}
//--------------------------------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridCrossPlotCurveSet.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RigActiveCellInfo.h"
@ -29,6 +30,7 @@
#include "RimEclipseResultDefinition.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCurve.h"
#include "RimProject.h"
#include "RimTools.h"
#include "cafPdmUiComboBoxEditor.h"
@ -65,6 +67,7 @@ RimGridCrossPlotCurveSet::RimGridCrossPlotCurveSet()
CAF_PDM_InitFieldNoDefault(&m_crossPlotCurves, "CrossPlotCurves", "Curves", "", "", "");
m_crossPlotCurves.uiCapability()->setUiTreeHidden(true);
setDefaults();
}
//--------------------------------------------------------------------------------------------------
@ -356,7 +359,10 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotCurveSet::calculateValueOptions(co
if (fieldNeedingOptions == &m_case)
{
RimTools::caseOptionItems(&options);
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
if (options.empty())
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
}
else if (fieldNeedingOptions == &m_timeStep)
{
@ -394,6 +400,30 @@ void RimGridCrossPlotCurveSet::performAutoNameUpdate()
this->setName(createAutoName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurveSet::setDefaults()
{
RimProject* project = RiaApplication::instance()->project();
if (project)
{
if (!project->eclipseCases().empty())
{
RimEclipseCase* eclipseCase = project->eclipseCases().front();
m_case = eclipseCase;
m_xAxisProperty->setEclipseCase(eclipseCase);
m_yAxisProperty->setEclipseCase(eclipseCase);
m_xAxisProperty->setResultType(RiaDefines::DYNAMIC_NATIVE);
m_xAxisProperty->setResultVariable("SOIL");
m_yAxisProperty->setResultType(RiaDefines::DYNAMIC_NATIVE);
m_yAxisProperty->setResultVariable("PRESSURE");
}
}
}
CAF_PDM_SOURCE_INIT(RimGridCrossPlotCurveSetNameConfig, "RimGridCrossPlotCurveSetNameConfig");
//--------------------------------------------------------------------------------------------------

View File

@ -76,7 +76,7 @@ protected:
bool* useOptionsOnly) override;
void triggerReplotAndTreeRebuild();
void performAutoNameUpdate() override;
void setDefaults();
private:
caf::PdmPtrField<RimCase*> m_case;
@ -87,4 +87,5 @@ private:
caf::PdmChildField<RimGridCrossPlotCurveSetNameConfig*> m_nameConfig;
caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves;
};