#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)
{
oilField->wellPathCollection->readWellPathFiles();
oilField->wellPathCollection->loadDataAndUpdate();
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();
void createWellPathGeometry();
void updateWellPathVisualization();
private:

View File

@ -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();
}

View File

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