mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
Rename ApplicationCode to ApplicationLibCode
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOilFieldEntry.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOilRegionEntry.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathImport.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellsEntry.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOilFieldEntry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOilRegionEntry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathImport.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellsEntry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\SsiHub" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,141 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicWellPathsImportSsihubFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPathImport.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuWellImportWizard.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicWellPathsImportSsihubFeature, "RicWellPathsImportSsihubFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathsImportSsihubFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathsImportSsihubFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if ( !app->project() ) return;
|
||||
|
||||
if ( !app->isProjectSavedToDisc() )
|
||||
{
|
||||
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
|
||||
if ( guiApp )
|
||||
{
|
||||
QMessageBox msgBox( guiApp->mainWindow() );
|
||||
msgBox.setIcon( QMessageBox::Question );
|
||||
|
||||
QString questionText =
|
||||
QString( "Import of well paths will be stored as a part of a ResInsight project file. Please "
|
||||
"save the project to file before importing well paths." );
|
||||
|
||||
msgBox.setText( questionText );
|
||||
msgBox.setInformativeText( "Do you want to save the project?" );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||
|
||||
int ret = msgBox.exec();
|
||||
if ( ret == QMessageBox::Yes )
|
||||
{
|
||||
guiApp->saveProject();
|
||||
}
|
||||
}
|
||||
|
||||
if ( !app->isProjectSavedToDisc() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the UTM bounding box from the reservoir
|
||||
app->project()->computeUtmAreaOfInterest();
|
||||
|
||||
QString wellPathsFolderPath = RimFileWellPath::getCacheDirectoryPath();
|
||||
QDir::root().mkpath( wellPathsFolderPath );
|
||||
|
||||
if ( !app->project()->wellPathImport() ) return;
|
||||
|
||||
// Keep a copy of the import settings, and restore if cancel is pressed in the import wizard
|
||||
QString copyOfOriginalObject = app->project()->wellPathImport()->writeObjectToXmlString();
|
||||
|
||||
if ( !app->preferences() ) return;
|
||||
RiuWellImportWizard wellImportwizard( app->preferences()->ssihubAddress,
|
||||
wellPathsFolderPath,
|
||||
app->project()->wellPathImport(),
|
||||
RiuMainWindow::instance() );
|
||||
|
||||
// Get password/username from application cache
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
// Valid credentials for ssihubfake received in mail from Håkon
|
||||
QString ssihubUsername = "admin";
|
||||
QString ssihubPassword = "resinsight";
|
||||
#else
|
||||
QString ssihubUsername = app->cacheDataObject( "ssihub_username" ).toString();
|
||||
QString ssihubPassword;
|
||||
#endif
|
||||
wellImportwizard.setCredentials( ssihubUsername, ssihubPassword );
|
||||
}
|
||||
|
||||
if ( QDialog::Accepted == wellImportwizard.exec() )
|
||||
{
|
||||
QStringList wellPaths = wellImportwizard.absoluteFilePathsToWellPaths();
|
||||
if ( wellPaths.size() > 0 )
|
||||
{
|
||||
QStringList errorMessages;
|
||||
app->addWellPathsToModel( wellPaths, false, &errorMessages );
|
||||
app->project()->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
app->setCacheDataObject( "ssihub_username", wellImportwizard.field( "username" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
app->project()->wellPathImport()->readObjectFromXmlString( copyOfOriginalObject,
|
||||
caf::PdmDefaultObjectFactory::instance() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathsImportSsihubFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Import Well Paths from &SSI-hub" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellCollection.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellPathsImportSsihubFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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 "RimOilFieldEntry.h"
|
||||
#include "RimWellPathImport.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMap>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimOilFieldEntry, "RimOilFieldEntry" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilFieldEntry::RimOilFieldEntry()
|
||||
{
|
||||
CAF_PDM_InitObject( "OilFieldEntry", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &name, "OilFieldName", "Oil Field Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &edmId, "EdmId", "Edm ID", "", "", "" );
|
||||
CAF_PDM_InitField( &selected, "Selected", false, "Selected", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &wellsFilePath, "wellsFilePath", "Wells File Path", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &wells, "Wells", "", "", "", "" );
|
||||
wells.uiCapability()->setUiHidden( true );
|
||||
wells.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilFieldEntry::~RimOilFieldEntry()
|
||||
{
|
||||
wells.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimOilFieldEntry::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimOilFieldEntry::objectToggleField()
|
||||
{
|
||||
return &selected;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOilFieldEntry::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &selected )
|
||||
{
|
||||
updateEnabledState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOilFieldEntry::initAfterRead()
|
||||
{
|
||||
updateEnabledState();
|
||||
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOilFieldEntry::updateEnabledState()
|
||||
{
|
||||
bool wellsReadOnly = !selected;
|
||||
if ( this->isUiReadOnly() )
|
||||
{
|
||||
wellsReadOnly = true;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < wells.size(); i++ )
|
||||
{
|
||||
wells[i]->setUiReadOnly( wellsReadOnly );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathEntry* RimOilFieldEntry::find( const QString& entryName, RimWellPathEntry::WellTypeEnum wellPathType )
|
||||
{
|
||||
for ( size_t i = 0; i < wells.size(); i++ )
|
||||
{
|
||||
RimWellPathEntry* wellPathEntry = wells[i];
|
||||
if ( wellPathEntry->name == entryName && wellPathEntry->wellPathType == wellPathType )
|
||||
{
|
||||
return wellPathEntry;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RimWellsEntry.h"
|
||||
|
||||
class RimOilFieldEntry : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimOilFieldEntry();
|
||||
~RimOilFieldEntry() override;
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<QString> edmId;
|
||||
caf::PdmField<bool> selected;
|
||||
caf::PdmField<QString> wellsFilePath; // Location of the response file from request "/wells"
|
||||
|
||||
caf::PdmChildArrayField<RimWellPathEntry*> wells;
|
||||
|
||||
RimWellPathEntry* find( const QString& name, RimWellPathEntry::WellTypeEnum wellPathType );
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void initAfterRead() override;
|
||||
|
||||
// private:
|
||||
void updateEnabledState();
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "RimOilRegionEntry.h"
|
||||
#include "RimOilFieldEntry.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimOilRegionEntry, "RimOilRegionEntry" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilRegionEntry::RimOilRegionEntry()
|
||||
{
|
||||
CAF_PDM_InitObject( "OilRegionEntry", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &name, "OilRegionEntry", "OilRegionEntry", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &fields, "Fields", "", "", "", "" );
|
||||
fields.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &selected, "Selected", false, "Selected", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimOilRegionEntry::~RimOilRegionEntry()
|
||||
{
|
||||
fields.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimOilRegionEntry::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimOilRegionEntry::objectToggleField()
|
||||
{
|
||||
return &selected;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOilRegionEntry::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( &selected == changedField )
|
||||
{
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimOilRegionEntry::updateState()
|
||||
{
|
||||
for ( size_t i = 0; i < fields.size(); i++ )
|
||||
{
|
||||
fields[i]->setUiReadOnly( !selected );
|
||||
fields[i]->updateEnabledState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimOilFieldEntry;
|
||||
|
||||
class RimOilRegionEntry : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimOilRegionEntry();
|
||||
~RimOilRegionEntry() override;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void updateState();
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> selected;
|
||||
caf::PdmChildArrayField<RimOilFieldEntry*> fields;
|
||||
};
|
||||
@@ -0,0 +1,252 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "RimWellPathImport.h"
|
||||
|
||||
#include "RimFileWellPath.h"
|
||||
#include "RimOilFieldEntry.h"
|
||||
#include "RimOilRegionEntry.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafPdmUiTreeViewEditor.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimWellPathImport::UtmFilterEnum>::setUp()
|
||||
{
|
||||
addItem( RimWellPathImport::UTM_FILTER_OFF, "UTM_FILTER_OFF", "Off" );
|
||||
addItem( RimWellPathImport::UTM_FILTER_PROJECT, "UTM_FILTER_PROJECT", "Project" );
|
||||
addItem( RimWellPathImport::UTM_FILTER_CUSTOM, "UTM_FILTER_CUSTOM", "Custom" );
|
||||
setDefault( RimWellPathImport::UTM_FILTER_PROJECT );
|
||||
}
|
||||
|
||||
} // End namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathImport, "RimWellPathImport" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathImport::RimWellPathImport()
|
||||
{
|
||||
CAF_PDM_InitObject( "RimWellPathImport", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &wellTypeSurvey, "WellTypeSurvey", true, "Survey", "", "", "" );
|
||||
CAF_PDM_InitField( &wellTypePlans, "WellTypePlans", true, "Plans", "", "", "" );
|
||||
|
||||
caf::AppEnum<RimWellPathImport::UtmFilterEnum> defaultUtmMode = UTM_FILTER_OFF;
|
||||
CAF_PDM_InitField( &utmFilterMode, "UtmMode", defaultUtmMode, "Utm Filter", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &north, "UtmNorth", 0.0, "North", "", "", "" );
|
||||
CAF_PDM_InitField( &south, "UtmSouth", 0.0, "South", "", "", "" );
|
||||
CAF_PDM_InitField( &east, "UtmEast", 0.0, "East", "", "", "" );
|
||||
CAF_PDM_InitField( &west, "UtmWest", 0.0, "West", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( ®ions, "Regions", "", "", "", "" );
|
||||
regions.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::updateRegions( const QStringList& regionStrings,
|
||||
const QStringList& fieldStrings,
|
||||
const QStringList& edmIds )
|
||||
{
|
||||
assert( regionStrings.size() == fieldStrings.size() && regionStrings.size() == edmIds.size() );
|
||||
|
||||
std::vector<RimOilRegionEntry*> regionsToRemove;
|
||||
|
||||
// Remove regions and fields not present in last request
|
||||
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
|
||||
{
|
||||
if ( !regionStrings.contains( this->regions[regionIdx]->name ) )
|
||||
{
|
||||
regionsToRemove.push_back( this->regions[regionIdx] );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimOilFieldEntry*> fieldsToRemove;
|
||||
|
||||
for ( size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++ )
|
||||
{
|
||||
if ( !fieldStrings.contains( this->regions[regionIdx]->fields[fIdx]->name ) )
|
||||
{
|
||||
fieldsToRemove.push_back( this->regions[regionIdx]->fields[fIdx] );
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < fieldsToRemove.size(); i++ )
|
||||
{
|
||||
this->regions[regionIdx]->fields.removeChildObject( fieldsToRemove[i] );
|
||||
|
||||
delete fieldsToRemove[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < regionsToRemove.size(); i++ )
|
||||
{
|
||||
this->regions.removeChildObject( regionsToRemove[i] );
|
||||
|
||||
delete regionsToRemove[i];
|
||||
}
|
||||
|
||||
for ( int i = 0; i < regionStrings.size(); i++ )
|
||||
{
|
||||
RimOilRegionEntry* oilRegionEntry = nullptr;
|
||||
RimOilFieldEntry* oilFieldEntry = nullptr;
|
||||
|
||||
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
|
||||
{
|
||||
if ( this->regions[regionIdx]->name == regionStrings[i] )
|
||||
{
|
||||
oilRegionEntry = this->regions[regionIdx];
|
||||
|
||||
for ( size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++ )
|
||||
{
|
||||
if ( this->regions[regionIdx]->fields[fIdx]->edmId == edmIds[i] )
|
||||
{
|
||||
oilFieldEntry = this->regions[regionIdx]->fields[fIdx];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !oilRegionEntry )
|
||||
{
|
||||
oilRegionEntry = new RimOilRegionEntry;
|
||||
oilRegionEntry->name = regionStrings[i];
|
||||
|
||||
this->regions.push_back( oilRegionEntry );
|
||||
}
|
||||
|
||||
assert( oilRegionEntry );
|
||||
|
||||
if ( !oilFieldEntry )
|
||||
{
|
||||
oilFieldEntry = new RimOilFieldEntry;
|
||||
oilFieldEntry->name = fieldStrings[i];
|
||||
oilFieldEntry->edmId = edmIds[i];
|
||||
|
||||
oilRegionEntry->fields.push_back( oilFieldEntry );
|
||||
}
|
||||
}
|
||||
|
||||
updateFieldVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::initAfterRead()
|
||||
{
|
||||
updateFieldVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::updateFieldVisibility()
|
||||
{
|
||||
if ( utmFilterMode == UTM_FILTER_CUSTOM )
|
||||
{
|
||||
north.uiCapability()->setUiReadOnly( false );
|
||||
south.uiCapability()->setUiReadOnly( false );
|
||||
east.uiCapability()->setUiReadOnly( false );
|
||||
west.uiCapability()->setUiReadOnly( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
north.uiCapability()->setUiReadOnly( true );
|
||||
south.uiCapability()->setUiReadOnly( true );
|
||||
east.uiCapability()->setUiReadOnly( true );
|
||||
west.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &utmFilterMode )
|
||||
{
|
||||
updateFieldVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
QStringList colHeaders;
|
||||
colHeaders << "Region";
|
||||
myAttr->columnHeaders = colHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathImport::~RimWellPathImport()
|
||||
{
|
||||
regions.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathImport::updateFilePaths()
|
||||
{
|
||||
QString wellPathsFolderPath = RimFileWellPath::getCacheDirectoryPath();
|
||||
|
||||
for ( size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++ )
|
||||
{
|
||||
for ( size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++ )
|
||||
{
|
||||
RimOilFieldEntry* oilField = this->regions[regionIdx]->fields[fIdx];
|
||||
|
||||
QFileInfo fi( oilField->wellsFilePath );
|
||||
|
||||
QString newWellsFilePath = wellPathsFolderPath + "/" + fi.fileName();
|
||||
oilField->wellsFilePath = newWellsFilePath;
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < oilField->wells.size(); wIdx++ )
|
||||
{
|
||||
RimWellPathEntry* rimWellPathEntry = oilField->wells[wIdx];
|
||||
|
||||
QFileInfo fiWell( rimWellPathEntry->wellPathFilePath );
|
||||
|
||||
QString newFilePath = wellPathsFolderPath + "/" + fiWell.fileName();
|
||||
rimWellPathEntry->wellPathFilePath = newFilePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimOilRegionEntry;
|
||||
|
||||
class RimWellPathImport : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum UtmFilterEnum
|
||||
{
|
||||
UTM_FILTER_OFF,
|
||||
UTM_FILTER_PROJECT,
|
||||
UTM_FILTER_CUSTOM
|
||||
};
|
||||
|
||||
public:
|
||||
RimWellPathImport();
|
||||
~RimWellPathImport() override;
|
||||
|
||||
caf::PdmField<bool> wellTypeSurvey;
|
||||
caf::PdmField<bool> wellTypePlans;
|
||||
|
||||
caf::PdmField<caf::AppEnum<UtmFilterEnum>> utmFilterMode;
|
||||
caf::PdmField<double> north;
|
||||
caf::PdmField<double> south;
|
||||
caf::PdmField<double> east;
|
||||
caf::PdmField<double> west;
|
||||
|
||||
caf::PdmChildArrayField<RimOilRegionEntry*> regions;
|
||||
|
||||
void updateRegions( const QStringList& regions, const QStringList& fields, const QStringList& edmIds );
|
||||
|
||||
void initAfterRead() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void updateFieldVisibility();
|
||||
|
||||
void updateFilePaths();
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "RimWellsEntry.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RimWellPathEntry::WellTypeEnum>::setUp()
|
||||
{
|
||||
addItem( RimWellPathEntry::WELL_ALL, "WELL_ALL", "All" );
|
||||
addItem( RimWellPathEntry::WELL_SURVEY, "WELL_SURVEY", "Survey" );
|
||||
addItem( RimWellPathEntry::WELL_PLAN, "WELL_PLAN", "Plan" );
|
||||
setDefault( RimWellPathEntry::WELL_ALL );
|
||||
}
|
||||
|
||||
} // End namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathEntry, "RimWellPathEntry" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathEntry::RimWellPathEntry()
|
||||
{
|
||||
CAF_PDM_InitObject( "WellPathEntry", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &name, "Name", "Name", "", "", "" );
|
||||
CAF_PDM_InitField( &selected, "Selected", false, "Selected", "", "", "" );
|
||||
|
||||
caf::AppEnum<RimWellPathEntry::WellTypeEnum> wellType = WELL_ALL;
|
||||
CAF_PDM_InitField( &wellPathType, "WellPathType", wellType, "Well path type", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &surveyType, "surveyType", "surveyType", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &requestUrl, "requestUrl", "requestUrl", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &wellPathFilePath, "wellPathFilePath", "wellPathFilePath", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellPathEntry::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellPathEntry::objectToggleField()
|
||||
{
|
||||
return &selected;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathEntry* RimWellPathEntry::createWellPathEntry( const QString& name,
|
||||
const QString& surveyType,
|
||||
const QString& requestUrl,
|
||||
const QString& absolutePath,
|
||||
WellTypeEnum wellType )
|
||||
{
|
||||
RimWellPathEntry* entry = new RimWellPathEntry();
|
||||
entry->name = name;
|
||||
entry->surveyType = surveyType;
|
||||
entry->requestUrl = requestUrl;
|
||||
entry->wellPathType = wellType;
|
||||
|
||||
QString responseFilePath = undefinedWellPathLocation();
|
||||
|
||||
int strIndex = requestUrl.indexOf( "edm/" );
|
||||
if ( strIndex >= 0 )
|
||||
{
|
||||
QString lastPart = requestUrl.right( requestUrl.size() - strIndex );
|
||||
lastPart = lastPart.replace( '/', '_' );
|
||||
|
||||
responseFilePath = absolutePath + "/" + lastPart + ".json";
|
||||
}
|
||||
|
||||
entry->wellPathFilePath = responseFilePath;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellPathEntry::undefinedWellPathLocation()
|
||||
{
|
||||
return "UNDEFIED_WELLPATH_FILE";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPathEntry::isWellPathValid()
|
||||
{
|
||||
return ( wellPathFilePath().compare( undefinedWellPathLocation() ) != 0 );
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimWellPathEntry : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum WellTypeEnum
|
||||
{
|
||||
WELL_SURVEY,
|
||||
WELL_PLAN,
|
||||
WELL_ALL
|
||||
};
|
||||
|
||||
public:
|
||||
RimWellPathEntry();
|
||||
|
||||
static RimWellPathEntry* createWellPathEntry( const QString& name,
|
||||
const QString& surveyType,
|
||||
const QString& requestUrl,
|
||||
const QString& absolutePath,
|
||||
WellTypeEnum wellType );
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> selected;
|
||||
|
||||
caf::PdmField<caf::AppEnum<WellTypeEnum>> wellPathType;
|
||||
caf::PdmField<QString> surveyType;
|
||||
caf::PdmField<QString> requestUrl;
|
||||
|
||||
bool isWellPathValid();
|
||||
caf::PdmField<QString> wellPathFilePath; // Location of the well path response
|
||||
|
||||
private:
|
||||
static QString undefinedWellPathLocation();
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,277 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QItemSelection>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QWizard>
|
||||
|
||||
class QFile;
|
||||
class QProgressDialog;
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
|
||||
class RimWellPathImport;
|
||||
class RimOilFieldEntry;
|
||||
class RimWellPathEntry;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmUiTreeView;
|
||||
class PdmUiListView;
|
||||
class PdmUiPropertyView;
|
||||
class PdmObjectCollection;
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class AuthenticationPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AuthenticationPage( const QString& webServiceAddress, QWidget* parent = nullptr );
|
||||
|
||||
void initializePage() override;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class FieldSelectionPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FieldSelectionPage( RimWellPathImport* wellPathImport, QWidget* parent = nullptr );
|
||||
~FieldSelectionPage() override;
|
||||
|
||||
void initializePage() override;
|
||||
|
||||
private:
|
||||
caf::PdmUiPropertyView* m_propertyView;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Container class used to define column headers
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class ObjectGroupWithHeaders : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
ObjectGroupWithHeaders()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active", "", "", "" );
|
||||
m_isChecked.uiCapability()->setUiHidden( true );
|
||||
};
|
||||
|
||||
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
public:
|
||||
caf::PdmChildArrayField<PdmObjectHandle*> objects;
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* objectToggleField() override { return &m_isChecked; }
|
||||
|
||||
protected:
|
||||
caf::PdmField<bool> m_isChecked;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class DownloadEntity
|
||||
{
|
||||
public:
|
||||
QString name;
|
||||
QString requestUrl;
|
||||
QString responseFilename;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class SummaryPageDownloadEntity : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
SummaryPageDownloadEntity();
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<QString> requestUrl;
|
||||
caf::PdmField<QString> responseFilename;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class WellSelectionPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WellSelectionPage( RimWellPathImport* wellPathImport, QWidget* parent = nullptr );
|
||||
~WellSelectionPage() override;
|
||||
|
||||
void initializePage() override;
|
||||
void buildWellTreeView();
|
||||
|
||||
void selectedWellPathEntries( std::vector<DownloadEntity>& downloadEntities, caf::PdmObjectHandle* objHandle );
|
||||
|
||||
private:
|
||||
void sortObjectsByDescription( caf::PdmObjectCollection* objects );
|
||||
|
||||
private slots:
|
||||
void customMenuRequested( const QPoint& pos );
|
||||
|
||||
private:
|
||||
ObjectGroupWithHeaders* m_regionsWithVisibleWells;
|
||||
RimWellPathImport* m_wellPathImportObject;
|
||||
caf::PdmUiTreeView* m_wellSelectionTreeView;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class WellSummaryPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WellSummaryPage( RimWellPathImport* wellPathImport, QWidget* parent = nullptr );
|
||||
|
||||
void initializePage() override;
|
||||
|
||||
void updateSummaryPage();
|
||||
|
||||
private slots:
|
||||
void slotShowDetails();
|
||||
|
||||
private:
|
||||
RimWellPathImport* m_wellPathImportObject;
|
||||
QTextEdit* m_textEdit;
|
||||
caf::PdmUiListView* m_listView;
|
||||
caf::PdmObjectCollection* m_objectGroup;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiuWellImportWizard : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum DownloadState
|
||||
{
|
||||
DOWNLOAD_FIELDS,
|
||||
DOWNLOAD_WELLS,
|
||||
DOWNLOAD_WELL_PATH,
|
||||
DOWNLOAD_UNDEFINED
|
||||
};
|
||||
|
||||
public:
|
||||
RiuWellImportWizard( const QString& webServiceAddress,
|
||||
const QString& downloadFolder,
|
||||
RimWellPathImport* wellPathImportObject,
|
||||
QWidget* parent = nullptr );
|
||||
~RiuWellImportWizard() override;
|
||||
|
||||
void setCredentials( const QString& username, const QString& password );
|
||||
QStringList absoluteFilePathsToWellPaths() const;
|
||||
|
||||
// Methods used from the wizard pages
|
||||
void resetAuthenticationCount();
|
||||
|
||||
public slots:
|
||||
void downloadWellPaths();
|
||||
void downloadWells();
|
||||
void downloadFields();
|
||||
|
||||
void checkDownloadQueueAndIssueRequests();
|
||||
|
||||
void issueHttpRequestToFile( QString completeUrlText, QString destinationFileName );
|
||||
void cancelDownload();
|
||||
|
||||
void httpFinished();
|
||||
void httpReadyRead();
|
||||
|
||||
void slotAuthenticationRequired( QNetworkReply* networkReply, QAuthenticator* authenticator );
|
||||
|
||||
int wellSelectionPageId();
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void sslErrors( QNetworkReply*, const QList<QSslError>& errors );
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void slotCurrentIdChanged( int currentId );
|
||||
|
||||
private:
|
||||
void startRequest( QUrl url );
|
||||
void setUrl( const QString& httpAddress );
|
||||
|
||||
QString jsonFieldsFilePath();
|
||||
QString jsonWellsFilePath();
|
||||
|
||||
void updateFieldsModel();
|
||||
void parseWellsResponse( RimOilFieldEntry* oilFieldEntry );
|
||||
|
||||
QString getValue( const QString& key, const QString& stringContent );
|
||||
|
||||
QProgressDialog* progressDialog();
|
||||
void hideProgressDialog();
|
||||
|
||||
private:
|
||||
QString m_webServiceAddress;
|
||||
QString m_destinationFolder;
|
||||
|
||||
RimWellPathImport* m_wellPathImportObject;
|
||||
caf::PdmUiTreeView* m_pdmTreeView;
|
||||
|
||||
QProgressDialog* m_myProgressDialog;
|
||||
|
||||
QUrl m_url;
|
||||
QNetworkAccessManager m_networkAccessManager;
|
||||
QNetworkReply* m_reply;
|
||||
QFile* m_file;
|
||||
bool m_httpRequestAborted;
|
||||
|
||||
bool m_firstTimeRequestingAuthentication;
|
||||
|
||||
QList<DownloadEntity> m_wellRequestQueue;
|
||||
|
||||
DownloadState m_currentDownloadState;
|
||||
|
||||
int m_fieldSelectionPageId;
|
||||
int m_wellSelectionPageId;
|
||||
int m_wellSummaryPageId;
|
||||
};
|
||||
Reference in New Issue
Block a user