mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-23 15:03:27 -06:00
#3801 Postpone assignment of old selectedTracer-field to producers and injectors
* initAfterRead is too soon as the solver hasn't been set up yet. * wait until onEditorWidgetsCreated()
This commit is contained in:
parent
d119f3d146
commit
4bdab329e1
@ -49,6 +49,7 @@
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
|
||||
namespace caf
|
||||
@ -861,6 +862,11 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::initAfterRead()
|
||||
{
|
||||
if (m_flowSolution() == nullptr)
|
||||
{
|
||||
assignFlowSolutionFromCase();
|
||||
}
|
||||
|
||||
m_porosityModelUiField = m_porosityModel;
|
||||
m_resultTypeUiField = m_resultType;
|
||||
m_resultVariableUiField = m_resultVariable;
|
||||
@ -868,42 +874,6 @@ void RimEclipseResultDefinition::initAfterRead()
|
||||
m_flowSolutionUiField = m_flowSolution();
|
||||
m_selectedInjectorTracersUiField = m_selectedInjectorTracers;
|
||||
|
||||
if (m_flowSolution() == nullptr)
|
||||
{
|
||||
assignFlowSolutionFromCase();
|
||||
}
|
||||
|
||||
if (m_flowSolution())
|
||||
{
|
||||
std::vector<QString> selectedInjectorTracers;
|
||||
std::vector<QString> selectedProducerTracers;
|
||||
for (const QString& tracerName : m_selectedTracers_OBSOLETE())
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType tracerStatus = m_flowSolution()->tracerStatusOverall(tracerName);
|
||||
if (tracerStatus == RimFlowDiagSolution::INJECTOR)
|
||||
{
|
||||
selectedInjectorTracers.push_back(tracerName);
|
||||
}
|
||||
else if (tracerStatus == RimFlowDiagSolution::PRODUCER)
|
||||
{
|
||||
selectedProducerTracers.push_back(tracerName);
|
||||
}
|
||||
else if (tracerStatus == RimFlowDiagSolution::VARYING || tracerStatus == RimFlowDiagSolution::UNDEFINED)
|
||||
{
|
||||
selectedInjectorTracers.push_back(tracerName);
|
||||
selectedProducerTracers.push_back(tracerName);
|
||||
}
|
||||
}
|
||||
if (!selectedInjectorTracers.empty())
|
||||
{
|
||||
setSelectedInjectorTracers(selectedInjectorTracers);
|
||||
}
|
||||
if (!selectedProducerTracers.empty())
|
||||
{
|
||||
setSelectedProducerTracers(selectedProducerTracers);
|
||||
}
|
||||
}
|
||||
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
@ -1159,6 +1129,43 @@ void RimEclipseResultDefinition::defineEditorAttribute(const caf::PdmFieldHandle
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::onEditorWidgetsCreated()
|
||||
{
|
||||
if (m_flowSolution() && !m_selectedTracers_OBSOLETE().empty())
|
||||
{
|
||||
std::vector<QString> selectedTracers;
|
||||
selectedTracers.swap(m_selectedTracers_OBSOLETE.v());
|
||||
|
||||
std::set<QString, TracerComp> allInjectorTracers = setOfTracersOfType(true);
|
||||
std::set<QString, TracerComp> allProducerTracers = setOfTracersOfType(false);
|
||||
|
||||
std::vector<QString> selectedInjectorTracers;
|
||||
std::vector<QString> selectedProducerTracers;
|
||||
for (const QString& tracerName : selectedTracers)
|
||||
{
|
||||
if (allInjectorTracers.count(tracerName))
|
||||
{
|
||||
selectedInjectorTracers.push_back(tracerName);
|
||||
}
|
||||
if (allProducerTracers.count(tracerName))
|
||||
{
|
||||
selectedProducerTracers.push_back(tracerName);
|
||||
}
|
||||
}
|
||||
if (!selectedInjectorTracers.empty())
|
||||
{
|
||||
setSelectedInjectorTracers(selectedInjectorTracers);
|
||||
}
|
||||
if (!selectedProducerTracers.empty())
|
||||
{
|
||||
setSelectedProducerTracers(selectedProducerTracers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
void updateUiFieldsFromActiveResult();
|
||||
|
||||
protected:
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
@ -123,6 +123,7 @@ protected:
|
||||
void initAfterRead() override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||
void onEditorWidgetsCreated() override;
|
||||
|
||||
protected:
|
||||
caf::PdmField< caf::AppEnum< RiaDefines::ResultCatType > > m_resultType;
|
||||
@ -174,6 +175,7 @@ private:
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
|
||||
QList<caf::PdmOptionItemInfo> calcOptionsForSelectedTracerField(bool injector);
|
||||
|
||||
QString timeOfFlightString(bool shorter) const;
|
||||
QString maxFractionTracerString(bool shorter) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user