mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Integrated well import wizard in project file
p4#: 22331
This commit is contained in:
@@ -19,6 +19,7 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
|
||||||
${CMAKE_BINARY_DIR}/Generated
|
${CMAKE_BINARY_DIR}/Generated
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ RimProject::RimProject(void)
|
|||||||
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
||||||
treeViewState.setUiHidden(true);
|
treeViewState.setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&wellPathImport, "WellPathImport", "WellPathImport", "", "", "");
|
||||||
|
wellPathImport = new RimWellPathImport();
|
||||||
|
wellPathImport.setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(¤tModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(¤tModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");
|
||||||
currentModelIndexPath.setUiHidden(true);
|
currentModelIndexPath.setUiHidden(true);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafPdmDocument.h"
|
#include "cafPdmDocument.h"
|
||||||
|
#include "RimWellPathImport.h"
|
||||||
|
|
||||||
class RimOilField;
|
class RimOilField;
|
||||||
class RimCase;
|
class RimCase;
|
||||||
@@ -43,6 +44,7 @@ public:
|
|||||||
|
|
||||||
caf::PdmPointersField<RimOilField*> oilFields;
|
caf::PdmPointersField<RimOilField*> oilFields;
|
||||||
caf::PdmField<RimScriptCollection*> scriptCollection;
|
caf::PdmField<RimScriptCollection*> scriptCollection;
|
||||||
|
caf::PdmField<RimWellPathImport*> wellPathImport;
|
||||||
caf::PdmField<QString> treeViewState;
|
caf::PdmField<QString> treeViewState;
|
||||||
caf::PdmField<QString> currentModelIndexPath;
|
caf::PdmField<QString> currentModelIndexPath;
|
||||||
caf::PdmField<int> nextValidCaseId; // Unique case ID within a project, used to identify a case from Octave scripts
|
caf::PdmField<int> nextValidCaseId; // Unique case ID within a project, used to identify a case from Octave scripts
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
#include "RimCellEdgeResultSlot.h"
|
#include "RimCellEdgeResultSlot.h"
|
||||||
#include "RimCellRangeFilterCollection.h"
|
#include "RimCellRangeFilterCollection.h"
|
||||||
#include "Rim3dOverlayInfoConfig.h"
|
#include "Rim3dOverlayInfoConfig.h"
|
||||||
|
#include "RiuWellImportWizard.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1597,6 +1598,42 @@ void RiuMainWindow::selectedCases(std::vector<RimCase*>& cases)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuMainWindow::slotImportWellPathsFromSSIHub()
|
void RiuMainWindow::slotImportWellPathsFromSSIHub()
|
||||||
{
|
{
|
||||||
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
if (!app->project())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!QFile::exists(app->project()->fileName()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString wellPathsFolderPath;
|
||||||
|
QString projectFileName = app->project()->fileName();
|
||||||
|
QFileInfo fileInfo(projectFileName);
|
||||||
|
wellPathsFolderPath = fileInfo.canonicalPath();
|
||||||
|
QString wellPathFolderName = fileInfo.completeBaseName() + "_wellpaths";
|
||||||
|
|
||||||
|
QDir projFolder(wellPathsFolderPath);
|
||||||
|
projFolder.mkdir(wellPathFolderName);
|
||||||
|
|
||||||
|
wellPathsFolderPath += "/" + wellPathFolderName;
|
||||||
|
|
||||||
|
app->project()->wellPathImport;
|
||||||
|
|
||||||
|
|
||||||
|
RiuWellImportWizard wellImportwizard(app->preferences()->ssihubAddress, wellPathsFolderPath, app->project()->wellPathImport, this);
|
||||||
|
if (QDialog::Accepted == wellImportwizard.exec())
|
||||||
|
{
|
||||||
|
QStringList wellPaths = wellImportwizard.absoluteFilePathsToWellPaths();
|
||||||
|
if (wellPaths.size() > 0)
|
||||||
|
{
|
||||||
|
app->addWellPathsToModel(wellPaths);
|
||||||
|
app->project()->createDisplayModelAndRedrawAllViews();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CVF_ASSERT(m_ssihubInterface);
|
CVF_ASSERT(m_ssihubInterface);
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,6 @@
|
|||||||
#include "ssihubDialog.h"
|
#include "ssihubDialog.h"
|
||||||
#include "RifJsonEncodeDecode.h"
|
#include "RifJsonEncodeDecode.h"
|
||||||
|
|
||||||
#include "RimWellCollection.h"
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -43,7 +41,7 @@
|
|||||||
RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const QString& downloadFolder, RimWellPathImport* wellPathImportObject, QWidget *parent /*= 0*/)
|
RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const QString& downloadFolder, RimWellPathImport* wellPathImportObject, QWidget *parent /*= 0*/)
|
||||||
: QWizard(parent)
|
: QWizard(parent)
|
||||||
{
|
{
|
||||||
m_wellPathImport = wellPathImportObject;
|
m_wellPathImportObject = wellPathImportObject;
|
||||||
|
|
||||||
m_destinationFolder = downloadFolder;
|
m_destinationFolder = downloadFolder;
|
||||||
m_webServiceAddress = webServiceAddress;
|
m_webServiceAddress = webServiceAddress;
|
||||||
@@ -51,9 +49,9 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const
|
|||||||
|
|
||||||
|
|
||||||
addPage(new AuthenticationPage(webServiceAddress, this));
|
addPage(new AuthenticationPage(webServiceAddress, this));
|
||||||
addPage(new FieldSelectionPage(m_wellPathImport, this));
|
addPage(new FieldSelectionPage(m_wellPathImportObject, this));
|
||||||
addPage(new WellSelectionPage(m_wellPathImport, this));
|
addPage(new WellSelectionPage(m_wellPathImportObject, this));
|
||||||
m_wellSummaryPageId = addPage(new WellSummaryPage(m_wellPathImport, this));
|
m_wellSummaryPageId = addPage(new WellSummaryPage(m_wellPathImportObject, this));
|
||||||
|
|
||||||
|
|
||||||
m_statusLabel = new QLabel(tr("Status : idle"));
|
m_statusLabel = new QLabel(tr("Status : idle"));
|
||||||
@@ -61,7 +59,7 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const
|
|||||||
|
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
|
|
||||||
m_wellCollection = new RimWellCollection;
|
m_wellCollection = new caf::PdmObjectGroup;
|
||||||
|
|
||||||
m_firstTimeRequestingAuthentication = true;
|
m_firstTimeRequestingAuthentication = true;
|
||||||
|
|
||||||
@@ -98,7 +96,7 @@ void RiuWellImportWizard::setJsonDestinationFolder(const QString& folder)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellImportWizard::setWellPathImportObject(RimWellPathImport* wellPathImportObject)
|
void RiuWellImportWizard::setWellPathImportObject(RimWellPathImport* wellPathImportObject)
|
||||||
{
|
{
|
||||||
m_wellPathImport = wellPathImportObject;
|
m_wellPathImportObject = wellPathImportObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -129,8 +127,8 @@ void RiuWellImportWizard::downloadFields()
|
|||||||
QFile::remove(wellFileName);
|
QFile::remove(wellFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wellPathImport->regions.deleteAllChildObjects();
|
m_wellPathImportObject->regions.deleteAllChildObjects();
|
||||||
m_wellPathImport->updateConnectedEditors();
|
m_wellPathImportObject->updateConnectedEditors();
|
||||||
|
|
||||||
QString completeUrlText = m_webServiceAddress + "/resinsight/projects";
|
QString completeUrlText = m_webServiceAddress + "/resinsight/projects";
|
||||||
QString destinationFileName = jsonFieldsFilePath();
|
QString destinationFileName = jsonFieldsFilePath();
|
||||||
@@ -562,8 +560,8 @@ void RiuWellImportWizard::updateFieldsModel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wellPathImport->updateRegions(regions, fields, edmIds);
|
m_wellPathImportObject->updateRegions(regions, fields, edmIds);
|
||||||
m_wellPathImport->updateConnectedEditors();
|
m_wellPathImportObject->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,9 +570,9 @@ void RiuWellImportWizard::updateFieldsModel()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellImportWizard::downloadWells()
|
void RiuWellImportWizard::downloadWells()
|
||||||
{
|
{
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImport->regions.size(); rIdx++)
|
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImport->regions[rIdx];
|
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
||||||
if (oilRegion->selected)
|
if (oilRegion->selected)
|
||||||
{
|
{
|
||||||
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
||||||
@@ -585,7 +583,7 @@ void RiuWellImportWizard::downloadWells()
|
|||||||
DownloadEntity urlToFile;
|
DownloadEntity urlToFile;
|
||||||
|
|
||||||
QString wellRequest;
|
QString wellRequest;
|
||||||
if (m_wellPathImport->utmFilterMode == RimWellPathImport::UTM_FILTER_OFF)
|
if (m_wellPathImportObject->utmFilterMode == RimWellPathImport::UTM_FILTER_OFF)
|
||||||
{
|
{
|
||||||
wellRequest = QString("/resinsight/projects/%1/wells").arg(oilField->edmId);
|
wellRequest = QString("/resinsight/projects/%1/wells").arg(oilField->edmId);
|
||||||
}
|
}
|
||||||
@@ -593,10 +591,10 @@ void RiuWellImportWizard::downloadWells()
|
|||||||
{
|
{
|
||||||
wellRequest = QString("/resinsight/projects/%1/wellsInArea?north=%2&south=%3&east=%4&west=%5&utmZone=32N")
|
wellRequest = QString("/resinsight/projects/%1/wellsInArea?north=%2&south=%3&east=%4&west=%5&utmZone=32N")
|
||||||
.arg(oilField->edmId)
|
.arg(oilField->edmId)
|
||||||
.arg(QString::number(m_wellPathImport->north, 'g', 10))
|
.arg(QString::number(m_wellPathImportObject->north, 'g', 10))
|
||||||
.arg(QString::number(m_wellPathImport->south, 'g', 10))
|
.arg(QString::number(m_wellPathImportObject->south, 'g', 10))
|
||||||
.arg(QString::number(m_wellPathImport->east, 'g', 10))
|
.arg(QString::number(m_wellPathImportObject->east, 'g', 10))
|
||||||
.arg(QString::number(m_wellPathImport->west, 'g', 10));
|
.arg(QString::number(m_wellPathImportObject->west, 'g', 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
urlToFile.requestUrl = m_webServiceAddress + wellRequest;
|
urlToFile.requestUrl = m_webServiceAddress + wellRequest;
|
||||||
@@ -620,9 +618,9 @@ void RiuWellImportWizard::downloadWells()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellImportWizard::downloadWellPaths()
|
void RiuWellImportWizard::downloadWellPaths()
|
||||||
{
|
{
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImport->regions.size(); rIdx++)
|
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImport->regions[rIdx];
|
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
||||||
if (oilRegion->selected)
|
if (oilRegion->selected)
|
||||||
{
|
{
|
||||||
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
||||||
@@ -676,13 +674,13 @@ void RiuWellImportWizard::checkDownloadQueueAndIssueRequests_v2()
|
|||||||
|
|
||||||
if (m_currentDownloadState == DOWNLOAD_WELLS)
|
if (m_currentDownloadState == DOWNLOAD_WELLS)
|
||||||
{
|
{
|
||||||
m_wellCollection->wells.clear();
|
m_wellCollection->objects.clear();
|
||||||
|
|
||||||
// Update UI with downloaded wells
|
// Update UI with downloaded wells
|
||||||
|
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImport->regions.size(); rIdx++)
|
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImport->regions[rIdx];
|
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
||||||
if (oilRegion->selected)
|
if (oilRegion->selected)
|
||||||
{
|
{
|
||||||
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
||||||
@@ -694,7 +692,7 @@ void RiuWellImportWizard::checkDownloadQueueAndIssueRequests_v2()
|
|||||||
|
|
||||||
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
|
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
|
||||||
{
|
{
|
||||||
m_wellCollection->wells.push_back(oilField->wells[wIdx]);
|
m_wellCollection->objects.push_back(oilField->wells[wIdx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -726,7 +724,7 @@ RiuWellImportWizard::~RiuWellImportWizard()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellCollection* RiuWellImportWizard::wellCollection()
|
caf::PdmObjectGroup* RiuWellImportWizard::wellCollection()
|
||||||
{
|
{
|
||||||
return m_wellCollection;
|
return m_wellCollection;
|
||||||
}
|
}
|
||||||
@@ -739,6 +737,41 @@ void RiuWellImportWizard::resetAuthenticationCount()
|
|||||||
m_firstTimeRequestingAuthentication = true;
|
m_firstTimeRequestingAuthentication = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QStringList RiuWellImportWizard::absoluteFilePathsToWellPaths() const
|
||||||
|
{
|
||||||
|
QStringList filePaths;
|
||||||
|
|
||||||
|
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
||||||
|
{
|
||||||
|
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
||||||
|
if (oilRegion->selected)
|
||||||
|
{
|
||||||
|
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
||||||
|
{
|
||||||
|
RimOilFieldEntry* oilField = oilRegion->fields[fIdx];
|
||||||
|
if (oilField->selected)
|
||||||
|
{
|
||||||
|
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
|
||||||
|
{
|
||||||
|
RimWellPathEntry* wellPathEntry = oilField->wells[wIdx];
|
||||||
|
|
||||||
|
QString wellStatus;
|
||||||
|
if (QFile::exists(oilField->wells[wIdx]->wellPathFilePath))
|
||||||
|
{
|
||||||
|
filePaths += oilField->wells[wIdx]->wellPathFilePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -922,7 +955,16 @@ void WellSummaryPage::updateSummaryPage()
|
|||||||
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
|
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
|
||||||
{
|
{
|
||||||
RimWellPathEntry* wellPathEntry = oilField->wells[wIdx];
|
RimWellPathEntry* wellPathEntry = oilField->wells[wIdx];
|
||||||
QString wellStatus = QString("%1 %2").arg(oilField->wells[wIdx]->name).arg(oilField->wells[wIdx]->wellPathFilePath);
|
|
||||||
|
QString wellStatus;
|
||||||
|
if (QFile::exists(oilField->wells[wIdx]->wellPathFilePath))
|
||||||
|
{
|
||||||
|
wellStatus = QString("%1 %2").arg(oilField->wells[wIdx]->name).arg(oilField->wells[wIdx]->wellPathFilePath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wellStatus = QString("Failed to get file %1 from well %2").arg(oilField->wells[wIdx]->wellPathFilePath).arg(oilField->wells[wIdx]->name);
|
||||||
|
}
|
||||||
|
|
||||||
m_textEdit->append(wellStatus);
|
m_textEdit->append(wellStatus);
|
||||||
|
|
||||||
|
|||||||
@@ -121,9 +121,11 @@ public:
|
|||||||
void setJsonDestinationFolder(const QString& folder);
|
void setJsonDestinationFolder(const QString& folder);
|
||||||
void setWellPathImportObject(RimWellPathImport* wellPathImportObject);
|
void setWellPathImportObject(RimWellPathImport* wellPathImportObject);
|
||||||
|
|
||||||
|
QStringList absoluteFilePathsToWellPaths() const;
|
||||||
|
|
||||||
|
|
||||||
// Methods used from the wizard pages
|
// Methods used from the wizard pages
|
||||||
RimWellCollection* wellCollection();
|
caf::PdmObjectGroup* wellCollection();
|
||||||
void resetAuthenticationCount();
|
void resetAuthenticationCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -173,10 +175,10 @@ private:
|
|||||||
QString m_webServiceAddress;
|
QString m_webServiceAddress;
|
||||||
QString m_destinationFolder;
|
QString m_destinationFolder;
|
||||||
|
|
||||||
RimWellPathImport* m_wellPathImport;
|
RimWellPathImport* m_wellPathImportObject;
|
||||||
caf::PdmUiTreeView* m_pdmTreeView;
|
caf::PdmUiTreeView* m_pdmTreeView;
|
||||||
|
|
||||||
RimWellCollection* m_wellCollection;
|
caf::PdmObjectGroup* m_wellCollection;
|
||||||
|
|
||||||
QProgressDialog* m_progressDialog;
|
QProgressDialog* m_progressDialog;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user