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

@ -20,6 +20,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasFile.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCsvFile.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLog.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFile.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileUtil.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogChannel.h
@ -40,6 +41,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogLasFile.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCsvFile.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLog.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFile.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileUtil.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogChannel.cpp

View File

@ -0,0 +1,88 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellLog.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( RimWellLog, "WellLog" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QDateTime RimWellLog::DEFAULT_DATE_TIME = RiaQDateTimeTools::createUtcDateTime( QDate( 1900, 1, 1 ) );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLog::RimWellLog()
{
CAF_PDM_InitObject( "Well File Info", ":/LasFile16x16.png" );
CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date" );
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "" );
RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogChannel*> RimWellLog::wellLogChannels() const
{
return m_wellLogChannelNames.childrenByType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QDateTime RimWellLog::date() const
{
return m_date;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLog::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() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLog::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
if ( caf::PdmUiDateEditorAttribute* attrib = dynamic_cast<caf::PdmUiDateEditorAttribute*>( attribute ) )
{
attrib->dateFormat = RiaQDateTimeTools::dateFormatString();
}
}

View File

@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024- 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 "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include <QDateTime>
#include <QString>
class RimWellLogChannel;
class RimWellPath;
class RigWellLogData;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLog : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellLog();
virtual std::vector<RimWellLogChannel*> wellLogChannels() const;
virtual QString wellName() const = 0;
virtual QString name() const = 0;
virtual RigWellLogData* wellLogData() = 0;
virtual QDateTime date() const;
virtual std::vector<std::pair<double, double>>
findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString = nullptr ) = 0;
const static QDateTime DEFAULT_DATE_TIME;
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;
caf::PdmChildArrayField<RimWellLogChannel*> m_wellLogChannelNames;
caf::PdmField<QDateTime> m_date;
};

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 );
}

View File

@ -22,19 +22,15 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include <QDateTime>
#include <QString>
class RimWellLogChannel;
class RimWellPath;
class RigWellLogData;
#include "RimWellLog.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogFile : public caf::PdmObject
class RimWellLogFile : public RimWellLog
{
CAF_PDM_HEADER_INIT;
@ -42,27 +38,14 @@ public:
RimWellLogFile();
~RimWellLogFile() override;
virtual void setFileName( const QString& fileName );
virtual QString fileName() const;
virtual std::vector<RimWellLogChannel*> wellLogChannels() const;
virtual void setFileName( const QString& fileName );
virtual QString fileName() const;
virtual QString wellName() const = 0;
virtual QString name() const = 0;
virtual bool readFile( QString* errorMessage ) = 0;
virtual RigWellLogData* wellLogData() = 0;
virtual QDateTime date() const;
virtual std::vector<std::pair<double, double>>
findMdAndChannelValuesForWellPath( const RimWellPath& wellPath, const QString& channelName, QString* unitString = nullptr ) = 0;
const static QDateTime DEFAULT_DATE_TIME;
virtual bool readFile( QString* errorMessage ) = 0;
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;
caf::PdmChildArrayField<RimWellLogChannel*> m_wellLogChannelNames;
caf::PdmField<caf::FilePath> m_fileName;
caf::PdmField<QDateTime> m_date;
caf::PdmField<caf::FilePath> m_fileName;
};