From 54e8b59ccff0f970f1036a8057dfbc8661bd8441 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 10 Dec 2025 08:41:36 +0100 Subject: [PATCH] #13283 OSDU: Add ExistenceKind support and improve well import wizard - Add ExistenceKind field to OsduWellboreTrajectory struct - Extract ExistenceKind from OSDU trajectory JSON data - Add ExistenceKind field to WellInfo structure - Display ExistenceKind in RimOsduWellPath UI under OSDU group - Add Enter key support for field search in import wizard - Show trajectory count in well import summary page --- .../Tools/Cloud/RiaOsduConnector.cpp | 16 ++++++++++++--- .../Tools/Cloud/RiaOsduConnector.h | 1 + .../RicWellPathsImportOsduFeature.cpp | 1 + .../OsduCommands/RiuWellImportWizard.cpp | 7 +++++++ .../OsduCommands/RiuWellImportWizard.h | 1 + .../WellPath/RimOsduWellPath.cpp | 20 +++++++++++++++++++ .../WellPath/RimOsduWellPath.h | 4 ++++ 7 files changed, 47 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.cpp b/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.cpp index 2ffa91decb..07bf835c72 100644 --- a/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.cpp +++ b/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.cpp @@ -414,10 +414,20 @@ void RiaOsduConnector::parseWellTrajectory( QNetworkReply* reply, const QString& for ( const QJsonValue& value : resultsArray ) { QJsonObject resultObj = value.toObject(); - QString id = resultObj["id"].toString(); - QString kind = resultObj["kind"].toString(); + if ( resultObj.isEmpty() ) continue; - m_wellboreTrajectories[wellboreId].push_back( OsduWellboreTrajectory{ id, kind, wellboreId } ); + QString id = resultObj["id"].toString(); + QString kind = resultObj["kind"].toString(); + QString existenceKind; + + // Safely extract existenceKind from nested data object + QJsonObject dataObj = resultObj["data"].toObject(); + if ( !dataObj.isEmpty() && dataObj.contains( "ExistenceKind" ) ) + { + existenceKind = dataObj["ExistenceKind"].toString(); + } + + m_wellboreTrajectories[wellboreId].push_back( OsduWellboreTrajectory{ id, kind, wellboreId, existenceKind } ); } } diff --git a/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.h b/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.h index 606d0773f2..81a764d8b9 100644 --- a/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.h +++ b/ApplicationLibCode/Application/Tools/Cloud/RiaOsduConnector.h @@ -50,6 +50,7 @@ struct OsduWellboreTrajectory QString id; QString kind; QString wellboreId; + QString existenceKind; }; struct OsduWellLogChannel diff --git a/ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.cpp b/ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.cpp index b28eb1a9fe..bf1eacee4c 100644 --- a/ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.cpp +++ b/ApplicationLibCode/Commands/OsduCommands/RicWellPathsImportOsduFeature.cpp @@ -91,6 +91,7 @@ void RicWellPathsImportOsduFeature::onActionTriggered( bool isChecked ) wellPath->setWellId( w.wellId ); wellPath->setWellboreId( w.wellboreId ); wellPath->setWellboreTrajectoryId( w.wellboreTrajectoryId ); + wellPath->setExistenceKind( w.existenceKind ); wellPath->setDatumElevationFromOsdu( w.datumElevation ); wellPath->setWellPathColor( RiaColorTables::wellPathsPaletteColors().cycledColor3f( colorIndex++ ) ); diff --git a/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.cpp index 0b64567e70..cbb94abc66 100644 --- a/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.cpp +++ b/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.cpp @@ -508,6 +508,8 @@ void WellSummaryPage::initializePage() { RiuWellImportWizard* wiz = dynamic_cast( wizard() ); + m_textEdit->clear(); + QMutexLocker lock( &m_mutex ); m_pendingWellboreIds.clear(); for ( const QString& wellboreId : wiz->selectedWellboreIds() ) @@ -544,6 +546,10 @@ void WellSummaryPage::wellboreTrajectoryFinished( const QString& wellboreId, int { m_textEdit->append( QString( "Wellbore '%1': No trajectory found." ).arg( wellbore.value().name ) ); } + else + { + m_textEdit->append( QString( "Wellbore '%1': Found %2 trajectory(ies)." ).arg( wellbore.value().name ).arg( numTrajectories ) ); + } for ( auto w : wellboreTrajectories ) { @@ -552,6 +558,7 @@ void WellSummaryPage::wellboreTrajectoryFinished( const QString& wellboreId, int .wellId = wellbore.value().wellId, .wellboreId = w.wellboreId, .wellboreTrajectoryId = wellboreTrajectoryId, + .existenceKind = w.existenceKind, .datumElevation = wellbore.value().datumElevation } ); } } diff --git a/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.h b/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.h index c8192151d4..608864fb39 100644 --- a/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.h +++ b/ApplicationLibCode/Commands/OsduCommands/RiuWellImportWizard.h @@ -370,6 +370,7 @@ public: QString wellId; QString wellboreId; QString wellboreTrajectoryId; + QString existenceKind; double datumElevation; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.cpp index ecf3c8b8ce..d13b2d8eb6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.cpp @@ -21,6 +21,9 @@ RimOsduWellPath::RimOsduWellPath() CAF_PDM_InitFieldNoDefault( &m_wellboreTrajectoryId, "WellboreTrajectoryId", "Wellbore Trajectory Id" ); m_wellboreTrajectoryId.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitFieldNoDefault( &m_existenceKind, "ExistenceKind", "Existence Kind" ); + m_existenceKind.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitField( &m_datumElevationFromOsdu, "DatumElevationFromOsdu", 0.0, "Datum Elevation From OSDU" ); m_datumElevationFromOsdu.uiCapability()->setUiReadOnly( true ); } @@ -96,6 +99,22 @@ double RimOsduWellPath::datumElevationFromOsdu() const return m_datumElevationFromOsdu; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimOsduWellPath::setExistenceKind( const QString& existenceKind ) +{ + m_existenceKind = existenceKind; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimOsduWellPath::existenceKind() const +{ + return m_existenceKind; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -105,6 +124,7 @@ void RimOsduWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering osduGroup->add( &m_wellId ); osduGroup->add( &m_wellboreId ); osduGroup->add( &m_wellboreTrajectoryId ); + osduGroup->add( &m_existenceKind ); osduGroup->add( &m_datumElevationFromOsdu ); RimWellPath::defineUiOrdering( uiConfigName, uiOrdering ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.h index 72d1628803..b0f5afdac3 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimOsduWellPath.h @@ -39,6 +39,9 @@ public: void setDatumElevationFromOsdu( double datumElevationFromOsdu ); double datumElevationFromOsdu() const; + void setExistenceKind( const QString& existenceKind ); + QString existenceKind() const; + protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -46,5 +49,6 @@ private: caf::PdmField m_wellId; caf::PdmField m_wellboreId; caf::PdmField m_wellboreTrajectoryId; + caf::PdmField m_existenceKind; caf::PdmField m_datumElevationFromOsdu; };