Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
//
|
|
|
|
|
// 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 "RimWellPathCollection.h"
|
|
|
|
|
|
2013-10-01 04:44:10 -05:00
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
#include "RiaPreferences.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
|
#include "RimProject.h"
|
|
|
|
|
#include "RimWellPath.h"
|
2015-09-16 09:06:06 -05:00
|
|
|
|
#include "RimWellLogFile.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
|
#include "RivWellPathCollectionPartMgr.h"
|
|
|
|
|
|
2015-09-24 02:37:26 -05:00
|
|
|
|
#include "RiuMainWindow.h"
|
|
|
|
|
|
2015-08-12 13:59:38 -05:00
|
|
|
|
#include "cafPdmUiEditorHandle.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
|
#include <QFileInfo>
|
2015-09-24 02:37:26 -05:00
|
|
|
|
#include <QMessageBox>
|
2014-07-24 03:11:43 -05:00
|
|
|
|
|
|
|
|
|
#include <fstream>
|
2014-07-24 04:01:02 -05:00
|
|
|
|
#include <cmath>
|
2013-10-01 04:44:10 -05:00
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
namespace caf
|
|
|
|
|
{
|
|
|
|
|
template<>
|
|
|
|
|
void RimWellPathCollection::WellVisibilityEnum::setUp()
|
|
|
|
|
{
|
|
|
|
|
addItem(RimWellPathCollection::FORCE_ALL_OFF, "FORCE_ALL_OFF", "Off");
|
|
|
|
|
addItem(RimWellPathCollection::ALL_ON, "ALL_ON", "Individual");
|
|
|
|
|
addItem(RimWellPathCollection::FORCE_ALL_ON, "FORCE_ALL_ON", "On");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimWellPathCollection, "WellPaths");
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimWellPathCollection::RimWellPathCollection()
|
|
|
|
|
{
|
|
|
|
|
CAF_PDM_InitObject("Wells", ":/WellCollection.png", "", "");
|
|
|
|
|
|
2013-10-22 08:30:12 -05:00
|
|
|
|
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
|
isActive.uiCapability()->setUiHidden(true);
|
2013-10-22 08:30:12 -05:00
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
CAF_PDM_InitField(&showWellPathLabel, "ShowWellPathLabel", true, "Show well path labels", "", "", "");
|
|
|
|
|
|
2013-10-01 04:44:10 -05:00
|
|
|
|
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
|
|
|
|
|
CAF_PDM_InitField(&wellPathLabelColor, "WellPathLabelColor", defWellLabelColor, "Well label color", "", "", "");
|
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
CAF_PDM_InitField(&wellPathVisibility, "GlobalWellPathVisibility", WellVisibilityEnum(ALL_ON), "Global well path visibility", "", "", "");
|
|
|
|
|
|
2013-06-06 09:36:37 -05:00
|
|
|
|
CAF_PDM_InitField(&wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.1, "Well Path radius scale", "", "", "");
|
2013-06-06 08:07:31 -05:00
|
|
|
|
CAF_PDM_InitField(&wellPathCrossSectionVertexCount, "WellPathVertexCount", 12, "Well Path vertex count", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
|
wellPathCrossSectionVertexCount.xmlCapability()->setIOWritable(false);
|
|
|
|
|
wellPathCrossSectionVertexCount.xmlCapability()->setIOReadable(false);
|
|
|
|
|
wellPathCrossSectionVertexCount.uiCapability()->setUiHidden(true);
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
CAF_PDM_InitField(&wellPathClip, "WellPathClip", true, "Clip Well Paths", "", "", "");
|
2013-06-06 09:36:37 -05:00
|
|
|
|
CAF_PDM_InitField(&wellPathClipZDistance, "WellPathClipZDistance", 100, "Well path clipping depth distance", "", "", "");
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&wellPaths, "WellPaths", "Well Paths", "", "", "");
|
2015-08-11 08:22:49 -05:00
|
|
|
|
wellPaths.uiCapability()->setUiHidden(true);
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
|
|
|
|
|
m_wellPathCollectionPartManager = new RivWellPathCollectionPartMgr(this);
|
2013-06-24 15:04:52 -05:00
|
|
|
|
|
2015-10-29 07:12:55 -05:00
|
|
|
|
m_asciiFileReader = new RifWellPathAsciiFileReader;
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimWellPathCollection::~RimWellPathCollection()
|
|
|
|
|
{
|
|
|
|
|
wellPaths.deleteAllChildObjects();
|
2013-06-24 15:04:52 -05:00
|
|
|
|
delete m_asciiFileReader;
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
|
{
|
2013-10-23 01:07:11 -05:00
|
|
|
|
scheduleGeometryRegenAndRedrawViews();
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// Read JSON files containing well path data
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::readWellPathFiles()
|
|
|
|
|
{
|
2013-10-01 04:32:37 -05:00
|
|
|
|
caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");
|
2013-09-26 07:49:28 -05:00
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
|
|
|
|
{
|
2015-09-14 09:33:28 -05:00
|
|
|
|
if (!wellPaths[wpIdx]->filepath().isEmpty())
|
|
|
|
|
{
|
2015-10-12 05:40:10 -05:00
|
|
|
|
QString errorMessage;
|
2015-12-01 05:27:19 -06:00
|
|
|
|
if (!wellPaths[wpIdx]->readWellPathFile(&errorMessage, this->asciiFileReader()))
|
2015-10-12 05:40:10 -05:00
|
|
|
|
{
|
|
|
|
|
QMessageBox::warning(RiuMainWindow::instance(),
|
|
|
|
|
"File open error",
|
|
|
|
|
errorMessage);
|
|
|
|
|
}
|
2015-09-14 09:33:28 -05:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-24 02:37:26 -05:00
|
|
|
|
RimWellLogFile* wellLogFile = wellPaths[wpIdx]->m_wellLogFile;
|
|
|
|
|
if (wellLogFile)
|
2015-09-14 09:33:28 -05:00
|
|
|
|
{
|
2015-09-24 03:08:45 -05:00
|
|
|
|
QString errorMessage;
|
|
|
|
|
if (!wellLogFile->readFile(&errorMessage))
|
2015-09-24 02:37:26 -05:00
|
|
|
|
{
|
2015-09-24 03:08:45 -05:00
|
|
|
|
QString displayMessage = "Could not open the well log file: \n" + wellLogFile->fileName();
|
|
|
|
|
|
|
|
|
|
if (!errorMessage.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
displayMessage += "\n\n";
|
|
|
|
|
displayMessage += errorMessage;
|
|
|
|
|
}
|
2015-09-24 02:37:26 -05:00
|
|
|
|
|
|
|
|
|
QMessageBox::warning(RiuMainWindow::instance(),
|
|
|
|
|
"File open error",
|
2015-09-24 03:08:45 -05:00
|
|
|
|
displayMessage);
|
2015-09-24 02:37:26 -05:00
|
|
|
|
}
|
2015-09-14 09:33:28 -05:00
|
|
|
|
}
|
2013-09-26 07:49:28 -05:00
|
|
|
|
|
|
|
|
|
progress.setProgressDescription(QString("Reading file %1").arg(wellPaths[wpIdx]->name));
|
|
|
|
|
progress.incrementProgress();
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
2015-11-30 07:32:34 -06:00
|
|
|
|
|
|
|
|
|
this->sortWellsByName();
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::addWellPaths( QStringList filePaths )
|
|
|
|
|
{
|
2015-09-15 04:49:09 -05:00
|
|
|
|
std::vector<RimWellPath*> wellPathArray;
|
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
foreach (QString filePath, filePaths)
|
|
|
|
|
{
|
|
|
|
|
// Check if this file is already open
|
|
|
|
|
bool alreadyOpen = false;
|
|
|
|
|
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
|
|
|
|
{
|
|
|
|
|
QFile f1;
|
|
|
|
|
f1.setFileName(filePath);
|
|
|
|
|
QString s1 = f1.fileName();
|
|
|
|
|
QFile f2;
|
|
|
|
|
f2.setFileName(wellPaths[wpIdx]->filepath());
|
|
|
|
|
QString s2 = f2.fileName();
|
|
|
|
|
if (s1 == s2)
|
|
|
|
|
{
|
2013-06-12 03:52:46 -05:00
|
|
|
|
//printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*) filePath.toLocal8Bit());
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
alreadyOpen = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!alreadyOpen)
|
|
|
|
|
{
|
2013-06-26 05:01:53 -05:00
|
|
|
|
QFileInfo fi(filePath);
|
|
|
|
|
|
|
|
|
|
if (fi.suffix().compare("json") == 0)
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
RimWellPath* wellPath = new RimWellPath();
|
|
|
|
|
wellPath->filepath = filePath;
|
2015-09-15 04:49:09 -05:00
|
|
|
|
wellPathArray.push_back(wellPath);
|
2013-06-24 15:04:52 -05:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Create Well path objects for all the paths in the assumed ascii file
|
|
|
|
|
size_t wellPathCount = this->m_asciiFileReader->wellDataCount(filePath);
|
|
|
|
|
for (size_t i = 0; i < wellPathCount; ++i)
|
|
|
|
|
{
|
|
|
|
|
RimWellPath* wellPath = new RimWellPath();
|
|
|
|
|
wellPath->filepath = filePath;
|
|
|
|
|
wellPath->wellPathIndexInFile = static_cast<int>(i);
|
2015-09-15 04:49:09 -05:00
|
|
|
|
wellPathArray.push_back(wellPath);
|
2013-06-24 15:04:52 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-15 04:49:09 -05:00
|
|
|
|
readAndAddWellPaths(wellPathArray);
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
p4#: 21651
2013-05-16 05:59:35 -05:00
|
|
|
|
}
|
2013-06-24 15:04:52 -05:00
|
|
|
|
|
2015-09-15 04:49:09 -05:00
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray)
|
|
|
|
|
{
|
|
|
|
|
caf::ProgressInfo progress(wellPathArray.size(), "Reading well paths from file");
|
|
|
|
|
|
|
|
|
|
for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++)
|
|
|
|
|
{
|
|
|
|
|
RimWellPath* wellPath = wellPathArray[wpIdx];
|
2015-12-01 05:27:19 -06:00
|
|
|
|
wellPath->readWellPathFile(NULL, this->asciiFileReader());
|
2015-09-15 04:49:09 -05:00
|
|
|
|
|
|
|
|
|
progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name));
|
|
|
|
|
|
|
|
|
|
// If a well path with this name exists already, make it read the well path file
|
|
|
|
|
RimWellPath* existingWellPath = wellPathByName(wellPath->name);
|
|
|
|
|
if (existingWellPath)
|
|
|
|
|
{
|
|
|
|
|
existingWellPath->filepath = wellPath->filepath;
|
|
|
|
|
existingWellPath->wellPathIndexInFile = wellPath->wellPathIndexInFile;
|
2015-12-01 05:27:19 -06:00
|
|
|
|
existingWellPath->readWellPathFile(NULL, this->asciiFileReader());
|
2015-09-15 04:49:09 -05:00
|
|
|
|
|
|
|
|
|
delete wellPath;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wellPaths.push_back(wellPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
progress.incrementProgress();
|
|
|
|
|
}
|
2015-11-30 07:32:34 -06:00
|
|
|
|
|
|
|
|
|
this->sortWellsByName();
|
2015-09-15 04:49:09 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-09-14 09:33:28 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::addWellLogs(const QStringList& filePaths)
|
|
|
|
|
{
|
|
|
|
|
foreach (QString filePath, filePaths)
|
|
|
|
|
{
|
2015-09-25 11:14:25 -05:00
|
|
|
|
RimWellLogFile* logFileInfo = RimWellLogFile::readWellLogFile(filePath);
|
2015-09-14 09:33:28 -05:00
|
|
|
|
if (logFileInfo)
|
|
|
|
|
{
|
2015-09-14 10:05:28 -05:00
|
|
|
|
RimWellPath* wellPath = wellPathByName(logFileInfo->wellName());
|
|
|
|
|
if (!wellPath)
|
|
|
|
|
{
|
2015-09-15 04:01:19 -05:00
|
|
|
|
wellPath = new RimWellPath();
|
2015-09-14 10:05:28 -05:00
|
|
|
|
wellPaths.push_back(wellPath);
|
|
|
|
|
}
|
2015-09-14 09:33:28 -05:00
|
|
|
|
|
|
|
|
|
wellPath->setLogFileInfo(logFileInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-11-30 07:32:34 -06:00
|
|
|
|
|
|
|
|
|
this->sortWellsByName();
|
2015-09-14 09:33:28 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-17 06:37:59 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
|
{
|
|
|
|
|
caf::PdmUiGroup* wellHeadGroup = uiOrdering.addNewGroup("Well labels");
|
|
|
|
|
wellHeadGroup->add(&showWellPathLabel);
|
|
|
|
|
wellHeadGroup->add(&wellPathLabelColor);
|
|
|
|
|
|
|
|
|
|
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
|
|
|
|
|
wellPipe->add(&wellPathVisibility);
|
|
|
|
|
wellPipe->add(&wellPathRadiusScaleFactor);
|
|
|
|
|
|
|
|
|
|
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Clipping");
|
|
|
|
|
advancedGroup->add(&wellPathClip);
|
|
|
|
|
advancedGroup->add(&wellPathClipZDistance);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-22 08:30:12 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
caf::PdmFieldHandle* RimWellPathCollection::objectToggleField()
|
|
|
|
|
{
|
|
|
|
|
return &isActive;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 01:07:11 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::scheduleGeometryRegenAndRedrawViews()
|
|
|
|
|
{
|
|
|
|
|
m_wellPathCollectionPartManager->scheduleGeometryRegen();
|
2015-12-01 05:27:19 -06:00
|
|
|
|
RimProject* proj;
|
2016-09-21 06:59:41 -05:00
|
|
|
|
this->firstAncestorOrThisOfType(proj);
|
2015-12-01 05:27:19 -06:00
|
|
|
|
if (proj) proj->createDisplayModelAndRedrawAllViews();
|
2013-10-23 01:07:11 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 02:50:16 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-06-29 09:09:27 -05:00
|
|
|
|
void RimWellPathCollection::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
2013-10-24 02:50:16 -05:00
|
|
|
|
{
|
|
|
|
|
for (size_t wellPathIdx = 0; wellPathIdx < wellPaths.size(); wellPathIdx++)
|
|
|
|
|
{
|
2016-06-29 09:09:27 -05:00
|
|
|
|
wellPaths[wellPathIdx]->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
|
2013-10-24 02:50:16 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-14 10:05:28 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimWellPath* RimWellPathCollection::wellPathByName(const QString& wellPathName) const
|
|
|
|
|
{
|
|
|
|
|
for (size_t wellPathIdx = 0; wellPathIdx < wellPaths.size(); wellPathIdx++)
|
|
|
|
|
{
|
|
|
|
|
if (wellPaths[wellPathIdx]->name() == wellPathName)
|
|
|
|
|
{
|
|
|
|
|
return wellPaths[wellPathIdx];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 15:04:52 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-29 07:12:55 -05:00
|
|
|
|
void RimWellPathCollection::deleteAllWellPaths()
|
|
|
|
|
{
|
|
|
|
|
wellPaths.deleteAllChildObjects();
|
|
|
|
|
|
|
|
|
|
m_asciiFileReader->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::removeWellPath(RimWellPath* wellPath)
|
|
|
|
|
{
|
|
|
|
|
wellPaths.removeChildObject(wellPath);
|
|
|
|
|
|
|
|
|
|
bool isFilePathUsed = false;
|
|
|
|
|
for (size_t i = 0; i < wellPaths.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
if (wellPaths[i]->filepath == wellPath->filepath)
|
|
|
|
|
{
|
|
|
|
|
isFilePathUsed = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isFilePathUsed)
|
|
|
|
|
{
|
|
|
|
|
// One file can have multiple well paths
|
|
|
|
|
// If no other well paths are referencing the filepath, remove cached data from the file reader
|
|
|
|
|
m_asciiFileReader->removeFilePath(wellPath->filepath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-30 07:32:34 -06:00
|
|
|
|
bool lessWellPath(const caf::PdmPointer<RimWellPath>& w1, const caf::PdmPointer<RimWellPath>& w2)
|
|
|
|
|
{
|
2015-11-30 07:50:16 -06:00
|
|
|
|
if (w1.notNull() && w2.notNull())
|
|
|
|
|
return (w1->name() < w2->name());
|
|
|
|
|
else if (w1.notNull())
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
2015-11-30 07:32:34 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimWellPathCollection::sortWellsByName()
|
|
|
|
|
{
|
|
|
|
|
std::sort(wellPaths.begin(), wellPaths.end(), lessWellPath);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-29 07:12:55 -05:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RifWellPathAsciiFileReader::readAllWellData(QString filePath)
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
std::map<QString, std::vector<WellData> >::iterator it = m_fileNameToWellDataGroupMap.find(filePath);
|
|
|
|
|
|
|
|
|
|
// If we have the file in the map, assume it is already read.
|
|
|
|
|
if (it != m_fileNameToWellDataGroupMap.end())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the data container
|
|
|
|
|
std::vector<WellData>& fileWellDataArray = m_fileNameToWellDataGroupMap[filePath];
|
2015-12-01 09:07:42 -06:00
|
|
|
|
|
2013-06-24 15:04:52 -05:00
|
|
|
|
std::ifstream stream(filePath.toLatin1().data());
|
|
|
|
|
double x(HUGE_VAL), y(HUGE_VAL), tvd(HUGE_VAL), md(HUGE_VAL);
|
|
|
|
|
|
2015-12-01 09:07:42 -06:00
|
|
|
|
bool hasReadWellPointInCurrentWell = false;
|
|
|
|
|
|
|
|
|
|
while (stream.good())
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
// First check if we can read a number
|
2013-06-24 15:04:52 -05:00
|
|
|
|
stream >> x;
|
2015-12-01 09:07:42 -06:00
|
|
|
|
if (stream.good()) // If we can, assume this line is a well point entry
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
stream >> y >> tvd >> md;
|
|
|
|
|
if (!stream.good())
|
|
|
|
|
{
|
|
|
|
|
// -999 or otherwise to few numbers before some word
|
|
|
|
|
if (x != -999)
|
|
|
|
|
{
|
|
|
|
|
// Error in file: missing numbers at this line
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
stream.clear();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
if (!fileWellDataArray.size())
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
fileWellDataArray.push_back(WellData());
|
|
|
|
|
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cvf::Vec3d wellPoint(x, y, -tvd);
|
|
|
|
|
fileWellDataArray.back().m_wellPathGeometry->m_wellPathPoints.push_back(wellPoint);
|
2015-09-10 07:21:08 -05:00
|
|
|
|
fileWellDataArray.back().m_wellPathGeometry->m_measuredDepths.push_back(md);
|
2013-06-24 15:04:52 -05:00
|
|
|
|
|
|
|
|
|
x = HUGE_VAL;
|
|
|
|
|
y = HUGE_VAL;
|
|
|
|
|
tvd = HUGE_VAL;
|
|
|
|
|
md = HUGE_VAL;
|
2015-12-01 09:07:42 -06:00
|
|
|
|
|
|
|
|
|
hasReadWellPointInCurrentWell = true;
|
2013-06-24 15:04:52 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Could not read one double.
|
|
|
|
|
// we assume there is a comment line or a well path description
|
|
|
|
|
stream.clear();
|
|
|
|
|
|
|
|
|
|
std::string line;
|
|
|
|
|
std::getline(stream, line, '\n');
|
2015-12-01 09:07:42 -06:00
|
|
|
|
// Skip possible comment lines (-- is used in eclipse, so Haakon H<>gst<73>l considered it smart to skip these here as well)
|
|
|
|
|
// The first "-" is eaten by the stream >> x above
|
|
|
|
|
if (line.find("-") == 0 || line.find("#") == 0)
|
2013-08-19 02:46:31 -05:00
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
// Comment line, just ignore
|
2013-08-19 02:46:31 -05:00
|
|
|
|
}
|
2015-12-01 09:07:42 -06:00
|
|
|
|
else
|
2013-08-19 02:46:31 -05:00
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
// Find the first and the last position of any quotes (and do not care to match quotes)
|
|
|
|
|
size_t quoteStartIdx = line.find_first_of("'`<60><><EFBFBD>");
|
|
|
|
|
size_t quoteEndIdx = line.find_last_of("'`<60><><EFBFBD>");
|
|
|
|
|
|
|
|
|
|
std::string wellName;
|
|
|
|
|
bool haveAPossibleWellStart = false;
|
|
|
|
|
|
|
|
|
|
if (quoteStartIdx < line.size() -1)
|
|
|
|
|
{
|
|
|
|
|
// Extract the text between the quotes
|
|
|
|
|
wellName = line.substr(quoteStartIdx + 1, quoteEndIdx - 1 - quoteStartIdx);
|
|
|
|
|
haveAPossibleWellStart = true;
|
|
|
|
|
}
|
|
|
|
|
else if (quoteStartIdx > line.length())
|
2013-08-19 02:46:31 -05:00
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
// We did not find any quotes
|
|
|
|
|
|
|
|
|
|
// Supported alternatives are
|
|
|
|
|
// name <WellNameA>
|
|
|
|
|
// wellname: <WellNameA>
|
|
|
|
|
std::string lineLowerCase = line;
|
|
|
|
|
transform(lineLowerCase.begin(), lineLowerCase.end(), lineLowerCase.begin(), ::tolower);
|
|
|
|
|
|
|
|
|
|
std::string tokenName = "name";
|
|
|
|
|
std::size_t foundNameIdx = lineLowerCase.find(tokenName);
|
|
|
|
|
if (foundNameIdx != std::string::npos)
|
2015-10-28 05:32:47 -05:00
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
std::string tokenColon = ":";
|
|
|
|
|
std::size_t foundColonIdx = lineLowerCase.find(tokenColon, foundNameIdx);
|
|
|
|
|
if (foundColonIdx != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
wellName = line.substr(foundColonIdx + tokenColon.length());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wellName = line.substr(foundNameIdx + tokenName.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
haveAPossibleWellStart = true;
|
2015-10-28 05:32:47 -05:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-12-01 09:07:42 -06:00
|
|
|
|
// Interpret the whole line as the well name.
|
|
|
|
|
|
|
|
|
|
QString name = line.c_str();
|
|
|
|
|
if (!name.trimmed().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
wellName = name.trimmed().toStdString();
|
|
|
|
|
haveAPossibleWellStart = true;
|
|
|
|
|
}
|
2015-10-28 05:32:47 -05:00
|
|
|
|
}
|
2013-08-19 02:46:31 -05:00
|
|
|
|
}
|
|
|
|
|
|
2015-12-01 09:07:42 -06:00
|
|
|
|
if (haveAPossibleWellStart)
|
|
|
|
|
{
|
|
|
|
|
// Create a new Well data if we have read some data into the previous one.
|
|
|
|
|
// if not, just overwrite the name
|
|
|
|
|
if (hasReadWellPointInCurrentWell || fileWellDataArray.size() == 0)
|
|
|
|
|
{
|
|
|
|
|
fileWellDataArray.push_back(WellData());
|
|
|
|
|
fileWellDataArray.back().m_wellPathGeometry = new RigWellPath();
|
|
|
|
|
}
|
2013-06-24 15:04:52 -05:00
|
|
|
|
|
2015-12-01 09:07:42 -06:00
|
|
|
|
QString name = wellName.c_str();
|
|
|
|
|
if (!name.trimmed().isEmpty())
|
|
|
|
|
{
|
|
|
|
|
// Do not overwrite the name aquired from a line above, if this line is empty
|
|
|
|
|
fileWellDataArray.back().m_name = name.trimmed();
|
|
|
|
|
}
|
|
|
|
|
hasReadWellPointInCurrentWell = false;
|
|
|
|
|
}
|
2013-06-24 15:04:52 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-29 07:12:55 -05:00
|
|
|
|
RifWellPathAsciiFileReader::WellData RifWellPathAsciiFileReader::readWellData(QString filePath, int indexInFile)
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
this->readAllWellData(filePath);
|
|
|
|
|
|
|
|
|
|
std::map<QString, std::vector<WellData> >::iterator it = m_fileNameToWellDataGroupMap.find(filePath);
|
|
|
|
|
|
|
|
|
|
CVF_ASSERT(it != m_fileNameToWellDataGroupMap.end());
|
|
|
|
|
|
2013-09-12 01:29:37 -05:00
|
|
|
|
if (indexInFile < static_cast<int>(it->second.size()))
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
return it->second[indexInFile];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-10-29 07:12:55 -05:00
|
|
|
|
// Error : The ascii well path file does not contain that many well paths
|
2013-06-24 15:04:52 -05:00
|
|
|
|
return WellData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-29 07:12:55 -05:00
|
|
|
|
size_t RifWellPathAsciiFileReader::wellDataCount(QString filePath)
|
2013-06-24 15:04:52 -05:00
|
|
|
|
{
|
|
|
|
|
std::map<QString, std::vector<WellData> >::iterator it = m_fileNameToWellDataGroupMap.find(filePath);
|
|
|
|
|
|
|
|
|
|
// If we have the file in the map, assume it is already read.
|
|
|
|
|
if (it != m_fileNameToWellDataGroupMap.end())
|
|
|
|
|
{
|
|
|
|
|
return it->second.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->readAllWellData(filePath);
|
|
|
|
|
it = m_fileNameToWellDataGroupMap.find(filePath);
|
|
|
|
|
CVF_ASSERT(it != m_fileNameToWellDataGroupMap.end());
|
|
|
|
|
|
|
|
|
|
return it->second.size();;
|
|
|
|
|
}
|
2015-10-29 07:12:55 -05:00
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RifWellPathAsciiFileReader::clear()
|
|
|
|
|
{
|
|
|
|
|
m_fileNameToWellDataGroupMap.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RifWellPathAsciiFileReader::removeFilePath(const QString& filePath)
|
|
|
|
|
{
|
|
|
|
|
m_fileNameToWellDataGroupMap.erase(filePath);
|
|
|
|
|
}
|