mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1037 - pre-proto - Added commands for Delete All for Fractures and Fracture Definitions
This commit is contained in:
parent
a1c55863e0
commit
b0968a2534
@ -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
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
@ -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
|
78
ApplicationCode/Commands/RicFracturesDeleteAllFeature.cpp
Normal file
78
ApplicationCode/Commands/RicFracturesDeleteAllFeature.cpp
Normal 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
|
43
ApplicationCode/Commands/RicFracturesDeleteAllFeature.h
Normal file
43
ApplicationCode/Commands/RicFracturesDeleteAllFeature.h
Normal 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
|
@ -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";
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,3 +47,11 @@ RimFractureCollection::~RimFractureCollection()
|
||||
fractures.deleteAllChildObjects();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureCollection::deleteFractures()
|
||||
{
|
||||
fractures.deleteAllChildObjects();
|
||||
}
|
||||
|
@ -39,4 +39,6 @@ public:
|
||||
caf::PdmChildArrayField<RimFracture*> fractures;
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
void deleteFractures();
|
||||
|
||||
};
|
||||
|
@ -45,6 +45,13 @@ RimFractureDefinitionCollection::RimFractureDefinitionCollection(void)
|
||||
RimFractureDefinitionCollection::~RimFractureDefinitionCollection()
|
||||
{
|
||||
fractureDefinitions.deleteAllChildObjects();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureDefinitionCollection::deleteFractureDefinitions()
|
||||
{
|
||||
fractureDefinitions.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,9 @@ public:
|
||||
virtual ~RimFractureDefinitionCollection(void);
|
||||
|
||||
caf::PdmChildArrayField<RimFractureDefinition*> fractureDefinitions;
|
||||
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
void deleteFractureDefinitions();
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user