mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5368 Restore selected wells in RimWellMeasurementInView when loading project
This commit is contained in:
parent
3a304f984c
commit
cdfd2d5648
@ -58,6 +58,12 @@ RimWellMeasurementInView::RimWellMeasurementInView()
|
||||
CAF_PDM_InitFieldNoDefault( &m_wells, "Wells", "Wells", "", "", "" );
|
||||
m_wells.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
m_wells.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
m_wells.xmlCapability()->disableIO();
|
||||
|
||||
// The m_wells field does not serialize in a suitable format, so we work around it by
|
||||
// serializing to a pipe-delimited string.
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellsSerialized, "WellsSerialized", "WellsSerialized", "", "", "" );
|
||||
m_wellsSerialized.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_lowerBound, "LowerBound", -HUGE_VAL, "Min", "", "", "" );
|
||||
m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
@ -145,12 +151,25 @@ void RimWellMeasurementInView::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_wells )
|
||||
{
|
||||
m_wellsSerialized = convertToSerializableString( m_wells.v() );
|
||||
}
|
||||
|
||||
updateLegendData();
|
||||
RimGridView* rimGridView = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rimGridView );
|
||||
rimGridView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementInView::initAfterRead()
|
||||
{
|
||||
m_wells = convertFromSerializableString( m_wellsSerialized );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -385,6 +404,8 @@ void RimWellMeasurementInView::setAllWellsSelected()
|
||||
{
|
||||
m_wells.v().push_back( wellName );
|
||||
}
|
||||
|
||||
m_wellsSerialized = convertToSerializableString( m_wells.v() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,3 +432,21 @@ void RimWellMeasurementInView::setAllQualitiesSelected()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellMeasurementInView::convertToSerializableString( const std::vector<QString>& strings )
|
||||
{
|
||||
QStringList stringList = QVector<QString>::fromStdVector( strings ).toList();
|
||||
return stringList.join( '|' );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimWellMeasurementInView::convertFromSerializableString( const QString& string )
|
||||
{
|
||||
QStringList stringList = string.split( '|' );
|
||||
return stringList.toVector().toStdVector();
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ protected:
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void initAfterRead() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
@ -76,12 +77,16 @@ protected:
|
||||
const QString& measurementKind );
|
||||
|
||||
private:
|
||||
static QString convertToSerializableString( const std::vector<QString>& strings );
|
||||
static std::vector<QString> convertFromSerializableString( const QString& string );
|
||||
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||
caf::PdmField<QString> m_measurementKind;
|
||||
caf::PdmField<std::vector<QString>> m_wells;
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
caf::PdmField<std::vector<int>> m_qualityFilter;
|
||||
caf::PdmField<QString> m_wellsSerialized;
|
||||
|
||||
double m_minimumResultValue;
|
||||
double m_maximumResultValue;
|
||||
|
Loading…
Reference in New Issue
Block a user