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

Applies a hierarchical layout to a TaskGraphTemplate in place. More...

#include <GraphAutoLayout.h>

Classes

struct  Layer
 A single layer in the hierarchical layout. More...
 

Static Public Member Functions

static void ApplyHierarchicalLayout (TaskGraphTemplate &graph)
 Assigns screen-space positions to every node in graph.
 
static std::vector< LayerBuildLayers (const TaskGraphTemplate &graph)
 Builds layers via BFS from the entry point.
 
static void AssignPositions (TaskGraphTemplate &graph, const std::vector< Layer > &layers)
 Assigns x/y positions from the layer structure.
 

Static Public Attributes

static constexpr float SPACING_X = 220.0f
 Horizontal gap between columns (pixels).
 
static constexpr float SPACING_Y = 130.0f
 Vertical gap between rows (pixels).
 
static constexpr float ORIGIN_X = 100.0f
 X coordinate of the root (EntryPoint) column.
 
static constexpr float ORIGIN_Y = 100.0f
 Y coordinate of the first row.
 

Static Private Member Functions

static void SetPos (TaskNodeDefinition &node, float x, float y)
 Writes a float position into a node's Parameters map.
 

Detailed Description

Applies a hierarchical layout to a TaskGraphTemplate in place.

Typical usage:

ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
static void ApplyHierarchicalLayout(TaskGraphTemplate &graph)
Assigns screen-space positions to every node in graph.

Definition at line 44 of file GraphAutoLayout.h.

Member Function Documentation

◆ ApplyHierarchicalLayout()

void Olympe::GraphAutoLayout::ApplyHierarchicalLayout ( TaskGraphTemplate graph)
static

Assigns screen-space positions to every node in graph.

Positions are written into each node's Parameters map under the keys "__posX" (float) and "__posY" (float) so they can be consumed by the editor canvas without touching the node's semantic fields.

If graph has no EntryPoint node, the first node in Nodes is used as the root. Disconnected (orphan) nodes are placed in an overflow column to the right of the main layout.

Parameters
graphThe graph whose nodes will be positioned.

Definition at line 170 of file GraphAutoLayout.cpp.

References AssignPositions(), BuildLayers(), and GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ AssignPositions()

void Olympe::GraphAutoLayout::AssignPositions ( TaskGraphTemplate graph,
const std::vector< Layer > &  layers 
)
static

Assigns x/y positions from the layer structure.

Parameters
graphGraph whose nodes will be modified.
layersLayer structure produced by BuildLayers().

Definition at line 137 of file GraphAutoLayout.cpp.

References GetComponentTypeID_Static(), Olympe::GraphAutoLayout::Layer::NodeIDs, ORIGIN_X, ORIGIN_Y, SetPos(), SPACING_X, and SPACING_Y.

Referenced by ApplyHierarchicalLayout().

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

◆ BuildLayers()

std::vector< GraphAutoLayout::Layer > Olympe::GraphAutoLayout::BuildLayers ( const TaskGraphTemplate graph)
static

Builds layers via BFS from the entry point.

Parameters
graphSource graph.
Returns
Vector of layers; layer[0] contains the root node.

Definition at line 38 of file GraphAutoLayout.cpp.

References Olympe::EntryPoint, GetComponentTypeID_Static(), Olympe::NODE_INDEX_NONE, and Olympe::GraphAutoLayout::Layer::NodeIDs.

Referenced by ApplyHierarchicalLayout().

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

◆ SetPos()

void Olympe::GraphAutoLayout::SetPos ( TaskNodeDefinition node,
float  x,
float  y 
)
staticprivate

Writes a float position into a node's Parameters map.

Definition at line 23 of file GraphAutoLayout.cpp.

References GetComponentTypeID_Static(), Olympe::Literal, and Olympe::ParameterBinding::Type.

Referenced by AssignPositions().

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

Member Data Documentation

◆ ORIGIN_X

constexpr float Olympe::GraphAutoLayout::ORIGIN_X = 100.0f
staticconstexpr

X coordinate of the root (EntryPoint) column.

Definition at line 54 of file GraphAutoLayout.h.

Referenced by AssignPositions().

◆ ORIGIN_Y

constexpr float Olympe::GraphAutoLayout::ORIGIN_Y = 100.0f
staticconstexpr

Y coordinate of the first row.

Definition at line 57 of file GraphAutoLayout.h.

Referenced by AssignPositions().

◆ SPACING_X

constexpr float Olympe::GraphAutoLayout::SPACING_X = 220.0f
staticconstexpr

Horizontal gap between columns (pixels).

Definition at line 48 of file GraphAutoLayout.h.

Referenced by AssignPositions().

◆ SPACING_Y

constexpr float Olympe::GraphAutoLayout::SPACING_Y = 130.0f
staticconstexpr

Vertical gap between rows (pixels).

Definition at line 51 of file GraphAutoLayout.h.

Referenced by AssignPositions().


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