Honor CoreOptions.Direction in the layered layout algorithm#5
Merged
Conversation
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>
There was a problem hiding this comment.
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.DirectionthroughLayeredLayoutAlgorithmintoInterconnectionLayoutEngine.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.