#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

View File

@ -361,11 +361,13 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
commandIds << "RicNewSimWellFractureFeature";
commandIds << "RicNewWellPathCollFractureFeature";
commandIds << "RicFracturesDeleteAllFeature";
}
else if (dynamic_cast<RimFractureDefinitionCollection*>(uiItem) ||
dynamic_cast<RimFractureDefinition*>(uiItem))
{
commandIds << "RicNewFractureDefinitionFeature";
commandIds << "RicFractureDefinitionsDeleteAllFeature";
}

View File

@ -47,3 +47,11 @@ RimFractureCollection::~RimFractureCollection()
fractures.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureCollection::deleteFractures()
{
fractures.deleteAllChildObjects();
}

View File

@ -39,4 +39,6 @@ public:
caf::PdmChildArrayField<RimFracture*> fractures;
caf::PdmField<bool> isActive;
void deleteFractures();
};

View File

@ -45,6 +45,13 @@ RimFractureDefinitionCollection::RimFractureDefinitionCollection(void)
RimFractureDefinitionCollection::~RimFractureDefinitionCollection()
{
fractureDefinitions.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFractureDefinitionCollection::deleteFractureDefinitions()
{
fractureDefinitions.deleteAllChildObjects();
}

View File

@ -37,6 +37,9 @@ public:
virtual ~RimFractureDefinitionCollection(void);
caf::PdmChildArrayField<RimFractureDefinition*> fractureDefinitions;
caf::PdmField<bool> isActive;
void deleteFractureDefinitions();
};