mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added prototype for adding range filters
This commit is contained in:
parent
d041f27416
commit
d606f60c1c
@ -7,6 +7,7 @@ endif()
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNew.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNew.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceI.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJ.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.h
|
||||
@ -15,6 +16,7 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.h
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNew.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNew.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceI.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJ.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.cpp
|
||||
|
@ -17,13 +17,16 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicRangeFilterNew.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicRangeFilterNew, "RicRangeFilterNew");
|
||||
@ -59,58 +62,13 @@ void RicRangeFilterNew::onActionTriggered(bool isChecked)
|
||||
|
||||
if (selectedRangeFilterCollection.size() == 1)
|
||||
{
|
||||
// selectedRangeFilterCollection[0]->rangeFilters.push_back(new RimCellRangeFilter);
|
||||
// selectedRangeFilterCollection[0]->reservoirView()->createDisplayModelAndRedraw();
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = selectedRangeFilterCollection[0];
|
||||
|
||||
RicRangeFilterNewExec* filterExec = new RicRangeFilterNewExec(NULL);
|
||||
filterExec->cellRangeFilterCollection = rangeFilterCollection;
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
EvmProject* proj = EvaApplication::instance()->project();
|
||||
|
||||
std::vector<EvmNode*> selectedNodes;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedNodes, caf::SelectionManager::CURRENT);
|
||||
|
||||
caf::CmdAddItemFeature* addItemFeature = dynamic_cast<caf::CmdAddItemFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature(caf::CmdAddItemFeature::idNameStatic()));
|
||||
assert(addItemFeature);
|
||||
|
||||
if (selectedNodes.size() > 0)
|
||||
{
|
||||
caf::SelectionManager::instance()->setActiveChildArrayFieldHandle(&proj->boundaryConditions);
|
||||
|
||||
std::vector<caf::CmdExecuteCommand*> commands;
|
||||
for (size_t i = 0; i < selectedNodes.size(); i++)
|
||||
{
|
||||
// Not allowed to add more than one BC
|
||||
if (proj->findBoundaryConditionForNode(selectedNodes[i]->id)) continue;
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> newSelection;
|
||||
newSelection.push_back(selectedNodes[i]);
|
||||
caf::CmdSelectionChangeExec* selectionChangeExec = caf::CmdSelectionHelper::createSelectionCommand(newSelection, caf::SelectionManager::CURRENT);
|
||||
commands.push_back(selectionChangeExec);
|
||||
|
||||
int indexAfter = -1;
|
||||
caf::CmdAddItemExec* addItemExec = new caf::CmdAddItemExec(caf::SelectionManager::instance()->notificationCenter());
|
||||
|
||||
caf::CmdAddItemExecData* data = addItemExec->commandData();
|
||||
data->m_rootObject = caf::PdmReferenceHelper::findRoot(&proj->nodalLoads);
|
||||
data->m_pathToField = caf::PdmReferenceHelper::referenceFromRootToField(data->m_rootObject, &proj->boundaryConditions);
|
||||
data->m_indexAfter = indexAfter;
|
||||
|
||||
commands.push_back(addItemExec);
|
||||
}
|
||||
|
||||
if (commands.size() > 0)
|
||||
{
|
||||
// Add an empty selection when boundary conditions has been assigned
|
||||
std::vector<caf::PdmObjectHandle*> newSelection;
|
||||
caf::CmdSelectionChangeExec* selectionChangeExec = caf::CmdSelectionHelper::createSelectionCommand(newSelection, caf::SelectionManager::CURRENT);
|
||||
commands.push_back(selectionChangeExec);
|
||||
}
|
||||
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommandsAsMacro("New Boundary Conditions", commands);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
80
ApplicationCode/Commands/RicRangeFilterNewExec.cpp
Normal file
80
ApplicationCode/Commands/RicRangeFilterNewExec.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicRangeFilterNewExec::RicRangeFilterNewExec(caf::NotificationCenter* notificationCenter)
|
||||
: CmdExecuteCommand(notificationCenter)
|
||||
{
|
||||
m_filterI = false;
|
||||
m_filterJ = false;
|
||||
m_filterK = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicRangeFilterNewExec::name()
|
||||
{
|
||||
return "New Range Filter";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewExec::redo()
|
||||
{
|
||||
assert(cellRangeFilterCollection);
|
||||
|
||||
RimCellRangeFilter* newFilter = cellRangeFilterCollection->createAndAppendRangeFilter();
|
||||
if (m_filterI)
|
||||
{
|
||||
newFilter->cellCountI = 1;
|
||||
}
|
||||
|
||||
if (m_filterJ)
|
||||
{
|
||||
newFilter->cellCountJ = 1;
|
||||
}
|
||||
|
||||
if (m_filterK)
|
||||
{
|
||||
newFilter->cellCountK = 1;
|
||||
}
|
||||
|
||||
caf::PdmUiFieldHandle::updateConnectedUiEditors(cellRangeFilterCollection->parentField());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRangeFilterNewExec::undo()
|
||||
{
|
||||
assert(cellRangeFilterCollection);
|
||||
|
||||
cellRangeFilterCollection->rangeFilters.erase(cellRangeFilterCollection->rangeFilters.size() - 1);
|
||||
|
||||
caf::PdmUiFieldHandle::updateConnectedUiEditors(cellRangeFilterCollection->parentField());
|
||||
}
|
46
ApplicationCode/Commands/RicRangeFilterNewExec.h
Normal file
46
ApplicationCode/Commands/RicRangeFilterNewExec.h
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdExecuteCommand.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimCellRangeFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicRangeFilterNewExec : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicRangeFilterNewExec(caf::NotificationCenter* notificationCenter);
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
public:
|
||||
caf::PdmPointer<RimCellRangeFilterCollection> cellRangeFilterCollection;
|
||||
|
||||
bool m_filterI;
|
||||
bool m_filterJ;
|
||||
bool m_filterK;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user