#4727 Apply initial default well path for new RFT Plots

This commit is contained in:
Gaute Lindkvist 2019-09-17 19:07:55 +02:00
parent 0b8d975cbe
commit 63eac19c07
3 changed files with 35 additions and 26 deletions

View File

@ -67,8 +67,6 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
{ {
QString wellName = selectedWellName(); QString wellName = selectedWellName();
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
RimWellRftPlot* rftPlot = new RimWellRftPlot(); RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setSimWellOrWellPathName( wellName ); rftPlot->setSimWellOrWellPathName( wellName );
@ -77,9 +75,13 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) ); plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) );
rftPlotColl->addPlot( rftPlot ); rftPlotColl->addPlot( rftPlot );
rftPlot->applyInitialSelections();
wellName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
rftPlot->setDescription( plotName ); rftPlot->setDescription( plotName );
rftPlot->applyInitialSelections();
rftPlot->loadDataAndUpdate(); rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors(); rftPlotColl->updateConnectedEditors();

View File

@ -221,6 +221,12 @@ QString RimWellRftPlot::associatedSimWellName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellRftPlot::applyInitialSelections() void RimWellRftPlot::applyInitialSelections()
{ {
std::map<QString, QStringList> wellSources = findWellSources();
if ( m_wellPathNameOrSimWellName == "None" && !wellSources.empty() )
{
m_wellPathNameOrSimWellName = wellSources.begin()->first;
}
std::vector<RifDataSourceForRftPlt> sourcesToSelect; std::vector<RifDataSourceForRftPlt> sourcesToSelect;
const QString simWellName = associatedSimWellName(); const QString simWellName = associatedSimWellName();
@ -637,7 +643,20 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions( const caf::
if ( fieldNeedingOptions == &m_wellPathNameOrSimWellName ) if ( fieldNeedingOptions == &m_wellPathNameOrSimWellName )
{ {
calculateValueOptionsForWells( options ); options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
std::map<QString, QStringList> wellSources = findWellSources();
for ( const auto& wellName : wellSources )
{
const QStringList& tags = wellName.second;
QString uiText = wellName.first;
if ( !tags.empty() )
{
uiText += QString( " (%1)" ).arg( wellName.second.join( ", " ) );
}
options.push_back( caf::PdmOptionItemInfo( uiText, wellName.first ) );
}
} }
else if ( fieldNeedingOptions == &m_selectedSources ) else if ( fieldNeedingOptions == &m_selectedSources )
{ {
@ -847,17 +866,16 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellRftPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options ) std::map<QString, QStringList> RimWellRftPlot::findWellSources()
{ {
RimProject* proj = RiaApplication::instance()->project(); std::map<QString /*value*/, QStringList /*uitext*/> wellNames;
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) ); RimProject* proj = RiaApplication::instance()->project();
if ( proj != nullptr ) if ( proj != nullptr )
{ {
const std::vector<QString> simWellNames = proj->simulationWellNames(); const std::vector<QString> simWellNames = proj->simulationWellNames();
std::set<QString> simWellsAssociatedWithWellPath; std::set<QString> simWellsAssociatedWithWellPath;
std::map<QString /*value*/, QStringList /*uitext*/> wellNames;
// Observed wells // Observed wells
for ( RimWellPath* const wellPath : proj->allWellPaths() ) for ( RimWellPath* const wellPath : proj->allWellPaths() )
@ -903,19 +921,8 @@ void RimWellRftPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo
} }
} }
} }
for ( const auto& wellName : wellNames )
{
const QStringList& tags = wellName.second;
QString uiText = wellName.first;
if ( !tags.empty() )
{
uiText += QString( " (%1)" ).arg( wellName.second.join( ", " ) );
}
options.push_back( caf::PdmOptionItemInfo( uiText, wellName.first ) );
}
} }
return wellNames;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -98,7 +98,7 @@ protected:
void initAfterRead() override; void initAfterRead() override;
private: private:
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options ); std::map<QString, QStringList> findWellSources();
void updateEditorsFromCurves(); void updateEditorsFromCurves();
void syncCurvesFromUiSelection(); void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves(); void assignWellPathToExtractionCurves();