From 95c396ce7705f053f5b5547704d6f3dc9b6860d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jacob=20St=C3=B8ren?= <jacob.storen@ceetronsolutions.com>
Date: Mon, 2 Jul 2018 16:55:32 +0200
Subject: [PATCH] #2609 Make modeled well path visible when loading project
file
---
.../Application/RiaApplication.cpp | 2 +-
.../ProjectDataModel/RimModeledWellPath.cpp | 8 +++
.../ProjectDataModel/RimModeledWellPath.h | 1 +
.../RimWellPathCollection.cpp | 59 +++++++++++--------
.../ProjectDataModel/RimWellPathCollection.h | 2 +-
5 files changed, 44 insertions(+), 28 deletions(-)
diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp
index 0816c16a3a..513ee58084 100644
--- a/ApplicationCode/Application/RiaApplication.cpp
+++ b/ApplicationCode/Application/RiaApplication.cpp
@@ -467,7 +467,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
if (oilField->wellPathCollection)
{
- oilField->wellPathCollection->readWellPathFiles();
+ oilField->wellPathCollection->loadDataAndUpdate();
oilField->wellPathCollection->readWellPathFormationFiles();
}
}
diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp
index 8e065b442e..a7ab02a75b 100644
--- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp
+++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp
@@ -33,6 +33,14 @@ RimModeledWellPath::~RimModeledWellPath()
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RimModeledWellPath::createWellPathGeometry()
+{
+ this->setWellPathGeometry(m_geometryDefinition->createWellPathGeometry().p());
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h
index fbc181cb99..07f20da36c 100644
--- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h
+++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h
@@ -37,6 +37,7 @@ public:
RimModeledWellPath();
~RimModeledWellPath();
+ void createWellPathGeometry();
void updateWellPathVisualization();
private:
diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp
index 5ca1c3d736..ba3133f345 100644
--- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp
+++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp
@@ -55,6 +55,7 @@
#include <cmath>
#include <fstream>
#include "RimFileWellPath.h"
+#include "RimModeledWellPath.h"
namespace caf
{
@@ -126,50 +127,56 @@ void RimWellPathCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedF
//--------------------------------------------------------------------------------------------------
-/// Read JSON files containing well path data
+/// Read files containing well path data, or create geometry based on the targets
//--------------------------------------------------------------------------------------------------
-void RimWellPathCollection::readWellPathFiles()
+void RimWellPathCollection::loadDataAndUpdate()
{
caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
{
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>(wellPaths[wpIdx]);
+ RimModeledWellPath* mWPath = dynamic_cast<RimModeledWellPath*>(wellPaths[wpIdx]);
if (fWPath)
{
- if (!fWPath->filepath().isEmpty())
- {
- QString errorMessage;
- if (!fWPath->readWellPathFile(&errorMessage, m_wellPathImporter))
- {
- QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(),
- "File open error",
- errorMessage);
- }
- }
-
- for (RimWellLogFile* const wellLogFile : fWPath->wellLogFiles())
- {
- if (wellLogFile)
+ if ( !fWPath->filepath().isEmpty() )
{
QString errorMessage;
- if (!wellLogFile->readFile(&errorMessage))
+ if ( !fWPath->readWellPathFile(&errorMessage, m_wellPathImporter) )
{
- QString displayMessage = "Could not open the well log file: \n" + wellLogFile->fileName();
-
- if (!errorMessage.isEmpty())
- {
- displayMessage += "\n\n";
- displayMessage += errorMessage;
- }
-
QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(),
"File open error",
- displayMessage);
+ errorMessage);
+ }
+ }
+
+ for ( RimWellLogFile* const wellLogFile : fWPath->wellLogFiles() )
+ {
+ if ( wellLogFile )
+ {
+ QString errorMessage;
+ if ( !wellLogFile->readFile(&errorMessage) )
+ {
+ QString displayMessage = "Could not open the well log file: \n" + wellLogFile->fileName();
+
+ if ( !errorMessage.isEmpty() )
+ {
+ displayMessage += "\n\n";
+ displayMessage += errorMessage;
+ }
+
+ QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(),
+ "File open error",
+ displayMessage);
+ }
}
}
}
+ else if (mWPath)
+ {
+ mWPath->createWellPathGeometry();
}
+
progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name()));
progress.incrementProgress();
}
diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h
index 9021f0da33..54d4ad682a 100644
--- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.h
+++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.h
@@ -88,7 +88,7 @@ public:
caf::PdmChildArrayField<RimWellPath*> wellPaths;
- void readWellPathFiles();
+ void loadDataAndUpdate();
void addWellPaths(QStringList filePaths);
void removeWellPath(RimWellPath* wellPath);