#8006 Ensemble Well Log: Create ensemble from well path in project (#8018)

This commit is contained in:
Kristian Bendiksen 2021-09-21 15:33:18 +02:00 committed by GitHub
parent b9767a35a4
commit 02b5246a20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 112 additions and 14 deletions

View File

@ -36,6 +36,7 @@
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimcWellLogPlot.h"
#include "RimcWellLogPlotCollection.h"
#include "RimcWellLogTrack.h"
@ -87,12 +88,20 @@ void RicCreateEnsembleWellLogFeature::openDialogAndExecuteCommand()
RicCreateEnsembleWellLogUi* ui = RimProject::current()->dialogData()->createEnsembleWellLogUi();
ui->setCaseData( eclipseCase->eclipseCaseData() );
// Automatically selected the well path the dialog was triggered on (if any)
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
if ( wellPath )
{
ui->setWellPathSource( RicCreateEnsembleWellLogUi::WellPathSource::PROJECT_WELLS );
ui->setWellPathFromProject( wellPath );
}
RiuPropertyViewTabWidget propertyDialog( Riu3DMainWindowTools::mainWindowWidget(),
ui,
"Create Ensemble Well Log",
ui->tabNames() );
if ( propertyDialog.exec() == QDialog::Accepted && !ui->properties().empty() && !ui->wellPathFilePath().isEmpty() )
if ( propertyDialog.exec() == QDialog::Accepted && !ui->properties().empty() )
{
executeCommand( *ui, result.files.toStdList() );
}
@ -110,16 +119,30 @@ void RicCreateEnsembleWellLogFeature::executeCommand( const RicCreateEnsembleWel
RimWellLogPlotCollection* plotCollection = RimProject::current()->mainPlotCollection()->wellLogPlotCollection();
// Load well path from file
QStringList wellPathFilePaths;
wellPathFilePaths << ui.wellPathFilePath();
bool importGrouped = false;
QStringList errorMessages;
std::vector<RimWellPath*> wellPaths =
RicImportWellPaths::importWellPaths( wellPathFilePaths, importGrouped, &errorMessages );
if ( wellPaths.empty() ) return;
RimWellPath* wellPath = nullptr;
RimWellPath* wellPath = wellPaths[0];
if ( ui.wellPathSource() == RicCreateEnsembleWellLogUi::WellPathSource::FILE )
{
if ( ui.wellPathFilePath().isEmpty() ) return;
// Load well path from file
QStringList wellPathFilePaths;
wellPathFilePaths << ui.wellPathFilePath();
bool importGrouped = false;
QStringList errorMessages;
std::vector<RimWellPath*> wellPaths =
RicImportWellPaths::importWellPaths( wellPathFilePaths, importGrouped, &errorMessages );
if ( wellPaths.empty() ) return;
wellPath = wellPaths[0];
}
else
{
CAF_ASSERT( ui.wellPathSource() == RicCreateEnsembleWellLogUi::WellPathSource::PROJECT_WELLS );
wellPath = ui.wellPathFromProject();
}
if ( !wellPath ) return;
QStringList allLasFileNames;
for ( const auto& fileName : fileNames )

View File

@ -27,7 +27,9 @@
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimTools.h"
#include "RimWellPath.h"
#include "cafAppEnum.h"
#include "cafPdmObject.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiListEditor.h"
@ -36,6 +38,17 @@
CAF_PDM_SOURCE_INIT( RicCreateEnsembleWellLogUi, "RicCreateEnsembleWellLogUi" );
namespace caf
{
template <>
void caf::AppEnum<RicCreateEnsembleWellLogUi::WellPathSource>::setUp()
{
addItem( RicCreateEnsembleWellLogUi::WellPathSource::FILE, "FILE", "From file" );
addItem( RicCreateEnsembleWellLogUi::WellPathSource::PROJECT_WELLS, "PROJECT_WELLS", "From Project Wells" );
setDefault( RicCreateEnsembleWellLogUi::WellPathSource::FILE );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -53,6 +66,8 @@ RicCreateEnsembleWellLogUi::RicCreateEnsembleWellLogUi()
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoCreateEnsembleWellLogs );
CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPathSource, "WellPathSource", "Well Path Source", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_well, "Well", "Well", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_selectedKeywords, "SelectedProperties", "Selected Properties", "", "", "" );
m_selectedKeywords.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
@ -83,7 +98,13 @@ void RicCreateEnsembleWellLogUi::defineUiOrdering( QString uiConfigName, caf::Pd
{
if ( uiConfigName == m_tabNames[0] )
{
uiOrdering.add( &m_wellPathSource );
bool fileSource = ( m_wellPathSource == RicCreateEnsembleWellLogUi::WellPathSource::FILE );
uiOrdering.add( &m_well );
uiOrdering.add( &m_wellPath );
m_well.uiCapability()->setUiHidden( !fileSource );
m_wellPath.uiCapability()->setUiHidden( fileSource );
uiOrdering.add( &m_autoCreateEnsembleWellLogs );
}
else if ( uiConfigName == m_tabNames[1] )
@ -135,6 +156,10 @@ QList<caf::PdmOptionItemInfo>
{
RimTools::timeStepsForCase( m_caseData->ownerCase(), &options );
}
else if ( fieldNeedingOptions == &m_wellPath )
{
RimTools::wellPathOptionItems( &options );
}
return options;
}
@ -203,6 +228,38 @@ QString RicCreateEnsembleWellLogUi::wellPathFilePath() const
return m_well().path();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicCreateEnsembleWellLogUi::WellPathSource RicCreateEnsembleWellLogUi::wellPathSource() const
{
return m_wellPathSource();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateEnsembleWellLogUi::setWellPathSource( RicCreateEnsembleWellLogUi::WellPathSource wellPathSource )
{
m_wellPathSource = wellPathSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicCreateEnsembleWellLogUi::wellPathFromProject() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateEnsembleWellLogUi::setWellPathFromProject( RimWellPath* wellPath )
{
m_wellPath = wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -22,11 +22,13 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QString>
#include <QStringList>
class RigEclipseCaseData;
class RimWellPath;
//==================================================================================================
///
@ -36,14 +38,27 @@ class RicCreateEnsembleWellLogUi : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
enum class WellPathSource
{
FILE,
PROJECT_WELLS
};
RicCreateEnsembleWellLogUi();
~RicCreateEnsembleWellLogUi() override;
const QStringList& tabNames() const;
bool autoCreateEnsembleWellLogs() const;
int timeStep() const;
QString wellPathFilePath() const;
int timeStep() const;
QString wellPathFilePath() const;
WellPathSource wellPathSource() const;
void setWellPathSource( WellPathSource wellPathSource );
void setWellPathFromProject( RimWellPath* wellPath );
RimWellPath* wellPathFromProject() const;
std::vector<std::pair<QString, RiaDefines::ResultCatType>> properties() const;
void setCaseData( RigEclipseCaseData* caseData );
@ -57,8 +72,10 @@ protected:
std::vector<RiaDefines::ResultCatType> validResultCategories() const;
private:
caf::PdmField<caf::FilePath> m_well;
caf::PdmField<bool> m_autoCreateEnsembleWellLogs;
caf::PdmField<caf::FilePath> m_well;
caf::PdmField<caf::AppEnum<WellPathSource>> m_wellPathSource;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<bool> m_autoCreateEnsembleWellLogs;
caf::PdmField<std::vector<QString>> m_selectedKeywords;
caf::PdmField<int> m_timeStep;

View File

@ -388,6 +388,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
appendExportWellPaths( menuBuilder );
menuBuilder.addSeparator();
menuBuilder << "RicCreateEnsembleWellLogFeature";
menuBuilder.subMenuStart( "Well Plots", QIcon( ":/WellLogTrack16x16.png" ) );
menuBuilder << "RicNewRftPlotFeature";
menuBuilder << "RicNewPltPlotFeature";