diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake index b648bf757c..18f6eb1639 100644 --- a/ApplicationCode/Commands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CMakeLists_files.cmake @@ -44,6 +44,7 @@ ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h ${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.h +${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h @@ -94,6 +95,7 @@ ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.cpp +${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp diff --git a/ApplicationCode/Commands/RicNewWellLogPlotTraceFeature.cpp b/ApplicationCode/Commands/RicNewWellLogPlotTraceFeature.cpp new file mode 100644 index 0000000000..14bfc3503a --- /dev/null +++ b/ApplicationCode/Commands/RicNewWellLogPlotTraceFeature.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RicNewWellLogPlotTraceFeature.h" + +#include "RimWellLogPlot.h" + +#include "cafSelectionManager.h" + +#include + + +CAF_CMD_SOURCE_INIT(RicNewWellLogPlotTraceFeature, "RicNewWellLogPlotTraceFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewWellLogPlotTraceFeature::isCommandEnabled() +{ + return selectedWellLogPlot() != NULL; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellLogPlotTraceFeature::onActionTriggered(bool isChecked) +{ + RimWellLogPlot* wellLogPlot = selectedWellLogPlot(); + if (wellLogPlot) + { + wellLogPlot->addTrace(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewWellLogPlotTraceFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("New Trace"); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellLogPlot* RicNewWellLogPlotTraceFeature::selectedWellLogPlot() +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType(&selection); + return selection.size() > 0 ? selection[0] : NULL; +} diff --git a/ApplicationCode/Commands/RicNewWellLogPlotTraceFeature.h b/ApplicationCode/Commands/RicNewWellLogPlotTraceFeature.h new file mode 100644 index 0000000000..af49b4e20a --- /dev/null +++ b/ApplicationCode/Commands/RicNewWellLogPlotTraceFeature.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "cafCmdFeature.h" + +class RimWellLogPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicNewWellLogPlotTraceFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + virtual bool isCommandEnabled(); + virtual void onActionTriggered( bool isChecked ); + virtual void setupActionLook( QAction* actionToSetup ); + +private: + RimWellLogPlot* selectedWellLogPlot(); +}; diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 77506895e0..f4236d4c88 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -552,6 +552,7 @@ void RimProject::computeUtmAreaOfInterest() #include "RimGeoMechView.h" #include "RimEclipseCellColors.h" #include "RimEclipseFaultColors.h" +#include "RimWellLogPlot.h" #include @@ -722,6 +723,10 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu) { commandIds << "RicDeleteItemFeature"; } + else if (dynamic_cast(uiItem)) + { + commandIds << "RicNewWellLogPlotTraceFeature"; + } if (dynamic_cast(uiItem)) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 8e24fd9858..67a213d1d7 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -24,6 +24,9 @@ #include "RiuWellLogPlot.h" #include "RiuMainWindow.h" +#include "cafPdmUiTreeView.h" + + CAF_PDM_SOURCE_INIT(RimWellLogPlot, "WellLogPlot"); //-------------------------------------------------------------------------------------------------- @@ -92,3 +95,15 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField() { return &showWindow; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::addTrace() +{ + RimWellLogPlotTrace* trace = new RimWellLogPlotTrace(); + traces.push_back(trace); + + RiuMainWindow::instance()->projectTreeView()->setExpanded(this, true); + updateConnectedEditors(); +} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index 299b2bc43b..aecc1bebda 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -40,6 +40,8 @@ public: RimWellLogPlot(); virtual ~RimWellLogPlot(); + void addTrace(); + caf::PdmField showWindow; protected: