Merge dev into master as release v2016.11 (pull request #1008)

Release v2016.11
This commit is contained in:
Jacob Støren 2016-11-29 10:03:18 +01:00 committed by GitHub
commit 6e2a87cabc
6663 changed files with 284816 additions and 124896 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QApplication>
#include <QProcess>
#include <QMutex>
@ -30,20 +31,32 @@
#include "cvfFont.h"
#include <iostream>
#include <memory>
class QAction;
class Drawable;
class RIProcess;
class RigCaseData;
class RimEclipseCase;
class Drawable;
class RiaSocketServer;
class RiaPreferences;
class RimEclipseView;
class RimView;
class RimProject;
class RimCommandObject;
class RiaProjectModifier;
class RiaSocketServer;
class RigCaseData;
class RimCommandObject;
class RimEclipseCase;
class RimEclipseView;
class RimProject;
class RimSummaryPlot;
class RimView;
class RimViewWindow;
class RimWellLogPlot;
class RiuMainPlotWindow;
class RiuRecentFileActionProvider;
namespace caf
{
class UiProcess;
@ -84,6 +97,9 @@ public:
void setActiveWellLogPlot(RimWellLogPlot*);
RimWellLogPlot* activeWellLogPlot();
void setActiveSummaryPlot(RimSummaryPlot*);
RimSummaryPlot* activeSummaryPlot();
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
RimProject* project();
@ -94,9 +110,11 @@ public:
void createMockModelCustomized();
void createInputMockModel();
QString defaultFileDialogDirectory(const QString& dialogName);
void setDefaultFileDialogDirectory(const QString& dialogName, const QString& defaultDirectory);
QString lastUsedDialogDirectory(const QString& dialogName);
QString lastUsedDialogDirectoryWithFallback(const QString& dialogName, const QString& fallbackDirectory);
void setLastUsedDialogDirectory(const QString& dialogName, const QString& directory);
bool openFile(const QString& fileName);
bool openEclipseCaseFromFile(const QString& fileName);
bool openEclipseCase(const QString& caseName, const QString& caseFileName);
bool addEclipseCases(const QStringList& fileNames);
@ -104,19 +122,16 @@ public:
bool openOdbCaseFromFile(const QString& fileName);
QString currentProjectFileName() const;
QString currentProjectPath() const;
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
bool loadProject(const QString& projectFileName);
bool saveProject();
bool saveProjectAs(const QString& fileName);
bool saveProjectPromptForFileName();
bool closeProject(bool askToSaveIfDirty);
void closeProject();
void addWellPathsToModel(QList<QString> wellPathFilePaths);
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
void copySnapshotToClipboard();
void saveSnapshotPromtpForFilename();
void saveSnapshotAs(const QString& fileName);
void saveSnapshotForAllViews(const QString& snapshotFolderName);
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath);
@ -148,6 +163,7 @@ public:
void applyPreferences();
cvf::Font* standardFont();
cvf::Font* customFont();
QString commandLineParameterHelp() const;
void showFormattedTextInMessageBox(const QString& text);
@ -163,6 +179,17 @@ public:
int launchUnitTests();
int launchUnitTestsWithConsole();
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
RiuMainPlotWindow* mainPlotWindow();
static RimViewWindow* activeViewWindow();
bool tryCloseMainWindow();
bool tryClosePlotWindow();
void addToRecentFiles(const QString& fileName);
std::vector<QAction*> recentFileActions() const;
private:
enum ProjectLoadAction
{
@ -171,13 +198,18 @@ private:
};
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
void onProjectOpenedOrClosed();
std::vector<QString> readFileListFromTextFile(QString listFileName);
void setWindowCaptionFromAppState();
QImage grabFrameBufferImage();
void clearViewsScheduledForUpdate();
void createMainPlotWindow();
void deleteMainPlotWindow();
void loadAndUpdatePlotData();
private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
@ -186,6 +218,7 @@ private slots:
private:
caf::PdmPointer<RimView> m_activeReservoirView;
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
caf::PdmPointer<RimProject> m_project;
@ -207,6 +240,7 @@ private:
QString m_startupDefaultDirectory;
cvf::ref<cvf::Font> m_standardFont;
cvf::ref<cvf::Font> m_customFont;
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
@ -215,4 +249,8 @@ private:
QString m_helpText;
bool m_runningRegressionTests;
RiuMainPlotWindow* m_mainPlotWindow;
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
};

View File

