SILICON
Loading...
Searching...
No Matches
ogdfCircuit.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <span>
21#include <unordered_map>
22
23#include <QPointF>
24
26
27namespace SILICON::core {
28class Circuit;
29}
30
31namespace SILICON::ui {
33
38
44
73
83public:
87 using PlacementMap = std::unordered_map<GraphicalLogicComponent*, QPointF>;
88
101 [[nodiscard]] static PlacementMap
102 compute(const core::Circuit& circuit,
103 std::span<GraphicalLogicComponent* const> components,
104 const GraphLayoutOptions& options = {});
105};
106
107} // namespace SILICON::ui
Represents a digital circuit as a directed graph of components.
Definition circuit.hpp:125
static constexpr int GRID_SIZE
Grid cell size in scene units.
Pure OGDF adapter for calculating circuit component positions.
static PlacementMap compute(const core::Circuit &circuit, std::span< GraphicalLogicComponent *const > components, const GraphLayoutOptions &options={})
Computes component placements for the subset represented by components.
std::unordered_map< GraphicalLogicComponent *, QPointF > PlacementMap
Map from graphical component to the computed scene position for that item.
Base class for logic-gate graphical components.
GraphLayoutDirection
Signal-flow direction used for a layered layout.
Configuration for OGDF-based component placement.
bool deterministic
True to use a single deterministic Sugiyama crossing-minimization run.
int nodeDistance
Minimum horizontal scene distance between nodes on the same OGDF layer.
int fallbackNodeHeight
Height used when a graphical item has no valid scene bounds.
int randomSeed
Deterministic seed used by force-directed candidates.
int layerDistance
Minimum vertical scene distance between neighboring OGDF layers.
int connectedComponentDistance
Minimum distance between disconnected graph components.
GraphLayoutAlgorithm algorithm
Placement family used to generate the candidate.
GraphLayoutDirection direction
Scene direction assigned to source-to-target ranks.
QPointF origin
Top-left scene position of the normalized arranged layout.
int fallbackNodeWidth
Width used when a graphical item has no valid scene bounds.