mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2872 Fix creating range filter slices on LGR
This commit is contained in:
parent
d6d894f631
commit
83d3a033d8
@ -63,11 +63,13 @@ void RicNewSliceRangeFilterFeature::onActionTriggered(bool isChecked)
|
||||
RicRangeFilterNewExec* filterExec = new RicRangeFilterNewExec(rangeFilterCollection);
|
||||
|
||||
QVariantList list = userData.toList();
|
||||
CAF_ASSERT(list.size() == 2);
|
||||
CAF_ASSERT(list.size() == 3);
|
||||
|
||||
int direction = list[0].toInt();
|
||||
int sliceStart = list[1].toInt();
|
||||
int gridIndex = list[2].toInt();
|
||||
|
||||
filterExec->m_gridIndex = gridIndex;
|
||||
if (direction == 0)
|
||||
{
|
||||
filterExec->m_iSlice = true;
|
||||
|
@ -27,18 +27,20 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterExecImpl::RicRangeFilterExecImpl(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter)
|
||||
RicRangeFilterExecImpl::RicRangeFilterExecImpl(RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* insertBeforeCellRangeFilter)
|
||||
: CmdExecuteCommand(nullptr)
|
||||
{
|
||||
CVF_ASSERT(rangeFilterCollection);
|
||||
m_cellRangeFilterCollection = rangeFilterCollection;
|
||||
|
||||
m_cellRangeFilter = rangeFilter;
|
||||
m_insertBeforeCellRangeFilter = insertBeforeCellRangeFilter;
|
||||
|
||||
m_iSlice = false;
|
||||
m_jSlice = false;
|
||||
m_kSlice = false;
|
||||
|
||||
m_gridIndex = 0;
|
||||
m_iSliceStart = -1;
|
||||
m_jSliceStart = -1;
|
||||
m_kSliceStart = -1;
|
||||
@ -61,6 +63,8 @@ RimCellRangeFilter* RicRangeFilterExecImpl::createRangeFilter()
|
||||
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter();
|
||||
|
||||
size_t flterIndex = m_cellRangeFilterCollection->rangeFilters().size() + 1;
|
||||
|
||||
rangeFilter->gridIndex = m_gridIndex;
|
||||
|
||||
rangeFilter->name = QString("New Filter (%1)").arg(flterIndex);
|
||||
|
||||
@ -87,6 +91,7 @@ RimCellRangeFilter* RicRangeFilterExecImpl::createRangeFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterExecImpl::applyCommandDataOnFilter(RimCellRangeFilter* rangeFilter)
|
||||
{
|
||||
rangeFilter->gridIndex = m_gridIndex;
|
||||
if (m_iSlice)
|
||||
{
|
||||
rangeFilter->cellCountI = 1;
|
||||
|
@ -31,7 +31,8 @@ class RimCellRangeFilterCollection;
|
||||
class RicRangeFilterExecImpl : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicRangeFilterExecImpl(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter = nullptr);
|
||||
RicRangeFilterExecImpl(RimCellRangeFilterCollection* rangeFilterCollection,
|
||||
RimCellRangeFilter* insertBeforeCellRangeFilter = nullptr);
|
||||
virtual ~RicRangeFilterExecImpl();
|
||||
|
||||
virtual QString name() = 0;
|
||||
@ -43,6 +44,7 @@ public:
|
||||
bool m_jSlice;
|
||||
bool m_kSlice;
|
||||
|
||||
int m_gridIndex;
|
||||
int m_iSliceStart;
|
||||
int m_jSliceStart;
|
||||
int m_kSliceStart;
|
||||
@ -53,7 +55,7 @@ protected:
|
||||
|
||||
protected:
|
||||
caf::PdmPointer<RimCellRangeFilterCollection> m_cellRangeFilterCollection;
|
||||
caf::PdmPointer<RimCellRangeFilter> m_cellRangeFilter;
|
||||
caf::PdmPointer<RimCellRangeFilter> m_insertBeforeCellRangeFilter;
|
||||
};
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ void RicRangeFilterInsertExec::redo()
|
||||
RimCellRangeFilter* rangeFilter = createRangeFilter();
|
||||
if (rangeFilter)
|
||||
{
|
||||
size_t index = m_cellRangeFilterCollection->rangeFilters.index(m_cellRangeFilter);
|
||||
size_t index = m_cellRangeFilterCollection->rangeFilters.index(m_insertBeforeCellRangeFilter);
|
||||
CVF_ASSERT(index < m_cellRangeFilterCollection->rangeFilters.size());
|
||||
|
||||
m_cellRangeFilterCollection->rangeFilters.insertAt(static_cast<int>(index), rangeFilter);
|
||||
|
@ -278,14 +278,17 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
QVariantList iSliceList;
|
||||
iSliceList.push_back(0);
|
||||
iSliceList.push_back(CVF_MAX(static_cast<int>(i + 1), 1));
|
||||
iSliceList.push_back(m_currentGridIdx);
|
||||
|
||||
QVariantList jSliceList;
|
||||
jSliceList.push_back(1);
|
||||
jSliceList.push_back(CVF_MAX(static_cast<int>(j + 1), 1));
|
||||
jSliceList.push_back(m_currentGridIdx);
|
||||
|
||||
QVariantList kSliceList;
|
||||
kSliceList.push_back(2);
|
||||
kSliceList.push_back(CVF_MAX(static_cast<int>(k + 1), 1));
|
||||
kSliceList.push_back(m_currentGridIdx);
|
||||
|
||||
menuBuilder.subMenuStart("Range Filter Slice", QIcon(":/CellFilter_Range.png"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user