Add support for well paths from OSDU.

This commit is contained in:
Kristian Bendiksen committed 2024-05-24 15:19:43 +02:00
1 parent d02dd2dfed
commit 577ef1e154
33 files changed
+2003 -1268

No files matched your search

@@ -20,6 +20,7 @@
#include "RimWellPathCollection.h"
#include "OsduImportCommands/RiaOsduConnector.h"
#include "RiaColorTables.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
@@ -27,6 +28,7 @@
#include "RiaTextStringTools.h"
#include "RiaWellNameComparer.h"
#include "RifOsduWellPathReader.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
@@ -40,6 +42,7 @@
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimOsduWellPath.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimStimPlanModel.h"
@@ -50,6 +53,8 @@
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathTieIn.h"
#include "RiuMainWindow.h"
#include "cafTreeNode.h" // TODO: Move to caf
#include "Riu3DMainWindowTools.h"
@@ -67,6 +72,7 @@
#include <cmath>
#include <fstream>
#include <memory>
namespace caf
{
@@ -149,6 +155,7 @@ void RimWellPathCollection::loadDataAndUpdate()
auto* fWPath = dynamic_cast<RimFileWellPath*>( wellPath );
auto* mWPath = dynamic_cast<RimModeledWellPath*>( wellPath );
auto* oWPath = dynamic_cast<RimOsduWellPath*>( wellPath );
if ( fWPath )
{
if ( !fWPath->filePath().isEmpty() )
@@ -164,6 +171,31 @@ void RimWellPathCollection::loadDataAndUpdate()
{
mWPath->createWellPathGeometry();
}
else if ( oWPath )
{
RiaApplication* app = RiaApplication::instance();
RiaPreferencesOsdu* osduPreferences = app->preferences()->osduPreferences();
const QString server = osduPreferences->server();
const QString dataParitionId = osduPreferences->dataPartitionId();
const QString authority = osduPreferences->authority();
const QString scopes = osduPreferences->scopes();
const QString clientId = osduPreferences->clientId();
auto osduConnector =
std::make_unique<RiaOsduConnector>( RiuMainWindow::instance(), server, dataParitionId, authority, scopes, clientId );
auto [wellPathGeometry, errorMessage] = loadWellPathGeometryFromOsdu( osduConnector.get(), oWPath->fileId() );
if ( wellPathGeometry.notNull() )
{
oWPath->setWellPathGeometry( wellPathGeometry.p() );
}
else
{
RiaLogging::warning( errorMessage );
}
}
if ( wellPath )
{
@@ -1013,3 +1045,18 @@ void RimWellPathCollection::onChildAdded( caf::PdmFieldHandle* containerForNewOb
scheduleRedrawAffectedViews();
uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<cvf::ref<RigWellPath>, QString> RimWellPathCollection::loadWellPathGeometryFromOsdu( RiaOsduConnector* osduConnector,
const QString& fileId )
{
auto [fileContents, errorMessage] = osduConnector->requestFileContentsById( fileId );
if ( !errorMessage.isEmpty() )
{
return { nullptr, errorMessage };
}
return RifOsduWellPathReader::parseCsv( fileContents );
}