Merge pull request #1536 from OPM/dev. Release 2017.05

Merge dev into master for release 2017.05
This commit is contained in:
Jacob Støren 2017-05-31 09:55:42 +02:00 committed by GitHub
commit 952b20b4ee
7540 changed files with 362381 additions and 312907 deletions

8
.gitignore vendored
View File

@ -57,11 +57,11 @@ CTest*.cmake
*.opensdf *.opensdf
*.unsuccessfulbuild *.unsuccessfulbuild
ipch/ ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad Ankh.NoLoad
#Temp files #Temp files
*.temp *.temp
/Resinsight_Host.includes
/Resinsight_Host.files
/Resinsight_Host.creator
/Resinsight_Host.config

View File

@ -322,3 +322,46 @@ exceptions:
CRAVA is a software package for seismic inversion and conditioning of CRAVA is a software package for seismic inversion and conditioning of
geological reservoir models. CRAVA is copyrighted by the Norwegian geological reservoir models. CRAVA is copyrighted by the Norwegian
Computing Center and Statoil and licensed under GPLv3+. 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 <http://www.gnu.org/licenses/>.
===============================================================================
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.

View File

@ -23,6 +23,7 @@
#include "RiaBaseDefs.h" #include "RiaBaseDefs.h"
#include "RiaImageCompareReporter.h" #include "RiaImageCompareReporter.h"
#include "RiaImageFileCompare.h" #include "RiaImageFileCompare.h"
#include "RiaLogging.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RiaProjectModifier.h" #include "RiaProjectModifier.h"
#include "RiaSocketServer.h" #include "RiaSocketServer.h"
@ -47,6 +48,8 @@
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimEclipseWellCollection.h" #include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h" #include "RimFaultCollection.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimFlowPlotCollection.h"
#include "RimFormationNamesCollection.h" #include "RimFormationNamesCollection.h"
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h" #include "RimGeoMechCellColors.h"
@ -64,8 +67,10 @@
#include "RimSummaryCurveFilter.h" #include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h" #include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h" #include "RimSummaryPlotCollection.h"
#include "RimTreeViewStateSerializer.h"
#include "RimViewLinker.h" #include "RimViewLinker.h"
#include "RimViewLinkerCollection.h" #include "RimViewLinkerCollection.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimWellPath.h" #include "RimWellPath.h"
@ -79,6 +84,8 @@
#include "RiuSummaryQwtPlot.h" #include "RiuSummaryQwtPlot.h"
#include "RiuViewer.h" #include "RiuViewer.h"
#include "RiuWellLogPlot.h" #include "RiuWellLogPlot.h"
#include "RiuWellAllocationPlot.h"
#include "RiuFlowCharacteristicsPlot.h"
#include "RicImportSummaryCaseFeature.h" #include "RicImportSummaryCaseFeature.h"
#include "RicSnapshotViewToClipboardFeature.h" #include "RicSnapshotViewToClipboardFeature.h"
@ -92,10 +99,12 @@
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h" #include "cafPdmFieldCvfMat4d.h"
#include "cafPdmSettings.h" #include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h"
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
#include "cafUiProcess.h" #include "cafUiProcess.h"
#include "cafUtils.h" #include "cafUtils.h"
#include "cvfProgramOptions.h" #include "cvfProgramOptions.h"
#include "cvfqtUtils.h" #include "cvfqtUtils.h"
@ -107,6 +116,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QTimer> #include <QTimer>
#include <QUrl> #include <QUrl>
#include <QTreeView>
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -114,6 +124,7 @@
#include <fcntl.h> #include <fcntl.h>
#endif #endif
namespace caf namespace caf
{ {
template<> template<>
@ -132,7 +143,7 @@ namespace RegTestNames
const QString generatedFolderName = "RegTestGeneratedImages"; const QString generatedFolderName = "RegTestGeneratedImages";
const QString diffFolderName = "RegTestDiffImages"; const QString diffFolderName = "RegTestDiffImages";
const QString baseFolderName = "RegTestBaseImages"; const QString baseFolderName = "RegTestBaseImages";
const QString testProjectName = "RegressionTest.rip"; const QString testProjectName = "RegressionTest";
const QString testFolderFilter = "TestCase*"; const QString testFolderFilter = "TestCase*";
const QString imageCompareExeName = "compare"; const QString imageCompareExeName = "compare";
const QString reportFileName = "ResInsightRegressionTestReport.html"; const QString reportFileName = "ResInsightRegressionTestReport.html";
@ -332,10 +343,16 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
closeProject(); closeProject();
RiaLogging::info(QString("Starting to open project file : '%1'").arg(projectFileName));
// Open the project file and read the serialized data. // Open the project file and read the serialized data.
// Will initialize itself. // 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->fileName = projectFileName;
m_project->readFile(); 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 // Execute command objects, and release the mutex when the queue is empty
executeCommandObjects(); executeCommandObjects();
RiaLogging::info(QString("Completed open of project file : '%1'").arg(projectFileName));
return true; return true;
} }
@ -554,6 +573,7 @@ void RiaApplication::loadAndUpdatePlotData()
{ {
RimWellLogPlotCollection* wlpColl = nullptr; RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr; RimSummaryPlotCollection* spColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection()) if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
{ {
@ -563,9 +583,15 @@ void RiaApplication::loadAndUpdatePlotData()
{ {
spColl = m_project->mainPlotCollection()->summaryPlotCollection(); spColl = m_project->mainPlotCollection()->summaryPlotCollection();
} }
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->flowPlotCollection())
{
flowColl = m_project->mainPlotCollection()->flowPlotCollection();
}
size_t plotCount = 0; size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 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"); caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
if (wlpColl) if (wlpColl)
@ -579,12 +605,60 @@ void RiaApplication::loadAndUpdatePlotData()
if (spColl) 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(); 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()); CVF_ASSERT(m_project.notNull());
if (!QFile::exists(m_project->fileName())) if (!caf::Utils::fileExists(m_project->fileName()))
{ {
return saveProjectPromptForFileName(); return saveProjectPromptForFileName();
} }
@ -687,6 +761,55 @@ bool RiaApplication::saveProjectPromptForFileName()
return bSaveOk; 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; m_project->fileName = fileName;
storeTreeViewState();
if (!m_project->writeFile()) 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)); 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); m_recentFileActionProvider->addFileName(fileName);
caf::PdmUiModelChangeDetector::instance()->reset();
return true; return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -793,16 +919,19 @@ QString RiaApplication::createAbsolutePathFromProjectRelativePath(QString projec
return projectRelativePath; return projectRelativePath;
} }
QString absolutePath;
if (m_project && !m_project->fileName().isEmpty()) if (m_project && !m_project->fileName().isEmpty())
{ {
QString absoluteProjectPath = QFileInfo(m_project->fileName()).absolutePath(); absolutePath = QFileInfo(m_project->fileName()).absolutePath();
QDir projectDir(absoluteProjectPath);
return projectDir.absoluteFilePath(projectRelativePath);
} }
else 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) bool RiaApplication::openEclipseCaseFromFile(const QString& fileName)
{ {
if (!QFile::exists(fileName)) return false; if (!caf::Utils::fileExists(fileName)) return false;
QFileInfo gridFileName(fileName); QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName(); QString caseName = gridFileName.completeBaseName();
@ -984,7 +1113,7 @@ bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNa
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaApplication::openOdbCaseFromFile(const QString& fileName) bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
{ {
if (!QFile::exists(fileName)) return false; if (!caf::Utils::fileExists(fileName)) return false;
QFileInfo gridFileName(fileName); QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName(); QString caseName = gridFileName.completeBaseName();
@ -1084,6 +1213,25 @@ RimView* RiaApplication::activeReservoirView()
return m_activeReservoirView; return m_activeReservoirView;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiaApplication::activePlotWindow() const
{
RimViewWindow* viewWindow = nullptr;
if ( m_mainPlotWindow )
{
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
if ( subwindows.size() > 0 )
{
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
}
}
return viewWindow;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1092,38 +1240,6 @@ void RiaApplication::setActiveReservoirView(RimView* rv)
m_activeReservoirView = rv; m_activeReservoirView = rv;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::setActiveWellLogPlot(RimWellLogPlot* wlp)
{
m_activeWellLogPlot = wlp;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RiaApplication::activeWellLogPlot()
{
return m_activeWellLogPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::setActiveSummaryPlot(RimSummaryPlot* sp)
{
m_activeSummaryPlot = sp;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlot* RiaApplication::activeSummaryPlot()
{
return m_activeSummaryPlot;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1283,7 +1399,8 @@ bool RiaApplication::parseArguments()
std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile); std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile);
runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots"); runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
closeProject(); closeAllWindows();
processEvents();
return false; return false;
} }
@ -1362,14 +1479,14 @@ bool RiaApplication::parseArguments()
foreach (QString caseName, caseNames) foreach (QString caseName, caseNames)
{ {
QString caseFileNameWithExt = caseName + ".EGRID"; QString caseFileNameWithExt = caseName + ".EGRID";
if (QFile::exists(caseFileNameWithExt)) if (!caf::Utils::fileExists(caseFileNameWithExt))
{ {
openEclipseCaseFromFile(caseFileNameWithExt); openEclipseCaseFromFile(caseFileNameWithExt);
} }
else else
{ {
caseFileNameWithExt = caseName + ".GRID"; caseFileNameWithExt = caseName + ".GRID";
if (QFile::exists(caseFileNameWithExt)) if (!caf::Utils::fileExists(caseFileNameWithExt))
{ {
openEclipseCaseFromFile(caseFileNameWithExt); openEclipseCaseFromFile(caseFileNameWithExt);
} }
@ -1436,7 +1553,8 @@ bool RiaApplication::parseArguments()
} }
} }
closeProject(); closeAllWindows();
processEvents();
} }
// Returning false will exit the application // Returning false will exit the application
@ -1555,6 +1673,16 @@ RiuMainPlotWindow* RiaApplication::mainPlotWindow()
return m_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; RimViewWindow* viewWindow = NULL;
QWidget* topLevelWidget = RiaApplication::activeWindow(); QWidget* mainWindowWidget = RiaApplication::activeWindow();
if (dynamic_cast<RiuMainWindow*>(topLevelWidget)) if (dynamic_cast<RiuMainWindow*>(mainWindowWidget))
{ {
viewWindow = RiaApplication::instance()->activeReservoirView(); viewWindow = RiaApplication::instance()->activeReservoirView();
} }
else if (dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget))
if (dynamic_cast<RiuMainPlotWindow*>(topLevelWidget))
{ {
RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(topLevelWidget); RiuMainPlotWindow* mainPlotWindow = dynamic_cast<RiuMainPlotWindow*>(mainWindowWidget);
QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder); QList<QMdiSubWindow*> subwindows = mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
if (subwindows.size() > 0) if (subwindows.size() > 0)
{ {
RiuSummaryQwtPlot* summaryQwtPlot = dynamic_cast<RiuSummaryQwtPlot*>(subwindows.back()->widget()); viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
if (summaryQwtPlot)
{
viewWindow = summaryQwtPlot->ownerPlotDefinition();
}
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subwindows.back()->widget());
if (wellLogPlot)
{
viewWindow = wellLogPlot->ownerPlotDefinition();
}
} }
} }
return viewWindow; 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()) if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
{ {
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText()); RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
if (mainPlotWindow()) mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
} }
caf::FixedAtlasFont::FontSize fontSizeType = caf::FixedAtlasFont::POINT_SIZE_16; 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) bool RiaApplication::openFile(const QString& fileName)
{ {
if (!QFile::exists(fileName)) return false; if (!caf::Utils::fileExists(fileName)) return false;
bool loadingSucceded = false; bool loadingSucceded = false;
if (fileName.contains(".rsp", Qt::CaseInsensitive) || fileName.contains(".rip", Qt::CaseInsensitive)) if (RiaApplication::hasValidProjectFileExtension(fileName))
{ {
loadingSucceded = loadProject(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; return loadingSucceded;
} }
@ -2086,7 +2228,7 @@ void RiaApplication::saveSnapshotForAllViews(const QString& snapshotFolderName)
viewer->repaint(); viewer->repaint();
QString fileName = cas->caseUserDescription() + "-" + riv->name(); QString fileName = cas->caseUserDescription() + "-" + riv->name();
fileName.replace(" ", "_"); fileName = caf::Utils::makeValidFileBasename(fileName);
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png"); QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
@ -2137,6 +2279,18 @@ void removeDirectoryWithContent(QDir dirToDelete )
dirToDelete.rmdir("."); 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) for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{ {
QDir testCaseFolder(folderList[dirIdx].filePath()); QDir testCaseFolder(folderList[dirIdx].filePath());
@ -2214,47 +2373,103 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx) for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{ {
QDir testCaseFolder(folderList[dirIdx].filePath()); QDir testCaseFolder(folderList[dirIdx].filePath());
if (testCaseFolder.exists(regTestProjectName))
QString projectFileName;
if (testCaseFolder.exists(regTestProjectName + ".rip"))
{ {
loadProject(testCaseFolder.filePath(regTestProjectName)); projectFileName = regTestProjectName + ".rip";
}
// Wait until all command objects have completed if (testCaseFolder.exists(regTestProjectName + ".rsp"))
while (!m_commandQueueLock.tryLock()) {
{ projectFileName = regTestProjectName + ".rsp";
processEvents(); }
}
m_commandQueueLock.unlock();
regressionTestConfigureProject(); if (!projectFileName.isEmpty())
{
logInfoTextWithTimeInSeconds(timeStamp, "Initializing test :" + testCaseFolder.absolutePath());
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName); loadProject(testCaseFolder.filePath(projectFileName));
saveSnapshotForAllViews(fullPathGeneratedFolder);
QDir baseDir(testCaseFolder.filePath(baseFolderName)); // Wait until all command objects have completed
QDir genDir(testCaseFolder.filePath(generatedFolderName)); while (!m_commandQueueLock.tryLock())
QDir diffDir(testCaseFolder.filePath(diffFolderName)); {
if (!diffDir.exists()) testCaseFolder.mkdir(diffFolderName); processEvents();
baseDir.setFilter(QDir::Files); }
QStringList baseImageFileNames = baseDir.entryList(); m_commandQueueLock.unlock();
for (int fIdx = 0; fIdx < baseImageFileNames.size(); ++fIdx) regressionTestConfigureProject();
{
QString fileName = baseImageFileNames[fIdx]; resizeMaximizedPlotWindows();
RiaImageFileCompare imgComparator(RegTestNames::imageCompareExeName);
bool ok = imgComparator.runComparison(genDir.filePath(fileName), baseDir.filePath(fileName), diffDir.filePath(fileName)); QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
if (!ok) 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(); 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; m_runningRegressionTests = false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::resizeMaximizedPlotWindows()
{
std::vector<RimViewWindow*> 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); bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions);
if (identicalGrid) if (identicalGrid)
{ {
if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData())) if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{ {
RimOilField* oilField = m_project->activeOilField(); RimOilField* oilField = m_project->activeOilField();
if (oilField && oilField->analysisModels()) 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 // 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);
}

View File

@ -43,7 +43,7 @@ class RiaPreferences;
class RiaProjectModifier; class RiaProjectModifier;
class RiaSocketServer; class RiaSocketServer;
class RigCaseData; class RigEclipseCaseData;
class RimCommandObject; class RimCommandObject;
class RimEclipseCase; class RimEclipseCase;
@ -53,7 +53,9 @@ class RimSummaryPlot;
class RimView; class RimView;
class RimViewWindow; class RimViewWindow;
class RimWellLogPlot; class RimWellLogPlot;
class RimWellAllocationPlot;
class RiuMainWindowBase;
class RiuMainPlotWindow; class RiuMainPlotWindow;
class RiuRecentFileActionProvider; class RiuRecentFileActionProvider;
@ -94,11 +96,7 @@ public:
RimView* activeReservoirView(); RimView* activeReservoirView();
const RimView* activeReservoirView() const; const RimView* activeReservoirView() const;
void setActiveWellLogPlot(RimWellLogPlot*); RimViewWindow* activePlotWindow() const;
RimWellLogPlot* activeWellLogPlot();
void setActiveSummaryPlot(RimSummaryPlot*);
RimSummaryPlot* activeSummaryPlot();
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate); void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
@ -128,15 +126,17 @@ public:
bool saveProject(); bool saveProject();
bool saveProjectAs(const QString& fileName); bool saveProjectAs(const QString& fileName);
bool saveProjectPromptForFileName(); bool saveProjectPromptForFileName();
static bool hasValidProjectFileExtension(const QString& fileName);
bool askUserToSaveModifiedProject();
void closeProject(); void closeProject();
void addWellPathsToModel(QList<QString> wellPathFilePaths); void addWellPathsToModel(QList<QString> wellPathFilePaths);
void addWellLogsToModel(const QList<QString>& wellLogFilePaths); void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
void saveSnapshotForAllViews(const QString& snapshotFolderName); void saveSnapshotForAllViews(const QString& snapshotFolderName);
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName); void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath); void runRegressionTest(const QString& testRootPath);
void updateRegressionTest(const QString& testRootPath );
void regressionTestConfigureProject();
void processNonGuiEvents(); void processNonGuiEvents();
@ -181,9 +181,13 @@ public:
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow(); RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
RiuMainPlotWindow* mainPlotWindow(); RiuMainPlotWindow* mainPlotWindow();
RiuMainWindowBase* mainWindowByID(int mainWindowID);
static RimViewWindow* activeViewWindow(); static RimViewWindow* activeViewWindow();
bool isMain3dWindowVisible() const;
bool isMainPlotWindowVisible() const;
bool tryCloseMainWindow(); bool tryCloseMainWindow();
bool tryClosePlotWindow(); bool tryClosePlotWindow();
@ -209,16 +213,26 @@ private:
void deleteMainPlotWindow(); void deleteMainPlotWindow();
void loadAndUpdatePlotData(); void loadAndUpdatePlotData();
void storeTreeViewState();
void resizeMaximizedPlotWindows();
void updateRegressionTest(const QString& testRootPath);
void regressionTestConfigureProject();
static QSize regressionDefaultImageSize();
private slots: private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void slotUpdateScheduledDisplayModels(); 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: private:
caf::PdmPointer<RimView> m_activeReservoirView; caf::PdmPointer<RimView> m_activeReservoirView;
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
caf::PdmPointer<RimProject> m_project; caf::PdmPointer<RimProject> m_project;

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaColorTables.h"
#include <QColor>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::normalPaletteColors()
{
static std::vector<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> colors{
cvf::Color3ub::BLACK,
cvf::Color3ub::WHITE
};
static caf::ColorTable colorTable = caf::ColorTable(colors);
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::whiteBlackPaletteColors()
{
static std::vector<cvf::Color3ub> colors{
cvf::Color3ub::WHITE,
cvf::Color3ub::BLACK
};
static caf::ColorTable colorTable = caf::ColorTable(colors);
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::pinkWhitePaletteColors()
{
static std::vector<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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<cvf::Color3ub> 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;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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();
};

View File

@ -36,7 +36,7 @@ public:
}; };
public: public:
RiaImageFileCompare(QString compareExecutable); explicit RiaImageFileCompare(QString compareExecutable);
~RiaImageFileCompare(); ~RiaImageFileCompare();
bool runComparison(QString imgFileName, QString refFileName, QString diffFileName); bool runComparison(QString imgFileName, QString refFileName, QString diffFileName);

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaLogging.h"
#include <sstream>
#ifdef WIN32
#pragma warning (push)
#pragma warning (disable: 4668)
#include <windows.h>
#pragma warning (pop)
#else
#include <cstring>
#include <cstdio>
#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 << "<no message>" << 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<DWORD>(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<RiaDefaultConsoleLogger*>(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());
}
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

@ -33,7 +33,7 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaPreferences::RiaPreferences(void) RiaPreferences::RiaPreferences(void)
{ {
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation mode", "", "", ""); CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation Mode", "", "", "");
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", ""); CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
@ -41,27 +41,27 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", ""); CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
scriptEditorExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); 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()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
octaveExecutable.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); 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); 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); ssihubAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", ""); 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(&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(&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(&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(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "");
CAF_PDM_InitField(&fontSizeInScene, "fontSizeInScene", QString("8"), "Font size", "", "", ""); 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); showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", ""); CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
@ -77,21 +77,22 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", ""); CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.uiCapability()->setUiHidden(true); 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); 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); loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", ""); CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader Settings", "", "", "");
readerSettings = new RifReaderSettings; 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); autoCreatePlotsOnImport.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", ""); CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", "");
m_tabNames << "General"; m_tabNames << "General";
m_tabNames << "Eclipse";
m_tabNames << "Octave"; m_tabNames << "Octave";
m_tabNames << "Summary"; m_tabNames << "Summary";
} }
@ -113,7 +114,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
if (field == &scriptDirectories) if (field == &scriptDirectories)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
@ -129,7 +130,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &showLasCurveWithoutTvdWarning || field == &showLasCurveWithoutTvdWarning ||
field == &autoCreatePlotsOnImport) field == &autoCreatePlotsOnImport)
{ {
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute); caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_useNativeCheckBoxLabel = true; myAttr->m_useNativeCheckBoxLabel = true;
@ -144,38 +145,36 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{ {
if (uiConfigName == m_tabNames[0]) if (uiConfigName == m_tabNames[0])
{ {
caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings"); caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default Settings");
defaultSettingsGroup->add(&defaultViewerBackgroundColor); defaultSettingsGroup->add(&defaultViewerBackgroundColor);
defaultSettingsGroup->add(&defaultGridLines); defaultSettingsGroup->add(&defaultGridLines);
defaultSettingsGroup->add(&defaultGridLineColors); defaultSettingsGroup->add(&defaultGridLineColors);
defaultSettingsGroup->add(&defaultFaultGridLineColors); defaultSettingsGroup->add(&defaultFaultGridLineColors);
defaultSettingsGroup->add(&defaultWellLabelColor); defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&fontSizeInScene); 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(&navigationPolicy);
viewsGroup->add(&useShaders); viewsGroup->add(&useShaders);
viewsGroup->add(&showHud); 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<caf::PdmFieldHandle*> readerSettingsFields;
readerSettings->fields(readerSettingsFields);
for (size_t i = 0; i < readerSettingsFields.size(); i++)
{
newCaseBehaviourGroup->add(readerSettingsFields[i]);
}
caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup("SSIHUB"); caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup("Other");
ssihubGroup->add(&ssihubAddress); otherGroup->add(&ssihubAddress);
otherGroup->add(&showLasCurveWithoutTvdWarning);
uiOrdering.add(&appendClassNameToUiText); uiOrdering.add(&appendClassNameToUiText);
} }
else if (uiConfigName == m_tabNames[1]) 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"); caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
octaveGroup->add(&octaveExecutable); octaveGroup->add(&octaveExecutable);
@ -185,13 +184,13 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
scriptGroup->add(&scriptDirectories); scriptGroup->add(&scriptDirectories);
scriptGroup->add(&scriptEditorExecutable); scriptGroup->add(&scriptEditorExecutable);
} }
else if (uiConfigName == m_tabNames[2]) else if (uiConfigName == m_tabNames[3])
{ {
uiOrdering.add(&autoCreatePlotsOnImport); uiOrdering.add(&autoCreatePlotsOnImport);
uiOrdering.add(&defaultCurveFilter); uiOrdering.add(&defaultCurveFilter);
} }
uiOrdering.setForgetRemainingFields(true); uiOrdering.skipRemainingFields(true);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -51,7 +51,7 @@ void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
{ {
if (field == &applicationWorkingFolder || field == &regressionTestFolder) if (field == &applicationWorkingFolder || field == &regressionTestFolder)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;

View File

@ -29,10 +29,10 @@ include_directories(
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src ${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
${ERT_INCLUDE_DIRS} ${ERT_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${boost-Subset_SOURCE_DIR}
${ResInsight_SOURCE_DIR}/ThirdParty/custom-opm-common/opm-common/
${custom-opm-parser_SOURCE_DIR}/opm-parser/
${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/ ${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}
${CMAKE_CURRENT_SOURCE_DIR}/Adm ${CMAKE_CURRENT_SOURCE_DIR}/Adm
@ -45,8 +45,11 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox ${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections ${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface ${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel ${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary ${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache ${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel ${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub ${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
@ -74,6 +77,9 @@ set( APPLICATION_FILES
Application/RiaImageCompareReporter.cpp Application/RiaImageCompareReporter.cpp
Application/RiaProjectModifier.cpp Application/RiaProjectModifier.cpp
Application/RiaRegressionTest.cpp Application/RiaRegressionTest.cpp
Application/RiaColorTables.cpp
Application/RiaLogging.h
Application/RiaLogging.cpp
) )
set( SOCKET_INTERFACE_FILES set( SOCKET_INTERFACE_FILES
@ -100,6 +106,7 @@ list( APPEND REFERENCED_CMAKE_FILES
ProjectDataModel/CMakeLists_files.cmake ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/Summary/CMakeLists_files.cmake ProjectDataModel/Summary/CMakeLists_files.cmake
ProjectDataModel/Flow/CMakeLists_files.cmake
GeoMech/GeoMechVisualization/CMakeLists_files.cmake GeoMech/GeoMechVisualization/CMakeLists_files.cmake
@ -113,6 +120,8 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/ApplicationCommands/CMakeLists_files.cmake Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/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/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
@ -267,23 +276,8 @@ endif ()
# Set up libraries and dependent projects to link with # 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 set( LINK_LIBRARIES
custom-opm-parser ${OPM_LIBRARIES}
custom-opm-flowdiagnostics
WellPathImportSsihub WellPathImportSsihub
@ -295,15 +289,12 @@ set( LINK_LIBRARIES
${ERT_LIBRARIES} ${ERT_LIBRARIES}
NRLib ${THIRD_PARTY_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${QT_LIBRARIES} ${QT_LIBRARIES}
${RI_BOOST_LIBRARIES}
Qwt
) )
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} ) 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 # 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 # multiple QRC files are not supported
set_source_files_properties (qrc_cafAnimControl.cxx PROPERTIES COTIRE_EXCLUDED TRUE) 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 # variables at global file scope
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE) set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
@ -347,13 +335,9 @@ if(RESINSIGHT_ENABLE_COTIRE)
# using namespace cvf # using namespace cvf
set_source_files_properties (GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 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/cvfGeometryTools-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
# opm parser # 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 (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) 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}") 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() endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# put a .exe.local file in the target directory to pick up DLLs from there # 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 set (RESINSIGHT_FILES
${QT_BINARY_DIR}/QtCore4.dll ${QT_BINARY_DIR}/QtCore4.dll
@ -485,19 +459,19 @@ if (RESINSIGHT_PRIVATE_INSTALL)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON) set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON)
set(CMAKE_INSTALL_OPENMP_LIBRARIES ON) set(CMAKE_INSTALL_OPENMP_LIBRARIES ON)
include(InstallRequiredSystemLibraries) 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() endif()
set (RESINSIGHT_FILES ${RESINSIGHT_FILES} ${RESINSIGHT_LICENSE_FILES}) 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") 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() endif()
else (RESINSIGHT_PRIVATE_INSTALL) else (RESINSIGHT_PRIVATE_INSTALL)

View File

@ -17,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h ${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h ${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h ${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES 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}RicCloseProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp ${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp ${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES
@ -42,10 +44,10 @@ list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES} ${SOURCE_GROUP_SOURCE_FILES}
) )
#set (QT_MOC_HEADERS set (QT_MOC_HEADERS
#${QT_MOC_HEADERS} ${QT_MOC_HEADERS}
#${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.h ${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 ) source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -37,8 +37,12 @@ bool RicCloseProjectFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCloseProjectFeature::onActionTriggered(bool isChecked) void RicCloseProjectFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
if (!app->askUserToSaveModifiedProject()) return;
app->closeProject(); app->closeProject();
} }

View File

@ -42,6 +42,8 @@ bool RicEditPreferencesFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicEditPreferencesFeature::onActionTriggered(bool isChecked) void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
QStringList tabNames = app->preferences()->tabNames(); QStringList tabNames = app->preferences()->tabNames();

View File

@ -37,7 +37,11 @@ bool RicExitApplicationFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExitApplicationFeature::onActionTriggered(bool isChecked) void RicExitApplicationFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
if (!app->askUserToSaveModifiedProject()) return;
app->closeAllWindows(); app->closeAllWindows();
} }
@ -47,4 +51,5 @@ void RicExitApplicationFeature::onActionTriggered(bool isChecked)
void RicExitApplicationFeature::setupActionLook(QAction* actionToSetup) void RicExitApplicationFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("E&xit"); actionToSetup->setText("E&xit");
actionToSetup->setShortcuts(QKeySequence::Quit);
} }

View File

@ -48,6 +48,8 @@ bool RicHelpAboutFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicHelpAboutFeature::onActionTriggered(bool isChecked) void RicHelpAboutFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
caf::AboutDialog dlg(NULL); caf::AboutDialog dlg(NULL);
dlg.setApplicationName(RI_APPLICATION_NAME); dlg.setApplicationName(RI_APPLICATION_NAME);
@ -100,6 +102,8 @@ bool RicHelpCommandLineFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicHelpCommandLineFeature::onActionTriggered(bool isChecked) void RicHelpCommandLineFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
QString text = app->commandLineParameterHelp(); QString text = app->commandLineParameterHelp();
app->showFormattedTextInMessageBox(text); app->showFormattedTextInMessageBox(text);
@ -131,6 +135,8 @@ bool RicHelpOpenUsersGuideFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicHelpOpenUsersGuideFeature::onActionTriggered(bool isChecked) void RicHelpOpenUsersGuideFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
QString usersGuideUrl = "http://resinsight.org/docs/home"; QString usersGuideUrl = "http://resinsight.org/docs/home";
if (!QDesktopServices::openUrl(usersGuideUrl)) if (!QDesktopServices::openUrl(usersGuideUrl))

View File

@ -39,6 +39,8 @@ bool RicLaunchUnitTestsFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicLaunchUnitTestsFeature::onActionTriggered(bool isChecked) void RicLaunchUnitTestsFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiaApplication::instance()->launchUnitTestsWithConsole(); RiaApplication::instance()->launchUnitTestsWithConsole();
} }

View File

@ -41,6 +41,9 @@ bool RicOpenLastUsedFileFeature::isCommandEnabled()
void RicOpenLastUsedFileFeature::onActionTriggered(bool isChecked) void RicOpenLastUsedFileFeature::onActionTriggered(bool isChecked)
{ {
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
if (!app->askUserToSaveModifiedProject()) return;
QString fileName = app->preferences()->lastUsedProjectFileName; QString fileName = app->preferences()->lastUsedProjectFileName;
if (app->loadProject(fileName)) if (app->loadProject(fileName))

View File

@ -42,6 +42,9 @@ bool RicOpenProjectFeature::isCommandEnabled()
void RicOpenProjectFeature::onActionTriggered(bool isChecked) void RicOpenProjectFeature::onActionTriggered(bool isChecked)
{ {
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
if (!app->askUserToSaveModifiedProject()) return;
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID"); QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
QString fileName = QFileDialog::getOpenFileName(NULL, "Open ResInsight Project", defaultDir, "ResInsight project (*.rsp *.rip);;All files(*.*)"); 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->setText("Open Project");
actionToSetup->setIcon(QIcon(":/openFolder24x24.png")); actionToSetup->setIcon(QIcon(":/openFolder24x24.png"));
actionToSetup->setShortcuts(QKeySequence::Open);
} }

View File

@ -40,9 +40,9 @@ bool RicSaveProjectAsFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSaveProjectAsFeature::onActionTriggered(bool isChecked) void RicSaveProjectAsFeature::onActionTriggered(bool isChecked)
{ {
RiaApplication* app = RiaApplication::instance(); this->disableModelChangeContribution();
RicSaveProjectFeature::storeTreeViewState(); RiaApplication* app = RiaApplication::instance();
app->saveProjectPromptForFileName(); app->saveProjectPromptForFileName();
} }
@ -54,4 +54,5 @@ void RicSaveProjectAsFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Save Project &As"); actionToSetup->setText("Save Project &As");
actionToSetup->setIcon(QIcon(":/Save.png")); actionToSetup->setIcon(QIcon(":/Save.png"));
actionToSetup->setShortcuts(QKeySequence::SaveAs);
} }

View File

@ -20,16 +20,7 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimTreeViewStateSerializer.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "RiuMainPlotWindow.h"
#include "cafPdmUiTreeView.h"
#include <QAction> #include <QAction>
#include <QTreeView>
CAF_CMD_SOURCE_INIT(RicSaveProjectFeature, "RicSaveProjectFeature"); CAF_CMD_SOURCE_INIT(RicSaveProjectFeature, "RicSaveProjectFeature");
@ -46,9 +37,9 @@ bool RicSaveProjectFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSaveProjectFeature::onActionTriggered(bool isChecked) void RicSaveProjectFeature::onActionTriggered(bool isChecked)
{ {
RiaApplication* app = RiaApplication::instance(); this->disableModelChangeContribution();
RicSaveProjectFeature::storeTreeViewState(); RiaApplication* app = RiaApplication::instance();
app->saveProject(); app->saveProject();
} }
@ -60,47 +51,7 @@ void RicSaveProjectFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("&Save Project"); actionToSetup->setText("&Save Project");
actionToSetup->setIcon(QIcon(":/Save.png")); 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;
}
}
}

View File

@ -28,9 +28,6 @@ class RicSaveProjectFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public:
static void storeTreeViewState();
protected: protected:
// Overrides // Overrides
virtual bool isCommandEnabled() override; virtual bool isCommandEnabled() override;

View File

@ -39,6 +39,8 @@ bool RicShowMainWindowFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::onActionTriggered(bool isChecked) void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiuMainWindow* mainWnd = RiuMainWindow::instance(); RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (mainWnd->isMinimized()) if (mainWnd->isMinimized())

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicShowPlotDataFeature.h"
#include "RiaApplication.h"
#include "RimSummaryPlot.h"
#include "RimWellLogPlot.h"
#include "RiuMainPlotWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QBoxLayout>
#include <QClipboard>
#include <QMenu>
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<RimSummaryPlot*> selectedSummaryPlots;
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
if (selectedSummaryPlots.size() > 0) return true;
std::vector<RimWellLogPlot*> wellLogPlots;
caf::SelectionManager::instance()->objectsByType(&wellLogPlots);
if (wellLogPlots.size() > 0) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
{
this->disableModelChangeContribution();
std::vector<RimSummaryPlot*> selectedSummaryPlots;
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
std::vector<RimWellLogPlot*> 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);
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <QDialog>
#include <QPlainTextEdit>
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);
};

