#2609 Make modeled well path visible when loading project file

This commit is contained in:
Jacob Støren
2018-07-02 16:55:32 +02:00
parent dc95b217c5
commit 95c396ce77
5 changed files with 44 additions and 28 deletions

View File

@@ -467,7 +467,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
if (oilField->wellPathCollection) if (oilField->wellPathCollection)
{ {
oilField->wellPathCollection->readWellPathFiles(); oilField->wellPathCollection->loadDataAndUpdate();
oilField->wellPathCollection->readWellPathFormationFiles(); oilField->wellPathCollection->readWellPathFormationFiles();
} }
} }

View File

@@ -33,6 +33,14 @@ RimModeledWellPath::~RimModeledWellPath()
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPath::createWellPathGeometry()
{
this->setWellPathGeometry(m_geometryDefinition->createWellPathGeometry().p());
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -37,6 +37,7 @@ public:
RimModeledWellPath(); RimModeledWellPath();
~RimModeledWellPath(); ~RimModeledWellPath();
void createWellPathGeometry();
void updateWellPathVisualization(); void updateWellPathVisualization();
private: private:

View File

@@ -55,6 +55,7 @@
#include <cmath> #include <cmath>
#include <fstream> #include <fstream>
#include "RimFileWellPath.h" #include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
namespace caf namespace caf
{ {
@@ -126,21 +127,22 @@ 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"); caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++) for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
{ {
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>(wellPaths[wpIdx]); RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>(wellPaths[wpIdx]);
RimModeledWellPath* mWPath = dynamic_cast<RimModeledWellPath*>(wellPaths[wpIdx]);
if (fWPath) if (fWPath)
{ {
if (!fWPath->filepath().isEmpty()) if ( !fWPath->filepath().isEmpty() )
{ {
QString errorMessage; QString errorMessage;
if (!fWPath->readWellPathFile(&errorMessage, m_wellPathImporter)) if ( !fWPath->readWellPathFile(&errorMessage, m_wellPathImporter) )
{ {
QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(), QMessageBox::warning(Riu3DMainWindowTools::mainWindowWidget(),
"File open error", "File open error",
@@ -148,16 +150,16 @@ void RimWellPathCollection::readWellPathFiles()
} }
} }
for (RimWellLogFile* const wellLogFile : fWPath->wellLogFiles()) for ( RimWellLogFile* const wellLogFile : fWPath->wellLogFiles() )
{ {
if (wellLogFile) if ( wellLogFile )
{ {
QString errorMessage; QString errorMessage;
if (!wellLogFile->readFile(&errorMessage)) if ( !wellLogFile->readFile(&errorMessage) )
{ {
QString displayMessage = "Could not open the well log file: \n" + wellLogFile->fileName(); QString displayMessage = "Could not open the well log file: \n" + wellLogFile->fileName();
if (!errorMessage.isEmpty()) if ( !errorMessage.isEmpty() )
{ {
displayMessage += "\n\n"; displayMessage += "\n\n";
displayMessage += errorMessage; displayMessage += errorMessage;
@@ -170,6 +172,11 @@ void RimWellPathCollection::readWellPathFiles()
} }
} }
} }
else if (mWPath)
{
mWPath->createWellPathGeometry();
}
progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name())); progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name()));
progress.incrementProgress(); progress.incrementProgress();
} }

View File

@@ -88,7 +88,7 @@ public:
caf::PdmChildArrayField<RimWellPath*> wellPaths; caf::PdmChildArrayField<RimWellPath*> wellPaths;
void readWellPathFiles(); void loadDataAndUpdate();
void addWellPaths(QStringList filePaths); void addWellPaths(QStringList filePaths);
void removeWellPath(RimWellPath* wellPath); void removeWellPath(RimWellPath* wellPath);