#5125 Well measurements : Select all wells by default

This commit is contained in:
Magne Sjaastad
2019-12-04 10:41:44 +01:00
parent 0a1e6fc1d3
commit 4fb0542946
3 changed files with 35 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RimWellMeasurementInView.h" #include "RimWellMeasurementInView.h"
#include "Rim3dView.h" #include "Rim3dView.h"
@@ -205,13 +206,13 @@ QList<caf::PdmOptionItemInfo>
// Find wells with a given measurement. // Find wells with a given measurement.
std::set<QString> wellsWithMeasurementKind; std::set<QString> wellsWithMeasurementKind;
for ( auto well : wellPathCollection->wellPaths ) for ( const auto& well : wellPathCollection->wellPaths )
{ {
if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) ) if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) )
wellsWithMeasurementKind.insert( well->name() ); wellsWithMeasurementKind.insert( well->name() );
} }
for ( auto wellName : wellsWithMeasurementKind ) for ( const auto& wellName : wellsWithMeasurementKind )
{ {
options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) ); options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) );
} }
@@ -252,3 +253,28 @@ bool RimWellMeasurementInView::isWellChecked( const QString& wellName ) const
{ {
return std::find( m_wells.v().begin(), m_wells.v().end(), wellName ) != m_wells.v().end(); return std::find( m_wells.v().begin(), m_wells.v().end(), wellName ) != m_wells.v().end();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellMeasurementInView::setAllWellsSelected()
{
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( wellPathCollection )
{
std::vector<RimWellMeasurement*> measurements = wellPathCollection->measurementCollection()->measurements();
// Find wells with a given measurement.
std::set<QString> wellsWithMeasurementKind;
for ( const auto& well : wellPathCollection->wellPaths )
{
if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) )
wellsWithMeasurementKind.insert( well->name() );
}
for ( const auto& wellName : wellsWithMeasurementKind )
{
m_wells.v().push_back( wellName );
}
}
}

View File

@@ -45,6 +45,7 @@ public:
QString measurementKind() const; QString measurementKind() const;
void setMeasurementKind( const QString& measurementKind ); void setMeasurementKind( const QString& measurementKind );
bool isWellChecked( const QString& wellName ) const; bool isWellChecked( const QString& wellName ) const;
void setAllWellsSelected();
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer ); void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );
@@ -55,8 +56,9 @@ protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue ) override; const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ); bool* useOptionsOnly ) override;
bool updateLegendData(); bool updateLegendData();
static bool hasMeasurementKindForWell( const RimWellPath* wellPath, static bool hasMeasurementKindForWell( const RimWellPath* wellPath,

View File

@@ -48,6 +48,8 @@ RimWellMeasurementInViewCollection::RimWellMeasurementInViewCollection()
CAF_PDM_InitFieldNoDefault( &m_measurementsInView, "MeasurementKinds", "Measurement Kinds", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_measurementsInView, "MeasurementKinds", "Measurement Kinds", "", "", "" );
m_measurementsInView.uiCapability()->setUiHidden( true ); m_measurementsInView.uiCapability()->setUiHidden( true );
m_isChecked = false;
this->setName( "Well Measurements" ); this->setName( "Well Measurements" );
} }
@@ -132,6 +134,8 @@ void RimWellMeasurementInViewCollection::syncWithChangesInWellMeasurementCollect
RimWellMeasurementInView* measurementInView = new RimWellMeasurementInView; RimWellMeasurementInView* measurementInView = new RimWellMeasurementInView;
measurementInView->setName( kind ); measurementInView->setName( kind );
measurementInView->setMeasurementKind( kind ); measurementInView->setMeasurementKind( kind );
measurementInView->setAllWellsSelected();
m_measurementsInView.push_back( measurementInView ); m_measurementsInView.push_back( measurementInView );
} }