diff --git a/ApplicationCode/Commands/FractureCommands/RicCreateDuplicateTemplateInOtherUnitSystemFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicCreateDuplicateTemplateInOtherUnitSystemFeature.cpp index 4cacae58dd..975ec04997 100644 --- a/ApplicationCode/Commands/FractureCommands/RicCreateDuplicateTemplateInOtherUnitSystemFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicCreateDuplicateTemplateInOtherUnitSystemFeature.cpp @@ -88,7 +88,7 @@ void RicCreateDuplicateTemplateInOtherUnitSystemFeature::onActionTriggered(bool copyOfTemplate->loadDataAndUpdate(); copyOfTemplate->updateConnectedEditors(); - RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(fractureTemplateCollection, copyOfTemplate); + RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(copyOfTemplate); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.cpp index 4cc4e0dd80..ebc0d4b7c3 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.cpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2016- Statoil ASA +// Copyright (C) 2016-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -25,6 +26,7 @@ #include "RimFractureTemplateCollection.h" #include "RimOilField.h" #include "RimProject.h" +#include "RimWellPathFracture.h" #include "Riu3DMainWindowTools.h" @@ -39,25 +41,27 @@ CAF_CMD_SOURCE_INIT(RicNewEllipseFractureTemplateFeature, "RicNewEllipseFracture //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFractureTemplateCollection* templateCollection, - RimFractureTemplate* fractureTemplate) +void RicNewEllipseFractureTemplateFeature::createNewTemplateForFractureAndUpdate(RimFracture* fracture) +{ + RimEllipseFractureTemplate* fractureTemplate = createNewTemplate(); + fracture->setFractureTemplate(fractureTemplate); + selectFractureTemplateAndUpdate(fractureTemplate); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFractureTemplate* fractureTemplate) { fractureTemplate->loadDataAndUpdate(); + RimFractureTemplateCollection* templateCollection = nullptr; + fractureTemplate->firstAncestorOrThisOfTypeAsserted(templateCollection); templateCollection->updateConnectedEditors(); RimProject* project = RiaApplication::instance()->project(); - - std::vector views; - project->allVisibleViews(views); - - for (Rim3dView* view : views) - { - if (dynamic_cast(view)) - { - view->updateConnectedEditors(); - } - } + + project->scheduleCreateDisplayModelAndRedrawAllViews(); Riu3DMainWindowTools::selectAsCurrentItem(fractureTemplate); } @@ -65,13 +69,13 @@ void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewEllipseFractureTemplateFeature::onActionTriggered(bool isChecked) +RimEllipseFractureTemplate* RicNewEllipseFractureTemplateFeature::createNewTemplate() { - RimProject* project = RiaApplication::instance()->project(); + RimProject* project = RiaApplication::instance()->project(); CVF_ASSERT(project); RimOilField* oilfield = project->activeOilField(); - if (oilfield == nullptr) return; + if (oilfield == nullptr) return nullptr; RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection(); @@ -84,8 +88,18 @@ void RicNewEllipseFractureTemplateFeature::onActionTriggered(bool isChecked) ellipseFractureTemplate->setUnitSystem(fracDefColl->defaultUnitSystemType()); ellipseFractureTemplate->setDefaultValuesFromUnit(); - selectFractureTemplateAndUpdate(fracDefColl, ellipseFractureTemplate); + return ellipseFractureTemplate; } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewEllipseFractureTemplateFeature::onActionTriggered(bool isChecked) +{ + RimEllipseFractureTemplate* ellipseFractureTemplate = createNewTemplate(); + selectFractureTemplateAndUpdate(ellipseFractureTemplate); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.h b/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.h index 26a440b44c..118a76f7b2 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.h +++ b/ApplicationCode/Commands/FractureCommands/RicNewEllipseFractureTemplateFeature.h @@ -1,6 +1,8 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2016- Statoil ASA +// Copyright (C) 2016-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -22,6 +24,8 @@ #include +class RimEllipseFractureTemplate; +class RimFracture; class RimFractureTemplate; class RimFractureTemplateCollection; @@ -33,10 +37,10 @@ class RicNewEllipseFractureTemplateFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static void selectFractureTemplateAndUpdate(RimFractureTemplateCollection* templateCollection, - RimFractureTemplate* ellipseFractureTemplate); - + static void createNewTemplateForFractureAndUpdate(RimFracture* fracture); + static void selectFractureTemplateAndUpdate(RimFractureTemplate* fractureTemplate); protected: + static RimEllipseFractureTemplate* createNewTemplate(); void onActionTriggered(bool isChecked) override; void setupActionLook(QAction* actionToSetup) override; bool isCommandEnabled() override; diff --git a/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp index e3e231be1c..34cf6d5011 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017- Statoil ASA +// Copyright (C) 2017-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -25,6 +26,7 @@ #include "RimOilField.h" #include "RimProject.h" #include "RimStimPlanFractureTemplate.h" +#include "RimWellPathFracture.h" #include "Riu3DMainWindowTools.h" @@ -39,26 +41,60 @@ CAF_CMD_SOURCE_INIT(RicNewStimPlanFractureTemplateFeature, "RicNewStimPlanFractureTemplateFeature"); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) +void RicNewStimPlanFractureTemplateFeature::createNewTemplateForFractureAndUpdate(RimFracture* fracture) { - RiaApplication* app = RiaApplication::instance(); - QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID"); - QStringList fileNames = QFileDialog::getOpenFileNames(nullptr, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)"); + std::vector newTemplates = createNewTemplates(); + if (!newTemplates.empty()) + { + RimStimPlanFractureTemplate* lastTemplateCreated = newTemplates.back(); + fracture->setFractureTemplate(lastTemplateCreated); + + selectFractureTemplateAndUpdate(lastTemplateCreated); + } +} - if (fileNames.isEmpty()) return; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewStimPlanFractureTemplateFeature::selectFractureTemplateAndUpdate(RimFractureTemplate* fractureTemplate) +{ + fractureTemplate->loadDataAndUpdate(); + + RimFractureTemplateCollection* templateCollection = nullptr; + fractureTemplate->firstAncestorOrThisOfTypeAsserted(templateCollection); + templateCollection->updateConnectedEditors(); + + RimProject* project = RiaApplication::instance()->project(); + + project->scheduleCreateDisplayModelAndRedrawAllViews(); + Riu3DMainWindowTools::selectAsCurrentItem(fractureTemplate); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicNewStimPlanFractureTemplateFeature::createNewTemplates() +{ + RiaApplication* app = RiaApplication::instance(); + QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID"); + QStringList fileNames = + QFileDialog::getOpenFileNames(nullptr, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)"); + + if (fileNames.isEmpty()) return std::vector(); RimProject* project = RiaApplication::instance()->project(); CVF_ASSERT(project); RimOilField* oilfield = project->activeOilField(); - if (oilfield == nullptr) return; + if (oilfield == nullptr) return std::vector(); RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection(); - if (!fracDefColl) return; + if (!fracDefColl) return std::vector(); - for(auto fileName : fileNames) + std::vector newFractures; + for (auto fileName : fileNames) { if (fileName.isEmpty()) continue; @@ -66,7 +102,7 @@ void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) fracDefColl->addFractureTemplate(fractureDef); QFileInfo stimplanfileFileInfo(fileName); - QString name = stimplanfileFileInfo.baseName(); + QString name = stimplanfileFileInfo.baseName(); if (name.isEmpty()) { name = "StimPlan Fracture Template"; @@ -79,22 +115,18 @@ void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) fractureDef->setDefaultsBasedOnXMLfile(); fractureDef->setDefaultWellDiameterFromUnit(); fractureDef->updateFractureGrid(); - - fracDefColl->updateConnectedEditors(); - - std::vector views; - project->allVisibleViews(views); - - for (Rim3dView* view : views) - { - if (dynamic_cast(view)) - { - view->updateConnectedEditors(); - } - } - - Riu3DMainWindowTools::selectAsCurrentItem(fractureDef); + newFractures.push_back(fractureDef); } + return newFractures; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked) +{ + std::vector newFractures = createNewTemplates(); + selectFractureTemplateAndUpdate(newFractures.back()); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.h b/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.h index 271af8184d..bd17b5075b 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.h +++ b/ApplicationCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.h @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017- Statoil ASA +// Copyright (C) 2017-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -22,6 +23,9 @@ #include +class RimFracture; +class RimFractureTemplate; +class RimStimPlanFractureTemplate; //================================================================================================== /// @@ -29,8 +33,11 @@ class RicNewStimPlanFractureTemplateFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; -protected: + static void createNewTemplateForFractureAndUpdate(RimFracture* fracture); + static void selectFractureTemplateAndUpdate(RimFractureTemplate* fractureTemplate); +protected: + static std::vector createNewTemplates(); void onActionTriggered(bool isChecked) override; void setupActionLook(QAction* actionToSetup) override; bool isCommandEnabled() override; diff --git a/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp index a6ba134f83..0ab1bd7429 100644 --- a/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2016- Statoil ASA +// Copyright (C) 2016-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -26,7 +27,6 @@ #include "RimCase.h" #include "RimEclipseView.h" -#include "RimEllipseFractureTemplate.h" #include "RimFractureTemplateCollection.h" #include "RimOilField.h" #include "RimProject.h" @@ -90,7 +90,10 @@ void RicNewWellPathFractureFeature::addFracture(RimWellPath* wellPath, double me fracture->setFractureUnit(unitSet); RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection()->firstFractureOfUnit(unitSet); - fracture->setFractureTemplate(fracDef); + if (fracDef) + { + fracture->setFractureTemplate(fracDef); + } wellPath->updateConnectedEditors(); Riu3DMainWindowTools::selectAsCurrentItem(fracture); @@ -108,9 +111,6 @@ void RicNewWellPathFractureFeature::addFracture(RimWellPath* wellPath, double me //-------------------------------------------------------------------------------------------------- void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked) { - RimProject* proj = RiaApplication::instance()->project(); - if (proj->allFractureTemplates().empty()) return; - RimWellPathFractureCollection* fractureColl = RicNewWellPathFractureFeature::selectedWellPathFractureCollection(); if (!fractureColl) return; @@ -135,9 +135,6 @@ void RicNewWellPathFractureFeature::setupActionLook(QAction* actionToSetup) //-------------------------------------------------------------------------------------------------- bool RicNewWellPathFractureFeature::isCommandEnabled() { - RimProject* proj = RiaApplication::instance()->project(); - if (proj->allFractureTemplates().empty()) return false; - if (selectedWellPathFractureCollection()) { return true; diff --git a/ApplicationCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp index 01fc8eb8ea..a08619812a 100644 --- a/ApplicationCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp @@ -78,7 +78,7 @@ void RicPasteEllipseFractureFeature::onActionTriggered(bool isChecked) fractureTemplateColl->addFractureTemplate(templ); - RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(fractureTemplateColl, templ); + RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(templ); } return; diff --git a/ApplicationCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp b/ApplicationCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp index 289e6719cb..1ad8443e1a 100644 --- a/ApplicationCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp +++ b/ApplicationCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp @@ -78,7 +78,7 @@ void RicPasteStimPlanFractureFeature::onActionTriggered(bool isChecked) fractureTemplateColl->addFractureTemplate(copyOfStimPlanTemplate); - RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(fractureTemplateColl, copyOfStimPlanTemplate); + RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate(copyOfStimPlanTemplate); } return; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp index ed17ac3f12..171c0bb75f 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017 Statoil ASA +// Copyright (C) 2017-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -24,6 +25,8 @@ #include "RiaEclipseUnitTools.h" #include "RiaLogging.h" +#include "Riu3DMainWindowTools.h" + #include "RigMainGrid.h" #include "Rim3dView.h" @@ -43,9 +46,14 @@ #include "RivWellFracturePartMgr.h" +#include "FractureCommands/RicNewEllipseFractureTemplateFeature.h" +#include "FractureCommands/RicNewStimPlanFractureTemplateFeature.h" + #include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h" #include "cafPdmUiDoubleSliderEditor.h" +#include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiToolButtonEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cvfBoundingBox.h" @@ -94,6 +102,17 @@ RimFracture::RimFracture() CAF_PDM_InitObject("Fracture", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_fractureTemplate, "FractureDef", "Fracture Template", "", "", ""); + CAF_PDM_InitField(&m_editFractureTemplate, "EditTemplate", false, "Edit", "", "", ""); + m_editFractureTemplate.uiCapability()->setUiEditorTypeName(caf::PdmUiToolButtonEditor::uiEditorTypeName()); + m_editFractureTemplate.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + + CAF_PDM_InitField(&m_createEllipseFractureTemplate, "CreateEllipseTemplate", false, "No Fracture Templates Found.", "", "", ""); + m_createEllipseFractureTemplate.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_createEllipseFractureTemplate.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); + + CAF_PDM_InitField(&m_createStimPlanFractureTemplate, "CreateStimPlanTemplate", false, "Create New Template?", "", "", ""); + m_createStimPlanFractureTemplate.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_createStimPlanFractureTemplate.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); CAF_PDM_InitFieldNoDefault(&m_anchorPosition, "AnchorPosition", "Anchor Position", "", "", ""); m_anchorPosition.uiCapability()->setUiHidden(true); @@ -210,7 +229,23 @@ void RimFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons setFractureTemplate(m_fractureTemplate); setDefaultFractureColorResult(); } - + else if (changedField == &m_editFractureTemplate) + { + m_editFractureTemplate = false; + if (m_fractureTemplate != nullptr) + { + Riu3DMainWindowTools::selectAsCurrentItem(m_fractureTemplate()); + } + } + else if (changedField == &m_createEllipseFractureTemplate) + { + m_createEllipseFractureTemplate = false; + RicNewEllipseFractureTemplateFeature::createNewTemplateForFractureAndUpdate(this); + } + else if (changedField == &m_createStimPlanFractureTemplate) + { + RicNewStimPlanFractureTemplateFeature::createNewTemplateForFractureAndUpdate(this); + } if ( changedField == &m_azimuth || changedField == &m_fractureTemplate || changedField == &m_stimPlanTimeIndexToPlot @@ -690,6 +725,18 @@ void RimFracture::defineEditorAttribute(const caf::PdmFieldHandle* field, myAttr->m_maximum = 1.0; } } + + if (field == &m_createEllipseFractureTemplate) + { + auto myAttr = dynamic_cast(attribute); + myAttr->m_buttonText = "Ellipse Template"; + } + + if (field == &m_createStimPlanFractureTemplate) + { + auto myAttr = dynamic_cast(attribute); + myAttr->m_buttonText = "StimPlan Template"; + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFracture.h b/ApplicationCode/ProjectDataModel/Completions/RimFracture.h index 72568c69c4..044a5a381b 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFracture.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFracture.h @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017 Statoil ASA +// Copyright (C) 2017-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -154,6 +155,9 @@ private: protected: caf::PdmPtrField m_fractureTemplate; + caf::PdmField m_editFractureTemplate; + caf::PdmField m_createEllipseFractureTemplate; + caf::PdmField m_createStimPlanFractureTemplate; caf::PdmProxyValueField m_uiAnchorPosition; caf::PdmField< RiaEclipseUnitTools::UnitSystemType > m_fractureUnit; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.cpp index 23446e484b..0b829943e9 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.cpp @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2016- Statoil ASA +// Copyright (C) 2016-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -79,7 +80,7 @@ void RimWellPathFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFie RimProject* proj = nullptr; this->firstAncestorOrThisOfType(proj); if (proj) proj->reloadCompletionTypeResultsInAllViews(); - } + } } //-------------------------------------------------------------------------------------------------- @@ -215,8 +216,29 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder { RimFracture::defineUiOrdering(uiConfigName, uiOrdering); - uiOrdering.add(nameField()); - uiOrdering.add(&m_fractureTemplate); + if (m_fractureTemplate()) + { + uiOrdering.add(nameField(), caf::PdmUiOrdering::LayoutOptions(true, 3, 1)); + uiOrdering.add(&m_fractureTemplate, {true, 2, 1}); + uiOrdering.add(&m_editFractureTemplate, false); + } + else + { + uiOrdering.add(nameField()); + { + RimProject* project = nullptr; + this->firstAncestorOrThisOfTypeAsserted(project); + if (project->allFractureTemplates().empty()) + { + uiOrdering.add(&m_createEllipseFractureTemplate); + uiOrdering.add(&m_createStimPlanFractureTemplate, false); + } + else + { + uiOrdering.add(&m_fractureTemplate); + } + } + } caf::PdmUiGroup* locationGroup = uiOrdering.addNewGroup("Location / Orientation"); locationGroup->add(&m_measuredDepth); @@ -236,6 +258,8 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder caf::PdmUiGroup* fractureCenterGroup = uiOrdering.addNewGroup("Fracture Center Info"); fractureCenterGroup->add(&m_uiAnchorPosition); + + uiOrdering.skipRemainingFields(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.h b/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.h index 707ddea581..fe5851f8b9 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathFracture.h @@ -1,6 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2016- Statoil ASA +// Copyright (C) 2016-2018 Statoil ASA +// Copyright (C) 2018- Equinor 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 @@ -60,4 +61,5 @@ private: private: caf::PdmField m_measuredDepth; + };