Skip to content

Commit 2f9cbe1

Browse files
committed
some test and fixes and
1 parent 2394f1f commit 2f9cbe1

21 files changed

Lines changed: 6200 additions & 236 deletions

src/PolylineAlgorithm/Abstraction/AbstractPolylineDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using PolylineAlgorithm.Diagnostics;
88
using PolylineAlgorithm.Internal;
99
using PolylineAlgorithm.Internal.Diagnostics;
10-
using PolylineAlgorithm.Internal.Logging;
10+
using PolylineAlgorithm.Internal.Diagnostics;
1111
using System.Runtime.CompilerServices;
1212

1313
namespace PolylineAlgorithm.Abstraction {

src/PolylineAlgorithm/Abstraction/AbstractPolylineEncoder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PolylineAlgorithm.Abstraction;
99
using PolylineAlgorithm;
1010
using PolylineAlgorithm.Internal;
1111
using PolylineAlgorithm.Internal.Diagnostics;
12-
using PolylineAlgorithm.Internal.Logging;
12+
using PolylineAlgorithm.Internal.Diagnostics;
1313
using System;
1414
using System.Buffers;
1515
using System.Diagnostics;
@@ -132,7 +132,7 @@ public TPolyline Encode(ReadOnlySpan<TCoordinate> coordinates) {
132132
static int GetMaxBufferLength(int count) {
133133
Debug.Assert(count > 0, "Count must be greater than zero.");
134134

135-
int requestedBufferLength = count * Defaults.Polyline.Block.Length.Max;
135+
int requestedBufferLength = count * 2 * Defaults.Polyline.Block.Length.Max;
136136

137137
Debug.Assert(requestedBufferLength > 0, "Requested buffer length must be greater than zero.");
138138

src/PolylineAlgorithm/Internal/CoordinateDelta.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,4 @@ public void Next(int latitude, int longitude) {
6969
public override readonly string ToString() =>
7070
$"{{ Coordinate: {{ Latitude: {_current.Latitude}, Longitude: {_current.Longitude} }}, " +
7171
$"Delta: {{ Latitude: {Latitude}, Longitude: {Longitude} }} }}";
72-
7372
}

src/PolylineAlgorithm/Internal/Defaults.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ internal static class Length {
101101
/// <summary>
102102
/// The minimum number of characters required to represent an encoded value.
103103
/// </summary>
104-
internal const int Min = 2;
104+
internal const int Min = 1;
105105

106106
/// <summary>
107107
/// The maximum number of characters allowed to represent an encoded value.
108108
/// </summary>
109-
internal const int Max = 14;
109+
internal const int Max = 7;
110110
}
111111
}
112112
}

src/PolylineAlgorithm/Internal/Diagnostics/LogDebugExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44
//
55

6-
namespace PolylineAlgorithm.Internal.Logging;
6+
namespace PolylineAlgorithm.Internal.Diagnostics;
77

88
using Microsoft.Extensions.Logging;
99

src/PolylineAlgorithm/Internal/Diagnostics/LogWarningExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44
//
55

6-
namespace PolylineAlgorithm.Internal.Logging;
6+
namespace PolylineAlgorithm.Internal.Diagnostics;
77

88
using Microsoft.Extensions.Logging;
99

src/PolylineAlgorithm/PolylineEncoding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public static void ValidateBlockLength(ReadOnlySpan<char> polyline) {
443443

444444
if (polyline[i] < End) {
445445
foundBlockEnd = true;
446-
if (blockLen > 7) {
446+
if (blockLen > Defaults.Polyline.Block.Length.Max) {
447447
ExceptionGuard.ThrowPolylineBlockTooLong(i - blockLen + 1);
448448
}
449449
blockLen = 0;

0 commit comments

Comments
 (0)