2015-08-06 04:00:21 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2015-08-06 07:01:23 -05:00
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2015-08-06 04:00:21 -05:00
|
|
|
//
|
2015-08-06 07:01:23 -05:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
2015-08-06 04:00:21 -05:00
|
|
|
// 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.
|
|
|
|
//
|
2015-08-06 07:01:23 -05:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
2015-08-06 04:00:21 -05:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-08-06 07:01:23 -05:00
|
|
|
#include "RicRangeFilterNewSliceI.h"
|
2015-08-06 13:54:29 -05:00
|
|
|
#include "RicRangeFilterNewExec.h"
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-06 07:01:23 -05:00
|
|
|
#include "RimCellRangeFilter.h"
|
|
|
|
#include "RimCellRangeFilterCollection.h"
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-06 13:54:29 -05:00
|
|
|
#include "cafCmdExecCommandManager.h"
|
2015-08-06 04:00:21 -05:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2015-08-06 07:01:23 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicRangeFilterNewSliceI, "RicRangeFilterNewSliceI");
|
2015-08-06 04:00:21 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-06 07:01:23 -05:00
|
|
|
bool RicRangeFilterNewSliceI::isCommandEnabled()
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-06 07:01:23 -05:00
|
|
|
std::vector<RimCellRangeFilter*> selectedRangeFilter;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilter);
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-06 07:01:23 -05:00
|
|
|
std::vector<RimCellRangeFilterCollection*> selectedRangeFilterCollection;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilterCollection);
|
|
|
|
|
|
|
|
if (selectedRangeFilter.size() > 0 || selectedRangeFilterCollection.size() > 0)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-06 07:01:23 -05:00
|
|
|
void RicRangeFilterNewSliceI::onActionTriggered(bool isChecked)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-06 13:54:29 -05:00
|
|
|
std::vector<RimCellRangeFilterCollection*> selectedRangeFilterCollection;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilterCollection);
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-06 13:54:29 -05:00
|
|
|
if (selectedRangeFilterCollection.size() == 1)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-06 13:54:29 -05:00
|
|
|
RimCellRangeFilterCollection* rangeFilterCollection = selectedRangeFilterCollection[0];
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-07 02:13:22 -05:00
|
|
|
RicRangeFilterNewExec* filterExec = new RicRangeFilterNewExec(rangeFilterCollection);
|
2015-08-06 13:54:29 -05:00
|
|
|
filterExec->m_iSlice = true;
|
2015-08-06 04:00:21 -05:00
|
|
|
|
2015-08-06 13:54:29 -05:00
|
|
|
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
|
2015-08-06 04:00:21 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-06 07:01:23 -05:00
|
|
|
void RicRangeFilterNewSliceI::setupActionLook(QAction* actionToSetup)
|
2015-08-06 04:00:21 -05:00
|
|
|
{
|
2015-08-06 07:01:23 -05:00
|
|
|
actionToSetup->setText("New I-slice range filter");
|
2015-08-06 04:00:21 -05:00
|
|
|
}
|
|
|
|
|