mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 08:25:03 -05:00
Add support for well paths from OSDU.
This commit is contained in:
1 parent
d02dd2dfed
commit
577ef1e154
33 files changed
+2003
-1268
No files matched your search
@@ -370,7 +370,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder.subMenuStart( "Import" );
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellPathsImportSsihubFeature";
|
||||
menuBuilder << "RicWellPathsImportOsduFeature";
|
||||
menuBuilder << "RicWellPathFormationsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "RicReloadWellPathFormationNamesFeature";
|
||||
|
||||
@@ -270,8 +270,6 @@ void RimProject::close()
|
||||
casesObsolete.deleteChildren();
|
||||
caseGroupsObsolete.deleteChildren();
|
||||
|
||||
wellPathImport->regions().deleteChildren();
|
||||
|
||||
commandObjects.deleteChildren();
|
||||
|
||||
multiSnapshotDefinitions.deleteChildren();
|
||||
@@ -512,7 +510,6 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project
|
||||
filePath->setPath( newFilePath );
|
||||
}
|
||||
|
||||
wellPathImport->updateFilePaths();
|
||||
auto* wellPathColl = RimTools::wellPathCollection();
|
||||
if ( wellPathColl )
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellIAModelBox.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellIAModelData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellIADataAccess.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellPath.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -34,6 +35,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellIAModelBox.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellIAModelData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellIADataAccess.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOsduWellPath.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
#include "RimOsduWellPath.h"
|
||||
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimOsduWellPath, "OsduWellPath" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOsduWellPath::RimOsduWellPath()
|
||||
{
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "Osdu Well Path", ":/Well.svg", "", "", "OsduWellPath", "Well Path Loaded From Osdu" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellId, "WellId", "Well Id" );
|
||||
m_wellId.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellboreId, "WellboreId", "Wellbore Id" );
|
||||
m_wellboreId.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellboreTrajectoryId, "WellboreTrajectoryId", "Wellbore Trajectory Id" );
|
||||
m_wellboreTrajectoryId.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fileId, "FileId", "File Id" );
|
||||
m_fileId.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOsduWellPath::~RimOsduWellPath()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOsduWellPath::setWellId( const QString& wellId )
|
||||
{
|
||||
m_wellId = wellId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimOsduWellPath::wellId() const
|
||||
{
|
||||
return m_wellId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOsduWellPath::setWellboreId( const QString& wellboreId )
|
||||
{
|
||||
m_wellboreId = wellboreId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimOsduWellPath::wellboreId() const
|
||||
{
|
||||
return m_wellboreId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOsduWellPath::setWellboreTrajectoryId( const QString& wellboreTrajectoryId )
|
||||
{
|
||||
m_wellboreTrajectoryId = wellboreTrajectoryId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimOsduWellPath::wellboreTrajectoryId() const
|
||||
{
|
||||
return m_wellboreTrajectoryId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOsduWellPath::setFileId( const QString& fileId )
|
||||
{
|
||||
m_fileId = fileId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimOsduWellPath::fileId() const
|
||||
{
|
||||
return m_fileId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOsduWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* osduGroup = uiOrdering.addNewGroup( "OSDU" );
|
||||
osduGroup->add( &m_wellId );
|
||||
osduGroup->add( &m_wellboreId );
|
||||
osduGroup->add( &m_wellboreTrajectoryId );
|
||||
osduGroup->add( &m_fileId );
|
||||
|
||||
RimWellPath::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimWellPath.h"
|
||||
|
||||
class RimOsduWellPath : public RimWellPath
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimOsduWellPath();
|
||||
~RimOsduWellPath() override;
|
||||
|
||||
void setWellId( const QString& wellId );
|
||||
QString wellId() const;
|
||||
|
||||
void setWellboreId( const QString& wellboreId );
|
||||
QString wellboreId() const;
|
||||
|
||||
void setWellboreTrajectoryId( const QString& wellboreTrajectoryId );
|
||||
QString wellboreTrajectoryId() const;
|
||||
|
||||
void setFileId( const QString& fileId );
|
||||
QString fileId() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellId;
|
||||
caf::PdmField<QString> m_wellboreId;
|
||||
caf::PdmField<QString> m_wellboreTrajectoryId;
|
||||
caf::PdmField<QString> m_fileId;
|
||||
};
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RiaOsduConnector;
|
||||
class RifWellPathImporter;
|
||||
class RigWellPath;
|
||||
class RimFileWellPath;
|
||||
@@ -131,6 +132,8 @@ public:
|
||||
|
||||
void onChildAdded( caf::PdmFieldHandle* containerForNewObject ) override;
|
||||
|
||||
static std::pair<cvf::ref<RigWellPath>, QString> loadWellPathGeometryFromOsdu( RiaOsduConnector* osduConnector, const QString& fileId );
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
|
||||
Reference in new issue
Block a user