Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::NodeGraph::NodeAnnotationsManager Class Reference

Manages per-node annotations (breakpoints, comments, colors) More...

#include <NodeAnnotations.h>

Public Member Functions

 NodeAnnotationsManager ()=default
 
 ~NodeAnnotationsManager ()=default
 
bool HasAnnotation (int nodeId) const
 Check if a node has any annotation.
 
NodeAnnotationGetAnnotation (int nodeId)
 Get annotation for a node (non-const)
 
const NodeAnnotationGetAnnotation (int nodeId) const
 Get annotation for a node (const)
 
void SetBreakpoint (int nodeId, bool enabled)
 Set breakpoint state for a node.
 
void SetComment (int nodeId, const std::string &text)
 Set comment for a node.
 
void SetColor (int nodeId, float r, float g, float b, float a)
 Set custom color for a node.
 
void ClearAnnotation (int nodeId)
 Remove all annotation data for a node.
 
const std::map< int, NodeAnnotation > & GetAll () const
 Get all annotations (for serialization / rendering)
 
json ToJson () const
 Serialize all annotations to JSON.
 
void FromJson (const json &j)
 Deserialize annotations from JSON.
 

Private Member Functions

NodeAnnotationGetOrCreate (int nodeId)
 Get or create annotation for a node.
 

Private Attributes

std::map< int, NodeAnnotationm_annotations
 

Detailed Description

Manages per-node annotations (breakpoints, comments, colors)

Definition at line 49 of file NodeAnnotations.h.

Constructor & Destructor Documentation

◆ NodeAnnotationsManager()

Olympe::NodeGraph::NodeAnnotationsManager::NodeAnnotationsManager ( )
default

◆ ~NodeAnnotationsManager()

Olympe::NodeGraph::NodeAnnotationsManager::~NodeAnnotationsManager ( )
default

Member Function Documentation

◆ ClearAnnotation()

void Olympe::NodeGraph::NodeAnnotationsManager::ClearAnnotation ( int  nodeId)

Remove all annotation data for a node.

Parameters
nodeIdNode identifier

Definition at line 71 of file NodeAnnotations.cpp.

References m_annotations, and SYSTEM_LOG.

◆ FromJson()

void Olympe::NodeGraph::NodeAnnotationsManager::FromJson ( const json j)

Deserialize annotations from JSON.

Parameters
jJSON array of annotation objects

Definition at line 111 of file NodeAnnotations.cpp.

References JsonHelper::GetBool(), GetComponentTypeID_Static(), JsonHelper::GetFloat(), JsonHelper::GetInt(), JsonHelper::GetString(), m_annotations, and Olympe::NodeGraph::NodeAnnotation::nodeId.

+ Here is the call graph for this function:

◆ GetAll()

const std::map< int, NodeAnnotation > & Olympe::NodeGraph::NodeAnnotationsManager::GetAll ( ) const

Get all annotations (for serialization / rendering)

Returns
Const reference to internal map

Definition at line 81 of file NodeAnnotations.cpp.

References m_annotations.

◆ GetAnnotation() [1/2]

NodeAnnotation * Olympe::NodeGraph::NodeAnnotationsManager::GetAnnotation ( int  nodeId)

Get annotation for a node (non-const)

Parameters
nodeIdNode identifier
Returns
Pointer to annotation, or nullptr if not found

Definition at line 23 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), and m_annotations.

Referenced by Olympe::NodeGraph::ToggleNodeBreakpointCommand::ToggleNodeBreakpointCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAnnotation() [2/2]

const NodeAnnotation * Olympe::NodeGraph::NodeAnnotationsManager::GetAnnotation ( int  nodeId) const

Get annotation for a node (const)

Parameters
nodeIdNode identifier
Returns
Const pointer to annotation, or nullptr if not found

Definition at line 33 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), and m_annotations.

+ Here is the call graph for this function:

◆ GetOrCreate()

NodeAnnotation & Olympe::NodeGraph::NodeAnnotationsManager::GetOrCreate ( int  nodeId)
private

Get or create annotation for a node.

Parameters
nodeIdNode identifier
Returns
Reference to annotation

Definition at line 156 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), m_annotations, and Olympe::NodeGraph::NodeAnnotation::nodeId.

Referenced by SetBreakpoint(), SetColor(), and SetComment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasAnnotation()

bool Olympe::NodeGraph::NodeAnnotationsManager::HasAnnotation ( int  nodeId) const

Check if a node has any annotation.

Parameters
nodeIdNode identifier
Returns
true if an annotation exists for this node

Definition at line 18 of file NodeAnnotations.cpp.

References m_annotations.

◆ SetBreakpoint()

void Olympe::NodeGraph::NodeAnnotationsManager::SetBreakpoint ( int  nodeId,
bool  enabled 
)

Set breakpoint state for a node.

Parameters
nodeIdNode identifier
enabledWhether breakpoint is active

Definition at line 47 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), GetOrCreate(), and SYSTEM_LOG.

Referenced by Olympe::NodeGraph::ToggleNodeBreakpointCommand::Execute(), and Olympe::NodeGraph::ToggleNodeBreakpointCommand::Undo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetColor()

void Olympe::NodeGraph::NodeAnnotationsManager::SetColor ( int  nodeId,
float  r,
float  g,
float  b,
float  a 
)

Set custom color for a node.

Parameters
nodeIdNode identifier
rRed component [0,1]
gGreen component [0,1]
bBlue component [0,1]
aAlpha component [0,1]

Definition at line 62 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), and GetOrCreate().

+ Here is the call graph for this function:

◆ SetComment()

void Olympe::NodeGraph::NodeAnnotationsManager::SetComment ( int  nodeId,
const std::string &  text 
)

Set comment for a node.

Parameters
nodeIdNode identifier
textComment text

Definition at line 55 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), GetOrCreate(), and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ ToJson()

json Olympe::NodeGraph::NodeAnnotationsManager::ToJson ( ) const

Serialize all annotations to JSON.

Returns
JSON array of annotation objects

Definition at line 90 of file NodeAnnotations.cpp.

References GetComponentTypeID_Static(), and m_annotations.

Referenced by Olympe::NodeGraph::GraphDocument::ToJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_annotations

std::map<int, NodeAnnotation> Olympe::NodeGraph::NodeAnnotationsManager::m_annotations
private

The documentation for this class was generated from the following files: