mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
#12719 Allow import of same well multiple times
Also exposes the well path collection object through the project object, and updates examples.
This commit is contained in:
1 parent
871973d02a
commit
377d300767
17 files changed
+204
-54
No files matched your search
@@ -53,12 +53,6 @@ RimModeledWellPath::RimModeledWellPath()
|
||||
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_geometryDefinition, "WellPathGeometryDef", "WellPathGeometry", "Trajectory" );
|
||||
m_geometryDefinition = new RimWellPathGeometryDef;
|
||||
m_geometryDefinition->changed.connect( this, &RimModeledWellPath::onGeometryDefinitionChanged );
|
||||
|
||||
// Required, as these settings are set in RimWellPath()
|
||||
m_name.uiCapability()->setUiReadOnly( false );
|
||||
m_name.uiCapability()->setUiHidden( false );
|
||||
m_name.xmlCapability()->setIOReadable( true );
|
||||
m_name.xmlCapability()->setIOWritable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -183,16 +177,6 @@ void RimModeledWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrd
|
||||
RimWellPath::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimModeledWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
RimWellPath::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,7 +44,6 @@ public:
|
||||
|
||||
private:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void onGeometryDefinitionChanged( const caf::SignalEmitter* emitter, bool fullUpdate );
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
@@ -23,12 +23,6 @@ RimOsduWellPath::RimOsduWellPath()
|
||||
|
||||
CAF_PDM_InitField( &m_datumElevationFromOsdu, "DatumElevationFromOsdu", 0.0, "Datum Elevation From OSDU" );
|
||||
m_datumElevationFromOsdu.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
// Required, as these settings are set in RimWellPath()
|
||||
m_name.uiCapability()->setUiReadOnly( false );
|
||||
m_name.uiCapability()->setUiHidden( false );
|
||||
m_name.xmlCapability()->setIOReadable( true );
|
||||
m_name.xmlCapability()->setIOWritable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -97,9 +97,6 @@ RimWellPath::RimWellPath()
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name" );
|
||||
m_name.registerKeywordAlias( "WellPathName" );
|
||||
m_name.uiCapability()->setUiReadOnly( true );
|
||||
m_name.uiCapability()->setUiHidden( true );
|
||||
m_name.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_airGap, "AirGap", "Air Gap" );
|
||||
m_airGap.registerGetMethod( this, &RimWellPath::airGap );
|
||||
@@ -711,6 +708,8 @@ void RimWellPath::setWellPathGeometry( RigWellPath* wellPathModel )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
if ( m_wellPathTieIn() )
|
||||
{
|
||||
m_wellPathTieIn->uiOrdering( uiConfigName, uiOrdering );
|
||||
|
||||
@@ -250,24 +250,26 @@ std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList fileP
|
||||
{
|
||||
// Check if this file is already open
|
||||
bool alreadyOpen = false;
|
||||
for ( const auto& wellPath : m_wellPaths )
|
||||
{
|
||||
auto* fWPath = dynamic_cast<RimFileWellPath*>( wellPath.p() );
|
||||
if ( !fWPath ) continue;
|
||||
|
||||
QFile f1;
|
||||
f1.setFileName( filePath );
|
||||
QString s1 = f1.fileName();
|
||||
QFile f2;
|
||||
f2.setFileName( fWPath->filePath() );
|
||||
QString s2 = f2.fileName();
|
||||
if ( s1 == s2 )
|
||||
if ( filePath.endsWith( "json", Qt::CaseInsensitive ) )
|
||||
{
|
||||
for ( const auto& wellPath : m_wellPaths )
|
||||
{
|
||||
// printf("Attempting to open well path JSON file that is already open:\n %s\n", (const char*)
|
||||
// filePath.toLocal8Bit());
|
||||
alreadyOpen = true;
|
||||
errorMessages->push_back( QString( "%1 is already loaded" ).arg( filePath ) );
|
||||
break;
|
||||
auto* fWPath = dynamic_cast<RimFileWellPath*>( wellPath.p() );
|
||||
if ( !fWPath ) continue;
|
||||
|
||||
QFile f1;
|
||||
f1.setFileName( filePath );
|
||||
QString s1 = f1.fileName();
|
||||
QFile f2;
|
||||
f2.setFileName( fWPath->filePath() );
|
||||
QString s2 = f2.fileName();
|
||||
if ( s1 == s2 )
|
||||
{
|
||||
alreadyOpen = true;
|
||||
errorMessages->push_back( QString( "%1 is already loaded" ).arg( filePath ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +345,7 @@ void RimWellPathCollection::readAndAddWellPaths( std::vector<RimFileWellPath*>&
|
||||
// NB! Do not use tryFindMatchingWellPath(), as this function will remove the prefix and will return an false
|
||||
// match in many cases.
|
||||
auto* existingWellPath = dynamic_cast<RimFileWellPath*>( wellPathByName( wellPath->name() ) );
|
||||
if ( existingWellPath )
|
||||
if ( existingWellPath && !existingWellPath->filePath().endsWith( ".dev" ) )
|
||||
{
|
||||
existingWellPath->setFilepath( wellPath->filePath() );
|
||||
existingWellPath->setWellPathIndexInFile( wellPath->wellPathIndexInFile() );
|
||||
|
||||
Reference in new issue
Block a user