mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Added command exec for "new property filter"
This commit is contained in:
parent
e889fc6308
commit
7636136627
@ -14,6 +14,7 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCellResultSave.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseFaultResultSave.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNew.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseViewCopy.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseViewDelete.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseViewNew.h
|
||||
@ -21,6 +22,7 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseViewPaste.h
|
||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsCreateCaseGroupFromFiles.h
|
||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsImport.h
|
||||
#${CEE_CURRENT_LIST_DIR}RicGridModelsImportInput.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPropertyFilterNewExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterDelete.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsert.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNew.h
|
||||
@ -41,6 +43,7 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCellResultSave.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseFaultResultSave.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNew.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseViewCopy.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseViewDelete.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseViewNew.cpp
|
||||
|
@ -19,10 +19,12 @@
|
||||
|
||||
#include "RicEclipsePropertyFilterNew.h"
|
||||
|
||||
#include "RicEclipsePropertyFilterNewExec.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -54,7 +56,27 @@ bool RicEclipsePropertyFilterNew::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipsePropertyFilterNew::onActionTriggered(bool isChecked)
|
||||
{
|
||||
// MODTODO
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = NULL;
|
||||
|
||||
std::vector<RimEclipsePropertyFilter*> selectedPropertyFilter;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedPropertyFilter);
|
||||
|
||||
std::vector<RimEclipsePropertyFilterCollection*> selectedPropertyFilterCollection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedPropertyFilterCollection);
|
||||
if (selectedPropertyFilterCollection.size() == 1)
|
||||
{
|
||||
propertyFilterCollection = selectedPropertyFilterCollection[0];
|
||||
}
|
||||
else if (selectedPropertyFilter.size() > 0)
|
||||
{
|
||||
propertyFilterCollection = dynamic_cast<RimEclipsePropertyFilterCollection*>(selectedPropertyFilter[0]->owner());
|
||||
}
|
||||
|
||||
if (propertyFilterCollection)
|
||||
{
|
||||
RicEclipsePropertyFilterNewExec* filterExec = new RicEclipsePropertyFilterNewExec(propertyFilterCollection);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
87
ApplicationCode/Commands/RicEclipsePropertyFilterNewExec.cpp
Normal file
87
ApplicationCode/Commands/RicEclipsePropertyFilterNewExec.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicEclipsePropertyFilterNewExec.h"
|
||||
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicEclipsePropertyFilterNewExec::RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection)
|
||||
: CmdExecuteCommand(NULL)
|
||||
{
|
||||
assert(propertyFilterCollection);
|
||||
m_propertyFilterCollection = propertyFilterCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicEclipsePropertyFilterNewExec::~RicEclipsePropertyFilterNewExec()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicEclipsePropertyFilterNewExec::name()
|
||||
{
|
||||
return "Create Property Filter";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipsePropertyFilterNewExec::redo()
|
||||
{
|
||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
||||
|
||||
RimEclipseView* reservoirView = m_propertyFilterCollection->reservoirView();
|
||||
assert(reservoirView);
|
||||
|
||||
propertyFilter->resultDefinition->setReservoirView(reservoirView);
|
||||
propertyFilter->resultDefinition->setResultVariable(reservoirView->cellResult->resultVariable());
|
||||
propertyFilter->resultDefinition->setPorosityModel(reservoirView->cellResult->porosityModel());
|
||||
propertyFilter->resultDefinition->setResultType(reservoirView->cellResult->resultType());
|
||||
propertyFilter->resultDefinition->loadResult();
|
||||
propertyFilter->setToDefaultValues();
|
||||
propertyFilter->updateFilterName();
|
||||
|
||||
propertyFilter->setParentContainer(m_propertyFilterCollection);
|
||||
m_propertyFilterCollection->propertyFilters.push_back(propertyFilter);
|
||||
m_propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
|
||||
caf::PdmUiFieldHandle::updateConnectedUiEditors(m_propertyFilterCollection->parentField());
|
||||
caf::PdmUiFieldHandle::updateConnectedUiEditors(&m_propertyFilterCollection->propertyFilters);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipsePropertyFilterNewExec::undo()
|
||||
{
|
||||
m_propertyFilterCollection->propertyFilters.erase(m_propertyFilterCollection->propertyFilters.size() - 1);
|
||||
caf::PdmUiFieldHandle::updateConnectedUiEditors(m_propertyFilterCollection->parentField());
|
||||
}
|
44
ApplicationCode/Commands/RicEclipsePropertyFilterNewExec.h
Normal file
44
ApplicationCode/Commands/RicEclipsePropertyFilterNewExec.h
Normal file
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RimEclipsePropertyFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipsePropertyFilterNewExec : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection);
|
||||
virtual ~RicEclipsePropertyFilterNewExec();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipsePropertyFilterCollection> m_propertyFilterCollection;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user