Skip to content

Honor CoreOptions.Direction in the layered layout algorithm#5

Merged
Malcolmnixon merged 1 commit into
mainfrom
feature/layered-direction
Jul 2, 2026
Merged

Honor CoreOptions.Direction in the layered layout algorithm#5
Malcolmnixon merged 1 commit into
mainfrom
feature/layered-direction

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

The layered layout engine already supported all four flow directions via its AxisTransform stage, but the public LayeredLayoutAlgorithm called InterconnectionLayoutEngine.Place hardcoded to Right and never plumbed the CoreOptions.Direction option through, so Direction=Down returned the same coordinates as Right. This restores the genuine top-to-bottom layout that action-flow and state-transition views depend on.

  • InterconnectionLayoutEngine.Place: add an optional LayoutDirection parameter (default Right) passed to the graph and pipeline; make the total width/height computation direction-aware (transposed for Down/Up). The Right/Left paths stay byte-identical (equivalence tests pass).
  • LayeredLayoutAlgorithm.Apply: resolve CoreOptions.Direction (graph scope then options then default) and map LayoutFlowDirection to the engine direction.
  • Update CoreOptions.Direction docs: no longer advisory.
  • Add unit tests for the algorithm and engine direction behavior, plus a gallery entry contrasting Right vs Down.
  • Update requirements, design, verification docs, and the user guide; add engine- and algorithm-level Direction requirements with traceability.

The layered layout engine already supported all four flow directions via
its AxisTransform stage, but the public LayeredLayoutAlgorithm called
InterconnectionLayoutEngine.Place hardcoded to Right and never plumbed the
CoreOptions.Direction option through, so Direction=Down returned the same
coordinates as Right. This restores the genuine top-to-bottom layout that
action-flow and state-transition views depend on.

- InterconnectionLayoutEngine.Place: add an optional LayoutDirection
  parameter (default Right) passed to the graph and pipeline; make the
  total width/height computation direction-aware (transposed for Down/Up).
  The Right/Left paths stay byte-identical (equivalence tests pass).
- LayeredLayoutAlgorithm.Apply: resolve CoreOptions.Direction (graph scope
  then options then default) and map LayoutFlowDirection to the engine
  direction.
- Update CoreOptions.Direction docs: no longer advisory.
- Add unit tests for the algorithm and engine direction behavior, plus a
  gallery entry contrasting Right vs Down.
- Update requirements, design, verification docs, and the user guide;
  add engine- and algorithm-level Direction requirements with traceability.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 2, 2026 18:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores correct handling of CoreOptions.Direction for the bundled layered layout so callers can request genuine top-to-bottom (and other) flow directions instead of always getting the default rightward coordinates.

Changes:

  • Plumbs CoreOptions.Direction through LayeredLayoutAlgorithm into InterconnectionLayoutEngine.Place, and makes engine total width/height direction-aware (transposed for Down/Up).
  • Adds unit and gallery coverage to distinguish Right vs Down behavior and prevent regressions where Direction is ignored.
  • Updates requirements/design/verification/user-guide documentation to reflect that Direction is now honored (not advisory) with traceability.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/DemaConsulting.Rendering.Layout.Tests/LayeredLayoutAlgorithmTests.cs Adds direction-focused tests (Down, default, graph-scope precedence, null options).
test/DemaConsulting.Rendering.Layout.Tests/Engine/InterconnectionLayoutEngineTests.cs Adds engine-level test validating Down transposes totals and stacks nodes by Y.
test/DemaConsulting.Rendering.Gallery/GalleryShowcaseTests.cs Adds gallery rendering tests for Right vs Down direction outputs.
test/DemaConsulting.Rendering.Gallery/GalleryDiagrams.cs Adds a new direction showcase diagram graph for the gallery.
test/DemaConsulting.Rendering.Gallery/GalleryCatalog.cs Registers new direction showcase images/section in the gallery catalog.
src/DemaConsulting.Rendering/Options/CoreOptions.cs Updates CoreOptions.Direction documentation to reflect actual behavior.
src/DemaConsulting.Rendering.Layout/LayeredLayoutAlgorithm.cs Resolves Direction (graph > options > default), maps to engine direction, passes through to engine.
src/DemaConsulting.Rendering.Layout/Engine/InterconnectionLayoutEngine.cs Adds optional LayoutDirection parameter and computes direction-aware total dimensions.
docs/verification/rendering-layout/layered-layout-algorithm.md Adds Direction requirement-to-tests mapping for the layered algorithm.
docs/verification/rendering-layout/engine/interconnection-layout-engine.md Adds Direction requirement-to-tests mapping for the engine.
docs/user_guide/introduction.md Documents and exemplifies Direction usage (including Down flow).
docs/reqstream/rendering-layout/rendering-layout.yaml Adds the layered algorithm Direction requirement to the overall layout reqstream index.
docs/reqstream/rendering-layout/layered-layout-algorithm.yaml Introduces the layered algorithm Direction requirement with linked tests.
docs/reqstream/rendering-layout/engine/interconnection-layout-engine.yaml Introduces the engine Direction requirement with linked test.
docs/reqstream/rendering-layout/engine/engine.yaml Includes the engine Direction requirement in the engine reqstream index.
docs/gallery/gallery.md Adds a “Flow direction” section showcasing Right vs Down.
docs/gallery/direction-right.svg Adds generated gallery SVG for rightward direction.
docs/gallery/direction-down.svg Adds generated gallery SVG for downward direction.
docs/design/rendering-layout/layered-layout-algorithm.md Updates design to include direction resolution and direction-aware placement behavior.
docs/design/rendering-layout/engine/interconnection-layout-engine.md Updates engine design doc for direction parameter and dimension transposition behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Malcolmnixon
Malcolmnixon merged commit 9efdb70 into main Jul 2, 2026
7 checks passed
@Malcolmnixon
Malcolmnixon deleted the feature/layered-direction branch July 2, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants