Refactor: Move updateChannelsFromWellLogData to base class RimWellLog

This commit is contained in:
Kristian Bendiksen committed 2025-09-04 09:04:56 +02:00
1 parent 160cb71168
commit 9326da7965
6 files changed
+24 -37

No files matched your search

@@ -107,24 +107,6 @@ void RimImportedWellLog::setWellLogData( RimImportedWellLogData* wellLogData )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimImportedWellLog::updateChannelsFromWellLogData( RigImportedWellLogData* wellLogData )
{
m_wellLogChannels.deleteChildren();
if ( !wellLogData ) return;
QStringList wellLogNames = wellLogData->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -54,7 +54,6 @@ public:
private:
void initAfterRead() override;
caf::PdmFieldHandle* userDescriptionField() override;
void updateChannelsFromWellLogData( RigImportedWellLogData* wellLogData );
private:
// PDM-based data storage for project file persistence
@@ -22,6 +22,8 @@
#include "RimTools.h"
#include "RimWellLogChannel.h"
#include "Well/RigWellLogData.h"
#include "RiaFieldHandleTools.h"
#include "RiaQDateTimeTools.h"
@@ -78,6 +80,24 @@ void RimWellLog::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
m_date = RiaQDateTimeTools::createUtcDateTime( m_date().date(), m_date().time() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLog::updateChannelsFromWellLogData( RigWellLogData* wellLogData )
{
m_wellLogChannels.deleteChildren();
if ( !wellLogData ) return;
QStringList wellLogNames = wellLogData->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -58,6 +58,8 @@ protected:
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void updateChannelsFromWellLogData( RigWellLogData* wellLogData );
caf::PdmChildArrayField<RimWellLogChannel*> m_wellLogChannels;
caf::PdmField<QDateTime> m_date;
};
@@ -78,15 +78,7 @@ bool RimWellLogCsvFile::readFile( QString* errorMessage )
return false;
}
m_wellLogChannels.deleteChildren();
QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
updateChannelsFromWellLogData( m_wellLogDataFile.p() );
return true;
}
@@ -142,15 +142,7 @@ bool RimWellLogLasFile::readFile( QString* errorMessage )
m_date = DEFAULT_DATE_TIME;
}
m_wellLogChannels.deleteChildren();
QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ )
{
RimWellLogChannel* wellLog = new RimWellLogChannel();
wellLog->setName( wellLogNames[logIdx] );
m_wellLogChannels.push_back( wellLog );
}
updateChannelsFromWellLogData( m_wellLogDataFile.p() );
auto fileWellPath = firstAncestorOrThisOfType<RimFileWellPath>();
if ( fileWellPath )