mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#435) WIP - Reading metadata from LAS files
This commit is contained in:
parent
671506f7cc
commit
095d974e38
@ -465,6 +465,29 @@ void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
|
||||
oilField->wellPathCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Add a list of well log file paths (LAS files) to the well path collection
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths)
|
||||
{
|
||||
if (m_project == NULL || m_project->oilFields.size() < 1) return;
|
||||
|
||||
RimOilField* oilField = m_project->activeOilField();
|
||||
if (oilField == NULL) return;
|
||||
|
||||
if (oilField->wellPathCollection == NULL)
|
||||
{
|
||||
oilField->wellPathCollection = new RimWellPathCollection();
|
||||
oilField->wellPathCollection->setProject(m_project);
|
||||
|
||||
m_project->updateConnectedEditors();
|
||||
}
|
||||
|
||||
if (oilField->wellPathCollection) oilField->wellPathCollection->addWellLogs(wellLogFilePaths);
|
||||
|
||||
oilField->wellPathCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
bool saveProjectPromptForFileName();
|
||||
bool closeProject(bool askToSaveIfDirty);
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
|
||||
void copySnapshotToClipboard();
|
||||
void saveSnapshotPromtpForFilename();
|
||||
|
@ -55,6 +55,7 @@ ${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeatureUi.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h
|
||||
|
||||
# General delete of any object in a child array field
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
|
||||
@ -112,6 +113,8 @@ ${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeatureUi.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.cpp
|
||||
|
||||
# General delete of any object in a child array field
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
|
||||
|
69
ApplicationCode/Commands/RicWellLogsImportFileFeature.cpp
Normal file
69
ApplicationCode/Commands/RicWellLogsImportFileFeature.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicWellLogsImportFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimProject.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
CAF_CMD_SOURCE_INIT(RicWellLogsImportFileFeature, "RicWellLogsImportFileFeature");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellLogsImportFileFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellLogsImportFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
// Open dialog box to select well path files
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString defaultDir = app->defaultFileDialogDirectory("WELL_LOGS_DIR");
|
||||
QStringList wellLogFilePaths = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Logs", defaultDir, "Well Logs (*.las);;All Files (*.*)");
|
||||
|
||||
if (wellLogFilePaths.size() < 1) return;
|
||||
|
||||
// Remember the path to next time
|
||||
app->setDefaultFileDialogDirectory("WELL_LOGS_DIR", QFileInfo(wellLogFilePaths.last()).absolutePath());
|
||||
|
||||
app->addWellLogsToModel(wellLogFilePaths);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellLogsImportFileFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Import Well &Logs from File");
|
||||
actionToSetup->setIcon(QIcon(":/Well.png"));
|
||||
}
|
||||
|
||||
} // end namespace caf
|
43
ApplicationCode/Commands/RicWellLogsImportFileFeature.h
Normal file
43
ApplicationCode/Commands/RicWellLogsImportFileFeature.h
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellLogsImportFileFeature : public CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // end namespace caf
|
@ -68,6 +68,8 @@ ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimViewLinker.h
|
||||
${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLasFileInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLasLog.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -134,6 +136,8 @@ ${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimViewLinker.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLasFileInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellLasLog.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -776,6 +776,7 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
commandIds << "RicWellPathsDeleteAllFeature";
|
||||
commandIds << "RicWellPathsImportFileFeature";
|
||||
commandIds << "RicWellPathsImportSsihubFeature";
|
||||
commandIds << "RicWellLogsImportFileFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||
{
|
||||
|
136
ApplicationCode/ProjectDataModel/RimWellLasFileInfo.cpp
Normal file
136
ApplicationCode/ProjectDataModel/RimWellLasFileInfo.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimWellLasFileInfo.h"
|
||||
#include "RimWellLasLog.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "well.hpp"
|
||||
|
||||
#include <QString>
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellLasFileInfo, "WellLasFileInfo");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLasFileInfo::RimWellLasFileInfo()
|
||||
{
|
||||
CAF_PDM_InitObject("Well LAS File Info", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellName, "WellName", "", "", "", "");
|
||||
m_wellName.uiCapability()->setUiReadOnly(true);
|
||||
m_wellName.uiCapability()->setUiHidden(true);
|
||||
m_wellName.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_fileName, "FileName", "Filename", "", "", "");
|
||||
m_fileName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_name, "Name", "", "", "", "");
|
||||
m_name.uiCapability()->setUiReadOnly(true);
|
||||
m_name.uiCapability()->setUiHidden(true);
|
||||
m_name.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_lasFileLogs, "WellLASFileLogs", "", "", "", "");
|
||||
m_lasFileLogs.uiCapability()->setUiHidden(true);
|
||||
m_lasFileLogs.xmlCapability()->setIOWritable(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLasFileInfo::~RimWellLasFileInfo()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLasFileInfo::setFileName(const QString& fileName)
|
||||
{
|
||||
m_fileName = fileName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLasFileInfo::readFile()
|
||||
{
|
||||
close();
|
||||
|
||||
int wellFormat = NRLib::Well::LAS;
|
||||
NRLib::Well* well = NRLib::Well::ReadWell(m_fileName().toStdString(), wellFormat);
|
||||
if (!well)
|
||||
{
|
||||
// TODO: Error handling
|
||||
return false;
|
||||
}
|
||||
|
||||
m_wellName = QString::fromStdString(well->GetWellName());
|
||||
m_name = QFileInfo(m_fileName).fileName();
|
||||
|
||||
const std::map<std::string, std::vector<double> >& contLogs = well->GetContLog();
|
||||
|
||||
std::vector<std::string> contLogNames;
|
||||
std::map<std::string, std::vector<double> >::const_iterator itCL;
|
||||
for (itCL = contLogs.begin(); itCL != contLogs.end(); itCL++)
|
||||
{
|
||||
RimWellLasLog* contLog = new RimWellLasLog();
|
||||
contLog->setName(QString::fromStdString(itCL->first));
|
||||
m_lasFileLogs.push_back(contLog);
|
||||
}
|
||||
|
||||
// TODO: Do the same for discrete logs
|
||||
|
||||
RimWellPath* wellPath;
|
||||
firstAnchestorOrThisOfType(wellPath);
|
||||
|
||||
if (wellPath)
|
||||
{
|
||||
if (wellPath->filepath().isEmpty())
|
||||
{
|
||||
wellPath->name = m_wellName;
|
||||
}
|
||||
}
|
||||
|
||||
delete well;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLasFileInfo::close()
|
||||
{
|
||||
m_lasFileLogs.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLasFileInfo::wellName() const
|
||||
{
|
||||
return m_wellName;
|
||||
}
|
58
ApplicationCode/ProjectDataModel/RimWellLasFileInfo.h
Normal file
58
ApplicationCode/ProjectDataModel/RimWellLasFileInfo.h
Normal file
@ -0,0 +1,58 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
|
||||
class RimWellLasLog;
|
||||
class QString;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLasFileInfo : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellLasFileInfo();
|
||||
virtual ~RimWellLasFileInfo();
|
||||
|
||||
void setFileName(const QString& fileName);
|
||||
bool readFile();
|
||||
void close();
|
||||
|
||||
QString wellName() const;
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_name; }
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimWellLasLog*> m_lasFileLogs;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<QString> m_fileName;
|
||||
caf::PdmField<QString> m_name;
|
||||
};
|
45
ApplicationCode/ProjectDataModel/RimWellLasLog.cpp
Normal file
45
ApplicationCode/ProjectDataModel/RimWellLasLog.cpp
Normal 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellLasLog.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellLasLog, "WellLasLog");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLasLog::RimWellLasLog()
|
||||
{
|
||||
CAF_PDM_InitObject("Well LAS File Log", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_name, "Name", "", "", "", "");
|
||||
m_name.uiCapability()->setUiHidden(true);
|
||||
m_name.xmlCapability()->setIOWritable(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLasLog::setName(const QString& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
45
ApplicationCode/ProjectDataModel/RimWellLasLog.h
Normal file
45
ApplicationCode/ProjectDataModel/RimWellLasLog.h
Normal 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 "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellLasLog : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellLasLog();
|
||||
|
||||
void setName(const QString& name);
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_name; }
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
};
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLasFileInfo.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RivWellPathPartMgr.h"
|
||||
|
||||
@ -81,6 +82,9 @@ RimWellPath::RimWellPath()
|
||||
CAF_PDM_InitField(&wellPathRadiusScaleFactor, "WellPathRadiusScale", 1.0, "Well path radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPathColor, "WellPathColor", cvf::Color3f(0.999f, 0.333f, 0.999f), "Well path color", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_lasFileInfo, "LasFileInfo", "Las File Info", "", "", "");
|
||||
m_lasFileInfo.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_wellPath = NULL;
|
||||
m_project = NULL;
|
||||
}
|
||||
@ -91,6 +95,10 @@ RimWellPath::RimWellPath()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath::~RimWellPath()
|
||||
{
|
||||
if (m_lasFileInfo)
|
||||
{
|
||||
delete m_lasFileInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -164,6 +172,29 @@ void RimWellPath::readWellPathFile()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLasFileInfo* RimWellPath::readWellLogFile(const QString& logFilePath)
|
||||
{
|
||||
QFileInfo fi(logFilePath);
|
||||
|
||||
RimWellLasFileInfo* lasFileInfo = NULL;
|
||||
|
||||
if (fi.suffix().compare("las") == 0)
|
||||
{
|
||||
lasFileInfo = new RimWellLasFileInfo();
|
||||
lasFileInfo->setFileName(logFilePath);
|
||||
if (!lasFileInfo->readFile())
|
||||
{
|
||||
delete lasFileInfo;
|
||||
lasFileInfo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return lasFileInfo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read JSON file containing well path data
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -245,7 +276,6 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
ssihubGroup->add(&updateDate);
|
||||
ssihubGroup->add(&updateUser);
|
||||
ssihubGroup->add(&m_surveyType);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -323,3 +353,18 @@ void RimWellPath::updateFilePathsFromProjectPath()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::setLogFileInfo(RimWellLasFileInfo* logFileInfo)
|
||||
{
|
||||
if (m_lasFileInfo)
|
||||
{
|
||||
delete m_lasFileInfo;
|
||||
}
|
||||
|
||||
m_lasFileInfo = logFileInfo;
|
||||
m_lasFileInfo->uiCapability()->setUiHidden(true);
|
||||
|
||||
this->name = m_lasFileInfo->wellName();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
@ -33,6 +34,7 @@
|
||||
class RimProject;
|
||||
class RivWellPathPartMgr;
|
||||
class RimWellPathCollection;
|
||||
class RimWellLasFileInfo;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -48,6 +50,7 @@ public:
|
||||
|
||||
void setProject(RimProject* project) { m_project = project; }
|
||||
void setCollection(RimWellPathCollection* collection) { m_wellPathCollection = collection; }
|
||||
void setLogFileInfo(RimWellLasFileInfo* logFileInfo);
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
@ -65,10 +68,13 @@ public:
|
||||
caf::PdmField<cvf::Color3f> wellPathColor;
|
||||
caf::PdmField<double> wellPathRadiusScaleFactor;
|
||||
|
||||
caf::PdmChildField<RimWellLasFileInfo*> m_lasFileInfo;
|
||||
|
||||
RigWellPath* wellPathGeometry() { return m_wellPath.p(); }
|
||||
RivWellPathPartMgr* partMgr();
|
||||
|
||||
void readWellPathFile();
|
||||
static RimWellLasFileInfo* readWellLogFile(const QString& logFilePath);
|
||||
void updateFilePathsFromProjectPath();
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "RiaPreferences.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellLasFileInfo.h"
|
||||
#include "RivWellPathCollectionPartMgr.h"
|
||||
|
||||
#include "cafPdmUiEditorHandle.h"
|
||||
@ -81,7 +82,6 @@ RimWellPathCollection::RimWellPathCollection()
|
||||
m_project = NULL;
|
||||
|
||||
m_asciiFileReader = new RimWellPathAsciiFileReader;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -126,8 +126,16 @@ void RimWellPathCollection::readWellPathFiles()
|
||||
caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");
|
||||
|
||||
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
||||
{
|
||||
if (!wellPaths[wpIdx]->filepath().isEmpty())
|
||||
{
|
||||
wellPaths[wpIdx]->readWellPathFile();
|
||||
}
|
||||
|
||||
if (wellPaths[wpIdx]->m_lasFileInfo)
|
||||
{
|
||||
wellPaths[wpIdx]->m_lasFileInfo->readFile();
|
||||
}
|
||||
|
||||
progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name));
|
||||
progress.incrementProgress();
|
||||
@ -192,6 +200,26 @@ void RimWellPathCollection::addWellPaths( QStringList filePaths )
|
||||
readWellPathFiles();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::addWellLogs(const QStringList& filePaths)
|
||||
{
|
||||
foreach (QString filePath, filePaths)
|
||||
{
|
||||
RimWellLasFileInfo* logFileInfo = RimWellPath::readWellLogFile(filePath);
|
||||
if (logFileInfo)
|
||||
{
|
||||
// TODO: Check for existing well paths and add log to correct well path if existing
|
||||
|
||||
RimWellPath* wellPath = new RimWellPath();
|
||||
wellPath->setCollection(this);
|
||||
wellPaths.push_back(wellPath);
|
||||
wellPath->setLogFileInfo(logFileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -82,6 +82,8 @@ public:
|
||||
void addWellPaths(QStringList filePaths);
|
||||
RimWellPathAsciiFileReader* asciiFileReader() {return m_asciiFileReader;}
|
||||
|
||||
void addWellLogs(const QStringList& filePaths);
|
||||
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
|
||||
void scheduleGeometryRegenAndRedrawViews();
|
||||
@ -98,6 +100,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellPathAsciiFileReader
|
||||
{
|
||||
public:
|
||||
|
@ -423,6 +423,7 @@ void RiuMainWindow::createMenus()
|
||||
#endif
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportFileFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellPathsImportSsihubFeature"));
|
||||
importMenu->addAction(cmdFeatureMgr->action("RicWellLogsImportFileFeature"));
|
||||
|
||||
QMenu* exportMenu = fileMenu->addMenu("&Export");
|
||||
exportMenu->addAction(m_snapshotToFile);
|
||||
|
@ -113,6 +113,7 @@ set_property(TARGET
|
||||
################################################################################
|
||||
|
||||
add_subdirectory(ThirdParty/NRLib)
|
||||
include_directories(ThirdParty/NRLib/nrlib/well)
|
||||
|
||||
|
||||
################################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user