2015-08-06 09:01:56 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2014 Ceetron Solutions AS, USFOS AS, AMOS - NTNU
|
|
|
|
//
|
|
|
|
// RPM 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.
|
|
|
|
//
|
|
|
|
// RPM 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 "RicRangeFilterNewExec.h"
|
|
|
|
|
|
|
|
#include "RimCellRangeFilter.h"
|
|
|
|
#include "RimCellRangeFilterCollection.h"
|
2015-08-06 09:17:23 -05:00
|
|
|
#include "RimView.h"
|
2015-08-13 16:47:04 -05:00
|
|
|
#include "RiuMainWindow.h"
|
2015-08-06 09:01:56 -05:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-07 02:13:22 -05:00
|
|
|
RicRangeFilterNewExec::RicRangeFilterNewExec(RimCellRangeFilterCollection* rangeFilterCollection)
|
|
|
|
: CmdExecuteCommand(NULL)
|
2015-08-06 09:01:56 -05:00
|
|
|
{
|
2015-08-06 13:54:29 -05:00
|
|
|
m_iSlice = false;
|
|
|
|
m_jSlice = false;
|
|
|
|
m_kSlice = false;
|
|
|
|
|
|
|
|
m_iSliceStart = -1;
|
|
|
|
m_jSliceStart = -1;
|
|
|
|
m_kSliceStart = -1;
|
2015-08-07 02:13:22 -05:00
|
|
|
|
|
|
|
cellRangeFilterCollection = rangeFilterCollection;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RicRangeFilterNewExec::~RicRangeFilterNewExec()
|
|
|
|
{
|
|
|
|
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RicRangeFilterNewExec::name()
|
|
|
|
{
|
2015-08-06 13:54:29 -05:00
|
|
|
if (m_iSlice)
|
2015-08-07 01:37:29 -05:00
|
|
|
return "Create I Slice Filter";
|
2015-08-06 13:54:29 -05:00
|
|
|
else if (m_jSlice)
|
2015-08-07 01:37:29 -05:00
|
|
|
return "Create J Slice Filter";
|
2015-08-06 13:54:29 -05:00
|
|
|
else if (m_kSlice)
|
2015-08-07 01:37:29 -05:00
|
|
|
return "Create K Slice Filter";
|
2015-08-06 13:54:29 -05:00
|
|
|
|
2015-08-07 01:37:29 -05:00
|
|
|
return "Create Range Filter";
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicRangeFilterNewExec::redo()
|
|
|
|
{
|
|
|
|
assert(cellRangeFilterCollection);
|
|
|
|
|
2015-08-07 01:37:29 -05:00
|
|
|
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter();
|
2015-08-11 13:59:05 -05:00
|
|
|
cellRangeFilterCollection->rangeFilters.push_back(rangeFilter);
|
2015-08-07 01:37:29 -05:00
|
|
|
rangeFilter->setDefaultValues();
|
|
|
|
|
|
|
|
rangeFilter->name = QString("Range Filter (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
|
|
|
|
2015-08-06 09:17:23 -05:00
|
|
|
if (m_iSlice)
|
2015-08-06 09:01:56 -05:00
|
|
|
{
|
2015-08-07 01:37:29 -05:00
|
|
|
rangeFilter->cellCountI = 1;
|
|
|
|
rangeFilter->name = QString("I Slice Filter (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|
|
|
|
|
2015-08-06 09:17:23 -05:00
|
|
|
if (m_jSlice)
|
2015-08-06 09:01:56 -05:00
|
|
|
{
|
2015-08-07 01:37:29 -05:00
|
|
|
rangeFilter->cellCountJ = 1;
|
|
|
|
rangeFilter->name = QString("J Slice Filter (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|
|
|
|
|
2015-08-06 09:17:23 -05:00
|
|
|
if (m_kSlice)
|
2015-08-06 09:01:56 -05:00
|
|
|
{
|
2015-08-07 01:37:29 -05:00
|
|
|
rangeFilter->cellCountK = 1;
|
|
|
|
rangeFilter->name = QString("K Slice Filter (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|
|
|
|
|
2015-08-07 01:37:29 -05:00
|
|
|
if (m_iSliceStart > -1) rangeFilter->startIndexI = m_iSliceStart;
|
|
|
|
if (m_jSliceStart > -1) rangeFilter->startIndexJ = m_jSliceStart;
|
|
|
|
if (m_kSliceStart > -1) rangeFilter->startIndexK = m_kSliceStart;
|
|
|
|
|
2015-08-06 09:17:23 -05:00
|
|
|
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
|
|
|
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
|
|
|
|
2015-08-10 16:23:41 -05:00
|
|
|
cellRangeFilterCollection->updateConnectedEditors();
|
2015-08-13 16:47:04 -05:00
|
|
|
|
|
|
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(rangeFilter);
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicRangeFilterNewExec::undo()
|
|
|
|
{
|
|
|
|
assert(cellRangeFilterCollection);
|
|
|
|
|
|
|
|
cellRangeFilterCollection->rangeFilters.erase(cellRangeFilterCollection->rangeFilters.size() - 1);
|
|
|
|
|
2015-08-12 04:10:10 -05:00
|
|
|
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
|
|
|
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
|
|
|
|
2015-08-10 16:23:41 -05:00
|
|
|
cellRangeFilterCollection->updateConnectedEditors();
|
2015-08-06 09:01:56 -05:00
|
|
|
}
|