| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace Trailblazer.Pathing; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Represents an authored handoff between chart-backed traversal and/or raw volume traversal. |
| | | 7 | | /// </summary> |
| | | 8 | | [Serializable] |
| | | 9 | | public readonly struct TraversalTransition |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Stable identifier for this transition within the global registry. |
| | | 13 | | /// </summary> |
| | | 14 | | public string Id { get; } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// The authored handoff this transition represents. |
| | | 18 | | /// </summary> |
| | | 19 | | public TraversalTransitionType Type { get; } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// The source anchor for this transition. |
| | | 23 | | /// </summary> |
| | | 24 | | public TraversalTransitionAnchor Source { get; } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// The destination anchor for this transition. |
| | | 28 | | /// </summary> |
| | | 29 | | public TraversalTransitionAnchor Destination { get; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Optional authored path cost adjustment for taking this transition. |
| | | 33 | | /// </summary> |
| | | 34 | | public int PathCostModifier { get; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Whether this transition may be traversed in both directions. |
| | | 38 | | /// </summary> |
| | | 39 | | public bool IsBidirectional { get; } |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Whether taking this transition should request climb intent for the active guided leg. |
| | | 43 | | /// </summary> |
| | | 44 | | public bool RequestsClimbIntent { get; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Whether climb intent should remain active after a guided handoff follows this transition. |
| | | 48 | | /// </summary> |
| | | 49 | | public bool PreserveClimbIntentOnFollowup { get; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Initializes a new instance of the TraversalTransition class, representing a transition between two traversal |
| | | 53 | | /// anchors with optional path cost and intent modifiers. |
| | | 54 | | /// </summary> |
| | | 55 | | /// <param name="id">The unique identifier for the transition. Cannot be null or whitespace.</param> |
| | | 56 | | /// <param name="type">The type of the transition, indicating how traversal occurs between the source and destinatio |
| | | 57 | | /// <param name="source">The anchor from which the transition originates.</param> |
| | | 58 | | /// <param name="destination">The anchor to which the transition leads.</param> |
| | | 59 | | /// <param name="pathCostModifier">An optional value that modifies the traversal path cost for this transition. Defa |
| | | 60 | | /// <param name="isBidirectional">true if the transition can be traversed in both directions; otherwise, false. Defa |
| | | 61 | | /// <param name="requestsClimbIntent">true if the transition requests a climb intent during traversal; otherwise, fa |
| | | 62 | | /// <param name="preserveClimbIntentOnFollowup">true if climb intent should be preserved on follow-up transitions; o |
| | | 63 | | /// <exception cref="ArgumentException">Thrown if id is null or consists only of whitespace.</exception> |
| | | 64 | | public TraversalTransition( |
| | | 65 | | string id, |
| | | 66 | | TraversalTransitionType type, |
| | | 67 | | TraversalTransitionAnchor source, |
| | | 68 | | TraversalTransitionAnchor destination, |
| | | 69 | | int pathCostModifier = 0, |
| | | 70 | | bool isBidirectional = false, |
| | | 71 | | bool requestsClimbIntent = false, |
| | | 72 | | bool preserveClimbIntentOnFollowup = false) |
| | | 73 | | { |
| | 355 | 74 | | if (string.IsNullOrWhiteSpace(id)) |
| | 3 | 75 | | throw new ArgumentException("Transition id cannot be null or whitespace.", nameof(id)); |
| | | 76 | | |
| | 352 | 77 | | Id = id; |
| | 352 | 78 | | Type = type; |
| | 352 | 79 | | Source = source; |
| | 352 | 80 | | Destination = destination; |
| | 352 | 81 | | PathCostModifier = pathCostModifier; |
| | 352 | 82 | | IsBidirectional = isBidirectional; |
| | 352 | 83 | | RequestsClimbIntent = requestsClimbIntent; |
| | 352 | 84 | | PreserveClimbIntentOnFollowup = preserveClimbIntentOnFollowup; |
| | 352 | 85 | | } |
| | | 86 | | } |