Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
ILayoutEngine.h
Go to the documentation of this file.
1/**
2 * @file ILayoutEngine.h
3 * @brief Abstract interface for graph layout algorithms
4 * @author Olympe Engine
5 * @date 2026-02-18
6 *
7 * @details
8 * Provides interface for implementing different layout algorithms
9 * (hierarchical, force-directed, etc.) for node graphs.
10 */
11
12#pragma once
13
14#include "NodeGraphCore.h"
15#include "GraphDocument.h"
16#include <string>
17#include <vector>
18
19namespace Olympe {
20namespace NodeGraph {
21
22// ============================================================================
23// Layout Structures
24// ============================================================================
25
26/**
27 * @struct NodeLayout
28 * @brief Layout information for a node
29 */
30struct NodeLayout {
33 float width = 200.0f;
34 float height = 100.0f;
35 int layer = 0;
36 int orderInLayer = 0;
37};
38
39/**
40 * @struct LayoutParams
41 * @brief Parameters for layout algorithms
42 */
44 float nodeSpacingX = 220.0f;
45 float nodeSpacingY = 140.0f;
46 float minNodeDistance = 180.0f;
47 float maxNodeDistance = 300.0f;
48 std::string direction = "TopToBottom";
49 float zoomFactor = 1.0f;
50};
51
52// ============================================================================
53// Layout Engine Interface
54// ============================================================================
55
56/**
57 * @class ILayoutEngine
58 * @brief Abstract interface for layout engines
59 */
61public:
62 virtual ~ILayoutEngine() = default;
63
64 /**
65 * @brief Compute layout for all nodes in graph
66 * @param graph Graph document
67 * @param params Layout parameters
68 * @return Vector of node layouts
69 */
70 virtual std::vector<NodeLayout> ComputeLayout(
71 const GraphDocument* graph,
72 const LayoutParams& params
73 ) = 0;
74
75 /**
76 * @brief Get name of layout engine
77 * @return Engine name
78 */
79 virtual std::string GetName() const = 0;
80};
81
82} // namespace NodeGraph
83} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Document class for managing node graphs.
Core data structures for generic node graph system.
Main document class for a node graph.
Abstract interface for layout engines.
virtual std::string GetName() const =0
Get name of layout engine.
virtual std::vector< NodeLayout > ComputeLayout(const GraphDocument *graph, const LayoutParams &params)=0
Compute layout for all nodes in graph.
virtual ~ILayoutEngine()=default
< Provides AssetID and INVALID_ASSET_ID
Parameters for layout algorithms.
Layout information for a node.