Skip to content

Signale erstellen und einer Gleiskante zuordnen: Seitenwahl beim Platzieren#3

Merged
rradica merged 1 commit into
mainfrom
claude/signal-creation-track-assignment-7tujvv
Jul 9, 2026
Merged

Signale erstellen und einer Gleiskante zuordnen: Seitenwahl beim Platzieren#3
rradica merged 1 commit into
mainfrom
claude/signal-creation-track-assignment-7tujvv

Conversation

@rradica

@rradica rradica commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Ziel

Signale sollen sich gezielt erstellen und einer Gleiskante zuordnen lassen. Das Signal-Werkzeug legte ein Signal bereits per Linear Referencing an der nächstgelegenen Kante an der angeklickten Position ab — die Seite war jedoch fest auf Rechts verdrahtet. Diese PR macht die Seite zu einer bewussten Wahl.

Änderungen

  • Toolbar-Schalter „Signalseite“ (Links/Rechts) in network-editor.fxml (eigene ToggleGroup), Standard: Rechts.
  • NetworkEditorController: neuer selectedSide()-Helper liest den Schalter aus und übergibt die Seite an TrackNetwork.addSignal; onSideChanged verhindert eine vollständig abgewählte Gruppe (spiegelt die Logik der Werkzeug-Gruppe). Die Statuszeile zeigt die aktuell gewählte Seite an.
  • Feature-Spezifikation unter Features/signale-erstellen-und-gleiskante-zuordnen.md gemäß Repo-Vorlage.

Die Domänenlogik (Signal, EdgeRef, Side, addSignal) bleibt unverändert und ist bereits unit-getestet — die Seitenwahl ist reine View-Verdrahtung über diese getesteten Pfade (die View-Schicht ist wie die übrigen Werkzeuge von der Coverage ausgenommen).

Verifikation

mvn verify ist grün: 20 Tests bestanden, 0 Checkstyle-Verstöße, PMD/SpotBugs/JaCoCo ok. Guardrails (max. 3 Parameter, max. 500 LOC/Klasse) eingehalten.

Nicht enthalten (mögliches Folge-Feature)

Umbenennen, Verschieben, Löschen bestehender Signale sowie das Zuordnen zu einer anderen Kante.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SXy8RSYYvXkGbUyDmiLMfb


Generated by Claude Code

Signals are placed via the Signal tool by clicking near a track edge;
they are linear-referenced to the nearest edge at the clicked position.
Previously the side was hardcoded to the right.

Add a "Signalseite" (Links/Rechts) toggle to the toolbar so the side is a
deliberate choice for newly created signals (default: Rechts). The
controller reads the selected side and passes it to
TrackNetwork.addSignal; the status bar reflects the current side. Reuses
the existing, unit-tested model (EdgeRef/Side/addSignal); no domain logic
changes.

Also document the feature under Features/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SXy8RSYYvXkGbUyDmiLMfb

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces the ability to select the side (Left or Right) when creating and placing signals on a track edge. It adds the corresponding UI toggle buttons to the toolbar in network-editor.fxml and integrates the selection logic into NetworkEditorController.java, updating the status bar and signal creation process accordingly. Feedback suggests improving the robustness of the selectedSide() method by using pattern matching to safely cast the toggle's user data and prevent potential null pointer exceptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +119 to +122
private Side selectedSide() {
Toggle selected = sideGroup.getSelectedToggle();
return selected != null ? (Side) selected.getUserData() : Side.RIGHT;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Sicherheitsverbesserung: Falls in Zukunft ein neuer Toggle-Button zur sideGroup hinzugefügt wird, bei dem vergessen wird, das userData zu setzen, oder falls getUserData() aus anderen Gründen null zurückgibt, führt der Cast (Side) selected.getUserData() zu null. Dies würde später beim Rendern in Geometry.offsetPoint zu einer NullPointerException führen. Es ist sicherer, mithilfe von Pattern Matching (instanceof Side side) zu prüfen, ob das User-Data-Objekt tatsächlich vom Typ Side ist, und andernfalls auf den Standardwert Side.RIGHT zurückzufallen.

    private Side selectedSide() {
        Toggle selected = sideGroup.getSelectedToggle();
        if (selected != null && selected.getUserData() instanceof Side side) {
            return side;
        }
        return Side.RIGHT;
    }

@rradica rradica merged commit f800d67 into main Jul 9, 2026
1 check passed
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