#1037 - pre-proto - Added commands for Delete All for Fractures and Fracture Definitions

This commit is contained in:
astridkbjorke
2017-01-02 10:12:43 +01:00
parent a1c55863e0
commit b0968a2534
10 changed files with 269 additions and 2 deletions

View File

@@ -40,9 +40,10 @@ ${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureAtPosFeature.h
${CEE_CURRENT_LIST_DIR}RicNewFractureDefinitionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureAtPosFeature.h
${CEE_CURRENT_LIST_DIR}RicFractureDefinitionsDeleteAllFeature.h
${CEE_CURRENT_LIST_DIR}RicFracturesDeleteAllFeature.h
# General delete of any object in a child array field
@@ -89,6 +90,8 @@ ${CEE_CURRENT_LIST_DIR}RicNewFractureDefinitionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellPathCollFractureAtPosFeature.cpp
${CEE_CURRENT_LIST_DIR}RicFractureDefinitionsDeleteAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicFracturesDeleteAllFeature.cpp

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicFractureDefinitionsDeleteAllFeature.h"
#include "RimFractureDefinitionCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicFractureDefinitionsDeleteAllFeature, "RicFractureDefinitionsDeleteAllFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicFractureDefinitionsDeleteAllFeature::isCommandEnabled()
{
std::vector<RimFractureDefinitionCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFractureDefinitionsDeleteAllFeature::onActionTriggered(bool isChecked)
{
std::vector<RimFractureDefinitionCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
RimFractureDefinitionCollection* fractureDefinitionCollection = nullptr;
if (objects.size() > 0)
{
fractureDefinitionCollection = objects[0];
}
fractureDefinitionCollection->deleteFractureDefinitions();
fractureDefinitionCollection->uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFractureDefinitionsDeleteAllFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete All Fracture Definitions");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
} // end namespace caf

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicFractureDefinitionsDeleteAllFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
} // end namespace caf

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicFracturesDeleteAllFeature.h"
#include "RimFractureCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicFracturesDeleteAllFeature, "RicFracturesDeleteAllFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicFracturesDeleteAllFeature::isCommandEnabled()
{
std::vector<RimFractureCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFracturesDeleteAllFeature::onActionTriggered(bool isChecked)
{
std::vector<RimFractureCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
RimFractureCollection* fractureCollection = nullptr;
if (objects.size() > 0)
{
fractureCollection = objects[0];
}
fractureCollection->deleteFractures();
fractureCollection->uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFracturesDeleteAllFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete All Fractures");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
} // end namespace caf

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicFracturesDeleteAllFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
} // end namespace caf