mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#385) Implemented feature RicRangeFilterInsertFeature
Did some refactoring, using common code for creation of cell range filters.
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "RicRangeFilterInsertFeature.h"
|
||||
|
||||
#include "RicRangeFilterInsertExec.h"
|
||||
#include "RicRangeFilterFeatureImpl.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -35,17 +38,8 @@ CAF_CMD_SOURCE_INIT(RicRangeFilterInsertFeature, "RicRangeFilterInsertFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRangeFilterInsertFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCellRangeFilter*> selectedRangeFilter;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilter);
|
||||
|
||||
if (selectedRangeFilter.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::vector<RimCellRangeFilter*> selection = selectedCellRangeFilters();
|
||||
return selection.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -53,6 +47,11 @@ bool RicRangeFilterInsertFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterInsertFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimCellRangeFilter*> selection = selectedCellRangeFilters();
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = RicRangeFilterFeatureImpl::findRangeFilterCollection();
|
||||
|
||||
RicRangeFilterInsertExec* filterExec = new RicRangeFilterInsertExec(rangeFilterCollection, selection[0]);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -63,3 +62,14 @@ void RicRangeFilterInsertFeature::setupActionLook(QAction* actionToSetup)
|
||||
actionToSetup->setText("Insert Range Filter");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCellRangeFilter*> RicRangeFilterInsertFeature::selectedCellRangeFilters()
|
||||
{
|
||||
std::vector<RimCellRangeFilter*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user