#2122 Formation/Well Path: Use reader in WellPath classes

This commit is contained in:
Unknown 2017-11-24 10:01:05 +01:00 committed by Rebecca Cox
parent 7e28039ffd
commit e80cd8de7c
6 changed files with 155 additions and 22 deletions

View File

@ -479,7 +479,11 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
oilField->wellPathCollection = new RimWellPathCollection();
}
if (oilField->wellPathCollection) oilField->wellPathCollection->readWellPathFiles();
if (oilField->wellPathCollection)
{
oilField->wellPathCollection->readWellPathFiles();
oilField->wellPathCollection->readWellPathFormationFiles();
}
}
for (RimOilField* oilField: m_project->oilFields)
@ -778,6 +782,28 @@ void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
oilField->wellPathCollection->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::addWellPathFormationsToModel(QList<QString> wellPathFormationsFilePaths)
{
if (m_project == nullptr || m_project->oilFields.size() < 1) return;
RimOilField* oilField = m_project->activeOilField();
if (oilField == nullptr) return;
if (oilField->wellPathCollection == nullptr)
{
oilField->wellPathCollection = new RimWellPathCollection();
m_project->updateConnectedEditors();
}
if (oilField->wellPathCollection) oilField->wellPathCollection->addWellFormations(wellPathFormationsFilePaths);
oilField->wellPathCollection->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
/// Add a list of well log file paths (LAS files) to the well path collection
//--------------------------------------------------------------------------------------------------

View File

@ -138,6 +138,7 @@ public:
void closeProject();
void addWellPathsToModel(QList<QString> wellPathFilePaths);
void addWellPathFormationsToModel(QList<QString> wellPathFilePaths);
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);

View File

