Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ words:
- renderable
- Segoe
- colour
- dasharray
- Metaobjects
- noviews
- Premul
- rasterizes
- Rgba
- Rects
- RRGGBB
- RRGGBBAA

# Exclude common build artifacts, dependencies, and vendored third-party code
ignorePaths:
Expand Down
12 changes: 12 additions & 0 deletions .reviewmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,18 @@ reviews:
- "docs/verification/sysml2-tools-tool/lint.md"
- "src/**/Lint/LintCommand.cs"

- id: SysML2Tools-Tool-Render
title: Review of SysML2 Tools Render subsystem implementation
context:
- docs/design/sysml2-tools-tool.md
- docs/reqstream/sysml2-tools-tool.yaml
paths:
- "docs/reqstream/sysml2-tools-tool/render.yaml"
- "docs/design/sysml2-tools-tool/render.md"
- "docs/verification/sysml2-tools-tool/render.md"
- "src/DemaConsulting.SysML2Tools.Tool/Render/RenderCommand.cs"
- "test/DemaConsulting.SysML2Tools.Tool.Tests/Render/RenderSubsystemTests.cs"

# OTS Items
- id: OTS-BuildMark
title: Review of BuildMark OTS verification evidence
Expand Down
20 changes: 13 additions & 7 deletions docs/design/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,24 @@ system, subsystem, and unit levels:
- **ReferenceResolver** (Unit) — resolves supertype references; detects circular imports
- **SupertypeWalker** (Unit) — walks specialization chains; detects cyclic specialization
- **Layout** (Subsystem) — LayoutTree intermediate representation: nine node types covering all SysML diagram elements
- **Internal** (Subsystem) — internal layout implementation
- **GeneralViewLayoutStrategy** (Unit) — two-column grid layout for general view diagrams
- **Rendering** (Subsystem) — rendering pipeline interfaces: IRenderer, ILayoutStrategy, Theme, RenderOptions, DiagramRenderer
- **DemaConsulting.SysML2Tools.Svg** (System) — SVG renderer: renders `LayoutTree` to
SVG output with zero external dependencies
- TODO: subsystems and units to be defined in Phase 4+
- **SvgRenderer** (Unit) — translates a `LayoutTree` to a self-contained SVG 1.1 document
- **DemaConsulting.SysML2Tools.Png** (System) — PNG renderer: renders `LayoutTree` to
PNG output using SkiaSharp
- TODO: subsystems and units to be defined in Phase 4+
- **PngRenderer** (Unit) — rasterizes a `LayoutTree` to a PNG image using SkiaSharp
- **DemaConsulting.SysML2Tools.Tool** (System) — dotnet tool: thin CLI wrapper and
orchestration
- **Program** (Unit) — entry point and execution orchestrator
- **Cli** (Subsystem) — command-line argument parsing and I/O
- **Context** (Unit) — argument parser and I/O owner
- **Lint** (Subsystem) — lint command implementation
- **LintCommand** (Unit) — resolves glob patterns, invokes WorkspaceLoader, reports diagnostics
- **Render** (Subsystem) — render command implementation
- **RenderCommand** (Unit) — loads workspace, selects renderer, writes diagram output files
- **SelfTest** (Subsystem) — self-validation test runner
- **Validation** (Unit) — self-validation test runner
- **Utilities** (Subsystem) — shared utilities
Expand Down Expand Up @@ -89,14 +93,15 @@ reviewers an explicit navigation aid from design to code:
- **src/** — source projects
- **DemaConsulting.SysML2Tools/** — core library
- **Grammar/** — ANTLR4 grammar files (hand-maintained; see Grammar/README.md)
- **Layout/** — LayoutTree intermediate representation (Phase 3+)
- **Layout/** — LayoutTree intermediate representation
- **Internal/** — internal layout implementation (GeneralViewLayoutStrategy)
- **Parser/** — SysML v2 parsing subsystem
- **Antlr/** — ANTLR4-generated C# (committed; not hand-written)
- **Internal/** — internal implementation (SysmlDiagnosticListener, StdlibLoader)
- **Rendering/** — rendering interfaces and theme (Phase 3+)
- **Stdlib/** — embedded SysML v2 standard library files (EPL-2.0; see Stdlib/README.md)
- **DemaConsulting.SysML2Tools.Svg/** — SVG renderer (Phase 0: stub)
- **DemaConsulting.SysML2Tools.Png/** — PNG renderer (Phase 0: stub)
- **DemaConsulting.SysML2Tools.Svg/** — SVG renderer
- **DemaConsulting.SysML2Tools.Png/** — PNG renderer
- **DemaConsulting.SysML2Tools.Tool/** — dotnet tool CLI wrapper
- **Cli/** — command-line interface subsystem
- **Lint/** — lint command subsystem
Expand All @@ -105,11 +110,12 @@ reviewers an explicit navigation aid from design to code:
- **docs/design/** — design documentation
- **sysml2-tools-core/** — core library unit/subsystem design
- **parser/** — Parser subsystem design (Internal subsystem)
- **sysml2-tools-svg/** — TODO: SVG renderer unit/subsystem design (Phase 4+)
- **sysml2-tools-png/** — TODO: PNG renderer unit/subsystem design (Phase 4+)
- **sysml2-tools-svg.md** — SVG renderer design
- **sysml2-tools-png.md** — PNG renderer design
- **sysml2-tools-tool/** — DemaConsulting.SysML2Tools.Tool unit/subsystem design
- **cli/** — Cli subsystem design
- **lint/** — Lint subsystem design
- **render/** — Render subsystem design (render.md)
- **self-test/** — SelfTest subsystem design
- **utilities/** — Utilities subsystem design

Expand Down
45 changes: 44 additions & 1 deletion docs/design/sysml2-tools-core/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,54 @@ decisions recorded here reflect constraints imposed during the Phase 3 vocabular
### Design Constraints

- All Layout types target net8.0, net9.0, and net10.0 with `<Nullable>enable</Nullable>`.
- No methods or behaviors are defined in the Layout subsystem; it is a data model only.
- No methods or behaviors are defined in the Layout subsystem data types; it is a data model only.
- `TextAlign` is declared in `LayoutLabel.cs` and reused by `LayoutGrid.cs`; both files
are in the same `DemaConsulting.SysML2Tools.Layout` namespace, so no cross-namespace
import is required.

### Internal Subsystem

#### GeneralViewLayoutStrategy

##### Purpose

`GeneralViewLayoutStrategy` implements `ILayoutStrategy` to produce a two-column grid
layout for general view diagrams. It collects all user-defined `part def` elements from
the workspace, groups them by parent package, and arranges the group boxes into two
left-to-right columns. Specialization relationships between `part def` elements with
declared supertypes are represented as `LayoutLine` nodes with open arrowheads.

##### Data Model

`GeneralViewLayoutStrategy` has no instance state. All inputs are supplied through
`BuildLayout` parameters. Layout constants (margins, gaps, minimum box sizes) are
declared as `private const double` fields.

##### Key Methods

**`BuildLayout(ViewContext context, RenderOptions options)`**

Entry point. Calls `CollectUserPartDefs` to gather non-stdlib `part def` declarations.
Returns a minimal 200×100 `LayoutTree` when no user part defs are found. Otherwise
calls `GroupByPackage` and `BuildGridLayout` to produce the full layout tree.

**`CollectUserPartDefs(SysmlWorkspace workspace)`**

Iterates `workspace.Declarations`, keeping only `SysmlDefinitionNode` entries with
`DefinitionKeyword == "part def"` that pass `StdlibFilter.IsStdlibElement`.

**`BuildGridLayout(groups, theme)`**

Places group `LayoutBox` nodes alternately in left and right columns. Computes column
widths from the maximum group width in each column, then assigns absolute `(X, Y)`
coordinates. Calls `AddSpecializationLines` to append `LayoutLine` nodes.

##### Dependencies

- `ILayoutStrategy` (in `DemaConsulting.SysML2Tools.Rendering`) — interface
- `StdlibFilter` (in `DemaConsulting.SysML2Tools.Rendering.Internal`) — stdlib exclusion
- `SysmlDefinitionNode` (in `DemaConsulting.SysML2Tools.Semantic.Internal`) — part def nodes

### Requirements Traceability

| Requirement ID | Satisfied by |
Expand Down
30 changes: 22 additions & 8 deletions docs/design/sysml2-tools-core/rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,26 @@ flowchart TD
- *Type*: Sealed class.
- *Role*: Orchestrator.
- *Contract*: `IReadOnlyList<RenderOutput> RenderWorkspace(SysmlWorkspace workspace, IRenderer renderer, RenderOptions options)`.
Iterates over all views in the workspace, calls `ILayoutStrategy.BuildLayout` for each,
then calls `IRenderer.Render` and collects the results. Implementation is deferred to
Phase 4.
Iterates over all views in the workspace, routes each view to an `ILayoutStrategy` via
`DiagramTypeRouter`, calls `ILayoutStrategy.BuildLayout`, then calls `IRenderer.Render`
and collects the results. Standard-library view declarations are filtered by `StdlibFilter`.

**DiagramTypeRouter**: Internal routing helper.

- *Type*: Internal static class.
- *Role*: Router.
- *Contract*: `static ILayoutStrategy GetStrategy(object viewNode, SysmlWorkspace workspace, out string? unsupportedMessage)`.
Routes all view types to `GeneralViewLayoutStrategy` in Phase 4. Sets `unsupportedMessage`
to a non-null diagnostic when no strategy is available for the view type; the caller skips
rendering that view.

**StdlibFilter**: Standard-library element filter.

- *Type*: Internal static class.
- *Role*: Filter.
- *Contract*: `static bool IsStdlibElement(string qualifiedName)`. Returns `true` when the
qualified name matches a standard-library prefix. Used by `DiagramRenderer` to exclude
stdlib view declarations from rendering.

### Design

Expand All @@ -126,9 +143,6 @@ flowchart TD

### Design Constraints

- `DiagramRenderer`, `IRenderer`, `ILayoutStrategy`, and `ViewContext` are Phase 3
interface definitions. All `Render` and `RenderWorkspace` method bodies throw
`NotImplementedException` until Phase 4 implementation.
- `ViewContext.Workspace` references `SysmlWorkspace` from
`DemaConsulting.SysML2Tools.Semantic`; the `using` directive `using DemaConsulting.SysML2Tools.Semantic;`
is required in `ILayoutStrategy.cs` and `DiagramRenderer.cs`.
Expand All @@ -141,11 +155,11 @@ flowchart TD
| Requirement ID | Satisfied by |
| --- | --- |
| SysML2Tools-Core-Rendering-IRenderer | `IRenderer` interface |
| SysML2Tools-Core-Rendering-IRendererStateless | `IRenderer` doc constraint; stub throws `NotImplementedException` |
| SysML2Tools-Core-Rendering-IRendererStateless | `SvgRenderer` and `PngRenderer` are pure stateless implementations |
| SysML2Tools-Core-Rendering-Theme | `Theme` and `FontDescriptor` records |
| SysML2Tools-Core-Rendering-ThemeDepthWrap | `Theme.DepthFillColors` with modulo indexing documented in `Theme` |
| SysML2Tools-Core-Rendering-RenderOptions | `RenderOptions` record with default values |
| SysML2Tools-Core-Rendering-ILayoutStrategy | `ILayoutStrategy` interface and `ViewContext` record |
| SysML2Tools-Core-Rendering-DiagramRenderer | `DiagramRenderer` class stub |
| SysML2Tools-Core-Rendering-DiagramRenderer | `DiagramRenderer.RenderWorkspace`; `DiagramTypeRouter`; `StdlibFilter` |
| SysML2Tools-Core-Rendering-RenderOutput | `RenderOutput` record |
| SysML2Tools-Core-Rendering-BuiltinThemes | `Themes.Light`, `Themes.Dark`, `Themes.Print` |
Loading
Loading