@@ -13,9 +13,26 @@ namespace PolylineAlgorithm;
1313/// Decodes encoded polyline strings into sequences of geographic coordinates.
1414/// Implements the <see cref="IPolylineDecoder{TCoordinate, TPolyline}"/> interface.
1515/// </summary>
16- public sealed class PolylineDecoder : PolylineDecoder < Coordinate , Polyline >
17- {
18- public override PolylineEncodingOptions < Coordinate > Options { get ; } = new PolylineEncodingOptions < Coordinate > ( ) ;
16+ public sealed class PolylineDecoder : PolylineDecoder < Coordinate , Polyline > {
17+ /// <summary>
18+ /// Initializes a new instance of the <see cref="PolylineDecoder"/> class with default encoding options.
19+ /// </summary>
20+ public PolylineDecoder ( )
21+ : this ( new ( ) ) { }
22+
23+ /// <summary>
24+ /// Initializes a new instance of the <see cref="PolylineDecoder"/> class with the specified encoding options.
25+ /// </summary>
26+ /// <param name="options">The encoding options to use for decoding polylines.</param>
27+ /// <exception cref="ArgumentNullException">Thrown if <paramref name="options"/> is <c>null</c>.</exception>
28+ public PolylineDecoder ( PolylineEncodingOptions < Coordinate > options ) {
29+ Options = options ?? throw new ArgumentNullException ( nameof ( options ) ) ;
30+ }
31+
32+ /// <summary>
33+ /// Gets the encoding options used by this polyline decoder.
34+ /// </summary>
35+ public override PolylineEncodingOptions < Coordinate > Options { get ; }
1936
2037 /// <summary>
2138 /// Creates a <see cref="Coordinate"/> instance from the given latitude and longitude.
@@ -24,8 +41,7 @@ public sealed class PolylineDecoder : PolylineDecoder<Coordinate, Polyline>
2441 /// <param name="longitude">The longitude of the coordinate.</param>
2542 /// <returns>A <see cref="Coordinate"/> instance.</returns>
2643 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
27- protected override Coordinate CreateCoordinate ( double latitude , double longitude )
28- {
44+ protected override Coordinate CreateCoordinate ( double latitude , double longitude ) {
2945 return new Coordinate ( latitude , longitude ) ;
3046 }
3147
@@ -35,8 +51,7 @@ protected override Coordinate CreateCoordinate(double latitude, double longitude
3551 /// <param name="polyline">The polyline to extract the sequence from.</param>
3652 /// <returns>A <see cref="ReadOnlySequence{Task }"/> representing the polyline.</returns>
3753 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
38- protected override ReadOnlySequence < char > GetReadOnlySequence ( Polyline polyline )
39- {
54+ protected override ReadOnlySequence < char > GetReadOnlySequence ( Polyline polyline ) {
4055 return polyline . Value ;
4156 }
4257}
0 commit comments