#809 Created Formation Names project items.

#819 Added delete command to Formation names
#808 Added an import Formation Names command
This commit is contained in:
Jacob Støren
2016-08-24 08:30:12 +02:00
parent 5260a3f870
commit b46c6ebcf8
17 changed files with 481 additions and 2 deletions

View File

@@ -68,6 +68,7 @@
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimFormationNamesCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuMainWindow.h"
@@ -385,6 +386,18 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
}
}
// Load the formation names
for(RimOilField* oilField: m_project->oilFields)
{
if (oilField == NULL) continue;
if(oilField->formationNamesCollection() != NULL)
{
oilField->formationNamesCollection()->readAllFormationNames();
}
}
// Add well paths for each oil field
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
{

View File

@@ -35,6 +35,8 @@ ${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}RicImportFormationNamesFeature.h
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
@@ -89,6 +91,8 @@ ${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}RicImportFormationNamesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp

View File

@@ -0,0 +1,77 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicImportFormationNamesFeature.h"
#include "RimFormationNamesCollection.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimOilField.h"
#include "RiuMainWindow.h"
#include <QAction>
#include <QFileDialog>
CAF_CMD_SOURCE_INIT(RicImportFormationNamesFeature, "RicImportFormationNamesFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportFormationNamesFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportFormationNamesFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("BINARY_GRID");
QStringList fileNames = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Formation Names", defaultDir, "Formation Names description File (*.lyr);;All Files (*.*)");
if (fileNames.isEmpty()) return;
// Remember the path to next time
app->setDefaultFileDialogDirectory("BINARY_GRID", QFileInfo(fileNames.last()).absolutePath());
// Find or create the FomationNamesCollection
RimProject* proj = RiaApplication::instance()->project();
RimFormationNamesCollection* fomNameColl = proj->activeOilField()->formationNamesCollection();
if (!fomNameColl)
{
fomNameColl = new RimFormationNamesCollection;
proj->activeOilField()->formationNamesCollection = fomNameColl;
}
// For each file, find existing Formation names item, or create new
fomNameColl->importFiles(fileNames);
proj->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportFormationNamesFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/FormationCollection16x16.png"));
actionToSetup->setText("Import Formation Names");
}

View File

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

View File

@@ -45,6 +45,8 @@ ${CEE_CURRENT_LIST_DIR}RimCommandObject.h
${CEE_CURRENT_LIST_DIR}RimTools.h
${CEE_CURRENT_LIST_DIR}RimFault.h
${CEE_CURRENT_LIST_DIR}RimFaultCollection.h
${CEE_CURRENT_LIST_DIR}RimFormationNames.h
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.h
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.h
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.h
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.h
@@ -132,6 +134,8 @@ ${CEE_CURRENT_LIST_DIR}RimCommandObject.cpp
${CEE_CURRENT_LIST_DIR}RimTools.cpp
${CEE_CURRENT_LIST_DIR}RimFault.cpp
${CEE_CURRENT_LIST_DIR}RimFaultCollection.cpp
${CEE_CURRENT_LIST_DIR}RimFormationNames.cpp
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.cpp
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.cpp
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.cpp

View File

@@ -35,6 +35,8 @@
#include "RimEclipseStatisticsCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimFormationNames.h"
#include "RimFormationNamesCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechPropertyFilter.h"
#include "RimGeoMechPropertyFilterCollection.h"
@@ -310,7 +312,18 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
commandIds << "RicNewSimWellCrossSectionFeature";
}
else if(dynamic_cast<RimFormationNames*>(uiItem))
{
commandIds << "RicImportFormationNamesFeature";
commandIds << "Separator";
commandIds << "RicDeleteItemFeature";
}
else if(dynamic_cast<RimFormationNamesCollection*>(uiItem))
{
commandIds << "RicImportFormationNamesFeature";
commandIds << "Separator";
commandIds << "RicDeleteItemFeature";
}
if (dynamic_cast<RimView*>(uiItem))
{
commandIds << "RicLinkVisibleViewsFeature";

View File

@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 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 "RimFormationNames.h"
#include "RimTools.h"
#include "cafPdmUiFilePathEditor.h"
CAF_PDM_SOURCE_INIT(RimFormationNames, "FormationNames");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFormationNames::RimFormationNames()
{
CAF_PDM_InitObject("Formation Names", ":/Formations16x16.png", "", "");
CAF_PDM_InitField(&m_formationNamesFileName, "FormationNamesFileName", QString(""), "File Name", "", "", "");
m_formationNamesFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFormationNames::~RimFormationNames()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (&m_formationNamesFileName == changedField)
{
updateUiTreeName();
readFormationNamesFile(nullptr);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::initAfterRead()
{
updateUiTreeName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::updateUiTreeName()
{
this->uiCapability()->setUiName(m_formationNamesFileName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::setFileName(const QString& fileName)
{
m_formationNamesFileName = fileName;
updateUiTreeName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RimFormationNames::fileName()
{
return m_formationNamesFileName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::readFormationNamesFile(QString * errorMessage)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNames::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
{
m_formationNamesFileName = RimTools::relocateFile(m_formationNamesFileName(), newProjectPath, oldProjectPath, NULL, NULL);
}

View File

@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 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 "cafPdmObject.h"
#include "cafPdmField.h"
#include "cvfObject.h"
class RigFormationNames;
class RimFormationNames : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFormationNames();
~RimFormationNames();
void setFileName(const QString& fileName);
const QString& fileName();
void readFormationNamesFile(QString * errorMessage);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void initAfterRead() override;
private:
void updateUiTreeName();
caf::PdmField<QString> m_formationNamesFileName;
cvf::ref<RigFormationNames> m_formationNamesData;
};
class RigFormationNames: public cvf::Object
{
};

View File

@@ -0,0 +1,105 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 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 "RimFormationNamesCollection.h"
#include "RimFormationNames.h"
CAF_PDM_SOURCE_INIT(RimFormationNamesCollection, "FormationNamesCollectionObject");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFormationNamesCollection::RimFormationNamesCollection()
{
CAF_PDM_InitObject("Formations", ":/FormationCollection16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_formationNamesList, "FormationNamesList", "Formations", "", "", "");
m_formationNamesList.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFormationNamesCollection::~RimFormationNamesCollection()
{
m_formationNamesList.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNamesCollection::readAllFormationNames()
{
for(RimFormationNames* fmNames: m_formationNamesList)
{
fmNames->readFormationNamesFile(nullptr);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNamesCollection::importFiles(const QStringList& fileNames)
{
QStringList newFileNames;
std::vector<RimFormationNames*> formNamesObjsToReload;
for(const QString& newFileName : fileNames)
{
bool isFound = false;
for(RimFormationNames* fmNames: m_formationNamesList)
{
if(fmNames->fileName() == newFileName)
{
formNamesObjsToReload.push_back(fmNames);
isFound = true;
break;
}
}
if(!isFound)
{
newFileNames.push_back(newFileName);
}
}
for(const QString& newFileName : newFileNames)
{
RimFormationNames* newFNs = new RimFormationNames;
newFNs->setFileName(newFileName);
m_formationNamesList.push_back(newFNs);
formNamesObjsToReload.push_back(newFNs);
}
for (RimFormationNames* fmNames: formNamesObjsToReload)
{
fmNames->readFormationNamesFile(nullptr);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFormationNamesCollection::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
{
for(RimFormationNames* fmNames: m_formationNamesList)
{
fmNames->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
}

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 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 "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
class RimFormationNames;
class RimFormationNamesCollection: public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFormationNamesCollection();
~RimFormationNamesCollection();
void readAllFormationNames();
void importFiles(const QStringList& fileNames);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
private:
caf::PdmChildArrayField<RimFormationNames*> m_formationNamesList;
};

View File

@@ -24,6 +24,7 @@
#include "RimWellPathCollection.h"
#include "RimGeoMechModels.h"
#include "RimSummaryCaseCollection.h"
#include "RimFormationNamesCollection.h"
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
//--------------------------------------------------------------------------------------------------
@@ -37,7 +38,8 @@ RimOilField::RimOilField(void)
CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
CAF_PDM_InitFieldNoDefault(&summaryCaseCollection,"SummaryCaseCollection","Summary Cases",":/GridModels.png","","");
CAF_PDM_InitFieldNoDefault(&formationNamesCollection,"FormationNamesCollection","Formations","","","");
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseCollection = new RimSummaryCaseCollection();
@@ -52,5 +54,6 @@ RimOilField::~RimOilField(void)
if (geoMechModels()) delete geoMechModels();
if (analysisModels()) delete analysisModels();
if (summaryCaseCollection()) delete summaryCaseCollection();
if (formationNamesCollection()) delete formationNamesCollection();
}

View File

@@ -29,6 +29,8 @@ class RimEclipseCaseCollection;
class RimGeoMechModels;
class RimWellPathCollection;
class RimSummaryCaseCollection;
class RimFormationNamesCollection;
//==================================================================================================
///
///
@@ -45,4 +47,6 @@ public:
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
caf::PdmChildField<RimSummaryCaseCollection*> summaryCaseCollection;
caf::PdmChildField<RimFormationNamesCollection*> formationNamesCollection;
};

View File

@@ -32,6 +32,7 @@
#include "RimContextCommandBuilder.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechModels.h"
#include "RimIdenticalGridCaseGroup.h"
@@ -393,6 +394,16 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
oilField->wellPathCollection->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
for(RimOilField* oilField: oilFields)
{
if(oilField == NULL) continue;
if(oilField->formationNamesCollection() != NULL)
{
oilField->formationNamesCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
}
wellPathImport->updateFilePaths();
}
@@ -773,6 +784,7 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
if (oilField->analysisModels()) uiTreeOrdering.add(oilField->analysisModels());
if (oilField->geoMechModels()) uiTreeOrdering.add(oilField->geoMechModels());
if (oilField->wellPathCollection()) uiTreeOrdering.add(oilField->wellPathCollection());
if (oilField->formationNamesCollection()) uiTreeOrdering.add(oilField->formationNamesCollection());
}
uiTreeOrdering.add(scriptCollection());

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

View File

@@ -61,6 +61,8 @@
<file>SummaryPlots16x16.png</file>
<file>SummaryCurve16x16.png</file>
<file>SummaryCurveFilter16x16.png</file>
<file>FormationCollection16x16.png</file>
<file>Formations16x16.png</file>
<file>Parallel16x16.png</file>
<file>Perspective16x16.png</file>

View File

@@ -406,6 +406,8 @@ void RiuMainWindow::createMenus()
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportFileFeature"));
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportSsihubFeature"));
importMenu->addAction(cmdFeatureMgr->action("RicWellLogsImportFileFeature"));
importMenu->addSeparator();
importMenu->addAction(cmdFeatureMgr->action("RicImportFormationNamesFeature"));
QMenu* exportMenu = fileMenu->addMenu("&Export");
exportMenu->addAction(m_snapshotToFile);