@ -58,7 +58,9 @@ RiaPreferences::RiaPreferences(void)
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, "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(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS curve without TVD warning", "", "", "");
showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
@ -81,8 +83,17 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and show SOIL", "", "", "");
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
readerSettings = new RifReaderSettings;
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", "");
readerSettings = new RifReaderSettings;
CAF_PDM_InitField(&autoCreatePlotsOnImport, "AutoCreatePlotsOnImport", true, "Create Summary Plots When Importing Eclipse Case", "", "", "");
autoCreatePlotsOnImport.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", "");
m_tabNames << "General";
m_tabNames << "Octave";
m_tabNames << "Summary";
}
//--------------------------------------------------------------------------------------------------
@ -115,7 +126,8 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &useShaders ||
field == &showHud ||
field == &appendClassNameToUiText ||
field == &showLasCurveWithoutTvdWarning )
field == &showLasCurveWithoutTvdWarning ||
field == &autoCreatePlotsOnImport)
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr)
@ -130,51 +142,89 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
//--------------------------------------------------------------------------------------------------
void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&navigationPolicy);
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script configuration");
scriptGroup->add(&scriptDirectories);
scriptGroup->add(&scriptEditorExecutable);
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
octaveGroup->add(&octaveExecutable);
octaveGroup->add(&octaveShowHeaderInfoWhenExecutingScripts);
caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings");
defaultSettingsGroup->add(&defaultScaleFactorZ);
defaultSettingsGroup->add(&defaultViewerBackgroundColor);
defaultSettingsGroup->add(&defaultGridLines);
defaultSettingsGroup->add(&defaultGridLineColors);
defaultSettingsGroup->add(&defaultFaultGridLineColors);
defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&showLasCurveWithoutTvdWarning);
caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Behavior when loading new case");
autoComputeGroup->add(&autocomputeDepthRelatedProperties);
autoComputeGroup->add(&loadAndShowSoil);
caf::PdmUiGroup* readerSettingsGroup = uiOrdering.addNewGroup("Reader settings");
std::vector<caf::PdmFieldHandle*> readerSettingsFields;
readerSettings->fields(readerSettingsFields);
for (size_t i = 0; i < readerSettingsFields.size(); i++)
if (uiConfigName == m_tabNames[0])
{
readerSettingsGroup->add(readerSettingsFields[i]);
caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings");
defaultSettingsGroup->add(&defaultViewerBackgroundColor);
defaultSettingsGroup->add(&defaultGridLines);
defaultSettingsGroup->add(&defaultGridLineColors);
defaultSettingsGroup->add(&defaultFaultGridLineColors);
defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&fontSizeInScene);
caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D views");
viewsGroup->add(&navigationPolicy);
viewsGroup->add(&useShaders);
viewsGroup->add(&showHud);
caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup("Behavior when loading new case");
newCaseBehaviourGroup->add(&defaultScaleFactorZ);
newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
newCaseBehaviourGroup->add(&loadAndShowSoil);
newCaseBehaviourGroup->add(&showLasCurveWithoutTvdWarning);
std::vector<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");
ssihubGroup->add(&ssihubAddress);
uiOrdering.add(&appendClassNameToUiText);
}
else if (uiConfigName == m_tabNames[1])
{
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
octaveGroup->add(&octaveExecutable);
octaveGroup->add(&octaveShowHeaderInfoWhenExecutingScripts);
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script files");
scriptGroup->add(&scriptDirectories);
scriptGroup->add(&scriptEditorExecutable);
}
else if (uiConfigName == m_tabNames[2])
{
uiOrdering.add(&autoCreatePlotsOnImport);
uiOrdering.add(&defaultCurveFilter);
}
uiOrdering.setForgetRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
/// This function is called as part of the regression test system to make sure the configuration
/// for regression tests is consistent
///
//--------------------------------------------------------------------------------------------------
void RiaPreferences::configureForRegressionTests()
QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
{
useShaders = true;
showHud = false;
QList<caf::PdmOptionItemInfo> options;
*useOptionsOnly = true;
autocomputeDepthRelatedProperties = true;
loadAndShowSoil = true;
if (&fontSizeInScene == fieldNeedingOptions)
{
QStringList fontSizes;
fontSizes << "8";
fontSizes << "12";
fontSizes << "16";
fontSizes << "24";
fontSizes << "32";
CVF_ASSERT(readerSettings);
readerSettings->importFaults = false;
for (int oIdx = 0; oIdx < fontSizes.size(); ++oIdx)
{
options.push_back(caf::PdmOptionItemInfo(fontSizes[oIdx], fontSizes[oIdx]));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RiaPreferences::tabNames()
{
return m_tabNames;
}

View File

@ -40,7 +40,7 @@ public:
RiaPreferences(void);
virtual ~RiaPreferences(void);
void configureForRegressionTests();
QStringList tabNames();
public: // Pdm Fields
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
@ -60,7 +60,7 @@ public: // Pdm Fields
caf::PdmField<cvf::Color3f> defaultViewerBackgroundColor;
caf::PdmField<cvf::Color3f> defaultWellLabelColor;
caf::PdmField<bool> showLasCurveWithoutTvdWarning;
caf::PdmField<QString> fontSizeInScene;
caf::PdmField<bool> useShaders;
caf::PdmField<bool> showHud;
@ -73,8 +73,17 @@ public: // Pdm Fields
caf::PdmChildField<RifReaderSettings*> readerSettings;
protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
// Summary
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) ;
caf::PdmField<bool> autoCreatePlotsOnImport;
caf::PdmField<QString> defaultCurveFilter;
protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
private:
QStringList m_tabNames;
};

View File

@ -19,58 +19,32 @@
#include "RiaProjectModifier.h"
#include "RimProject.h"
#include "RimEclipseCaseCollection.h"
#include "RimOilField.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimCaseCollection.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimWellPathCollection.h"
#include "RimScriptCollection.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipsePropertyFilter.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimEclipseCellColors.h"
#include "RimCellEdgeColors.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseWellCollection.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimOilField.h"
#include "RimProject.h"
#include <QFileInfo>
#include <QDir>
//==================================================================================================
//
//
//
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaProjectModifier::RiaProjectModifier()
: m_replaceCase_caseId(UNDEFINED),
m_replaceSourceCases_caseGroupId(UNDEFINED)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setReplaceCaseFirstOccurence(QString newGridFileName)
void RiaProjectModifier::setReplaceCaseFirstOccurrence(QString newGridFileName)
{
m_replaceCase_caseId = FIRST_OCCURENCE;
m_replaceCase_gridFileName = makeFilePathAbsolute(newGridFileName);
m_caseIdToGridFileNameMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute(newGridFileName);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -78,27 +52,18 @@ void RiaProjectModifier::setReplaceCase(int caseIdToReplace, QString newGridFile
{
if (caseIdToReplace >= 0)
{
m_replaceCase_caseId = caseIdToReplace;
m_replaceCase_gridFileName = makeFilePathAbsolute(newGridFileName);
m_caseIdToGridFileNameMap[caseIdToReplace] = makeFilePathAbsolute(newGridFileName);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaProjectModifier::setReplaceSourceCasesFirstOccurence(std::vector<QString> newGridFileNames)
void RiaProjectModifier::setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames)
{
m_replaceSourceCases_caseGroupId = FIRST_OCCURENCE;
m_replaceSourceCases_gridFileNames.clear();
foreach (QString fn, newGridFileNames)
{
m_replaceSourceCases_gridFileNames.push_back(makeFilePathAbsolute(fn));
}
m_groupIdToGridFileNamesMap[RiaProjectModifier::firstOccurrenceId()] = newGridFileNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -106,28 +71,21 @@ void RiaProjectModifier::setReplaceSourceCasesById(int caseGroupIdToReplace, std
{
if (caseGroupIdToReplace >= 0)
{
m_replaceSourceCases_caseGroupId = caseGroupIdToReplace;
m_replaceSourceCases_gridFileNames.clear();
foreach (QString fn, newGridFileNames)
{
m_replaceSourceCases_gridFileNames.push_back(makeFilePathAbsolute(fn));
}
m_groupIdToGridFileNamesMap[caseGroupIdToReplace] = newGridFileNames;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
{
if (m_replaceCase_caseId != UNDEFINED && !m_replaceCase_gridFileName.isEmpty())
if (m_caseIdToGridFileNameMap.size() > 0)
{
replaceCase(project);
}
if (m_replaceSourceCases_caseGroupId != UNDEFINED && m_replaceSourceCases_gridFileNames.size() > 0)
if (m_groupIdToGridFileNamesMap.size() > 0)
{
replaceSourceCases(project);
}
@ -135,90 +93,80 @@ bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaProjectModifier::replaceSourceCases(RimProject* project)
void RiaProjectModifier::replaceSourceCases(RimProject* project)
{
bool didReplacement = false;
for (size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++)
for (RimOilField* oilField : project->oilFields())
{
RimOilField* oilField = project->oilFields[oilFieldIdx];
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
if (analysisModels)
{
const size_t numCaseGroups = analysisModels->caseGroups.size();
for (size_t caseGrpIdx = 0; caseGrpIdx < numCaseGroups; ++caseGrpIdx)
for (RimIdenticalGridCaseGroup* caseGroup : analysisModels->caseGroups)
{
RimIdenticalGridCaseGroup* caseGroup = analysisModels->caseGroups[caseGrpIdx];
if (m_replaceSourceCases_caseGroupId == FIRST_OCCURENCE ||
m_replaceSourceCases_caseGroupId == caseGroup->groupId)
for (auto item : m_groupIdToGridFileNamesMap)
{
RimCaseCollection* caseCollection = caseGroup->caseCollection;
caseCollection->reservoirs.deleteAllChildObjects();
for (size_t i = 0; i < m_replaceSourceCases_gridFileNames.size(); i++)
int groupIdToReplace = item.first;
if (groupIdToReplace == RiaProjectModifier::firstOccurrenceId())
{
QString fileName = m_replaceSourceCases_gridFileNames[i];
QString caseName = caseNameFromGridFileName(fileName);
// Use this slightly hackish method in order to get a new unique ID
RimEclipseResultCase* resCase = new RimEclipseResultCase;
resCase->setCaseInfo(caseName, fileName);
caseCollection->reservoirs.push_back(resCase);
groupIdToReplace = firstGroupId(project);
}
didReplacement = true;
if (m_replaceSourceCases_caseGroupId == FIRST_OCCURENCE)
if (groupIdToReplace == caseGroup->groupId())
{
return true;
RimCaseCollection* caseCollection = caseGroup->caseCollection;
caseCollection->reservoirs.deleteAllChildObjects();
for (QString fileName : item.second)
{
QString caseName = caseNameFromGridFileName(fileName);
// Use this slightly hackish method in order to get a new unique ID
RimEclipseResultCase* resCase = new RimEclipseResultCase;
resCase->setCaseInfo(caseName, fileName);
caseCollection->reservoirs.push_back(resCase);
}
}
}
}
}
}
return didReplacement;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaProjectModifier::replaceCase(RimProject* project)
void RiaProjectModifier::replaceCase(RimProject* project)
{
bool didReplacement = false;
std::vector<RimCase*> allCases;
project->allCases(allCases);
for (size_t caseIdx = 0; caseIdx < allCases.size(); ++caseIdx)
for (RimCase* rimCase : allCases)
{
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(allCases[caseIdx]);
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase);
if (resultCase)
{
if (m_replaceCase_caseId == FIRST_OCCURENCE ||
m_replaceCase_caseId == resultCase->caseId())
for (auto item : m_caseIdToGridFileNameMap)
{
resultCase->setGridFileName(m_replaceCase_gridFileName);
resultCase->caseUserDescription = caseNameFromGridFileName(m_replaceCase_gridFileName);
didReplacement = true;
if (m_replaceCase_caseId == FIRST_OCCURENCE)
int caseIdToReplace = item.first;
if (caseIdToReplace == RiaProjectModifier::firstOccurrenceId())
{
return true;
caseIdToReplace = firstCaseId(project);
}
if (caseIdToReplace == resultCase->caseId())
{
QString replaceFileName = item.second;
resultCase->setGridFileName(replaceFileName);
resultCase->caseUserDescription = caseNameFromGridFileName(replaceFileName);
}
}
}
}
return didReplacement;
}
//--------------------------------------------------------------------------------------------------
/// Returns absolute path name to the specified file.
///
@ -232,7 +180,6 @@ QString RiaProjectModifier::makeFilePathAbsolute(QString relOrAbsolutePath)
return theFile.filePath();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -248,4 +195,52 @@ QString RiaProjectModifier::caseNameFromGridFileName(QString fullGridFilePathNam
return deepestDirPlusFileName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaProjectModifier::firstCaseId(RimProject* project)
{
std::vector<RimCase*> allCases;
project->allCases(allCases);
for (RimCase* rimCase : allCases)
{
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase);
if (resultCase)
{
return resultCase->caseId();
}
}
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaProjectModifier::firstGroupId(RimProject* project)
{
for (size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = project->oilFields[oilFieldIdx];
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
if (analysisModels)
{
if (analysisModels->caseGroups.size() > 0)
{
return analysisModels->caseGroups[0]->groupId();
}
}
}
return -1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiaProjectModifier::firstOccurrenceId()
{
return -999;
}

View File

@ -25,6 +25,7 @@
#include <QString>
#include <vector>
#include <map>
class RimProject;
@ -40,32 +41,27 @@ class RiaProjectModifier : public cvf::Object
public:
RiaProjectModifier();
void setReplaceCaseFirstOccurence(QString newGridFileName);
void setReplaceCaseFirstOccurrence(QString newGridFileName);
void setReplaceCase(int caseIdToReplace, QString newGridFileName);
void setReplaceSourceCasesFirstOccurence(std::vector<QString> newGridFileNames);
void setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames);
void setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames);
bool applyModificationsToProject(RimProject* project);
private:
bool replaceSourceCases(RimProject* project);
bool replaceCase(RimProject* project);
void replaceSourceCases(RimProject* project);
void replaceCase(RimProject* project);
static QString makeFilePathAbsolute(QString relOrAbsolutePath);
static QString caseNameFromGridFileName(QString fullGridFilePathName);
static int firstCaseId(RimProject* project);
static int firstGroupId(RimProject* project);
static int firstOccurrenceId();
private:
int m_replaceCase_caseId;
QString m_replaceCase_gridFileName;
int m_replaceSourceCases_caseGroupId;
std::vector<QString> m_replaceSourceCases_gridFileNames;
static const int UNDEFINED = -1;
static const int FIRST_OCCURENCE = -999;
std::map<int, QString> m_caseIdToGridFileNameMap;
std::map<int, std::vector<QString> > m_groupIdToGridFileNamesMap;
};

View File

@ -21,19 +21,32 @@ include_directories(
${cafUserInterface_SOURCE_DIR}
${cafPdmCvf_SOURCE_DIR}
${CommonCode_SOURCE_DIR}
${cafVizExtensions_SOURCE_DIR}
${cafTensor_SOURCE_DIR}
${ResInsight_SOURCE_DIR}/ThirdParty
${ResInsight_SOURCE_DIR}/ThirdParty/NRLib/nrlib/well
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
${ERT_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${ResInsight_SOURCE_DIR}/ThirdParty/custom-opm-common/opm-common/
${custom-opm-parser_SOURCE_DIR}/opm-parser/
${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Adm
${CMAKE_CURRENT_SOURCE_DIR}/Application
${CMAKE_CURRENT_SOURCE_DIR}/Commands
${CMAKE_CURRENT_SOURCE_DIR}/Commands/EclipseCommands
${CMAKE_CURRENT_SOURCE_DIR}/FileInterface
${CMAKE_CURRENT_SOURCE_DIR}/SocketInterface
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
@ -63,42 +76,6 @@ set( APPLICATION_FILES
Application/RiaRegressionTest.cpp
)
set( USER_INTERFACE_FILES
UserInterface/RiuCursors.cpp
UserInterface/RiuResultTextBuilder.cpp
UserInterface/RiuFemResultTextBuilder.cpp
UserInterface/RiuMainWindow.cpp
UserInterface/RiuResultInfoPanel.cpp
UserInterface/RiuViewer.cpp
UserInterface/RiuSimpleHistogramWidget.cpp
UserInterface/RiuMultiCaseImportDialog.cpp
UserInterface/RiuProcessMonitor.cpp
UserInterface/RiuViewerCommands.cpp
UserInterface/RiuCadNavigation.cpp
UserInterface/RiuRmsNavigation.cpp
UserInterface/RiuGeoQuestNavigation.cpp
UserInterface/RiuDragDrop.cpp
UserInterface/RiuDragDrop.h
UserInterface/RiuTreeViewEventFilter.cpp
UserInterface/RiuTreeViewEventFilter.h
UserInterface/RiuWellLogPlot.cpp
UserInterface/RiuWellLogPlot.h
UserInterface/RiuLineSegmentQwtPlotCurve.cpp
UserInterface/RiuLineSegmentQwtPlotCurve.h
UserInterface/RiuWellLogTrack.cpp
UserInterface/RiuWellLogTrack.h
UserInterface/RiuProjectPropertyView.h
UserInterface/RiuProjectPropertyView.cpp
UserInterface/RiuResultQwtPlot.h
UserInterface/RiuResultQwtPlot.cpp
UserInterface/RiuSelectionManager.h
UserInterface/RiuSelectionManager.cpp
UserInterface/RiuSelectionColors.h
UserInterface/RiuSelectionColors.cpp
UserInterface/RiuSelectionChangedHandler.h
UserInterface/RiuSelectionChangedHandler.cpp
)
set( SOCKET_INTERFACE_FILES
SocketInterface/RiaSocketServer.cpp
SocketInterface/RiaProjectInfoCommands.cpp
@ -112,7 +89,6 @@ set( SOCKET_INTERFACE_FILES
list( APPEND CPP_SOURCES
${APPLICATION_FILES}
${USER_INTERFACE_FILES}
${SOCKET_INTERFACE_FILES}
${UNIT_TEST_FILES}
)
@ -121,20 +97,30 @@ list( APPEND REFERENCED_CMAKE_FILES
ReservoirDataModel/CMakeLists_files.cmake
ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake
FileInterface/CMakeLists_files.cmake
ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/Summary/CMakeLists_files.cmake
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
ModelVisualization/CMakeLists_files.cmake
ModelVisualization/GridBox/CMakeLists_files.cmake
ModelVisualization/Intersections/CMakeLists_files.cmake
UserInterface/CMakeLists_files.cmake
Commands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
Commands/ToggleCommands/CMakeLists_files.cmake
Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
Commands/SummaryPlotCommands/CMakeLists_files.cmake
Commands/ToggleCommands/CMakeLists_files.cmake
Commands/ViewLink/CMakeLists_files.cmake
Commands/WellLogCommands/CMakeLists_files.cmake
Commands/WellPathCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
)
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
@ -190,26 +176,13 @@ set ( QT_MOC_HEADERS
Application/RiaApplication.h
ProjectDataModel/RimMimeData.h
ProjectDataModel/RimIntersectionBox.h
UserInterface/RiuMainWindow.h
UserInterface/RiuResultInfoPanel.h
UserInterface/RiuViewer.h
UserInterface/RiuProcessMonitor.h
SocketInterface/RiaSocketServer.h
UserInterface/RiuMultiCaseImportDialog.h
UserInterface/RiuViewerCommands.h
UserInterface/RiuTreeViewEventFilter.h
UserInterface/RiuWellLogPlot.h
UserInterface/RiuWellLogTrack.h
)
qt4_wrap_cpp( MOC_FILES_CPP ${QT_MOC_HEADERS} )
# Define files for the uic compiler
set ( QT_UI_FILES
UserInterface/RiuMultiCaseImportDialog.ui
)
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
# NOTE! Resources in subfolders must append to QRC_FILES using the following statement
@ -232,67 +205,12 @@ if ( MSVC )
set( WIN_RESOURCE Resources/ResInsight.rc )
endif()
#############################################################################
# creating PCH's for MSVC and GCC on Linux
#############################################################################
#set( RAW_SOURCES ${CPP_SOURCES} )
#
#list( REMOVE_ITEM RAW_SOURCES
# RiaStdInclude.cpp
#
# ${CODE_SOURCE_FILES}
#
# ModelVisualization/RivCellEdgeEffectGenerator.cpp
# ModelVisualization/RivPipeGeometryGenerator.cpp
# ModelVisualization/RivWellPipesPartMgr.cpp
# ModelVisualization/RivWellHeadPartMgr.cpp
#
# Application/RiaImageFileCompare.cpp
# Application/RiaImageCompareReporter.cpp
# Application/RiaRegressionTest.cpp
#
# SocketInterface/RiaSocketDataTransfer.cpp
#
# FileInterface/RifEclipseInputFileTools.cpp
# FileInterface/RifEclipseOutputFileTools.cpp
# FileInterface/RifEclipseRestartFilesetAccess.cpp
# FileInterface/RifEclipseRestartDataAccess.cpp
# FileInterface/RifEclipseUnifiedRestartFileAccess.cpp
# FileInterface/RifReaderEclipseInput.cpp
# FileInterface/RifReaderEclipseOutput.cpp
#
# UserInterface/RiuSimpleHistogramWidget.cpp
# UserInterface/RiuMultiCaseImportDialog.cpp
# UserInterface/RiuResultTextBuilder.cpp
#)
#
#include( CustomPCH.cmake )
#set( ALL_INCLUDES
# ${LibCore_SOURCE_DIR}
# ${LibGeometry_SOURCE_DIR}
# ${LibGuiQt_SOURCE_DIR}
# ${LibRender_SOURCE_DIR}
# ${LibViewing_SOURCE_DIR}
# ${QT_INCLUDES}
#)
#
#set( PCH_NAME RiaStdInclude )
#set( GCC_PCH_TARGET gccPCH )
#set( PCH_COMPILER_DEFINE EMPTY )
#IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# set( PCH_COMPILER_DEFINE CVF_LINUX)
#ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
#
#precompiled_header( RAW_SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} ${PCH_COMPILER_DEFINE} )
################################################################################
# Create source groups - see also included CMakeLists_files.cmake
################################################################################
source_group( "Application" FILES ${APPLICATION_FILES} )
source_group( "ModelVisualization" FILES ${MODEL_VISUALIZATION_FILES} )
source_group( "UserInterface" FILES ${USER_INTERFACE_FILES} )
source_group( "SocketInterface" FILES ${SOCKET_INTERFACE_FILES} )
source_group( "UnitTests" FILES ${UNIT_TEST_FILES} )
@ -349,49 +267,40 @@ endif ()
# Set up libraries and dependent projects to link with
#############################################################################
if (MSVC)
set (RI_BOOST_LIBRARIES
debug ${Boost_SYSTEM_LIBRARY_DEBUG}
optimized ${Boost_SYSTEM_LIBRARY_RELEASE}
debug ${Boost_FILESYSTEM_LIBRARY_DEBUG}
optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE}
debug ${Boost_REGEX_LIBRARY_DEBUG}
optimized ${Boost_REGEX_LIBRARY_RELEASE}
)
else()
set (RI_BOOST_LIBRARIES ${Boost_LIBRARIES})
endif()
set( LINK_LIBRARIES
custom-opm-parser
custom-opm-flowdiagnostics
WellPathImportSsihub
# cafPdmCvf
# cafUserInterface
# cafProjectDataModel
# cafViewer
# cafAnimControl
# cafTensor
# CommonCode
#cafPdmCore
#cafPdmUiCore
cafPdmXml
#cafProjectDataModel
cafUserInterface
cafViewer
cafAnimControl
cafCommand
cafPdmCvf
cafTensor
CommonCode
LibGuiQt
LibViewing
LibRender
LibGeometry
LibCore
ResultStatisticsCache
RigGeoMechDataModel
ecl
ert_util
ert_geometry
ecl_well
${APP_FWK_LIBRARIES}
${VIZ_FWK_LIBRARIES}
${ERT_LIBRARIES}
NRLib
${OPENGL_LIBRARIES}
${QT_LIBRARIES}
${RI_BOOST_LIBRARIES}
Qwt
)
@ -412,6 +321,53 @@ ENDIF()
target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
#############################################################################
# cotire
#############################################################################
if(RESINSIGHT_ENABLE_COTIRE)
# forever is used as variable name, and this symbol is defined by Qt and used in precompiled headers
set_source_files_properties (${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc PROPERTIES COTIRE_EXCLUDED TRUE)
# multiple QRC files are not supported
set_source_files_properties (qrc_cafAnimControl.cxx PROPERTIES COTIRE_EXCLUDED TRUE)
# TODO: Revisit why opm-parser is not working
set_source_files_properties (UnitTests/opm-parser-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
# variables at global file scope
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (ModelVisualization/GridBox/RivGridBoxGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (Commands/WellLogCommands/RicWellLogPlotCurveFeatureImpl.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
# using namespace cvf
set_source_files_properties (GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (UnitTests/cvfGeometryTools-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
# opm parser
set_source_files_properties (FileInterface/RifReaderOpmParserInput.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (ProjectDataModel/RimProject.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (UnitTests/opm-parser-Performance-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_source_files_properties (UnitTests/opm-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
cotire(ResInsight)
# make sure the unity target is included in the active builds to trigger rebuild before debug
get_target_property(_unityTargetName ResInsight COTIRE_UNITY_TARGET_NAME)
set_target_properties(${_unityTargetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE)
set_target_properties(ResInsight PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
endif()
#############################################################################
# Copy Dlls on MSVC
#############################################################################
@ -434,6 +390,12 @@ if ((MSVC) AND (${RESINSIGHT_USE_ODB_API}))
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
if (_unityTargetName)
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif()
endforeach()
endif()
@ -448,6 +410,12 @@ if (MSVC)
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${QT_BINARY_DIR}/${qtlib}4.dll"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
if (_unityTargetName)
add_custom_command(TARGET ResInsight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${QT_BINARY_DIR}/${qtlib}4.dll"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif()
endforeach( qtlib )
endif(MSVC)
@ -466,16 +434,24 @@ if (RESINSIGHT_PRIVATE_INSTALL)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# tell binary to first attempt to load libraries from its own directory
set(RESINSIGHT_INSTALL_RPATH "\$ORIGIN")
if (${RESINSIGHT_USE_ODB_API})
# This is a "hack" to make ResInsight runtime find the ODB so files used when compiling.
# statoil wanted it this way, but we should probbly make a different installoptions that does things this way,
# and really do copy them when doing PRIVATE_INSTALL
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "\$ORIGIN;${RESINSIGHT_ODB_API_DIR}/lib")
else()
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "\$ORIGIN")
set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} ${RESINSIGHT_ODB_API_DIR}/lib)
endif()
if (EXISTS ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT})
# append the external ERT lib root
set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT})
endif()
#message("RESINSIGHT_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*

View File

@ -0,0 +1,51 @@
# 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}RicLaunchUnitTestsFeature.h
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.h
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.h
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveProjectAsFeature.h
${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.cpp
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveProjectAsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
#set (QT_MOC_HEADERS
#${QT_MOC_HEADERS}
#${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.h
#)
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicCloseProjectFeature.h"
#include "RiaApplication.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCloseProjectFeature, "RicCloseProjectFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCloseProjectFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCloseProjectFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
app->closeProject();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCloseProjectFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&Close Project");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicCloseProjectFeature : 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,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicEditPreferencesFeature.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiuPropertyViewTabWidget.h"
#include "cafPdmSettings.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicEditPreferencesFeature, "RicEditPreferencesFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicEditPreferencesFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QStringList tabNames = app->preferences()->tabNames();
RiuPropertyViewTabWidget propertyDialog(NULL, app->preferences(), "Preferences", tabNames);
if (propertyDialog.exec() == QDialog::Accepted)
{
// Write preferences using QSettings and apply them to the application
caf::PdmSettings::writeFieldsToApplicationStore(app->preferences());
app->applyPreferences();
}
else
{
// Read back currently stored values using QSettings
caf::PdmSettings::readFieldsFromApplicationStore(app->preferences());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEditPreferencesFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&Preferences...");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicEditPreferencesFeature : 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,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicExitApplicationFeature.h"
#include "RiaApplication.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicExitApplicationFeature, "RicExitApplicationFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExitApplicationFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExitApplicationFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
app->closeAllWindows();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExitApplicationFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("E&xit");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicExitApplicationFeature : 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,151 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicHelpFeatures.h"
#include "RiaBaseDefs.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
#include "cafAboutDialog.h"
#include "cafViewer.h"
#include <QAction>
#include <QDesktopServices>
#include <QErrorMessage>
#include <QUrl>
CAF_CMD_SOURCE_INIT(RicHelpAboutFeature, "RicHelpAboutFeature");
CAF_CMD_SOURCE_INIT(RicHelpCommandLineFeature, "RicHelpCommandLineFeature");
CAF_CMD_SOURCE_INIT(RicHelpOpenUsersGuideFeature, "RicHelpOpenUsersGuideFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicHelpAboutFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicHelpAboutFeature::onActionTriggered(bool isChecked)
{
caf::AboutDialog dlg(NULL);
dlg.setApplicationName(RI_APPLICATION_NAME);
dlg.setApplicationVersion(RiaApplication::getVersionStringApp(true));
dlg.setCopyright("Copyright Statoil ASA, Ceetron Solutions AS, Ceetron AS");
dlg.showQtVersion(false);
#ifdef _DEBUG
dlg.setIsDebugBuild(true);
#endif
dlg.addVersionEntry(" ", "ResInsight is made available under the GNU General Public License v. 3");
dlg.addVersionEntry(" ", "See http://www.gnu.org/licenses/gpl.html");
dlg.addVersionEntry(" ", " ");
dlg.addVersionEntry(" ", " ");
dlg.addVersionEntry(" ", "Technical Information");
dlg.addVersionEntry(" ", QString(" Qt ") + qVersion());
dlg.addVersionEntry(" ", QString(" ") + caf::AboutDialog::versionStringForcurrentOpenGLContext());
dlg.addVersionEntry(" ", caf::Viewer::isShadersSupported() ? " Hardware OpenGL" : " Software OpenGL");
dlg.create();
dlg.resize(300, 200);
dlg.exec();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicHelpAboutFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&About");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicHelpCommandLineFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicHelpCommandLineFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString text = app->commandLineParameterHelp();
app->showFormattedTextInMessageBox(text);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicHelpCommandLineFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&Command Line Help");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicHelpOpenUsersGuideFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicHelpOpenUsersGuideFeature::onActionTriggered(bool isChecked)
{
QString usersGuideUrl = "http://resinsight.org/docs/home";
if (!QDesktopServices::openUrl(usersGuideUrl))
{
QErrorMessage* errorHandler = QErrorMessage::qtHandler();
errorHandler->showMessage("Failed open browser with the following url\n\n" + usersGuideUrl);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicHelpOpenUsersGuideFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&Users Guide");
}

View File

@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicHelpAboutFeature : 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;
};
//==================================================================================================
///
//==================================================================================================
class RicHelpCommandLineFeature : 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;
};
//==================================================================================================
///
//==================================================================================================
class RicHelpOpenUsersGuideFeature : 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,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicOpenLastUsedFileFeature.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiuMainWindow.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicOpenLastUsedFileFeature, "RicOpenLastUsedFileFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicOpenLastUsedFileFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicOpenLastUsedFileFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString fileName = app->preferences()->lastUsedProjectFileName;
if (app->loadProject(fileName))
{
app->addToRecentFiles(fileName);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicOpenLastUsedFileFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Open &Last Used Project");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicOpenLastUsedFileFeature : 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,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicOpenProjectFeature.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
#include <QAction>
#include <QFileDialog>
#include <QStyle>
CAF_CMD_SOURCE_INIT(RicOpenProjectFeature, "RicOpenProjectFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicOpenProjectFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicOpenProjectFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
QString fileName = QFileDialog::getOpenFileName(NULL, "Open ResInsight Project", defaultDir, "ResInsight project (*.rsp *.rip);;All files(*.*)");
if (fileName.isEmpty()) return;
// Remember the path to next time
app->setLastUsedDialogDirectory("BINARY_GRID", QFileInfo(fileName).absolutePath());
if (app->loadProject(fileName))
{
app->addToRecentFiles(fileName);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicOpenProjectFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Open Project");
actionToSetup->setIcon(QIcon(":/openFolder24x24.png"));
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicOpenProjectFeature : 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,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicSaveProjectAsFeature.h"
#include "RicSaveProjectFeature.h"
#include "RiaApplication.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicSaveProjectAsFeature, "RicSaveProjectAsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSaveProjectAsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaveProjectAsFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
RicSaveProjectFeature::storeTreeViewState();
app->saveProjectPromptForFileName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaveProjectAsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Save Project &As");
actionToSetup->setIcon(QIcon(":/Save.png"));
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicSaveProjectAsFeature : 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,106 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicSaveProjectFeature.h"
#include "RiaApplication.h"
#include "RimTreeViewStateSerializer.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "RiuMainPlotWindow.h"
#include "cafPdmUiTreeView.h"
#include <QAction>
#include <QTreeView>
CAF_CMD_SOURCE_INIT(RicSaveProjectFeature, "RicSaveProjectFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSaveProjectFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaveProjectFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
RicSaveProjectFeature::storeTreeViewState();
app->saveProject();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaveProjectFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("&Save Project");
actionToSetup->setIcon(QIcon(":/Save.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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

@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicSaveProjectFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void storeTreeViewState();
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicShowMainWindowFeature.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicShowMainWindowFeature, "RicShowMainWindowFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowMainWindowFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (mainWnd->isMinimized())
{
mainWnd->showNormal();
mainWnd->update();
}
else
{
mainWnd->show();
}
mainWnd->raise();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Open 3D Window");
actionToSetup->setIcon(QIcon(":/3DWindow24x24.png"));
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicShowMainWindowFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicShowPlotWindowFeature.h"
#include "RiaApplication.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicShowPlotWindowFeature, "RicShowPlotWindowFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowPlotWindowFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowPlotWindowFeature::onActionTriggered(bool isChecked)
{
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowPlotWindowFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Open Plot Window");
actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicShowPlotWindowFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicTileWindowsFeature.h"
#include "RiuMainWindow.h"
#include "RiuMainPlotWindow.h"
#include <QAction>
#include <QApplication>
#include "RiaApplication.h"
CAF_CMD_SOURCE_INIT(RicTileWindowsFeature, "RicTileWindowsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicTileWindowsFeature::isCommandEnabled()
{
RiuMainWindow* mainWindow = RiuMainWindow::instance();
if (mainWindow)
{
return mainWindow->isAnyMdiSubWindowVisible();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTileWindowsFeature::onActionTriggered(bool isChecked)
{
RiuMainWindow* mainWindow = RiuMainWindow::instance();
if (mainWindow)
{
mainWindow->tileWindows();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTileWindowsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Tile Windows");
actionToSetup->setIcon(QIcon(":/TileWindows24x24.png"));
}
CAF_CMD_SOURCE_INIT(RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicTilePlotWindowsFeature::isCommandEnabled()
{
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
if (mainPlotWindow)
{
return mainPlotWindow->isAnyMdiSubWindowVisible();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTilePlotWindowsFeature::onActionTriggered(bool isChecked)
{
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->tileWindows();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicTilePlotWindowsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Tile Windows");
actionToSetup->setIcon(QIcon(":/TileWindows24x24.png"));
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicTileWindowsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
//==================================================================================================
///
//==================================================================================================
class RicTilePlotWindowsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered(bool isChecked);
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@ -6,18 +6,11 @@ endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertExec.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicNewViewFeature.h
${CEE_CURRENT_LIST_DIR}RicPropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterExecImpl.h
@ -29,21 +22,19 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceIFeature.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJFeature.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.h
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
${CEE_CURRENT_LIST_DIR}RicImportFormationNamesFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.h
${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h
${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.h
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.h
${CEE_CURRENT_LIST_DIR}RicExportToLasFileFeature.h
${CEE_CURRENT_LIST_DIR}RicExportToLasFileResampleUi.h
${CEE_CURRENT_LIST_DIR}RicSnapshotViewToClipboardFeature.h
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
@ -55,18 +46,11 @@ ${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicNewViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterExecImpl.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertExec.cpp
@ -77,20 +61,17 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceIFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportFormationNamesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportToLasFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportToLasFileResampleUi.cpp
${CEE_CURRENT_LIST_DIR}RicSnapshotViewToClipboardFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp

View File

@ -5,17 +5,17 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicAppendCrossSectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSimWellCrossSectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellPathCrossSectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPolylineCrossSectionFeature.h
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSimWellIntersectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellPathIntersectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPolylineIntersectionFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicAppendCrossSectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewSimWellCrossSectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellPathCrossSectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPolylineCrossSectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewSimWellIntersectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellPathIntersectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPolylineIntersectionFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -1,110 +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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAppendCrossSectionFeature.h"
#include "RimCrossSection.h"
#include "RimCrossSectionCollection.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicAppendCrossSectionFeature, "RicAppendCrossSectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAppendCrossSectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendCrossSectionFeature::onActionTriggered(bool isChecked)
{
std::vector<caf::PdmObjectHandle*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
RimCrossSectionCollection* crossSectionCollection = NULL;
collection[0]->firstAnchestorOrThisOfType(crossSectionCollection);
CVF_ASSERT(crossSectionCollection);
RicAppendCrossSectionFeatureCmd* cmd = new RicAppendCrossSectionFeatureCmd(crossSectionCollection);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendCrossSectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicAppendCrossSectionFeatureCmd::RicAppendCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection)
: CmdExecuteCommand(NULL),
m_crossSectionCollection(crossSectionCollection)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicAppendCrossSectionFeatureCmd::~RicAppendCrossSectionFeatureCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicAppendCrossSectionFeatureCmd::name()
{
return "New Intersection";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendCrossSectionFeatureCmd::redo()
{
CVF_ASSERT(m_crossSectionCollection);
RimCrossSection* crossSection = new RimCrossSection();
crossSection->name = QString("Intersection");
m_crossSectionCollection->appendCrossSection(crossSection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendCrossSectionFeatureCmd::undo()
{
}

View File

@ -1,62 +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"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimCrossSectionCollection;
//==================================================================================================
///
//==================================================================================================
class RicAppendCrossSectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicAppendCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection);
virtual ~RicAppendCrossSectionFeatureCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
};
//==================================================================================================
///
//==================================================================================================
class RicAppendCrossSectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAppendIntersectionFeature.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicAppendIntersectionFeature, "RicAppendIntersectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAppendIntersectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeature::onActionTriggered(bool isChecked)
{
std::vector<caf::PdmObjectHandle*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
RimIntersectionCollection* intersectionCollection = NULL;
collection[0]->firstAncestorOrThisOfType(intersectionCollection);
CVF_ASSERT(intersectionCollection);
RicAppendIntersectionFeatureCmd* cmd = new RicAppendIntersectionFeatureCmd(intersectionCollection);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicAppendIntersectionFeatureCmd::RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection)
: CmdExecuteCommand(NULL),
m_intersectionCollection(intersectionCollection)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicAppendIntersectionFeatureCmd::~RicAppendIntersectionFeatureCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicAppendIntersectionFeatureCmd::name()
{
return "New Intersection";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
RimIntersection* intersection = new RimIntersection();
intersection->name = QString("Intersection");
m_intersectionCollection->appendIntersection(intersection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionFeatureCmd::undo()
{
}

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
//==================================================================================================
///
//==================================================================================================
class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicAppendIntersectionFeatureCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
};
//==================================================================================================
///
//==================================================================================================
class RicAppendIntersectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -1,157 +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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewPolylineCrossSectionFeature.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimCrossSection.h"
#include "RimCrossSectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiuSelectionManager.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewPolylineCrossSectionFeature, "RicNewPolylineCrossSectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineCrossSectionFeature::RicNewPolylineCrossSectionFeature()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPolylineCrossSectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineCrossSectionFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RicNewPolylineCrossSectionFeatureCmd* cmd = new RicNewPolylineCrossSectionFeatureCmd(activeView->crossSectionCollection);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineCrossSectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Polyline Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPolylineCrossSectionFeature::handleEvent(cvf::Object* eventObject)
{
std::vector<RimCrossSection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() == 1)
{
RicViewerEventObject* polylineUiEvent = dynamic_cast<RicViewerEventObject*>(eventObject);
if (polylineUiEvent)
{
RimCrossSection* crossSection = selection[0];
if (crossSection->inputFromViewerEnabled())
{
RimCase* rimCase = NULL;
crossSection->firstAnchestorOrThisOfType(rimCase);
CVF_ASSERT(rimCase);
crossSection->appendPointToPolyLine(rimCase->displayModelOffset() + polylineUiEvent->localIntersectionPoint);
// Further Ui processing is stopped when true is returned
return true;
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineCrossSectionFeatureCmd::RicNewPolylineCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection)
: CmdExecuteCommand(NULL),
m_crossSectionCollection(crossSectionCollection)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineCrossSectionFeatureCmd::~RicNewPolylineCrossSectionFeatureCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewPolylineCrossSectionFeatureCmd::name()
{
return "Start Polyline Intersection";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineCrossSectionFeatureCmd::redo()
{
CVF_ASSERT(m_crossSectionCollection);
RimCrossSection* crossSection = new RimCrossSection();
crossSection->name = "Polyline";
crossSection->type = RimCrossSection::CS_POLYLINE;
crossSection->inputFromViewerEnabled = true;
m_crossSectionCollection->appendCrossSection(crossSection);
RiuSelectionManager::instance()->deleteAllItems();
RiuMainWindow::instance()->selectAsCurrentItem(crossSection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineCrossSectionFeatureCmd::undo()
{
}

View File

@ -1,72 +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 "RicViewerEventInterface.h"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfVector3.h"
class RimCrossSectionCollection;
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineCrossSectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicNewPolylineCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection);
virtual ~RicNewPolylineCrossSectionFeatureCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
};
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineCrossSectionFeature : public caf::CmdFeature, public RicViewerEventInterface
{
CAF_CMD_HEADER_INIT;
public:
RicNewPolylineCrossSectionFeature();
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
virtual bool handleEvent(cvf::Object* eventObject);
};

View File

@ -0,0 +1,171 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewPolylineIntersectionFeature.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewPolylineIntersectionFeature, "RicNewPolylineIntersectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineIntersectionFeature::RicNewPolylineIntersectionFeature()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPolylineIntersectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RicNewPolylineIntersectionFeatureCmd* cmd = new RicNewPolylineIntersectionFeatureCmd(activeView->crossSectionCollection);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Polyline Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPolylineIntersectionFeature::handleEvent(cvf::Object* eventObject)
{
std::vector<RimIntersection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() == 1)
{
RicViewerEventObject* polylineUiEvent = dynamic_cast<RicViewerEventObject*>(eventObject);
if (polylineUiEvent)
{
RimIntersection* intersection = selection[0];
RimView* rimView = nullptr;
intersection->firstAncestorOrThisOfType(rimView);
CVF_ASSERT(rimView);
cvf::ref<caf::DisplayCoordTransform> transForm = rimView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->transformToDomainCoord(polylineUiEvent->globalIntersectionPoint);
if (intersection->inputPolyLineFromViewerEnabled())
{
intersection->appendPointToPolyLine(domainCoord);
// Further Ui processing is stopped when true is returned
return true;
}
else if (intersection->inputExtrusionPointsFromViewerEnabled())
{
intersection->appendPointToExtrusionDirection(domainCoord);
// Further Ui processing is stopped when true is returned
return true;
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineIntersectionFeatureCmd::RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection)
: CmdExecuteCommand(NULL),
m_intersectionCollection(intersectionCollection)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewPolylineIntersectionFeatureCmd::~RicNewPolylineIntersectionFeatureCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewPolylineIntersectionFeatureCmd::name()
{
return "Start Polyline Intersection";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
RimIntersection* intersection = new RimIntersection();
intersection->name = "Polyline";
intersection->type = RimIntersection::CS_POLYLINE;
intersection->inputPolyLineFromViewerEnabled = true;
m_intersectionCollection->appendIntersection(intersection);
RiuSelectionManager::instance()->deleteAllItems();
RiuMainWindow::instance()->selectAsCurrentItem(intersection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPolylineIntersectionFeatureCmd::undo()
{
}

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicViewerEventInterface.h"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfVector3.h"
class RimIntersectionCollection;
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicNewPolylineIntersectionFeatureCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
};
//==================================================================================================
///
//==================================================================================================
class RicNewPolylineIntersectionFeature : public caf::CmdFeature, public RicViewerEventInterface
{
CAF_CMD_HEADER_INIT;
public:
RicNewPolylineIntersectionFeature();
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
virtual bool handleEvent(cvf::Object* eventObject);
};

View File

@ -1,118 +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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewSimWellCrossSectionFeature.h"
#include "RimCrossSection.h"
#include "RimCrossSectionCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewSimWellCrossSectionFeature, "RicNewSimWellCrossSectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewSimWellCrossSectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellCrossSectionFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
RimEclipseWell* eclWell = collection[0];
RimEclipseView* eclView = NULL;
eclWell->firstAnchestorOrThisOfType(eclView);
CVF_ASSERT(eclView);
RicNewSimWellCrossSectionCmd* cmd = new RicNewSimWellCrossSectionCmd(eclView->crossSectionCollection, eclWell);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellCrossSectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewSimWellCrossSectionCmd::RicNewSimWellCrossSectionCmd(RimCrossSectionCollection* crossSectionCollection, RimEclipseWell* simWell)
: CmdExecuteCommand(NULL),
m_crossSectionCollection(crossSectionCollection),
m_wellPath(simWell)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewSimWellCrossSectionCmd::~RicNewSimWellCrossSectionCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewSimWellCrossSectionCmd::name()
{
return "Create Intersection From Well";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellCrossSectionCmd::redo()
{
CVF_ASSERT(m_crossSectionCollection);
CVF_ASSERT(m_wellPath);
RimCrossSection* crossSection = new RimCrossSection();
crossSection->name = m_wellPath->name;
crossSection->type = RimCrossSection::CS_SIMULATION_WELL;
crossSection->simulationWell = m_wellPath;
m_crossSectionCollection->appendCrossSection(crossSection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellCrossSectionCmd::undo()
{
}

View File

@ -1,64 +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"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimCrossSectionCollection;
class RimEclipseWell;
//==================================================================================================
///
//==================================================================================================
class RicNewSimWellCrossSectionCmd : public caf::CmdExecuteCommand
{
public:
RicNewSimWellCrossSectionCmd(RimCrossSectionCollection* crossSectionCollection, RimEclipseWell* simWell);
virtual ~RicNewSimWellCrossSectionCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
caf::PdmPointer<RimEclipseWell> m_wellPath;
};
//==================================================================================================
///
//==================================================================================================
class RicNewSimWellCrossSectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -0,0 +1,118 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewSimWellIntersectionFeature.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewSimWellIntersectionFeature, "RicNewSimWellIntersectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewSimWellIntersectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
RimEclipseWell* eclWell = collection[0];
RimEclipseView* eclView = NULL;
eclWell->firstAncestorOrThisOfType(eclView);
CVF_ASSERT(eclView);
RicNewSimWellIntersectionCmd* cmd = new RicNewSimWellIntersectionCmd(eclView->crossSectionCollection, eclWell);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewSimWellIntersectionCmd::RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimEclipseWell* simWell)
: CmdExecuteCommand(NULL),
m_intersectionCollection(intersectionCollection),
m_wellPath(simWell)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewSimWellIntersectionCmd::~RicNewSimWellIntersectionCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewSimWellIntersectionCmd::name()
{
return "Create Intersection From Well";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT(m_wellPath);
RimIntersection* intersection = new RimIntersection();
intersection->name = m_wellPath->name;
intersection->type = RimIntersection::CS_SIMULATION_WELL;
intersection->simulationWell = m_wellPath;
m_intersectionCollection->appendIntersection(intersection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellIntersectionCmd::undo()
{
}

View File

@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
class RimEclipseWell;
//==================================================================================================
///
//==================================================================================================
class RicNewSimWellIntersectionCmd : public caf::CmdExecuteCommand
{
public:
RicNewSimWellIntersectionCmd(RimIntersectionCollection* intersectionCollection, RimEclipseWell* simWell);
virtual ~RicNewSimWellIntersectionCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
caf::PdmPointer<RimEclipseWell> m_wellPath;
};
//==================================================================================================
///
//==================================================================================================
class RicNewSimWellIntersectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -1,127 +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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellPathCrossSectionFeature.h"
#include "RiaApplication.h"
#include "RimCrossSection.h"
#include "RimCrossSectionCollection.h"
#include "RimWellPath.h"
#include "RimView.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewWellPathCrossSectionFeature, "RicNewWellPathCrossSectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathCrossSectionFeature::RicNewWellPathCrossSectionFeature()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathCrossSectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
std::vector<RimWellPath*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
RimWellPath* wellPath = collection[0];
RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(activeView->crossSectionCollection, wellPath);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathCrossSectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathCrossSectionFeatureCmd::RicNewWellPathCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection, RimWellPath* wellPath)
: CmdExecuteCommand(NULL),
m_crossSectionCollection(crossSectionCollection),
m_wellPath(wellPath)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathCrossSectionFeatureCmd::~RicNewWellPathCrossSectionFeatureCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewWellPathCrossSectionFeatureCmd::name()
{
return "Create Intersection From Well Path";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathCrossSectionFeatureCmd::redo()
{
CVF_ASSERT(m_crossSectionCollection);
CVF_ASSERT(m_wellPath);
RimCrossSection* crossSection = new RimCrossSection();
crossSection->name = m_wellPath->name;
crossSection->type = RimCrossSection::CS_WELL_PATH;
crossSection->wellPath = m_wellPath;
m_crossSectionCollection->appendCrossSection(crossSection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathCrossSectionFeatureCmd::undo()
{
}

View File

@ -1,67 +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"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimCrossSectionCollection;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicNewWellPathCrossSectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicNewWellPathCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection, RimWellPath* wellPath);
virtual ~RicNewWellPathCrossSectionFeatureCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimCrossSectionCollection> m_crossSectionCollection;
caf::PdmPointer<RimWellPath> m_wellPath;
};
//==================================================================================================
///
//==================================================================================================
class RicNewWellPathCrossSectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
RicNewWellPathCrossSectionFeature();
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellPathIntersectionFeature.h"
#include "RiaApplication.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
#include "RimWellPath.h"
#include "RimView.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewWellPathIntersectionFeature, "RicNewWellPathIntersectionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathIntersectionFeature::RicNewWellPathIntersectionFeature()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathIntersectionFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
std::vector<RimWellPath*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
CVF_ASSERT(collection.size() == 1);
RimWellPath* wellPath = collection[0];
RicNewWellPathIntersectionFeatureCmd* cmd = new RicNewWellPathIntersectionFeatureCmd(activeView->crossSectionCollection, wellPath);
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Intersection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathIntersectionFeatureCmd::RicNewWellPathIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection, RimWellPath* wellPath)
: CmdExecuteCommand(NULL),
m_intersectionCollection(intersectionCollection),
m_wellPath(wellPath)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicNewWellPathIntersectionFeatureCmd::~RicNewWellPathIntersectionFeatureCmd()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewWellPathIntersectionFeatureCmd::name()
{
return "Create Intersection From Well Path";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeatureCmd::redo()
{
CVF_ASSERT(m_intersectionCollection);
CVF_ASSERT(m_wellPath);
RimIntersection* intersection = new RimIntersection();
intersection->name = m_wellPath->name;
intersection->type = RimIntersection::CS_WELL_PATH;
intersection->wellPath = m_wellPath;
m_intersectionCollection->appendIntersection(intersection);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathIntersectionFeatureCmd::undo()
{
}

View File

@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
#include "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicNewWellPathIntersectionFeatureCmd : public caf::CmdExecuteCommand
{
public:
RicNewWellPathIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection, RimWellPath* wellPath);
virtual ~RicNewWellPathIntersectionFeatureCmd();
virtual QString name();
virtual void redo();
virtual void undo();
private:
caf::PdmPointer<RimIntersectionCollection> m_intersectionCollection;
caf::PdmPointer<RimWellPath> m_wellPath;
};
//==================================================================================================
///
//==================================================================================================
class RicNewWellPathIntersectionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
RicNewWellPathIntersectionFeature();
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -0,0 +1,57 @@
# 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}RicAddEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.h
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertExec.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertFeature.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.h
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.h
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicAddEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAddOpmInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipseCaseNewGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterInsertFeature.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicEclipsePropertyFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportInputEclipseCaseOpmFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseInputPropertyFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyExec.cpp
${CEE_CURRENT_LIST_DIR}RicSaveEclipseResultAsInputPropertyFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\Eclipse" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -21,6 +21,7 @@
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipseInputCase.h"
#include "RimEclipseInputCaseOpm.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
@ -39,6 +40,18 @@ CAF_CMD_SOURCE_INIT(RicAddEclipseInputPropertyFeature, "RicAddEclipseInputProper
//--------------------------------------------------------------------------------------------------
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
{
RimEclipseInputPropertyCollection* inputProp = selectedInputPropertyCollection();
if (inputProp)
{
RimEclipseInputCaseOpm* inputCaseOpm = NULL;
inputProp->firstAncestorOrThisOfType(inputCaseOpm);
if (inputCaseOpm)
{
return false;
}
}
return selectedInputPropertyCollection() != NULL;
}
@ -48,14 +61,14 @@ bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
void RicAddEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Select Eclipse Input Property Files", defaultDir, "All Files (*.* *)");
if (fileNames.isEmpty()) return;
// Remember the directory to next time
defaultDir = QFileInfo(fileNames.last()).absolutePath();
app->setDefaultFileDialogDirectory("INPUT_FILES", defaultDir);
app->setLastUsedDialogDirectory("INPUT_FILES", defaultDir);
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
if (inputPropertyCollection)

View File

@ -0,0 +1,115 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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

@ -44,7 +44,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled()
if (statisticsCase)
{
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
statisticsCase->firstAnchestorOrThisOfType(gridCaseGroup);
statisticsCase->firstAncestorOrThisOfType(gridCaseGroup);
RimCaseCollection* caseCollection = gridCaseGroup ? gridCaseGroup->caseCollection() : NULL;
return caseCollection ? caseCollection->reservoirs.size() > 0 : false;
@ -64,17 +64,7 @@ void RicComputeStatisticsFeature::onActionTriggered(bool isChecked)
{
RimEclipseStatisticsCase* statisticsCase = selection[0];
statisticsCase->computeStatistics();
statisticsCase->scheduleACTIVEGeometryRegenOnReservoirViews();
statisticsCase->updateConnectedEditorsAndReservoirViews();
if (statisticsCase->reservoirViews.size() == 0)
{
QAction* action = caf::CmdFeatureManager::instance()->action("RicNewViewFeature");
CVF_ASSERT(action);
action->trigger();
}
statisticsCase->computeStatisticsAndUpdateViews();
}
}

View File

@ -90,7 +90,7 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter(RimEclipsePropert
bool RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(caf::PdmObjectHandle* object)
{
RimView* rimView = NULL;
object->firstAnchestorOrThisOfType(rimView);
object->firstAncestorOrThisOfType(rimView);
if (rimView)
{
RimViewController* vc = rimView->viewController();
@ -123,4 +123,5 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
propertyFilter->resultDefinition->loadResult();
propertyFilter->setToDefaultValues();
propertyFilter->updateFilterName();
propertyFilter->m_categorySelection = true;
}

View File

@ -64,5 +64,6 @@ void RicEclipsePropertyFilterInsertFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterInsertFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/CellFilter_Values.png"));
actionToSetup->setText("Insert Property Filter");
}

View File

@ -45,10 +45,10 @@ void RicImportEclipseCaseFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse File", defaultDir, "Eclipse Grid Files (*.GRID *.EGRID)");
if (fileNames.size()) defaultDir = QFileInfo(fileNames.last()).absolutePath();
app->setDefaultFileDialogDirectory("BINARY_GRID", defaultDir);
app->setLastUsedDialogDirectory("BINARY_GRID", defaultDir);
int i;
for (i = 0; i < fileNames.size(); i++)
@ -59,7 +59,7 @@ void RicImportEclipseCaseFeature::onActionTriggered(bool isChecked)
{
if (app->openEclipseCaseFromFile(fileName))
{
RiuMainWindow::instance()->addRecentFiles(fileName);
app->addToRecentFiles(fileName);
}
}
}

View File

@ -44,13 +44,13 @@ bool RicImportInputEclipseCaseFeature::isCommandEnabled()
void RicImportInputEclipseCaseFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("INPUT_FILES");
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse Input Files", defaultDir, "Eclipse Input Files and Input Properties (*.GRDECL *)");
QString defaultDir = app->lastUsedDialogDirectory("INPUT_FILES");
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Eclipse Input Files", defaultDir, "Eclipse Input Files and Input Properties Eclipse Input Files (*.GRDECL);;All Files (*.*)");
if (fileNames.isEmpty()) return;
// Remember the path to next time
app->setDefaultFileDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
app->setLastUsedDialogDirectory("INPUT_FILES", QFileInfo(fileNames.last()).absolutePath());
app->openInputEclipseCaseFromFileNames(fileNames);

View File

@ -0,0 +1,100 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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

@ -84,17 +84,10 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
if (!inputReservoir) return;
{
QString projectFolder;
RiaApplication* app = RiaApplication::instance();
QString projectFileName = app->currentProjectFileName();
if (!projectFileName.isEmpty())
QString projectFolder = app->currentProjectPath();
if (projectFolder.isEmpty())
{
QFileInfo fi(projectFileName);
projectFolder = fi.absolutePath();
}
else
{
projectFolder = inputReservoir->locationOnDisc();
}

View File

@ -77,16 +77,9 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
RimBinaryExportSettings exportSettings;
exportSettings.eclipseKeyword = m_cellColors->resultVariable();
{
QString projectFolder;
RiaApplication* app = RiaApplication::instance();
QString projectFileName = app->currentProjectFileName();
if (!projectFileName.isEmpty())
{
QFileInfo fi(projectFileName);
projectFolder = fi.absolutePath();
}
else
QString projectFolder = app->currentProjectPath();
if (projectFolder.isEmpty())
{
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
}

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}RicBoxManipulatorEventHandler.h
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionBoxFeature.h
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxXSliceFeature.h
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxYSliceFeature.h
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxZSliceFeature.h
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxAtPosFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.cpp
${CEE_CURRENT_LIST_DIR}RicAppendIntersectionBoxFeature.cpp
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxXSliceFeature.cpp
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxYSliceFeature.cpp
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxZSliceFeature.cpp
${CEE_CURRENT_LIST_DIR}RicIntersectionBoxAtPosFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
set (QT_MOC_HEADERS
${QT_MOC_HEADERS}
${CEE_CURRENT_LIST_DIR}RicBoxManipulatorEventHandler.h
)
source_group( "CommandFeature\\IntersectionBox" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicAppendIntersectionBoxFeature.h"
#include "RimCase.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicAppendIntersectionBoxFeature, "RicAppendIntersectionBoxFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAppendIntersectionBoxFeature::isCommandEnabled()
{
RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
if (coll) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionBoxFeature::onActionTriggered(bool isChecked)
{
RimIntersectionCollection* coll = RicAppendIntersectionBoxFeature::intersectionCollection();
if (coll)
{
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Intersection Box");
coll->appendIntersectionBox(intersectionBox);
intersectionBox->setToDefaultSizeBox();
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
RimView* rimView = NULL;
coll->firstAncestorOrThisOfType(rimView);
if (rimView)
{
rimView->showGridCells(false);
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendIntersectionBoxFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/IntersectionBox16x16.png"));
actionToSetup->setText("New Intersection Box");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionCollection* RicAppendIntersectionBoxFeature::intersectionCollection()
{
RimIntersectionCollection* intersectionBoxColl = nullptr;
std::vector<caf::PdmObjectHandle*> selectedObjects;
caf::SelectionManager::instance()->objectsByType(&selectedObjects);
if (selectedObjects.size() == 1)
{
selectedObjects[0]->firstAncestorOrThisOfType(intersectionBoxColl);
}
return intersectionBoxColl;
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdExecuteCommand.h"
#include "cafPdmPointer.h"
class RimIntersectionCollection;
//==================================================================================================
///
//==================================================================================================
class RicAppendIntersectionBoxFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
static RimIntersectionCollection* intersectionCollection();
};

View File

@ -0,0 +1,136 @@
#include "RicBoxManipulatorEventHandler.h"
#include "cafBoxManipulatorPartManager.h"
#include "cafEffectGenerator.h"
#include "cafViewer.h"
#include "cvfCamera.h"
#include "cvfDrawableGeo.h"
#include "cvfHitItemCollection.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfRay.h"
#include <QDebug>
#include <QMouseEvent>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicBoxManipulatorEventHandler::RicBoxManipulatorEventHandler(caf::Viewer* viewer)
: m_viewer(viewer)
{
m_partManager = new caf::BoxManipulatorPartManager;
m_viewer->installEventFilter(this);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicBoxManipulatorEventHandler::~RicBoxManipulatorEventHandler()
{
if (m_viewer) m_viewer->removeEventFilter(this);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::setOrigin(const cvf::Vec3d& origin)
{
m_partManager->setOrigin(origin);
emit notifyRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::setSize(const cvf::Vec3d& size)
{
m_partManager->setSize(size);
emit notifyRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicBoxManipulatorEventHandler::appendPartsToModel(cvf::ModelBasicList* model)
{
m_partManager->appendPartsToModel(model);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicBoxManipulatorEventHandler::eventFilter(QObject *obj, QEvent* inputEvent)
{
if (inputEvent->type() == QEvent::MouseButtonPress)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(inputEvent);
if (mouseEvent->button() == Qt::LeftButton)
{
cvf::HitItemCollection hitItems;
if (m_viewer->rayPick(mouseEvent->x(), mouseEvent->y(), &hitItems))
{
m_partManager->tryToActivateManipulator(hitItems.firstItem());
if(m_partManager->isManipulatorActive())
{
emit notifyRedraw();
return true;
}
}
}
}
else if (inputEvent->type() == QEvent::MouseMove)
{
if (m_partManager->isManipulatorActive())
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(inputEvent);
//qDebug() << "Inside mouse move";
//qDebug() << mouseEvent->pos();
int translatedMousePosX = mouseEvent->pos().x();
int translatedMousePosY = m_viewer->height() - mouseEvent->pos().y();
cvf::ref<cvf::Ray> ray = m_viewer->mainCamera()->rayFromWindowCoordinates(translatedMousePosX, translatedMousePosY);
{
m_partManager->updateManipulatorFromRay(ray.p());
cvf::Vec3d origin;
cvf::Vec3d size;
m_partManager->originAndSize(&origin, &size);
emit notifyUpdate(origin, size);
emit notifyRedraw();
return true;
}
}
}
else if (inputEvent->type() == QEvent::MouseButtonRelease)
{
if (m_partManager->isManipulatorActive())
{
m_partManager->endManipulator();
cvf::Vec3d origin;
cvf::Vec3d size;
m_partManager->originAndSize(&origin, &size);
emit notifyUpdate(origin, size);
return true;
}
}
return false;
}

View File

@ -0,0 +1,56 @@
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfMatrix4.h"
#include "cvfVector3.h"
#include <QObject>
#include <QPointer>
namespace cvf {
class Model;
class ModelBasicList;
};
namespace caf {
class BoxManipulatorPartManager;
class Viewer;
};
class QMouseEvent;
//==================================================================================================
//
//
//==================================================================================================
class RicBoxManipulatorEventHandler : public QObject
{
Q_OBJECT
public:
RicBoxManipulatorEventHandler(caf::Viewer* viewer);
~RicBoxManipulatorEventHandler();
void setOrigin(const cvf::Vec3d& origin);
void setSize(const cvf::Vec3d& size);
void appendPartsToModel(cvf::ModelBasicList* model);
signals:
void notifyRedraw();
void notifyUpdate(const cvf::Vec3d& origin, const cvf::Vec3d& size);
protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
QPointer<caf::Viewer> m_viewer;
cvf::ref<caf::BoxManipulatorPartManager> m_partManager;
};

View File

@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicIntersectionBoxAtPosFeature.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicIntersectionBoxAtPosFeature, "RicIntersectionBoxAtPosFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxAtPosFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxAtPosFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT(coll);
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Intersection box");
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_NONE, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
RimView* rimView = NULL;
coll->firstAncestorOrThisOfType(rimView);
if (rimView)
{
rimView->showGridCells(false);
RiuMainWindow::instance()->refreshDrawStyleActions();
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxAtPosFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/IntersectionBox16x16.png"));
actionToSetup->setText("Intersection Box");
}

View File

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

View File

@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicIntersectionBoxXSliceFeature.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicIntersectionBoxXSliceFeature, "RicIntersectionBoxXSliceFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxXSliceFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxXSliceFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT(coll);
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("X-slice (Intersection box)");
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_X, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
RimView* rimView = NULL;
coll->firstAncestorOrThisOfType(rimView);
if (rimView)
{
rimView->showGridCells(false);
RiuMainWindow::instance()->refreshDrawStyleActions();
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxXSliceFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/IntersectionXPlane16x16.png"));
actionToSetup->setText("X-slice Intersection Box");
}

View File

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

View File

@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicIntersectionBoxYSliceFeature.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicIntersectionBoxYSliceFeature, "RicIntersectionBoxYSliceFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxYSliceFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxYSliceFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT(coll);
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Y-slice (Intersection box)");
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Y, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
RimView* rimView = NULL;
coll->firstAncestorOrThisOfType(rimView);
if (rimView)
{
rimView->showGridCells(false);
RiuMainWindow::instance()->refreshDrawStyleActions();
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxYSliceFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/IntersectionYPlane16x16.png"));
actionToSetup->setText("Y-slice Intersection Box");
}

View File

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

View File

@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicIntersectionBoxZSliceFeature.h"
#include "RiaApplication.h"
#include "RimCase.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionCollection.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafCmdExecCommandManager.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicIntersectionBoxZSliceFeature, "RicIntersectionBoxZSliceFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicIntersectionBoxZSliceFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxZSliceFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
RimIntersectionCollection* coll = activeView->crossSectionCollection();
CVF_ASSERT(coll);
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Z-slice (Intersection box)");
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Z, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
RimView* rimView = NULL;
coll->firstAncestorOrThisOfType(rimView);
if (rimView)
{
rimView->showGridCells(false);
RiuMainWindow::instance()->refreshDrawStyleActions();
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxZSliceFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/IntersectionZPlane16x16.png"));
actionToSetup->setText("Z-slice Intersection Box");
}

View File

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

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