mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added "new" and "insert" commands for geomech property filters
This commit is contained in:
@@ -11,8 +11,11 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputProperty.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsert.h
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNew.h
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterDelete.h
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterDeleteExec.h
|
||||
@@ -36,6 +39,8 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceI.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJ.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputProperty.h
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -45,8 +50,11 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseCaseExecuteScript.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroup.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewView.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipseCasePaste.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputProperty.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsert.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNew.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterDelete.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterDeleteExec.cpp
|
||||
@@ -69,6 +77,8 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceI.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJ.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceK.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputProperty.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
115
ApplicationCode/Commands/RicGeoMechPropertyFilter.cpp
Normal file
115
ApplicationCode/Commands/RicGeoMechPropertyFilter.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicGeoMechPropertyFilter.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechPropertyFilter*> RicGeoMechPropertyFilter::selectedPropertyFilters()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> propertyFilters;
|
||||
caf::SelectionManager::instance()->objectsByType(&propertyFilters);
|
||||
|
||||
return propertyFilters;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> RicGeoMechPropertyFilter::selectedPropertyFilterCollections()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> propertyFilterCollections;
|
||||
caf::SelectionManager::instance()->objectsByType(&propertyFilterCollections);
|
||||
|
||||
return propertyFilterCollections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilter::addPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection)
|
||||
{
|
||||
RimGeoMechPropertyFilter* propertyFilter = createPropertyFilter(propertyFilterCollection);
|
||||
CVF_ASSERT(propertyFilter);
|
||||
|
||||
propertyFilterCollection->propertyFilters.push_back(propertyFilter);
|
||||
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
|
||||
propertyFilterCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilter::insertPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection, size_t index)
|
||||
{
|
||||
RimGeoMechPropertyFilter* propertyFilter = createPropertyFilter(propertyFilterCollection);
|
||||
CVF_ASSERT(propertyFilter);
|
||||
|
||||
propertyFilterCollection->propertyFilters.insertAt(index, propertyFilter);
|
||||
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
|
||||
propertyFilterCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechPropertyFilter* RicGeoMechPropertyFilter::createPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection)
|
||||
{
|
||||
CVF_ASSERT(propertyFilterCollection);
|
||||
|
||||
RimGeoMechPropertyFilter* propertyFilter = new RimGeoMechPropertyFilter();
|
||||
propertyFilter->setParentContainer(propertyFilterCollection);
|
||||
|
||||
setDefaults(propertyFilter);
|
||||
|
||||
return propertyFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilter::setDefaults(RimGeoMechPropertyFilter* propertyFilter)
|
||||
{
|
||||
CVF_ASSERT(propertyFilter);
|
||||
|
||||
RimGeoMechPropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
|
||||
CVF_ASSERT(propertyFilterCollection);
|
||||
|
||||
RimGeoMechView* reservoirView = propertyFilterCollection->reservoirView();
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
propertyFilter->resultDefinition->setReservoirView(reservoirView);
|
||||
propertyFilter->resultDefinition->setResultAddress(reservoirView->cellResult()->resultAddress());
|
||||
propertyFilter->resultDefinition->loadResult();
|
||||
propertyFilter->setToDefaultValues();
|
||||
propertyFilter->updateFilterName();
|
||||
}
|
||||
42
ApplicationCode/Commands/RicGeoMechPropertyFilter.h
Normal file
42
ApplicationCode/Commands/RicGeoMechPropertyFilter.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <vector>
|
||||
|
||||
class RimGeoMechPropertyFilter;
|
||||
class RimGeoMechPropertyFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicGeoMechPropertyFilter
|
||||
{
|
||||
public:
|
||||
static std::vector<RimGeoMechPropertyFilter*> selectedPropertyFilters();
|
||||
static std::vector<RimGeoMechPropertyFilterCollection*> selectedPropertyFilterCollections();
|
||||
|
||||
static void addPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
|
||||
static void insertPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection, size_t index);
|
||||
|
||||
private:
|
||||
static RimGeoMechPropertyFilter* createPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
|
||||
static void setDefaults(RimGeoMechPropertyFilter* propertyFilter);
|
||||
};
|
||||
63
ApplicationCode/Commands/RicGeoMechPropertyFilterInsert.cpp
Normal file
63
ApplicationCode/Commands/RicGeoMechPropertyFilterInsert.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicGeoMechPropertyFilterInsert.h"
|
||||
|
||||
#include "RicGeoMechPropertyFilterInsertExec.h"
|
||||
#include "RicGeoMechPropertyFilter.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include <vector>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicGeoMechPropertyFilterInsert, "RicGeoMechPropertyFilterInsert");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicGeoMechPropertyFilterInsert::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> propertyFilters = RicGeoMechPropertyFilter::selectedPropertyFilters();
|
||||
return propertyFilters.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterInsert::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> propertyFilters = RicGeoMechPropertyFilter::selectedPropertyFilters();
|
||||
if (propertyFilters.size() == 1)
|
||||
{
|
||||
RicGeoMechPropertyFilterInsertExec* filterExec = new RicGeoMechPropertyFilterInsertExec(propertyFilters[0]);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterInsert::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Insert Property Filter");
|
||||
}
|
||||
39
ApplicationCode/Commands/RicGeoMechPropertyFilterInsert.h
Normal file
39
ApplicationCode/Commands/RicGeoMechPropertyFilterInsert.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicGeoMechPropertyFilterInsert : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicGeoMechPropertyFilterInsertExec.h"
|
||||
|
||||
|
||||
#include "RicGeoMechPropertyFilter.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicGeoMechPropertyFilterInsertExec::RicGeoMechPropertyFilterInsertExec(RimGeoMechPropertyFilter* propertyFilter)
|
||||
: CmdExecuteCommand(NULL)
|
||||
{
|
||||
CVF_ASSERT(propertyFilter);
|
||||
m_propertyFilter = propertyFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicGeoMechPropertyFilterInsertExec::~RicGeoMechPropertyFilterInsertExec()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicGeoMechPropertyFilterInsertExec::name()
|
||||
{
|
||||
return "Insert Property Filter";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterInsertExec::redo()
|
||||
{
|
||||
RimGeoMechPropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer();
|
||||
CVF_ASSERT(propertyFilterCollection);
|
||||
|
||||
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
|
||||
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());
|
||||
|
||||
RicGeoMechPropertyFilter::insertPropertyFilter(propertyFilterCollection, index);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterInsertExec::undo()
|
||||
{
|
||||
// TODO
|
||||
CVF_ASSERT(0);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RimGeoMechPropertyFilter;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicGeoMechPropertyFilterInsertExec : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicGeoMechPropertyFilterInsertExec(RimGeoMechPropertyFilter* propertyFilter);
|
||||
virtual ~RicGeoMechPropertyFilterInsertExec();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimGeoMechPropertyFilter> m_propertyFilter;
|
||||
};
|
||||
|
||||
63
ApplicationCode/Commands/RicGeoMechPropertyFilterNew.cpp
Normal file
63
ApplicationCode/Commands/RicGeoMechPropertyFilterNew.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicGeoMechPropertyFilterNew.h"
|
||||
|
||||
#include "RicGeoMechPropertyFilterNewExec.h"
|
||||
#include "RicGeoMechPropertyFilter.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicGeoMechPropertyFilterNew, "RicGeoMechPropertyFilterNew");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicGeoMechPropertyFilterNew::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> filterCollections = RicGeoMechPropertyFilter::selectedPropertyFilterCollections();
|
||||
return filterCollections.size() == 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterNew::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> filterCollections = RicGeoMechPropertyFilter::selectedPropertyFilterCollections();
|
||||
if (filterCollections.size() == 1)
|
||||
{
|
||||
RicGeoMechPropertyFilterNewExec* filterExec = new RicGeoMechPropertyFilterNewExec(filterCollections[0]);
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterNew::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/CellFilter_Values.png"));
|
||||
actionToSetup->setText("New Property Filter");
|
||||
}
|
||||
39
ApplicationCode/Commands/RicGeoMechPropertyFilterNew.h
Normal file
39
ApplicationCode/Commands/RicGeoMechPropertyFilterNew.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafCmdFeature.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicGeoMechPropertyFilterNew : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
||||
69
ApplicationCode/Commands/RicGeoMechPropertyFilterNewExec.cpp
Normal file
69
ApplicationCode/Commands/RicGeoMechPropertyFilterNewExec.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicGeoMechPropertyFilterNewExec.h"
|
||||
|
||||
#include "RicGeoMechPropertyFilter.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicGeoMechPropertyFilterNewExec::RicGeoMechPropertyFilterNewExec(RimGeoMechPropertyFilterCollection* propertyFilterCollection)
|
||||
: CmdExecuteCommand(NULL)
|
||||
{
|
||||
assert(propertyFilterCollection);
|
||||
m_propertyFilterCollection = propertyFilterCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicGeoMechPropertyFilterNewExec::~RicGeoMechPropertyFilterNewExec()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicGeoMechPropertyFilterNewExec::name()
|
||||
{
|
||||
return "New Property Filter";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterNewExec::redo()
|
||||
{
|
||||
RicGeoMechPropertyFilter::addPropertyFilter(m_propertyFilterCollection);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicGeoMechPropertyFilterNewExec::undo()
|
||||
{
|
||||
m_propertyFilterCollection->propertyFilters.erase(m_propertyFilterCollection->propertyFilters.size() - 1);
|
||||
|
||||
m_propertyFilterCollection->updateConnectedEditors();
|
||||
}
|
||||
44
ApplicationCode/Commands/RicGeoMechPropertyFilterNewExec.h
Normal file
44
ApplicationCode/Commands/RicGeoMechPropertyFilterNewExec.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 RimGeoMechPropertyFilterCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicGeoMechPropertyFilterNewExec : public caf::CmdExecuteCommand
|
||||
{
|
||||
public:
|
||||
RicGeoMechPropertyFilterNewExec(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
|
||||
virtual ~RicGeoMechPropertyFilterNewExec();
|
||||
|
||||
virtual QString name();
|
||||
virtual void redo();
|
||||
virtual void undo();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimGeoMechPropertyFilterCollection> m_propertyFilterCollection;
|
||||
};
|
||||
|
||||
|
||||
@@ -520,6 +520,8 @@ void RimProject::computeUtmAreaOfInterest()
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
|
||||
@@ -589,6 +591,14 @@ void RimProject::actionsBasedOnSelection(std::vector<QAction*>& actions)
|
||||
actions.push_back(commandManager->action("RicEclipsePropertyFilterInsert"));
|
||||
actions.push_back(commandManager->action("RicEclipsePropertyFilterDelete"));
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(uiItem))
|
||||
{
|
||||
actions.push_back(commandManager->action("RicGeoMechPropertyFilterNew"));
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechPropertyFilter*>(uiItem))
|
||||
{
|
||||
actions.push_back(commandManager->action("RicGeoMechPropertyFilterInsert"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user