@ -20,22 +20,22 @@
#include "RimWellPath.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "RigWellPath.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimWellPathCompletions.h"
#include "RiuMainWindow.h"
#include "RivWellPathPartMgr.h"
@ -50,6 +50,7 @@
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <regex>
@ -677,6 +678,39 @@ void RimWellPath::detachWellLogFile(RimWellLogFile* logFileInfo)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::setWellFormationFile(const QString& formationFilePath)
{
m_wellPathFormationFilePath = formationFilePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPath::wellFormationFile() const
{
return m_wellPathFormationFilePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPath::readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter)
{
if (caf::Utils::fileExists(m_wellPathFormationFilePath()))
{
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations(m_wellPathFormationFilePath(), m_name());
return true;
}
else
{
if (errorMessage) (*errorMessage) = "Could not find the well path formation file: " + m_wellPathFormationFilePath();
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -37,6 +37,7 @@
#include <functional>
class RifWellPathImporter;
class RifWellPathFormationsImporter;
class RigWellPath;
class RimProject;
class RimWellLogFile;
@ -46,6 +47,7 @@ class RivWellPathPartMgr;
class RimFishbonesCollection;
class RimPerforationCollection;
class RimWellPathCompletions;
class RigWellPathFormations;
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
class RimWellPathFractureCollection;
@ -70,10 +72,14 @@ public:
void deleteWellLogFile(RimWellLogFile* logFileInfo);
void detachWellLogFile(RimWellLogFile* logFileInfo);
virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField();
void setWellFormationFile(const QString& formationFilePath);
QString wellFormationFile() const;
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual void initAfterRead() override;
@ -134,14 +140,14 @@ private:
QString surveyType() { return m_surveyType; }
void setSurveyType(QString surveyType);
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
bool isStoredInCache();
QString getCacheFileName();
QString getCacheDirectoryPath();
virtual void setupBeforeSave();
virtual void setupBeforeSave() override;
caf::PdmField<QString> id;
caf::PdmField<QString> sourceSystem;
@ -157,10 +163,13 @@ private:
caf::PdmChildField<RimWellPathCompletions*> m_completions;
cvf::ref<RigWellPath> m_wellPath;
cvf::ref<RigWellPathFormations> m_wellPathFormations;
cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr;
caf::PdmField<QString> m_name;
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
caf::PdmField<QString> m_wellPathFormationFilePath;
caf::PdmChildField<RimWellLogFile*> m_wellLogFile_OBSOLETE;

View File

@ -21,36 +21,39 @@
#include "RimWellPathCollection.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiaColorTables.h"
#include "RiaPreferences.h"
#include "RiaWellNameComparer.h"
#include "RigWellPath.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimOilField.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RiuMainWindow.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "RivWellPathPartMgr.h"
#include "cafPdmUiEditorHandle.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QString>
#include <fstream>
#include <cmath>
#include "RivWellPathPartMgr.h"
#include "RimEclipseView.h"
#include <fstream>
namespace caf
{
@ -97,6 +100,7 @@ RimWellPathCollection::RimWellPathCollection()
m_wellPathImporter = new RifWellPathImporter;
m_newestAddedWellName = QString();
m_wellPathFormationsImporter = new RifWellPathFormationsImporter;
}
@ -107,6 +111,7 @@ RimWellPathCollection::~RimWellPathCollection()
{
wellPaths.deleteAllChildObjects();
delete m_wellPathImporter;
delete m_wellPathFormationsImporter;
}
@ -322,6 +327,34 @@ RimWellLogFile* RimWellPathCollection::addWellLogs(const QStringList& filePaths)
return logFileInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathFormations* RimWellPathCollection::addWellFormations(const QStringList& filePaths)
{
RimWellPathFormations* wellFormationFile = nullptr;
/*
foreach(QString filePath, filePaths)
{
wellFormationFile = RimWellPathFormations::readWellLogFile(filePath);
if (wellFormationFile)
{
RimWellPath* wellPath = tryFindMatchingWellPath(wellFormationFile->wellName());
if (!wellPath)
{
wellPath = new RimWellPath();
wellPaths.push_back(wellPath);
}
wellPath->setWellFormationFile(wellFormationFile);
}
}
this->sortWellsByName();*/
return wellFormationFile;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -461,6 +494,31 @@ void RimWellPathCollection::deleteAllWellPaths()
m_wellPathImporter->clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::readWellPathFormationFiles()
{
caf::ProgressInfo progress(wellPaths.size(), "Reading well path formations from file");
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
{
if (!wellPaths[wpIdx]->filepath().isEmpty())
{
QString errorMessage;
if (!wellPaths[wpIdx]->readWellPathFormationsFile(&errorMessage, m_wellPathFormationsImporter))
{
QMessageBox::warning(RiuMainWindow::instance(),
"File open error",
errorMessage);
}
}
progress.setProgressDescription(QString("Reading formation file %1").arg(wpIdx));
progress.incrementProgress();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -34,14 +34,15 @@
#include "cvfObject.h"
#include <QString>
class RifWellPathImporter;
class RigWellPath;
class RimEclipseView;
class RimProject;
class RimWellLogFile;
class RimWellPath;
class RimWellPathFormations;
class RifWellPathFormationsImporter;
class QString;
namespace cvf {
class ModelBasicList;
@ -95,10 +96,13 @@ public:
void removeWellPath(RimWellPath* wellPath);
void deleteAllWellPaths();
void readWellPathFormationFiles();
RimWellPath* wellPathByName(const QString& wellPathName) const;
RimWellPath* tryFindMatchingWellPath(const QString& wellName) const;
void addWellPaths(const std::vector<RimWellPath*> wellPaths);
RimWellLogFile* addWellLogs(const QStringList& filePaths);
RimWellPathFormations* addWellFormations(const QStringList& filePaths);
void scheduleRedrawAffectedViews();
@ -119,11 +123,11 @@ public:
const caf::DisplayCoordTransform* displayCoordTransform);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
protected:
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
virtual caf::PdmFieldHandle* objectToggleField();
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual caf::PdmFieldHandle* objectToggleField() override;
void readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray);
void sortWellsByName();
@ -131,5 +135,6 @@ private:
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath(const RimWellPath* wellPath);
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
QString m_newestAddedWellName;
};