(#385) Implemented feature RicRangeFilterInsertFeature

Did some refactoring, using common code for creation of cell range
filters.
This commit is contained in:
Pål Hagen
2015-08-20 18:15:58 +02:00
parent 2e1a542749
commit d4a97d8e68
10 changed files with 327 additions and 84 deletions

View File

@@ -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;
}