From 2022e2dd3d2619927b73eea97c22f9e78b5f3ae8 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 20 Dec 2016 15:28:37 +0100 Subject: [PATCH] (#1038) - pre-proto - Added new well path fracture from context menu in 3D view. Measured depth along well path for fracture is not yet updated. --- .../Commands/CMakeLists_files.cmake | 3 +- ...RicNewWellPathCollFractureAtPosFeature.cpp | 113 ++++++++++++++++++ .../RicNewWellPathCollFractureAtPosFeature.h | 39 ++++++ .../ProjectDataModel/RimFracture.cpp | 7 +- .../ProjectDataModel/RimFracture.h | 3 + .../RimFractureDefinitionCollection.cpp | 2 +- .../ProjectDataModel/RimOilField.cpp | 5 +- .../ProjectDataModel/RimOilField.h | 2 - .../UserInterface/RiuViewerCommands.cpp | 1 + 9 files changed, 165 insertions(+), 10 deletions(-) create mode 100644 ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.cpp create mode 100644 ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.h diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index faf8dc52bb..0970de95a1 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -42,6 +42,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureAtPosFeature.h ${CEE_CURRENT_LIST_DIR}RicNewFractureDefinitionFeature.h ${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.h +${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureAtPosFeature.h # General delete of any object in a child array field @@ -86,8 +87,8 @@ ${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureAtPosFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewFractureDefinitionFeature.cpp -#${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.cpp +${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureAtPosFeature.cpp diff --git a/ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.cpp b/ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.cpp new file mode 100644 index 0000000000..a21c93e98d --- /dev/null +++ b/ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.cpp @@ -0,0 +1,113 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewWellPathCollFractureAtPosFeature.h" + +#include "RiaApplication.h" + +#include "RimCase.h" +#include "RimFracture.h" +#include "RimFractureCollection.h" +#include "RimProject.h" +#include "RimWellPathCollection.h" + +#include "cafSelectionManager.h" + +#include "cvfAssert.h" + +#include "QAction.h" +#include "RimWellPath.h" +#include "RimView.h" +#include "cvfVector3.h" +#include "cvfRenderState_FF.h" +#include "RiuViewer.h" + + +CAF_CMD_SOURCE_INIT(RicNewWellPathCollFractureAtPosFeature, "RicNewWellPathCollFractureAtPosFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellPathCollFractureAtPosFeature::onActionTriggered(bool isChecked) +{ + RimView* activeView = RiaApplication::instance()->activeReservoirView(); + if (!activeView) return; + + std::vector collection; + caf::SelectionManager::instance()->objectsByType(&collection); + if (collection.size() != 1) return; + + RimWellPath* wellPath = collection[0]; + + caf::PdmObjectHandle* objHandle = dynamic_cast(wellPath); + if (!objHandle) return; + + RimWellPathCollection* wellPathColl = nullptr; + objHandle->firstAncestorOrThisOfType(wellPathColl); + CVF_ASSERT(wellPathColl); + + RimFractureCollection* fractureCollection = wellPathColl->fractureCollection(); + + RimFracture* fracture = new RimFracture(); + fractureCollection->fractures.push_back(fracture); + + fracture->name = "New Well Path Fracture"; + fracture->welltype = RimFracture::FRACTURE_WELL_PATH; + fracture->wellpath = wellPath; + //TODO set all relevant defaults... + + + cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords(); + fracture->positionAtWellpath = domainCoord; + + + + fractureCollection->updateConnectedEditors(); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellPathCollFractureAtPosFeature::setupActionLook(QAction* actionToSetup) +{ +// actionToSetup->setIcon(QIcon(":/CrossSection16x16.png")); + actionToSetup->setText("New Fracture"); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewWellPathCollFractureAtPosFeature::isCommandEnabled() +{ + caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem(); + if (!pdmUiItem) return false; + + caf::PdmObjectHandle* objHandle = dynamic_cast(pdmUiItem); + if (!objHandle) return false; + + RimWellPathCollection* wellPathColl = nullptr; + objHandle->firstAncestorOrThisOfType(wellPathColl); + + if (wellPathColl) + { + return true; + } + + return false; +} diff --git a/ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.h b/ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.h new file mode 100644 index 0000000000..029804fadd --- /dev/null +++ b/ApplicationCode/Commands/RicNewWellPathCollFractureAtPosFeature.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +#include + + +//================================================================================================== +/// +//================================================================================================== +class RicNewWellPathCollFractureAtPosFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + + +}; diff --git a/ApplicationCode/ProjectDataModel/RimFracture.cpp b/ApplicationCode/ProjectDataModel/RimFracture.cpp index 24790ad3a2..93b182a6e9 100644 --- a/ApplicationCode/ProjectDataModel/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimFracture.cpp @@ -32,6 +32,7 @@ #include "QToolBox" #include "QList" +#include "cvfVector3.h" namespace caf @@ -59,8 +60,9 @@ RimFracture::RimFracture(void) CAF_PDM_InitField(&name, "UserDescription", QString("Fracture Name"), "Name", "", "", ""); CAF_PDM_InitField(&welltype,"Type", caf::AppEnum(FRACTURE_SIMULATION_WELL), "Type", "", "", ""); - CAF_PDM_InitField( &measuredDepth, "MeasuredDepth", 650.0f, "Measured Depth Location (if along well path)", "", "", ""); - CAF_PDM_InitFieldNoDefault(&wellpath, "WellPath", "Well path for measured deph", "", "", ""); + CAF_PDM_InitField( &measuredDepth, "MeasuredDepth", 650.0f, "Measured Depth Location (if along well path)", "", "", ""); + CAF_PDM_InitFieldNoDefault(&wellpath, "WellPath", "Well path for measured deph", "", "", ""); + CAF_PDM_InitField( &positionAtWellpath, "PositionAtWellpath", cvf::Vec3d::ZERO, "Fracture Position at Well Path", "", "", ""); CAF_PDM_InitField(&i, "I", 1, "Fracture location cell I", "", "", ""); CAF_PDM_InitField(&j, "J", 1, "Fracture location cell J", "", "", ""); @@ -139,6 +141,7 @@ void RimFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO { geometryGroup->add(&wellpath); geometryGroup->add(&measuredDepth); + geometryGroup->add(&positionAtWellpath); } else if (welltype == FRACTURE_SIMULATION_WELL) diff --git a/ApplicationCode/ProjectDataModel/RimFracture.h b/ApplicationCode/ProjectDataModel/RimFracture.h index fc194f088b..8f888cb24a 100644 --- a/ApplicationCode/ProjectDataModel/RimFracture.h +++ b/ApplicationCode/ProjectDataModel/RimFracture.h @@ -22,6 +22,8 @@ #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" +#include "RimView.h" +#include "cvfVector3.h" class RimFractureDefinition; class RimWellPath; @@ -51,6 +53,7 @@ public: caf::PdmPtrField wellpath; caf::PdmField measuredDepth; + caf::PdmField positionAtWellpath; caf::PdmField i; caf::PdmField j; diff --git a/ApplicationCode/ProjectDataModel/RimFractureDefinitionCollection.cpp b/ApplicationCode/ProjectDataModel/RimFractureDefinitionCollection.cpp index 471d8cbec2..f3d581c204 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureDefinitionCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureDefinitionCollection.cpp @@ -35,7 +35,7 @@ RimFractureDefinitionCollection::RimFractureDefinitionCollection(void) CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", ""); - CAF_PDM_InitFieldNoDefault(&fractureDefinitions, "Fracture Definitions", "", "", "", ""); + CAF_PDM_InitFieldNoDefault(&fractureDefinitions, "FractureDefinitions", "", "", "", ""); fractureDefinitions.uiCapability()->setUiHidden(true); } diff --git a/ApplicationCode/ProjectDataModel/RimOilField.cpp b/ApplicationCode/ProjectDataModel/RimOilField.cpp index 1b8e433935..d52a98d2aa 100644 --- a/ApplicationCode/ProjectDataModel/RimOilField.cpp +++ b/ApplicationCode/ProjectDataModel/RimOilField.cpp @@ -23,7 +23,7 @@ #include "RimEclipseCaseCollection.h" #include "RimFormationNamesCollection.h" #include "RimFractureDefinitionCollection.h" -//#include "RimFractureCollection.h" + #include "RimGeoMechModels.h" #include "RimSummaryCaseCollection.h" #include "RimWellPathCollection.h" @@ -42,11 +42,9 @@ RimOilField::RimOilField(void) CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", ""); CAF_PDM_InitFieldNoDefault(&fractureDefinitionCollection, "FractureDefinitionCollection", "Defenition of fractures", "", "", ""); CAF_PDM_InitFieldNoDefault(&summaryCaseCollection,"SummaryCaseCollection","Summary Cases",":/GridModels.png","",""); -// CAF_PDM_InitFieldNoDefault(&fractureCollection, "FractureCollection", "Fractures", "", "", ""); CAF_PDM_InitFieldNoDefault(&formationNamesCollection,"FormationNamesCollection","Formations","","",""); fractureDefinitionCollection = new RimFractureDefinitionCollection(); -// fractureCollection = new RimFractureCollection(); analysisModels = new RimEclipseCaseCollection(); wellPathCollection = new RimWellPathCollection(); summaryCaseCollection = new RimSummaryCaseCollection(); @@ -59,7 +57,6 @@ RimOilField::~RimOilField(void) { if (wellPathCollection()) delete wellPathCollection(); if (fractureDefinitionCollection()) delete fractureDefinitionCollection(); -// if (fractureCollection()) delete fractureCollection(); if (geoMechModels()) delete geoMechModels(); if (analysisModels()) delete analysisModels(); if (summaryCaseCollection()) delete summaryCaseCollection(); diff --git a/ApplicationCode/ProjectDataModel/RimOilField.h b/ApplicationCode/ProjectDataModel/RimOilField.h index 8952358854..6ff702861b 100644 --- a/ApplicationCode/ProjectDataModel/RimOilField.h +++ b/ApplicationCode/ProjectDataModel/RimOilField.h @@ -29,7 +29,6 @@ class RimEclipseCaseCollection; class RimGeoMechModels; class RimWellPathCollection; class RimFractureDefinitionCollection; -//class RimFractureCollection; class RimSummaryCaseCollection; class RimFormationNamesCollection; @@ -49,7 +48,6 @@ public: caf::PdmChildField geoMechModels; caf::PdmChildField wellPathCollection; caf::PdmChildField fractureDefinitionCollection; -// caf::PdmChildField fractureCollection; caf::PdmChildField summaryCaseCollection; caf::PdmChildField formationNamesCollection; diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index c3d54985c0..2af08de8fe 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -298,6 +298,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event) commandIds << "RicNewWellLogFileCurveFeature"; commandIds << "RicNewWellLogCurveExtractionFeature"; commandIds << "RicNewWellPathIntersectionFeature"; + commandIds << "RicNewWellPathCollFractureAtPosFeature"; } }