mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add Well Log root object.
This commit is contained in:
88
ApplicationLibCode/ProjectDataModel/WellLog/RimWellLog.cpp
Normal file
88
ApplicationLibCode/ProjectDataModel/WellLog/RimWellLog.cpp
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user