mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add support for well paths from OSDU.
This commit is contained in:
@@ -9,6 +9,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesSummary.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesGeoMech.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesSystem.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesOsdu.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPorosityModel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.h
|
||||
@@ -35,6 +36,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFileDownloader.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -48,6 +50,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesSummary.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesGeoMech.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesSystem.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPreferencesOsdu.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPorosityModel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCurveSetDefinition.cpp
|
||||
@@ -74,6 +77,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaLasDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellFlowDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAddress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFileDownloader.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
@@ -87,6 +91,7 @@ set(QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFileDownloader.h
|
||||
)
|
||||
|
||||
source_group(
|
||||
|
||||
54
ApplicationLibCode/Application/RiaFileDownloader.cpp
Normal file
54
ApplicationLibCode/Application/RiaFileDownloader.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "RiaFileDownloader.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
RiaFileDownloader::RiaFileDownloader( QObject* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
}
|
||||
|
||||
void RiaFileDownloader::downloadFile( const QUrl& url, const QString& filePath )
|
||||
{
|
||||
QNetworkAccessManager* manager = new QNetworkAccessManager( this );
|
||||
QNetworkRequest request( url );
|
||||
|
||||
RiaLogging::debug( "Downloading from: " + url.toString() );
|
||||
|
||||
QNetworkReply* reply = manager->get( request );
|
||||
|
||||
connect( reply,
|
||||
&QNetworkReply::finished,
|
||||
[=]()
|
||||
{
|
||||
if ( reply->error() )
|
||||
{
|
||||
RiaLogging::error( "Download failed:" + reply->errorString() );
|
||||
emit done();
|
||||
}
|
||||
else
|
||||
{
|
||||
QFile file( filePath );
|
||||
if ( file.open( QIODevice::WriteOnly ) )
|
||||
{
|
||||
file.write( reply->readAll() );
|
||||
file.close();
|
||||
RiaLogging::info( "Download succeeded. File saved to " + filePath );
|
||||
emit done();
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::info( "Failed to save file to " + filePath );
|
||||
emit done();
|
||||
}
|
||||
}
|
||||
reply->deleteLater();
|
||||
manager->deleteLater();
|
||||
} );
|
||||
}
|
||||
16
ApplicationLibCode/Application/RiaFileDownloader.h
Normal file
16
ApplicationLibCode/Application/RiaFileDownloader.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
class RiaFileDownloader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RiaFileDownloader( QObject* parent = nullptr );
|
||||
|
||||
void downloadFile( const QUrl& url, const QString& filePath );
|
||||
signals:
|
||||
void done();
|
||||
};
|
||||
@@ -279,6 +279,9 @@ RiaPreferences::RiaPreferences()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences" );
|
||||
m_systemPreferences = new RiaPreferencesSystem;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_osduPreferences, "osduPreferences", "osduPreferences" );
|
||||
m_osduPreferences = new RiaPreferencesOsdu;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -487,6 +490,10 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
m_loggerTrapSignalAndFlush.uiCapability()->setUiReadOnly( !m_loggerFilename().first );
|
||||
m_loggerFlushInterval.uiCapability()->setUiReadOnly( !m_loggerFilename().first );
|
||||
}
|
||||
else if ( uiConfigName == RiaPreferences::tabNameOsdu() )
|
||||
{
|
||||
m_osduPreferences()->uiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
|
||||
{
|
||||
m_systemPreferences()->uiOrdering( uiConfigName, uiOrdering );
|
||||
@@ -614,6 +621,14 @@ QString RiaPreferences::tabNameSystem()
|
||||
return "System";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameOsdu()
|
||||
{
|
||||
return "Osdu";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -654,6 +669,7 @@ QStringList RiaPreferences::tabNames()
|
||||
names << tabNameGeomech();
|
||||
#endif
|
||||
names << tabNameImportExport();
|
||||
names << tabNameOsdu();
|
||||
|
||||
if ( RiaApplication::enableDevelopmentFeatures() )
|
||||
{
|
||||
@@ -1018,6 +1034,14 @@ RiaPreferencesGeoMech* RiaPreferences::geoMechPreferences() const
|
||||
return m_geoMechPreferences();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferencesOsdu* RiaPreferences::osduPreferences() const
|
||||
{
|
||||
return m_osduPreferences();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "RiaDateTimeDefines.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaFontCache.h"
|
||||
#include "RiaPreferencesOsdu.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@@ -43,6 +44,7 @@ class RifReaderSettings;
|
||||
class RiaPreferencesSummary;
|
||||
class RiaPreferencesGeoMech;
|
||||
class RiaPreferencesSystem;
|
||||
class RiaPreferencesOsdu;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -125,6 +127,7 @@ public:
|
||||
RiaPreferencesGeoMech* geoMechPreferences() const;
|
||||
RiaPreferencesSummary* summaryPreferences() const;
|
||||
RiaPreferencesSystem* systemPreferences() const;
|
||||
RiaPreferencesOsdu* osduPreferences() const;
|
||||
|
||||
public:
|
||||
caf::PdmField<bool> enableGrpcServer;
|
||||
@@ -170,6 +173,7 @@ private:
|
||||
static QString tabNamePlotting();
|
||||
static QString tabNameScripting();
|
||||
static QString tabNameSystem();
|
||||
static QString tabNameOsdu();
|
||||
static QString tabNameImportExport();
|
||||
|
||||
static double defaultMarginSize( QPageSize::PageSizeId pageSizeId );
|
||||
@@ -230,6 +234,9 @@ private:
|
||||
// System settings
|
||||
caf::PdmChildField<RiaPreferencesSystem*> m_systemPreferences;
|
||||
|
||||
// Osdu settings
|
||||
caf::PdmChildField<RiaPreferencesOsdu*> m_osduPreferences;
|
||||
|
||||
// 3d view
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::MeshModeType>> m_defaultMeshModeType;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::RINavigationPolicy>> m_navigationPolicy;
|
||||
|
||||
84
ApplicationLibCode/Application/RiaPreferencesOsdu.cpp
Normal file
84
ApplicationLibCode/Application/RiaPreferencesOsdu.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaPreferencesOsdu.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RiaPreferencesOsdu, "RiaPreferencesOsdu" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferencesOsdu::RiaPreferencesOsdu()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &m_server, "server", "Server" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_dataPartitionId, "dataPartitionId", "Data Partition Id" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_authority, "authority", "Authority" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_scopes, "scopes", "Scopes" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_clientId, "clientId", "Client Id" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferencesOsdu* RiaPreferencesOsdu::current()
|
||||
{
|
||||
return RiaApplication::instance()->preferences()->osduPreferences();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferencesOsdu::server() const
|
||||
{
|
||||
return m_server;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferencesOsdu::dataPartitionId() const
|
||||
{
|
||||
return m_dataPartitionId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferencesOsdu::authority() const
|
||||
{
|
||||
return m_authority;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferencesOsdu::scopes() const
|
||||
{
|
||||
return m_scopes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferencesOsdu::clientId() const
|
||||
{
|
||||
return m_clientId;
|
||||
}
|
||||
48
ApplicationLibCode/Application/RiaPreferencesOsdu.h
Normal file
48
ApplicationLibCode/Application/RiaPreferencesOsdu.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiaPreferencesOsdu : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RiaPreferencesOsdu();
|
||||
|
||||
static RiaPreferencesOsdu* current();
|
||||
|
||||
QString server() const;
|
||||
QString dataPartitionId() const;
|
||||
QString authority() const;
|
||||
QString scopes() const;
|
||||
QString clientId() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_server;
|
||||
caf::PdmField<QString> m_dataPartitionId;
|
||||
caf::PdmField<QString> m_authority;
|
||||
caf::PdmField<QString> m_scopes;
|
||||
caf::PdmField<QString> m_clientId;
|
||||
};
|
||||
Reference in New Issue
Block a user