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:
90
ApplicationCode/Commands/RicRangeFilterExecImpl.cpp
Normal file
90
ApplicationCode/Commands/RicRangeFilterExecImpl.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicRangeFilterExecImpl.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterExecImpl::RicRangeFilterExecImpl(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter)
|
||||
: CmdExecuteCommand(NULL)
|
||||
{
|
||||
CVF_ASSERT(rangeFilterCollection);
|
||||
m_cellRangeFilterCollection = rangeFilterCollection;
|
||||
|
||||
m_cellRangeFilter = rangeFilter;
|
||||
|
||||
m_iSlice = false;
|
||||
m_jSlice = false;
|
||||
m_kSlice = false;
|
||||
|
||||
m_iSliceStart = -1;
|
||||
m_jSliceStart = -1;
|
||||
m_kSliceStart = -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterExecImpl::~RicRangeFilterExecImpl()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellRangeFilter* RicRangeFilterExecImpl::createRangeFilter()
|
||||
{
|
||||
CVF_ASSERT(m_cellRangeFilterCollection);
|
||||
|
||||
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter();
|
||||
|
||||
size_t flterIndex = m_cellRangeFilterCollection->rangeFilters().size() + 1;
|
||||
|
||||
rangeFilter->name = QString("Range Filter (%1)").arg(flterIndex);
|
||||
|
||||
if (m_iSlice)
|
||||
{
|
||||
rangeFilter->cellCountI = 1;
|
||||
rangeFilter->name = QString("Slice I (%1)").arg(flterIndex);
|
||||
}
|
||||
|
||||
if (m_jSlice)
|
||||
{
|
||||
rangeFilter->cellCountJ = 1;
|
||||
rangeFilter->name = QString("Slice J (%1)").arg(flterIndex);
|
||||
}
|
||||
|
||||
if (m_kSlice)
|
||||
{
|
||||
rangeFilter->cellCountK = 1;
|
||||
rangeFilter->name = QString("Slice K (%1)").arg(flterIndex);
|
||||
}
|
||||
|
||||
if (m_iSliceStart > -1) rangeFilter->startIndexI = m_iSliceStart;
|
||||
if (m_jSliceStart > -1) rangeFilter->startIndexJ = m_jSliceStart;
|
||||
if (m_kSliceStart > -1) rangeFilter->startIndexK = m_kSliceStart;
|
||||
|
||||
return rangeFilter;
|
||||
}
|
||||
Reference in New Issue
Block a user