mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'fishbones' into pre-proto
This commit is contained in:
@@ -20,13 +20,12 @@
|
||||
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "RifJsonEncodeDecode.h"
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
@@ -34,11 +33,15 @@
|
||||
#include "RimWellPathFracture.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "RimWellPathCompletions.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RivWellPathPartMgr.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
@@ -101,7 +104,11 @@ 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_completions, "Completions", "Completions", "", "", "");
|
||||
m_completions = new RimWellPathCompletions;
|
||||
m_completions.uiCapability()->setUiTreeHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogFile, "WellLogFile", "Well Log File", "", "", "");
|
||||
m_wellLogFile.uiCapability()->setUiHidden(true);
|
||||
|
||||
@@ -162,6 +169,26 @@ void RimWellPath::setSurveyType(QString surveyType)
|
||||
wellPathColor = cvf::Color3f(0.0f, 0.333f, 0.999f);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFishbonesCollection* RimWellPath::fishbonesCollection()
|
||||
{
|
||||
CVF_ASSERT(m_completions);
|
||||
|
||||
return m_completions->fishbonesCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPerforationCollection* RimWellPath::perforationIntervalCollection()
|
||||
{
|
||||
CVF_ASSERT(m_completions);
|
||||
|
||||
return m_completions->perforationCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -216,27 +243,28 @@ caf::PdmFieldHandle* RimWellPath::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read JSON or ascii file containing well path data
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathAsciiFileReader* asciiReader)
|
||||
bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* wellPathImporter)
|
||||
{
|
||||
QFileInfo fileInf(filepath());
|
||||
|
||||
if (fileInf.isFile() && fileInf.exists())
|
||||
if (caf::Utils::fileExists(filepath()))
|
||||
{
|
||||
if (fileInf.suffix().compare("json") == 0)
|
||||
{
|
||||
this->readJsonWellPathFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->readAsciiWellPathFile(asciiReader);
|
||||
}
|
||||
RifWellPathImporter::WellData wellData = wellPathImporter->readWellData(filepath(), wellPathIndexInFile());
|
||||
RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(filepath(), wellPathIndexInFile());
|
||||
// General well info
|
||||
|
||||
name = wellData.m_name;
|
||||
id = wellMetaData.m_id;
|
||||
sourceSystem = wellMetaData.m_sourceSystem;
|
||||
utmZone = wellMetaData.m_utmZone;
|
||||
updateUser = wellMetaData.m_updateUser;
|
||||
setSurveyType(wellMetaData.m_surveyType);
|
||||
updateDate = wellMetaData.m_updateDate.toString("d MMMM yyyy");
|
||||
|
||||
m_wellPath = wellData.m_wellPathGeometry;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (errorMessage) (*errorMessage) = "Could not find the well path file: " + filepath();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -249,69 +277,6 @@ void RimWellPath::setWellPathGeometry(RigWellPath* wellPathModel)
|
||||
m_wellPath = wellPathModel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read JSON file containing well path data
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::readJsonWellPathFile()
|
||||
{
|
||||
RigWellPath* wellPathGeom = new RigWellPath();
|
||||
ResInsightInternalJson::JsonReader jsonReader;
|
||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(filepath);
|
||||
|
||||
// General well info
|
||||
|
||||
name = jsonMap["name"].toString();
|
||||
id = jsonMap["id"].toString();
|
||||
sourceSystem = jsonMap["sourceSystem"].toString();
|
||||
utmZone = jsonMap["utmZone"].toString();
|
||||
updateUser = jsonMap["updateUser"].toString();
|
||||
|
||||
setSurveyType(jsonMap["surveyType"].toString());
|
||||
|
||||
// Convert updateDate from the following format:
|
||||
// "Number of milliseconds elapsed since midnight Coordinated Universal Time (UTC)
|
||||
// of January 1, 1970, not counting leap seconds"
|
||||
|
||||
QString updateDateStr = jsonMap["updateDate"].toString().trimmed();
|
||||
uint updateDateUint = updateDateStr.toULongLong() / 1000; // should be within 32 bit, maximum number is 4294967295 which corresponds to year 2106
|
||||
QDateTime updateDateTime;
|
||||
updateDateTime.setTime_t(updateDateUint);
|
||||
|
||||
updateDate = updateDateTime.toString("d MMMM yyyy");
|
||||
|
||||
// Well path points
|
||||
|
||||
double datumElevation = jsonMap["datumElevation"].toDouble();
|
||||
wellPathGeom->setDatumElevation(datumElevation);
|
||||
|
||||
QList<QVariant> pathList = jsonMap["path"].toList();
|
||||
foreach (QVariant point, pathList)
|
||||
{
|
||||
QMap<QString, QVariant> coordinateMap = point.toMap();
|
||||
cvf::Vec3d vec3d(coordinateMap["east"].toDouble(), coordinateMap["north"].toDouble(), -(coordinateMap["tvd"].toDouble() - datumElevation));
|
||||
wellPathGeom->m_wellPathPoints.push_back(vec3d);
|
||||
|
||||
double measuredDepth = coordinateMap["md"].toDouble();
|
||||
wellPathGeom->m_measuredDepths.push_back(measuredDepth);
|
||||
}
|
||||
|
||||
//jsonReader.dumpToFile(wellPathGeom->m_wellPathPoints, "c:\\temp\\jsonpoints.txt");
|
||||
setWellPathGeometry(wellPathGeom);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::readAsciiWellPathFile(RifWellPathAsciiFileReader* asciiReader)
|
||||
{
|
||||
CVF_ASSERT(asciiReader);
|
||||
|
||||
RifWellPathAsciiFileReader::WellData wpData = asciiReader->readWellData(filepath(), wellPathIndexInFile());
|
||||
this->name = wpData.m_name;
|
||||
|
||||
setWellPathGeometry(wpData.m_wellPathGeometry.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -346,6 +311,22 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||
{
|
||||
uiTreeOrdering.add(&m_wellLogFile);
|
||||
uiTreeOrdering.add(&m_completions);
|
||||
|
||||
// TODO : Move to subobject Completions->Fractures
|
||||
for (RimWellPathFracture* fracture : fractureCollection()->fractures())
|
||||
{
|
||||
uiTreeOrdering.add(fracture);
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -410,18 +391,6 @@ void RimWellPath::setupBeforeSave()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
for (RimWellPathFracture* fracture : fractureCollection()->fractures())
|
||||
{
|
||||
uiTreeOrdering.add(fracture);
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -440,7 +409,7 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath,
|
||||
{
|
||||
QString newCacheFileName = getCacheFileName();
|
||||
|
||||
if (QFile::exists(newCacheFileName))
|
||||
if (caf::Utils::fileExists(newCacheFileName))
|
||||
{
|
||||
filepath = newCacheFileName;
|
||||
}
|
||||
@@ -451,6 +420,17 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath,
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimWellPath::combinedScaleFactor() const
|
||||
{
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(wellPathColl);
|
||||
|
||||
return this->wellPathRadiusScaleFactor() * wellPathColl->wellPathRadiusScaleFactor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user