Use general delete on property filters, and deleted obsolete files

This commit is contained in:
Magne Sjaastad 2015-08-12 11:10:10 +02:00
parent f9df484974
commit bcf1109412
10 changed files with 18 additions and 352 deletions

View File

@ -18,8 +18,6 @@ ${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
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsert.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertExec.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNew.h
@ -32,7 +30,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseViewPaste.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
${CEE_CURRENT_LIST_DIR}RicRangeFilterHelper.h
@ -63,8 +60,6 @@ ${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
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsert.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNew.cpp
@ -76,7 +71,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipseViewPaste.cpp
#${CEE_CURRENT_LIST_DIR}RicGridModelsCreateCaseGroupFromFiles.cpp
#${CEE_CURRENT_LIST_DIR}RicGridModelsImport.cpp
#${CEE_CURRENT_LIST_DIR}RicGridModelsImportInput.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterDelete.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsert.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNew.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterHelper.cpp

View File

@ -44,6 +44,7 @@
#include "cafNotificationCenter.h"
#include "cafSelectionManager.h"
#include "cafPdmDocument.h"
namespace caf
@ -75,18 +76,12 @@ void RicDeleteItemExec::redo()
if (m_commandData->m_deletedObjectAsXml().isEmpty())
{
QString encodedXml;
{
m_commandData->m_deletedObjectAsXml = xmlObj(obj)->writeObjectToXmlString();
}
m_commandData->m_deletedObjectAsXml = xmlObj(obj)->writeObjectToXmlString();
}
listField->erase(m_commandData->m_indexToObject);
listField->uiCapability()->updateConnectedEditors();
uiObj(listField->ownerObject())->updateConnectedEditors();
if (m_notificationCenter) m_notificationCenter->notifyObservers();
delete obj;
}
@ -106,8 +101,16 @@ void RicDeleteItemExec::undo()
listField->insertAt(m_commandData->m_indexToObject, obj);
PdmDocument::initAfterReadTraversal(obj);
listField->uiCapability()->updateConnectedEditors();
/*
uiObj(obj)->updateConnectedEditors();
listField->uiCapability()->updateConnectedEditors();
uiObj(listField->ownerObject())->updateConnectedEditors();
*/
if (m_notificationCenter) m_notificationCenter->notifyObservers();
}

View File

