Remove direct access to the well path field in RimWellPathCollection

This commit is contained in:
Gaute Lindkvist
2020-10-06 15:00:39 +02:00
parent aceac43652
commit 6622328622
16 changed files with 126 additions and 153 deletions

View File

@@ -97,11 +97,9 @@ bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable()
auto wellPathCollection = RimTools::wellPathCollection();
if ( wellPathCollection )
{
caf::PdmChildArrayField<RimWellPath*>& wellPaths = wellPathCollection->wellPaths;
for ( size_t i = 0; i < wellPaths.size(); i++ )
for ( auto wellPath : wellPathCollection->wellPaths() )
{
if ( !wellPaths[i]->wellLogFiles().empty() )
if ( !wellPath->wellLogFiles().empty() )
{
return true;
}

View File

@@ -24,7 +24,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimCellEdgeColors.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewTools.h
${CMAKE_CURRENT_LIST_DIR}/RimAbstractWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h
@@ -205,7 +204,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimCellEdgeColors.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAbstractWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp

View File

@@ -75,7 +75,7 @@ void RimCompletionCellIntersectionCalc::calculateCompletionTypeResult( RimEclips
{
const RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
for ( const RimWellPath* wellPath : project->activeOilField()->wellPathCollection->wellPaths )
for ( const RimWellPath* wellPath : project->activeOilField()->wellPathCollection->wellPaths() )
{
if ( wellPath->showWellPath() && wellPath->wellPathGeometry() )
{

View File

@@ -352,10 +352,7 @@ RimWellPath* RimWellPlotTools::wellPathFromWellLogFile( const RimWellLogFile* we
RimProject* const project = RimProject::current();
for ( const auto& oilField : project->oilFields )
{
auto wellPaths = std::vector<RimWellPath*>( oilField->wellPathCollection()->wellPaths.begin(),
oilField->wellPathCollection()->wellPaths.end() );
for ( const auto& wellPath : wellPaths )
for ( const auto& wellPath : oilField->wellPathCollection()->wellPaths() )
{
for ( RimWellLogFile* const file : wellPath->wellLogFiles() )
{

View File

@@ -1,29 +0,0 @@
#include "RimAbstractWellPath.h"
#include "RigWellPath.h"
CAF_PDM_ABSTRACT_SOURCE_INIT( RimAbstractWellPath, "AbstractWellPath" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimAbstractWellPath::startMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measuredDepths().front();
}
return std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimAbstractWellPath::endMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measuredDepths().back();
}
return std::numeric_limits<double>::infinity();
}

View File

@@ -1,36 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor 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 "RimWellPathComponentInterface.h"
#include "cafPdmObject.h"
class RigWellPath;
class RimAbstractWellPath : public caf::PdmObject, public RimWellPathComponentInterface
{
CAF_PDM_HEADER_INIT;
public:
virtual RigWellPath* wellPathGeometry() = 0;
virtual const RigWellPath* wellPathGeometry() const = 0;
double startMD() const override;
double endMD() const override;
};

View File

@@ -1118,16 +1118,16 @@ RimWellPath* RimProject::wellPathByName( const QString& wellPathName ) const
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimProject::allWellPaths() const
{
std::vector<RimWellPath*> paths;
std::vector<RimWellPath*> wellPaths;
for ( const auto& oilField : oilFields() )
{
auto wellPathColl = oilField->wellPathCollection();
for ( const auto& path : wellPathColl->wellPaths )
for ( auto wellPath : wellPathColl->wellPaths() )
{
paths.push_back( path );
wellPaths.push_back( wellPath );
}
}
return paths;
return wellPaths;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -242,10 +242,8 @@ void RimTools::wellPathOptionItems( QList<caf::PdmOptionItemInfo>* options )
auto wellPathColl = RimTools::wellPathCollection();
if ( wellPathColl )
{
caf::PdmChildArrayField<RimWellPath*>& wellPaths = wellPathColl->wellPaths;
caf::IconProvider wellIcon( ":/Well.png" );
for ( RimWellPath* wellPath : wellPaths )
for ( auto wellPath : wellPathColl->wellPaths() )
{
options->push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath, false, wellIcon ) );
}
@@ -264,7 +262,7 @@ void RimTools::wellPathWithFormationsOptionItems( QList<caf::PdmOptionItemInfo>*
RimTools::wellPathWithFormations( &wellPaths );
caf::IconProvider wellIcon( ":/Well.png" );
for ( RimWellPath* wellPath : wellPaths )
for ( auto wellPath : wellPaths )
{
options->push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath, false, wellIcon ) );
}
@@ -278,9 +276,7 @@ void RimTools::wellPathWithFormations( std::vector<RimWellPath*>* wellPaths )
auto wellPathColl = RimTools::wellPathCollection();
if ( wellPathColl )
{
caf::PdmChildArrayField<RimWellPath*>& allWellPaths = wellPathColl->wellPaths;
for ( RimWellPath* wellPath : allWellPaths )
for ( RimWellPath* wellPath : wellPathColl->wellPaths() )
{
if ( wellPath->hasFormations() )
{

View File

@@ -296,14 +296,12 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions( const
auto wellPathColl = RimTools::wellPathCollection();
if ( wellPathColl )
{
caf::PdmChildArrayField<RimWellPath*>& wellPaths = wellPathColl->wellPaths;
for ( size_t i = 0; i < wellPaths.size(); i++ )
for ( auto wellPath : wellPathColl->wellPaths() )
{
// Only include well paths coming from a well log file
if ( wellPaths[i]->wellLogFiles().size() > 0 )
if ( wellPath->wellLogFiles().size() > 0 )
{
options.push_back( caf::PdmOptionItemInfo( wellPaths[i]->name(), wellPaths[i] ) );
options.push_back( caf::PdmOptionItemInfo( wellPath->name(), wellPath ) );
}
}

View File

@@ -333,7 +333,7 @@ QList<caf::PdmOptionItemInfo>
// Find wells with a given measurement.
std::set<QString> wellsWithMeasurementKind;
for ( const auto& well : wellPathCollection->wellPaths )
for ( const auto& well : wellPathCollection->wellPaths() )
{
if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) )
wellsWithMeasurementKind.insert( well->name() );
@@ -416,7 +416,7 @@ void RimWellMeasurementInView::setAllWellsSelected()
// Find wells with a given measurement.
std::set<QString> wellsWithMeasurementKind;
for ( const auto& well : wellPathCollection->wellPaths )
for ( const auto& well : wellPathCollection->wellPaths() )
{
if ( hasMeasurementKindForWell( well, wellPathCollection, measurements, m_measurementKind ) )
wellsWithMeasurementKind.insert( well->name() );

View File

@@ -127,7 +127,7 @@ RimWellPath::RimWellPath()
m_wellPathAttributes = new RimWellPathAttributeCollection;
m_wellPathAttributes->uiCapability()->setUiTreeHidden( true );
m_wellPathGeometry = nullptr;
CAF_PDM_InitFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
@@ -337,6 +337,30 @@ const RigWellPath* RimWellPath::wellPathGeometry() const
return m_wellPathGeometry.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPath::startMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measuredDepths().front();
}
return std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPath::endMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measuredDepths().back();
}
return std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -22,12 +22,13 @@
#include "RiaEclipseUnitTools.h"
#include "RimAbstractWellPath.h"
#include "RimWellPathComponentInterface.h"
#include "cafAppEnum.h"
#include "cafFilePath.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafPdmProxyValueField.h"
@@ -41,17 +42,18 @@
class RifWellPathImporter;
class RifWellPathFormationsImporter;
class RigWellPath;
class RigWellPathFormations;
class RimProject;
class RimWellLogFile;
class RimFractureTemplateCollection;
class RimFishboneWellPathCollection;
class RimFractureModelCollection;
class RimFishbonesCollection;
class RimPerforationCollection;
class RimWellPathAttributeCollection;
class RimWellPathCompletions;
class RigWellPathFormations;
class RimWellPathFractureCollection;
class Rim3dWellLogCurve;
@@ -61,7 +63,7 @@ class Rim3dWellLogCurveCollection;
///
///
//==================================================================================================
class RimWellPath : public RimAbstractWellPath
class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface
{
CAF_PDM_HEADER_INIT;
@@ -88,8 +90,11 @@ public:
double airGap() const;
double datumElevation() const;
RigWellPath* wellPathGeometry() override;
const RigWellPath* wellPathGeometry() const override;
RigWellPath* wellPathGeometry();
const RigWellPath* wellPathGeometry() const;
double startMD() const override;
double endMD() const override;
void addWellLogFile( RimWellLogFile* logFileInfo );
void deleteWellLogFile( RimWellLogFile* logFileInfo );
@@ -190,4 +195,6 @@ private:
// Obsolete fields
caf::PdmChildField<RimWellLogFile*> m_wellLogFile_OBSOLETE;
caf::PdmChildArrayField<RimWellPath*> m_childWellPaths;
};

View File

@@ -104,16 +104,15 @@ RimWellPathCollection::RimWellPathCollection()
CAF_PDM_InitField( &wellPathClip, "WellPathClip", true, "Clip Well Paths", "", "", "" );
CAF_PDM_InitField( &wellPathClipZDistance, "WellPathClipZDistance", 100, "Well Path Clipping Depth Distance", "", "", "" );
CAF_PDM_InitFieldNoDefault( &wellPaths, "WellPaths", "Well Paths", "", "", "" );
wellPaths.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellPaths, "WellPaths", "Well Paths", "", "", "" );
m_wellPaths.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" );
m_wellMeasurements = new RimWellMeasurementCollection;
m_wellMeasurements.uiCapability()->setUiTreeHidden( true );
m_wellPathImporter = new RifWellPathImporter;
m_wellPathFormationsImporter = new RifWellPathFormationsImporter;
m_mostRecentlyUpdatedWellPath = nullptr;
m_wellPathImporter = std::make_unique<RifWellPathImporter>();
m_wellPathFormationsImporter = std::make_unique<RifWellPathFormationsImporter>();
}
//--------------------------------------------------------------------------------------------------
@@ -121,9 +120,6 @@ RimWellPathCollection::RimWellPathCollection()
//--------------------------------------------------------------------------------------------------
RimWellPathCollection::~RimWellPathCollection()
{
wellPaths.deleteAllChildObjects();
delete m_wellPathImporter;
delete m_wellPathFormationsImporter;
}
//--------------------------------------------------------------------------------------------------
@@ -141,7 +137,7 @@ void RimWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changed
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::loadDataAndUpdate()
{
caf::ProgressInfo progress( wellPaths.size(), "Reading well paths from file" );
caf::ProgressInfo progress( m_wellPaths.size(), "Reading well paths from file" );
readWellPathFormationFiles();
@@ -156,7 +152,7 @@ void RimWellPathCollection::loadDataAndUpdate()
if ( !fWPath->filePath().isEmpty() )
{
QString errorMessage;
if ( !fWPath->readWellPathFile( &errorMessage, m_wellPathImporter, false ) )
if ( !fWPath->readWellPathFile( &errorMessage, m_wellPathImporter.get(), false ) )
{
RiaLogging::warning( errorMessage );
}
@@ -209,9 +205,9 @@ std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList fileP
{
// Check if this file is already open
bool alreadyOpen = false;
for ( size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++ )
for ( auto wellPath : m_wellPaths )
{
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPaths[wpIdx] );
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPath.p() );
if ( !fWPath ) continue;
QFile f1;
@@ -261,7 +257,15 @@ std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList fileP
scheduleRedrawAffectedViews();
updateAllRequiredEditors();
return wellPaths.childObjects();
return wellPaths();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RimWellPathCollection::wellPaths()
{
return m_wellPaths.childObjects();
}
//--------------------------------------------------------------------------------------------------
@@ -274,7 +278,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
for ( size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++ )
{
RimFileWellPath* wellPath = wellPathArray[wpIdx];
wellPath->readWellPathFile( nullptr, m_wellPathImporter, true );
wellPath->readWellPathFile( nullptr, m_wellPathImporter.get(), true );
progress.setProgressDescription( QString( "Reading file %1" ).arg( wellPath->name() ) );
@@ -284,7 +288,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
{
existingWellPath->setFilepath( wellPath->filePath() );
existingWellPath->setWellPathIndexInFile( wellPath->wellPathIndexInFile() );
existingWellPath->readWellPathFile( nullptr, m_wellPathImporter, true );
existingWellPath->readWellPathFile( nullptr, m_wellPathImporter.get(), true );
// Let name from well path file override name from well log file
existingWellPath->setName( wellPath->name() );
@@ -294,10 +298,10 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
}
else
{
wellPath->setWellPathColor( RiaColorTables::wellPathsPaletteColors().cycledColor3f( wellPaths.size() ) );
wellPath->setWellPathColor( RiaColorTables::wellPathsPaletteColors().cycledColor3f( m_wellPaths.size() ) );
wellPath->setUnitSystem( findUnitSystemForWellPath( wellPath ) );
m_mostRecentlyUpdatedWellPath = wellPath;
wellPaths.push_back( wellPath );
m_wellPaths.push_back( wellPath );
}
progress.incrementProgress();
@@ -313,7 +317,7 @@ void RimWellPathCollection::addWellPaths( const std::vector<RimWellPath*> incomi
{
for ( const auto& wellPath : incomingWellPaths )
{
this->wellPaths.push_back( wellPath );
m_wellPaths.push_back( wellPath );
}
this->sortWellsByName();
@@ -343,7 +347,7 @@ std::vector<RimWellLogFile*> RimWellPathCollection::addWellLogs( const QStringLi
if ( !wellPath )
{
wellPath = new RimWellPath();
wellPaths.push_back( wellPath );
m_wellPaths.push_back( wellPath );
}
wellPath->addWellLogFile( logFileInfo );
@@ -382,7 +386,7 @@ void RimWellPathCollection::addWellPathFormations( const QStringList& filePaths
{
wellPath = new RimWellPath();
wellPath->setName( it->first );
wellPaths.push_back( wellPath );
m_wellPaths.push_back( wellPath );
RiaLogging::info( QString( "Created new well: %1" ).arg( wellPath->name() ) );
}
wellPath->setFormationsGeometry( it->second );
@@ -435,9 +439,9 @@ void RimWellPathCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTree
uiTreeOrdering.add( &m_wellMeasurements );
}
if ( !wellPaths.empty() )
if ( !m_wellPaths.empty() )
{
uiTreeOrdering.add( &wellPaths );
uiTreeOrdering.add( &m_wellPaths );
}
uiTreeOrdering.skipRemainingChildren( true );
@@ -466,9 +470,9 @@ void RimWellPathCollection::scheduleRedrawAffectedViews()
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
for ( size_t wellPathIdx = 0; wellPathIdx < wellPaths.size(); wellPathIdx++ )
for ( auto wellPath : m_wellPaths )
{
wellPaths[wellPathIdx]->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
wellPath->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath );
}
}
@@ -477,7 +481,7 @@ void RimWellPathCollection::updateFilePathsFromProjectPath( const QString& newPr
//--------------------------------------------------------------------------------------------------
bool RimWellPathCollection::anyWellsContainingPerforationIntervals() const
{
for ( const auto& wellPath : wellPaths )
for ( auto wellPath : m_wellPaths )
{
if ( !wellPath->perforationIntervalCollection()->perforations().empty() ) return true;
}
@@ -490,9 +494,9 @@ bool RimWellPathCollection::anyWellsContainingPerforationIntervals() const
size_t RimWellPathCollection::modelledWellPathCount() const
{
size_t count = 0;
for ( size_t wellPathIdx = 0; wellPathIdx < wellPaths.size(); wellPathIdx++ )
for ( auto wellPath : m_wellPaths )
{
if ( dynamic_cast<RimModeledWellPath*>( wellPaths[wellPathIdx] ) )
if ( dynamic_cast<const RimModeledWellPath*>( wellPath.p() ) )
{
count++;
}
@@ -505,14 +509,13 @@ size_t RimWellPathCollection::modelledWellPathCount() const
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellPathCollection::wellPathByName( const QString& wellPathName ) const
{
for ( size_t wellPathIdx = 0; wellPathIdx < wellPaths.size(); wellPathIdx++ )
for ( auto wellPath : m_wellPaths )
{
if ( wellPaths[wellPathIdx]->name() == wellPathName )
if ( wellPath->name() == wellPathName )
{
return wellPaths[wellPathIdx];
return wellPath;
}
}
return nullptr;
}
@@ -531,7 +534,7 @@ RimWellPath* RimWellPathCollection::tryFindMatchingWellPath( const QString& well
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::deleteAllWellPaths()
{
wellPaths.deleteAllChildObjects();
m_wellPaths.deleteAllChildObjects();
m_wellPathImporter->clear();
updateAllRequiredEditors();
@@ -550,12 +553,12 @@ RimWellPath* RimWellPathCollection::mostRecentlyUpdatedWellPath()
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::readWellPathFormationFiles()
{
caf::ProgressInfo progress( wellPaths.size(), "Reading well picks from file" );
caf::ProgressInfo progress( m_wellPaths.size(), "Reading well picks from file" );
for ( size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++ )
for ( size_t wpIdx = 0; wpIdx < m_wellPaths.size(); wpIdx++ )
{
QString errorMessage;
if ( !wellPaths[wpIdx]->readWellPathFormationsFile( &errorMessage, m_wellPathFormationsImporter ) )
if ( !m_wellPaths[wpIdx]->readWellPathFormationsFile( &errorMessage, m_wellPathFormationsImporter.get() ) )
{
RiaLogging::errorInMessageBox( Riu3DMainWindowTools::mainWindowWidget(), "File open error", errorMessage );
}
@@ -570,17 +573,17 @@ void RimWellPathCollection::readWellPathFormationFiles()
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::reloadAllWellPathFormations()
{
caf::ProgressInfo progress( wellPaths.size(), "Reloading well picks from file" );
caf::ProgressInfo progress( m_wellPaths.size(), "Reloading well picks from file" );
for ( size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++ )
for ( auto wellPath : m_wellPaths )
{
QString errorMessage;
if ( !wellPaths[wpIdx]->reloadWellPathFormationsFile( &errorMessage, m_wellPathFormationsImporter ) )
if ( !wellPath->reloadWellPathFormationsFile( &errorMessage, m_wellPathFormationsImporter.get() ) )
{
RiaLogging::errorInMessageBox( Riu3DMainWindowTools::mainWindowWidget(), "File open error", errorMessage );
}
progress.setProgressDescription( QString( "Reloading formation file %1" ).arg( wpIdx ) );
progress.setProgressDescription( QString( "Reloading formation file for %1" ).arg( wellPath->name() ) );
progress.incrementProgress();
}
}
@@ -590,15 +593,15 @@ void RimWellPathCollection::reloadAllWellPathFormations()
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::removeWellPath( RimWellPath* wellPath )
{
wellPaths.removeChildObject( wellPath );
m_wellPaths.removeChildObject( wellPath );
RimFileWellPath* fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath );
if ( fileWellPath )
{
bool isFilePathUsed = false;
for ( size_t i = 0; i < wellPaths.size(); i++ )
for ( auto wellPath : m_wellPaths )
{
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPaths[i] );
RimFileWellPath* fWPath = dynamic_cast<RimFileWellPath*>( wellPath.p() );
if ( fWPath && fWPath->filePath() == fileWellPath->filePath() )
{
isFilePathUsed = true;
@@ -634,7 +637,7 @@ bool lessWellPath( const caf::PdmPointer<RimWellPath>& w1, const caf::PdmPointer
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::sortWellsByName()
{
std::sort( wellPaths.begin(), wellPaths.end(), lessWellPath );
std::sort( m_wellPaths.begin(), m_wellPaths.end(), lessWellPath );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -34,6 +34,8 @@
#include "cvfObject.h"
#include <memory>
class RifWellPathImporter;
class RigWellPath;
class RimFileWellPath;
@@ -87,11 +89,10 @@ public:
caf::PdmField<bool> wellPathClip;
caf::PdmField<int> wellPathClipZDistance;
caf::PdmChildArrayField<RimWellPath*> wellPaths;
void loadDataAndUpdate();
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
std::vector<RimWellPath*> wellPaths();
void removeWellPath( RimWellPath* wellPath );
void deleteAllWellPaths();
@@ -132,8 +133,10 @@ private:
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath( const RimWellPath* wellPath );
RifWellPathImporter* m_wellPathImporter;
RifWellPathFormationsImporter* m_wellPathFormationsImporter;
std::unique_ptr<RifWellPathImporter> m_wellPathImporter;
std::unique_ptr<RifWellPathFormationsImporter> m_wellPathFormationsImporter;
caf::PdmPointer<RimWellPath> m_mostRecentlyUpdatedWellPath;
caf::PdmChildField<RimWellMeasurementCollection*> m_wellMeasurements;
caf::PdmChildArrayField<RimWellPath*> m_wellPaths;
};

View File

@@ -28,6 +28,7 @@
RigWellPath::RigWellPath()
: m_hasDatumElevation( false )
, m_datumElevation( 0.0 )
, objectBeingDeleted( this )
{
}
@@ -39,6 +40,7 @@ RigWellPath::RigWellPath( const RigWellPath& rhs )
, m_measuredDepths( rhs.m_measuredDepths )
, m_hasDatumElevation( rhs.m_hasDatumElevation )
, m_datumElevation( rhs.m_datumElevation )
, objectBeingDeleted( this )
{
}
@@ -48,6 +50,7 @@ RigWellPath::RigWellPath( const RigWellPath& rhs )
RigWellPath::RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const std::vector<double>& measuredDepths )
: m_wellPathPoints( wellPathPoints )
, m_measuredDepths( measuredDepths )
, objectBeingDeleted( this )
{
}
@@ -63,6 +66,11 @@ RigWellPath& RigWellPath::operator=( const RigWellPath& rhs )
return *this;
}
RigWellPath::~RigWellPath()
{
objectBeingDeleted.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -18,27 +18,33 @@
#pragma once
#include "cafSignal.h"
#include "cvfMath.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include <vector>
namespace cvf
{
class BoundingBox;
}
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RigWellPath : public cvf::Object
class RigWellPath : public cvf::Object, public caf::SignalEmitter
{
public:
caf::Signal<> objectBeingDeleted;
public:
RigWellPath();
RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const std::vector<double>& measuredDepths );
RigWellPath( const RigWellPath& rhs );
RigWellPath& operator=( const RigWellPath& rhs );
~RigWellPath();
const std::vector<cvf::Vec3d>& wellPathPoints() const;
const std::vector<double>& measuredDepths() const;