diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 7110ef97d1..5602847442 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -83,6 +83,9 @@ #include "cvfProgramOptions.h" #include "cvfqtUtils.h" #include "RimCommandObject.h" +#include "RimGeoMechCase.h" +#include "RimGeoMechModels.h" +#include "RimGeoMechView.h" namespace caf @@ -702,6 +705,49 @@ bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNa } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaApplication::openOdbCaseFromFile(const QString& fileName) +{ + if (!QFile::exists(fileName)) return false; + + QFileInfo gridFileName(fileName); + QString caseName = gridFileName.completeBaseName(); + + RimGeoMechCase* geoMechCase = new RimGeoMechCase(); + geoMechCase->caseUserDescription = caseName; + + RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : NULL; + + // Create the geoMech model container if it is not there already + if (geoMechModelCollection == NULL) + { + geoMechModelCollection = new RimGeoMechModels(); + m_project->activeOilField()->geoMechModels = geoMechModelCollection; + } + + geoMechModelCollection->cases.push_back(geoMechCase); + + RimGeoMechView* riv = geoMechCase->createAndAddReservoirView(); + + // riv->loadDataAndUpdate(); + + //if (!riv->cellResult()->hasResult()) + //{ + // riv->cellResult()->setResultVariable(RimDefines::undefinedResultName()); + //} + + RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel(); + + uiModel->updateUiSubTree(m_project); + + RiuMainWindow::instance()->setCurrentObjectInTreeView(riv->cellResult()); + + return true; +} + + //-------------------------------------------------------------------------------------------------- /// @@ -2079,4 +2125,3 @@ void RiaApplication::regressionTestConfigureProject() } } } - diff --git a/ApplicationCode/Application/RiaApplication.h b/ApplicationCode/Application/RiaApplication.h index 1d04f1ace7..3386d72dd7 100644 --- a/ApplicationCode/Application/RiaApplication.h +++ b/ApplicationCode/Application/RiaApplication.h @@ -94,6 +94,8 @@ public: bool addEclipseCases(const QStringList& fileNames); bool openInputEclipseCaseFromFileNames(const QStringList& fileNames); + bool openOdbCaseFromFile(const QString& fileName); + QString currentProjectFileName() const; QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath); bool loadProject(const QString& projectFileName); diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index acfb39020e..b6ef70a581 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -51,6 +51,9 @@ ${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.h ${CEE_CURRENT_LIST_DIR}RimFaultResultSlot.h ${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNNC.h ${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNncCollection.h +${CEE_CURRENT_LIST_DIR}RimGeoMechModels.h +${CEE_CURRENT_LIST_DIR}RimGeoMechCase.h +${CEE_CURRENT_LIST_DIR}RimGeoMechView.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -100,6 +103,9 @@ ${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.cpp ${CEE_CURRENT_LIST_DIR}RimFaultResultSlot.cpp ${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNNC.cpp ${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNncCollection.cpp +${CEE_CURRENT_LIST_DIR}RimGeoMechModels.cpp +${CEE_CURRENT_LIST_DIR}RimGeoMechCase.cpp +${CEE_CURRENT_LIST_DIR}RimGeoMechView.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 9165ad92dc..18716a2789 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -245,3 +245,11 @@ caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField() { return &active; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dOverlayInfoConfig::setReservoirView(RimReservoirView* ownerReservoirView) +{ + m_reservoirView = ownerReservoirView; +} diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index 7f0c805144..b49697757a 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -41,7 +41,7 @@ public: void update3DInfo(); - void setReservoirView(RimReservoirView* ownerReservoirView) {m_reservoirView = ownerReservoirView; } + void setReservoirView(RimReservoirView* ownerReservoirView); void setPosition(cvf::Vec2ui position); caf::PdmField active; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp new file mode 100644 index 0000000000..ccc717be3c --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimGeoMechCase.h" +#include "RimGeoMechView.h" + +CAF_PDM_SOURCE_INIT(RimGeoMechCase, "ResInsightGeoMechCase"); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechCase::RimGeoMechCase(void) +{ + CAF_PDM_InitObject("Geomechanical Case", ":/GeoMechCase48x48.png", "", ""); + + CAF_PDM_InitField(&caseUserDescription, "CaseUserDescription", QString(), "Case name", "", "" ,""); + CAF_PDM_InitField(&caseFileName, "CaseFileName", QString(), "Case file name", "", "", ""); + caseFileName.setUiReadOnly(true); + CAF_PDM_InitFieldNoDefault(&geoMechViews, "GeoMechViews", "", "", "", ""); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechCase::~RimGeoMechCase(void) +{ + geoMechViews.deleteAllChildObjects(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechView* RimGeoMechCase::createAndAddReservoirView() +{ + RimGeoMechView* gmv = new RimGeoMechView(); + size_t i = geoMechViews().size(); + gmv->name = QString("View %1").arg(i + 1); + + geoMechViews.push_back(gmv); + return gmv; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimGeoMechCase::userDescriptionField() +{ + return &caseUserDescription; +} + diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h new file mode 100644 index 0000000000..63af359448 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPointer.h" + +class RimGeoMechView; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimGeoMechCase : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimGeoMechCase(void); + virtual ~RimGeoMechCase(void); + + RimGeoMechView* createAndAddReservoirView(); + + virtual caf::PdmFieldHandle* userDescriptionField(); + + // Fields: + caf::PdmField caseUserDescription; + caf::PdmPointersField geoMechViews; + +private: + caf::PdmField caseFileName; +}; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechModels.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechModels.cpp new file mode 100644 index 0000000000..a24570d0f3 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimGeoMechModels.cpp @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimGeoMechModels.h" + +#include "RimGeoMechCase.h" + + +CAF_PDM_SOURCE_INIT(RimGeoMechModels, "ResInsightGeoMechModels"); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechModels::RimGeoMechModels(void) +{ + CAF_PDM_InitObject("Geomechanical Models", ":/GeoMechCases48x48.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&cases, "Cases", "", "", "", ""); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechModels::~RimGeoMechModels(void) +{ + cases.deleteAllChildObjects(); +} + diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechModels.h b/ApplicationCode/ProjectDataModel/RimGeoMechModels.h new file mode 100644 index 0000000000..aa81ca5b0c --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimGeoMechModels.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPointer.h" + +class RimGeoMechCase; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimGeoMechModels : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimGeoMechModels(void); + virtual ~RimGeoMechModels(void); + + caf::PdmPointersField cases; + +private: +}; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp new file mode 100644 index 0000000000..e489379c66 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimGeoMechView.h" +#include "RimReservoirView.h" + +#include "Rim3dOverlayInfoConfig.h" +#include "RiaApplication.h" +#include "RiaPreferences.h" +#include "RimResultSlot.h" + + + +namespace caf { + +template<> +void caf::AppEnum< RimGeoMechView::MeshModeType >::setUp() +{ + addItem(RimGeoMechView::FULL_MESH, "FULL_MESH", "All"); + addItem(RimGeoMechView::FAULTS_MESH, "FAULTS_MESH", "Faults only"); + addItem(RimGeoMechView::NO_MESH, "NO_MESH", "None"); + setDefault(RimGeoMechView::FULL_MESH); +} + +template<> +void caf::AppEnum< RimGeoMechView::SurfaceModeType >::setUp() +{ + addItem(RimGeoMechView::SURFACE, "SURFACE", "All"); + addItem(RimGeoMechView::FAULTS, "FAULTS", "Faults only"); + addItem(RimGeoMechView::NO_SURFACE, "NO_SURFACE", "None"); + setDefault(RimGeoMechView::SURFACE); +} + +} // End namespace caf + + + + + +CAF_PDM_SOURCE_INIT(RimGeoMechView, "GeoMechView"); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechView::RimGeoMechView(void) +{ + RiaApplication* app = RiaApplication::instance(); + RiaPreferences* preferences = app->preferences(); + CVF_ASSERT(preferences); + + CAF_PDM_InitObject("Geomechanical View", ":/ReservoirView.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", ""); + cellResult = new RimResultSlot(); + + CAF_PDM_InitFieldNoDefault(&overlayInfoConfig, "OverlayInfoConfig", "Info Box", "", "", ""); + overlayInfoConfig = new Rim3dOverlayInfoConfig(); + + CAF_PDM_InitField(&name, "UserDescription", QString("View"), "Name", "", "", ""); + + double defaultScaleFactor = 1.0; + if (preferences) defaultScaleFactor = preferences->defaultScaleFactorZ; + CAF_PDM_InitField(&scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", ""); + + caf::AppEnum defaultMeshType = NO_MESH; + if (preferences->defaultGridLines) defaultMeshType = FULL_MESH; + CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid lines", "", "", ""); + CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid surface", "", "", ""); + + cvf::Color3f defBackgColor = preferences->defaultViewerBackgroundColor(); + CAF_PDM_InitField(&backgroundColor, "ViewBackgroundColor", defBackgColor, "Background", "", "", ""); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGeoMechView::~RimGeoMechView(void) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimGeoMechView::userDescriptionField() +{ + return &name; +} + diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.h b/ApplicationCode/ProjectDataModel/RimGeoMechView.h new file mode 100644 index 0000000000..7b9659c7da --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPointer.h" +#include "cafAppEnum.h" +#include "cafPdmFieldCvfColor.h" + +class RimResultSlot; +class Rim3dOverlayInfoConfig; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimGeoMechView : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimGeoMechView(void); + virtual ~RimGeoMechView(void); + + + enum MeshModeType + { + FULL_MESH, + FAULTS_MESH, + NO_MESH + }; + + enum SurfaceModeType + { + SURFACE, + FAULTS, + NO_SURFACE + }; + + caf::PdmField cellResult; + caf::PdmField overlayInfoConfig; + + // Fields: + caf::PdmField name; + caf::PdmField scaleZ; + + caf::PdmField< caf::AppEnum< MeshModeType > > meshMode; + caf::PdmField< caf::AppEnum< SurfaceModeType > > surfaceMode; + + caf::PdmField< cvf::Color3f > backgroundColor; +protected: + virtual caf::PdmFieldHandle* userDescriptionField(); + +private: +}; diff --git a/ApplicationCode/ProjectDataModel/RimOilField.cpp b/ApplicationCode/ProjectDataModel/RimOilField.cpp index f56e5bc456..2349d61467 100644 --- a/ApplicationCode/ProjectDataModel/RimOilField.cpp +++ b/ApplicationCode/ProjectDataModel/RimOilField.cpp @@ -22,6 +22,7 @@ #include "RimAnalysisModels.h" #include "RimWellPathCollection.h" +#include "RimGeoMechModels.h" CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField"); //-------------------------------------------------------------------------------------------------- @@ -32,6 +33,7 @@ RimOilField::RimOilField(void) CAF_PDM_InitObject("Oil Field", "", "", ""); CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", ""); + CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", ""); CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", ""); analysisModels = new RimAnalysisModels(); @@ -43,6 +45,7 @@ RimOilField::RimOilField(void) RimOilField::~RimOilField(void) { if (wellPathCollection()) delete wellPathCollection(); + if (geoMechModels()) delete geoMechModels(); if (analysisModels()) delete analysisModels(); } diff --git a/ApplicationCode/ProjectDataModel/RimOilField.h b/ApplicationCode/ProjectDataModel/RimOilField.h index 0a26e32d40..e45a0fff5c 100644 --- a/ApplicationCode/ProjectDataModel/RimOilField.h +++ b/ApplicationCode/ProjectDataModel/RimOilField.h @@ -26,6 +26,7 @@ class RimWellPathCollection; class RimAnalysisModels; +class RimGeoMechModels; //================================================================================================== /// @@ -40,5 +41,6 @@ public: virtual ~RimOilField(void); caf::PdmField analysisModels; + caf::PdmField geoMechModels; caf::PdmField wellPathCollection; }; diff --git a/ApplicationCode/Resources/GeoMechCase48x48.png b/ApplicationCode/Resources/GeoMechCase48x48.png new file mode 100644 index 0000000000..859c240e91 Binary files /dev/null and b/ApplicationCode/Resources/GeoMechCase48x48.png differ diff --git a/ApplicationCode/Resources/GeoMechCase48x48.xcf b/ApplicationCode/Resources/GeoMechCase48x48.xcf new file mode 100644 index 0000000000..a5a0f28254 Binary files /dev/null and b/ApplicationCode/Resources/GeoMechCase48x48.xcf differ diff --git a/ApplicationCode/Resources/GeoMechCases48x48.png b/ApplicationCode/Resources/GeoMechCases48x48.png new file mode 100644 index 0000000000..c27dd63b30 Binary files /dev/null and b/ApplicationCode/Resources/GeoMechCases48x48.png differ diff --git a/ApplicationCode/Resources/GeoMechCases48x48.xcf b/ApplicationCode/Resources/GeoMechCases48x48.xcf new file mode 100644 index 0000000000..2304b1de5b Binary files /dev/null and b/ApplicationCode/Resources/GeoMechCases48x48.xcf differ diff --git a/ApplicationCode/Resources/ResInsight.qrc b/ApplicationCode/Resources/ResInsight.qrc index 384db079ed..7fcc5298c5 100644 --- a/ApplicationCode/Resources/ResInsight.qrc +++ b/ApplicationCode/Resources/ResInsight.qrc @@ -44,6 +44,8 @@ draw_style_WellCellsToRangeFilter_24x24.png draw_style_surface_w_fault_mesh_24x24.png InfoBox16x16.png + GeoMechCase48x48.png + GeoMechCases48x48.png fs_CellFace.glsl diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 5ebb970e73..1a347e922d 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -57,6 +57,7 @@ #include "cafPdmUiPropertyView.h" #include "cvfTimer.h" +#include "RimGeoMechModels.h" //================================================================================================== @@ -184,6 +185,7 @@ void RiuMainWindow::createActions() m_importEclipseCaseAction = new QAction(QIcon(":/Case48x48.png"), "Import &Eclipse Case", this); m_importInputEclipseFileAction= new QAction(QIcon(":/EclipseInput48x48.png"), "Import &Input Eclipse Case", this); + m_importGeoMechCaseAction = new QAction(QIcon(":/GeoMechCase48x48.png"), "Import &Geo Mechanical Model", this); m_openMultipleEclipseCasesAction = new QAction(QIcon(":/CreateGridCaseGroup16x16.png"), "&Create Grid Case Group from Files", this); m_importWellPathsFromFileAction = new QAction(QIcon(":/Well.png"), "Import &Well Paths from File", this); @@ -220,6 +222,8 @@ void RiuMainWindow::createActions() connect(m_openProjectAction, SIGNAL(triggered()), SLOT(slotOpenProject())); connect(m_openLastUsedProjectAction, SIGNAL(triggered()), SLOT(slotOpenLastUsedProject())); connect(m_importEclipseCaseAction, SIGNAL(triggered()), SLOT(slotImportEclipseCase())); + connect(m_importGeoMechCaseAction, SIGNAL(triggered()), SLOT(slotImportGeoMechModel())); + connect(m_importInputEclipseFileAction, SIGNAL(triggered()), SLOT(slotImportInputEclipseFiles())); connect(m_openMultipleEclipseCasesAction, SIGNAL(triggered()), SLOT(slotOpenMultipleCases())); connect(m_importWellPathsFromFileAction, SIGNAL(triggered()), SLOT(slotImportWellPathsFromFile())); @@ -382,6 +386,8 @@ void RiuMainWindow::createMenus() importMenu->addAction(m_importInputEclipseFileAction); importMenu->addAction(m_openMultipleEclipseCasesAction); importMenu->addSeparator(); + importMenu->addAction(m_importGeoMechCaseAction); + importMenu->addSeparator(); importMenu->addAction(m_importWellPathsFromFileAction); importMenu->addAction(m_importWellPathsFromSSIHubAction); @@ -837,6 +843,36 @@ void RiuMainWindow::slotImportInputEclipseFiles() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::slotImportGeoMechModel() +{ + if (checkForDocumentModifications()) + { + RiaApplication* app = RiaApplication::instance(); + + QString defaultDir = app->defaultFileDialogDirectory("GEOMECH_MODEL"); + QStringList fileNames = QFileDialog::getOpenFileNames(this, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)"); + if (fileNames.size()) defaultDir = QFileInfo(fileNames.last()).absolutePath(); + app->setDefaultFileDialogDirectory("GEOMECH_MODEL", defaultDir); + + int i; + for (i = 0; i < fileNames.size(); i++) + { + QString fileName = fileNames[i]; + + if (!fileNames.isEmpty()) + { + if (app->openOdbCaseFromFile(fileName)) + { + addRecentFiles(fileName); + } + } + } + } +} + //-------------------------------------------------------------------------------------------------- /// @@ -2011,6 +2047,10 @@ void RiuMainWindow::appendActionsContextMenuForPdmObject(caf::PdmObject* pdmObje menu->addAction(m_importInputEclipseFileAction); menu->addAction(m_openMultipleEclipseCasesAction); } + else if (dynamic_cast(pdmObject)) + { + menu->addAction(m_importGeoMechCaseAction); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index 8ce06d71b1..91ce6a747f 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -132,6 +132,7 @@ private: // File actions QAction* m_importEclipseCaseAction; QAction* m_importInputEclipseFileAction; + QAction* m_importGeoMechCaseAction; QAction* m_openMultipleEclipseCasesAction; QAction* m_openProjectAction; QAction* m_openLastUsedProjectAction; @@ -206,6 +207,7 @@ private slots: // File slots void slotImportEclipseCase(); void slotImportInputEclipseFiles(); + void slotImportGeoMechModel(); void slotOpenMultipleCases(); void slotOpenProject(); void slotOpenLastUsedProject(); @@ -279,7 +281,6 @@ private slots: // Pdm System : public: void setPdmRoot(caf::PdmObject* pdmRoot); - private: RimUiTreeView* m_treeView; RimUiTreeModelPdm* m_treeModelPdm;