#14513 Orion Events: Add raw schedule text events

This commit is contained in:
Kristian Bendiksen committed 2026-08-24 13:26:19 +02:00
1 parent 1803c636a5
commit d6878ea562
14 files changed
+810 -78

No files matched your search

@@ -1,6 +1,7 @@
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimWellEvent.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellEventPerf.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellEventRawText.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellEventValve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellEventTubing.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellEventState.cpp
@@ -39,6 +39,7 @@ void AppEnum<RimWellEvent::EventType>::setUp()
addItem( RimWellEvent::EventType::WCONTROL, "WCONTROL", "Well Control" );
addItem( RimWellEvent::EventType::KEYWORD, "KEYWORD", "Well Keyword" );
addItem( RimWellEvent::EventType::SCHEDULE_KEYWORD, "SCHEDULE_KEYWORD", "Schedule Keyword" );
addItem( RimWellEvent::EventType::RAW_TEXT, "RAW_TEXT", "Raw Text" );
setDefault( RimWellEvent::EventType::PERF );
}
} // namespace caf
@@ -48,7 +48,8 @@ public:
WELLSPEC,
WCONTROL,
KEYWORD,
SCHEDULE_KEYWORD
SCHEDULE_KEYWORD,
RAW_TEXT
};
RimWellEvent();
@@ -0,0 +1,165 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- 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 "RimWellEventRawText.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTextEditor.h"
#include "cafPdmUiTreeOrdering.h"
namespace caf
{
template <>
void AppEnum<RimWellEventRawText::Placement>::setUp()
{
addItem( RimWellEventRawText::Placement::AFTER_DATE, "AFTER_DATE", "After Date" );
addItem( RimWellEventRawText::Placement::BEFORE_KEYWORD, "BEFORE_KEYWORD", "Before Keyword" );
addItem( RimWellEventRawText::Placement::AFTER_KEYWORD, "AFTER_KEYWORD", "After Keyword" );
addItem( RimWellEventRawText::Placement::END_OF_DATE, "END_OF_DATE", "End of Date" );
setDefault( RimWellEventRawText::Placement::AFTER_DATE );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimWellEventRawText, "RawTextEvent" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellEventRawText::RimWellEventRawText()
{
CAF_PDM_InitScriptableObject( "Raw Text Event", "", "", "RawTextEvent" );
CAF_PDM_InitScriptableField( &m_text, "Text", QString(), "Text" );
m_text.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
CAF_PDM_InitScriptableField( &m_placement, "Placement", Placement::AFTER_DATE, "Placement" );
CAF_PDM_InitScriptableField( &m_anchorKeyword, "AnchorKeyword", QString(), "Anchor Keyword" );
CAF_PDM_InitScriptableField( &m_priority, "Priority", 0, "Priority" );
setDeletable( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellEventRawText::~RimWellEventRawText()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellEventRawText::text() const
{
return m_text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEventRawText::setText( const QString& text )
{
m_text = text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellEventRawText::Placement RimWellEventRawText::placement() const
{
return m_placement();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEventRawText::setPlacement( Placement placement )
{
m_placement = placement;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellEventRawText::anchorKeyword() const
{
return m_anchorKeyword();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEventRawText::setAnchorKeyword( const QString& keyword )
{
m_anchorKeyword = keyword.toUpper();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellEventRawText::priority() const
{
return m_priority();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEventRawText::setPriority( int priority )
{
m_priority = priority;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellEvent::EventType RimWellEventRawText::eventType() const
{
return EventType::RAW_TEXT;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellEventRawText::generateScheduleKeyword( const QString& wellName ) const
{
return m_text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEventRawText::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_eventDate );
uiOrdering.add( &m_placement );
uiOrdering.add( &m_anchorKeyword );
uiOrdering.add( &m_priority );
uiOrdering.add( &m_text );
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellEventRawText::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
setUiName( QString( "Raw Text %1" ).arg( m_eventDate().toString( "yyyy-MM-dd" ) ) );
uiTreeOrdering.skipRemainingChildren( true );
}
@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- 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 "RimWellEvent.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
//==================================================================================================
///
/// Raw schedule text inserted at a specific position in a dated schedule section.
///
//==================================================================================================
class RimWellEventRawText : public RimWellEvent
{
CAF_PDM_HEADER_INIT;
public:
enum class Placement
{
AFTER_DATE,
BEFORE_KEYWORD,
AFTER_KEYWORD,
END_OF_DATE
};
RimWellEventRawText();
~RimWellEventRawText() override;
QString text() const;
void setText( const QString& text );
Placement placement() const;
void setPlacement( Placement placement );
QString anchorKeyword() const;
void setAnchorKeyword( const QString& keyword );
int priority() const;
void setPriority( int priority );
EventType eventType() const override;
QString generateScheduleKeyword( const QString& wellName ) const override;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
private:
caf::PdmField<QString> m_text;
caf::PdmField<caf::AppEnum<Placement>> m_placement;
caf::PdmField<QString> m_anchorKeyword;
caf::PdmField<int> m_priority;
};
namespace caf
{
template <>
void caf::AppEnum<RimWellEventRawText::Placement>::setUp();
} // namespace caf
@@ -23,6 +23,7 @@
#include "RimWellEventControl.h"
#include "RimWellEventKeyword.h"
#include "RimWellEventPerf.h"
#include "RimWellEventRawText.h"
#include "RimWellEventState.h"
#include "RimWellEventTubing.h"
#include "RimWellEventType.h"
@@ -343,6 +344,18 @@ RimKeywordEvent* RimWellEventTimeline::addKeywordEvent( const QDateTime& date, c
return event;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellEventRawText* RimWellEventTimeline::addRawTextEvent( const QDateTime& date )
{
auto* event = new RimWellEventRawText();
event->setEventDate( date );
m_events.push_back( event );
updateEditorsAfterEventChange();
return event;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -37,6 +37,7 @@ class RimWellEventWellSpec;
class RimWellEventControl;
class RimWellEventKeyword;
class RimKeywordEvent;
class RimWellEventRawText;
class RimWellPath;
class RimWellPathCollection;
@@ -81,6 +82,7 @@ public:
RimWellEventControl* addControlEvent( RimWellPath* wellPath, const QDateTime& date );
RimWellEventKeyword* addWellKeywordEvent( RimWellPath* wellPath, const QDateTime& date, const QString& keywordName );
RimKeywordEvent* addKeywordEvent( const QDateTime& date, const QString& keywordName );
RimWellEventRawText* addRawTextEvent( const QDateTime& date );
// Generic add event method
void addEvent( RimWellEvent* event );