mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Several refactoring of well import wizard
Keep original copy of RimWellPathImport object as Xml instead of copy using PdmObjectGroup Added destructor for cleanup of wizard pages Simplified info communication between pages
This commit is contained in:
parent
c2fe5f3a16
commit
3c9e1bab5c
@ -72,6 +72,7 @@
|
|||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include "cvfTimer.h"
|
#include "cvfTimer.h"
|
||||||
|
#include "cafPdmDefaultObjectFactory.h"
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -1981,32 +1982,24 @@ void RiuMainWindow::slotImportWellPathsFromSSIHub()
|
|||||||
wellPathsFolderPath += "_wellpaths";
|
wellPathsFolderPath += "_wellpaths";
|
||||||
QDir::root().mkpath(wellPathsFolderPath);
|
QDir::root().mkpath(wellPathsFolderPath);
|
||||||
|
|
||||||
RimWellPathImport* copyOfWellPathImport = NULL;
|
|
||||||
|
|
||||||
// Create a copy of the object
|
// Keep a copy of the import settings, and restore if cancel is pressed in the import wizard
|
||||||
// MODTODO: Verify that behaviour is correct
|
QString copyOfOriginalObject = xmlObj(app->project()->wellPathImport())->writeObjectToXmlString();
|
||||||
{
|
|
||||||
caf::PdmObjectGroup objGroup;
|
|
||||||
objGroup.addObject(app->project()->wellPathImport);
|
|
||||||
|
|
||||||
std::vector<caf::PdmPointer<RimWellPathImport> > typedObjects;
|
RiuWellImportWizard wellImportwizard(app->preferences()->ssihubAddress, wellPathsFolderPath, app->project()->wellPathImport(), this);
|
||||||
|
|
||||||
objGroup.createCopyByType(&typedObjects, caf::PdmDefaultObjectFactory::instance());
|
|
||||||
if (typedObjects.size() == 1)
|
|
||||||
{
|
|
||||||
copyOfWellPathImport = typedObjects[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RiuWellImportWizard wellImportwizard(app->preferences()->ssihubAddress, wellPathsFolderPath, copyOfWellPathImport, this);
|
|
||||||
|
|
||||||
RimWellPathImport* wellPathObjectToBeDeleted = NULL;
|
|
||||||
|
|
||||||
// Get password/username from application cache
|
// Get password/username from application cache
|
||||||
{
|
{
|
||||||
QString ssihubUsername = app->cacheDataObject("ssihub_username").toString();
|
QString ssihubUsername = app->cacheDataObject("ssihub_username").toString();
|
||||||
QString ssihubPassword = app->cacheDataObject("ssihub_password").toString();
|
QString ssihubPassword = app->cacheDataObject("ssihub_password").toString();
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
|
||||||
|
// Valid credentials for ssihubfake received in mail from Håkon
|
||||||
|
ssihubUsername = "admin";
|
||||||
|
ssihubPassword = "resinsight";
|
||||||
|
#endif
|
||||||
|
|
||||||
wellImportwizard.setCredentials(ssihubUsername, ssihubPassword);
|
wellImportwizard.setCredentials(ssihubUsername, ssihubPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2019,18 +2012,13 @@ void RiuMainWindow::slotImportWellPathsFromSSIHub()
|
|||||||
app->project()->createDisplayModelAndRedrawAllViews();
|
app->project()->createDisplayModelAndRedrawAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
wellPathObjectToBeDeleted = app->project()->wellPathImport;
|
|
||||||
app->project()->wellPathImport = copyOfWellPathImport;
|
|
||||||
|
|
||||||
app->setCacheDataObject("ssihub_username", wellImportwizard.field("username"));
|
app->setCacheDataObject("ssihub_username", wellImportwizard.field("username"));
|
||||||
app->setCacheDataObject("ssihub_password", wellImportwizard.field("password"));
|
app->setCacheDataObject("ssihub_password", wellImportwizard.field("password"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wellPathObjectToBeDeleted = copyOfWellPathImport;
|
xmlObj(app->project()->wellPathImport())->readObjectFromXmlString(copyOfOriginalObject, caf::PdmDefaultObjectFactory::instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
delete wellPathObjectToBeDeleted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "RimWellPathImport.h"
|
#include "RimWellPathImport.h"
|
||||||
|
|
||||||
#include "cafPdmDocument.h"
|
#include "cafPdmDocument.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmObjectGroup.h"
|
#include "cafPdmObjectGroup.h"
|
||||||
#include "cafPdmUiListView.h"
|
#include "cafPdmUiListView.h"
|
||||||
#include "cafPdmUiListViewEditor.h"
|
#include "cafPdmUiListViewEditor.h"
|
||||||
@ -66,6 +67,13 @@ RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuWellImportWizard::~RiuWellImportWizard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -427,38 +435,18 @@ void RiuWellImportWizard::downloadWells()
|
|||||||
checkDownloadQueueAndIssueRequests();
|
checkDownloadQueueAndIssueRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuWellImportWizard::downloadWellPaths()
|
void RiuWellImportWizard::downloadWellPaths()
|
||||||
{
|
{
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
WellSelectionPage* wellSelectionPage = dynamic_cast<WellSelectionPage*>(page(m_wellSelectionPageId));
|
||||||
|
std::vector<DownloadEntity> downloadEntities;
|
||||||
|
wellSelectionPage->selectedWellPathEntries(downloadEntities, NULL);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < downloadEntities.size(); i++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
m_wellRequestQueue.push_back(downloadEntities[i]);
|
||||||
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];
|
|
||||||
if (wellPathEntry->selected && wellPathEntry->isWellPathValid())
|
|
||||||
{
|
|
||||||
DownloadEntity urlToFile;
|
|
||||||
|
|
||||||
urlToFile.requestUrl = wellPathEntry->requestUrl;
|
|
||||||
urlToFile.responseFilename = wellPathEntry->wellPathFilePath;
|
|
||||||
|
|
||||||
m_wellRequestQueue.push_back(urlToFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentDownloadState = DOWNLOAD_WELL_PATH;
|
m_currentDownloadState = DOWNLOAD_WELL_PATH;
|
||||||
@ -543,31 +531,15 @@ QStringList RiuWellImportWizard::absoluteFilePathsToWellPaths() const
|
|||||||
{
|
{
|
||||||
QStringList filePaths;
|
QStringList filePaths;
|
||||||
|
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
WellSelectionPage* wellSelectionPage = dynamic_cast<WellSelectionPage*>(page(m_wellSelectionPageId));
|
||||||
{
|
std::vector<DownloadEntity> downloadEntities;
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
wellSelectionPage->selectedWellPathEntries(downloadEntities, NULL);
|
||||||
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;
|
for (size_t i = 0; i < downloadEntities.size(); i++)
|
||||||
if (wellPathEntry->selected)
|
{
|
||||||
{
|
if (QFile::exists(downloadEntities[i].responseFilename))
|
||||||
if (QFile::exists(oilField->wells[wIdx]->wellPathFilePath))
|
{
|
||||||
{
|
filePaths.push_back(downloadEntities[i].responseFilename);
|
||||||
filePaths += oilField->wells[wIdx]->wellPathFilePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,6 +680,15 @@ void RiuWellImportWizard::setCredentials(const QString& username, const QString&
|
|||||||
setField("password", password);
|
setField("password", password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RiuWellImportWizard::wellSelectionPageId()
|
||||||
|
{
|
||||||
|
return m_wellSelectionPageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -781,9 +762,9 @@ FieldSelectionPage::FieldSelectionPage(RimWellPathImport* wellPathImport, QWidge
|
|||||||
|
|
||||||
|
|
||||||
// Property view
|
// Property view
|
||||||
caf::PdmUiPropertyView* propertyView = new caf::PdmUiPropertyView(this);
|
m_propertyView = new caf::PdmUiPropertyView(this);
|
||||||
layout->addWidget(propertyView);
|
layout->addWidget(m_propertyView);
|
||||||
propertyView->showProperties(wellPathImport);
|
m_propertyView->showProperties(wellPathImport);
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||||
}
|
}
|
||||||
@ -797,36 +778,19 @@ void FieldSelectionPage::initializePage()
|
|||||||
wiz->downloadFields();
|
wiz->downloadFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Helper class used to define column headers
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
class ObjectGroupWithHeaders : public caf::PdmObjectGroup
|
FieldSelectionPage::~FieldSelectionPage()
|
||||||
{
|
{
|
||||||
public:
|
m_propertyView->showProperties(NULL);
|
||||||
ObjectGroupWithHeaders() : caf::PdmObjectGroup()
|
}
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
virtual void defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
|
||||||
{
|
|
||||||
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>(attribute);
|
|
||||||
if (myAttr)
|
|
||||||
{
|
|
||||||
QStringList colHeaders;
|
|
||||||
colHeaders << "Wells";
|
|
||||||
myAttr->columnHeaders = colHeaders;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -849,6 +813,7 @@ WellSelectionPage::WellSelectionPage(RimWellPathImport* wellPathImport, QWidget*
|
|||||||
m_wellPathImportObject = wellPathImport;
|
m_wellPathImportObject = wellPathImport;
|
||||||
|
|
||||||
m_regionsWithVisibleWells = new ObjectGroupWithHeaders;
|
m_regionsWithVisibleWells = new ObjectGroupWithHeaders;
|
||||||
|
m_regionsWithVisibleWells->objects.uiCapability()->setUiHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -888,14 +853,16 @@ void WellSelectionPage::buildWellTreeView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete all temporary pdm object groups
|
// Delete all temporary pdm object groups
|
||||||
m_regionsWithVisibleWells->deleteObjects();
|
m_regionsWithVisibleWells->objects.deleteAllChildObjects();
|
||||||
|
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
||||||
if (oilRegion->selected)
|
if (oilRegion->selected)
|
||||||
{
|
{
|
||||||
caf::PdmObjectGroup* regGroup = new caf::PdmObjectGroup;
|
caf::PdmGuardedObjects* regGroup = new caf::PdmGuardedObjects;
|
||||||
|
regGroup->objects.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
regGroup->setUiName(oilRegion->userDescriptionField()->uiCapability()->uiValue().toString());
|
regGroup->setUiName(oilRegion->userDescriptionField()->uiCapability()->uiValue().toString());
|
||||||
|
|
||||||
m_regionsWithVisibleWells->objects.push_back(regGroup);
|
m_regionsWithVisibleWells->objects.push_back(regGroup);
|
||||||
@ -905,7 +872,9 @@ void WellSelectionPage::buildWellTreeView()
|
|||||||
RimOilFieldEntry* oilField = oilRegion->fields[fIdx];
|
RimOilFieldEntry* oilField = oilRegion->fields[fIdx];
|
||||||
if (oilField->selected)
|
if (oilField->selected)
|
||||||
{
|
{
|
||||||
caf::PdmObjectGroup* fieldGroup = new caf::PdmObjectGroup;
|
caf::PdmGuardedObjects* fieldGroup = new caf::PdmGuardedObjects;
|
||||||
|
fieldGroup->objects.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
fieldGroup->setUiName(oilField->userDescriptionField()->uiCapability()->uiValue().toString());
|
fieldGroup->setUiName(oilField->userDescriptionField()->uiCapability()->uiValue().toString());
|
||||||
|
|
||||||
regGroup->objects.push_back(fieldGroup);
|
regGroup->objects.push_back(fieldGroup);
|
||||||
@ -913,7 +882,14 @@ void WellSelectionPage::buildWellTreeView()
|
|||||||
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];
|
||||||
fieldGroup->objects.push_back(wellPathEntry);
|
|
||||||
|
// Create a copy of the PdmObject, as it is not supported to have multiple parents of any objects
|
||||||
|
QString objStr = xmlObj(wellPathEntry)->writeObjectToXmlString();
|
||||||
|
|
||||||
|
RimWellPathEntry* wellPathCopy = new RimWellPathEntry;
|
||||||
|
xmlObj(wellPathCopy)->readObjectFromXmlString(objStr, caf::PdmDefaultObjectFactory::instance());
|
||||||
|
|
||||||
|
fieldGroup->objects.push_back(wellPathCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -931,10 +907,55 @@ void WellSelectionPage::buildWellTreeView()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
WellSelectionPage::~WellSelectionPage()
|
WellSelectionPage::~WellSelectionPage()
|
||||||
{
|
{
|
||||||
|
if (m_wellSelectionTreeView)
|
||||||
|
{
|
||||||
|
m_wellSelectionTreeView->setPdmItem(NULL);
|
||||||
|
}
|
||||||
delete m_regionsWithVisibleWells;
|
delete m_regionsWithVisibleWells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void WellSelectionPage::selectedWellPathEntries(std::vector<DownloadEntity>& downloadEntities, caf::PdmObjectHandle* objHandle)
|
||||||
|
{
|
||||||
|
if (objHandle == NULL)
|
||||||
|
{
|
||||||
|
objHandle = m_regionsWithVisibleWells;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<caf::PdmFieldHandle*> childFields;
|
||||||
|
objHandle->fields(childFields);
|
||||||
|
for (size_t i = 0; i < childFields.size(); i++)
|
||||||
|
{
|
||||||
|
std::vector<caf::PdmObjectHandle*> childObjects;
|
||||||
|
childFields[i]->childObjects(&childObjects);
|
||||||
|
|
||||||
|
for (size_t j = 0; j < childObjects.size(); j++)
|
||||||
|
{
|
||||||
|
RimWellPathEntry* wellPathEntry = (dynamic_cast<RimWellPathEntry*>(childObjects[j]));
|
||||||
|
if (wellPathEntry)
|
||||||
|
{
|
||||||
|
if (wellPathEntry->selected && wellPathEntry->isWellPathValid())
|
||||||
|
{
|
||||||
|
DownloadEntity urlToFile;
|
||||||
|
|
||||||
|
urlToFile.requestUrl = wellPathEntry->requestUrl;
|
||||||
|
urlToFile.responseFilename = wellPathEntry->wellPathFilePath;
|
||||||
|
|
||||||
|
downloadEntities.push_back(urlToFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectedWellPathEntries(downloadEntities, childObjects[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -961,7 +982,7 @@ WellSummaryPage::WellSummaryPage(RimWellPathImport* wellPathImport, QWidget* par
|
|||||||
layout->addWidget(m_listView);
|
layout->addWidget(m_listView);
|
||||||
m_listView->hide();
|
m_listView->hide();
|
||||||
|
|
||||||
m_objectGroup = new caf::PdmObjectGroup;
|
m_objectGroup = new caf::PdmGuardedObjects;
|
||||||
|
|
||||||
setButtonText(QWizard::FinishButton, "Import");
|
setButtonText(QWizard::FinishButton, "Import");
|
||||||
}
|
}
|
||||||
@ -987,41 +1008,28 @@ void WellSummaryPage::updateSummaryPage()
|
|||||||
size_t wellPathCount = 0;
|
size_t wellPathCount = 0;
|
||||||
QString errorString;
|
QString errorString;
|
||||||
|
|
||||||
for (size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++)
|
RiuWellImportWizard* wiz = dynamic_cast<RiuWellImportWizard*>(wizard());
|
||||||
|
WellSelectionPage* wellSelectionPage = dynamic_cast<WellSelectionPage*>(wiz->page(wiz->wellSelectionPageId()));
|
||||||
|
std::vector<DownloadEntity> downloadEntities;
|
||||||
|
wellSelectionPage->selectedWellPathEntries(downloadEntities, NULL);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < downloadEntities.size(); i++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegion = m_wellPathImportObject->regions[rIdx];
|
if (QFile::exists(downloadEntities[i].responseFilename))
|
||||||
if (oilRegion->selected)
|
|
||||||
{
|
{
|
||||||
for (size_t fIdx = 0; fIdx < oilRegion->fields.size(); fIdx++)
|
wellPathCount++;
|
||||||
{
|
}
|
||||||
RimOilFieldEntry* oilField = oilRegion->fields[fIdx];
|
else
|
||||||
if (oilField->selected)
|
{
|
||||||
{
|
errorString += QString("Failed to get file '%1' from well '%2'\n").arg(downloadEntities[i].responseFilename).arg(downloadEntities[i].requestUrl);
|
||||||
QString oilFieldText = QString("\nRegion : %1 - Field : %2").arg(oilRegion->name).arg(oilField->name);
|
|
||||||
m_textEdit->append(oilFieldText);
|
|
||||||
|
|
||||||
for (size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++)
|
|
||||||
{
|
|
||||||
RimWellPathEntry* wellPathEntry = oilField->wells[wIdx];
|
|
||||||
if (wellPathEntry->selected)
|
|
||||||
{
|
|
||||||
if (QFile::exists(oilField->wells[wIdx]->wellPathFilePath))
|
|
||||||
{
|
|
||||||
wellPathCount++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorString += QString("Failed to get file '%1' from well '%2'\n").arg(oilField->wells[wIdx]->wellPathFilePath).arg(oilField->wells[wIdx]->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_objectGroup->objects.push_back(wellPathEntry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
SummaryPageDownloadEntity* sumPageEntity = new SummaryPageDownloadEntity;
|
||||||
|
sumPageEntity->responseFilename = downloadEntities[i].responseFilename;
|
||||||
|
sumPageEntity->requestUrl = downloadEntities[i].requestUrl;
|
||||||
|
|
||||||
|
m_objectGroup->objects().push_back(sumPageEntity);
|
||||||
|
}
|
||||||
|
|
||||||
m_textEdit->setText(QString("Downloaded successfully %1 well paths.\nPlease push 'Import' button to import well paths into ResInsight.\n\n").arg(wellPathCount));
|
m_textEdit->setText(QString("Downloaded successfully %1 well paths.\nPlease push 'Import' button to import well paths into ResInsight.\n\n").arg(wellPathCount));
|
||||||
if (!errorString.isEmpty())
|
if (!errorString.isEmpty())
|
||||||
@ -1050,3 +1058,33 @@ void WellSummaryPage::slotShowDetails()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void ObjectGroupWithHeaders::defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||||
|
{
|
||||||
|
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>(attribute);
|
||||||
|
if (myAttr)
|
||||||
|
{
|
||||||
|
QStringList colHeaders;
|
||||||
|
colHeaders << "Wells";
|
||||||
|
myAttr->columnHeaders = colHeaders;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(SummaryPageDownloadEntity, "SummaryPageDownloadEntity");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
SummaryPageDownloadEntity::SummaryPageDownloadEntity()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("SummaryPageDownloadEntity", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&requestUrl, "RequestUrl", "", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&responseFilename, "ResponseFilename", "", "", "", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -18,21 +18,26 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QString>
|
#include "cafPdmChildArrayField.h"
|
||||||
#include <QWizard>
|
#include "cafPdmField.h"
|
||||||
#include <QNetworkAccessManager>
|
#include "cafPdmObject.h"
|
||||||
#include <QUrl>
|
#include "cafPdmObjectGroup.h"
|
||||||
|
|
||||||
#include <QItemSelection>
|
#include <QItemSelection>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#include <QString>
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QWizard>
|
||||||
|
|
||||||
class QFile;
|
class QFile;
|
||||||
class QProgressDialog;
|
class QProgressDialog;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
|
|
||||||
|
|
||||||
class RimWellPathImport;
|
class RimWellPathImport;
|
||||||
class RimOilFieldEntry;
|
class RimOilFieldEntry;
|
||||||
|
class RimWellPathEntry;
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -40,7 +45,8 @@ namespace caf
|
|||||||
class UiTreeModelPdm;
|
class UiTreeModelPdm;
|
||||||
class PdmUiTreeView;
|
class PdmUiTreeView;
|
||||||
class PdmUiListView;
|
class PdmUiListView;
|
||||||
class PdmObjectGroup;
|
class PdmUiPropertyView;
|
||||||
|
class PdmGuardedObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,14 +73,50 @@ class FieldSelectionPage : public QWizardPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FieldSelectionPage(RimWellPathImport* wellPathImport, QWidget* parent = 0);
|
FieldSelectionPage(RimWellPathImport* wellPathImport, QWidget* parent = 0);
|
||||||
|
~FieldSelectionPage();
|
||||||
|
|
||||||
virtual void initializePage();
|
virtual void initializePage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmUiPropertyView* m_propertyView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ObjectGroupWithHeaders;
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Container class used to define column headers
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class ObjectGroupWithHeaders : public caf::PdmGuardedObjects
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ObjectGroupWithHeaders() {};
|
||||||
|
|
||||||
|
virtual void defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute * attribute);
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class DownloadEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString requestUrl;
|
||||||
|
QString responseFilename;
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class SummaryPageDownloadEntity : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SummaryPageDownloadEntity();
|
||||||
|
|
||||||
|
caf::PdmField<QString> requestUrl;
|
||||||
|
caf::PdmField<QString> responseFilename;
|
||||||
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -90,6 +132,9 @@ public:
|
|||||||
virtual void initializePage();
|
virtual void initializePage();
|
||||||
void buildWellTreeView();
|
void buildWellTreeView();
|
||||||
|
|
||||||
|
|
||||||
|
void selectedWellPathEntries(std::vector<DownloadEntity>& downloadEntities, caf::PdmObjectHandle* objHandle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectGroupWithHeaders* m_regionsWithVisibleWells;
|
ObjectGroupWithHeaders* m_regionsWithVisibleWells;
|
||||||
RimWellPathImport* m_wellPathImportObject;
|
RimWellPathImport* m_wellPathImportObject;
|
||||||
@ -119,20 +164,10 @@ private:
|
|||||||
RimWellPathImport* m_wellPathImportObject;
|
RimWellPathImport* m_wellPathImportObject;
|
||||||
QTextEdit* m_textEdit;
|
QTextEdit* m_textEdit;
|
||||||
caf::PdmUiListView* m_listView;
|
caf::PdmUiListView* m_listView;
|
||||||
caf::PdmObjectGroup*m_objectGroup;
|
caf::PdmGuardedObjects* m_objectGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
class DownloadEntity
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString requestUrl;
|
|
||||||
QString responseFilename;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -146,12 +181,12 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
RiuWellImportWizard(const QString& webServiceAddress, const QString& downloadFolder, RimWellPathImport* wellPathImportObject, QWidget *parent = 0);
|
RiuWellImportWizard(const QString& webServiceAddress, const QString& downloadFolder, RimWellPathImport* wellPathImportObject, QWidget *parent = 0);
|
||||||
|
~RiuWellImportWizard();
|
||||||
|
|
||||||
void setCredentials(const QString& username, const QString& password);
|
void setCredentials(const QString& username, const QString& password);
|
||||||
QStringList absoluteFilePathsToWellPaths() const;
|
QStringList absoluteFilePathsToWellPaths() const;
|
||||||
|
|
||||||
// Methods used from the wizard pages
|
// Methods used from the wizard pages
|
||||||
caf::PdmObjectGroup* wellCollection();
|
|
||||||
void resetAuthenticationCount();
|
void resetAuthenticationCount();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -169,6 +204,7 @@ public slots:
|
|||||||
|
|
||||||
void slotAuthenticationRequired(QNetworkReply* networkReply, QAuthenticator* authenticator);
|
void slotAuthenticationRequired(QNetworkReply* networkReply, QAuthenticator* authenticator);
|
||||||
|
|
||||||
|
int wellSelectionPageId();
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
#ifndef QT_NO_OPENSSL
|
||||||
void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
|
void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
|
||||||
|
Loading…
Reference in New Issue
Block a user