diff --git a/.gitignore b/.gitignore
index 52cccf6d4c..dc1fc79f22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,11 +57,11 @@ CTest*.cmake
*.opensdf
*.unsuccessfulbuild
ipch/
-[Oo]bj/
-[Bb]in
-[Dd]ebug*/
-[Rr]elease*/
Ankh.NoLoad
#Temp files
*.temp
+/Resinsight_Host.includes
+/Resinsight_Host.files
+/Resinsight_Host.creator
+/Resinsight_Host.config
diff --git a/ApplicationCode/Adm/LicenseInformation.txt b/ApplicationCode/Adm/LicenseInformation.txt
index 69a1d1bdea..b7a312a144 100644
--- a/ApplicationCode/Adm/LicenseInformation.txt
+++ b/ApplicationCode/Adm/LicenseInformation.txt
@@ -322,3 +322,46 @@ exceptions:
CRAVA is a software package for seismic inversion and conditioning of
geological reservoir models. CRAVA is copyrighted by the Norwegian
Computing Center and Statoil and licensed under GPLv3+.
+
+===============================================================================
+ Notice for opm-flowdiagnostics and opm-flowdiagnostics-applications libraries
+===============================================================================
+
+ Copyright 2016, 2017 Statoil ASA.
+
+ This file is part of the Open Porous Media Project (OPM).
+
+ OPM 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.
+
+ OPM 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OPM. If not, see .
+
+===============================================================================
+ Notice for the NightCharts code
+===============================================================================
+
+ NightCharts
+ Copyright (C) 2010 by Alexander A. Avdonin, Artem N. Ivanov / ITGears Co.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Please contact gordos.kund@gmail.com with any questions on this license.
diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp
index f7adafaa1a..15e26fd1a6 100644
--- a/ApplicationCode/Application/RiaApplication.cpp
+++ b/ApplicationCode/Application/RiaApplication.cpp
@@ -23,6 +23,7 @@
#include "RiaBaseDefs.h"
#include "RiaImageCompareReporter.h"
#include "RiaImageFileCompare.h"
+#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RiaProjectModifier.h"
#include "RiaSocketServer.h"
@@ -47,6 +48,8 @@
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
+#include "RimFlowCharacteristicsPlot.h"
+#include "RimFlowPlotCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
@@ -64,8 +67,10 @@
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
+#include "RimTreeViewStateSerializer.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
+#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
@@ -79,6 +84,8 @@
#include "RiuSummaryQwtPlot.h"
#include "RiuViewer.h"
#include "RiuWellLogPlot.h"
+#include "RiuWellAllocationPlot.h"
+#include "RiuFlowCharacteristicsPlot.h"
#include "RicImportSummaryCaseFeature.h"
#include "RicSnapshotViewToClipboardFeature.h"
@@ -92,10 +99,12 @@
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cafPdmSettings.h"
+#include "cafPdmUiModelChangeDetector.h"
#include "cafPdmUiTreeView.h"
#include "cafProgressInfo.h"
#include "cafUiProcess.h"
#include "cafUtils.h"
+
#include "cvfProgramOptions.h"
#include "cvfqtUtils.h"
@@ -107,6 +116,7 @@
#include
#include
#include
+#include
#include "gtest/gtest.h"
@@ -114,6 +124,7 @@
#include
#endif
+
namespace caf
{
template<>
@@ -132,7 +143,7 @@ namespace RegTestNames
const QString generatedFolderName = "RegTestGeneratedImages";
const QString diffFolderName = "RegTestDiffImages";
const QString baseFolderName = "RegTestBaseImages";
- const QString testProjectName = "RegressionTest.rip";
+ const QString testProjectName = "RegressionTest";
const QString testFolderFilter = "TestCase*";
const QString imageCompareExeName = "compare";
const QString reportFileName = "ResInsightRegressionTestReport.html";
@@ -332,10 +343,16 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
closeProject();
+ RiaLogging::info(QString("Starting to open project file : '%1'").arg(projectFileName));
+
// Open the project file and read the serialized data.
// Will initialize itself.
- if (!QFile::exists(projectFileName)) return false;
+ if (!caf::Utils::fileExists(projectFileName))
+ {
+ RiaLogging::info(QString("File does not exist : '%1'").arg(projectFileName));
+ return false;
+ }
m_project->fileName = projectFileName;
m_project->readFile();
@@ -536,6 +553,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
// Execute command objects, and release the mutex when the queue is empty
executeCommandObjects();
+ RiaLogging::info(QString("Completed open of project file : '%1'").arg(projectFileName));
+
return true;
}
@@ -554,6 +573,7 @@ void RiaApplication::loadAndUpdatePlotData()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
+ RimFlowPlotCollection* flowColl = nullptr;
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
{
@@ -563,9 +583,15 @@ void RiaApplication::loadAndUpdatePlotData()
{
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
}
+ if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->flowPlotCollection())
+ {
+ flowColl = m_project->mainPlotCollection()->flowPlotCollection();
+ }
+
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
- plotCount += spColl ? spColl->m_summaryPlots().size() : 0;
+ plotCount += spColl ? spColl->summaryPlots().size() : 0;
+ plotCount += flowColl ? flowColl->plotCount() : 0;
caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
if (wlpColl)
@@ -579,12 +605,60 @@ void RiaApplication::loadAndUpdatePlotData()
if (spColl)
{
- for (size_t wlpIdx = 0; wlpIdx < spColl->m_summaryPlots().size(); ++wlpIdx)
+ for (size_t wlpIdx = 0; wlpIdx < spColl->summaryPlots().size(); ++wlpIdx)
{
- spColl->m_summaryPlots[wlpIdx]->loadDataAndUpdate();
+ spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
+
+ if (flowColl)
+ {
+ plotProgress.setNextProgressIncrement(flowColl->plotCount());
+ flowColl->loadDataAndUpdate();
+ plotProgress.incrementProgress();
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaApplication::storeTreeViewState()
+{
+ {
+ if (mainPlotWindow() && mainPlotWindow()->projectTreeView())
+ {
+ caf::PdmUiTreeView* projectTreeView = mainPlotWindow()->projectTreeView();
+
+ QString treeViewState;
+ RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
+
+ QModelIndex mi = projectTreeView->treeView()->currentIndex();
+
+ QString encodedModelIndexString;
+ RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
+
+ project()->plotWindowTreeViewState = treeViewState;
+ project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
+ }
+ }
+
+ {
+ caf::PdmUiTreeView* projectTreeView = RiuMainWindow::instance()->projectTreeView();
+ if (projectTreeView)
+ {
+ QString treeViewState;
+ RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
+
+ QModelIndex mi = projectTreeView->treeView()->currentIndex();
+
+ QString encodedModelIndexString;
+ RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
+
+ project()->mainWindowTreeViewState = treeViewState;
+ project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
+ }
+ }
}
//--------------------------------------------------------------------------------------------------
@@ -640,7 +714,7 @@ bool RiaApplication::saveProject()
{
CVF_ASSERT(m_project.notNull());
- if (!QFile::exists(m_project->fileName()))
+ if (!caf::Utils::fileExists(m_project->fileName()))
{
return saveProjectPromptForFileName();
}
@@ -687,6 +761,55 @@ bool RiaApplication::saveProjectPromptForFileName()
return bSaveOk;
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RiaApplication::hasValidProjectFileExtension(const QString& fileName)
+{
+ if (fileName.contains(".rsp", Qt::CaseInsensitive) || fileName.contains(".rip", Qt::CaseInsensitive))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RiaApplication::askUserToSaveModifiedProject()
+{
+ if (caf::PdmUiModelChangeDetector::instance()->isModelChanged())
+ {
+ QMessageBox msgBox;
+ msgBox.setIcon(QMessageBox::Question);
+
+ QString questionText;
+ questionText = QString("The current project is modified.\n\nDo you want to save the changes?");
+
+ msgBox.setText(questionText);
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+
+ int ret = msgBox.exec();
+ if (ret == QMessageBox::Cancel)
+ {
+ return false;
+ }
+ else if (ret == QMessageBox::Yes)
+ {
+ if (!saveProject())
+ {
+ return false;
+ }
+ }
+ else
+ {
+ caf::PdmUiModelChangeDetector::instance()->reset();
+ }
+ }
+
+ return true;
+}
//--------------------------------------------------------------------------------------------------
///
@@ -695,6 +818,8 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
{
m_project->fileName = fileName;
+ storeTreeViewState();
+
if (!m_project->writeFile())
{
QMessageBox::warning(NULL, "Error when saving project file", QString("Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1").arg(fileName));
@@ -707,10 +832,11 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
m_recentFileActionProvider->addFileName(fileName);
+ caf::PdmUiModelChangeDetector::instance()->reset();
+
return true;
}
-
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -793,16 +919,19 @@ QString RiaApplication::createAbsolutePathFromProjectRelativePath(QString projec
return projectRelativePath;
}
+ QString absolutePath;
if (m_project && !m_project->fileName().isEmpty())
{
- QString absoluteProjectPath = QFileInfo(m_project->fileName()).absolutePath();
- QDir projectDir(absoluteProjectPath);
- return projectDir.absoluteFilePath(projectRelativePath);
+ absolutePath = QFileInfo(m_project->fileName()).absolutePath();
}
else
{
- return projectRelativePath;
+ absolutePath = this->lastUsedDialogDirectory("BINARY_GRID");
}
+
+ QDir projectDir(absolutePath);
+
+ return projectDir.absoluteFilePath(projectRelativePath);
}
@@ -811,7 +940,7 @@ QString RiaApplication::createAbsolutePathFromProjectRelativePath(QString projec
//--------------------------------------------------------------------------------------------------
bool RiaApplication::openEclipseCaseFromFile(const QString& fileName)
{
- if (!QFile::exists(fileName)) return false;
+ if (!caf::Utils::fileExists(fileName)) return false;
QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName();
@@ -984,7 +1113,7 @@ bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNa
//--------------------------------------------------------------------------------------------------
bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
{
- if (!QFile::exists(fileName)) return false;
+ if (!caf::Utils::fileExists(fileName)) return false;
QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName();
@@ -1087,41 +1216,28 @@ RimView* RiaApplication::activeReservoirView()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-void RiaApplication::setActiveReservoirView(RimView* rv)
-{
- m_activeReservoirView = rv;
-}
-
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-void RiaApplication::setActiveWellLogPlot(RimWellLogPlot* wlp)
+RimViewWindow* RiaApplication::activePlotWindow() const
{
- m_activeWellLogPlot = wlp;
-}
+ RimViewWindow* viewWindow = nullptr;
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-RimWellLogPlot* RiaApplication::activeWellLogPlot()
-{
- return m_activeWellLogPlot;
-}
+ if ( m_mainPlotWindow )
+ {
+ QList subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
+ if ( subwindows.size() > 0 )
+ {
+ viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
+ }
+ }
-//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-void RiaApplication::setActiveSummaryPlot(RimSummaryPlot* sp)
-{
- m_activeSummaryPlot = sp;
+ return viewWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
-RimSummaryPlot* RiaApplication::activeSummaryPlot()
+void RiaApplication::setActiveReservoirView(RimView* rv)
{
- return m_activeSummaryPlot;
+ m_activeReservoirView = rv;
}
//--------------------------------------------------------------------------------------------------
@@ -1283,7 +1399,8 @@ bool RiaApplication::parseArguments()
std::vector gridFiles = readFileListFromTextFile(gridListFile);
runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
- closeProject();
+ closeAllWindows();
+ processEvents();
return false;
}
@@ -1362,14 +1479,14 @@ bool RiaApplication::parseArguments()
foreach (QString caseName, caseNames)
{
QString caseFileNameWithExt = caseName + ".EGRID";
- if (QFile::exists(caseFileNameWithExt))
+ if (!caf::Utils::fileExists(caseFileNameWithExt))
{
openEclipseCaseFromFile(caseFileNameWithExt);
}
else
{
caseFileNameWithExt = caseName + ".GRID";
- if (QFile::exists(caseFileNameWithExt))
+ if (!caf::Utils::fileExists(caseFileNameWithExt))
{
openEclipseCaseFromFile(caseFileNameWithExt);
}
@@ -1436,7 +1553,8 @@ bool RiaApplication::parseArguments()
}
}
- closeProject();
+ closeAllWindows();
+ processEvents();
}
// Returning false will exit the application
@@ -1555,6 +1673,16 @@ RiuMainPlotWindow* RiaApplication::mainPlotWindow()
return m_mainPlotWindow;
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
+{
+ if (mainWindowID == 0) return RiuMainWindow::instance();
+ else if (mainWindowID == 1) return m_mainPlotWindow;
+ else return nullptr;
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1562,36 +1690,44 @@ RimViewWindow* RiaApplication::activeViewWindow()
{
RimViewWindow* viewWindow = NULL;
- QWidget* topLevelWidget = RiaApplication::activeWindow();
+ QWidget* mainWindowWidget = RiaApplication::activeWindow();
- if (dynamic_cast(topLevelWidget))
+ if (dynamic_cast(mainWindowWidget))
{
viewWindow = RiaApplication::instance()->activeReservoirView();
}
-
- if (dynamic_cast(topLevelWidget))
+ else if (dynamic_cast(mainWindowWidget))
{
- RiuMainPlotWindow* mainPlotWindow = dynamic_cast(topLevelWidget);
+ RiuMainPlotWindow* mainPlotWindow = dynamic_cast(mainWindowWidget);
+
QList subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
if (subwindows.size() > 0)
{
- RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast(subwindows.back()->widget());
- if (summaryQwtPlot)
- {
- viewWindow = summaryQwtPlot->ownerPlotDefinition();
- }
-
- RiuWellLogPlot* wellLogPlot = dynamic_cast(subwindows.back()->widget());
- if (wellLogPlot)
- {
- viewWindow = wellLogPlot->ownerPlotDefinition();
- }
+ viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
}
}
return viewWindow;
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RiaApplication::isMain3dWindowVisible() const
+{
+ return RiuMainWindow::instance()->isVisible();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RiaApplication::isMainPlotWindowVisible() const
+{
+ if (!m_mainPlotWindow) return false;
+
+ return m_mainPlotWindow->isVisible();
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1889,6 +2025,7 @@ void RiaApplication::applyPreferences()
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
{
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
+ if (mainPlotWindow()) mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
}
caf::FixedAtlasFont::FontSize fontSizeType = caf::FixedAtlasFont::POINT_SIZE_16;
@@ -1998,11 +2135,11 @@ void RiaApplication::setLastUsedDialogDirectory(const QString& dialogName, const
//--------------------------------------------------------------------------------------------------
bool RiaApplication::openFile(const QString& fileName)
{
- if (!QFile::exists(fileName)) return false;
+ if (!caf::Utils::fileExists(fileName)) return false;
bool loadingSucceded = false;
- if (fileName.contains(".rsp", Qt::CaseInsensitive) || fileName.contains(".rip", Qt::CaseInsensitive))
+ if (RiaApplication::hasValidProjectFileExtension(fileName))
{
loadingSucceded = loadProject(fileName);
}
@@ -2037,6 +2174,11 @@ bool RiaApplication::openFile(const QString& fileName)
}
}
+ if (loadingSucceded && !RiaApplication::hasValidProjectFileExtension(fileName))
+ {
+ caf::PdmUiModelChangeDetector::instance()->setModelChanged();
+ }
+
return loadingSucceded;
}
@@ -2086,7 +2228,7 @@ void RiaApplication::saveSnapshotForAllViews(const QString& snapshotFolderName)
viewer->repaint();
QString fileName = cas->caseUserDescription() + "-" + riv->name();
- fileName.replace(" ", "_");
+ fileName = caf::Utils::makeValidFileBasename(fileName);
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
@@ -2137,6 +2279,18 @@ void removeDirectoryWithContent(QDir dirToDelete )
dirToDelete.rmdir(".");
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void logInfoTextWithTimeInSeconds(const QTime& time, const QString& msg)
+{
+ double timeRunning = time.elapsed() / 1000.0;
+
+ QString timeText = QString("(%1 s) ").arg(timeRunning, 0, 'f', 1);
+
+ RiaLogging::info(timeText + msg);
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2193,6 +2347,11 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
}
}
+ QTime timeStamp;
+ timeStamp.start();
+
+ logInfoTextWithTimeInSeconds(timeStamp, "Starting regression tests\n");
+
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{
QDir testCaseFolder(folderList[dirIdx].filePath());
@@ -2214,47 +2373,103 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{
QDir testCaseFolder(folderList[dirIdx].filePath());
- if (testCaseFolder.exists(regTestProjectName))
+
+ QString projectFileName;
+
+ if (testCaseFolder.exists(regTestProjectName + ".rip"))
{
- loadProject(testCaseFolder.filePath(regTestProjectName));
-
- // Wait until all command objects have completed
- while (!m_commandQueueLock.tryLock())
- {
- processEvents();
- }
- m_commandQueueLock.unlock();
-
- regressionTestConfigureProject();
-
- QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
- saveSnapshotForAllViews(fullPathGeneratedFolder);
-
- QDir baseDir(testCaseFolder.filePath(baseFolderName));
- QDir genDir(testCaseFolder.filePath(generatedFolderName));
- QDir diffDir(testCaseFolder.filePath(diffFolderName));
- if (!diffDir.exists()) testCaseFolder.mkdir(diffFolderName);
- baseDir.setFilter(QDir::Files);
- QStringList baseImageFileNames = baseDir.entryList();
-
- for (int fIdx = 0; fIdx < baseImageFileNames.size(); ++fIdx)
- {
- QString fileName = baseImageFileNames[fIdx];
- RiaImageFileCompare imgComparator(RegTestNames::imageCompareExeName);
- bool ok = imgComparator.runComparison(genDir.filePath(fileName), baseDir.filePath(fileName), diffDir.filePath(fileName));
- if (!ok)
- {
+ projectFileName = regTestProjectName + ".rip";
+ }
+
+ if (testCaseFolder.exists(regTestProjectName + ".rsp"))
+ {
+ projectFileName = regTestProjectName + ".rsp";
+ }
+
+ if (!projectFileName.isEmpty())
+ {
+ logInfoTextWithTimeInSeconds(timeStamp, "Initializing test :" + testCaseFolder.absolutePath());
+
+ loadProject(testCaseFolder.filePath(projectFileName));
+
+ // Wait until all command objects have completed
+ while (!m_commandQueueLock.tryLock())
+ {
+ processEvents();
+ }
+ m_commandQueueLock.unlock();
+
+ regressionTestConfigureProject();
+
+ resizeMaximizedPlotWindows();
+
+ QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
+ saveSnapshotForAllViews(fullPathGeneratedFolder);
+
+ RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(fullPathGeneratedFolder);
+
+ QDir baseDir(testCaseFolder.filePath(baseFolderName));
+ QDir genDir(testCaseFolder.filePath(generatedFolderName));
+ QDir diffDir(testCaseFolder.filePath(diffFolderName));
+ if (!diffDir.exists()) testCaseFolder.mkdir(diffFolderName);
+ baseDir.setFilter(QDir::Files);
+ QStringList baseImageFileNames = baseDir.entryList();
+
+ for (int fIdx = 0; fIdx < baseImageFileNames.size(); ++fIdx)
+ {
+ QString fileName = baseImageFileNames[fIdx];
+ RiaImageFileCompare imgComparator(RegTestNames::imageCompareExeName);
+ bool ok = imgComparator.runComparison(genDir.filePath(fileName), baseDir.filePath(fileName), diffDir.filePath(fileName));
+ if (!ok)
+ {
qDebug() << "Error comparing :" << imgComparator.errorMessage() << "\n" << imgComparator.errorDetails();
- }
- }
+ }
+ }
- closeProject();
+ closeProject();
+
+ logInfoTextWithTimeInSeconds(timeStamp, "Completed test :" + testCaseFolder.absolutePath());
}
}
+ RiaLogging::info("\n");
+ logInfoTextWithTimeInSeconds(timeStamp, "Completed regression tests");
+
m_runningRegressionTests = false;
}
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaApplication::resizeMaximizedPlotWindows()
+{
+ std::vector viewWindows;
+ m_project->mainPlotCollection()->descendantsIncludingThisOfType(viewWindows);
+
+ for (auto viewWindow : viewWindows)
+ {
+ if (viewWindow->isMdiWindow())
+ {
+ RimMdiWindowGeometry wndGeo = viewWindow->mdiWindowGeometry();
+ if (wndGeo.isMaximized)
+ {
+ QWidget* viewWidget = viewWindow->viewWidget();
+
+ if (viewWidget)
+ {
+ QMdiSubWindow* mdiWindow = m_mainPlotWindow->findMdiSubWindow(viewWidget);
+ if (mdiWindow)
+ {
+ mdiWindow->showNormal();
+
+ viewWidget->resize(RiaApplication::regressionDefaultImageSize());
+ }
+ }
+ }
+ }
+ }
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2347,7 +2562,7 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions);
if (identicalGrid)
{
- if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData()))
+ if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{
RimOilField* oilField = m_project->activeOilField();
if (oilField && oilField->analysisModels())
@@ -2649,7 +2864,6 @@ void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
}
}
-
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -2684,8 +2898,16 @@ void RiaApplication::regressionTestConfigureProject()
}
// This size is set to match the regression test reference images
- riv->viewer()->setFixedSize(1000, 745);
+ riv->viewer()->setFixedSize(RiaApplication::regressionDefaultImageSize());
}
}
}
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+QSize RiaApplication::regressionDefaultImageSize()
+{
+ return QSize(1000, 745);
+}
diff --git a/ApplicationCode/Application/RiaApplication.h b/ApplicationCode/Application/RiaApplication.h
index 0cfd04432e..8e158e3ebc 100644
--- a/ApplicationCode/Application/RiaApplication.h
+++ b/ApplicationCode/Application/RiaApplication.h
@@ -43,7 +43,7 @@ class RiaPreferences;
class RiaProjectModifier;
class RiaSocketServer;
-class RigCaseData;
+class RigEclipseCaseData;
class RimCommandObject;
class RimEclipseCase;
@@ -53,7 +53,9 @@ class RimSummaryPlot;
class RimView;
class RimViewWindow;
class RimWellLogPlot;
+class RimWellAllocationPlot;
+class RiuMainWindowBase;
class RiuMainPlotWindow;
class RiuRecentFileActionProvider;
@@ -94,11 +96,7 @@ class RiaApplication : public QApplication
RimView* activeReservoirView();
const RimView* activeReservoirView() const;
- void setActiveWellLogPlot(RimWellLogPlot*);
- RimWellLogPlot* activeWellLogPlot();
-
- void setActiveSummaryPlot(RimSummaryPlot*);
- RimSummaryPlot* activeSummaryPlot();
+ RimViewWindow* activePlotWindow() const;
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
@@ -128,15 +126,17 @@ class RiaApplication : public QApplication
bool saveProject();
bool saveProjectAs(const QString& fileName);
bool saveProjectPromptForFileName();
+ static bool hasValidProjectFileExtension(const QString& fileName);
+
+ bool askUserToSaveModifiedProject();
void closeProject();
+
void addWellPathsToModel(QList wellPathFilePaths);
void addWellLogsToModel(const QList& wellLogFilePaths);
void saveSnapshotForAllViews(const QString& snapshotFolderName);
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector gridFileNames, const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath);
- void updateRegressionTest(const QString& testRootPath );
- void regressionTestConfigureProject();
void processNonGuiEvents();
@@ -181,9 +181,13 @@ class RiaApplication : public QApplication
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
RiuMainPlotWindow* mainPlotWindow();
+ RiuMainWindowBase* mainWindowByID(int mainWindowID);
static RimViewWindow* activeViewWindow();
+ bool isMain3dWindowVisible() const;
+ bool isMainPlotWindowVisible() const;
+
bool tryCloseMainWindow();
bool tryClosePlotWindow();
@@ -209,16 +213,26 @@ class RiaApplication : public QApplication
void deleteMainPlotWindow();
void loadAndUpdatePlotData();
+
+ void storeTreeViewState();
+
+ void resizeMaximizedPlotWindows();
+ void updateRegressionTest(const QString& testRootPath);
+ void regressionTestConfigureProject();
+ static QSize regressionDefaultImageSize();
private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
-
void slotUpdateScheduledDisplayModels();
+ // Friend classes required to have access to slotUpdateScheduledDisplayModels
+ // As snapshots are produced fast in sequence, the feature must have access to force redraw
+ // of scheduled redraws
+ friend class RimView;
+ friend class RicExportMultipleSnapshotsFeature;
+
private:
caf::PdmPointer m_activeReservoirView;
- caf::PdmPointer m_activeWellLogPlot;
- caf::PdmPointer m_activeSummaryPlot;
caf::PdmPointer m_project;
diff --git a/ApplicationCode/Application/RiaColorTables.cpp b/ApplicationCode/Application/RiaColorTables.cpp
new file mode 100644
index 0000000000..3452a01150
--- /dev/null
+++ b/ApplicationCode/Application/RiaColorTables.cpp
@@ -0,0 +1,431 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RiaColorTables.h"
+
+#include
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::normalPaletteColors()
+{
+ static std::vector colors {
+ cvf::Color3ub( 0, 0, 255),
+ cvf::Color3ub( 0, 127, 255),
+ cvf::Color3ub( 0, 255, 255),
+ cvf::Color3ub( 0, 255, 0),
+ cvf::Color3ub(255, 255, 0),
+ cvf::Color3ub(255, 127, 0),
+ cvf::Color3ub(255, 0, 0)
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::normalPaletteOppositeOrderingColors()
+{
+ static std::vector colors{
+ cvf::Color3ub(255, 0, 0),
+ cvf::Color3ub(255, 127, 0),
+ cvf::Color3ub(255, 255, 0),
+ cvf::Color3ub( 0, 255, 0),
+ cvf::Color3ub( 0, 255, 255),
+ cvf::Color3ub( 0, 127, 255),
+ cvf::Color3ub( 0, 0, 255)
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::blackWhitePaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub::BLACK,
+ cvf::Color3ub::WHITE
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::whiteBlackPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub::WHITE,
+ cvf::Color3ub::BLACK
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::pinkWhitePaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub::DEEP_PINK,
+ cvf::Color3ub::WHITE
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::whitePinkPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub::WHITE,
+ cvf::Color3ub::DEEP_PINK
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::blueWhiteRedPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub::BLUE,
+ cvf::Color3ub::WHITE,
+ cvf::Color3ub::RED
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::redWhiteBluePaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub::RED,
+ cvf::Color3ub::WHITE,
+ cvf::Color3ub::BLUE
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::categoryPaletteColors()
+{
+ // Based on http://stackoverflow.com/questions/470690/how-to-automatically-generate-n-distinct-colors
+ // and Kelly Colors and sorted by hue
+ // See also http://www.w3schools.com/colors/ for palettes etc.
+
+ static std::vector colors{
+ cvf::Color3ub(128, 62, 117), // hwb(310, 24%, 50%) strong_purple
+ cvf::Color3ub(212, 28, 132), // hwb(326, 11%, 17%) strong_purplish_red
+ cvf::Color3ub(246, 118, 142), // hwb(349, 46%, 4%) strong_purplish_pink
+ cvf::Color3ub(193, 0, 32), // hwb(350, 0%, 24%) vivid_red
+ cvf::Color3ub(127, 24, 13), // hwb( 6, 5%, 50%) strong_reddish_brown
+ cvf::Color3ub(241, 58, 19), // hwb( 11, 7%, 5%) vivid_reddish_orange
+ cvf::Color3ub(255, 122, 92), // hwb( 11, 36%, 0%) strong_yellowish_pink
+ cvf::Color3ub(129, 112, 102), // hwb( 22, 40%, 49%) medium_gray
+ cvf::Color3ub(255, 104, 0), // hwb( 24, 0%, 0%) vivid_orange
+ cvf::Color3ub( 89, 51, 21), // hwb( 26, 8%, 65%) deep_yellowish_brown
+ cvf::Color3ub(255, 142, 0), // hwb( 33, 0%, 0%) vivid_orange_yellow
+ cvf::Color3ub(206, 162, 98), // hwb( 36, 38%, 19%) grayish_yellow
+ cvf::Color3ub(244, 200, 0), // hwb( 49, 0%, 4%) vivid_greenish_yellow
+ cvf::Color3ub(147, 170, 0), // hwb( 68, 0%, 33%) vivid_yellowish_green
+ cvf::Color3ub( 59, 84, 23), // hwb( 85, 9%, 67%) dark_olive_green
+ cvf::Color3ub( 0, 125, 52), // hwb(145, 0%, 51%) vivid_green
+ cvf::Color3ub( 54, 125, 123), // hwb(178, 21%, 51%) vivid_blueish_green
+ cvf::Color3ub( 0, 83, 138), // hwb(204, 0%, 46%) strong_blue
+ cvf::Color3ub(166, 189, 215), // hwb(212, 65%, 16%) very_light_blue
+ cvf::Color3ub( 46, 76, 224) // hwb(230, 18%, 12%) medium_blue
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::angularPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub(255, 0, 255),
+ cvf::Color3ub(0, 0, 255),
+ cvf::Color3ub(0, 127, 255),
+ cvf::Color3ub(0, 255, 255),
+ cvf::Color3ub(0, 255, 0),
+ cvf::Color3ub(255, 255, 0),
+ cvf::Color3ub(255, 127, 0),
+ cvf::Color3ub(255, 0, 0),
+ cvf::Color3ub(255, 0, 255)
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::faultsPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub(101, 132, 96), // Dark green
+ cvf::Color3ub(255, 131, 140), // Old pink
+ cvf::Color3ub(210, 176, 112), // Light Brown
+ cvf::Color3ub(140, 171, 238), // Light gray blue
+ cvf::Color3ub(255, 205, 131), // Peach
+ cvf::Color3ub(220, 212, 166), // Dark off white
+ cvf::Color3ub(130, 255, 120), // Light green
+ cvf::Color3ub(166, 220, 215), // Light gray torquise
+ cvf::Color3ub(168, 220, 166), // Light gray green
+ cvf::Color3ub(255, 64, 236) // Magneta
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::wellsPaletteColors()
+{
+ return categoryPaletteColors();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::summaryCurveDefaultPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub( 0, 112, 136), // Dark Green-Blue
+ cvf::Color3ub(202, 0, 0), // Red
+ cvf::Color3ub( 78, 204, 0), // Clear Green
+ cvf::Color3ub(236, 118, 0), // Orange
+ cvf::Color3ub( 0, 0, 0), // Black
+ cvf::Color3ub( 56, 56, 255), // Vivid Blue
+ cvf::Color3ub(248, 0, 170), // Magenta
+ cvf::Color3ub(169, 2, 240), // Purple
+ cvf::Color3ub( 0, 221, 221), // Turquoise
+ cvf::Color3ub(201, 168, 206), // Light Violet
+ cvf::Color3ub( 0, 205, 68), // Bluish Green
+ cvf::Color3ub(236, 188, 0), // Mid Yellow
+ cvf::Color3ub( 51, 204, 255), // Bluer Turquoise
+ cvf::Color3ub(164, 193, 0), // Mid Yellowish Green
+ cvf::Color3ub( 0, 143, 239) // Dark Light Blue
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::summaryCurveRedPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub(202, 0, 0), // Off Red
+ cvf::Color3ub(255, 51, 51), // Bright Red
+ cvf::Color3ub(255, 102, 102) // Light Red
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::summaryCurveGreenPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub( 78, 204, 0), // Clear Green
+ cvf::Color3ub(164, 193, 0), // Mid Yellowish Green
+ cvf::Color3ub( 0, 205, 68) // Bluish Green
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::summaryCurveBluePaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub( 56, 56, 255), // Vivid Blue
+ cvf::Color3ub( 0, 143, 239), // Dark Light Blue
+ cvf::Color3ub(153, 153, 255) // Off Light Blue
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::summaryCurveBrownPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub(186, 101, 44),
+ cvf::Color3ub( 99, 53, 23), // Highway Brown
+ cvf::Color3ub(103, 56, 24), // Dark Brown
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::summaryCurveNoneRedGreenBlueBrownPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub(236, 118, 0), // Orange
+ cvf::Color3ub( 0, 0, 0), // Black
+ cvf::Color3ub(248, 0, 170), // Magenta
+ cvf::Color3ub(236, 188, 0), // Mid Yellow
+ cvf::Color3ub(169, 2, 240), // Purple
+ cvf::Color3ub( 0, 221, 221), // Turquoise
+ cvf::Color3ub(201, 168, 206) // Light Violet
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
+{
+ static std::vector colors{
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::black)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkBlue)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkRed)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkGreen)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkYellow)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkMagenta)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkCyan)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::darkGray)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::blue)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::red)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::green)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::yellow)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::magenta)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::cyan)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::gray))
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::selectionPaletteColors()
+{
+ static std::vector colors{
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::magenta)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::cyan)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::blue)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::red)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::green)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::yellow)),
+ caf::ColorTable::fromQColor(Qt::GlobalColor(Qt::gray))
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+const caf::ColorTable& RiaColorTables::timestepsPaletteColors()
+{
+ static std::vector colors{
+ cvf::Color3ub( 56, 56, 255), // Vivid Blue
+ cvf::Color3ub( 0, 143, 239), // Dark Light Blue
+ cvf::Color3ub( 0, 112, 136), // Dark Green-Blue
+ cvf::Color3ub( 51, 204, 255), // Bluer Turquoise
+ cvf::Color3ub( 0, 221, 221), // Turquoise
+ cvf::Color3ub( 0, 205, 68), // Bluish Green
+ cvf::Color3ub( 78, 204, 0), // Clear Green
+ cvf::Color3ub(164, 193, 0), // Mid Yellowish Green
+ cvf::Color3ub(236, 188, 0), // Mid Yellow
+ cvf::Color3ub(236, 118, 0), // Orange
+ cvf::Color3ub(202, 0, 0), // Red
+ cvf::Color3ub(248, 0, 170), // Magenta
+ cvf::Color3ub(201, 168, 206), // Light Violet
+ cvf::Color3ub(169, 2, 240), // Purple
+ };
+
+ static caf::ColorTable colorTable = caf::ColorTable(colors);
+
+ return colorTable;
+}
diff --git a/ApplicationCode/Application/RiaColorTables.h b/ApplicationCode/Application/RiaColorTables.h
new file mode 100644
index 0000000000..b40c3f95a1
--- /dev/null
+++ b/ApplicationCode/Application/RiaColorTables.h
@@ -0,0 +1,53 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafColorTable.h"
+
+
+//==================================================================================================
+///
+///
+//==================================================================================================
+class RiaColorTables
+{
+public:
+ static const caf::ColorTable& normalPaletteColors();
+ static const caf::ColorTable& normalPaletteOppositeOrderingColors();
+ static const caf::ColorTable& blackWhitePaletteColors();
+ static const caf::ColorTable& whiteBlackPaletteColors();
+ static const caf::ColorTable& pinkWhitePaletteColors();
+ static const caf::ColorTable& whitePinkPaletteColors();
+ static const caf::ColorTable& blueWhiteRedPaletteColors();
+ static const caf::ColorTable& redWhiteBluePaletteColors();
+ static const caf::ColorTable& categoryPaletteColors();
+ static const caf::ColorTable& angularPaletteColors();
+ static const caf::ColorTable& faultsPaletteColors();
+ static const caf::ColorTable& wellsPaletteColors();
+ static const caf::ColorTable& summaryCurveDefaultPaletteColors();
+ static const caf::ColorTable& summaryCurveRedPaletteColors();
+ static const caf::ColorTable& summaryCurveGreenPaletteColors();
+ static const caf::ColorTable& summaryCurveBluePaletteColors();
+ static const caf::ColorTable& summaryCurveBrownPaletteColors();
+ static const caf::ColorTable& summaryCurveNoneRedGreenBlueBrownPaletteColors();
+ static const caf::ColorTable& wellLogPlotPaletteColors();
+ static const caf::ColorTable& selectionPaletteColors();
+ static const caf::ColorTable& timestepsPaletteColors();
+
+};
diff --git a/ApplicationCode/Application/RiaImageFileCompare.h b/ApplicationCode/Application/RiaImageFileCompare.h
index 2ccbb357f0..e9f79054c1 100644
--- a/ApplicationCode/Application/RiaImageFileCompare.h
+++ b/ApplicationCode/Application/RiaImageFileCompare.h
@@ -36,7 +36,7 @@ class RiaImageFileCompare
};
public:
- RiaImageFileCompare(QString compareExecutable);
+ explicit RiaImageFileCompare(QString compareExecutable);
~RiaImageFileCompare();
bool runComparison(QString imgFileName, QString refFileName, QString diffFileName);
diff --git a/ApplicationCode/Application/RiaLogging.cpp b/ApplicationCode/Application/RiaLogging.cpp
new file mode 100644
index 0000000000..ed0f5a6f06
--- /dev/null
+++ b/ApplicationCode/Application/RiaLogging.cpp
@@ -0,0 +1,252 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RiaLogging.h"
+
+#include
+
+#ifdef WIN32
+#pragma warning (push)
+#pragma warning (disable: 4668)
+#include
+#pragma warning (pop)
+#else
+#include
+#include
+#endif
+
+#include "QString"
+
+
+
+
+//==================================================================================================
+//
+//
+//
+//==================================================================================================
+class RiaDefaultConsoleLogger : public RiaLogger
+{
+public:
+ RiaDefaultConsoleLogger();
+
+ virtual int level() const override;
+ virtual void setLevel(int logLevel) override;
+ virtual void error( const char* message) override;
+ virtual void warning(const char* message) override;
+ virtual void info( const char* message) override;
+ virtual void debug( const char* message) override;
+
+private:
+ static void writeMessageToConsole(const char* prefix, const char* message);
+ static void writeToConsole(const std::string& str);
+
+private:
+ int m_logLevel;
+};
+
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RiaDefaultConsoleLogger::RiaDefaultConsoleLogger()
+ : m_logLevel(RI_LL_WARNING)
+{
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+int RiaDefaultConsoleLogger::level() const
+{
+ return m_logLevel;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::setLevel(int logLevel)
+{
+ m_logLevel = logLevel;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::error(const char* message)
+{
+ writeMessageToConsole("ERROR: ", message);
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::warning(const char* message)
+{
+ writeMessageToConsole("warn: ", message);
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::info(const char* message)
+{
+ writeMessageToConsole("info: ", message);
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::debug(const char* message)
+{
+ writeMessageToConsole("debug: ", message);
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::writeMessageToConsole(const char* prefix, const char* message)
+{
+ std::ostringstream oss;
+
+// VF_ASSERT(prefix);
+ oss << prefix;
+
+ if (message)
+ {
+ oss << message << std::endl;
+ }
+ else
+ {
+ oss << "" << std::endl;
+ }
+
+ writeToConsole(oss.str());
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaDefaultConsoleLogger::writeToConsole(const std::string& str)
+{
+#ifdef WIN32
+ AllocConsole();
+ HANDLE hStdOutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (hStdOutputHandle)
+ {
+ DWORD stringLength = static_cast(str.length());
+
+ unsigned long iDum = 0;
+ WriteConsoleA(hStdOutputHandle, str.c_str(), stringLength, &iDum, NULL);
+ }
+#else
+ fputs(str.c_str(), stderr);
+#endif
+}
+
+//==================================================================================================
+//
+//
+//
+//==================================================================================================
+
+RiaLogger* RiaLogging::sm_logger = new RiaDefaultConsoleLogger;
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RiaLogger* RiaLogging::loggerInstance()
+{
+ return sm_logger;
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaLogging::setLoggerInstance(RiaLogger* loggerInstance)
+{
+ // Only delete if we're currently using our own default impl
+ if (dynamic_cast(sm_logger))
+ {
+ delete sm_logger;
+ }
+
+// VF_ASSERT(loggerInstance);
+ sm_logger = loggerInstance;
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaLogging::deleteLoggerInstance()
+{
+ delete sm_logger;
+ sm_logger = NULL;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaLogging::error(const QString& message)
+{
+ if (sm_logger && sm_logger->level() >= RI_LL_ERROR)
+ {
+ sm_logger->error(message.toLatin1().constData());
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaLogging::warning(const QString& message)
+{
+ if (sm_logger && sm_logger->level() >= RI_LL_WARNING)
+ {
+ sm_logger->warning(message.toLatin1().constData());
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaLogging::info(const QString& message)
+{
+ if (sm_logger && sm_logger->level() >= RI_LL_INFO)
+ {
+ sm_logger->info(message.toLatin1().constData());
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiaLogging::debug(const QString& message)
+{
+ if (sm_logger && sm_logger->level() >= RI_LL_DEBUG)
+ {
+ sm_logger->debug(message.toLatin1().constData());
+ }
+}
+
diff --git a/ApplicationCode/Application/RiaLogging.h b/ApplicationCode/Application/RiaLogging.h
new file mode 100644
index 0000000000..3a9ce668e3
--- /dev/null
+++ b/ApplicationCode/Application/RiaLogging.h
@@ -0,0 +1,74 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+class QString;
+
+enum RILogLevel
+{
+ RI_LL_ERROR = 1,
+ RI_LL_WARNING = 2,
+ RI_LL_INFO = 3,
+ RI_LL_DEBUG = 4
+};
+
+
+
+//==================================================================================================
+//
+// Logger interface for the application
+//
+//==================================================================================================
+class RiaLogger
+{
+public:
+ virtual ~RiaLogger() {}
+
+ virtual int level() const = 0;
+ virtual void setLevel(int logLevel) = 0;
+
+ virtual void error( const char* message) = 0;
+ virtual void warning(const char* message) = 0;
+ virtual void info( const char* message) = 0;
+ virtual void debug( const char* message) = 0;
+};
+
+
+
+//==================================================================================================
+//
+//
+//
+//==================================================================================================
+class RiaLogging
+{
+public:
+ static RiaLogger* loggerInstance();
+ static void setLoggerInstance(RiaLogger* loggerInstance);
+ static void deleteLoggerInstance();
+
+ static void error( const QString& message);
+ static void warning(const QString& message);
+ static void info( const QString& message);
+ static void debug( const QString& message);
+
+private:
+ static RiaLogger* sm_logger;
+};
+
diff --git a/ApplicationCode/Application/RiaPreferences.cpp b/ApplicationCode/Application/RiaPreferences.cpp
index 15eea4ff20..6816ab4cae 100644
--- a/ApplicationCode/Application/RiaPreferences.cpp
+++ b/ApplicationCode/Application/RiaPreferences.cpp
@@ -33,7 +33,7 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
//--------------------------------------------------------------------------------------------------
RiaPreferences::RiaPreferences(void)
{
- CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation mode", "", "", "");
+ CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation Mode", "", "", "");
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
@@ -41,27 +41,27 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
scriptEditorExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
- CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave executable location", "", "", "");
+ CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave Executable Location", "", "", "");
octaveExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
octaveExecutable.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
- CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show text header when executing scripts", "", "", "");
+ CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show Text Header When Executing Scripts", "", "", "");
octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
- CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "ssihub Address", "", "", "");
+ CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "SSIHUB Address", "", "", "");
ssihubAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", "");
- CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", cvf::Color3f(0.92f, 0.92f, 0.92f), "Mesh color", "", "", "");
- CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", cvf::Color3f(0.08f, 0.08f, 0.08f), "Mesh color along faults", "", "", "");
- CAF_PDM_InitField(&defaultWellLabelColor, "defaultWellLableColor", cvf::Color3f(0.92f, 0.92f, 0.92f), "Well label color", "", "The default well label color in new views", "");
+ CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", cvf::Color3f(0.92f, 0.92f, 0.92f), "Mesh Color", "", "", "");
+ CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", cvf::Color3f(0.08f, 0.08f, 0.08f), "Mesh Color Along Faults", "", "", "");
+ CAF_PDM_InitField(&defaultWellLabelColor, "defaultWellLableColor", cvf::Color3f(0.92f, 0.92f, 0.92f), "Well Label Color", "", "The default well label color in new views", "");
- CAF_PDM_InitField(&defaultViewerBackgroundColor, "defaultViewerBackgroundColor", cvf::Color3f(0.69f, 0.77f, 0.87f), "Viewer background", "", "The viewer background color for new views", "");
+ CAF_PDM_InitField(&defaultViewerBackgroundColor, "defaultViewerBackgroundColor", cvf::Color3f(0.69f, 0.77f, 0.87f), "Viewer Background", "", "The viewer background color for new views", "");
- CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z scale factor", "", "", "");
- CAF_PDM_InitField(&fontSizeInScene, "fontSizeInScene", QString("8"), "Font size", "", "", "");
+ CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "");
+ CAF_PDM_InitField(&fontSizeInScene, "fontSizeInScene", QString("8"), "Font Size", "", "", "");
- CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS curve without TVD warning", "", "", "");
+ CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS Curve Without TVD Warning", "", "", "");
showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
@@ -77,21 +77,22 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.uiCapability()->setUiHidden(true);
- CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "Compute DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
+ CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "Compute DEPTH Related Properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
autocomputeDepthRelatedProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
- CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and show SOIL", "", "", "");
+ CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "");
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
- CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", "");
+ CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader Settings", "", "", "");
readerSettings = new RifReaderSettings;
- CAF_PDM_InitField(&autoCreatePlotsOnImport, "AutoCreatePlotsOnImport", true, "Create Summary Plots When Importing Eclipse Case", "", "", "");
+ CAF_PDM_InitField(&autoCreatePlotsOnImport, "AutoCreatePlotsOnImport", true, "Automatically Create Summary Plots On Import", "", "", "");
autoCreatePlotsOnImport.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", "");
m_tabNames << "General";
+ m_tabNames << "Eclipse";
m_tabNames << "Octave";
m_tabNames << "Summary";
}
@@ -113,7 +114,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
if (field == &scriptDirectories)
{
- caf::PdmUiFilePathEditorAttribute* myAttr = static_cast(attribute);
+ caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast(attribute);
if (myAttr)
{
myAttr->m_selectDirectory = true;
@@ -129,7 +130,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &showLasCurveWithoutTvdWarning ||
field == &autoCreatePlotsOnImport)
{
- caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast(attribute);
+ caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast(attribute);
if (myAttr)
{
myAttr->m_useNativeCheckBoxLabel = true;
@@ -144,38 +145,36 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{
if (uiConfigName == m_tabNames[0])
{
- caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings");
+ caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default Settings");
defaultSettingsGroup->add(&defaultViewerBackgroundColor);
defaultSettingsGroup->add(&defaultGridLines);
defaultSettingsGroup->add(&defaultGridLineColors);
defaultSettingsGroup->add(&defaultFaultGridLineColors);
defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&fontSizeInScene);
+ defaultSettingsGroup->add(&defaultScaleFactorZ);
- caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D views");
+ caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D Views");
viewsGroup->add(&navigationPolicy);
viewsGroup->add(&useShaders);
viewsGroup->add(&showHud);
- caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup("Behavior when loading new case");
- newCaseBehaviourGroup->add(&defaultScaleFactorZ);
- newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
- newCaseBehaviourGroup->add(&loadAndShowSoil);
- newCaseBehaviourGroup->add(&showLasCurveWithoutTvdWarning);
-
- std::vector readerSettingsFields;
- readerSettings->fields(readerSettingsFields);
- for (size_t i = 0; i < readerSettingsFields.size(); i++)
- {
- newCaseBehaviourGroup->add(readerSettingsFields[i]);
- }
- caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup("SSIHUB");
- ssihubGroup->add(&ssihubAddress);
+ caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup("Other");
+ otherGroup->add(&ssihubAddress);
+ otherGroup->add(&showLasCurveWithoutTvdWarning);
uiOrdering.add(&appendClassNameToUiText);
}
else if (uiConfigName == m_tabNames[1])
+ {
+ caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup("Behavior When Loading Data");
+ newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
+ newCaseBehaviourGroup->add(&loadAndShowSoil);
+
+ readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup);
+ }
+ else if (uiConfigName == m_tabNames[2])
{
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
octaveGroup->add(&octaveExecutable);
@@ -185,13 +184,13 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
scriptGroup->add(&scriptDirectories);
scriptGroup->add(&scriptEditorExecutable);
}
- else if (uiConfigName == m_tabNames[2])
+ else if (uiConfigName == m_tabNames[3])
{
uiOrdering.add(&autoCreatePlotsOnImport);
uiOrdering.add(&defaultCurveFilter);
}
- uiOrdering.setForgetRemainingFields(true);
+ uiOrdering.skipRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationCode/Application/RiaRegressionTest.cpp b/ApplicationCode/Application/RiaRegressionTest.cpp
index f05e1f28e6..ce54c33d17 100644
--- a/ApplicationCode/Application/RiaRegressionTest.cpp
+++ b/ApplicationCode/Application/RiaRegressionTest.cpp
@@ -51,7 +51,7 @@ void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
{
if (field == &applicationWorkingFolder || field == ®ressionTestFolder)
{
- caf::PdmUiFilePathEditorAttribute* myAttr = static_cast(attribute);
+ caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast(attribute);
if (myAttr)
{
myAttr->m_selectDirectory = true;
diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt
index 1269c7b3af..c1ec89d9a5 100644
--- a/ApplicationCode/CMakeLists.txt
+++ b/ApplicationCode/CMakeLists.txt
@@ -29,10 +29,10 @@ include_directories(
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
${ERT_INCLUDE_DIRS}
- ${Boost_INCLUDE_DIRS}
- ${ResInsight_SOURCE_DIR}/ThirdParty/custom-opm-common/opm-common/
- ${custom-opm-parser_SOURCE_DIR}/opm-parser/
+ ${boost-Subset_SOURCE_DIR}
${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/
+ ${custom-opm-flowdiag-app_SOURCE_DIR}/opm-flowdiagnostics-applications/
+ ${custom-opm-flowdiag-app_SOURCE_DIR}/opmCore
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Adm
@@ -45,8 +45,11 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
+
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
+ ${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
+
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
@@ -74,6 +77,9 @@ set( APPLICATION_FILES
Application/RiaImageCompareReporter.cpp
Application/RiaProjectModifier.cpp
Application/RiaRegressionTest.cpp
+ Application/RiaColorTables.cpp
+ Application/RiaLogging.h
+ Application/RiaLogging.cpp
)
set( SOCKET_INTERFACE_FILES
@@ -100,6 +106,7 @@ list( APPEND REFERENCED_CMAKE_FILES
ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/Summary/CMakeLists_files.cmake
+ ProjectDataModel/Flow/CMakeLists_files.cmake
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
@@ -113,6 +120,8 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
+ Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
+ Commands/FlowCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
@@ -267,23 +276,8 @@ endif ()
# Set up libraries and dependent projects to link with
#############################################################################
-if (MSVC)
- set (RI_BOOST_LIBRARIES
- debug ${Boost_SYSTEM_LIBRARY_DEBUG}
- optimized ${Boost_SYSTEM_LIBRARY_RELEASE}
- debug ${Boost_FILESYSTEM_LIBRARY_DEBUG}
- optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE}
- debug ${Boost_REGEX_LIBRARY_DEBUG}
- optimized ${Boost_REGEX_LIBRARY_RELEASE}
- )
-else()
- set (RI_BOOST_LIBRARIES ${Boost_LIBRARIES})
-endif()
-
-
set( LINK_LIBRARIES
- custom-opm-parser
- custom-opm-flowdiagnostics
+ ${OPM_LIBRARIES}
WellPathImportSsihub
@@ -295,15 +289,12 @@ set( LINK_LIBRARIES
${ERT_LIBRARIES}
- NRLib
+ ${THIRD_PARTY_LIBRARIES}
${OPENGL_LIBRARIES}
${QT_LIBRARIES}
-
- ${RI_BOOST_LIBRARIES}
-
- Qwt
)
+
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} )
# According to ivarun this is needed on OpenSuse, and Fedora. See: https://github.com/OPM/ResInsight/pull/7
@@ -332,9 +323,6 @@ if(RESINSIGHT_ENABLE_COTIRE)
# multiple QRC files are not supported
set_source_files_properties (qrc_cafAnimControl.cxx PROPERTIES COTIRE_EXCLUDED TRUE)
-
- # TODO: Revisit why opm-parser is not working
- set_source_files_properties (UnitTests/opm-parser-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
# variables at global file scope
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
@@ -347,13 +335,9 @@ if(RESINSIGHT_ENABLE_COTIRE)
# using namespace cvf
set_source_files_properties (GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (UnitTests/cvfGeometryTools-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
- set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
# opm parser
- set_source_files_properties (FileInterface/RifReaderOpmParserInput.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (ProjectDataModel/RimProject.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
- set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
- set_source_files_properties (UnitTests/opm-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
@@ -452,21 +436,11 @@ if (RESINSIGHT_PRIVATE_INSTALL)
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "${RESINSIGHT_INSTALL_RPATH}")
- # Find Qt libraries and sym links
- file (GLOB RESINSIGHT_FILES
- ${QT_LIBRARY_DIR}/libQtCore.so*
- ${QT_LIBRARY_DIR}/libQtGui.so*
- ${QT_LIBRARY_DIR}/libQtOpenGL.so*
- ${QT_LIBRARY_DIR}/libQtNetwork.so*
- ${QT_LIBRARY_DIR}/libQtScript.so*
- ${QT_LIBRARY_DIR}/libQtScriptTools.so*
- )
-
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# put a .exe.local file in the target directory to pick up DLLs from there
- install (CODE "exec_program (${CMAKE_COMMAND} ARGS -E touch \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}${RESINSIGHT_FINAL_NAME}/ResInsight${CMAKE_EXECUTABLE_SUFFIX}.local)")
+ install (CODE "exec_program (\"${CMAKE_COMMAND}\" ARGS -E touch \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}ResInsight${CMAKE_EXECUTABLE_SUFFIX}.local)")
set (RESINSIGHT_FILES
${QT_BINARY_DIR}/QtCore4.dll
@@ -485,19 +459,19 @@ if (RESINSIGHT_PRIVATE_INSTALL)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ON)
include(InstallRequiredSystemLibraries)
- install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${RESINSIGHT_FINAL_NAME})
+ install(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${RESINSIGHT_INSTALL_FOLDER})
endif()
set (RESINSIGHT_FILES ${RESINSIGHT_FILES} ${RESINSIGHT_LICENSE_FILES})
- install(TARGETS ResInsight DESTINATION ${RESINSIGHT_FINAL_NAME})
+ install(TARGETS ResInsight DESTINATION ${RESINSIGHT_INSTALL_FOLDER})
- install(FILES ${RESINSIGHT_FILES} DESTINATION ${RESINSIGHT_FINAL_NAME} )
+ install(FILES ${RESINSIGHT_FILES} DESTINATION ${RESINSIGHT_INSTALL_FOLDER} )
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resinsight DESTINATION ${RESINSIGHT_FINAL_NAME} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resinsight DESTINATION ${RESINSIGHT_INSTALL_FOLDER} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
endif()
else (RESINSIGHT_PRIVATE_INSTALL)
diff --git a/ApplicationCode/Commands/ApplicationCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/ApplicationCommands/CMakeLists_files.cmake
index c93e9cf97b..858000503d 100644
--- a/ApplicationCode/Commands/ApplicationCommands/CMakeLists_files.cmake
+++ b/ApplicationCode/Commands/ApplicationCommands/CMakeLists_files.cmake
@@ -17,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h
+${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -32,6 +33,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.cpp
)
list(APPEND CODE_HEADER_FILES
@@ -42,10 +44,10 @@ list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
-#set (QT_MOC_HEADERS
-#${QT_MOC_HEADERS}
-#${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.h
-#)
+set (QT_MOC_HEADERS
+${QT_MOC_HEADERS}
+${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
+)
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicCloseProjectFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicCloseProjectFeature.cpp
index be166c4449..30c1fd1612 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicCloseProjectFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicCloseProjectFeature.cpp
@@ -37,8 +37,12 @@ bool RicCloseProjectFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicCloseProjectFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiaApplication* app = RiaApplication::instance();
+ if (!app->askUserToSaveModifiedProject()) return;
+
app->closeProject();
}
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp
index 7fecdbba4e..28e668088b 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp
@@ -42,6 +42,8 @@ bool RicEditPreferencesFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiaApplication* app = RiaApplication::instance();
QStringList tabNames = app->preferences()->tabNames();
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp
index 9c206256f0..24aaa0dd11 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp
@@ -37,7 +37,11 @@ bool RicExitApplicationFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicExitApplicationFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiaApplication* app = RiaApplication::instance();
+ if (!app->askUserToSaveModifiedProject()) return;
+
app->closeAllWindows();
}
@@ -47,4 +51,5 @@ void RicExitApplicationFeature::onActionTriggered(bool isChecked)
void RicExitApplicationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("E&xit");
+ actionToSetup->setShortcuts(QKeySequence::Quit);
}
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicHelpFeatures.cpp b/ApplicationCode/Commands/ApplicationCommands/RicHelpFeatures.cpp
index 80dc2d4713..e97a449ac0 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicHelpFeatures.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicHelpFeatures.cpp
@@ -48,6 +48,8 @@ bool RicHelpAboutFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicHelpAboutFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
caf::AboutDialog dlg(NULL);
dlg.setApplicationName(RI_APPLICATION_NAME);
@@ -100,6 +102,8 @@ bool RicHelpCommandLineFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicHelpCommandLineFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiaApplication* app = RiaApplication::instance();
QString text = app->commandLineParameterHelp();
app->showFormattedTextInMessageBox(text);
@@ -131,6 +135,8 @@ bool RicHelpOpenUsersGuideFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicHelpOpenUsersGuideFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
QString usersGuideUrl = "http://resinsight.org/docs/home";
if (!QDesktopServices::openUrl(usersGuideUrl))
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.cpp
index 1a3079390b..e7123bc7f1 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.cpp
@@ -39,6 +39,8 @@ bool RicLaunchUnitTestsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicLaunchUnitTestsFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiaApplication::instance()->launchUnitTestsWithConsole();
}
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.cpp
index 2bc4e7662f..70c7580d35 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.cpp
@@ -41,6 +41,9 @@ bool RicOpenLastUsedFileFeature::isCommandEnabled()
void RicOpenLastUsedFileFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
+
+ if (!app->askUserToSaveModifiedProject()) return;
+
QString fileName = app->preferences()->lastUsedProjectFileName;
if (app->loadProject(fileName))
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicOpenProjectFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicOpenProjectFeature.cpp
index bd13d777c9..64f5da34df 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicOpenProjectFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicOpenProjectFeature.cpp
@@ -42,6 +42,9 @@ bool RicOpenProjectFeature::isCommandEnabled()
void RicOpenProjectFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
+
+ if (!app->askUserToSaveModifiedProject()) return;
+
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
QString fileName = QFileDialog::getOpenFileName(NULL, "Open ResInsight Project", defaultDir, "ResInsight project (*.rsp *.rip);;All files(*.*)");
@@ -63,4 +66,5 @@ void RicOpenProjectFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Open Project");
actionToSetup->setIcon(QIcon(":/openFolder24x24.png"));
+ actionToSetup->setShortcuts(QKeySequence::Open);
}
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp
index e06e998393..a8616fb13e 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp
@@ -40,9 +40,9 @@ bool RicSaveProjectAsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicSaveProjectAsFeature::onActionTriggered(bool isChecked)
{
- RiaApplication* app = RiaApplication::instance();
+ this->disableModelChangeContribution();
- RicSaveProjectFeature::storeTreeViewState();
+ RiaApplication* app = RiaApplication::instance();
app->saveProjectPromptForFileName();
}
@@ -54,4 +54,5 @@ void RicSaveProjectAsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Save Project &As");
actionToSetup->setIcon(QIcon(":/Save.png"));
+ actionToSetup->setShortcuts(QKeySequence::SaveAs);
}
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp
index 76be1bab22..8a5c33c660 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp
@@ -20,16 +20,7 @@
#include "RiaApplication.h"
-#include "RimTreeViewStateSerializer.h"
-#include "RimProject.h"
-
-#include "RiuMainWindow.h"
-#include "RiuMainPlotWindow.h"
-
-#include "cafPdmUiTreeView.h"
-
#include
-#include
CAF_CMD_SOURCE_INIT(RicSaveProjectFeature, "RicSaveProjectFeature");
@@ -46,9 +37,9 @@ bool RicSaveProjectFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicSaveProjectFeature::onActionTriggered(bool isChecked)
{
- RiaApplication* app = RiaApplication::instance();
+ this->disableModelChangeContribution();
- RicSaveProjectFeature::storeTreeViewState();
+ RiaApplication* app = RiaApplication::instance();
app->saveProject();
}
@@ -60,47 +51,7 @@ void RicSaveProjectFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&Save Project");
actionToSetup->setIcon(QIcon(":/Save.png"));
+ actionToSetup->setShortcuts(QKeySequence::Save);
}
//--------------------------------------------------------------------------------------------------
-///
-//--------------------------------------------------------------------------------------------------
-void RicSaveProjectFeature::storeTreeViewState()
-{
- {
- RiaApplication* app = RiaApplication::instance();
- if (app->mainPlotWindow() && app->mainPlotWindow()->projectTreeView())
- {
- caf::PdmUiTreeView* projectTreeView = app->mainPlotWindow()->projectTreeView();
-
- QString treeViewState;
- RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
-
- QModelIndex mi = projectTreeView->treeView()->currentIndex();
-
- QString encodedModelIndexString;
- RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
-
- RiaApplication::instance()->project()->plotWindowTreeViewState = treeViewState;
- RiaApplication::instance()->project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
- }
- }
-
- {
- caf::PdmUiTreeView* projectTreeView = RiuMainWindow::instance()->projectTreeView();
- if (projectTreeView)
- {
- QString treeViewState;
- RimTreeViewStateSerializer::storeTreeViewStateToString(projectTreeView->treeView(), treeViewState);
-
- QModelIndex mi = projectTreeView->treeView()->currentIndex();
-
- QString encodedModelIndexString;
- RimTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
-
- RiaApplication::instance()->project()->mainWindowTreeViewState = treeViewState;
- RiaApplication::instance()->project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
- }
- }
-}
-
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.h b/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.h
index 61db41ebc2..f6f2aa73dd 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.h
+++ b/ApplicationCode/Commands/ApplicationCommands/RicSaveProjectFeature.h
@@ -28,9 +28,6 @@ class RicSaveProjectFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
-public:
- static void storeTreeViewState();
-
protected:
// Overrides
virtual bool isCommandEnabled() override;
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp
index 960264631e..83b065e603 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp
@@ -39,6 +39,8 @@ bool RicShowMainWindowFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (mainWnd->isMinimized())
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp
new file mode 100644
index 0000000000..da5bffebb5
--- /dev/null
+++ b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp
@@ -0,0 +1,264 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowPlotDataFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RimSummaryPlot.h"
+#include "RimWellLogPlot.h"
+
+#include "RiuMainPlotWindow.h"
+
+#include "cafSelectionManager.h"
+
+#include
+#include
+#include
+#include
+
+
+CAF_CMD_SOURCE_INIT(RicShowPlotDataFeature, "RicShowPlotDataFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+///
+/// RiuQPlainTextEdit
+///
+///
+//--------------------------------------------------------------------------------------------------
+void RiuQPlainTextEdit::keyPressEvent(QKeyEvent *e)
+{
+ if ( e->key() == Qt::Key_C && e->modifiers() == Qt::ControlModifier )
+ {
+ slotCopyContentToClipboard();
+ e->setAccepted(true);
+ }
+ else
+ {
+ QPlainTextEdit::keyPressEvent(e);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiuQPlainTextEdit::slotCopyContentToClipboard()
+{
+ QTextCursor cursor(this->textCursor());
+
+ QString textForClipboard;
+
+ QString selText = cursor.selectedText();
+ if (!selText.isEmpty())
+ {
+ QTextDocument doc;
+ doc.setPlainText(selText);
+
+ textForClipboard = doc.toPlainText();
+ }
+
+ if (textForClipboard.isEmpty())
+ {
+ textForClipboard = this->toPlainText();
+ }
+
+ if (!textForClipboard.isEmpty())
+ {
+ QClipboard* clipboard = QApplication::clipboard();
+ if (clipboard)
+ {
+ clipboard->setText(textForClipboard);
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RiuQPlainTextEdit::slotSelectAll()
+{
+ this->selectAll();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+///
+/// RicTextWidget
+///
+///
+//--------------------------------------------------------------------------------------------------
+RicTextWidget::RicTextWidget(QWidget* parent)
+ : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
+{
+ m_textEdit = new RiuQPlainTextEdit(this);
+ m_textEdit->setReadOnly(true);
+ m_textEdit->setLineWrapMode(QPlainTextEdit::NoWrap);
+
+ QFont font("Courier", 8);
+ m_textEdit->setFont(font);
+
+ m_textEdit->setContextMenuPolicy(Qt::NoContextMenu);
+
+ QVBoxLayout* layout = new QVBoxLayout();
+ layout->addWidget(m_textEdit);
+ setLayout(layout);
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicTextWidget::setText(const QString& text)
+{
+ m_textEdit->setPlainText(text);
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicTextWidget::contextMenuEvent(QContextMenuEvent* event)
+{
+ QMenu menu;
+
+ {
+ QAction* actionToSetup = new QAction(this);
+
+ actionToSetup->setText("Copy");
+ actionToSetup->setIcon(QIcon(":/Copy.png"));
+ actionToSetup->setShortcuts(QKeySequence::Copy);
+
+ connect(actionToSetup, SIGNAL(triggered()), m_textEdit, SLOT(slotCopyContentToClipboard()));
+
+ menu.addAction(actionToSetup);
+ }
+
+ {
+ QAction* actionToSetup = new QAction(this);
+
+ actionToSetup->setText("Select All");
+ actionToSetup->setShortcuts(QKeySequence::SelectAll);
+
+ connect(actionToSetup, SIGNAL(triggered()), m_textEdit, SLOT(slotSelectAll()));
+
+ menu.addAction(actionToSetup);
+ }
+
+ menu.exec(event->globalPos());
+}
+
+
+
+//--------------------------------------------------------------------------------------------------
+///
+///
+/// RicShowPlotDataFeature
+///
+///
+//--------------------------------------------------------------------------------------------------
+bool RicShowPlotDataFeature::isCommandEnabled()
+{
+ std::vector selectedSummaryPlots;
+ caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
+ if (selectedSummaryPlots.size() > 0) return true;
+
+ std::vector wellLogPlots;
+ caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
+ if (wellLogPlots.size() > 0) return true;
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
+{
+ this->disableModelChangeContribution();
+
+ std::vector selectedSummaryPlots;
+ caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
+
+ std::vector wellLogPlots;
+ caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
+
+ if (selectedSummaryPlots.size() == 0 && wellLogPlots.size() == 0)
+ {
+ CVF_ASSERT(false);
+
+ return;
+ }
+
+ RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
+ CVF_ASSERT(plotwindow);
+
+ for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
+ {
+ QString title = summaryPlot->description();
+ QString text = summaryPlot->asciiDataForPlotExport();
+
+ RicShowPlotDataFeature::showTextWindow(title, text);
+ }
+
+ for (RimWellLogPlot* wellLogPlot : wellLogPlots)
+ {
+ QString title = wellLogPlot->description();
+ QString text = wellLogPlot->asciiDataForPlotExport();
+
+ RicShowPlotDataFeature::showTextWindow(title, text);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowPlotDataFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Plot Data");
+ actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
+}
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowPlotDataFeature::showTextWindow(const QString& title, const QString& text)
+{
+ RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
+ CVF_ASSERT(plotwindow);
+
+ RicTextWidget* textWiget = new RicTextWidget(plotwindow);
+ textWiget->setMinimumSize(400, 600);
+
+ textWiget->setWindowTitle(title);
+ textWiget->setText(text);
+
+ textWiget->show();
+
+ plotwindow->addToTemporaryWidgets(textWiget);
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h
new file mode 100644
index 0000000000..a3b06014bc
--- /dev/null
+++ b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h
@@ -0,0 +1,80 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+#include
+#include
+
+
+class RiuQPlainTextEdit : public QPlainTextEdit
+{
+ Q_OBJECT
+public:
+ explicit RiuQPlainTextEdit(QWidget *parent = 0) : QPlainTextEdit(parent) {}
+
+protected:
+ virtual void keyPressEvent(QKeyEvent *e) override;
+
+private slots:
+ void slotCopyContentToClipboard();
+ void slotSelectAll();
+
+};
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+class RicTextWidget : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit RicTextWidget(QWidget* parent = 0);
+
+ void setText(const QString& text);
+
+private:
+ RiuQPlainTextEdit* m_textEdit;
+protected:
+ virtual void contextMenuEvent(QContextMenuEvent *) override;
+
+};
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowPlotDataFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled();
+ virtual void onActionTriggered( bool isChecked );
+ virtual void setupActionLook( QAction* actionToSetup );
+
+public:
+ static void showTextWindow(const QString& title, const QString& text);
+};
+
+
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.cpp
index dfaf8d4f49..62085d6b09 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.cpp
@@ -37,6 +37,8 @@ bool RicShowPlotWindowFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicShowPlotWindowFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
diff --git a/ApplicationCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp
index d46689ecaf..2160d83258 100644
--- a/ApplicationCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp
+++ b/ApplicationCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp
@@ -47,6 +47,8 @@ bool RicTileWindowsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicTileWindowsFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RiuMainWindow* mainWindow = RiuMainWindow::instance();
if (mainWindow)
{
diff --git a/ApplicationCode/Commands/CMakeLists_files.cmake b/ApplicationCode/Commands/CMakeLists_files.cmake
index 8ce105d653..806e5bc397 100644
--- a/ApplicationCode/Commands/CMakeLists_files.cmake
+++ b/ApplicationCode/Commands/CMakeLists_files.cmake
@@ -35,13 +35,18 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h
+${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h
+
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
+${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
+
+${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -72,11 +77,16 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.cpp
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
+
+${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
+
+${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
)
list(APPEND CODE_HEADER_FILES
diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h b/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h
index 58fa795d27..ccadce2511 100644
--- a/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h
+++ b/ApplicationCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h
@@ -32,7 +32,7 @@ class RimIntersectionCollection;
class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
- RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
+ explicit RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicAppendIntersectionFeatureCmd();
virtual QString name();
diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.h b/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.h
index 0381ff5f1e..b32ee3d997 100644
--- a/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.h
+++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewPolylineIntersectionFeature.h
@@ -37,7 +37,7 @@ class RimIntersectionCollection;
class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
- RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
+ explicit RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicNewPolylineIntersectionFeatureCmd();
virtual QString name();
diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp
index e273ae30e2..67e792d0c9 100644
--- a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp
+++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp
@@ -75,7 +75,7 @@ void RicNewSimWellIntersectionFeature::setupActionLook(QAction* actionToSetup)
RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimEclipseWell* simWell)
: CmdExecuteCommand(NULL),
m_intersectionCollection(intersectionCollection),
- m_wellPath(simWell)
+ m_simWell(simWell)
{
}
@@ -100,12 +100,12 @@ QString RicNewSimWellIntersectionCmd::name()
void RicNewSimWellIntersectionCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
- CVF_ASSERT(m_wellPath);
+ CVF_ASSERT(m_simWell);
RimIntersection* intersection = new RimIntersection();
- intersection->name = m_wellPath->name;
+ intersection->name = m_simWell->name;
intersection->type = RimIntersection::CS_SIMULATION_WELL;
- intersection->simulationWell = m_wellPath;
+ intersection->simulationWell = m_simWell;
m_intersectionCollection->appendIntersection(intersection);
}
diff --git a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h
index e3b0ed1be2..b5dbf8377a 100644
--- a/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h
+++ b/ApplicationCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h
@@ -42,7 +42,7 @@ class RicNewSimWellIntersectionCmd : public caf::CmdExecuteCommand
private:
caf::PdmPointer m_intersectionCollection;
- caf::PdmPointer m_wellPath;
+ caf::PdmPointer m_simWell;
};
diff --git a/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake
index 767483654c..920f7417c1 100644
--- a/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake
+++ b/ApplicationCode/Commands/EclipseCommands/CMakeLists_files.cmake
@@ -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,16 +17,15 @@ ${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
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h
+${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
@@ -39,11 +37,11 @@ ${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
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.cpp
)
list(APPEND CODE_HEADER_FILES
diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake b/ApplicationCode/Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
new file mode 100644
index 0000000000..27f3295bad
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
@@ -0,0 +1,25 @@
+
+# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
+if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
+ set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
+endif()
+
+set (SOURCE_GROUP_HEADER_FILES
+${CEE_CURRENT_LIST_DIR}RicEclipseWellFeatureImpl.h
+${CEE_CURRENT_LIST_DIR}RicEclipseWellShowFeatures.h
+)
+
+set (SOURCE_GROUP_SOURCE_FILES
+${CEE_CURRENT_LIST_DIR}RicEclipseWellFeatureImpl.cpp
+${CEE_CURRENT_LIST_DIR}RicEclipseWellShowFeatures.cpp
+)
+
+list(APPEND CODE_HEADER_FILES
+${SOURCE_GROUP_HEADER_FILES}
+)
+
+list(APPEND CODE_SOURCE_FILES
+${SOURCE_GROUP_SOURCE_FILES}
+)
+
+source_group( "CommandFeature\\Eclipse\\Well" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp
new file mode 100644
index 0000000000..24caf44c5c
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp
@@ -0,0 +1,71 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicEclipseWellFeatureImpl.h"
+
+#include "RimEclipseWell.h"
+#include "RimEclipseWellCollection.h"
+
+#include "cafSelectionManager.h"
+
+#include
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellFeatureImpl::isAnyWellSelected()
+{
+ std::vector selection = selectedWells();
+ if (selection.size() > 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+std::vector RicEclipseWellFeatureImpl::selectedWells()
+{
+ std::vector selection;
+ caf::SelectionManager::instance()->objectsByType(&selection);
+
+ return selection;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RimEclipseWellCollection* RicEclipseWellFeatureImpl::wellCollectionFromSelection()
+{
+ std::vector selection = selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* firstWell = selection[0];
+
+ RimEclipseWellCollection* wellCollection = nullptr;
+ firstWell->firstAncestorOrThisOfType(wellCollection);
+
+ return wellCollection;
+ }
+
+ return nullptr;
+}
+
diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.h b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.h
new file mode 100644
index 0000000000..3986e77bf5
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.h
@@ -0,0 +1,35 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include
+
+class RimEclipseWell;
+class RimEclipseWellCollection;
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellFeatureImpl
+{
+public:
+ static bool isAnyWellSelected();
+ static std::vector selectedWells();
+ static RimEclipseWellCollection* wellCollectionFromSelection();
+};
diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp
new file mode 100644
index 0000000000..d4daa955a9
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp
@@ -0,0 +1,352 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicEclipseWellShowFeatures.h"
+
+#include "RicEclipseWellFeatureImpl.h"
+
+#include "RimEclipseWell.h"
+#include "RimEclipseWellCollection.h"
+
+#include
+
+
+
+CAF_CMD_SOURCE_INIT(RicEclipseWellShowLabelFeature, "RicEclipseWellShowLabelFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowLabelFeature::onActionTriggered(bool isChecked)
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ for (RimEclipseWell* w : selection)
+ {
+ w->showWellLabel.setValueWithFieldChanged(isChecked);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowLabelFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Well Label");
+ actionToSetup->setCheckable(true);
+ actionToSetup->setChecked(isCommandChecked());
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowLabelFeature::isCommandEnabled()
+{
+ return RicEclipseWellFeatureImpl::isAnyWellSelected();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowLabelFeature::isCommandChecked()
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* well = selection[0];
+
+ return well->showWellLabel();
+ }
+
+ return false;
+}
+
+
+
+
+
+
+
+
+CAF_CMD_SOURCE_INIT(RicEclipseWellShowHeadFeature, "RicEclipseWellShowHeadFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowHeadFeature::onActionTriggered(bool isChecked)
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ for (RimEclipseWell* w : selection)
+ {
+ w->showWellHead.setValueWithFieldChanged(isChecked);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowHeadFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Well Head");
+ actionToSetup->setCheckable(true);
+ actionToSetup->setChecked(isCommandChecked());
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowHeadFeature::isCommandEnabled()
+{
+ return RicEclipseWellFeatureImpl::isAnyWellSelected();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowHeadFeature::isCommandChecked()
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* well = selection[0];
+
+ return well->showWellHead();
+ }
+
+ return false;
+}
+
+
+
+
+
+
+
+
+
+CAF_CMD_SOURCE_INIT(RicEclipseWellShowPipeFeature, "RicEclipseWellShowPipeFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowPipeFeature::onActionTriggered(bool isChecked)
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ for (RimEclipseWell* w : selection)
+ {
+ w->showWellPipe.setValueWithFieldChanged(isChecked);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowPipeFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Well Pipes");
+ actionToSetup->setCheckable(true);
+ actionToSetup->setChecked(isCommandChecked());
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowPipeFeature::isCommandEnabled()
+{
+ return RicEclipseWellFeatureImpl::isAnyWellSelected();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowPipeFeature::isCommandChecked()
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* well = selection[0];
+
+ return well->showWellPipe();
+ }
+
+ return false;
+}
+
+
+
+
+
+
+
+
+CAF_CMD_SOURCE_INIT(RicEclipseWellShowSpheresFeature, "RicEclipseWellShowSpheresFeature");
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowSpheresFeature::onActionTriggered(bool isChecked)
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ for (RimEclipseWell* w : selection)
+ {
+ w->showWellSpheres.setValueWithFieldChanged(isChecked);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowSpheresFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Well Spheres");
+ actionToSetup->setCheckable(true);
+ actionToSetup->setChecked(isCommandChecked());
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowSpheresFeature::isCommandEnabled()
+{
+ return RicEclipseWellFeatureImpl::isAnyWellSelected();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowSpheresFeature::isCommandChecked()
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* well = selection[0];
+
+ return well->showWellSpheres();
+ }
+
+ return false;
+}
+
+
+
+
+
+
+
+
+CAF_CMD_SOURCE_INIT(RicEclipseWellShowWellCellsFeature, "RicEclipseWellShowWellCellsFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowWellCellsFeature::onActionTriggered(bool isChecked)
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ for (RimEclipseWell* w : selection)
+ {
+ w->showWellCells.setValueWithFieldChanged(isChecked);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowWellCellsFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Well Cells");
+ actionToSetup->setCheckable(true);
+ actionToSetup->setChecked(isCommandChecked());
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowWellCellsFeature::isCommandEnabled()
+{
+ return RicEclipseWellFeatureImpl::isAnyWellSelected();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowWellCellsFeature::isCommandChecked()
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* well = selection[0];
+
+ return well->showWellCells();
+ }
+
+ return false;
+}
+
+
+
+
+
+
+
+CAF_CMD_SOURCE_INIT(RicEclipseWellShowWellCellFenceFeature, "RicEclipseWellShowWellCellFenceFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowWellCellFenceFeature::onActionTriggered(bool isChecked)
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ for (RimEclipseWell* w : selection)
+ {
+ w->showWellCellFence.setValueWithFieldChanged(isChecked);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicEclipseWellShowWellCellFenceFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Well Cell Fence");
+ actionToSetup->setCheckable(true);
+ actionToSetup->setChecked(isCommandChecked());
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowWellCellFenceFeature::isCommandEnabled()
+{
+ return RicEclipseWellFeatureImpl::isAnyWellSelected();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicEclipseWellShowWellCellFenceFeature::isCommandChecked()
+{
+ std::vector selection = RicEclipseWellFeatureImpl::selectedWells();
+ if (selection.size() > 0)
+ {
+ RimEclipseWell* well = selection[0];
+
+ return well->showWellCellFence();
+ }
+
+ return false;
+}
diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.h b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.h
new file mode 100644
index 0000000000..2b794d3256
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.h
@@ -0,0 +1,107 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellShowLabelFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+ virtual bool isCommandEnabled() override;
+ virtual bool isCommandChecked() override;
+};
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellShowHeadFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+ virtual bool isCommandEnabled() override;
+ virtual bool isCommandChecked() override;
+};
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellShowPipeFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+ virtual bool isCommandEnabled() override;
+ virtual bool isCommandChecked() override;
+};
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellShowSpheresFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+ virtual bool isCommandEnabled() override;
+ virtual bool isCommandChecked() override;
+};
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellShowWellCellsFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+ virtual bool isCommandEnabled() override;
+ virtual bool isCommandChecked() override;
+};
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicEclipseWellShowWellCellFenceFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+ virtual bool isCommandEnabled() override;
+ virtual bool isCommandChecked() override;
+};
+
diff --git a/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp
index dd87823d9f..de61fc1a35 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.cpp
@@ -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;
}
diff --git a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp
deleted file mode 100644
index 2d2cd2a4da..0000000000
--- a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.cpp
+++ /dev/null
@@ -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
-// for more details.
-//
-/////////////////////////////////////////////////////////////////////////////////
-
-#include "RicAddOpmInputPropertyFeature.h"
-
-#include "RiaApplication.h"
-#include "RimEclipseInputCaseOpm.h"
-#include "RimEclipseInputPropertyCollection.h"
-#include "RiuMainWindow.h"
-
-#include "cafSelectionManager.h"
-
-#include
-#include
-#include
-#include
-
-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 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();
-}
-
-
diff --git a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h b/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h
deleted file mode 100644
index e5ca7facf8..0000000000
--- a/ApplicationCode/Commands/EclipseCommands/RicAddOpmInputPropertyFeature.h
+++ /dev/null
@@ -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
-// 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);
-};
-
-
diff --git a/ApplicationCode/Commands/EclipseCommands/RicApplyPropertyFilterAsCellResultFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicApplyPropertyFilterAsCellResultFeature.cpp
new file mode 100644
index 0000000000..a9ab8dff7c
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/RicApplyPropertyFilterAsCellResultFeature.cpp
@@ -0,0 +1,121 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicApplyPropertyFilterAsCellResultFeature.h"
+
+#include "RimEclipseCellColors.h"
+#include "RimEclipsePropertyFilter.h"
+#include "RimEclipseView.h"
+
+#include "RimGeoMechPropertyFilter.h"
+#include "RimGeoMechResultDefinition.h"
+#include "RimGeoMechView.h"
+
+#include "cafSelectionManager.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicApplyPropertyFilterAsCellResultFeature, "RicApplyPropertyFilterAsCellResultFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicApplyPropertyFilterAsCellResultFeature::isCommandEnabled()
+{
+ {
+ std::vector objects;
+ caf::SelectionManager::instance()->objectsByType(&objects);
+
+ if (objects.size() == 1)
+ {
+ return true;
+ }
+ }
+
+ {
+ std::vector objects;
+ caf::SelectionManager::instance()->objectsByType(&objects);
+
+ if (objects.size() == 1)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered(bool isChecked)
+{
+ {
+ std::vector objects;
+ caf::SelectionManager::instance()->objectsByType(&objects);
+
+ if (objects.size() == 1)
+ {
+ RimEclipsePropertyFilter* propertyFilter = objects[0];
+ if (!propertyFilter) return;
+
+ RimEclipseView* rimEclipseView = nullptr;
+ propertyFilter->firstAncestorOrThisOfType(rimEclipseView);
+ if (!rimEclipseView) return;
+
+ rimEclipseView->cellResult()->simpleCopy(propertyFilter->resultDefinition());
+ rimEclipseView->cellResult()->updateConnectedEditors();
+
+ rimEclipseView->scheduleCreateDisplayModelAndRedraw();
+
+ return;
+ }
+ }
+
+ {
+ std::vector objects;
+ caf::SelectionManager::instance()->objectsByType(&objects);
+
+ if (objects.size() == 1)
+ {
+ RimGeoMechPropertyFilter* propertyFilter = objects[0];
+ if (!propertyFilter) return;
+
+ RimGeoMechView* geoMechView = nullptr;
+ propertyFilter->firstAncestorOrThisOfType(geoMechView);
+ if (!geoMechView) return;
+
+ geoMechView->cellResultResultDefinition()->setResultAddress(propertyFilter->resultDefinition()->resultAddress());
+ geoMechView->cellResultResultDefinition()->updateConnectedEditors();
+
+ geoMechView->scheduleCreateDisplayModelAndRedraw();
+
+ return;
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicApplyPropertyFilterAsCellResultFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Apply As Cell Result");
+ actionToSetup->setIcon(QIcon(":/CellResult.png"));
+}
+
diff --git a/ApplicationCode/Commands/EclipseCommands/RicApplyPropertyFilterAsCellResultFeature.h b/ApplicationCode/Commands/EclipseCommands/RicApplyPropertyFilterAsCellResultFeature.h
new file mode 100644
index 0000000000..bfbe11beea
--- /dev/null
+++ b/ApplicationCode/Commands/EclipseCommands/RicApplyPropertyFilterAsCellResultFeature.h
@@ -0,0 +1,36 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicApplyPropertyFilterAsCellResultFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+};
+
diff --git a/ApplicationCode/Commands/EclipseCommands/RicCreateGridCaseGroupFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicCreateGridCaseGroupFeature.cpp
index 6da72f89c2..c5f69fe3de 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicCreateGridCaseGroupFeature.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicCreateGridCaseGroupFeature.cpp
@@ -34,10 +34,7 @@ CAF_CMD_SOURCE_INIT(RicCreateGridCaseGroupFeature, "RicCreateGridCaseGroupFeatur
//--------------------------------------------------------------------------------------------------
bool RicCreateGridCaseGroupFeature::isCommandEnabled()
{
- std::vector selection;
- caf::SelectionManager::instance()->objectsByType(&selection);
-
- return selection.size() > 0;
+ return true;
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp
index b63ede27be..193f16204c 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterFeatureImpl.cpp
@@ -63,6 +63,7 @@ void RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(RimEclipsePropertyFi
setDefaults(propertyFilter);
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
+ propertyFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(propertyFilter);
@@ -79,6 +80,7 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter(RimEclipsePropert
setDefaults(propertyFilter);
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
+ propertyFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(propertyFilter);
@@ -110,18 +112,17 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
{
CVF_ASSERT(propertyFilter);
- RimEclipsePropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
- CVF_ASSERT(propertyFilterCollection);
+ RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
+ propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
- RimEclipseView* reservoirView = propertyFilterCollection->reservoirView();
- CVF_ASSERT(reservoirView);
+ RimEclipseView* reservoirView = nullptr;
+ propertyFilter->firstAncestorOrThisOfTypeAsserted(reservoirView);
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
- propertyFilter->resultDefinition->setResultVariable(reservoirView->cellResult->resultVariable());
- propertyFilter->resultDefinition->setPorosityModel(reservoirView->cellResult->porosityModel());
- propertyFilter->resultDefinition->setResultType(reservoirView->cellResult->resultType());
+ propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);
+
propertyFilter->resultDefinition->loadResult();
propertyFilter->setToDefaultValues();
propertyFilter->updateFilterName();
- propertyFilter->m_categorySelection = true;
+ propertyFilter->m_useCategorySelection = true;
}
diff --git a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp
index 0eb7f9c956..d15e954280 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp
@@ -57,8 +57,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterInsertExec::redo()
{
- RimEclipsePropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer();
- CVF_ASSERT(propertyFilterCollection);
+ RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
+ m_propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());
diff --git a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.h b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.h
index 727a30d8fc..f996fb5240 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.h
+++ b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.h
@@ -30,7 +30,7 @@ class RimEclipsePropertyFilter;
class RicEclipsePropertyFilterInsertExec : public caf::CmdExecuteCommand
{
public:
- RicEclipsePropertyFilterInsertExec(RimEclipsePropertyFilter* propertyFilter);
+ explicit RicEclipsePropertyFilterInsertExec(RimEclipsePropertyFilter* propertyFilter);
virtual ~RicEclipsePropertyFilterInsertExec();
virtual QString name();
diff --git a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewExec.h b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewExec.h
index f890ce57e6..f20f8d0481 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewExec.h
+++ b/ApplicationCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewExec.h
@@ -30,7 +30,7 @@ class RimEclipsePropertyFilterCollection;
class RicEclipsePropertyFilterNewExec : public caf::CmdExecuteCommand
{
public:
- RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection);
+ explicit RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection);
virtual ~RicEclipsePropertyFilterNewExec();
virtual QString name();
diff --git a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp
deleted file mode 100644
index 22406bab93..0000000000
--- a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.cpp
+++ /dev/null
@@ -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
-// 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
-#include
-
-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");
-}
diff --git a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h b/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h
deleted file mode 100644
index 6df4d3fd15..0000000000
--- a/ApplicationCode/Commands/EclipseCommands/RicImportInputEclipseCaseOpmFeature.h
+++ /dev/null
@@ -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
-// for more details.
-//
-/////////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include "cafCmdFeature.h"
-
-#include
-
-//==================================================================================================
-///
-//==================================================================================================
-class RicImportInputEclipseCaseOpmFeature : public caf::CmdFeature
-{
- CAF_CMD_HEADER_INIT;
-
-protected:
- // Overrides
- virtual bool isCommandEnabled();
- virtual void onActionTriggered( bool isChecked );
- virtual void setupActionLook( QAction* actionToSetup );
-};
-
-
diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp
index b027dddf4d..ac8a2ec421 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseInputPropertyFeature.cpp
@@ -51,6 +51,8 @@ bool RicSaveEclipseInputPropertyFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
RimEclipseInputProperty* inputProperty = selectedInputProperty();
if (!inputProperty) return;
@@ -99,7 +101,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
- bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->reservoirData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword);
+ bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->eclipseCaseData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword);
if (isOk)
{
inputProperty->fileName = exportSettings.fileName;
@@ -116,7 +118,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicSaveEclipseInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{
- actionToSetup->setText("Save Property To File");
+ actionToSetup->setText("Export Property To File");
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp
index 49f274112a..b28c89474f 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp
@@ -24,7 +24,6 @@
#include "RimEclipseView.h"
#include "RimEclipseCase.h"
-#include "RigCaseData.h"
#include "RigCaseCellResultsData.h"
#include "RifEclipseInputFileTools.h"
@@ -37,6 +36,7 @@
#include
#include
+#include "cafUtils.h"
//--------------------------------------------------------------------------------------------------
///
@@ -60,7 +60,7 @@ RicSaveEclipseResultAsInputPropertyExec::~RicSaveEclipseResultAsInputPropertyExe
//--------------------------------------------------------------------------------------------------
QString RicSaveEclipseResultAsInputPropertyExec::name()
{
- return "Save Property To File";
+ return "Export Property To File";
}
//--------------------------------------------------------------------------------------------------
@@ -72,7 +72,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
if (!m_cellColors->reservoirView()) return;
if (!m_cellColors->reservoirView()->eclipseCase()) return;
- if (!m_cellColors->reservoirView()->eclipseCase()->reservoirData()) return;
+ if (!m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData()) return;
RimBinaryExportSettings exportSettings;
exportSettings.eclipseKeyword = m_cellColors->resultVariable();
@@ -84,18 +84,18 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
}
- QString outputFileName = projectFolder + "/" + m_cellColors->resultVariable();
+ QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiShortName());
exportSettings.fileName = outputFileName;
}
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", "");
+
if (propertyDialog.exec() == QDialog::Accepted)
{
size_t timeStep = m_cellColors->reservoirView()->currentTimeStep();
- RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_cellColors->porosityModel());
- bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->reservoirData(), porosityModel, timeStep, m_cellColors->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue);
+ bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(), timeStep, m_cellColors, exportSettings.eclipseKeyword, exportSettings.undefinedValue);
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);
diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.h b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.h
index bfba44995b..6a949fc021 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.h
+++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.h
@@ -30,7 +30,7 @@ class RimEclipseCellColors;
class RicSaveEclipseResultAsInputPropertyExec : public caf::CmdExecuteCommand
{
public:
- RicSaveEclipseResultAsInputPropertyExec(RimEclipseCellColors* cellColors);
+ explicit RicSaveEclipseResultAsInputPropertyExec(RimEclipseCellColors* cellColors);
virtual ~RicSaveEclipseResultAsInputPropertyExec();
virtual QString name();
diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp
index 683bd05075..52d4f4a443 100644
--- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp
+++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyFeature.cpp
@@ -47,6 +47,8 @@ bool RicSaveEclipseResultAsInputPropertyFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
std::vector selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() == 1)
@@ -61,7 +63,7 @@ void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecke
//--------------------------------------------------------------------------------------------------
void RicSaveEclipseResultAsInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{
- actionToSetup->setText("Save Property To File");
+ actionToSetup->setText("Export Property To File");
}
diff --git a/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake
new file mode 100644
index 0000000000..267d09bca3
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake
@@ -0,0 +1,39 @@
+
+# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
+if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
+ set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
+endif()
+
+set (SOURCE_GROUP_HEADER_FILES
+${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
+${CEE_CURRENT_LIST_DIR}RicShowFlowCharacteristicsPlotFeature.h
+${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h
+${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h
+${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
+${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
+${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
+${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
+${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.h
+)
+
+set (SOURCE_GROUP_SOURCE_FILES
+${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicShowFlowCharacteristicsPlotFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
+${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
+${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
+${CEE_CURRENT_LIST_DIR}RicShowTotalAllocationDataFeature.cpp
+)
+
+list(APPEND CODE_HEADER_FILES
+${SOURCE_GROUP_HEADER_FILES}
+)
+
+list(APPEND CODE_SOURCE_FILES
+${SOURCE_GROUP_SOURCE_FILES}
+)
+
+source_group( "CommandFeature\\FlowDiagnostics" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
diff --git a/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp
new file mode 100644
index 0000000000..d65d102229
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp
@@ -0,0 +1,99 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicAddStoredWellAllocationPlotFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RimFlowPlotCollection.h"
+#include "RimMainPlotCollection.h"
+#include "RimProject.h"
+#include "RimWellAllocationPlot.h"
+
+#include "RiuMainPlotWindow.h"
+
+#include "cafSelectionManager.h"
+
+#include "cvfAssert.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicAddStoredWellAllocationPlotFeature, "RicAddStoredWellAllocationPlotFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicAddStoredWellAllocationPlotFeature::isCommandEnabled()
+{
+ if (RiaApplication::instance()->project())
+ {
+ RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
+ if (flowPlotColl)
+ {
+ RimWellAllocationPlot* wellAllocationPlot = dynamic_cast(caf::SelectionManager::instance()->selectedItem());
+
+ if (flowPlotColl->defaultWellAllocPlot() == wellAllocationPlot)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicAddStoredWellAllocationPlotFeature::onActionTriggered(bool isChecked)
+{
+ if (RiaApplication::instance()->project())
+ {
+ RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
+ if (flowPlotColl)
+ {
+ RimWellAllocationPlot* sourceObject = dynamic_cast(caf::SelectionManager::instance()->selectedItem());
+
+ RimWellAllocationPlot* wellAllocationPlot = dynamic_cast(sourceObject->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
+ CVF_ASSERT(wellAllocationPlot);
+
+ flowPlotColl->addWellAllocPlotToStoredPlots(wellAllocationPlot);
+ wellAllocationPlot->resolveReferencesRecursively();
+
+ wellAllocationPlot->loadDataAndUpdate();
+
+ flowPlotColl->updateConnectedEditors();
+
+ RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
+ if (mainPlotWindow)
+ {
+ mainPlotWindow->selectAsCurrentItem(wellAllocationPlot);
+ mainPlotWindow->setExpanded(wellAllocationPlot, true);
+ }
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicAddStoredWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
+{
+ //actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
+ actionToSetup->setText("Add Stored Well Allocation Plot");
+}
diff --git a/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h b/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h
new file mode 100644
index 0000000000..651e2eaa17
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h
@@ -0,0 +1,38 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicAddStoredWellAllocationPlotFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered( bool isChecked ) override;
+ virtual void setupActionLook( QAction* actionToSetup ) override;
+};
+
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp
new file mode 100644
index 0000000000..9098e6f4e3
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp
@@ -0,0 +1,307 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicPlotProductionRateFeature.h"
+
+#include "RiaApplication.h"
+#include "RiaPreferences.h"
+
+#include "RifEclipseSummaryAddress.h"
+#include "RifReaderEclipseSummary.h"
+
+#include "RigSingleWellResultsData.h"
+#include "RigSummaryCaseData.h"
+
+#include "RimEclipseResultCase.h"
+#include "RimEclipseWell.h"
+#include "RimGridSummaryCase.h"
+#include "RimMainPlotCollection.h"
+#include "RimOilField.h"
+#include "RimProject.h"
+#include "RimSummaryCaseCollection.h"
+#include "RimSummaryCurve.h"
+#include "RimSummaryCurveAppearanceCalculator.h"
+#include "RimSummaryPlot.h"
+#include "RimSummaryPlotCollection.h"
+#include "RimView.h"
+
+#include "RiuMainPlotWindow.h"
+#include "RiuMainWindow.h"
+
+#include "cafSelectionManager.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicPlotProductionRateFeature, "RicPlotProductionRateFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicPlotProductionRateFeature::isCommandEnabled()
+{
+ std::vector collection;
+ caf::SelectionManager::instance()->objectsByType(&collection);
+
+ for (RimEclipseWell* well : collection)
+ {
+ RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
+ if (gridSummaryCase)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
+{
+ RimProject* project = RiaApplication::instance()->project();
+ CAF_ASSERT(project);
+
+ RimSummaryCaseCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseCollection() : nullptr;
+ if (!sumCaseColl) return;
+
+ RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
+ CAF_ASSERT(mainPlotColl);
+
+ RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
+ CAF_ASSERT(summaryPlotColl);
+
+ std::vector collection;
+ caf::SelectionManager::instance()->objectsByType(&collection);
+
+ RimSummaryPlot* summaryPlotToSelect = nullptr;
+
+ for (RimEclipseWell* well : collection)
+ {
+ RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
+ if (!gridSummaryCase) continue;
+
+ QString description = "Well Production Rates : ";
+
+ if (isInjector(well))
+ {
+ description = "Well Injection Rates : ";
+ }
+
+ RimSummaryPlot* plot = new RimSummaryPlot();
+ summaryPlotColl->summaryPlots().push_back(plot);
+
+ description += well->name();
+ plot->setDescription(description);
+
+ if (isInjector(well))
+ {
+ // Left Axis
+
+ RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_LEFT;
+
+ {
+ // Note : The parameter "WOIR" is probably never-existing, but we check for existence before creating curve
+ // Oil
+ QString parameterName = "WOIR";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
+ }
+
+ {
+ // Water
+ QString parameterName = "WWIR";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
+ }
+
+ {
+ // Gas
+ QString parameterName = "WGIR";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
+ }
+ }
+ else
+ {
+ // Left Axis
+
+ RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_LEFT;
+
+ {
+ // Oil
+ QString parameterName = "WOPR";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
+ }
+
+ {
+ // Water
+ QString parameterName = "WWPR";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
+ }
+
+ {
+ // Gas
+ QString parameterName = "WGPR";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
+ }
+ }
+
+
+ // Right Axis
+
+ {
+ RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_RIGHT;
+
+ {
+ QString parameterName = "WTHP";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(0));
+ }
+
+ {
+ QString parameterName = "WBHP";
+ RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
+ plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(1));
+ }
+ }
+
+ summaryPlotColl->updateConnectedEditors();
+ plot->loadDataAndUpdate();
+
+ summaryPlotToSelect = plot;
+ }
+
+ if (summaryPlotToSelect)
+ {
+ RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
+ if (mainPlotWindow)
+ {
+ mainPlotWindow->selectAsCurrentItem(summaryPlotToSelect);
+ mainPlotWindow->setExpanded(summaryPlotToSelect, true);
+
+ mainPlotWindow->tileWindows();
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicPlotProductionRateFeature::setupActionLook(QAction* actionToSetup)
+{
+ //actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
+ actionToSetup->setText("Plot Production Rates");
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell(RimEclipseWell* well)
+{
+ RimProject* project = RiaApplication::instance()->project();
+ if (!project) return nullptr;
+
+ RimSummaryCaseCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseCollection() : nullptr;
+ if (!sumCaseColl) return nullptr;
+
+ RimEclipseResultCase* eclCase = nullptr;
+ well->firstAncestorOrThisOfType(eclCase);
+ if (eclCase)
+ {
+ RimGridSummaryCase* gridSummaryCase = dynamic_cast(sumCaseColl->findSummaryCaseFromEclipseResultCase(eclCase));
+ if (gridSummaryCase)
+ {
+ return gridSummaryCase;
+ }
+ }
+
+ return nullptr;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicPlotProductionRateFeature::isInjector(RimEclipseWell* well)
+{
+ RigSingleWellResultsData* wRes = well->wellResults();
+ if (wRes)
+ {
+ RimView* rimView = nullptr;
+ well->firstAncestorOrThisOfTypeAsserted(rimView);
+
+ int currentTimeStep = rimView->currentTimeStep();
+
+ if (wRes->hasWellResult(currentTimeStep))
+ {
+ const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
+
+ if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
+ || wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
+ || wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* plot, const RimEclipseWell* well,
+ RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
+ RimDefines::PlotAxis plotAxis, const cvf::Color3f& color)
+{
+ CVF_ASSERT(plot);
+ CVF_ASSERT(gridSummaryCase);
+ CVF_ASSERT(well);
+
+ RifEclipseSummaryAddress addr(RifEclipseSummaryAddress::SUMMARY_WELL,
+ vectorName.toStdString(),
+ -1,
+ -1,
+ "",
+ well->name().toStdString(),
+ -1,
+ "",
+ -1,
+ -1,
+ -1);
+
+ if (!gridSummaryCase->caseData()->summaryReader()->hasAddress(addr))
+ {
+ return nullptr;
+ }
+
+ RimSummaryCurve* newCurve = new RimSummaryCurve();
+ plot->addCurve(newCurve);
+
+ newCurve->setSummaryCase(gridSummaryCase);
+ newCurve->setSummaryAddress(addr);
+ newCurve->setColor(color);
+ newCurve->setYAxis(plotAxis);
+
+ return newCurve;
+}
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.h b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.h
new file mode 100644
index 0000000000..592d8780fb
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicPlotProductionRateFeature.h
@@ -0,0 +1,52 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+#include "RimFlowDiagSolution.h"
+#include "RimDefines.h"
+
+class RimGridSummaryCase;
+class RimEclipseWell;
+class RimSummaryPlot;
+class RimSummaryCurve;
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicPlotProductionRateFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered( bool isChecked ) override;
+ virtual void setupActionLook( QAction* actionToSetup ) override;
+
+private:
+ static RimGridSummaryCase* gridSummaryCaseForWell(RimEclipseWell* well);
+ static bool isInjector(RimEclipseWell* well);
+ static RimSummaryCurve* addSummaryCurve(RimSummaryPlot* plot, const RimEclipseWell* well,
+ RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
+ RimDefines::PlotAxis plotAxis, const cvf::Color3f& color);
+};
+
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp
new file mode 100644
index 0000000000..158439567a
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.cpp
@@ -0,0 +1,131 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicSelectViewUI.h"
+
+#include "RimEclipseResultCase.h"
+#include "RimEclipseView.h"
+
+
+CAF_PDM_SOURCE_INIT(RicSelectViewUI, "RicSelectViewUI");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RicSelectViewUI::RicSelectViewUI()
+{
+ CAF_PDM_InitObject("RicSelectViewUI", "", "", "");
+
+ CAF_PDM_InitFieldNoDefault(&m_selectedView, "MasterView", "Select view", "", "", "");
+ CAF_PDM_InitField(&m_createNewView, "CreateNewView", false, "Create New View", "", "", "");
+ CAF_PDM_InitField(&m_newViewName, "NewViewName", QString("ShowContributingWells"), "New View Name", "", "", "");
+
+ m_currentView = nullptr;
+ m_currentCase = nullptr;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicSelectViewUI::setView(RimEclipseView* currentView)
+{
+ m_currentView = currentView;
+
+ m_currentView->firstAncestorOrThisOfTypeAsserted(m_currentCase);
+
+ m_selectedView = m_currentView;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicSelectViewUI::setCase(RimEclipseResultCase* currentCase)
+{
+ m_currentCase = currentCase;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RimEclipseView* RicSelectViewUI::selectedView() const
+{
+ return m_selectedView();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicSelectViewUI::createNewView() const
+{
+ return m_createNewView;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+QString RicSelectViewUI::newViewName() const
+{
+ return m_newViewName;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+QList RicSelectViewUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
+{
+ QList options;
+
+ if (fieldNeedingOptions == &m_selectedView)
+ {
+ if (m_currentCase)
+ {
+ for (RimView* v : m_currentCase->views())
+ {
+ QIcon icon = v->uiCapability()->uiIcon();
+ QString displayName = v->name;
+
+ options.push_back(caf::PdmOptionItemInfo(displayName, v, false, icon));
+ }
+ }
+ }
+
+ return options;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicSelectViewUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
+{
+ if (m_currentCase && m_currentCase->views().size() == 0)
+ {
+ m_createNewView = true;
+ }
+
+ if (m_createNewView)
+ {
+ m_newViewName.uiCapability()->setUiReadOnly(false);
+ m_selectedView.uiCapability()->setUiReadOnly(true);
+ }
+ else
+ {
+ m_newViewName.uiCapability()->setUiReadOnly(true);
+ m_selectedView.uiCapability()->setUiReadOnly(false);
+ }
+}
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h
new file mode 100644
index 0000000000..f3ecfa2355
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicSelectViewUI.h
@@ -0,0 +1,58 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafPdmField.h"
+#include "cafPdmObject.h"
+#include "cafPdmPtrField.h"
+
+class RimEclipseView;
+class RimEclipseResultCase;
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicSelectViewUI : public caf::PdmObject
+{
+ CAF_PDM_HEADER_INIT;
+
+public:
+ RicSelectViewUI();
+
+ void setView(RimEclipseView* currentView);
+ void setCase(RimEclipseResultCase* currentCase);
+
+ RimEclipseView* selectedView() const;
+ bool createNewView() const;
+ QString newViewName() const;
+
+ virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
+
+protected:
+ virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
+
+private:
+ caf::PdmPtrField m_selectedView;
+ caf::PdmField m_createNewView;
+ caf::PdmField m_newViewName;
+
+ RimEclipseView* m_currentView;
+ RimEclipseResultCase* m_currentCase;
+};
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp
new file mode 100644
index 0000000000..43c8ef5f8a
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.cpp
@@ -0,0 +1,111 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowContributingWellsFeature.h"
+
+#include "RicShowContributingWellsFeatureImpl.h"
+
+#include "RimEclipseCellColors.h"
+#include "RimEclipseResultCase.h"
+#include "RimEclipseView.h"
+#include "RimEclipseWell.h"
+#include "RimViewManipulator.h"
+
+#include "RiuMainWindow.h"
+
+#include "cafCmdFeatureManager.h"
+#include "cafSelectionManager.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicShowContributingWellsFeature::isCommandEnabled()
+{
+ std::vector collection;
+ caf::SelectionManager::instance()->objectsByType(&collection);
+ if (collection.size() == 1)
+ {
+ RimEclipseWell* well = collection[0];
+ RimEclipseView* eclipseView = nullptr;
+ well->firstAncestorOrThisOfType(eclipseView);
+
+ if (eclipseView)
+ {
+ RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution();
+ if (!flowDiagSolution)
+ {
+ RimEclipseResultCase* eclipseResultCase = nullptr;
+ well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
+
+ if (eclipseResultCase)
+ {
+ flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
+ }
+ }
+
+ if (flowDiagSolution)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
+{
+ std::vector collection;
+ caf::SelectionManager::instance()->objectsByType(&collection);
+
+ CAF_ASSERT(collection.size() == 1);
+
+ RimEclipseWell* well = collection[0];
+ RimEclipseView* eclipseView = nullptr;
+ well->firstAncestorOrThisOfTypeAsserted(eclipseView);
+
+ RimEclipseResultCase* eclipseResultCase = nullptr;
+ well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
+
+ RimEclipseView* modifiedView = RicShowContributingWellsFeatureImpl::maniuplateSelectedView(eclipseResultCase, well->name(), eclipseView->currentTimeStep());
+ if (modifiedView)
+ {
+ modifiedView->createDisplayModelAndRedraw();
+
+ std::vector viewsToUpdate;
+ viewsToUpdate.push_back(modifiedView);
+
+ RimViewManipulator::applySourceViewCameraOnDestinationViews(eclipseView, viewsToUpdate);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowContributingWellsFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
+ actionToSetup->setText("Show Contributing Wells");
+}
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h
new file mode 100644
index 0000000000..ab99fa476e
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeature.h
@@ -0,0 +1,37 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowContributingWellsFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered( bool isChecked ) override;
+ virtual void setupActionLook( QAction* actionToSetup ) override;
+};
+
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp
new file mode 100644
index 0000000000..d01a566506
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.cpp
@@ -0,0 +1,280 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowContributingWellsFeatureImpl.h"
+
+#include "RiaApplication.h"
+
+#include "RicSelectViewUI.h"
+
+#include "RigFlowDiagResultAddress.h"
+#include "RigSingleWellResultsData.h"
+
+#include "RimEclipseCellColors.h"
+#include "RimEclipsePropertyFilter.h"
+#include "RimEclipsePropertyFilterCollection.h"
+#include "RimEclipseResultCase.h"
+#include "RimEclipseView.h"
+#include "RimEclipseWell.h"
+#include "RimEclipseWellCollection.h"
+#include "RimFaultCollection.h"
+#include "RimFlowDiagSolution.h"
+#include "RimProject.h"
+#include "RimViewManipulator.h"
+
+#include "RiuMainWindow.h"
+
+#include "cafCmdFeature.h"
+#include "cafCmdFeatureManager.h"
+#include "cafPdmUiPropertyViewDialog.h"
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+RimEclipseView* RicShowContributingWellsFeatureImpl::maniuplateSelectedView(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
+{
+ const QString lastUsedViewKey("lastUsedViewKey");
+
+ RimEclipseView* defaultSelectedView = nullptr;
+ {
+ QString lastUsedViewRef = RiaApplication::instance()->cacheDataObject(lastUsedViewKey).toString();
+ RimEclipseView* lastUsedView = dynamic_cast(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedViewRef));
+ if (lastUsedView)
+ {
+ RimEclipseResultCase* lastUsedViewResultCase = nullptr;
+ lastUsedView->firstAncestorOrThisOfTypeAsserted(lastUsedViewResultCase);
+
+ if (lastUsedViewResultCase == eclipseResultCase)
+ {
+ defaultSelectedView = lastUsedView;
+ }
+ }
+
+ if (!defaultSelectedView)
+ {
+ RimEclipseView* activeView = dynamic_cast(RiaApplication::instance()->activeReservoirView());
+ if (activeView)
+ {
+ RimEclipseResultCase* activeViewResultCase = nullptr;
+ activeView->firstAncestorOrThisOfTypeAsserted(activeViewResultCase);
+
+ if (activeViewResultCase == eclipseResultCase)
+ {
+ defaultSelectedView = activeView;
+ }
+ else
+ {
+ if (eclipseResultCase->views().size() > 0)
+ {
+ defaultSelectedView = dynamic_cast(eclipseResultCase->views()[0]);
+ }
+ }
+ }
+ }
+ }
+
+ RicSelectViewUI featureUi;
+ if (defaultSelectedView)
+ {
+ featureUi.setView(defaultSelectedView);
+ }
+ else
+ {
+ featureUi.setCase(eclipseResultCase);
+ }
+
+ caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Show Contributing Wells in View", "");
+ propertyDialog.resize(QSize(400, 200));
+
+ if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
+
+ RimEclipseView* viewToManipulate = nullptr;
+ if (featureUi.createNewView())
+ {
+ RimEclipseView* createdView = eclipseResultCase->createAndAddReservoirView();
+ createdView->name = featureUi.newViewName();
+
+ // Must be run before buildViewItems, as wells are created in this function
+ createdView->loadDataAndUpdate();
+ eclipseResultCase->updateConnectedEditors();
+
+ viewToManipulate = createdView;
+ }
+ else
+ {
+ viewToManipulate = featureUi.selectedView();
+ }
+
+ CVF_ASSERT(viewToManipulate);
+
+
+ RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(viewToManipulate, wellName, timeStep);
+
+ auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature");
+ feature->actionTriggered(false);
+
+ RiuMainWindow::instance()->setExpanded(viewToManipulate, true);
+ RiuMainWindow::instance()->selectAsCurrentItem(viewToManipulate);
+
+ QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), viewToManipulate);
+ RiaApplication::instance()->setCacheDataObject(lastUsedViewKey, refFromProjectToView);
+
+ return viewToManipulate;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep)
+{
+ CVF_ASSERT(viewToModify);
+
+ RimEclipseWell* selectedWell = nullptr;
+
+ for (RimEclipseWell* w : viewToModify->wellCollection()->wells())
+ {
+ if (w->name() == wellName)
+ {
+ selectedWell = w;
+ }
+ }
+
+ CVF_ASSERT(selectedWell);
+
+ RimEclipseResultCase* eclipseResultCase = nullptr;
+ selectedWell->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
+
+ // Use the active flow diag solutions, or the first one as default
+ RimFlowDiagSolution* flowDiagSolution = viewToModify->cellResult()->flowDiagSolution();
+ if (!flowDiagSolution)
+ {
+ flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
+ }
+
+ //assert(flowDiagSolution);
+ CVF_ASSERT(flowDiagSolution);
+
+ RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep(selectedWell->name(), timeStep);
+ if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER))
+ {
+ return;
+ }
+
+ viewToModify->setCurrentTimeStep(timeStep);
+ viewToModify->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
+ viewToModify->cellResult()->setResultVariable("MaxFractionTracer");
+ viewToModify->cellResult()->setFlowSolution(flowDiagSolution);
+
+ switch (tracerStatus)
+ {
+ case RimFlowDiagSolution::PRODUCER:
+ viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
+ break;
+ case RimFlowDiagSolution::INJECTOR:
+ viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
+ break;
+
+ default:
+ CVF_ASSERT(false);
+ break;
+ }
+
+ viewToModify->cellResult()->loadDataAndUpdate();
+ viewToModify->cellResult()->updateConnectedEditors();
+
+ std::vector tracerNames = findContributingTracerNames(flowDiagSolution, selectedWell->wellResults(), timeStep);
+
+ for (RimEclipseWell* w : viewToModify->wellCollection()->wells())
+ {
+ if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end()
+ || selectedWell->name() == w->name())
+ {
+ w->showWell = true;
+ }
+ else
+ {
+ w->showWell = false;
+ }
+ }
+
+ // Disable all existing property filters, and
+ // create a new property filter based on TOF for current well
+
+ RimEclipsePropertyFilterCollection* propertyFilterCollection = viewToModify->eclipsePropertyFilterCollection();
+
+ for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
+ {
+ f->isActive = false;
+ }
+
+ RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
+ propertyFilterCollection->propertyFilters().push_back(propertyFilter);
+
+ propertyFilter->resultDefinition()->setEclipseCase(viewToModify->eclipseCase());
+ propertyFilter->resultDefinition()->setTofAndSelectTracer(selectedWell->name());
+ propertyFilter->resultDefinition()->loadDataAndUpdate();
+
+ propertyFilterCollection->updateConnectedEditors();
+
+ RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
+
+ viewToModify->faultCollection()->showFaultCollection = false;
+ viewToModify->faultCollection()->updateConnectedEditors();
+
+ viewToModify->updateCurrentTimeStepAndRedraw();
+ viewToModify->scheduleCreateDisplayModelAndRedraw();
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+std::vector RicShowContributingWellsFeatureImpl::findContributingTracerNames(
+ const RimFlowDiagSolution* flowDiagSolution,
+ const RigSingleWellResultsData* wellResults,
+ int timeStep)
+{
+ std::vector tracerCellFractionValues;
+
+ if (flowDiagSolution && wellResults->hasWellResult(timeStep))
+ {
+ RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
+
+ const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(timeStep);
+ if ( prodType == RigWellResultFrame::PRODUCER
+ || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE)
+ {
+ requestedTracerType = RimFlowDiagSolution::INJECTOR;
+ }
+ else
+ {
+ requestedTracerType = RimFlowDiagSolution::PRODUCER;
+ }
+
+ std::vector tracerNames = flowDiagSolution->tracerNames();
+ for (const QString& tracerName : tracerNames)
+ {
+ if (flowDiagSolution->tracerStatusInTimeStep(tracerName, timeStep) == requestedTracerType)
+ {
+ tracerCellFractionValues.push_back(tracerName);
+ }
+ }
+ }
+
+ return tracerCellFractionValues;
+}
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h
new file mode 100644
index 0000000000..a5ce2afc60
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFeatureImpl.h
@@ -0,0 +1,48 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include
+
+#include
+
+class RigSingleWellResultsData;
+class RimEclipseResultCase;
+class RimEclipseView;
+class RimEclipseWell;
+class RimFlowDiagSolution;
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowContributingWellsFeatureImpl
+{
+public:
+ static RimEclipseView* maniuplateSelectedView(RimEclipseResultCase* wellAllocationResultCase, QString wellName, int timeStep);
+
+private:
+ static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep);
+
+ static std::vector findContributingTracerNames(
+ const RimFlowDiagSolution* flowDiagSolution,
+ const RigSingleWellResultsData* wellResults,
+ int timeStep);
+};
+
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp
new file mode 100644
index 0000000000..40f4e73c58
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.cpp
@@ -0,0 +1,69 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowContributingWellsFromPlotFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RicShowContributingWellsFeatureImpl.h"
+
+#include "RimEclipseResultCase.h"
+#include "RimFlowDiagSolution.h"
+#include "RimWellAllocationPlot.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
+{
+ RimWellAllocationPlot* wellAllocationPlot = dynamic_cast(RiaApplication::instance()->activePlotWindow());
+
+ if (wellAllocationPlot) return true;
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
+{
+ RimWellAllocationPlot* wellAllocationPlot = dynamic_cast(RiaApplication::instance()->activePlotWindow());
+
+ if (!wellAllocationPlot) return;
+
+ int timeStep = wellAllocationPlot->timeStep();
+ QString wellName = wellAllocationPlot->wellName();
+
+ RimEclipseResultCase* wellAllocationResultCase = wellAllocationPlot->rimCase();
+
+ RicShowContributingWellsFeatureImpl::maniuplateSelectedView(wellAllocationResultCase, wellName, timeStep);
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowContributingWellsFromPlotFeature::setupActionLook(QAction* actionToSetup)
+{
+ //actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
+ actionToSetup->setText("Show Contributing Wells");
+}
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.h b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.h
new file mode 100644
index 0000000000..bc4af31852
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowContributingWellsFromPlotFeature.h
@@ -0,0 +1,38 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowContributingWellsFromPlotFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered( bool isChecked ) override;
+ virtual void setupActionLook( QAction* actionToSetup ) override;
+};
+
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp
new file mode 100644
index 0000000000..9177768572
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp
@@ -0,0 +1,110 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowFlowCharacteristicsPlotFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RimEclipseResultCase.h"
+#include "RimEclipseView.h"
+#include "RimFlowCharacteristicsPlot.h"
+#include "RigFlowDiagResults.h"
+#include "RimFlowDiagSolution.h"
+#include "RimFlowPlotCollection.h"
+#include "RimMainPlotCollection.h"
+#include "RimProject.h"
+#include "RimView.h"
+
+#include "RiuMainPlotWindow.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicShowFlowCharacteristicsPlotFeature, "RicShowFlowCharacteristicsPlotFeature");
+
+RimEclipseResultCase* activeEclipseResultCase()
+{
+ RimView * activeView = RiaApplication::instance()->activeReservoirView();
+
+ auto eclView = dynamic_cast(activeView);
+
+ if (!eclView) return nullptr;
+
+ auto eclCase = dynamic_cast(eclView->ownerCase());
+
+ return eclCase;
+
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicShowFlowCharacteristicsPlotFeature::isCommandEnabled()
+{
+ RimEclipseResultCase* eclCase = activeEclipseResultCase();
+
+ if (!eclCase) return false;
+
+ if (!eclCase->defaultFlowDiagSolution()) return false;
+
+ return true;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowFlowCharacteristicsPlotFeature::onActionTriggered(bool isChecked)
+{
+ RimEclipseResultCase* eclCase = activeEclipseResultCase();
+
+ if (eclCase && eclCase->defaultFlowDiagSolution())
+ {
+ // Make sure flow results for the the active timestep is calculated, to avoid an empty plot
+ {
+ RimView * activeView = RiaApplication::instance()->activeReservoirView();
+ if (activeView && eclCase->defaultFlowDiagSolution()->flowDiagResults())
+ {
+ // Trigger calculation
+ eclCase->defaultFlowDiagSolution()->flowDiagResults()->maxAbsPairFlux(activeView->currentTimeStep());
+ }
+ }
+
+ if (RiaApplication::instance()->project())
+ {
+ RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
+ if (flowPlotColl)
+ {
+ RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
+
+ flowPlotColl->defaultFlowCharacteristicsPlot()->setFromFlowSolution(eclCase->defaultFlowDiagSolution());
+ flowPlotColl->defaultFlowCharacteristicsPlot()->updateConnectedEditors();
+
+ // Make sure the summary plot window is created and visible
+ plotwindow->selectAsCurrentItem(flowPlotColl->defaultFlowCharacteristicsPlot());
+ }
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowFlowCharacteristicsPlotFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
+ actionToSetup->setText("Plot Flow Characteristics");
+}
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h b/ApplicationCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h
new file mode 100644
index 0000000000..b9846b507a
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h
@@ -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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+class RimEclipseWell;
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowFlowCharacteristicsPlotFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered( bool isChecked ) override;
+ virtual void setupActionLook( QAction* actionToSetup ) override;
+};
+
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp
new file mode 100644
index 0000000000..37a77bb1a0
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.cpp
@@ -0,0 +1,107 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowTotalAllocationDataFeature.h"
+
+#include "ApplicationCommands/RicShowPlotDataFeature.h"
+
+#include "RimTotalWellAllocationPlot.h"
+#include "RimWellAllocationPlot.h"
+
+#include "cafSelectionManager.h"
+#include "cvfAssert.h"
+
+#include
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicShowTotalAllocationDataFeature, "RicShowTotalAllocationDataFeature");
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicShowTotalAllocationDataFeature::isCommandEnabled()
+{
+ std::set wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
+
+ if (wellAllocPlots.size() > 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowTotalAllocationDataFeature::onActionTriggered(bool isChecked)
+{
+ this->disableModelChangeContribution();
+
+ std::set wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
+ CVF_ASSERT(wellAllocPlots.size() > 0);
+
+ for (auto wellAllocPlot : wellAllocPlots)
+ {
+ QString txt = wellAllocPlot->description();
+ txt += "\n";
+ txt += "\n";
+ txt += wellAllocPlot->totalWellFlowPlot()->totalAllocationAsText();
+
+ QString title = "Total Allocation (" + wellAllocPlot->wellName() + ")";
+
+ RicShowPlotDataFeature::showTextWindow(title, txt);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowTotalAllocationDataFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Show Total Allocation Data");
+ //actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+std::set RicShowTotalAllocationDataFeature::selectedWellAllocationPlots()
+{
+ std::set wellAllocPlots;
+
+ std::vector objects;
+ caf::SelectionManager::instance()->objectsByType(&objects);
+ for (auto obj : objects)
+ {
+ CVF_ASSERT(obj);
+
+ RimWellAllocationPlot* parentPlot = nullptr;
+ obj->firstAncestorOrThisOfType(parentPlot);
+
+ if (parentPlot)
+ {
+ wellAllocPlots.insert(parentPlot);
+ }
+ }
+
+ return wellAllocPlots;
+}
+
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h b/ApplicationCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h
new file mode 100644
index 0000000000..6ac89e7e1b
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+#include
+
+class RimWellAllocationPlot;
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowTotalAllocationDataFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered(bool isChecked) override;
+ virtual void setupActionLook(QAction* actionToSetup) override;
+
+private:
+ static std::set selectedWellAllocationPlots();
+};
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp
new file mode 100644
index 0000000000..51291eeb82
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp
@@ -0,0 +1,90 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicShowWellAllocationPlotFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RimEclipseResultCase.h"
+#include "RimEclipseWell.h"
+#include "RimFlowPlotCollection.h"
+#include "RimMainPlotCollection.h"
+#include "RimProject.h"
+#include "RimView.h"
+#include "RimWellAllocationPlot.h"
+
+#include "RiuMainPlotWindow.h"
+
+#include "cafSelectionManager.h"
+
+#include
+
+CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature");
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicShowWellAllocationPlotFeature::isCommandEnabled()
+{
+ std::vector collection;
+ caf::SelectionManager::instance()->objectsByType(&collection);
+
+ if (collection.size() > 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
+{
+ std::vector collection;
+ caf::SelectionManager::instance()->objectsByType(&collection);
+
+ if (collection.size() > 0)
+ {
+ RimEclipseWell* eclWell = collection[0];
+
+ if (RiaApplication::instance()->project())
+ {
+ RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
+ if (flowPlotColl)
+ {
+ flowPlotColl->defaultWellAllocPlot()->setFromSimulationWell(eclWell);
+ flowPlotColl->defaultWellAllocPlot()->updateConnectedEditors();
+
+ // Make sure the summary plot window is created and visible
+ RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
+ plotwindow->selectAsCurrentItem(flowPlotColl->defaultWellAllocPlot());
+ }
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
+ actionToSetup->setText("Plot Well Allocation");
+}
diff --git a/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h
new file mode 100644
index 0000000000..7d804b8640
--- /dev/null
+++ b/ApplicationCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h
@@ -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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+class RimEclipseWell;
+
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicShowWellAllocationPlotFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+
+protected:
+ // Overrides
+ virtual bool isCommandEnabled() override;
+ virtual void onActionTriggered( bool isChecked ) override;
+ virtual void setupActionLook( QAction* actionToSetup ) override;
+};
+
+
diff --git a/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h b/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h
index 3c8b41a2ac..e2ddb19a46 100644
--- a/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h
+++ b/ApplicationCode/Commands/IntersectionBoxCommands/RicBoxManipulatorEventHandler.h
@@ -33,7 +33,7 @@ class RicBoxManipulatorEventHandler : public QObject
Q_OBJECT
public:
- RicBoxManipulatorEventHandler(caf::Viewer* viewer);
+ explicit RicBoxManipulatorEventHandler(caf::Viewer* viewer);
~RicBoxManipulatorEventHandler();
void setOrigin(const cvf::Vec3d& origin);
diff --git a/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp b/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp
index 823c81c140..a0658ec706 100644
--- a/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp
+++ b/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.cpp
@@ -23,6 +23,7 @@
#include "RimCalcScript.h"
#include "RiaApplication.h"
+#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@@ -49,6 +50,9 @@ void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
std::vector selection = RicScriptFeatureImpl::selectedScripts();
CVF_ASSERT(selection.size() > 0);
+ RiuMainWindow* mainWindow = RiuMainWindow::instance();
+ mainWindow->showProcessMonitorDockPanel();
+
RimCalcScript* calcScript = selection[0];
RiaApplication* app = RiaApplication::instance();
diff --git a/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp b/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp
index d2f2be5204..f9a35557ca 100644
--- a/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp
+++ b/ApplicationCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp
@@ -21,6 +21,7 @@
#include "RimCase.h"
#include "RiaApplication.h"
+#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
@@ -74,6 +75,9 @@ void RicExecuteScriptForCasesFeature::slotExecuteScriptForSelectedCases()
QString scriptAbsolutePath = action->data().toString();
+ RiuMainWindow* mainWindow = RiuMainWindow::instance();
+ mainWindow->showProcessMonitorDockPanel();
+
RiaApplication* app = RiaApplication::instance();
QString octavePath = app->octavePath();
if (!octavePath.isEmpty())
diff --git a/ApplicationCode/Commands/OctaveScriptCommands/RicNewScriptFeature.cpp b/ApplicationCode/Commands/OctaveScriptCommands/RicNewScriptFeature.cpp
index dd011f9825..5febff7db3 100644
--- a/ApplicationCode/Commands/OctaveScriptCommands/RicNewScriptFeature.cpp
+++ b/ApplicationCode/Commands/OctaveScriptCommands/RicNewScriptFeature.cpp
@@ -29,6 +29,8 @@
#include "RiuMainWindow.h"
+#include "cafUtils.h"
+
#include
#include
#include
@@ -76,7 +78,7 @@ void RicNewScriptFeature::onActionTriggered(bool isChecked)
fullPathFilenameNewScript = fullPathNewScript + "/untitled.m";
int num= 1;
- while (QFileInfo(fullPathFilenameNewScript).exists())
+ while (caf::Utils::fileExists(fullPathFilenameNewScript))
{
fullPathFilenameNewScript = fullPathNewScript + "/untitled" + QString::number(num) + ".m";
num++;
diff --git a/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp b/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp
index 1ded41458c..ac8ff487fd 100644
--- a/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp
+++ b/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp
@@ -19,8 +19,17 @@
#include "RicCopyReferencesToClipboardFeature.h"
+#include "RimEclipseCase.h"
+#include "RimEclipseView.h"
+#include "RimGeoMechView.h"
#include "RimMimeData.h"
+#include "RimSummaryCurveFilter.h"
+#include "RimSummaryPlot.h"
+#include "RimWellAllocationPlot.h"
+#include "RimWellLogPlot.h"
+#include "RimWellLogTrack.h"
+#include "cafPdmObject.h"
#include "cafPdmUiItem.h"
#include "cafSelectionManager.h"
@@ -40,7 +49,7 @@ CAF_CMD_SOURCE_INIT(RicCopyReferencesToClipboardFeature, "RicCopyReferencesToCli
//--------------------------------------------------------------------------------------------------
bool RicCopyReferencesToClipboardFeature::isCommandEnabled()
{
- return true;
+ return isAnyCopyableObjectSelected();
}
//--------------------------------------------------------------------------------------------------
@@ -48,8 +57,24 @@ bool RicCopyReferencesToClipboardFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicCopyReferencesToClipboardFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
+ if (!isAnyCopyableObjectSelected()) return;
+
std::vector referenceList;
- SelectionManager::instance()->selectionAsReferences(referenceList);
+
+ std::vector selectedFormationNamesCollObjs;
+ caf::SelectionManager::instance()->objectsByType(&selectedFormationNamesCollObjs);
+
+ for (PdmObject* pdmObject : selectedFormationNamesCollObjs)
+ {
+ if (RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(pdmObject))
+ {
+ QString itemRef = PdmReferenceHelper::referenceFromRootToObject(SelectionManager::instance()->pdmRootObject(), pdmObject);
+
+ referenceList.push_back(itemRef);
+ }
+ }
MimeDataWithReferences* myObject = new MimeDataWithReferences;
myObject->setReferences(referenceList);
@@ -71,4 +96,70 @@ void RicCopyReferencesToClipboardFeature::setupActionLook(QAction* actionToSetup
actionToSetup->setShortcuts(QKeySequence::Copy);
}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicCopyReferencesToClipboardFeature::isAnyCopyableObjectSelected()
+{
+ std::vector selectedFormationNamesCollObjs;
+ caf::SelectionManager::instance()->objectsByType(&selectedFormationNamesCollObjs);
+
+ for (PdmObject* pdmObject : selectedFormationNamesCollObjs)
+ {
+ if (RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(pdmObject))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported(PdmObject* pdmObject)
+{
+ RimWellAllocationPlot* wellAllocPlot = nullptr;
+ pdmObject->firstAncestorOrThisOfType(wellAllocPlot);
+
+ if (dynamic_cast(pdmObject))
+ {
+ return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ if (!wellAllocPlot) return true;
+ }
+ else if (dynamic_cast(pdmObject))
+ {
+ if (!wellAllocPlot) return true;
+ }
+
+ return false;
+}
+
} // end namespace caf
diff --git a/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h b/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h
index 61b7ac77ab..477eba8a15 100644
--- a/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h
+++ b/ApplicationCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h
@@ -25,6 +25,8 @@
namespace caf
{
+class PdmObject;
+
//==================================================================================================
///
//==================================================================================================
@@ -37,6 +39,10 @@ class RicCopyReferencesToClipboardFeature : public CmdFeature
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
+
+private:
+ static bool isAnyCopyableObjectSelected();
+ static bool isCopyOfObjectSupported(PdmObject* pdmObject);
};
diff --git a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp
index be7352935b..1ef1447676 100644
--- a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp
+++ b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.cpp
@@ -28,6 +28,7 @@
#include "RimCaseCollection.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseResultCase.h"
+#include "RimEclipseView.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimOilField.h"
@@ -116,7 +117,8 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
RimEclipseResultCase* eclCase = dynamic_cast(objectGroup.objects[i]);
if (eclCase)
{
- RimEclipseResultCase* eclCaseCopy = dynamic_cast(eclCase->copyByXmlSerialization(PdmDefaultObjectFactory::instance()));
+ RimEclipseResultCase* eclCaseCopy = new RimEclipseResultCase();
+ eclCaseCopy->setCaseInfo(eclCase->caseUserDescription(), eclCase->gridFileName());
resultCases.push_back(eclCaseCopy);
}
}
@@ -178,7 +180,7 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
continue;
}
- if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData()))
+ if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{
CVF_ASSERT(false);
}
diff --git a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp
index c1fdefbe7a..97fb22d65a 100644
--- a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp
+++ b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp
@@ -21,6 +21,8 @@
#include "RiaApplication.h"
+#include "RiuMainWindow.h"
+
#include "RicPasteFeatureImpl.h"
#include "RimEclipseCase.h"
@@ -83,6 +85,8 @@ void RicPasteEclipseViewsFeature::onActionTriggered(bool isChecked)
std::vector > eclipseViews;
objectGroup.objectsByType(&eclipseViews);
+ RimEclipseView* lastViewCopy = nullptr;
+
// Add cases to case group
for (size_t i = 0; i < eclipseViews.size(); i++)
{
@@ -97,16 +101,18 @@ void RicPasteEclipseViewsFeature::onActionTriggered(bool isChecked)
// Resolve references after reservoir view has been inserted into Rim structures
// Intersections referencing a well path/ simulation well requires this
- // TODO: initAfterReadRecursively can probably be removed
- rimReservoirView->initAfterReadRecursively();
rimReservoirView->resolveReferencesRecursively();
+ rimReservoirView->initAfterReadRecursively();
rimReservoirView->loadDataAndUpdate();
caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);
eclipseCase->updateConnectedEditors();
+ lastViewCopy = rimReservoirView;
}
+
+ if (lastViewCopy) RiuMainWindow::instance()->selectAsCurrentItem(lastViewCopy);
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteFeatureImpl.cpp b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteFeatureImpl.cpp
index 48e392d255..440372f9de 100644
--- a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteFeatureImpl.cpp
+++ b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteFeatureImpl.cpp
@@ -23,6 +23,7 @@
#include "RimCaseCollection.h"
#include "RimEclipseCase.h"
+#include "RimEclipseView.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimIdenticalGridCaseGroup.h"
diff --git a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp
index b804d6d3c9..b5c6505452 100644
--- a/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp
+++ b/ApplicationCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp
@@ -21,6 +21,8 @@
#include "RicPasteFeatureImpl.h"
+#include "RiuMainWindow.h"
+
#include "RimGeoMechView.h"
#include "RimGeoMechCase.h"
@@ -77,6 +79,8 @@ void RicPasteGeoMechViewsFeature::onActionTriggered(bool isChecked)
std::vector > geomViews;
objectGroup.objectsByType(&geomViews);
+ RimGeoMechView* lastViewCopy = nullptr;
+
// Add cases to case group
for (size_t i = 0; i < geomViews.size(); i++)
{
@@ -89,15 +93,19 @@ void RicPasteGeoMechViewsFeature::onActionTriggered(bool isChecked)
// Resolve references after reservoir view has been inserted into Rim structures
// Intersections referencing a well path requires this
- rimReservoirView->initAfterReadRecursively();
rimReservoirView->resolveReferencesRecursively();
+ rimReservoirView->initAfterReadRecursively();
caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);
rimReservoirView->loadDataAndUpdate();
geomCase->updateConnectedEditors();
+
+ lastViewCopy = rimReservoirView;
}
+
+ if (lastViewCopy) RiuMainWindow::instance()->selectAsCurrentItem(lastViewCopy);
}
//--------------------------------------------------------------------------------------------------
diff --git a/ApplicationCode/Commands/RicCloseCaseFeature.cpp b/ApplicationCode/Commands/RicCloseCaseFeature.cpp
index a239d440b5..aca46ec016 100644
--- a/ApplicationCode/Commands/RicCloseCaseFeature.cpp
+++ b/ApplicationCode/Commands/RicCloseCaseFeature.cpp
@@ -158,6 +158,26 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
}
else
{
+ RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup();
+ if (caseGroup)
+ {
+ // When deleting the last source case for statistics, remove any views on statistics cases.
+ // This is done because the views do not work well
+ if (caseGroup->caseCollection()->reservoirs.size() == 1)
+ {
+ std::vector children;
+ caseGroup->statisticsCaseCollection()->reservoirs.childObjects(&children);
+
+ for (size_t i = children.size(); i-- > 0;)
+ {
+ caf::PdmObjectHandle* obj = children[i];
+ delete obj;
+ caseGroup->statisticsCaseCollection()->reservoirs.erase(i);
+ }
+
+ caseGroup->statisticsCaseCollection()->uiCapability()->updateConnectedEditors();
+ }
+ }
removeCaseFromAllGroups(eclipseCase);
}
}
diff --git a/ApplicationCode/Commands/RicDeleteItemExec.h b/ApplicationCode/Commands/RicDeleteItemExec.h
index c58817b347..e733702f45 100644
--- a/ApplicationCode/Commands/RicDeleteItemExec.h
+++ b/ApplicationCode/Commands/RicDeleteItemExec.h
@@ -33,7 +33,7 @@ class RicDeleteItemExecData;
class RicDeleteItemExec : public CmdExecuteCommand
{
public:
- RicDeleteItemExec(NotificationCenter* notificationCenter);
+ explicit RicDeleteItemExec(NotificationCenter* notificationCenter);
RicDeleteItemExecData* commandData();
diff --git a/ApplicationCode/Commands/RicDeleteItemFeature.cpp b/ApplicationCode/Commands/RicDeleteItemFeature.cpp
index 3a936a2e85..78a495e348 100644
--- a/ApplicationCode/Commands/RicDeleteItemFeature.cpp
+++ b/ApplicationCode/Commands/RicDeleteItemFeature.cpp
@@ -21,6 +21,25 @@
#include "RicDeleteItemExec.h"
#include "RicDeleteItemExecData.h"
+#include "RimCellRangeFilter.h"
+#include "RimEclipseInputProperty.h"
+#include "RimEclipsePropertyFilter.h"
+#include "RimEclipseView.h"
+#include "RimFormationNames.h"
+#include "RimFormationNamesCollection.h"
+#include "RimGeoMechPropertyFilter.h"
+#include "RimGeoMechView.h"
+#include "RimGridTimeHistoryCurve.h"
+#include "RimIdenticalGridCaseGroup.h"
+#include "RimIntersection.h"
+#include "RimIntersectionBox.h"
+#include "RimSummaryCurve.h"
+#include "RimSummaryCurveFilter.h"
+#include "RimSummaryPlot.h"
+#include "RimViewController.h"
+#include "RimWellAllocationPlot.h"
+#include "RimWellFlowRateCurve.h"
+#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
@@ -32,22 +51,6 @@
#include "cafSelectionManager.h"
#include
-#include "RimGeoMechView.h"
-#include "RimEclipseView.h"
-#include "RimIdenticalGridCaseGroup.h"
-#include "RimEclipseInputProperty.h"
-#include "RimCellRangeFilter.h"
-#include "RimEclipsePropertyFilter.h"
-#include "RimGeoMechPropertyFilter.h"
-#include "RimViewController.h"
-#include "RimWellLogCurve.h"
-#include "RimSummaryCurve.h"
-#include "RimSummaryCurveFilter.h"
-#include "RimIntersection.h"
-#include "RimIntersectionBox.h"
-#include "RimFormationNames.h"
-#include "RimFormationNamesCollection.h"
-#include "RimSummaryPlot.h"
namespace caf
{
@@ -55,6 +58,22 @@ namespace caf
bool isDeletable(PdmUiItem * uiItem)
{
+ // Enable delete of well allocation plots
+ if (dynamic_cast(uiItem)) return true;
+
+ // Disable delete of all sub objects of a well allocation plot
+ caf::PdmObjectHandle* destinationObject = dynamic_cast(uiItem);
+ if (destinationObject)
+ {
+ RimWellAllocationPlot* wellAllocationPlot = nullptr;
+ destinationObject->firstAncestorOrThisOfType(wellAllocationPlot);
+
+ if (wellAllocationPlot)
+ {
+ return false;
+ }
+ }
+
if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
@@ -67,6 +86,7 @@ bool isDeletable(PdmUiItem * uiItem)
if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
+ if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
if (dynamic_cast(uiItem)) return true;
diff --git a/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp b/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp
new file mode 100644
index 0000000000..e7d81966a6
--- /dev/null
+++ b/ApplicationCode/Commands/RicDeleteSubItemsFeature.cpp
@@ -0,0 +1,112 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicDeleteSubItemsFeature.h"
+
+#include "RimSummaryPlotCollection.h"
+#include "RimWellPathCollection.h"
+
+#include "cafPdmUiItem.h"
+#include "cafSelectionManager.h"
+
+#include
+
+
+CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature");
+
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicDeleteSubItemsFeature::isCommandEnabled()
+{
+ std::vector items;
+ caf::SelectionManager::instance()->selectedItems(items);
+
+ if (items.empty()) return false;
+
+ for (auto* item : items)
+ {
+ if (!RicDeleteSubItemsFeature::hasDeletableSubItems(item)) return false;
+ }
+
+ return true;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicDeleteSubItemsFeature::onActionTriggered(bool isChecked)
+{
+ std::vector items;
+ caf::SelectionManager::instance()->selectedItems(items);
+
+ CVF_ASSERT(items.size() > 0);
+
+ for (auto item : items)
+ {
+ if (!RicDeleteSubItemsFeature::hasDeletableSubItems(item)) continue;
+
+ RimSummaryPlotCollection* summaryPlotColl = dynamic_cast(item);
+ if (summaryPlotColl)
+ {
+ summaryPlotColl->summaryPlots.deleteAllChildObjects();
+
+ summaryPlotColl->updateConnectedEditors();
+ }
+
+ RimWellPathCollection* wellPathColl = dynamic_cast(item);
+ if (wellPathColl)
+ {
+ wellPathColl->deleteAllWellPaths();
+
+ wellPathColl->updateConnectedEditors();
+ wellPathColl->scheduleGeometryRegenAndRedrawViews();
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicDeleteSubItemsFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Delete Sub Items");
+ actionToSetup->setIcon(QIcon(":/Erase.png"));
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicDeleteSubItemsFeature::hasDeletableSubItems(caf::PdmUiItem* uiItem)
+{
+ RimSummaryPlotCollection* summaryPlotColl = dynamic_cast(uiItem);
+ if (summaryPlotColl && summaryPlotColl->summaryPlots().size() > 0)
+ {
+ return true;
+ }
+
+ RimWellPathCollection* wellPathColl = dynamic_cast(uiItem);
+ if (wellPathColl && wellPathColl->wellPaths().size() > 0)
+ {
+ return true;
+ }
+
+ return false;
+}
diff --git a/ApplicationCode/Commands/RicDeleteSubItemsFeature.h b/ApplicationCode/Commands/RicDeleteSubItemsFeature.h
new file mode 100644
index 0000000000..72c80b7583
--- /dev/null
+++ b/ApplicationCode/Commands/RicDeleteSubItemsFeature.h
@@ -0,0 +1,43 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "cafCmdFeature.h"
+
+namespace caf {
+ class PdmUiItem;
+}
+
+//==================================================================================================
+///
+//==================================================================================================
+class RicDeleteSubItemsFeature : public caf::CmdFeature
+{
+ CAF_CMD_HEADER_INIT;
+protected:
+
+ // Overrides
+ virtual bool isCommandEnabled();
+ virtual void onActionTriggered( bool isChecked );
+ virtual void setupActionLook( QAction* actionToSetup );
+
+private:
+ static bool hasDeletableSubItems(caf::PdmUiItem* uiItem);
+};
+
diff --git a/ApplicationCode/Commands/RicExportFaultsFeature.cpp b/ApplicationCode/Commands/RicExportFaultsFeature.cpp
index 293567a759..431ed0f0e2 100644
--- a/ApplicationCode/Commands/RicExportFaultsFeature.cpp
+++ b/ApplicationCode/Commands/RicExportFaultsFeature.cpp
@@ -20,16 +20,21 @@
#include "RicExportFaultsFeature.h"
#include "RiaApplication.h"
-#include "cafSelectionManager.h"
+
+#include "RigEclipseCaseData.h"
+#include "RigFault.h"
+#include "RigMainGrid.h"
+
+#include "RimDefines.h"
+#include "RimEclipseCase.h"
#include "RimFault.h"
+#include "cafSelectionManager.h"
+#include "cafUtils.h"
+
#include
#include
-#include "RimEclipseCase.h"
-#include "RigFault.h"
-#include "RigMainGrid.h"
-#include "RigCaseData.h"
-#include "QMessageBox"
+#include
CAF_CMD_SOURCE_INIT(RicExportFaultsFeature, "RicExportFaultsFeature");
@@ -52,6 +57,8 @@ bool RicExportFaultsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicExportFaultsFeature::onActionTriggered(bool isChecked)
{
+ this->disableModelChangeContribution();
+
std::vector selectedFaults;
caf::SelectionManager::instance()->objectsByType(&selectedFaults);
@@ -65,6 +72,11 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
QString selectedDir = QFileDialog::getExistingDirectory(NULL, tr("Select Directory"), defaultDir);
+ if (selectedDir.isNull()) {
+ // Stop if folder selection was cancelled.
+ return;
+ }
+
for (RimFault* rimFault : selectedFaults)
{
RimEclipseCase* eclCase = nullptr;
@@ -79,11 +91,11 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
if ( faultName == RimDefines::undefinedGridFaultWithInactiveName() ) faultName = "UNDEF_IA";
QString baseFilename = "Fault_" + faultName + "_" + caseName;
- baseFilename.replace(" ", "_");
+ baseFilename = caf::Utils::makeValidFileBasename(baseFilename);
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";
- RicExportFaultsFeature::saveFault(completeFilename, eclCase->reservoirData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
+ RicExportFaultsFeature::saveFault(completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
}
@@ -101,6 +113,75 @@ void RicExportFaultsFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setIcon(QIcon(":/Save.png"));
}
+//--------------------------------------------------------------------------------------------------
+/// Order FaultCellAndFace by i, j, face then k.
+//--------------------------------------------------------------------------------------------------
+bool RicExportFaultsFeature::faultOrdering(FaultCellAndFace first, FaultCellAndFace second)
+ {
+ size_t i1, i2, j1, j2, k1, k2;
+ cvf::StructGridInterface::FaceType f1, f2;
+ std::tie(i1, j1, k1, f1) = first;
+ std::tie(i2, j2, k2, f2) = second;
+ if (i1 == i2)
+ {
+ if (j1 == j2)
+ {
+ if (f1 == f2)
+ {
+ return k1 < k2;
+ }
+ else
+ {
+ return f1 < f2;
+ }
+ }
+ else
+ {
+ return j1 < j2;
+ }
+ }
+ else
+ {
+ return i1 < i2;
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+QString RicExportFaultsFeature::faceText(cvf::StructGridInterface::FaceType faceType)
+{
+ switch (faceType)
+ {
+ case cvf::StructGridInterface::POS_I: return QString(" I");
+ case cvf::StructGridInterface::NEG_I: return QString("-I");
+ case cvf::StructGridInterface::POS_J: return QString(" J");
+ case cvf::StructGridInterface::NEG_J: return QString("-J");
+ case cvf::StructGridInterface::POS_K: return QString(" K");
+ case cvf::StructGridInterface::NEG_K: return QString("-K");
+ default: CVF_ASSERT(false);
+ }
+ return "";
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicExportFaultsFeature::writeLine(QTextStream & stream, QString faultName, size_t i, size_t j, size_t startK, size_t endK, cvf::StructGridInterface::FaceType faceType)
+{
+ // Convert indices to eclipse format
+ i++;
+ j++;
+ startK++;
+ endK++;
+
+ stream << "'" << faultName << "'" << " " << i << " " << i
+ << " " << j << " " << j
+ << " " << startK << " " << endK
+ << " " << RicExportFaultsFeature::faceText(faceType) << " / ";
+ stream << endl;
+}
+
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -121,33 +202,55 @@ void RicExportFaultsFeature::saveFault(QString completeFilename, const RigMainGr
stream << "-- Name I1 I2 J1 J2 K1 K2 Face ( I/J/K )" << endl;
// 'NAME' 1 1 1 1 1 2 J /
-
- for (const RigFault::FaultFace& fface: faultFaces)
- {
- size_t i1, j1, k1, i2, j2, k2;
+
+ std::vector faultCellAndFaces;
- bool ok = mainGrid->ijkFromCellIndex(fface.m_nativeReservoirCellIndex, &i1, &j1, &k1);
+ for (const RigFault::FaultFace& faultCellAndFace : faultFaces)
+ {
+ size_t i, j, k;
+ bool ok = mainGrid->ijkFromCellIndex(faultCellAndFace.m_nativeReservoirCellIndex, &i, &j, &k);
if (!ok) continue;
- ok = mainGrid->ijkFromCellIndex(fface.m_oppositeReservoirCellIndex, &i2, &j2, &k2);
- QString faceText;
- switch (fface.m_nativeFace)
+ faultCellAndFaces.push_back(std::make_tuple(i, j, k, faultCellAndFace.m_nativeFace));
+ }
+
+ // Sort order: i, j, face then k.
+ std::sort(faultCellAndFaces.begin(), faultCellAndFaces.end(), RicExportFaultsFeature::faultOrdering);
+
+ size_t lastI = std::numeric_limits::max();
+ size_t lastJ = std::numeric_limits::max();
+ size_t lastK = std::numeric_limits::max();
+ size_t startK = std::numeric_limits::max();
+ cvf::StructGridInterface::FaceType lastFaceType = cvf::StructGridInterface::FaceType::NO_FACE;
+
+ for (const FaultCellAndFace &faultCellAndFace : faultCellAndFaces)
+ {
+ size_t i, j, k;
+ cvf::StructGridInterface::FaceType faceType;
+ std::tie(i, j, k, faceType) = faultCellAndFace;
+
+ if (i != lastI || j != lastJ || lastFaceType != faceType || k != lastK+1)
{
- case cvf::StructGridInterface::POS_I: faceText = " I"; break;
- case cvf::StructGridInterface::NEG_I: faceText = "-I"; break;
- case cvf::StructGridInterface::POS_J: faceText = " J"; break;
- case cvf::StructGridInterface::NEG_J: faceText = "-J"; break;
- case cvf::StructGridInterface::POS_K: faceText = " K"; break;
- case cvf::StructGridInterface::NEG_K: faceText = "-K"; break;
+ // No fault should have no face
+ if (lastFaceType != cvf::StructGridInterface::FaceType::NO_FACE)
+ {
+ RicExportFaultsFeature::writeLine(stream, faultName, lastI, lastJ, startK, lastK, lastFaceType);
+ }
+ lastI = i;
+ lastJ = j;
+ lastK = k;
+ lastFaceType = faceType;
+ startK = k;
+ }
+ else
+ {
+ lastK = k;
}
-
- stream << "'" << faultName << "'" << " " << i1 << " " << i2
- << " " << j1 << " " << j2
- << " " << k1 << " " << k2
- << " " << faceText << " / ";
- stream << endl ;
}
-
+ // No fault should have no face
+ if (lastFaceType != cvf::StructGridInterface::FaceType::NO_FACE)
+ {
+ RicExportFaultsFeature::writeLine(stream, faultName, lastI, lastJ, startK, lastK, lastFaceType);
+ }
stream << "/" << endl;
-
-}
\ No newline at end of file
+}
diff --git a/ApplicationCode/Commands/RicExportFaultsFeature.h b/ApplicationCode/Commands/RicExportFaultsFeature.h
index 33f9e5f78b..5633e1b4f1 100644
--- a/ApplicationCode/Commands/RicExportFaultsFeature.h
+++ b/ApplicationCode/Commands/RicExportFaultsFeature.h
@@ -26,6 +26,8 @@
class RigMainGrid;
+typedef std::tuple FaultCellAndFace;
+
//==================================================================================================
///
//==================================================================================================
@@ -41,5 +43,8 @@ class RicExportFaultsFeature : public caf::CmdFeature
private:
static void saveFault(QString completeFilename, const RigMainGrid* mainGrid, const std::vector& faultFaces, QString faultName);
+ static bool faultOrdering(FaultCellAndFace first, FaultCellAndFace second);
+ static QString faceText(cvf::StructGridInterface::FaceType faceType);
+ static void writeLine(QTextStream &stream, QString faultName, size_t i, size_t j, size_t startK, size_t endK, cvf::StructGridInterface::FaceType faceType);
};
diff --git a/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp b/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp
new file mode 100644
index 0000000000..5d8c09df3a
--- /dev/null
+++ b/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp
@@ -0,0 +1,325 @@
+/////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+// for more details.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+#include "RicExportMultipleSnapshotsFeature.h"
+
+#include "RiaApplication.h"
+
+#include "RicSnapshotViewToClipboardFeature.h"
+
+#include "RigFemResultPosEnum.h"
+
+#include "RimCase.h"
+#include "RimCellRangeFilter.h"
+#include "RimCellRangeFilterCollection.h"
+#include "RimEclipseCase.h"
+#include "RimEclipseCellColors.h"
+#include "RimEclipseView.h"
+#include "RimGeoMechCase.h"
+#include "RimGeoMechCellColors.h"
+#include "RimGeoMechResultDefinition.h"
+#include "RimGeoMechView.h"
+#include "RimMultiSnapshotDefinition.h"
+#include "RimProject.h"
+#include "RimView.h"
+
+#include "RiuExportMultipleSnapshotsWidget.h"
+#include "RiuViewer.h"
+
+#include "cafCmdExecCommandManager.h"
+#include "cafFrameAnimationControl.h"
+#include "cafUtils.h"
+
+#include
+#include
+#include
+
+
+CAF_CMD_SOURCE_INIT(RicExportMultipleSnapshotsFeature, "RicExportMultipleSnapshotsFeature");
+
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+bool RicExportMultipleSnapshotsFeature::isCommandEnabled()
+{
+ RimProject* proj = RiaApplication::instance()->project();
+
+ return proj;
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicExportMultipleSnapshotsFeature::onActionTriggered(bool isChecked)
+{
+ this->disableModelChangeContribution();
+
+ RimProject* proj = RiaApplication::instance()->project();
+
+ if (proj)
+ {
+ // Enable the command system to be able to assign a value to multiple fields at the same time
+ caf::CmdExecCommandSystemActivator activator;
+
+ RiuExportMultipleSnapshotsWidget dlg(nullptr, proj);
+
+ RimView* activeView = RiaApplication::instance()->activeReservoirView();
+ if (activeView && proj->multiSnapshotDefinitions.size() == 0)
+ {
+ dlg.addSnapshotItemFromActiveView();
+ dlg.addEmptySnapshotItems(4);
+ }
+
+ dlg.exec();
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicExportMultipleSnapshotsFeature::setupActionLook(QAction* actionToSetup)
+{
+ actionToSetup->setText("Advanced Snapshot Export ...");
+ actionToSetup->setIcon(QIcon(":/SnapShotSaveViews.png"));
+}
+
+//--------------------------------------------------------------------------------------------------
+///
+//--------------------------------------------------------------------------------------------------
+void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& folder, RimProject* project)
+{
+ if (!project) return;
+
+ QDir snapshotPath(folder);
+ if (!snapshotPath.exists())
+ {
+ if (!snapshotPath.mkpath(".")) return;
+ }
+
+ for (RimMultiSnapshotDefinition* msd : project->multiSnapshotDefinitions())
+ {
+ if (!msd->isActive()) continue;
+
+ RimView* sourceView = msd->view();
+ if (!sourceView) continue;
+ if (!sourceView->viewer()) continue;
+
+ int initialFramIndex = sourceView->viewer()->currentFrameIndex();
+
+ //exportViewVariations(sourceView, msd, folder);
+
+ for (RimCase* rimCase : msd->additionalCases())
+ {
+ RimEclipseCase* eclCase = dynamic_cast(rimCase);
+ RimEclipseView* sourceEclipseView = dynamic_cast(sourceView);
+ if (eclCase && sourceEclipseView)
+ {
+ RimEclipseView* copyOfEclipseView = eclCase->createCopyAndAddView(sourceEclipseView);
+ CVF_ASSERT(copyOfEclipseView);
+
+ copyOfEclipseView->loadDataAndUpdate();
+
+ exportViewVariations(copyOfEclipseView, msd, folder);
+
+ eclCase->reservoirViews().removeChildObject(copyOfEclipseView);
+
+ delete copyOfEclipseView;
+ }
+
+ RimGeoMechCase* geomCase = dynamic_cast(rimCase);
+ RimGeoMechView* sourceGeoMechView = dynamic_cast(sourceView);
+ if (geomCase && sourceGeoMechView)
+ {
+ RimGeoMechView* copyOfGeoMechView = dynamic_cast