View File

@ -37,6 +37,8 @@ bool RicShowPlotWindowFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicShowPlotWindowFeature::onActionTriggered(bool isChecked) void RicShowPlotWindowFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
} }

View File

@ -47,6 +47,8 @@ bool RicTileWindowsFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicTileWindowsFeature::onActionTriggered(bool isChecked) void RicTileWindowsFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RiuMainWindow* mainWindow = RiuMainWindow::instance(); RiuMainWindow* mainWindow = RiuMainWindow::instance();
if (mainWindow) if (mainWindow)
{ {

View File

@ -35,13 +35,18 @@ ${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h ${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h
${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h
# General delete of any object in a child array field # General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h ${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES 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}RicImportSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.cpp
# General delete of any object in a child array field # General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@ -32,7 +32,7 @@ class RimIntersectionCollection;
class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand
{ {
public: public:
RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection); explicit RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicAppendIntersectionFeatureCmd(); virtual ~RicAppendIntersectionFeatureCmd();
virtual QString name(); virtual QString name();

View File

@ -37,7 +37,7 @@ class RimIntersectionCollection;
class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand
{ {
public: public:
RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection); explicit RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicNewPolylineIntersectionFeatureCmd(); virtual ~RicNewPolylineIntersectionFeatureCmd();
virtual QString name(); virtual QString name();

View File

@ -75,7 +75,7 @@ void RicNewSimWellIntersectionFeature::setupActionLook(QAction* actionToSetup)
RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimEclipseWell* simWell) RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimEclipseWell* simWell)
: CmdExecuteCommand(NULL), : CmdExecuteCommand(NULL),
m_intersectionCollection(intersectionCollection), m_intersectionCollection(intersectionCollection),
m_wellPath(simWell) m_simWell(simWell)
{ {
} }
@ -100,12 +100,12 @@ QString RicNewSimWellIntersectionCmd::name()
void RicNewSimWellIntersectionCmd::redo() void RicNewSimWellIntersectionCmd::redo()
{ {
CVF_ASSERT(m_intersectionCollection); CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT(m_wellPath); CVF_ASSERT(m_simWell);
RimIntersection* intersection = new RimIntersection(); RimIntersection* intersection = new RimIntersection();
intersection->name = m_wellPath->name; intersection->name = m_simWell->name;
intersection->type = RimIntersection::CS_SIMULATION_WELL; intersection->type = RimIntersection::CS_SIMULATION_WELL;
intersection->simulationWell = m_wellPath; intersection->simulationWell = m_simWell;
m_intersectionCollection->appendIntersection(intersection); m_intersectionCollection->appendIntersection(intersection);
} }

View File

@ -42,7 +42,7 @@ public:
private: private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection; caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
caf::PdmPointer<RimEclipseWell> m_wellPath; caf::PdmPointer<RimEclipseWell> m_simWell;
}; };

View File

@ -6,7 +6,6 @@ endif()
set (SOURCE_GROUP_HEADER_FILES set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.h ${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.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}RicEclipsePropertyFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.h
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h ${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp ${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.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}RicEclipsePropertyFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicApplyPropertyFilterAsCellResultFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@ -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 )

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicEclipseWellFeatureImpl.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicEclipseWellFeatureImpl::isAnyWellSelected()
{
std::vector<RimEclipseWell*> selection = selectedWells();
if (selection.size() > 0)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipseWell*> RicEclipseWellFeatureImpl::selectedWells()
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWellCollection* RicEclipseWellFeatureImpl::wellCollectionFromSelection()
{
std::vector<RimEclipseWell*> selection = selectedWells();
if (selection.size() > 0)
{
RimEclipseWell* firstWell = selection[0];
RimEclipseWellCollection* wellCollection = nullptr;
firstWell->firstAncestorOrThisOfType(wellCollection);
return wellCollection;
}
return nullptr;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimEclipseWell;
class RimEclipseWellCollection;
//==================================================================================================
///
//==================================================================================================
class RicEclipseWellFeatureImpl
{
public:
static bool isAnyWellSelected();
static std::vector<RimEclipseWell*> selectedWells();
static RimEclipseWellCollection* wellCollectionFromSelection();
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicEclipseWellShowFeatures.h"
#include "RicEclipseWellFeatureImpl.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicEclipseWellShowLabelFeature, "RicEclipseWellShowLabelFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipseWellShowLabelFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
if (selection.size() > 0)
{
RimEclipseWell* well = selection[0];
return well->showWellCellFence();
}
return false;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

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

View File

@ -1,115 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAddOpmInputPropertyFeature.h"
#include "RiaApplication.h"
#include "RimEclipseInputCaseOpm.h"
#include "RimEclipseInputPropertyCollection.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QFileDialog>
#include <QFileInfo>
#include <QStringList>
CAF_CMD_SOURCE_INIT(RicAddOpmInputPropertyFeature, "RicAddOpmInputPropertyFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAddOpmInputPropertyFeature::isCommandEnabled()
{
RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection();
if (inputProp)
{
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
inputProp->firstAncestorOrThisOfType(inputCaseOpm);
if (inputCaseOpm)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddOpmInputPropertyFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QStringList fileNames = QFileDialog::getOpenFileNames(NULL, "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
if (fileNames.isEmpty()) return;
// Remember the directory to next time
defaultDir = QFileInfo(fileNames.last()).absolutePath();
app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir);
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
if (inputPropertyCollection)
{
addEclipseInputProperty(fileNames, inputPropertyCollection);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddOpmInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Add Input Property");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseInputPropertyCollection* RicAddOpmInputPropertyFeature::selectedInputPropertyCollection() const
{
std::vector<RimEclipseInputPropertyCollection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddOpmInputPropertyFeature::addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection)
{
CVF_ASSERT(inputPropertyCollection);
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
inputPropertyCollection->firstAncestorOrThisOfType(inputCaseOpm);
if (inputCaseOpm)
{
inputCaseOpm->appendPropertiesFromStandaloneFiles(fileNames);
}
inputPropertyCollection->updateConnectedEditors();
}

View File

@ -1,45 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimEclipseInputPropertyCollection;
class QStringList;
//==================================================================================================
///
//==================================================================================================
class RicAddOpmInputPropertyFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimEclipseInputPropertyCollection* selectedInputPropertyCollection() const;
static void addEclipseInputProperty(const QStringList& fileNames, RimEclipseInputPropertyCollection* inputPropertyCollection);
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
CAF_CMD_SOURCE_INIT(RicApplyPropertyFilterAsCellResultFeature, "RicApplyPropertyFilterAsCellResultFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicApplyPropertyFilterAsCellResultFeature::isCommandEnabled()
{
{
std::vector<RimEclipsePropertyFilter*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
{
return true;
}
}
{
std::vector<RimGeoMechPropertyFilter*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered(bool isChecked)
{
{
std::vector<RimEclipsePropertyFilter*> 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<RimGeoMechPropertyFilter*> 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"));
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

@ -34,10 +34,7 @@ CAF_CMD_SOURCE_INIT(RicCreateGridCaseGroupFeature, "RicCreateGridCaseGroupFeatur
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCreateGridCaseGroupFeature::isCommandEnabled() bool RicCreateGridCaseGroupFeature::isCommandEnabled()
{ {
std::vector<RimEclipseCaseCollection*> selection; return true;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -63,6 +63,7 @@ void RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(RimEclipsePropertyFi
setDefaults(propertyFilter); setDefaults(propertyFilter);
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED); propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
propertyFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
propertyFilterCollection->updateConnectedEditors(); propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(propertyFilter); RiuMainWindow::instance()->selectAsCurrentItem(propertyFilter);
@ -79,6 +80,7 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter(RimEclipsePropert
setDefaults(propertyFilter); setDefaults(propertyFilter);
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED); propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
propertyFilterCollection->reservoirView()->scheduleCreateDisplayModelAndRedraw();
propertyFilterCollection->updateConnectedEditors(); propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(propertyFilter); RiuMainWindow::instance()->selectAsCurrentItem(propertyFilter);
@ -110,18 +112,17 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
{ {
CVF_ASSERT(propertyFilter); CVF_ASSERT(propertyFilter);
RimEclipsePropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer(); RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
CVF_ASSERT(propertyFilterCollection); propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
RimEclipseView* reservoirView = propertyFilterCollection->reservoirView(); RimEclipseView* reservoirView = nullptr;
CVF_ASSERT(reservoirView); propertyFilter->firstAncestorOrThisOfTypeAsserted(reservoirView);
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase()); propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
propertyFilter->resultDefinition->setResultVariable(reservoirView->cellResult->resultVariable()); propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);
propertyFilter->resultDefinition->setPorosityModel(reservoirView->cellResult->porosityModel());
propertyFilter->resultDefinition->setResultType(reservoirView->cellResult->resultType());
propertyFilter->resultDefinition->loadResult(); propertyFilter->resultDefinition->loadResult();
propertyFilter->setToDefaultValues(); propertyFilter->setToDefaultValues();
propertyFilter->updateFilterName(); propertyFilter->updateFilterName();
propertyFilter->m_categorySelection = true; propertyFilter->m_useCategorySelection = true;
} }

View File

@ -57,8 +57,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterInsertExec::redo() void RicEclipsePropertyFilterInsertExec::redo()
{ {
RimEclipsePropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer(); RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
CVF_ASSERT(propertyFilterCollection); m_propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter); size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size()); CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());

View File

@ -30,7 +30,7 @@ class RimEclipsePropertyFilter;
class RicEclipsePropertyFilterInsertExec : public caf::CmdExecuteCommand class RicEclipsePropertyFilterInsertExec : public caf::CmdExecuteCommand
{ {
public: public:
RicEclipsePropertyFilterInsertExec(RimEclipsePropertyFilter* propertyFilter); explicit RicEclipsePropertyFilterInsertExec(RimEclipsePropertyFilter* propertyFilter);
virtual ~RicEclipsePropertyFilterInsertExec(); virtual ~RicEclipsePropertyFilterInsertExec();
virtual QString name(); virtual QString name();

View File

@ -30,7 +30,7 @@ class RimEclipsePropertyFilterCollection;
class RicEclipsePropertyFilterNewExec : public caf::CmdExecuteCommand class RicEclipsePropertyFilterNewExec : public caf::CmdExecuteCommand
{ {
public: public:
RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection); explicit RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection);
virtual ~RicEclipsePropertyFilterNewExec(); virtual ~RicEclipsePropertyFilterNewExec();
virtual QString name(); virtual QString name();

View File

@ -1,100 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicImportInputEclipseCaseOpmFeature.h"
#include "RiaApplication.h"
#include "RimDefines.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseInputCaseOpm.h"
#include "RimEclipseView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QFileDialog>
CAF_CMD_SOURCE_INIT(RicImportInputEclipseCaseOpmFeature, "RicImportInputEclipseCaseOpmFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportInputEclipseCaseOpmFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportInputEclipseCaseOpmFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QString fileName = QFileDialog::getOpenFileName(RiuMainWindow::instance(), "Import Eclipse Input file", defaultDir, "Eclipse Input Files (*.GRDECL);;All Files (*.*)");
if (fileName.isEmpty()) return;
// Remember the path to next time
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileName).absolutePath());
RimProject* proj = app->project();
RimEclipseCaseCollection* analysisModels = proj->activeOilField() ? proj->activeOilField()->analysisModels() : NULL;
if (analysisModels)
{
// This code originates from RiaApplication::openInputEclipseCaseFromFileNames
RimEclipseInputCaseOpm* rimInputReservoir = new RimEclipseInputCaseOpm();
proj->assignCaseIdToCase(rimInputReservoir);
rimInputReservoir->importNewEclipseGridAndProperties(fileName);
analysisModels->cases.push_back(rimInputReservoir);
RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView();
riv->cellResult()->setResultType(RimDefines::INPUT_PROPERTY);
riv->hasUserRequestedAnimation = true;
riv->loadDataAndUpdate();
if (!riv->cellResult()->hasResult())
{
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
}
analysisModels->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportInputEclipseCaseOpmFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/EclipseInput48x48.png"));
actionToSetup->setText("Import Input Eclipse Case (opm-parser) - BETA");
}

View File

@ -1,39 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicImportInputEclipseCaseOpmFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -51,6 +51,8 @@ bool RicSaveEclipseInputPropertyFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked) void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
RimEclipseInputProperty* inputProperty = selectedInputProperty(); RimEclipseInputProperty* inputProperty = selectedInputProperty();
if (!inputProperty) return; if (!inputProperty) return;
@ -99,7 +101,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", ""); caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", "");
if (propertyDialog.exec() == QDialog::Accepted) 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) if (isOk)
{ {
inputProperty->fileName = exportSettings.fileName; inputProperty->fileName = exportSettings.fileName;
@ -116,7 +118,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSaveEclipseInputPropertyFeature::setupActionLook(QAction* actionToSetup) void RicSaveEclipseInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Save Property To File"); actionToSetup->setText("Export Property To File");
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -24,7 +24,6 @@
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RigCaseData.h"
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
#include "RifEclipseInputFileTools.h" #include "RifEclipseInputFileTools.h"
@ -37,6 +36,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include "cafUtils.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -60,7 +60,7 @@ RicSaveEclipseResultAsInputPropertyExec::~RicSaveEclipseResultAsInputPropertyExe
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RicSaveEclipseResultAsInputPropertyExec::name() 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()) return;
if (!m_cellColors->reservoirView()->eclipseCase()) return; if (!m_cellColors->reservoirView()->eclipseCase()) return;
if (!m_cellColors->reservoirView()->eclipseCase()->reservoirData()) return; if (!m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData()) return;
RimBinaryExportSettings exportSettings; RimBinaryExportSettings exportSettings;
exportSettings.eclipseKeyword = m_cellColors->resultVariable(); exportSettings.eclipseKeyword = m_cellColors->resultVariable();
@ -84,18 +84,18 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc(); projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
} }
QString outputFileName = projectFolder + "/" + m_cellColors->resultVariable(); QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiShortName());
exportSettings.fileName = outputFileName; exportSettings.fileName = outputFileName;
} }
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", ""); caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", "");
if (propertyDialog.exec() == QDialog::Accepted) if (propertyDialog.exec() == QDialog::Accepted)
{ {
size_t timeStep = m_cellColors->reservoirView()->currentTimeStep(); 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) if (!isOk)
{ {
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName); QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);

View File

@ -30,7 +30,7 @@ class RimEclipseCellColors;
class RicSaveEclipseResultAsInputPropertyExec : public caf::CmdExecuteCommand class RicSaveEclipseResultAsInputPropertyExec : public caf::CmdExecuteCommand
{ {
public: public:
RicSaveEclipseResultAsInputPropertyExec(RimEclipseCellColors* cellColors); explicit RicSaveEclipseResultAsInputPropertyExec(RimEclipseCellColors* cellColors);
virtual ~RicSaveEclipseResultAsInputPropertyExec(); virtual ~RicSaveEclipseResultAsInputPropertyExec();
virtual QString name(); virtual QString name();

View File

@ -47,6 +47,8 @@ bool RicSaveEclipseResultAsInputPropertyFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecked) void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
std::vector<RimEclipseCellColors*> selection; std::vector<RimEclipseCellColors*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() == 1) if (selection.size() == 1)
@ -61,7 +63,7 @@ void RicSaveEclipseResultAsInputPropertyFeature::onActionTriggered(bool isChecke
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicSaveEclipseResultAsInputPropertyFeature::setupActionLook(QAction* actionToSetup) void RicSaveEclipseResultAsInputPropertyFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Save Property To File"); actionToSetup->setText("Export Property To File");
} }

View File

@ -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 )

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
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<RimWellAllocationPlot*>(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<RimWellAllocationPlot*>(caf::SelectionManager::instance()->selectedItem());
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(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");
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
CAF_CMD_SOURCE_INIT(RicPlotProductionRateFeature, "RicPlotProductionRateFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPlotProductionRateFeature::isCommandEnabled()
{
std::vector<RimEclipseWell*> 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<RimEclipseWell*> 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<RimGridSummaryCase*>(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;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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);
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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<caf::PdmOptionItemInfo> RicSelectViewUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> 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);
}
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
caf::PdmPtrField<RimEclipseView*> m_selectedView;
caf::PdmField<bool> m_createNewView;
caf::PdmField<QString> m_newViewName;
RimEclipseView* m_currentView;
RimEclipseResultCase* m_currentCase;
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFeature::isCommandEnabled()
{
std::vector<RimEclipseWell*> 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<RimEclipseWell*> 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<RimView*> 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");
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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<RimEclipseView*>(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<RimEclipseView*>(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<RimEclipseView*>(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<QString> 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<QString> RicShowContributingWellsFeatureImpl::findContributingTracerNames(
const RimFlowDiagSolution* flowDiagSolution,
const RigSingleWellResultsData* wellResults,
int timeStep)
{
std::vector<QString> 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<QString> tracerNames = flowDiagSolution->tracerNames();
for (const QString& tracerName : tracerNames)
{
if (flowDiagSolution->tracerStatusInTimeStep(tracerName, timeStep) == requestedTracerType)
{
tracerCellFractionValues.push_back(tracerName);
}
}
}
return tracerCellFractionValues;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
#include <QString>
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<QString> findContributingTracerNames(
const RimFlowDiagSolution* flowDiagSolution,
const RigSingleWellResultsData* wellResults,
int timeStep);
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicShowContributingWellsFromPlotFeature.h"
#include "RiaApplication.h"
#include "RicShowContributingWellsFeatureImpl.h"
#include "RimEclipseResultCase.h"
#include "RimFlowDiagSolution.h"
#include "RimWellAllocationPlot.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributingWellsFromPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
{
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
if (wellAllocationPlot) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
{
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(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");
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
CAF_CMD_SOURCE_INIT(RicShowFlowCharacteristicsPlotFeature, "RicShowFlowCharacteristicsPlotFeature");
RimEclipseResultCase* activeEclipseResultCase()
{
RimView * activeView = RiaApplication::instance()->activeReservoirView();
auto eclView = dynamic_cast<RimEclipseView*>(activeView);
if (!eclView) return nullptr;
auto eclCase = dynamic_cast<RimEclipseResultCase*>(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");
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class 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;
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicShowTotalAllocationDataFeature.h"
#include "ApplicationCommands/RicShowPlotDataFeature.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellAllocationPlot.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include <set>
CAF_CMD_SOURCE_INIT(RicShowTotalAllocationDataFeature, "RicShowTotalAllocationDataFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowTotalAllocationDataFeature::isCommandEnabled()
{
std::set<RimWellAllocationPlot*> wellAllocPlots = RicShowTotalAllocationDataFeature::selectedWellAllocationPlots();
if (wellAllocPlots.size() > 0)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowTotalAllocationDataFeature::onActionTriggered(bool isChecked)
{
this->disableModelChangeContribution();
std::set<RimWellAllocationPlot*> 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<RimWellAllocationPlot*> RicShowTotalAllocationDataFeature::selectedWellAllocationPlots()
{
std::set<RimWellAllocationPlot*> wellAllocPlots;
std::vector<caf::PdmObject*> 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;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <set>
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<RimWellAllocationPlot*> selectedWellAllocationPlots();
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
{
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
if (collection.size() > 0)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> 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");
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class 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;
};

View File

@ -33,7 +33,7 @@ class RicBoxManipulatorEventHandler : public QObject
Q_OBJECT Q_OBJECT
public: public:
RicBoxManipulatorEventHandler(caf::Viewer* viewer); explicit RicBoxManipulatorEventHandler(caf::Viewer* viewer);
~RicBoxManipulatorEventHandler(); ~RicBoxManipulatorEventHandler();
void setOrigin(const cvf::Vec3d& origin); void setOrigin(const cvf::Vec3d& origin);

View File

@ -23,6 +23,7 @@
#include "RimCalcScript.h" #include "RimCalcScript.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include "cvfAssert.h" #include "cvfAssert.h"
@ -49,6 +50,9 @@ void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts(); std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
CVF_ASSERT(selection.size() > 0); CVF_ASSERT(selection.size() > 0);
RiuMainWindow* mainWindow = RiuMainWindow::instance();
mainWindow->showProcessMonitorDockPanel();
RimCalcScript* calcScript = selection[0]; RimCalcScript* calcScript = selection[0];
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();

View File

@ -21,6 +21,7 @@
#include "RimCase.h" #include "RimCase.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
@ -74,6 +75,9 @@ void RicExecuteScriptForCasesFeature::slotExecuteScriptForSelectedCases()
QString scriptAbsolutePath = action->data().toString(); QString scriptAbsolutePath = action->data().toString();
RiuMainWindow* mainWindow = RiuMainWindow::instance();
mainWindow->showProcessMonitorDockPanel();
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
QString octavePath = app->octavePath(); QString octavePath = app->octavePath();
if (!octavePath.isEmpty()) if (!octavePath.isEmpty())

View File

@ -29,6 +29,8 @@
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "cafUtils.h"
#include <QAction> #include <QAction>
#include <QFileInfo> #include <QFileInfo>
#include <QInputDialog> #include <QInputDialog>
@ -76,7 +78,7 @@ void RicNewScriptFeature::onActionTriggered(bool isChecked)
fullPathFilenameNewScript = fullPathNewScript + "/untitled.m"; fullPathFilenameNewScript = fullPathNewScript + "/untitled.m";
int num= 1; int num= 1;
while (QFileInfo(fullPathFilenameNewScript).exists()) while (caf::Utils::fileExists(fullPathFilenameNewScript))
{ {
fullPathFilenameNewScript = fullPathNewScript + "/untitled" + QString::number(num) + ".m"; fullPathFilenameNewScript = fullPathNewScript + "/untitled" + QString::number(num) + ".m";
num++; num++;

View File

@ -19,8 +19,17 @@
#include "RicCopyReferencesToClipboardFeature.h" #include "RicCopyReferencesToClipboardFeature.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimGeoMechView.h"
#include "RimMimeData.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 "cafPdmUiItem.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
@ -40,7 +49,7 @@ CAF_CMD_SOURCE_INIT(RicCopyReferencesToClipboardFeature, "RicCopyReferencesToCli
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCopyReferencesToClipboardFeature::isCommandEnabled() bool RicCopyReferencesToClipboardFeature::isCommandEnabled()
{ {
return true; return isAnyCopyableObjectSelected();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -48,8 +57,24 @@ bool RicCopyReferencesToClipboardFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicCopyReferencesToClipboardFeature::onActionTriggered(bool isChecked) void RicCopyReferencesToClipboardFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
if (!isAnyCopyableObjectSelected()) return;
std::vector<QString> referenceList; std::vector<QString> referenceList;
SelectionManager::instance()->selectionAsReferences(referenceList);
std::vector<PdmObject*> 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; MimeDataWithReferences* myObject = new MimeDataWithReferences;
myObject->setReferences(referenceList); myObject->setReferences(referenceList);
@ -71,4 +96,70 @@ void RicCopyReferencesToClipboardFeature::setupActionLook(QAction* actionToSetup
actionToSetup->setShortcuts(QKeySequence::Copy); actionToSetup->setShortcuts(QKeySequence::Copy);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCopyReferencesToClipboardFeature::isAnyCopyableObjectSelected()
{
std::vector<PdmObject*> 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<RimGeoMechView*>(pdmObject))
{
return true;
}
else if (dynamic_cast<RimEclipseView*>(pdmObject))
{
return true;
}
else if (dynamic_cast<RimEclipseCase*>(pdmObject))
{
return true;
}
else if (dynamic_cast<RimSummaryPlot*>(pdmObject))
{
return true;
}
else if (dynamic_cast<RimPlotCurve*>(pdmObject))
{
return true;
}
else if (dynamic_cast<RimSummaryCurveFilter*>(pdmObject))
{
return true;
}
else if (dynamic_cast<RimWellLogTrack*>(pdmObject))
{
if (!wellAllocPlot) return true;
}
else if (dynamic_cast<RimWellLogPlot*>(pdmObject))
{
if (!wellAllocPlot) return true;
}
return false;
}
} // end namespace caf } // end namespace caf

View File

@ -25,6 +25,8 @@
namespace caf namespace caf
{ {
class PdmObject;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
@ -37,6 +39,10 @@ protected:
virtual bool isCommandEnabled(); virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked ); virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup ); virtual void setupActionLook( QAction* actionToSetup );
private:
static bool isAnyCopyableObjectSelected();
static bool isCopyOfObjectSupported(PdmObject* pdmObject);
}; };

View File

@ -28,6 +28,7 @@
#include "RimCaseCollection.h" #include "RimCaseCollection.h"
#include "RimEclipseCaseCollection.h" #include "RimEclipseCaseCollection.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimIdenticalGridCaseGroup.h" #include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h" #include "RimMimeData.h"
#include "RimOilField.h" #include "RimOilField.h"
@ -116,7 +117,8 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(objectGroup.objects[i]); RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(objectGroup.objects[i]);
if (eclCase) if (eclCase)
{ {
RimEclipseResultCase* eclCaseCopy = dynamic_cast<RimEclipseResultCase*>(eclCase->copyByXmlSerialization(PdmDefaultObjectFactory::instance())); RimEclipseResultCase* eclCaseCopy = new RimEclipseResultCase();
eclCaseCopy->setCaseInfo(eclCase->caseUserDescription(), eclCase->gridFileName());
resultCases.push_back(eclCaseCopy); resultCases.push_back(eclCaseCopy);
} }
} }
@ -178,7 +180,7 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
continue; continue;
} }
if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData())) if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{ {
CVF_ASSERT(false); CVF_ASSERT(false);
} }

View File

@ -21,6 +21,8 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiuMainWindow.h"
#include "RicPasteFeatureImpl.h" #include "RicPasteFeatureImpl.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
@ -83,6 +85,8 @@ void RicPasteEclipseViewsFeature::onActionTriggered(bool isChecked)
std::vector<caf::PdmPointer<RimEclipseView> > eclipseViews; std::vector<caf::PdmPointer<RimEclipseView> > eclipseViews;
objectGroup.objectsByType(&eclipseViews); objectGroup.objectsByType(&eclipseViews);
RimEclipseView* lastViewCopy = nullptr;
// Add cases to case group // Add cases to case group
for (size_t i = 0; i < eclipseViews.size(); i++) 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 // Resolve references after reservoir view has been inserted into Rim structures
// Intersections referencing a well path/ simulation well requires this // Intersections referencing a well path/ simulation well requires this
// TODO: initAfterReadRecursively can probably be removed
rimReservoirView->initAfterReadRecursively();
rimReservoirView->resolveReferencesRecursively(); rimReservoirView->resolveReferencesRecursively();
rimReservoirView->initAfterReadRecursively();
rimReservoirView->loadDataAndUpdate(); rimReservoirView->loadDataAndUpdate();
caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView); caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);
eclipseCase->updateConnectedEditors(); eclipseCase->updateConnectedEditors();
lastViewCopy = rimReservoirView;
} }
if (lastViewCopy) RiuMainWindow::instance()->selectAsCurrentItem(lastViewCopy);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@
#include "RimCaseCollection.h" #include "RimCaseCollection.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimIdenticalGridCaseGroup.h" #include "RimIdenticalGridCaseGroup.h"

View File

@ -21,6 +21,8 @@
#include "RicPasteFeatureImpl.h" #include "RicPasteFeatureImpl.h"
#include "RiuMainWindow.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
@ -77,6 +79,8 @@ void RicPasteGeoMechViewsFeature::onActionTriggered(bool isChecked)
std::vector<caf::PdmPointer<RimGeoMechView> > geomViews; std::vector<caf::PdmPointer<RimGeoMechView> > geomViews;
objectGroup.objectsByType(&geomViews); objectGroup.objectsByType(&geomViews);
RimGeoMechView* lastViewCopy = nullptr;
// Add cases to case group // Add cases to case group
for (size_t i = 0; i < geomViews.size(); i++) 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 // Resolve references after reservoir view has been inserted into Rim structures
// Intersections referencing a well path requires this // Intersections referencing a well path requires this
rimReservoirView->initAfterReadRecursively();
rimReservoirView->resolveReferencesRecursively(); rimReservoirView->resolveReferencesRecursively();
rimReservoirView->initAfterReadRecursively();
caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView); caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);
rimReservoirView->loadDataAndUpdate(); rimReservoirView->loadDataAndUpdate();
geomCase->updateConnectedEditors(); geomCase->updateConnectedEditors();
lastViewCopy = rimReservoirView;
} }
if (lastViewCopy) RiuMainWindow::instance()->selectAsCurrentItem(lastViewCopy);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -158,6 +158,26 @@ void RicCloseCaseFeature::deleteEclipseCase(RimEclipseCase* eclipseCase)
} }
else 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<caf::PdmObjectHandle*> 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); removeCaseFromAllGroups(eclipseCase);
} }
} }

View File

@ -33,7 +33,7 @@ class RicDeleteItemExecData;
class RicDeleteItemExec : public CmdExecuteCommand class RicDeleteItemExec : public CmdExecuteCommand
{ {
public: public:
RicDeleteItemExec(NotificationCenter* notificationCenter); explicit RicDeleteItemExec(NotificationCenter* notificationCenter);
RicDeleteItemExecData* commandData(); RicDeleteItemExecData* commandData();

View File

@ -21,6 +21,25 @@
#include "RicDeleteItemExec.h" #include "RicDeleteItemExec.h"
#include "RicDeleteItemExecData.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 "RimWellLogPlot.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
@ -32,22 +51,6 @@
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include <QAction> #include <QAction>
#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 namespace caf
{ {
@ -55,6 +58,22 @@ namespace caf
bool isDeletable(PdmUiItem * uiItem) bool isDeletable(PdmUiItem * uiItem)
{ {
// Enable delete of well allocation plots
if (dynamic_cast<RimWellAllocationPlot*>(uiItem)) return true;
// Disable delete of all sub objects of a well allocation plot
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(uiItem);
if (destinationObject)
{
RimWellAllocationPlot* wellAllocationPlot = nullptr;
destinationObject->firstAncestorOrThisOfType(wellAllocationPlot);
if (wellAllocationPlot)
{
return false;
}
}
if (dynamic_cast<RimGeoMechView*>(uiItem)) return true; if (dynamic_cast<RimGeoMechView*>(uiItem)) return true;
if (dynamic_cast<RimEclipseView*>(uiItem)) return true; if (dynamic_cast<RimEclipseView*>(uiItem)) return true;
if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem)) return true; if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem)) return true;
@ -67,6 +86,7 @@ bool isDeletable(PdmUiItem * uiItem)
if (dynamic_cast<RimWellLogCurve*>(uiItem)) return true; if (dynamic_cast<RimWellLogCurve*>(uiItem)) return true;
if (dynamic_cast<RimSummaryPlot*>(uiItem)) return true; if (dynamic_cast<RimSummaryPlot*>(uiItem)) return true;
if (dynamic_cast<RimSummaryCurve*>(uiItem)) return true; if (dynamic_cast<RimSummaryCurve*>(uiItem)) return true;
if (dynamic_cast<RimGridTimeHistoryCurve*>(uiItem)) return true;
if (dynamic_cast<RimSummaryCurveFilter*>(uiItem)) return true; if (dynamic_cast<RimSummaryCurveFilter*>(uiItem)) return true;
if (dynamic_cast<RimIntersection*>(uiItem)) return true; if (dynamic_cast<RimIntersection*>(uiItem)) return true;
if (dynamic_cast<RimIntersectionBox*>(uiItem)) return true; if (dynamic_cast<RimIntersectionBox*>(uiItem)) return true;

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicDeleteSubItemsFeature.h"
#include "RimSummaryPlotCollection.h"
#include "RimWellPathCollection.h"
#include "cafPdmUiItem.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeleteSubItemsFeature::isCommandEnabled()
{
std::vector<caf::PdmUiItem*> 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<caf::PdmUiItem*> items;
caf::SelectionManager::instance()->selectedItems(items);
CVF_ASSERT(items.size() > 0);
for (auto item : items)
{
if (!RicDeleteSubItemsFeature::hasDeletableSubItems(item)) continue;
RimSummaryPlotCollection* summaryPlotColl = dynamic_cast<RimSummaryPlotCollection*>(item);
if (summaryPlotColl)
{
summaryPlotColl->summaryPlots.deleteAllChildObjects();
summaryPlotColl->updateConnectedEditors();
}
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(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<RimSummaryPlotCollection*>(uiItem);
if (summaryPlotColl && summaryPlotColl->summaryPlots().size() > 0)
{
return true;
}
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(uiItem);
if (wellPathColl && wellPathColl->wellPaths().size() > 0)
{
return true;
}
return false;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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);
};

View File

@ -20,16 +20,21 @@
#include "RicExportFaultsFeature.h" #include "RicExportFaultsFeature.h"
#include "RiaApplication.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 "RimFault.h"
#include "cafSelectionManager.h"
#include "cafUtils.h"
#include <QAction> #include <QAction>
#include <QFileDialog> #include <QFileDialog>
#include "RimEclipseCase.h" #include <QMessageBox>
#include "RigFault.h"
#include "RigMainGrid.h"
#include "RigCaseData.h"
#include "QMessageBox"
CAF_CMD_SOURCE_INIT(RicExportFaultsFeature, "RicExportFaultsFeature"); CAF_CMD_SOURCE_INIT(RicExportFaultsFeature, "RicExportFaultsFeature");
@ -52,6 +57,8 @@ bool RicExportFaultsFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportFaultsFeature::onActionTriggered(bool isChecked) void RicExportFaultsFeature::onActionTriggered(bool isChecked)
{ {
this->disableModelChangeContribution();
std::vector<RimFault*> selectedFaults; std::vector<RimFault*> selectedFaults;
caf::SelectionManager::instance()->objectsByType(&selectedFaults); caf::SelectionManager::instance()->objectsByType(&selectedFaults);
@ -65,6 +72,11 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
QString selectedDir = QFileDialog::getExistingDirectory(NULL, tr("Select Directory"), defaultDir); QString selectedDir = QFileDialog::getExistingDirectory(NULL, tr("Select Directory"), defaultDir);
if (selectedDir.isNull()) {
// Stop if folder selection was cancelled.
return;
}
for (RimFault* rimFault : selectedFaults) for (RimFault* rimFault : selectedFaults)
{ {
RimEclipseCase* eclCase = nullptr; RimEclipseCase* eclCase = nullptr;
@ -79,11 +91,11 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
if ( faultName == RimDefines::undefinedGridFaultWithInactiveName() ) faultName = "UNDEF_IA"; if ( faultName == RimDefines::undefinedGridFaultWithInactiveName() ) faultName = "UNDEF_IA";
QString baseFilename = "Fault_" + faultName + "_" + caseName; QString baseFilename = "Fault_" + faultName + "_" + caseName;
baseFilename.replace(" ", "_"); baseFilename = caf::Utils::makeValidFileBasename(baseFilename);
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl"; 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")); 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; stream << "-- Name I1 I2 J1 J2 K1 K2 Face ( I/J/K )" << endl;
// 'NAME' 1 1 1 1 1 2 J / // 'NAME' 1 1 1 1 1 2 J /
for (const RigFault::FaultFace& fface: faultFaces) std::vector<FaultCellAndFace> faultCellAndFaces;
{
size_t i1, j1, k1, i2, j2, k2;
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; if (!ok) continue;
ok = mainGrid->ijkFromCellIndex(fface.m_oppositeReservoirCellIndex, &i2, &j2, &k2);
QString faceText; faultCellAndFaces.push_back(std::make_tuple(i, j, k, faultCellAndFace.m_nativeFace));
switch (fface.m_nativeFace)
{
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;
}
stream << "'" << faultName << "'" << " " << i1 << " " << i2
<< " " << j1 << " " << j2
<< " " << k1 << " " << k2
<< " " << faceText << " / ";
stream << endl ;
} }
stream << "/" << endl; // Sort order: i, j, face then k.
std::sort(faultCellAndFaces.begin(), faultCellAndFaces.end(), RicExportFaultsFeature::faultOrdering);
} size_t lastI = std::numeric_limits<size_t>::max();
size_t lastJ = std::numeric_limits<size_t>::max();
size_t lastK = std::numeric_limits<size_t>::max();
size_t startK = std::numeric_limits<size_t>::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)
{
// 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;
}
}
// No fault should have no face
if (lastFaceType != cvf::StructGridInterface::FaceType::NO_FACE)
{
RicExportFaultsFeature::writeLine(stream, faultName, lastI, lastJ, startK, lastK, lastFaceType);
}
stream << "/" << endl;
}

View File

@ -26,6 +26,8 @@
class RigMainGrid; class RigMainGrid;
typedef std::tuple<size_t, size_t, size_t, cvf::StructGridInterface::FaceType> FaultCellAndFace;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
@ -41,5 +43,8 @@ protected:
private: private:
static void saveFault(QString completeFilename, const RigMainGrid* mainGrid, const std::vector<RigFault::FaultFace>& faultFaces, QString faultName); static void saveFault(QString completeFilename, const RigMainGrid* mainGrid, const std::vector<RigFault::FaultFace>& 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);
}; };

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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 <QAction>
#include <QDebug>
#include <QDir>
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<RimEclipseCase*>(rimCase);
RimEclipseView* sourceEclipseView = dynamic_cast<RimEclipseView*>(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<RimGeoMechCase*>(rimCase);
RimGeoMechView* sourceGeoMechView = dynamic_cast<RimGeoMechView*>(sourceView);
if (geomCase && sourceGeoMechView)
{
RimGeoMechView* copyOfGeoMechView = dynamic_cast<RimGeoMechView*>(sourceGeoMechView->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
CVF_ASSERT(copyOfGeoMechView);
geomCase->geoMechViews().push_back(copyOfGeoMechView);
copyOfGeoMechView->setGeoMechCase(geomCase);
// Resolve references after reservoir view has been inserted into Rim structures
copyOfGeoMechView->resolveReferencesRecursively();
copyOfGeoMechView->initAfterReadRecursively();
copyOfGeoMechView->loadDataAndUpdate();
exportViewVariations(copyOfGeoMechView, msd, folder);
geomCase->geoMechViews().removeChildObject(copyOfGeoMechView);
delete copyOfGeoMechView;
}
}
// Set view back to initial state
sourceView->viewer()->setCurrentFrame(initialFramIndex);
sourceView->viewer()->animationControl()->setCurrentFrameOnly(initialFramIndex);
sourceView->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportMultipleSnapshotsFeature::exportViewVariations(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder)
{
if (msd->selectedEclipseResults().size() > 0)
{
RimEclipseCase* eclCase = dynamic_cast<RimEclipseCase*>(rimView->ownerCase());
RimEclipseView* copyOfView = eclCase->createCopyAndAddView(dynamic_cast<RimEclipseView*>(rimView));
copyOfView->cellResult()->setResultType(msd->eclipseResultType());
for (QString s : msd->selectedEclipseResults())
{
copyOfView->cellResult()->setResultVariable(s);
copyOfView->loadDataAndUpdate();
exportViewVariationsToFolder(copyOfView, msd, folder);
}
eclCase->reservoirViews().removeChildObject(copyOfView);
delete copyOfView;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder)
{
RimCase* rimCase = rimView->ownerCase();
CVF_ASSERT(rimCase);
RiuViewer* viewer = rimView->viewer();
QStringList timeSteps = rimCase->timeStepStrings();
QString resName = resultName(rimView);
QString viewCaseResultString = rimCase->caseUserDescription() + "_" + rimView->name() + "_" + resName;
viewCaseResultString = caf::Utils::makeValidFileBasename(viewCaseResultString);
for (int i = msd->timeStepStart(); i <= msd->timeStepEnd(); i++)
{
QString timeStepIndexString = QString("%1").arg(i, 2, 10, QLatin1Char('0'));
QString timeStepString = timeStepIndexString + "_" + timeSteps[i].replace(".", "-");
if (viewer)
{
// Force update of scheduled display models modifying the time step
// This is required due to visualization structures updated by the update functions,
// and this is not triggered by changing time step only
RiaApplication::instance()->slotUpdateScheduledDisplayModels();
viewer->setCurrentFrame(i);
viewer->animationControl()->setCurrentFrameOnly(i);
}
if (msd->sliceDirection == RimMultiSnapshotDefinition::NO_RANGEFILTER)
{
QString fileName = viewCaseResultString + "_" + timeStepString;
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
absoluteFileName.replace(" ", "_");
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
}
else
{
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter;
rimView->rangeFilterCollection()->rangeFilters.push_back(rangeFilter);
bool rangeFilterInitState = rimView->rangeFilterCollection()->isActive();
rimView->rangeFilterCollection()->isActive = true;
for (int i = msd->startSliceIndex(); i <= msd->endSliceIndex(); i++)
{
QString rangeFilterString = msd->sliceDirection().text() + "-" + QString::number(i);
QString fileName = viewCaseResultString + "_" + timeStepString + "_" + rangeFilterString;
rangeFilter->setDefaultValues();
if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_I)
{
rangeFilter->cellCountI = 1;
rangeFilter->startIndexI = i;
}
else if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_J)
{
rangeFilter->cellCountJ = 1;
rangeFilter->startIndexJ = i;
}
else if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_K)
{
rangeFilter->cellCountK = 1;
rangeFilter->startIndexK = i;
}
rimView->rangeFilterCollection()->updateDisplayModeNotifyManagedViews(rangeFilter);
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
absoluteFileName.replace(" ", "_");
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
}
rimView->rangeFilterCollection()->rangeFilters.removeChildObject(rangeFilter);
delete rangeFilter;
rimView->rangeFilterCollection()->isActive = rangeFilterInitState;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicExportMultipleSnapshotsFeature::resultName(RimView* rimView)
{
if (dynamic_cast<RimEclipseView*>(rimView))
{
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(rimView);
return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiShortName());
}
else if (dynamic_cast<RimGeoMechView*>(rimView))
{
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(rimView);
RimGeoMechCellColors* cellResult = geoMechView->cellResult();
if (cellResult)
{
QString title = caf::AppEnum<RigFemResultPosEnum>(cellResult->resultPositionType()).uiText() + "_"
+ cellResult->resultFieldUiName();
if (!cellResult->resultComponentUiName().isEmpty())
{
title += "_" + cellResult->resultComponentUiName();
}
return title;
}
}
return "";
}

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimMultiSnapshotDefinition;
class RimProject;
class RimView;
//==================================================================================================
///
//==================================================================================================
class RicExportMultipleSnapshotsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
public:
static void exportMultipleSnapshots(const QString& folder, RimProject* project);
static void exportViewVariations(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder);
private:
static void exportViewVariationsToFolder(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder);
static QString resultName(RimView* rimView);
};

View File

@ -19,9 +19,14 @@
#include "RicExportToLasFileFeature.h" #include "RicExportToLasFileFeature.h"
#include "RiaApplication.h"
#include "RicExportToLasFileResampleUi.h" #include "RicExportToLasFileResampleUi.h"
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
#include "RiaApplication.h"
#include "RigLasFileExporter.h" #include "RigLasFileExporter.h"
#include "RigWellLogCurveData.h"
#include "RimWellLogCurve.h" #include "RimWellLogCurve.h"
#include "cafPdmUiPropertyViewDialog.h" #include "cafPdmUiPropertyViewDialog.h"
@ -39,7 +44,9 @@ CAF_CMD_SOURCE_INIT(RicExportToLasFileFeature, "RicExportToLasFileFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicExportToLasFileFeature::isCommandEnabled() bool RicExportToLasFileFeature::isCommandEnabled()
{ {
return selectedWellLogCurves().size() > 0; if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
return RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().size() > 0;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -47,7 +54,11 @@ bool RicExportToLasFileFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportToLasFileFeature::onActionTriggered(bool isChecked) void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
{ {
std::vector<RimWellLogCurve*> curves = selectedWellLogCurves(); this->disableModelChangeContribution();
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return;
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
if (curves.size() == 0) return; if (curves.size() == 0) return;
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
@ -103,39 +114,3 @@ void RicExportToLasFileFeature::setupActionLook(QAction* actionToSetup)
actionToSetup->setText("Export To LAS Files..."); actionToSetup->setText("Export To LAS Files...");
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogCurve*> RicExportToLasFileFeature::selectedWellLogCurves() const
{
std::set<RimWellLogCurve*> curveSet;
{
std::vector<caf::PdmUiItem*> selectedItems;
caf::SelectionManager::instance()->selectedItems(selectedItems);
for (auto selectedItem : selectedItems)
{
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selectedItem);
if (objHandle)
{
std::vector<RimWellLogCurve*> childCurves;
objHandle->descendantsIncludingThisOfType(childCurves);
for (auto curve : childCurves)
{
curveSet.insert(curve);
}
}
}
}
std::vector<RimWellLogCurve*> allCurves;
for (auto curve : curveSet)
{
allCurves.push_back(curve);
}
return allCurves;
}

View File

@ -37,8 +37,5 @@ protected:
virtual bool isCommandEnabled(); virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked ); virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup ); virtual void setupActionLook( QAction* actionToSetup );
private:
std::vector<RimWellLogCurve*> selectedWellLogCurves() const;
}; };

View File

@ -121,7 +121,7 @@ void RicExportToLasFileResampleUi::defineEditorAttribute(const caf::PdmFieldHand
{ {
if (field == &exportFolder) if (field == &exportFolder)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
@ -130,7 +130,7 @@ void RicExportToLasFileResampleUi::defineEditorAttribute(const caf::PdmFieldHand
if (field == &exportTvdrkb || field == &activateResample) if (field == &exportTvdrkb || field == &activateResample)
{ {
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute); caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_useNativeCheckBoxLabel = true; myAttr->m_useNativeCheckBoxLabel = true;

View File

@ -30,7 +30,7 @@ class RimGeoMechPropertyFilter;
class RicGeoMechPropertyFilterInsertExec : public caf::CmdExecuteCommand class RicGeoMechPropertyFilterInsertExec : public caf::CmdExecuteCommand
{ {
public: public:
RicGeoMechPropertyFilterInsertExec(RimGeoMechPropertyFilter* propertyFilter); explicit RicGeoMechPropertyFilterInsertExec(RimGeoMechPropertyFilter* propertyFilter);
virtual ~RicGeoMechPropertyFilterInsertExec(); virtual ~RicGeoMechPropertyFilterInsertExec();
virtual QString name(); virtual QString name();

View File

@ -30,7 +30,7 @@ class RimGeoMechPropertyFilterCollection;
class RicGeoMechPropertyFilterNewExec : public caf::CmdExecuteCommand class RicGeoMechPropertyFilterNewExec : public caf::CmdExecuteCommand
{ {
public: public:
RicGeoMechPropertyFilterNewExec(RimGeoMechPropertyFilterCollection* propertyFilterCollection); explicit RicGeoMechPropertyFilterNewExec(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
virtual ~RicGeoMechPropertyFilterNewExec(); virtual ~RicGeoMechPropertyFilterNewExec();
virtual QString name(); virtual QString name();

View File

@ -19,6 +19,7 @@
#include "RicImportSummaryCaseFeature.h" #include "RicImportSummaryCaseFeature.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RimGridSummaryCase.h" #include "RimGridSummaryCase.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
@ -102,10 +103,14 @@ bool RicImportSummaryCaseFeature::createAndAddSummaryCaseFromFile(const QString&
RimSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromFileName(fileName); RimSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromFileName(fileName);
newSumCase->loadCase(); newSumCase->loadCase();
RimMainPlotCollection* mainPlotColl = proj->mainPlotCollection();
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotColl, newSumCase); if (app->preferences()->autoCreatePlotsOnImport())
{
RimMainPlotCollection* mainPlotColl = proj->mainPlotCollection();
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotColl, newSumCase);
}
sumCaseColl->updateConnectedEditors(); sumCaseColl->updateConnectedEditors();
app->addToRecentFiles(fileName); app->addToRecentFiles(fileName);

View File

@ -26,6 +26,7 @@
#include "RimView.h" #include "RimView.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiaLogging.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
@ -36,9 +37,9 @@ CAF_CMD_SOURCE_INIT(RicNewViewFeature, "RicNewViewFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewViewFeature::addReservoirView() void RicNewViewFeature::addReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
{ {
RimView* newView = createReservoirView(); RimView* newView = createReservoirView(eclipseCase, geomCase);
if (newView) if (newView)
{ {
@ -62,7 +63,18 @@ bool RicNewViewFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewViewFeature::onActionTriggered(bool isChecked) void RicNewViewFeature::onActionTriggered(bool isChecked)
{ {
addReservoirView(); // Establish type of selected object
RimEclipseCase* eclipseCase = selectedEclipseCase();
RimGeoMechCase* geomCase = selectedGeoMechCase();
RimGeoMechView* geoMechView = selectedGeoMechView();
RimEclipseView* reservoirView = selectedEclipseView();
// Find case to insert into
if (geoMechView) geomCase = geoMechView->geoMechCase();
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
addReservoirView(eclipseCase, geomCase);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -77,18 +89,8 @@ void RicNewViewFeature::setupActionLook(QAction* actionToSetup)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimView* RicNewViewFeature::createReservoirView() RimView* RicNewViewFeature::createReservoirView(RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase)
{ {
// Establish type of selected object
RimEclipseCase* eclipseCase = selectedEclipseCase();
RimGeoMechCase* geomCase = selectedGeoMechCase();
RimGeoMechView* geoMechView = selectedGeoMechView();
RimEclipseView* reservoirView = selectedEclipseView();
// Find case to insert into
if (geoMechView) geomCase = geoMechView->geoMechCase();
if (reservoirView) eclipseCase = reservoirView->eclipseCase();
RimView* insertedView = NULL; RimView* insertedView = NULL;
if (eclipseCase) if (eclipseCase)

Some files were not shown because too many files have changed in this diff Show More