mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1728 Can close all summary cases within one collection
This commit is contained in:
parent
e1ab73da30
commit
a4aa06b75c
@ -7,6 +7,7 @@ endif()
|
|||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseCollectionFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.h
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
|
||||||
@ -70,6 +71,7 @@ endif()
|
|||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseCollectionFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
|
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017- Statoil ASA
|
||||||
|
//
|
||||||
|
// 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 "RicCloseSummaryCaseCollectionFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RicCloseSummaryCaseFeature.h"
|
||||||
|
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicCloseSummaryCaseCollectionFeature, "RicCloseSummaryCaseCollectionFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicCloseSummaryCaseCollectionFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("Close Sub Items");
|
||||||
|
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicCloseSummaryCaseCollectionFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCaseCollection*> summaryCaseCollections;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&summaryCaseCollections);
|
||||||
|
return (summaryCaseCollections.size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicCloseSummaryCaseCollectionFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCaseCollection*> summaryCaseCollections;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&summaryCaseCollections);
|
||||||
|
|
||||||
|
for (RimSummaryCaseCollection* summaryCaseCollection : summaryCaseCollections)
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> summaryCasesFromCollection;
|
||||||
|
|
||||||
|
for (int i = 0; i < summaryCaseCollection->summaryCaseCount(); i++)
|
||||||
|
{
|
||||||
|
summaryCasesFromCollection.push_back(summaryCaseCollection->summaryCase(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
RicCloseSummaryCaseFeature::deleteSummaryCases(summaryCasesFromCollection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017- Statoil ASA
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicCloseSummaryCaseCollectionFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled() override;
|
||||||
|
virtual void onActionTriggered(bool isChecked) override;
|
||||||
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
};
|
@ -34,6 +34,7 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicCloseSummaryCaseFeature, "RicCloseSummaryCaseFeature");
|
CAF_CMD_SOURCE_INIT(RicCloseSummaryCaseFeature, "RicCloseSummaryCaseFeature");
|
||||||
|
|
||||||
|
|
||||||
@ -49,22 +50,8 @@ void RicCloseSummaryCaseFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicCloseSummaryCaseFeature::isCommandEnabled()
|
void RicCloseSummaryCaseFeature::deleteSummaryCases(const std::vector<RimSummaryCase*>& cases)
|
||||||
{
|
{
|
||||||
std::vector<RimSummaryCase*> selection;
|
|
||||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
|
||||||
return (selection.size() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicCloseSummaryCaseFeature::onActionTriggered(bool isChecked)
|
|
||||||
{
|
|
||||||
std::vector<RimSummaryCase*> selection;
|
|
||||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
|
||||||
CVF_ASSERT(selection.size() > 0);
|
|
||||||
|
|
||||||
RimProject* project = RiaApplication::instance()->project();
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
CVF_ASSERT(project);
|
CVF_ASSERT(project);
|
||||||
|
|
||||||
@ -74,7 +61,7 @@ void RicCloseSummaryCaseFeature::onActionTriggered(bool isChecked)
|
|||||||
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||||
CVF_ASSERT(summaryPlotColl);
|
CVF_ASSERT(summaryPlotColl);
|
||||||
|
|
||||||
for (RimSummaryCase* summaryCase : selection)
|
for (RimSummaryCase* summaryCase : cases)
|
||||||
{
|
{
|
||||||
for (RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots)
|
for (RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots)
|
||||||
{
|
{
|
||||||
@ -90,3 +77,26 @@ void RicCloseSummaryCaseFeature::onActionTriggered(bool isChecked)
|
|||||||
summaryCaseCollection->updateConnectedEditors();
|
summaryCaseCollection->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicCloseSummaryCaseFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||||
|
|
||||||
|
return (selection.size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicCloseSummaryCaseFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCase*> selection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||||
|
CVF_ASSERT(selection.size() > 0);
|
||||||
|
|
||||||
|
RicCloseSummaryCaseFeature::deleteSummaryCases(selection);
|
||||||
|
}
|
||||||
|
@ -32,13 +32,11 @@ class RicCloseSummaryCaseFeature : public caf::CmdFeature
|
|||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
public:
|
public:
|
||||||
|
static void deleteSummaryCases(const std::vector<RimSummaryCase*>& cases);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual bool isCommandEnabled() override;
|
virtual bool isCommandEnabled() override;
|
||||||
virtual void onActionTriggered(bool isChecked) override;
|
virtual void onActionTriggered(bool isChecked) override;
|
||||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
|
||||||
private:
|
|
||||||
RimSummaryCase* selectedSummaryCase() const;
|
|
||||||
};
|
};
|
||||||
|
@ -444,6 +444,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicFlyToObjectFeature";
|
commandIds << "RicFlyToObjectFeature";
|
||||||
commandIds << "RicExportCarfin";
|
commandIds << "RicExportCarfin";
|
||||||
commandIds << "RicCloseSummaryCaseFeature";
|
commandIds << "RicCloseSummaryCaseFeature";
|
||||||
|
commandIds << "RicCloseSummaryCaseCollectionFeature";
|
||||||
|
|
||||||
|
|
||||||
// Fracture commands
|
// Fracture commands
|
||||||
|
Loading…
Reference in New Issue
Block a user