mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5368 Automatically select new wells when they appear in new measurements.
This commit is contained in:
@@ -65,6 +65,16 @@ RimWellMeasurementInView::RimWellMeasurementInView()
|
|||||||
CAF_PDM_InitFieldNoDefault( &m_wellsSerialized, "WellsSerialized", "WellsSerialized", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_wellsSerialized, "WellsSerialized", "WellsSerialized", "", "", "" );
|
||||||
m_wellsSerialized.uiCapability()->setUiHidden( true );
|
m_wellsSerialized.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
|
// Keep track of the wells which has a given measurement in order to automatically select
|
||||||
|
// new wells when they appear in new measurements
|
||||||
|
CAF_PDM_InitFieldNoDefault( &m_availableWellsSerialized,
|
||||||
|
"AvailableWellsSerialized",
|
||||||
|
"AvailableWellsSerialized",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"" );
|
||||||
|
// m_availableWellsSerialized.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_lowerBound, "LowerBound", -HUGE_VAL, "Min", "", "", "" );
|
CAF_PDM_InitField( &m_lowerBound, "LowerBound", -HUGE_VAL, "Min", "", "", "" );
|
||||||
m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||||
|
|
||||||
@@ -324,6 +334,9 @@ QList<caf::PdmOptionItemInfo>
|
|||||||
{
|
{
|
||||||
options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
|
options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectNewWells( wellsWithMeasurementKind );
|
||||||
|
setAvailableWells( wellsWithMeasurementKind );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( fieldNeedingOptions == &m_qualityFilter )
|
else if ( fieldNeedingOptions == &m_qualityFilter )
|
||||||
@@ -450,3 +463,43 @@ std::vector<QString> RimWellMeasurementInView::convertFromSerializableString( co
|
|||||||
QStringList stringList = string.split( '|' );
|
QStringList stringList = string.split( '|' );
|
||||||
return stringList.toVector().toStdVector();
|
return stringList.toVector().toStdVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellMeasurementInView::selectNewWells( const std::set<QString>& wells )
|
||||||
|
{
|
||||||
|
// Check if there are new wells on the measurement kind
|
||||||
|
std::set<QString> currentAvailableWells = getAvailableWells();
|
||||||
|
std::set<QString> newWells;
|
||||||
|
std::set_difference( wells.begin(),
|
||||||
|
wells.end(),
|
||||||
|
currentAvailableWells.begin(),
|
||||||
|
currentAvailableWells.end(),
|
||||||
|
std::inserter( newWells, newWells.end() ) );
|
||||||
|
|
||||||
|
// Select the new wells
|
||||||
|
for ( const QString& newWell : newWells )
|
||||||
|
{
|
||||||
|
m_wells.v().push_back( newWell );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellMeasurementInView::setAvailableWells( const std::set<QString>& wells )
|
||||||
|
{
|
||||||
|
std::vector<QString> v( wells.begin(), wells.end() );
|
||||||
|
m_availableWellsSerialized = convertToSerializableString( v );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<QString> RimWellMeasurementInView::getAvailableWells() const
|
||||||
|
{
|
||||||
|
std::vector<QString> v = convertFromSerializableString( m_availableWellsSerialized );
|
||||||
|
std::set<QString> s( v.begin(), v.end() );
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ private:
|
|||||||
caf::PdmField<double> m_upperBound;
|
caf::PdmField<double> m_upperBound;
|
||||||
caf::PdmField<std::vector<int>> m_qualityFilter;
|
caf::PdmField<std::vector<int>> m_qualityFilter;
|
||||||
caf::PdmField<QString> m_wellsSerialized;
|
caf::PdmField<QString> m_wellsSerialized;
|
||||||
|
caf::PdmField<QString> m_availableWellsSerialized;
|
||||||
|
|
||||||
|
void selectNewWells( const std::set<QString>& wells );
|
||||||
|
void setAvailableWells( const std::set<QString>& wells );
|
||||||
|
std::set<QString> getAvailableWells() const;
|
||||||
|
|
||||||
double m_minimumResultValue;
|
double m_minimumResultValue;
|
||||||
double m_maximumResultValue;
|
double m_maximumResultValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user