@ -1,63 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicEclipsePropertyFilterDelete.h"
#include "RicEclipsePropertyFilterDeleteExec.h"
#include "RicEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilter.h"
#include "cafCmdExecCommandManager.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT(RicEclipsePropertyFilterDelete, "RicEclipsePropertyFilterDelete");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicEclipsePropertyFilterDelete::isCommandEnabled()
{
std::vector<RimEclipsePropertyFilter*> propertyFilters = RicEclipsePropertyFilter::selectedPropertyFilters();
return propertyFilters.size() == 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterDelete::onActionTriggered(bool isChecked)
{
std::vector<RimEclipsePropertyFilter*> propertyFilters = RicEclipsePropertyFilter::selectedPropertyFilters();
if (propertyFilters.size() == 1)
{
RicEclipsePropertyFilterDeleteExec* filterExec = new RicEclipsePropertyFilterDeleteExec(propertyFilters[0]);
caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterDelete::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete");
}

View File

@ -1,39 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicEclipsePropertyFilterDelete : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -1,87 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicEclipsePropertyFilterDeleteExec.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicEclipsePropertyFilterDeleteExec::RicEclipsePropertyFilterDeleteExec(RimEclipsePropertyFilter* propertyFilter)
: CmdExecuteCommand(NULL)
{
CVF_ASSERT(propertyFilter);
m_propertyFilter = propertyFilter;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicEclipsePropertyFilterDeleteExec::~RicEclipsePropertyFilterDeleteExec()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicEclipsePropertyFilterDeleteExec::name()
{
return "Delete Property Filter";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterDeleteExec::redo()
{
RimEclipsePropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer();
CVF_ASSERT(propertyFilterCollection);
bool wasFilterActive = m_propertyFilter->isActive();
bool wasSomeFilterActive = propertyFilterCollection->hasActiveFilters();
propertyFilterCollection->remove(m_propertyFilter);
delete m_propertyFilter;
if (wasFilterActive)
{
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
}
if (wasSomeFilterActive)
{
propertyFilterCollection->reservoirView()->createDisplayModelAndRedraw();
}
caf::PdmUiFieldHandle::updateConnectedUiEditors(propertyFilterCollection->parentField());
caf::PdmUiFieldHandle::updateConnectedUiEditors(&propertyFilterCollection->propertyFilters);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterDeleteExec::undo()
{
// TODO
CVF_ASSERT(0);
}

View File

@ -1,43 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RimEclipsePropertyFilter;
//==================================================================================================
///
//==================================================================================================
class RicEclipsePropertyFilterDeleteExec : public caf::CmdExecuteCommand
{
public:
RicEclipsePropertyFilterDeleteExec(RimEclipsePropertyFilter* propertyFilter);
virtual ~RicEclipsePropertyFilterDeleteExec();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimEclipsePropertyFilter> m_propertyFilter;
};

View File

@ -1,65 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicRangeFilterDelete.h"
#include "RimCellRangeFilter.h"
#include "cafSelectionManager.h"
#include "cafCmdFeatureManager.h"
#include "cafCmdExecCommandManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicRangeFilterDelete, "RicRangeFilterDelete");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRangeFilterDelete::isCommandEnabled()
{
std::vector<RimCellRangeFilter*> selectedRangeFilter;
caf::SelectionManager::instance()->objectsByType(&selectedRangeFilter);
if (selectedRangeFilter.size() > 0)
{
return true;
}
else
{
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRangeFilterDelete::onActionTriggered(bool isChecked)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRangeFilterDelete::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete");
}

View File

@ -1,39 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicRangeFilterDelete : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -113,5 +113,8 @@ void RicRangeFilterNewExec::undo()
cellRangeFilterCollection->rangeFilters.erase(cellRangeFilterCollection->rangeFilters.size() - 1);
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED);
cellRangeFilterCollection->reservoirView()->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
cellRangeFilterCollection->updateConnectedEditors();
}

View File

@ -576,9 +576,8 @@ void RimProject::actionsBasedOnSelection(std::vector<QAction*>& actions)
actions.push_back(commandManager->action("RicRangeFilterNewSliceI"));
actions.push_back(commandManager->action("RicRangeFilterNewSliceJ"));
actions.push_back(commandManager->action("RicRangeFilterNewSliceK"));
actions.push_back(commandManager->action("RicRangeFilterDelete"));
actions.push_back(commandManager->action("RicDeleteItemFeature"));
actions.push_back(commandManager->action("RicDeleteItemFeature"));
}
else if (dynamic_cast<RimEclipsePropertyFilterCollection*>(uiItem))
{
@ -587,7 +586,8 @@ void RimProject::actionsBasedOnSelection(std::vector<QAction*>& actions)
else if (dynamic_cast<RimEclipsePropertyFilter*>(uiItem))
{
actions.push_back(commandManager->action("RicEclipsePropertyFilterInsert"));
actions.push_back(commandManager->action("RicEclipsePropertyFilterDelete"));
actions.push_back(commandManager->action("RicDeleteItemFeature"));
}
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(uiItem))
{
@ -596,6 +596,8 @@ void RimProject::actionsBasedOnSelection(std::vector<QAction*>& actions)
else if (dynamic_cast<RimGeoMechPropertyFilter*>(uiItem))
{
actions.push_back(commandManager->action("RicGeoMechPropertyFilterInsert"));
actions.push_back(commandManager->action("RicDeleteItemFeature"));
}
}