mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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:
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
109
ApplicationCode/ProjectDataModel/RimFormationNames.cpp
Normal file
109
ApplicationCode/ProjectDataModel/RimFormationNames.cpp
Normal 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);
|
||||
}
|
||||
|
||||
55
ApplicationCode/ProjectDataModel/RimFormationNames.h
Normal file
55
ApplicationCode/ProjectDataModel/RimFormationNames.h
Normal 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
|
||||
{
|
||||
|
||||
};
|
||||
105
ApplicationCode/ProjectDataModel/RimFormationNamesCollection.cpp
Normal file
105
ApplicationCode/ProjectDataModel/RimFormationNamesCollection.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user