mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-05 21:53:27 -06:00
#2224 Well Formations: Make Reloading the csv file work
This commit is contained in:
parent
4bef3abda8
commit
8608e00b35
@ -30,6 +30,7 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicImportFormationNamesFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadWellPathFormationNamesFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSliceRangeFilterFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicHideIntersectionFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicHideIntersectionBoxFeature.h
|
||||
@ -107,6 +108,7 @@ ${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicImportFormationNamesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicReloadWellPathFormationNamesFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewSliceRangeFilterFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicHideIntersectionFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicHideIntersectionBoxFeature.cpp
|
||||
|
@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicReloadWellPathFormationNamesFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicReloadWellPathFormationNamesFeature, "RicReloadWellPathFormationNamesFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReloadWellPathFormationNamesFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
||||
|
||||
std::vector<RimWellPathCollection*> wellPathCollection;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPathCollection);
|
||||
|
||||
return (wellPaths.size() > 0 || wellPathCollection.size() > 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadWellPathFormationNamesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPaths);
|
||||
|
||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
||||
caf::SelectionManager::instance()->objectsByType(&wellPathCollections);
|
||||
|
||||
if (wellPaths.size() > 0)
|
||||
{
|
||||
RimWellPathCollection* wellPathCollection;
|
||||
wellPaths[0]->firstAncestorOrThisOfTypeAsserted(wellPathCollection);
|
||||
wellPathCollection->reloadAllWellPathFormations();
|
||||
}
|
||||
else if (wellPathCollections.size() > 0)
|
||||
{
|
||||
wellPathCollections[0]->reloadAllWellPathFormations();
|
||||
}
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
if (project)
|
||||
{
|
||||
if (project->mainPlotCollection())
|
||||
{
|
||||
project->mainPlotCollection->updatePlotsWithFormations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadWellPathFormationNamesFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Reload All Well Picks");
|
||||
actionToSetup->setIcon(QIcon(":/Refresh-32.png"));
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicReloadWellPathFormationNamesFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -36,6 +36,16 @@ cvf::ref<RigWellPathFormations> RifWellPathFormationsImporter::readWellPathForma
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigWellPathFormations> RifWellPathFormationsImporter::reloadWellPathFormations(const QString& formationFilePath, const QString& wellName)
|
||||
{
|
||||
m_fileNameToWellPathFormationMap.erase(formationFilePath);
|
||||
|
||||
return readWellPathFormations(formationFilePath, wellName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -55,6 +65,25 @@ std::map<QString, cvf::ref<RigWellPathFormations>> RifWellPathFormationsImporter
|
||||
return wellPathToFormationMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifWellPathFormationsImporter::reloadAllWellPathFormations()
|
||||
{
|
||||
std::vector<QString> allFilePaths;
|
||||
for (auto it = m_fileNameToWellPathFormationMap.begin(); it != m_fileNameToWellPathFormationMap.end(); it++)
|
||||
{
|
||||
allFilePaths.push_back(it->first);
|
||||
}
|
||||
|
||||
m_fileNameToWellPathFormationMap.clear();
|
||||
|
||||
for (const QString& filePath : allFilePaths)
|
||||
{
|
||||
readWellPathFormationsFromPath(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,9 +37,12 @@ class RifWellPathFormationsImporter
|
||||
{
|
||||
public:
|
||||
cvf::ref<RigWellPathFormations> readWellPathFormations(const QString& formationFilePath, const QString& wellName);
|
||||
cvf::ref<RigWellPathFormations> reloadWellPathFormations(const QString& formationFilePath, const QString& wellName);
|
||||
|
||||
std::map<QString, cvf::ref<RigWellPathFormations>> readWellPathFormationsFromPath(const QString& filePath);
|
||||
|
||||
void reloadAllWellPathFormations();
|
||||
|
||||
private:
|
||||
void readAllWellPathFormations(const QString& filePath);
|
||||
|
||||
|
@ -232,6 +232,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicWellPathsImportSsihubFeature";
|
||||
menuBuilder << "RicWellPathFormationsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "RicReloadWellPathFormationNamesFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||
@ -239,6 +240,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellPathFormationsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "RicReloadWellPathFormationNamesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
menuBuilder << "RicNewPltPlotFeature";
|
||||
|
@ -721,7 +721,28 @@ bool RimWellPath::readWellPathFormationsFile(QString* errorMessage, RifWellPathF
|
||||
}
|
||||
else
|
||||
{
|
||||
if (errorMessage) (*errorMessage) = "Could not find the well path formation file: " + m_wellPathFormationFilePath();
|
||||
if (errorMessage) (*errorMessage) = "Could not find the well pick file: " + m_wellPathFormationFilePath();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPath::reloadWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter)
|
||||
{
|
||||
if (m_wellPathFormationFilePath().isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (caf::Utils::fileExists(m_wellPathFormationFilePath()))
|
||||
{
|
||||
m_wellPathFormations = wellPathFormationsImporter->reloadWellPathFormations(m_wellPathFormationFilePath(), m_formationKeyInFile());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (errorMessage) (*errorMessage) = "Could not find the well pick file: " + m_wellPathFormationFilePath();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
|
||||
void setFormationsGeometry(cvf::ref<RigWellPathFormations> wellPathFormations);
|
||||
bool readWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
|
||||
bool reloadWellPathFormationsFile(QString* errorMessage, RifWellPathFormationsImporter* wellPathFormationsImporter);
|
||||
bool hasFormations() const;
|
||||
const RigWellPathFormations* formationsGeometry() const;
|
||||
|
||||
|
@ -508,7 +508,7 @@ RimWellPath* RimWellPathCollection::newestAddedWellPath()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::readWellPathFormationFiles()
|
||||
{
|
||||
caf::ProgressInfo progress(wellPaths.size(), "Reading well path formations from file");
|
||||
caf::ProgressInfo progress(wellPaths.size(), "Reading well picks from file");
|
||||
|
||||
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
||||
{
|
||||
@ -525,6 +525,28 @@ void RimWellPathCollection::readWellPathFormationFiles()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::reloadAllWellPathFormations()
|
||||
{
|
||||
caf::ProgressInfo progress(wellPaths.size(), "Reloading well picks from file");
|
||||
|
||||
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
||||
{
|
||||
QString errorMessage;
|
||||
if (!wellPaths[wpIdx]->reloadWellPathFormationsFile(&errorMessage, m_wellPathFormationsImporter))
|
||||
{
|
||||
QMessageBox::warning(RiuMainWindow::instance(),
|
||||
"File open error",
|
||||
errorMessage);
|
||||
}
|
||||
|
||||
progress.setProgressDescription(QString("Reloading formation file %1").arg(wpIdx));
|
||||
progress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
RimWellPath* newestAddedWellPath();
|
||||
|
||||
void readWellPathFormationFiles();
|
||||
void reloadAllWellPathFormations();
|
||||
|
||||
RimWellPath* wellPathByName(const QString& wellPathName) const;
|
||||
RimWellPath* tryFindMatchingWellPath(const QString& wellName) const;
|
||||
|
Loading…
Reference in New Issue
Block a user