mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1387 Command to delete existing sour sim data from ResInsight
This commit is contained in:
parent
2ec68d08fb
commit
63bb85b998
@ -44,6 +44,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteSourSimDataFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
|
||||
@ -86,6 +88,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteSourSimDataFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
|
||||
)
|
||||
|
||||
|
67
ApplicationCode/Commands/RicDeleteSourSimDataFeature.cpp
Normal file
67
ApplicationCode/Commands/RicDeleteSourSimDataFeature.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// 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 "RicDeleteSourSimDataFeature.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicDeleteSourSimDataFeature, "RicDeleteSourSimDataFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteSourSimDataFeature::isCommandEnabled()
|
||||
{
|
||||
return getSelectedEclipseCase() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSourSimDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimEclipseResultCase* eclipseCase = getSelectedEclipseCase();
|
||||
|
||||
if (eclipseCase == nullptr) return;
|
||||
|
||||
eclipseCase->setSourSimFileName(QString());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSourSimDataFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete SourSim Data");
|
||||
actionToSetup->setIcon(QIcon(":/Erase.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase* RicDeleteSourSimDataFeature::getSelectedEclipseCase()
|
||||
{
|
||||
caf::PdmUiItem* selectedItem = caf::SelectionManager::instance()->selectedItem();
|
||||
RimEclipseResultCase* eclipseCase = dynamic_cast<RimEclipseResultCase*>(selectedItem);
|
||||
return eclipseCase;
|
||||
}
|
40
ApplicationCode/Commands/RicDeleteSourSimDataFeature.h
Normal file
40
ApplicationCode/Commands/RicDeleteSourSimDataFeature.h
Normal file
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// 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 RimEclipseResultCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicDeleteSourSimDataFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
static RimEclipseResultCase* getSelectedEclipseCase();
|
||||
};
|
@ -458,6 +458,14 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
|
||||
RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
CVF_ASSERT(matrixModelResults);
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
RiaLogging::info("HDF: Removing all existing Sour Sim data ...");
|
||||
matrixModelResults->eraseAllSourSimData();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RiaLogging::info(QString("HDF: Start import of data from : ").arg(fileName));
|
||||
|
||||
RiaLogging::info("HDF: Removing all existing Sour Sim data ...");
|
||||
|
@ -410,6 +410,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicReloadCaseFeature";
|
||||
commandIds << "RicExecuteScriptForCasesFeature";
|
||||
commandIds << "RicDeleteSourSimDataFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user