mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1818 Observed Data: Command to Import observed data
This commit is contained in:
parent
d23675b466
commit
dd45f7c453
@ -34,6 +34,7 @@ ${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
|
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.h
|
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicImportObservedDataInMenuFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h
|
||||||
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.h
|
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.h
|
||||||
@ -99,6 +100,7 @@ ${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicImportObservedDataInMenuFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp
|
||||||
|
|
||||||
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.cpp
|
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.cpp
|
||||||
|
@ -20,11 +20,14 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimObservedData.h"
|
||||||
#include "RimObservedDataCollection.h"
|
#include "RimObservedDataCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryObservedDataFile.h"
|
#include "RimSummaryObservedDataFile.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
@ -41,19 +44,11 @@ RicImportObservedDataFeature::RicImportObservedDataFeature()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicImportObservedDataFeature::isCommandEnabled()
|
void RicImportObservedDataFeature::selectObservedDataFileInDialog()
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicImportObservedDataFeature::onActionTriggered(bool isChecked)
|
|
||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
|
||||||
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Import Observed Data", defaultDir, "Observed Data File;;All Files (*.*)");
|
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Import Observed Data", defaultDir, "All Files (*.*)");
|
||||||
|
|
||||||
if (fileNames.isEmpty()) return;
|
if (fileNames.isEmpty()) return;
|
||||||
|
|
||||||
@ -70,6 +65,28 @@ void RicImportObservedDataFeature::onActionTriggered(bool isChecked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicImportObservedDataFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
std::vector<RimObservedDataCollection*> selectionObservedDataCollection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectionObservedDataCollection);
|
||||||
|
|
||||||
|
std::vector<RimObservedData*> selectionObservedData;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selectionObservedData);
|
||||||
|
|
||||||
|
return (selectionObservedDataCollection.size() > 0 || selectionObservedData.size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicImportObservedDataFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RicImportObservedDataFeature::selectObservedDataFileInDialog();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -33,10 +33,11 @@ class RicImportObservedDataFeature : public caf::CmdFeature
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
RicImportObservedDataFeature();
|
RicImportObservedDataFeature();
|
||||||
|
static void selectObservedDataFileInDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool isCommandEnabled() override;
|
virtual bool isCommandEnabled() override;
|
||||||
virtual void onActionTriggered(bool isChecked) override;
|
virtual void onActionTriggered(bool isChecked) override;
|
||||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
bool createAndAddObservedDataFromFile(const QString& fileName);
|
static bool createAndAddObservedDataFromFile(const QString& fileName);
|
||||||
};
|
};
|
||||||
|
@ -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 "RicImportObservedDataInMenuFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RicImportObservedDataFeature.h"
|
||||||
|
|
||||||
|
#include "RimObservedDataCollection.h"
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryObservedDataFile.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicImportObservedDataInMenuFeature, "RicImportObservedDataInMenuFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RicImportObservedDataInMenuFeature::RicImportObservedDataInMenuFeature()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicImportObservedDataInMenuFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicImportObservedDataInMenuFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RicImportObservedDataFeature::selectObservedDataFileInDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicImportObservedDataInMenuFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setIcon(QIcon(":/Default.png"));
|
||||||
|
actionToSetup->setText("Import Observed Data");
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
class RicImportObservedDataInMenuFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RicImportObservedDataInMenuFeature();
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual bool isCommandEnabled() override;
|
||||||
|
virtual void onActionTriggered(bool isChecked) override;
|
||||||
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
};
|
@ -445,6 +445,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicFlyToObjectFeature";
|
commandIds << "RicFlyToObjectFeature";
|
||||||
commandIds << "RicExportCarfin";
|
commandIds << "RicExportCarfin";
|
||||||
|
|
||||||
|
commandIds << "RicImportObservedDataFeature";
|
||||||
commandIds << "RicPasteSummaryCaseFeature";
|
commandIds << "RicPasteSummaryCaseFeature";
|
||||||
commandIds << "RicReloadSummaryCaseFeature";
|
commandIds << "RicReloadSummaryCaseFeature";
|
||||||
commandIds << "RicCreateSummaryCaseCollectionFeature";
|
commandIds << "RicCreateSummaryCaseCollectionFeature";
|
||||||
|
@ -71,6 +71,8 @@ RimSummaryObservedDataFile* RimObservedDataCollection::createAndAddObservedDataF
|
|||||||
newObservedData->setSummaryHeaderFilename(fileName);
|
newObservedData->setSummaryHeaderFilename(fileName);
|
||||||
newObservedData->updateOptionSensitivity();
|
newObservedData->updateOptionSensitivity();
|
||||||
|
|
||||||
|
this->updateConnectedEditors();
|
||||||
|
|
||||||
return newObservedData;
|
return newObservedData;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -184,6 +184,7 @@ void RiuMainPlotWindow::createMenus()
|
|||||||
importMenu->addAction(cmdFeatureMgr->action("RicImportEclipseCaseFeature"));
|
importMenu->addAction(cmdFeatureMgr->action("RicImportEclipseCaseFeature"));
|
||||||
importMenu->addAction(cmdFeatureMgr->action("RicImportInputEclipseCaseFeature"));
|
importMenu->addAction(cmdFeatureMgr->action("RicImportInputEclipseCaseFeature"));
|
||||||
importMenu->addAction(cmdFeatureMgr->action("RicImportSummaryCaseFeature"));
|
importMenu->addAction(cmdFeatureMgr->action("RicImportSummaryCaseFeature"));
|
||||||
|
importMenu->addAction(cmdFeatureMgr->action("RicImportObservedDataInMenuFeature"));
|
||||||
importMenu->addAction(cmdFeatureMgr->action("RicCreateGridCaseGroupFeature"));
|
importMenu->addAction(cmdFeatureMgr->action("RicCreateGridCaseGroupFeature"));
|
||||||
importMenu->addSeparator();
|
importMenu->addSeparator();
|
||||||
#ifdef USE_ODB_API
|
#ifdef USE_ODB_API
|
||||||
|
Loading…
Reference in New Issue
Block a user