mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2122 Formation/Well Path: Set formations path and key on RimWellPath
This commit is contained in:
@@ -106,7 +106,7 @@ RimWellPath::RimWellPath()
|
||||
CAF_PDM_InitFieldNoDefault(&m_unitSystem, "UnitSystem", "Unit System", "", "", "");
|
||||
m_unitSystem.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&filepath, "WellPathFilepath", QString(""), "Filepath", "", "", "");
|
||||
CAF_PDM_InitField(&filepath, "WellPathFilepath", QString(""), "File Path", "", "", "");
|
||||
filepath.uiCapability()->setUiReadOnly(true);
|
||||
CAF_PDM_InitField(&wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in file", "", "", "");
|
||||
wellPathIndexInFile.uiCapability()->setUiReadOnly(true);
|
||||
@@ -129,11 +129,17 @@ RimWellPath::RimWellPath()
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogFiles, "WellLogFiles", "Well Log Files", "", "", "");
|
||||
m_wellLogFiles.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_formationKeyInFile, "WellPathFormationKeyInFile", QString(""), "Key in File", "", "", "");
|
||||
m_formationKeyInFile.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&m_wellPathFormationFilePath, "WellPathFormationFilePath", QString(""), "File Path", "", "", "");
|
||||
m_wellPathFormationFilePath.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogFile_OBSOLETE, "WellLogFile", "Well Log File", "", "", "");
|
||||
m_wellLogFile_OBSOLETE.uiCapability()->setUiHidden(true);
|
||||
m_wellLogFile_OBSOLETE.xmlCapability()->setIOWritable(false);
|
||||
|
||||
m_wellPath = NULL;
|
||||
m_wellPath = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -489,6 +495,10 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
m_datumElevation.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* formationFileInfoGroup = uiOrdering.addNewGroup("Formation Names");
|
||||
formationFileInfoGroup->add(&m_wellPathFormationFilePath);
|
||||
formationFileInfoGroup->add(&m_formationKeyInFile);
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
@@ -596,7 +606,7 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath,
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = RimTools::relocateFile(filepath(), newProjectPath, oldProjectPath, NULL, NULL);
|
||||
filepath = RimTools::relocateFile(filepath(), newProjectPath, oldProjectPath, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,17 +691,13 @@ void RimWellPath::detachWellLogFile(RimWellLogFile* logFileInfo)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::setWellFormationFile(const QString& formationFilePath)
|
||||
void RimWellPath::setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations)
|
||||
{
|
||||
m_wellPathFormationFilePath = formationFilePath;
|
||||
}
|
||||
m_wellPathFormations = wellPathFormations;
|
||||
m_wellPathFormationFilePath = wellPathFormations->filePath();
|
||||
m_formationKeyInFile = wellPathFormations->keyInFile();
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPath::wellFormationFile() const
|
||||
{
|
||||
return m_wellPathFormationFilePath;
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -699,9 +705,18 @@ QString RimWellPath::wellFormationFile() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPath::readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter)
|
||||
{
|
||||
if (m_wellPathFormationFilePath().isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (caf::Utils::fileExists(m_wellPathFormationFilePath()))
|
||||
{
|
||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations(m_wellPathFormationFilePath(), m_name());
|
||||
m_wellPathFormations = wellPathFormationsImporter->readWellPathFormations(m_wellPathFormationFilePath(), m_formationKeyInFile());
|
||||
if (m_name().isEmpty())
|
||||
{
|
||||
setName(m_formationKeyInFile());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -72,8 +72,7 @@ public:
|
||||
void deleteWellLogFile(RimWellLogFile* logFileInfo);
|
||||
void detachWellLogFile(RimWellLogFile* logFileInfo);
|
||||
|
||||
void setWellFormationFile(const QString& formationFilePath);
|
||||
QString wellFormationFile() const;
|
||||
void setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations);
|
||||
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
@@ -167,6 +166,8 @@ private:
|
||||
cvf::ref<RivWellPathPartMgr> m_wellPathPartMgr;
|
||||
caf::PdmField<QString> m_name;
|
||||
|
||||
caf::PdmField<QString> m_formationKeyInFile;
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
|
||||
|
||||
caf::PdmField<QString> m_wellPathFormationFilePath;
|
||||
|
||||
@@ -330,29 +330,27 @@ RimWellLogFile* RimWellPathCollection::addWellLogs(const QStringList& filePaths)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathFormations* RimWellPathCollection::addWellFormations(const QStringList& filePaths)
|
||||
void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths)
|
||||
{
|
||||
RimWellPathFormations* wellFormationFile = nullptr;
|
||||
/*
|
||||
foreach(QString filePath, filePaths)
|
||||
for (QString filePath : filePaths)
|
||||
{
|
||||
wellFormationFile = RimWellPathFormations::readWellLogFile(filePath);
|
||||
if (wellFormationFile)
|
||||
std::map<QString, cvf::ref<RigWellPathFormations>> newFormations =
|
||||
m_wellPathFormationsImporter->readWellPathFormationsFromPath(filePath);
|
||||
|
||||
for (auto it = newFormations.begin(); it != newFormations.end(); it++)
|
||||
{
|
||||
RimWellPath* wellPath = tryFindMatchingWellPath(wellFormationFile->wellName());
|
||||
RimWellPath* wellPath = tryFindMatchingWellPath(it->first);
|
||||
if (!wellPath)
|
||||
{
|
||||
wellPath = new RimWellPath();
|
||||
wellPath->setName(it->first);
|
||||
wellPaths.push_back(wellPath);
|
||||
}
|
||||
|
||||
wellPath->setWellFormationFile(wellFormationFile);
|
||||
wellPath->setFormationsGeometry(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
this->sortWellsByName();*/
|
||||
|
||||
return wellFormationFile;
|
||||
this->sortWellsByName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -503,15 +501,12 @@ void RimWellPathCollection::readWellPathFormationFiles()
|
||||
|
||||
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
||||
{
|
||||
if (!wellPaths[wpIdx]->filepath().isEmpty())
|
||||
QString errorMessage;
|
||||
if (!wellPaths[wpIdx]->readWellPathFormationsFile(&errorMessage, m_wellPathFormationsImporter))
|
||||
{
|
||||
QString errorMessage;
|
||||
if (!wellPaths[wpIdx]->readWellPathFormationsFile(&errorMessage, m_wellPathFormationsImporter))
|
||||
{
|
||||
QMessageBox::warning(RiuMainWindow::instance(),
|
||||
"File open error",
|
||||
errorMessage);
|
||||
}
|
||||
QMessageBox::warning(RiuMainWindow::instance(),
|
||||
"File open error",
|
||||
errorMessage);
|
||||
}
|
||||
|
||||
progress.setProgressDescription(QString("Reading formation file %1").arg(wpIdx));
|
||||
|
||||
@@ -40,7 +40,6 @@ class RimEclipseView;
|
||||
class RimProject;
|
||||
class RimWellLogFile;
|
||||
class RimWellPath;
|
||||
class RimWellPathFormations;
|
||||
class RifWellPathFormationsImporter;
|
||||
class QString;
|
||||
|
||||
@@ -102,7 +101,7 @@ public:
|
||||
RimWellPath* tryFindMatchingWellPath(const QString& wellName) const;
|
||||
void addWellPaths(const std::vector<RimWellPath*> wellPaths);
|
||||
RimWellLogFile* addWellLogs(const QStringList& filePaths);
|
||||
RimWellPathFormations* addWellFormations(const QStringList& filePaths);
|
||||
void addWellPathFormations(const QStringList& filePaths);
|
||||
|
||||
void scheduleRedrawAffectedViews();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user