diff --git a/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp b/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp index 53fc62c386..3d447e0ca0 100644 --- a/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp +++ b/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp @@ -18,11 +18,14 @@ #include "RicDeleteSubItemsFeature.h" -#include #include "RimSummaryPlotCollection.h" +#include "RimWellPathCollection.h" + +#include "cafAssert.h" #include "cafPdmUiItem.h" #include "cafSelectionManager.h" -#include "cafAssert.h" + +#include CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature"); @@ -68,6 +71,15 @@ void RicDeleteSubItemsFeature::onActionTriggered(bool isChecked) summaryPlotColl->updateConnectedEditors(); } + + RimWellPathCollection* wellPathColl = dynamic_cast(item); + if (wellPathColl) + { + wellPathColl->deleteAllWellPaths(); + + wellPathColl->updateConnectedEditors(); + wellPathColl->scheduleGeometryRegenAndRedrawViews(); + } } } @@ -91,6 +103,11 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems(caf::PdmUiItem* uiItem) return true; } + RimWellPathCollection* wellPathColl = dynamic_cast(uiItem); + if (wellPathColl && wellPathColl->wellPaths().size() > 0) + { + return true; + } return false; } diff --git a/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake index 0deea938f8..b249623bc5 100644 --- a/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/WellPathCommands/CMakeLists_files.cmake @@ -6,7 +6,6 @@ endif() set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h -${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h @@ -14,7 +13,6 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h set (SOURCE_GROUP_SOURCE_FILES ${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp -${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathsDeleteAllFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathsDeleteAllFeature.cpp deleted file mode 100644 index 0d22d4a594..0000000000 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathsDeleteAllFeature.cpp +++ /dev/null @@ -1,75 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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 "RicWellPathsDeleteAllFeature.h" - -#include "RimWellPathCollection.h" - -#include "cafSelectionManager.h" - -#include - -namespace caf -{ - -CAF_CMD_SOURCE_INIT(RicWellPathsDeleteAllFeature, "RicWellPathsDeleteAllFeature"); - - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicWellPathsDeleteAllFeature::isCommandEnabled() -{ - std::vector objects; - caf::SelectionManager::instance()->objectsByType(&objects); - - if (objects.size() == 1) - { - return true; - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicWellPathsDeleteAllFeature::onActionTriggered(bool isChecked) -{ - std::vector objects; - caf::SelectionManager::instance()->objectsByType(&objects); - - RimWellPathCollection* wellPathCollection = objects[0]; - - wellPathCollection->deleteAllWellPaths(); - - wellPathCollection->uiCapability()->updateConnectedEditors(); - wellPathCollection->scheduleGeometryRegenAndRedrawViews(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicWellPathsDeleteAllFeature::setupActionLook(QAction* actionToSetup) -{ - actionToSetup->setText("Delete All Well Paths"); - actionToSetup->setIcon(QIcon(":/Erase.png")); -} - -} // end namespace caf diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathsDeleteAllFeature.h b/ApplicationCode/Commands/WellPathCommands/RicWellPathsDeleteAllFeature.h deleted file mode 100644 index 3c316ce976..0000000000 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathsDeleteAllFeature.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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" - -namespace caf -{ - -//================================================================================================== -/// -//================================================================================================== -class RicWellPathsDeleteAllFeature : public CmdFeature -{ - CAF_CMD_HEADER_INIT; -protected: - - // Overrides - virtual bool isCommandEnabled(); - virtual void onActionTriggered( bool isChecked ); - virtual void setupActionLook( QAction* actionToSetup ); -}; - - - -} // end namespace caf diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index 5d2ec7c54b..9f2397ecb5 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -205,8 +205,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection() commandIds << "RicWellPathsImportFileFeature"; commandIds << "RicWellPathsImportSsihubFeature"; commandIds << "RicWellLogsImportFileFeature"; - commandIds << "Separator"; - commandIds << "RicWellPathsDeleteAllFeature"; } else if (dynamic_cast(uiItem)) {