Add Well Log root object.

This commit is contained in:
Kristian Bendiksen
2024-05-27 15:31:01 +02:00
parent 74ba0c8b8c
commit 6144c1f3a6
5 changed files with 162 additions and 73 deletions

View File

@@ -18,24 +18,10 @@
#include "RimWellLogFile.h"
#include "RimFileWellPath.h"
#include "RimTools.h"
#include "RimWellLogChannel.h"
#include "RiaFieldHandleTools.h"
#include "RiaQDateTimeTools.h"
#include "cafPdmUiDateEditor.h"
#include <QString>
CAF_PDM_ABSTRACT_SOURCE_INIT( RimWellLogFile, "WellLogFileInterface" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QDateTime RimWellLogFile::DEFAULT_DATE_TIME = RiaQDateTimeTools::createUtcDateTime( QDate( 1900, 1, 1 ) );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -45,11 +31,6 @@ RimWellLogFile::RimWellLogFile()
CAF_PDM_InitFieldNoDefault( &m_fileName, "FileName", "Filename" );
m_fileName.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date" );
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "" );
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames );
}
//--------------------------------------------------------------------------------------------------
@@ -57,7 +38,6 @@ RimWellLogFile::RimWellLogFile()
//--------------------------------------------------------------------------------------------------
RimWellLogFile::~RimWellLogFile()
{
m_wellLogChannelNames.deleteChildren();
}
//--------------------------------------------------------------------------------------------------
@@ -76,45 +56,18 @@ QString RimWellLogFile::fileName() const
return m_fileName().path();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogChannel*> RimWellLogFile::wellLogChannels() const
{
std::vector<RimWellLogChannel*> channels;
for ( const auto& channel : m_wellLogChannelNames )
{
channels.push_back( channel );
}
return channels;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QDateTime RimWellLogFile::date() const
{
return m_date;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
if ( changedField == &m_date )
{
// Due to a possible bug in QDateEdit/PdmUiDateEditor, convert m_date to a QDateTime having UTC timespec
m_date = RiaQDateTimeTools::createUtcDateTime( m_date().date(), m_date().time() );
}
RimWellLog::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
if ( caf::PdmUiDateEditorAttribute* attrib = dynamic_cast<caf::PdmUiDateEditorAttribute*>( attribute ) )
{
attrib->dateFormat = RiaQDateTimeTools::dateFormatString();
}
RimWellLog::defineEditorAttribute( field, uiConfigName, attribute );
}