diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index b14e004b04..1e6035031c 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -37,6 +37,8 @@ ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h ${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h +${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.h + # General delete of any object in a child array field ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h @@ -76,6 +78,9 @@ ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.cpp +${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.cpp + + # General delete of any object in a child array field ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp diff --git a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp new file mode 100644 index 0000000000..f5562aac2e --- /dev/null +++ b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicNewSimWellFractureFeature.h" + +#include "RiaApplication.h" +// +// #include "RimMainPlotCollection.h" +// #include "RimOilField.h" +#include "RimProject.h" +#include "RimFractureCollection.h" +// #include "RimSummaryCaseCollection.h" +// #include "RimSummaryCurve.h" +// #include "RimSummaryPlot.h" +// #include "RimSummaryPlotCollection.h" +// +// #include "RiuMainPlotWindow.h" +// +// #include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" +// +#include "cafSelectionManager.h" + +#include "cvfAssert.h" + +#include +#include "RimOilField.h" +#include "RimFracture.h" + + +CAF_CMD_SOURCE_INIT(RicNewSimWellFractureFeature, "RicNewSimWellFractureFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked) +{ + + RimProject* project = RiaApplication::instance()->project(); + CVF_ASSERT(project); + + RimOilField* oilfield = project->activeOilField(); + if (oilfield == nullptr) return; + + RimFractureCollection* fracColl = oilfield->fractureCollection(); + + + if (fracColl) + { + RimFracture* fracture = new RimFracture(); + fracColl->fractures.push_back(fracture); + + fracture->name = "New Fracture"; + + + fracColl->updateConnectedEditors(); + + } + + + + + +// RimSummaryPlot* plot = selectedSummaryPlot(); +// if (plot) +// { +// RimSummaryCurve* newCurve = new RimSummaryCurve(); +// plot->addCurve(newCurve); +// +// cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(); +// newCurve->setColor(curveColor); +// +// RimSummaryCase* defaultCase = nullptr; +// if (project->activeOilField()->summaryCaseCollection()->summaryCaseCount() > 0) +// { +// defaultCase = project->activeOilField()->summaryCaseCollection()->summaryCase(0); +// newCurve->setSummaryCase(defaultCase); +// newCurve->setVariable("FOPT"); +// newCurve->loadDataAndUpdate(); +// } +// +// plot->updateConnectedEditors(); +// +// RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve); +// } + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSimWellFractureFeature::setupActionLook(QAction* actionToSetup) +{ +// actionToSetup->setIcon(QIcon(":/CrossSection16x16.png")); + actionToSetup->setText("New Fracture"); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewSimWellFractureFeature::isCommandEnabled() +{ + return true; +} diff --git a/ApplicationCode/Commands/RicNewSimWellFractureFeature.h b/ApplicationCode/Commands/RicNewSimWellFractureFeature.h new file mode 100644 index 0000000000..d939f7ddd4 --- /dev/null +++ b/ApplicationCode/Commands/RicNewSimWellFractureFeature.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 RimSummaryPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicNewSimWellFractureFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + + + +private: + +// RimSummaryPlot* selectedSummaryPlot() const; +}; diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 51e0f56e86..6d21291ce0 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -59,6 +59,8 @@ #include "RimWellPath.h" #include "RimWellPathCollection.h" +#include "RimFractureCollection.h" + #include "ToggleCommands/RicToggleItemsFeatureImpl.h" #include "cafPdmUiItem.h" @@ -351,6 +353,11 @@ QStringList RimContextCommandBuilder::commandsFromSelection() { commandIds << "RicExportFaultsFeature"; } + else if (dynamic_cast(uiItem)) + { + commandIds << "RicNewSimWellFractureFeature"; + } + if (dynamic_cast(uiItem)) diff --git a/ApplicationCode/ProjectDataModel/RimFracture.cpp b/ApplicationCode/ProjectDataModel/RimFracture.cpp index 5280e23889..b3cc535c0d 100644 --- a/ApplicationCode/ProjectDataModel/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimFracture.cpp @@ -53,8 +53,8 @@ RimFracture::RimFracture(void) CAF_PDM_InitFieldNoDefault(&wellpath, "WellPath", "Well path for measured deph", "", "", ""); CAF_PDM_InitField(&i, "I", 1, "Fracture location cell I", "", "", ""); - CAF_PDM_InitField(&i, "J", 1, "Fracture location cell J", "", "", ""); - CAF_PDM_InitField(&i, "K", 1, "Fracture location cell K", "", "", ""); + CAF_PDM_InitField(&j, "J", 1, "Fracture location cell J", "", "", ""); + CAF_PDM_InitField(&k, "K", 1, "Fracture location cell K", "", "", ""); CAF_PDM_InitFieldNoDefault(&fractureDefinition, "FractureDef", "FractureDef", "", "", ""); diff --git a/ApplicationCode/ProjectDataModel/RimFractureCollection.cpp b/ApplicationCode/ProjectDataModel/RimFractureCollection.cpp index f1e84ea626..716e300984 100644 --- a/ApplicationCode/ProjectDataModel/RimFractureCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimFractureCollection.cpp @@ -36,7 +36,7 @@ RimFractureCollection::RimFractureCollection(void) CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", ""); CAF_PDM_InitFieldNoDefault(&fractures, "Fractures", "", "", "", ""); - + fractures.uiCapability()->setUiHidden(true); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimProject.h b/ApplicationCode/ProjectDataModel/RimProject.h index b0b534c3df..4af4815c2c 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.h +++ b/ApplicationCode/ProjectDataModel/RimProject.h @@ -76,9 +76,6 @@ public: caf::PdmChildArrayField multiSnapshotDefinitions; - caf::PdmChildArrayField fractureDefinition; - caf::PdmChildArrayField fractureCollection; - caf::PdmField mainWindowTreeViewState; caf::PdmField mainWindowCurrentModelIndexPath;