#1371 opm-parser : Removed command features

This commit is contained in:
Magne Sjaastad 2017-04-03 20:48:45 +02:00
parent 0ec1d44125
commit 254d944b84
6 changed files with 0 additions and 316 deletions

View File

@ -6,7 +6,6 @@ endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h
@ -18,7 +17,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.h
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
@ -28,7 +26,6 @@ ${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.h
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp
@ -40,7 +37,6 @@ ${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp

View File

@ -21,7 +21,6 @@
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipseInputCase.h"
#include "RimEclipseInputCaseOpm.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
@ -40,18 +39,6 @@ CAF_CMD_SOURCE_INIT(RicAddEclipseInputPropertyFeature, "RicAddEclipseInputProper
//--------------------------------------------------------------------------------------------------
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
{
RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection();
if (inputProp)
{
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
inputProp->firstAncestorOrThisOfType(inputCaseOpm);
if (inputCaseOpm)
{
return false;
}
}
return selectedInputPropertyCollection() != NULL;
}

View File

@ -1,115 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "RicAddOpmInputPropertyFeature.h"
#include "RiaApplication.h"
#include "RimEclipseInputCaseOpm.h"
#include "RimEclipseInputPropertyCollection.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QFileDialog>
#include <QFileInfo>
#include <QStringList>
CAF_CMD_SOURCE_INIT(RicAddOpmInputPropertyFeature, "RicAddOpmInputPropertyFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAddOpmInputPropertyFeature::isCommandEnabled()
{
RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection();
if (inputProp)
{
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
inputProp->firstAncestorOrThisOfType(inputCaseOpm);
if (inputCaseOpm)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddOpmInputPropertyFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
if (fileNames.isEmpty()) return;
// Remember the directory to next time
defaultDir = QFileInfo(fileNames.last()).absolutePath();
app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir);
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
if (inputPropertyCollection)
{
addEclipseInputProperty(fileNames, inputPropertyCollection);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddOpmInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Add Input Property");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseInputPropertyCollection* RicAddOpmInputPropertyFeature::selectedInputPropertyCollection() const
{
std::vector<RimEclipseInputPropertyCollection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddOpmInputPropertyFeature::addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection)
{
CVF_ASSERT(inputPropertyCollection);
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
inputPropertyCollection->firstAncestorOrThisOfType(inputCaseOpm);
if (inputCaseOpm)
{
inputCaseOpm->appendPropertiesFromStandaloneFiles(fileNames);
}
inputPropertyCollection->updateConnectedEditors();
}

View File

@ -1,45 +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 RimEclipseInputPropertyCollection;
class QStringList;
//==================================================================================================
///
//==================================================================================================
class RicAddOpmInputPropertyFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimEclipseInputPropertyCollection* selectedInputPropertyCollection() const;
static void addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection);
};

View File

@ -1,100 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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 "RicImportInputEclipseCaseOpmFeature.h"
#include "RiaApplication.h"
#include "RimDefines.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseInputCaseOpm.h"
#include "RimEclipseView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QFileDialog>
CAF_CMD_SOURCE_INIT(RicImportInputEclipseCaseOpmFeature, "RicImportInputEclipseCaseOpmFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportInputEclipseCaseOpmFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportInputEclipseCaseOpmFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QString fileName = QFileDialog::getOpenFileName(RiuMainWindow::instance(), "Import Eclipse Input file", defaultDir, "Eclipse Input Files (*.GRDECL);;All Files (*.*)");
if (fileName.isEmpty()) return;
// Remember the path to next time
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileName).absolutePath());
RimProject* proj = app->project();
RimEclipseCaseCollection* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL;
if (analysisModels)
{
// This code originates from RiaApplication::openInputEclipseCaseFromFileNames
RimEclipseInputCaseOpm* rimInputReservoir = new RimEclipseInputCaseOpm();
proj->assignCaseIdToCase(rimInputReservoir);
rimInputReservoir->importNewEclipseGridAndProperties(fileName);
analysisModels->cases.push_back(rimInputReservoir);
RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView();
riv->cellResult()->setResultType(RimDefines::INPUT_PROPERTY);
riv->hasUserRequestedAnimation = true;
riv->loadDataAndUpdate();
if (!riv->cellResult()->hasResult())
{
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
}
analysisModels->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportInputEclipseCaseOpmFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/EclipseInput48x48.png"));
actionToSetup->setText("Import Input Eclipse Case (opm-parser) - BETA");
}

View File

@ -1,39 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicImportInputEclipseCaseOpmFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};