mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1306 Use general delete sub items for well path collection
This commit is contained in:
parent
d547079847
commit
84f76e5242
@ -18,11 +18,14 @@
|
|||||||
|
|
||||||
#include "RicDeleteSubItemsFeature.h"
|
#include "RicDeleteSubItemsFeature.h"
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include "RimSummaryPlotCollection.h"
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RimWellPathCollection.h"
|
||||||
|
|
||||||
|
#include "cafAssert.h"
|
||||||
#include "cafPdmUiItem.h"
|
#include "cafPdmUiItem.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
#include "cafAssert.h"
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature");
|
CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature");
|
||||||
@ -68,6 +71,15 @@ void RicDeleteSubItemsFeature::onActionTriggered(bool isChecked)
|
|||||||
|
|
||||||
summaryPlotColl->updateConnectedEditors();
|
summaryPlotColl->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(item);
|
||||||
|
if (wellPathColl)
|
||||||
|
{
|
||||||
|
wellPathColl->deleteAllWellPaths();
|
||||||
|
|
||||||
|
wellPathColl->updateConnectedEditors();
|
||||||
|
wellPathColl->scheduleGeometryRegenAndRedrawViews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +103,11 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems(caf::PdmUiItem* uiItem)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(uiItem);
|
||||||
|
if (wellPathColl && wellPathColl->wellPaths().size() > 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ endif()
|
|||||||
|
|
||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h
|
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.h
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
|
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
|
||||||
@ -14,7 +13,6 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
|
|||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.cpp
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp
|
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp
|
||||||
|
@ -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 <http://www.gnu.org/licenses/gpl.html>
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "RicWellPathsDeleteAllFeature.h"
|
|
||||||
|
|
||||||
#include "RimWellPathCollection.h"
|
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
|
|
||||||
namespace caf
|
|
||||||
{
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicWellPathsDeleteAllFeature, "RicWellPathsDeleteAllFeature");
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RicWellPathsDeleteAllFeature::isCommandEnabled()
|
|
||||||
{
|
|
||||||
std::vector<RimWellPathCollection*> objects;
|
|
||||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
|
||||||
|
|
||||||
if (objects.size() == 1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicWellPathsDeleteAllFeature::onActionTriggered(bool isChecked)
|
|
||||||
{
|
|
||||||
std::vector<RimWellPathCollection*> 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
|
|
@ -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 <http://www.gnu.org/licenses/gpl.html>
|
|
||||||
// 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
|
|
@ -205,8 +205,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicWellPathsImportFileFeature";
|
commandIds << "RicWellPathsImportFileFeature";
|
||||||
commandIds << "RicWellPathsImportSsihubFeature";
|
commandIds << "RicWellPathsImportSsihubFeature";
|
||||||
commandIds << "RicWellLogsImportFileFeature";
|
commandIds << "RicWellLogsImportFileFeature";
|
||||||
commandIds << "Separator";
|
|
||||||
commandIds << "RicWellPathsDeleteAllFeature";
|
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user