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:
parent
2e1a542749
commit
d4a97d8e68
@ -31,7 +31,9 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseViewPasteFeature.h
|
|||||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsCreateCaseGroupFromFiles.h
|
#${CEE_CURRENT_LIST_DIR}RicGridModelsCreateCaseGroupFromFiles.h
|
||||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsImport.h
|
#${CEE_CURRENT_LIST_DIR}RicGridModelsImport.h
|
||||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsImportInput.h
|
#${CEE_CURRENT_LIST_DIR}RicGridModelsImportInput.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicPropertyFilterNewExec.cpp
|
${CEE_CURRENT_LIST_DIR}RicPropertyFilterNewExec.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterExecImpl.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertExec.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertFeature.h
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewFeature.h
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterFeatureImpl.h
|
||||||
@ -82,6 +84,8 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseViewPasteFeature.cpp
|
|||||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsCreateCaseGroupFromFiles.cpp
|
#${CEE_CURRENT_LIST_DIR}RicGridModelsCreateCaseGroupFromFiles.cpp
|
||||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsImport.cpp
|
#${CEE_CURRENT_LIST_DIR}RicGridModelsImport.cpp
|
||||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsImportInput.cpp
|
#${CEE_CURRENT_LIST_DIR}RicGridModelsImportInput.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterExecImpl.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertExec.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicRangeFilterFeatureImpl.cpp
|
||||||
|
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;
|
||||||
|
}
|
58
ApplicationCode/Commands/RicRangeFilterExecImpl.h
Normal file
58
ApplicationCode/Commands/RicRangeFilterExecImpl.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafCmdExecuteCommand.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
|
class RimCellRangeFilter;
|
||||||
|
class RimCellRangeFilterCollection;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicRangeFilterExecImpl : public caf::CmdExecuteCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RicRangeFilterExecImpl(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter = 0);
|
||||||
|
virtual ~RicRangeFilterExecImpl();
|
||||||
|
|
||||||
|
virtual QString name() = 0;
|
||||||
|
virtual void redo() = 0;
|
||||||
|
virtual void undo() = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool m_iSlice;
|
||||||
|
bool m_jSlice;
|
||||||
|
bool m_kSlice;
|
||||||
|
|
||||||
|
int m_iSliceStart;
|
||||||
|
int m_jSliceStart;
|
||||||
|
int m_kSliceStart;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
RimCellRangeFilter* createRangeFilter();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
caf::PdmPointer<RimCellRangeFilterCollection> m_cellRangeFilterCollection;
|
||||||
|
caf::PdmPointer<RimCellRangeFilter> m_cellRangeFilter;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ public:
|
|||||||
static bool isRangeFilterCommandAvailable();
|
static bool isRangeFilterCommandAvailable();
|
||||||
static RicRangeFilterNewExec* createRangeFilterExecCommand();
|
static RicRangeFilterNewExec* createRangeFilterExecCommand();
|
||||||
|
|
||||||
private:
|
public:
|
||||||
static RimCellRangeFilterCollection* findRangeFilterCollection();
|
static RimCellRangeFilterCollection* findRangeFilterCollection();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
82
ApplicationCode/Commands/RicRangeFilterInsertExec.cpp
Normal file
82
ApplicationCode/Commands/RicRangeFilterInsertExec.cpp
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicRangeFilterInsertExec.h"
|
||||||
|
|
||||||
|
#include "RimCellRangeFilter.h"
|
||||||
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
#include "RimView.h"
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RicRangeFilterInsertExec::RicRangeFilterInsertExec(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter)
|
||||||
|
: RicRangeFilterExecImpl(rangeFilterCollection, rangeFilter)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RicRangeFilterInsertExec::~RicRangeFilterInsertExec()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RicRangeFilterInsertExec::name()
|
||||||
|
{
|
||||||
|
return "Create Range Filter";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicRangeFilterInsertExec::redo()
|
||||||
|
{
|
||||||
|
RimCellRangeFilter* rangeFilter = createRangeFilter();
|
||||||
|
if (rangeFilter)
|
||||||
|
{
|
||||||
|
size_t index = m_cellRangeFilterCollection->rangeFilters.index(m_cellRangeFilter);
|
||||||
|
CVF_ASSERT(index < m_cellRangeFilterCollection->rangeFilters.size());
|
||||||
|
|
||||||
|
m_cellRangeFilterCollection->rangeFilters.insertAt(index, rangeFilter);
|
||||||
|
|
||||||
|
rangeFilter->setDefaultValues();
|
||||||
|
|
||||||
|
m_cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
||||||
|
m_cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
||||||
|
m_cellRangeFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
|
||||||
|
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(rangeFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicRangeFilterInsertExec::undo()
|
||||||
|
{
|
||||||
|
}
|
41
ApplicationCode/Commands/RicRangeFilterInsertExec.h
Normal file
41
ApplicationCode/Commands/RicRangeFilterInsertExec.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "RicRangeFilterExecImpl.h"
|
||||||
|
|
||||||
|
class RimCellRangeFilter;
|
||||||
|
class RimCellRangeFilterCollection;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicRangeFilterInsertExec : public RicRangeFilterExecImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RicRangeFilterInsertExec(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter = 0);
|
||||||
|
virtual ~RicRangeFilterInsertExec();
|
||||||
|
|
||||||
|
virtual QString name();
|
||||||
|
virtual void redo();
|
||||||
|
virtual void undo();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
#include "RicRangeFilterInsertFeature.h"
|
#include "RicRangeFilterInsertFeature.h"
|
||||||
|
|
||||||
|
#include "RicRangeFilterInsertExec.h"
|
||||||
|
#include "RicRangeFilterFeatureImpl.h"
|
||||||
|
|
||||||
#include "RimCellRangeFilter.h"
|
#include "RimCellRangeFilter.h"
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
@ -35,17 +38,8 @@ CAF_CMD_SOURCE_INIT(RicRangeFilterInsertFeature, "RicRangeFilterInsertFeature");
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicRangeFilterInsertFeature::isCommandEnabled()
|
bool RicRangeFilterInsertFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
std::vector<RimCellRangeFilter*> selectedRangeFilter;
|
std::vector<RimCellRangeFilter*> selection = selectedCellRangeFilters();
|
||||||
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilter);
|
return selection.size() > 0;
|
||||||
|
|
||||||
if (selectedRangeFilter.size() > 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -53,6 +47,11 @@ bool RicRangeFilterInsertFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicRangeFilterInsertFeature::onActionTriggered(bool isChecked)
|
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");
|
actionToSetup->setText("Insert Range Filter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimCellRangeFilter*> RicRangeFilterInsertFeature::selectedCellRangeFilters()
|
||||||
|
{
|
||||||
|
std::vector<RimCellRangeFilter*> selection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||||
|
|
||||||
|
return selection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class RimCellRangeFilter;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -34,6 +37,9 @@ protected:
|
|||||||
virtual bool isCommandEnabled();
|
virtual bool isCommandEnabled();
|
||||||
virtual void onActionTriggered( bool isChecked );
|
virtual void onActionTriggered( bool isChecked );
|
||||||
virtual void setupActionLook( QAction* actionToSetup );
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::vector<RimCellRangeFilter*> selectedCellRangeFilters();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,18 +28,9 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicRangeFilterNewExec::RicRangeFilterNewExec(RimCellRangeFilterCollection* rangeFilterCollection)
|
RicRangeFilterNewExec::RicRangeFilterNewExec(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter)
|
||||||
: CmdExecuteCommand(NULL)
|
: RicRangeFilterExecImpl(rangeFilterCollection, rangeFilter)
|
||||||
{
|
{
|
||||||
m_iSlice = false;
|
|
||||||
m_jSlice = false;
|
|
||||||
m_kSlice = false;
|
|
||||||
|
|
||||||
m_iSliceStart = -1;
|
|
||||||
m_jSliceStart = -1;
|
|
||||||
m_kSliceStart = -1;
|
|
||||||
|
|
||||||
cellRangeFilterCollection = rangeFilterCollection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -47,7 +38,6 @@ RicRangeFilterNewExec::RicRangeFilterNewExec(RimCellRangeFilterCollection* range
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RicRangeFilterNewExec::~RicRangeFilterNewExec()
|
RicRangeFilterNewExec::~RicRangeFilterNewExec()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -70,43 +60,21 @@ QString RicRangeFilterNewExec::name()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicRangeFilterNewExec::redo()
|
void RicRangeFilterNewExec::redo()
|
||||||
{
|
{
|
||||||
assert(cellRangeFilterCollection);
|
RimCellRangeFilter* rangeFilter = createRangeFilter();
|
||||||
|
if (rangeFilter)
|
||||||
|
{
|
||||||
|
m_cellRangeFilterCollection->rangeFilters.push_back(rangeFilter);
|
||||||
|
|
||||||
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter();
|
|
||||||
cellRangeFilterCollection->rangeFilters.push_back(rangeFilter);
|
|
||||||
rangeFilter->setDefaultValues();
|
rangeFilter->setDefaultValues();
|
||||||
|
|
||||||
rangeFilter->name = QString("Range Filter (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
m_cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
||||||
|
m_cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
||||||
|
m_cellRangeFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
|
||||||
|
|
||||||
if (m_iSlice)
|
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||||
{
|
|
||||||
rangeFilter->cellCountI = 1;
|
|
||||||
rangeFilter->name = QString("Slice I (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_jSlice)
|
|
||||||
{
|
|
||||||
rangeFilter->cellCountJ = 1;
|
|
||||||
rangeFilter->name = QString("Slice J (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_kSlice)
|
|
||||||
{
|
|
||||||
rangeFilter->cellCountK = 1;
|
|
||||||
rangeFilter->name = QString("Slice K (%1)").arg(cellRangeFilterCollection->rangeFilters().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_iSliceStart > -1) rangeFilter->startIndexI = m_iSliceStart;
|
|
||||||
if (m_jSliceStart > -1) rangeFilter->startIndexJ = m_jSliceStart;
|
|
||||||
if (m_kSliceStart > -1) rangeFilter->startIndexK = m_kSliceStart;
|
|
||||||
|
|
||||||
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
|
||||||
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
|
||||||
cellRangeFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
|
|
||||||
|
|
||||||
cellRangeFilterCollection->updateConnectedEditors();
|
|
||||||
|
|
||||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(rangeFilter);
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(rangeFilter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -114,12 +82,12 @@ void RicRangeFilterNewExec::redo()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicRangeFilterNewExec::undo()
|
void RicRangeFilterNewExec::undo()
|
||||||
{
|
{
|
||||||
assert(cellRangeFilterCollection);
|
assert(m_cellRangeFilterCollection);
|
||||||
|
|
||||||
cellRangeFilterCollection->rangeFilters.erase(cellRangeFilterCollection->rangeFilters.size() - 1);
|
m_cellRangeFilterCollection->rangeFilters.erase(m_cellRangeFilterCollection->rangeFilters.size() - 1);
|
||||||
|
|
||||||
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
m_cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
|
||||||
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
m_cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
||||||
|
|
||||||
cellRangeFilterCollection->updateConnectedEditors();
|
m_cellRangeFilterCollection->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
@ -19,36 +19,20 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafCmdExecuteCommand.h"
|
#include "RicRangeFilterExecImpl.h"
|
||||||
#include "cafPdmPointer.h"
|
|
||||||
|
|
||||||
class RimCellRangeFilterCollection;
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RicRangeFilterNewExec : public caf::CmdExecuteCommand
|
class RicRangeFilterNewExec : public RicRangeFilterExecImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RicRangeFilterNewExec(RimCellRangeFilterCollection* rangeFilterCollection);
|
RicRangeFilterNewExec(RimCellRangeFilterCollection* rangeFilterCollection, RimCellRangeFilter* rangeFilter = 0);
|
||||||
|
|
||||||
virtual ~RicRangeFilterNewExec();
|
virtual ~RicRangeFilterNewExec();
|
||||||
|
|
||||||
virtual QString name();
|
virtual QString name();
|
||||||
virtual void redo();
|
virtual void redo();
|
||||||
virtual void undo();
|
virtual void undo();
|
||||||
|
|
||||||
public:
|
|
||||||
bool m_iSlice;
|
|
||||||
bool m_jSlice;
|
|
||||||
bool m_kSlice;
|
|
||||||
|
|
||||||
int m_iSliceStart;
|
|
||||||
int m_jSliceStart;
|
|
||||||
int m_kSliceStart;
|
|
||||||
|
|
||||||
private:
|
|
||||||
caf::PdmPointer<RimCellRangeFilterCollection> cellRangeFilterCollection;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user