// Example pseudocode for typical usage with a string-based encoder:
+
+ var coords = new[] {
+ new Coordinate { Latitude = 47.6219, Longitude = -122.3503 },
+ new Coordinate { Latitude = 47.6220, Longitude = -122.3504 }
+ };
+
+ IPolylineEncoder<Coordinate,string> encoder = new GoogleEncodedPolylineEncoder();
+
+ string encoded = encoder.Encode(coords, CancellationToken.None);
+- h4: Remarks
+- markdown: >-
+ - Implementations should validate input as appropriate and document any preconditions (for example
+ if coordinates must be within [-90,90] latitude and [-180,180] longitude).
+ - For large input sequences, implementations may provide streaming or incremental encoders; those
+ variants can still implement this interface by materializing the final encoded result.
+- h4: Exceptions
+- parameters:
+ - type:
+ - text: OperationCanceledException
+ url: https://learn.microsoft.com/dotnet/api/system.operationcanceledexception
+ description: Thrown if the operation is canceled via cancellationToken.
languageId: csharp
metadata:
- description: Defines a contract for encoding a sequence of geographic coordinates into an encoded polyline string.
+ description: >-
+ Contract for encoding a sequence of geographic coordinates into an encoded polyline representation.
+
+ Implementations interpret the generic TValue type and produce an encoded
+
+ representation of those coordinates as TPolyline.
diff --git a/api-reference/1.0/PolylineAlgorithm.Abstraction.yml b/api-reference/1.0/PolylineAlgorithm.Abstraction.yml
index ff580e3c..e9de48f7 100644
--- a/api-reference/1.0/PolylineAlgorithm.Abstraction.yml
+++ b/api-reference/1.0/PolylineAlgorithm.Abstraction.yml
@@ -11,25 +11,24 @@ body:
- type:
text: AbstractPolylineDecoder
url: PolylineAlgorithm.Abstraction.AbstractPolylineDecoder-2.html
- description: >-
- Decodes encoded polyline strings into sequences of geographic coordinates.
-
- Implements the interface.
+ description: Provides a base implementation for decoding encoded polyline strings into sequences of geographic coordinates.
- type:
text: AbstractPolylineEncoder
url: PolylineAlgorithm.Abstraction.AbstractPolylineEncoder-2.html
- description: >-
- Provides functionality to encode a collection of geographic coordinates into an encoded polyline string.
-
- Implements the interface.
+ description: Provides a base implementation for encoding sequences of geographic coordinates into encoded polyline strings.
- h3: Interfaces
- parameters:
- type:
- text: IPolylineDecoder
+ text: IPolylineDecoder
url: PolylineAlgorithm.Abstraction.IPolylineDecoder-2.html
description: Defines a contract for decoding an encoded polyline into a sequence of geographic coordinates.
- type:
- text: IPolylineEncoder
+ text: IPolylineEncoder
url: PolylineAlgorithm.Abstraction.IPolylineEncoder-2.html
- description: Defines a contract for encoding a sequence of geographic coordinates into an encoded polyline string.
+ description: >-
+ Contract for encoding a sequence of geographic coordinates into an encoded polyline representation.
+
+ Implementations interpret the generic TValue type and produce an encoded
+
+ representation of those coordinates as TPolyline.
languageId: csharp
diff --git a/api-reference/1.0/PolylineAlgorithm.Coordinate.yml b/api-reference/1.0/PolylineAlgorithm.Coordinate.yml
deleted file mode 100644
index 7f5afdf3..00000000
--- a/api-reference/1.0/PolylineAlgorithm.Coordinate.yml
+++ /dev/null
@@ -1,250 +0,0 @@
-### YamlMime:ApiPage
-title: Struct Coordinate
-body:
-- api1: Struct Coordinate
- id: PolylineAlgorithm_Coordinate
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L22
- metadata:
- uid: PolylineAlgorithm.Coordinate
- commentId: T:PolylineAlgorithm.Coordinate
-- facts:
- - name: Namespace
- value:
- text: PolylineAlgorithm
- url: PolylineAlgorithm.html
- - name: Assembly
- value: PolylineAlgorithm.dll
-- markdown: Represents a geographic coordinate as a pair of latitude and longitude values.
-- code: 'public readonly struct Coordinate : IEquatable'
-- h4: Implements
-- list:
- - text: IEquatable
- url: https://learn.microsoft.com/dotnet/api/system.iequatable-1
-- h4: Inherited Members
-- list:
- - text: object.Equals(object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
- - text: object.Equals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
- - text: object.GetHashCode()
- url: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- - text: object.GetType()
- url: https://learn.microsoft.com/dotnet/api/system.object.gettype
- - text: object.ReferenceEquals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- - text: object.ToString()
- url: https://learn.microsoft.com/dotnet/api/system.object.tostring
-- h2: Remarks
-- markdown: >-
- This struct is designed to be immutable and lightweight, providing a simple way to represent
-
- geographic coordinates in degrees. It includes validation for latitude and longitude ranges
-
- and provides methods for equality comparison and string representation.
-- h2: Constructors
-- api3: Coordinate()
- id: PolylineAlgorithm_Coordinate__ctor
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L28
- metadata:
- uid: PolylineAlgorithm.Coordinate.#ctor
- commentId: M:PolylineAlgorithm.Coordinate.#ctor
-- markdown: Initializes a new instance of the struct with default values (0) for and .
-- code: public Coordinate()
-- api3: Coordinate(double, double)
- id: PolylineAlgorithm_Coordinate__ctor_System_Double_System_Double_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L46
- metadata:
- uid: PolylineAlgorithm.Coordinate.#ctor(System.Double,System.Double)
- commentId: M:PolylineAlgorithm.Coordinate.#ctor(System.Double,System.Double)
-- markdown: Initializes a new instance of the struct with the specified latitude and longitude values.
-- code: public Coordinate(double latitude, double longitude)
-- h4: Parameters
-- parameters:
- - name: latitude
- type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
- description: The latitude component of the coordinate, in degrees. Must be between -90 and 90.
- - name: longitude
- type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
- description: The longitude component of the coordinate, in degrees. Must be between -180 and 180.
-- h4: Exceptions
-- parameters:
- - type:
- - text: ArgumentOutOfRangeException
- url: https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception
- description: >-
- Thrown when latitude is less than -90 or greater than 90,
-
- or when longitude is less than -180 or greater than 180.
-- h2: Properties
-- api3: Latitude
- id: PolylineAlgorithm_Coordinate_Latitude
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L62
- metadata:
- uid: PolylineAlgorithm.Coordinate.Latitude
- commentId: P:PolylineAlgorithm.Coordinate.Latitude
-- markdown: Gets the latitude component of the coordinate, in degrees.
-- code: public double Latitude { get; }
-- h4: Property Value
-- parameters:
- - type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
-- api3: Longitude
- id: PolylineAlgorithm_Coordinate_Longitude
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L67
- metadata:
- uid: PolylineAlgorithm.Coordinate.Longitude
- commentId: P:PolylineAlgorithm.Coordinate.Longitude
-- markdown: Gets the longitude component of the coordinate, in degrees.
-- code: public double Longitude { get; }
-- h4: Property Value
-- parameters:
- - type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
-- h2: Methods
-- api3: Equals(object?)
- id: PolylineAlgorithm_Coordinate_Equals_System_Object_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L82
- metadata:
- uid: PolylineAlgorithm.Coordinate.Equals(System.Object)
- commentId: M:PolylineAlgorithm.Coordinate.Equals(System.Object)
-- markdown: Indicates whether this instance and a specified object are equal.
-- code: public override bool Equals(object? obj)
-- h4: Parameters
-- parameters:
- - name: obj
- type:
- - text: object
- url: https://learn.microsoft.com/dotnet/api/system.object
- - '?'
- description: The object to compare with the current instance.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if obj and this instance are the same type and represent the same value; otherwise, false.
-- api3: Equals(Coordinate)
- id: PolylineAlgorithm_Coordinate_Equals_PolylineAlgorithm_Coordinate_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L102
- metadata:
- uid: PolylineAlgorithm.Coordinate.Equals(PolylineAlgorithm.Coordinate)
- commentId: M:PolylineAlgorithm.Coordinate.Equals(PolylineAlgorithm.Coordinate)
-- markdown: Indicates whether the current object is equal to another object of the same type.
-- code: public bool Equals(Coordinate other)
-- h4: Parameters
-- parameters:
- - name: other
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: An object to compare with this object.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if the current object is equal to the other parameter; otherwise, false.
-- api3: GetHashCode()
- id: PolylineAlgorithm_Coordinate_GetHashCode
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L85
- metadata:
- uid: PolylineAlgorithm.Coordinate.GetHashCode
- commentId: M:PolylineAlgorithm.Coordinate.GetHashCode
-- markdown: Returns the hash code for this instance.
-- code: public override int GetHashCode()
-- h4: Returns
-- parameters:
- - type:
- - text: int
- url: https://learn.microsoft.com/dotnet/api/system.int32
- description: A 32-bit signed integer that is the hash code for this instance.
-- api3: IsDefault()
- id: PolylineAlgorithm_Coordinate_IsDefault
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L75
- metadata:
- uid: PolylineAlgorithm.Coordinate.IsDefault
- commentId: M:PolylineAlgorithm.Coordinate.IsDefault
-- markdown: Determines whether this coordinate is the default value (both and are 0).
-- code: public bool IsDefault()
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if both latitude and longitude are 0; otherwise, false.
-- api3: ToString()
- id: PolylineAlgorithm_Coordinate_ToString
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L93
- metadata:
- uid: PolylineAlgorithm.Coordinate.ToString
- commentId: M:PolylineAlgorithm.Coordinate.ToString
-- markdown: 'Returns a string representation of this coordinate in the format: { Latitude: [double], Longitude: [double] }.'
-- code: public override string ToString()
-- h4: Returns
-- parameters:
- - type:
- - text: string
- url: https://learn.microsoft.com/dotnet/api/system.string
- description: A string representation of the coordinate.
-- h2: Operators
-- api3: operator ==(Coordinate, Coordinate)
- id: PolylineAlgorithm_Coordinate_op_Equality_PolylineAlgorithm_Coordinate_PolylineAlgorithm_Coordinate_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L119
- metadata:
- uid: PolylineAlgorithm.Coordinate.op_Equality(PolylineAlgorithm.Coordinate,PolylineAlgorithm.Coordinate)
- commentId: M:PolylineAlgorithm.Coordinate.op_Equality(PolylineAlgorithm.Coordinate,PolylineAlgorithm.Coordinate)
-- markdown: Determines whether two instances are equal.
-- code: public static bool operator ==(Coordinate left, Coordinate right)
-- h4: Parameters
-- parameters:
- - name: left
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: The first coordinate to compare.
- - name: right
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: The second coordinate to compare.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if both coordinates are equal; otherwise, false.
-- api3: operator !=(Coordinate, Coordinate)
- id: PolylineAlgorithm_Coordinate_op_Inequality_PolylineAlgorithm_Coordinate_PolylineAlgorithm_Coordinate_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Coordinate.cs#L129
- metadata:
- uid: PolylineAlgorithm.Coordinate.op_Inequality(PolylineAlgorithm.Coordinate,PolylineAlgorithm.Coordinate)
- commentId: M:PolylineAlgorithm.Coordinate.op_Inequality(PolylineAlgorithm.Coordinate,PolylineAlgorithm.Coordinate)
-- markdown: Determines whether two instances are not equal.
-- code: public static bool operator !=(Coordinate left, Coordinate right)
-- h4: Parameters
-- parameters:
- - name: left
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: The first coordinate to compare.
- - name: right
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: The second coordinate to compare.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if the coordinates are not equal; otherwise, false.
-languageId: csharp
-metadata:
- description: Represents a geographic coordinate as a pair of latitude and longitude values.
diff --git a/api-reference/1.0/PolylineAlgorithm.CoordinateValueType.yml b/api-reference/1.0/PolylineAlgorithm.CoordinateValueType.yml
deleted file mode 100644
index 775098b4..00000000
--- a/api-reference/1.0/PolylineAlgorithm.CoordinateValueType.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-### YamlMime:ApiPage
-title: Enum CoordinateValueType
-body:
-- api1: Enum CoordinateValueType
- id: PolylineAlgorithm_CoordinateValueType
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/CoordinateValueType.cs#L11
- metadata:
- uid: PolylineAlgorithm.CoordinateValueType
- commentId: T:PolylineAlgorithm.CoordinateValueType
-- facts:
- - name: Namespace
- value:
- text: PolylineAlgorithm
- url: PolylineAlgorithm.html
- - name: Assembly
- value: PolylineAlgorithm.dll
-- markdown: Represents the type of a geographic coordinate value.
-- code: public enum CoordinateValueType
-- h2: Fields
-- parameters:
- - name: Latitude
- default: "1"
- description: >+
- Represents a latitude value.
-
- - name: Longitude
- default: "2"
- description: >+
- Represents a longitude value.
-
- - name: None
- default: "0"
- description: >+
- Represents no specific type. This value is used when the type is not applicable or not specified.
-
-- h2: Remarks
-- markdown: >-
- This enumeration is used to specify whether a coordinate value represents latitude or
-
- longitude. Latitude values indicate the north-south position, while longitude values indicate the east-west
-
- position.
-languageId: csharp
-metadata:
- description: Represents the type of a geographic coordinate value.
diff --git a/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineDecoderExtensions.yml b/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineDecoderExtensions.yml
index 086af359..4b97f584 100644
--- a/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineDecoderExtensions.yml
+++ b/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineDecoderExtensions.yml
@@ -3,7 +3,7 @@ title: Class PolylineDecoderExtensions
body:
- api1: Class PolylineDecoderExtensions
id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L16
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L16
metadata:
uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions
commentId: T:PolylineAlgorithm.Extensions.PolylineDecoderExtensions
@@ -39,14 +39,14 @@ body:
- text: object.ToString()
url: https://learn.microsoft.com/dotnet/api/system.object.tostring
- h2: Methods
-- api3: Decode(IPolylineDecoder, string)
- id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode_PolylineAlgorithm_Abstraction_IPolylineDecoder_PolylineAlgorithm_Polyline_PolylineAlgorithm_Coordinate__System_String_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L32
+- api3: Decode(IPolylineDecoder, char[])
+ id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode__1_PolylineAlgorithm_Abstraction_IPolylineDecoder_System_String___0__System_Char___
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L33
metadata:
- uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode(PolylineAlgorithm.Abstraction.IPolylineDecoder{PolylineAlgorithm.Polyline,PolylineAlgorithm.Coordinate},System.String)
- commentId: M:PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode(PolylineAlgorithm.Abstraction.IPolylineDecoder{PolylineAlgorithm.Polyline,PolylineAlgorithm.Coordinate},System.String)
-- markdown: Decodes an encoded polyline string into a sequence of geographic coordinates.
-- code: public static IEnumerable Decode(this IPolylineDecoder decoder, string polyline)
+ uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode``1(PolylineAlgorithm.Abstraction.IPolylineDecoder{System.String,``0},System.Char[])
+ commentId: M:PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode``1(PolylineAlgorithm.Abstraction.IPolylineDecoder{System.String,``0},System.Char[])
+- markdown: Decodes an encoded polyline represented as a character array into a sequence of geographic coordinates.
+- code: public static IEnumerable Decode(this IPolylineDecoder decoder, char[] polyline)
- h4: Parameters
- parameters:
- name: decoder
@@ -54,43 +54,47 @@ body:
- text: IPolylineDecoder
url: PolylineAlgorithm.Abstraction.IPolylineDecoder-2.html
- <
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
- ','
- " "
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TValue
- '>'
description: The instance used to perform the decoding operation.
- name: polyline
type:
- - text: string
- url: https://learn.microsoft.com/dotnet/api/system.string
- description: The encoded polyline string to decode.
+ - text: char
+ url: https://learn.microsoft.com/dotnet/api/system.char
+ - '['
+ - ']'
+ description: The encoded polyline as a character array to decode. The array is converted to a string internally.
- h4: Returns
- parameters:
- type:
- text: IEnumerable
url: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1
- <
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TValue
- '>'
- description: An containing the decoded latitude and longitude pairs.
+ description: An of TValue containing the decoded coordinate pairs.
+- h4: Type Parameters
+- parameters:
+ - name: TValue
+ description: The coordinate type returned by the decoder.
- h4: Exceptions
- parameters:
- type:
- text: ArgumentNullException
url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when decoder is null.
-- api3: Decode(IPolylineDecoder, char[])
- id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode_PolylineAlgorithm_Abstraction_IPolylineDecoder_PolylineAlgorithm_Polyline_PolylineAlgorithm_Coordinate__System_Char___
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L55
+ description: Thrown when decoder or polyline is null.
+- api3: Decode(IPolylineDecoder, ReadOnlyMemory)
+ id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode__1_PolylineAlgorithm_Abstraction_IPolylineDecoder_System_String___0__System_ReadOnlyMemory_System_Char__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L61
metadata:
- uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode(PolylineAlgorithm.Abstraction.IPolylineDecoder{PolylineAlgorithm.Polyline,PolylineAlgorithm.Coordinate},System.Char[])
- commentId: M:PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode(PolylineAlgorithm.Abstraction.IPolylineDecoder{PolylineAlgorithm.Polyline,PolylineAlgorithm.Coordinate},System.Char[])
-- markdown: Decodes an encoded polyline represented as a character array into a sequence of geographic coordinates.
-- code: public static IEnumerable Decode(this IPolylineDecoder decoder, char[] polyline)
+ uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode``1(PolylineAlgorithm.Abstraction.IPolylineDecoder{System.String,``0},System.ReadOnlyMemory{System.Char})
+ commentId: M:PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode``1(PolylineAlgorithm.Abstraction.IPolylineDecoder{System.String,``0},System.ReadOnlyMemory{System.Char})
+- markdown: Decodes an encoded polyline represented as a read-only memory of characters into a sequence of geographic coordinates.
+- code: public static IEnumerable Decode(this IPolylineDecoder decoder, ReadOnlyMemory polyline)
- h4: Parameters
- parameters:
- name: decoder
@@ -98,45 +102,52 @@ body:
- text: IPolylineDecoder
url: PolylineAlgorithm.Abstraction.IPolylineDecoder-2.html
- <
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
- ','
- " "
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TValue
- '>'
description: The instance used to perform the decoding operation.
- name: polyline
type:
+ - text: ReadOnlyMemory
+ url: https://learn.microsoft.com/dotnet/api/system.readonlymemory-1
+ - <
- text: char
url: https://learn.microsoft.com/dotnet/api/system.char
- - '['
- - ']'
- description: The encoded polyline as a character array to decode.
+ - '>'
+ description: The encoded polyline as a read-only memory of characters to decode. The memory is converted to a string internally.
- h4: Returns
- parameters:
- type:
- text: IEnumerable
url: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1
- <
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TValue
- '>'
- description: An containing the decoded latitude and longitude pairs.
+ description: An of TValue containing the decoded coordinate pairs.
+- h4: Type Parameters
+- parameters:
+ - name: TValue
+ description: The coordinate type returned by the decoder.
- h4: Exceptions
- parameters:
- type:
- text: ArgumentNullException
url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
description: Thrown when decoder is null.
-- api3: Decode(IPolylineDecoder, ReadOnlyMemory)
- id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode_PolylineAlgorithm_Abstraction_IPolylineDecoder_PolylineAlgorithm_Polyline_PolylineAlgorithm_Coordinate__System_ReadOnlyMemory_System_Char__
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L78
+- api3: Decode(IPolylineDecoder, TValue>, string)
+ id: PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode__1_PolylineAlgorithm_Abstraction_IPolylineDecoder_System_ReadOnlyMemory_System_Char____0__System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineDecoderExtensions.cs#L86
metadata:
- uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode(PolylineAlgorithm.Abstraction.IPolylineDecoder{PolylineAlgorithm.Polyline,PolylineAlgorithm.Coordinate},System.ReadOnlyMemory{System.Char})
- commentId: M:PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode(PolylineAlgorithm.Abstraction.IPolylineDecoder{PolylineAlgorithm.Polyline,PolylineAlgorithm.Coordinate},System.ReadOnlyMemory{System.Char})
-- markdown: Decodes an encoded polyline represented as a read-only memory of characters into a sequence of geographic coordinates.
-- code: public static IEnumerable Decode(this IPolylineDecoder decoder, ReadOnlyMemory polyline)
+ uid: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode``1(PolylineAlgorithm.Abstraction.IPolylineDecoder{System.ReadOnlyMemory{System.Char},``0},System.String)
+ commentId: M:PolylineAlgorithm.Extensions.PolylineDecoderExtensions.Decode``1(PolylineAlgorithm.Abstraction.IPolylineDecoder{System.ReadOnlyMemory{System.Char},``0},System.String)
+- markdown: >-
+ Decodes an encoded polyline string into a sequence of geographic coordinates,
+
+ using a decoder that accepts of .
+- code: public static IEnumerable Decode(this IPolylineDecoder, TValue> decoder, string polyline)
- h4: Parameters
- parameters:
- name: decoder
@@ -144,39 +155,41 @@ body:
- text: IPolylineDecoder
url: PolylineAlgorithm.Abstraction.IPolylineDecoder-2.html
- <
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- - ','
- - " "
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- - '>'
- description: The instance used to perform the decoding operation.
- - name: polyline
- type:
- text: ReadOnlyMemory
url: https://learn.microsoft.com/dotnet/api/system.readonlymemory-1
- <
- text: char
url: https://learn.microsoft.com/dotnet/api/system.char
- '>'
- description: The encoded polyline as a read-only memory of characters to decode.
+ - ','
+ - " "
+ - TValue
+ - '>'
+ description: The instance used to perform the decoding operation.
+ - name: polyline
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: The encoded polyline string to decode. The string is converted to internally.
- h4: Returns
- parameters:
- type:
- text: IEnumerable
url: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1
- <
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TValue
- '>'
- description: An containing the decoded latitude and longitude pairs.
+ description: An of TValue containing the decoded coordinate pairs.
+- h4: Type Parameters
+- parameters:
+ - name: TValue
+ description: The coordinate type returned by the decoder.
- h4: Exceptions
- parameters:
- type:
- text: ArgumentNullException
url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when decoder is null.
+ description: Thrown when decoder or polyline is null.
languageId: csharp
metadata:
description: Provides extension methods for the interface to facilitate decoding encoded polylines.
diff --git a/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineEncoderExtensions.yml b/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineEncoderExtensions.yml
index 767322e4..aeba23f9 100644
--- a/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineEncoderExtensions.yml
+++ b/api-reference/1.0/PolylineAlgorithm.Extensions.PolylineEncoderExtensions.yml
@@ -3,7 +3,7 @@ title: Class PolylineEncoderExtensions
body:
- api1: Class PolylineEncoderExtensions
id: PolylineAlgorithm_Extensions_PolylineEncoderExtensions
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs#L16
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs#L19
metadata:
uid: PolylineAlgorithm.Extensions.PolylineEncoderExtensions
commentId: T:PolylineAlgorithm.Extensions.PolylineEncoderExtensions
@@ -39,14 +39,19 @@ body:
- text: object.ToString()
url: https://learn.microsoft.com/dotnet/api/system.object.tostring
- h2: Methods
-- api3: Encode(IPolylineEncoder, ICollection)
- id: PolylineAlgorithm_Extensions_PolylineEncoderExtensions_Encode_PolylineAlgorithm_Abstraction_IPolylineEncoder_PolylineAlgorithm_Coordinate_PolylineAlgorithm_Polyline__System_Collections_Generic_ICollection_PolylineAlgorithm_Coordinate__
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs#L32
+- api3: Encode(IPolylineEncoder, List)
+ id: PolylineAlgorithm_Extensions_PolylineEncoderExtensions_Encode__2_PolylineAlgorithm_Abstraction_IPolylineEncoder___0___1__System_Collections_Generic_List___0__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs#L37
metadata:
- uid: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode(PolylineAlgorithm.Abstraction.IPolylineEncoder{PolylineAlgorithm.Coordinate,PolylineAlgorithm.Polyline},System.Collections.Generic.ICollection{PolylineAlgorithm.Coordinate})
- commentId: M:PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode(PolylineAlgorithm.Abstraction.IPolylineEncoder{PolylineAlgorithm.Coordinate,PolylineAlgorithm.Polyline},System.Collections.Generic.ICollection{PolylineAlgorithm.Coordinate})
-- markdown: Encodes a collection of instances into an encoded polyline.
-- code: public static Polyline Encode(this IPolylineEncoder encoder, ICollection coordinates)
+ uid: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode``2(PolylineAlgorithm.Abstraction.IPolylineEncoder{``0,``1},System.Collections.Generic.List{``0})
+ commentId: M:PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode``2(PolylineAlgorithm.Abstraction.IPolylineEncoder{``0,``1},System.Collections.Generic.List{``0})
+- markdown: Encodes a of TCoordinate instances into an encoded polyline.
+- code: >-
+ [SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "We need a list as we do need to marshal it as span.")]
+
+ [SuppressMessage("Design", "MA0016:Prefer using collection abstraction instead of implementation", Justification = "We need a list as we do need to marshal it as span.")]
+
+ public static TPolyline Encode(this IPolylineEncoder encoder, List coordinates)
- h4: Parameters
- parameters:
- name: encoder
@@ -54,43 +59,45 @@ body:
- text: IPolylineEncoder
url: PolylineAlgorithm.Abstraction.IPolylineEncoder-2.html
- <
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TCoordinate
- ','
- " "
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
+ - TPolyline
- '>'
description: The instance used to perform the encoding operation.
- name: coordinates
type:
- - text: ICollection
- url: https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1
+ - text: List
+ url: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1
- <
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TCoordinate
- '>'
- description: The sequence of objects to encode.
+ description: The list of TCoordinate objects to encode.
- h4: Returns
- parameters:
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: A representing the encoded polyline string for the provided coordinates.
+ - TPolyline
+ description: A TPolyline instance representing the encoded polyline for the provided coordinates.
+- h4: Type Parameters
+- parameters:
+ - name: TCoordinate
+ description: The type that represents a geographic coordinate to encode.
+ - name: TPolyline
+ description: The type that represents the encoded polyline output.
- h4: Exceptions
- parameters:
- type:
- text: ArgumentNullException
url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when encoder is null.
-- api3: Encode(IPolylineEncoder, Coordinate[])
- id: PolylineAlgorithm_Extensions_PolylineEncoderExtensions_Encode_PolylineAlgorithm_Abstraction_IPolylineEncoder_PolylineAlgorithm_Coordinate_PolylineAlgorithm_Polyline__PolylineAlgorithm_Coordinate___
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs#L55
+ description: Thrown when encoder or coordinates is null.
+- api3: Encode(IPolylineEncoder, TCoordinate[])
+ id: PolylineAlgorithm_Extensions_PolylineEncoderExtensions_Encode__2_PolylineAlgorithm_Abstraction_IPolylineEncoder___0___1____0___
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Extensions/PolylineEncoderExtensions.cs#L73
metadata:
- uid: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode(PolylineAlgorithm.Abstraction.IPolylineEncoder{PolylineAlgorithm.Coordinate,PolylineAlgorithm.Polyline},PolylineAlgorithm.Coordinate[])
- commentId: M:PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode(PolylineAlgorithm.Abstraction.IPolylineEncoder{PolylineAlgorithm.Coordinate,PolylineAlgorithm.Polyline},PolylineAlgorithm.Coordinate[])
-- markdown: Encodes an array of instances into an encoded polyline.
-- code: public static Polyline Encode(this IPolylineEncoder encoder, Coordinate[] coordinates)
+ uid: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode``2(PolylineAlgorithm.Abstraction.IPolylineEncoder{``0,``1},``0[])
+ commentId: M:PolylineAlgorithm.Extensions.PolylineEncoderExtensions.Encode``2(PolylineAlgorithm.Abstraction.IPolylineEncoder{``0,``1},``0[])
+- markdown: Encodes an array of TCoordinate instances into an encoded polyline.
+- code: public static TPolyline Encode(this IPolylineEncoder encoder, TCoordinate[] coordinates)
- h4: Parameters
- parameters:
- name: encoder
@@ -98,33 +105,35 @@ body:
- text: IPolylineEncoder
url: PolylineAlgorithm.Abstraction.IPolylineEncoder-2.html
- <
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TCoordinate
- ','
- " "
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
+ - TPolyline
- '>'
description: The instance used to perform the encoding operation.
- name: coordinates
type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
+ - TCoordinate
- '['
- ']'
- description: The array of objects to encode.
+ description: The array of TCoordinate objects to encode.
- h4: Returns
- parameters:
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: A representing the encoded polyline string for the provided coordinates.
+ - TPolyline
+ description: A TPolyline instance representing the encoded polyline for the provided coordinates.
+- h4: Type Parameters
+- parameters:
+ - name: TCoordinate
+ description: The type that represents a geographic coordinate to encode.
+ - name: TPolyline
+ description: The type that represents the encoded polyline output.
- h4: Exceptions
- parameters:
- type:
- text: ArgumentNullException
url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when encoder is null.
+ description: Thrown when encoder or coordinates is null.
languageId: csharp
metadata:
description: Provides extension methods for the interface to facilitate encoding geographic coordinates into polylines.
diff --git a/api-reference/1.0/PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.yml b/api-reference/1.0/PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.yml
new file mode 100644
index 00000000..45962074
--- /dev/null
+++ b/api-reference/1.0/PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.yml
@@ -0,0 +1,313 @@
+### YamlMime:ApiPage
+title: Class ExceptionGuard
+body:
+- api1: Class ExceptionGuard
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L29
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard
+ commentId: T:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard
+- facts:
+ - name: Namespace
+ value:
+ text: PolylineAlgorithm.Internal.Diagnostics
+ url: PolylineAlgorithm.Internal.Diagnostics.html
+ - name: Assembly
+ value: PolylineAlgorithm.dll
+- markdown: Centralizes exception throwing for common validation and error scenarios used across the library.
+- code: public static class ExceptionGuard
+- h4: Inheritance
+- inheritance:
+ - text: object
+ url: https://learn.microsoft.com/dotnet/api/system.object
+ - text: ExceptionGuard
+ url: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.html
+- h4: Inherited Members
+- list:
+ - text: object.Equals(object)
+ url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
+ - text: object.Equals(object, object)
+ url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
+ - text: object.GetHashCode()
+ url: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
+ - text: object.GetType()
+ url: https://learn.microsoft.com/dotnet/api/system.object.gettype
+ - text: object.MemberwiseClone()
+ url: https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone
+ - text: object.ReferenceEquals(object, object)
+ url: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
+ - text: object.ToString()
+ url: https://learn.microsoft.com/dotnet/api/system.object.tostring
+- h2: Remarks
+- markdown: >-
+ Methods in this class are intentionally small and annotated so that they can act as single
+
+ call sites for throwing exceptions (improving inlining and stack traces). Many members have
+
+ attributes to avoid polluting callers' stack traces (__StackTraceHidden__ on supported targets)
+
+ or to prevent inlining on older targets.
+- h2: Methods
+- api3: StackAllocLimitMustBeEqualOrGreaterThan(int, string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_StackAllocLimitMustBeEqualOrGreaterThan_System_Int32_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L97
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.StackAllocLimitMustBeEqualOrGreaterThan(System.Int32,System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.StackAllocLimitMustBeEqualOrGreaterThan(System.Int32,System.String)
+- markdown: Throws an when a stack allocation limit is below the required minimum.
+- code: >-
+ [DoesNotReturn]
+
+ public static void StackAllocLimitMustBeEqualOrGreaterThan(int minValue, string paramName)
+- h4: Parameters
+- parameters:
+ - name: minValue
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: Minimum required stack allocation limit.
+ - name: paramName
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Name of the parameter representing the limit.
+- api3: ThrowArgumentCannotBeEmptyEnumerationMessage(string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowArgumentCannotBeEmptyEnumerationMessage_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L111
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowArgumentCannotBeEmptyEnumerationMessage(System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowArgumentCannotBeEmptyEnumerationMessage(System.String)
+- markdown: Throws an when an enumeration argument is empty but must contain at least one element.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowArgumentCannotBeEmptyEnumerationMessage(string paramName)
+- h4: Parameters
+- parameters:
+ - name: paramName
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Name of the parameter representing the enumeration.
+- api3: ThrowArgumentNull(string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowArgumentNull_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L51
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowArgumentNull(System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowArgumentNull(System.String)
+- markdown: Throws an for a null argument.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowArgumentNull(string paramName)
+- h4: Parameters
+- parameters:
+ - name: paramName
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Name of the parameter that was null.
+- api3: ThrowBufferOverflow(string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowBufferOverflow_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L65
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowBufferOverflow(System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowBufferOverflow(System.String)
+- markdown: Throws an with a provided message.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowBufferOverflow(string message)
+- h4: Parameters
+- parameters:
+ - name: message
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Message that describes the overflow condition.
+- api3: ThrowCoordinateValueOutOfRange(double, double, double, string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowCoordinateValueOutOfRange_System_Double_System_Double_System_Double_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L82
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowCoordinateValueOutOfRange(System.Double,System.Double,System.Double,System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowCoordinateValueOutOfRange(System.Double,System.Double,System.Double,System.String)
+- markdown: Throws an when a coordinate value is outside the allowed range.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowCoordinateValueOutOfRange(double value, double min, double max, string paramName)
+- h4: Parameters
+- parameters:
+ - name: value
+ type:
+ - text: double
+ url: https://learn.microsoft.com/dotnet/api/system.double
+ description: The coordinate value that was out of range.
+ - name: min
+ type:
+ - text: double
+ url: https://learn.microsoft.com/dotnet/api/system.double
+ description: Inclusive minimum allowed value.
+ - name: max
+ type:
+ - text: double
+ url: https://learn.microsoft.com/dotnet/api/system.double
+ description: Inclusive maximum allowed value.
+ - name: paramName
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Name of the parameter containing the coordinate.
+- api3: ThrowCouldNotWriteEncodedValueToBuffer()
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowCouldNotWriteEncodedValueToBuffer
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L124
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowCouldNotWriteEncodedValueToBuffer
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowCouldNotWriteEncodedValueToBuffer
+- markdown: Throws an when an encoded value could not be written to the destination buffer.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowCouldNotWriteEncodedValueToBuffer()
+- api3: ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(int, int, string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_System_Int32_System_Int32_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L140
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(System.Int32,System.Int32,System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(System.Int32,System.Int32,System.String)
+- markdown: Throws an when a destination array is not large enough to contain the polyline data.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength(int destinationLength, int polylineLength, string paramName)
+- h4: Parameters
+- parameters:
+ - name: destinationLength
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: The length of the destination array.
+ - name: polylineLength
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: The required polyline length.
+ - name: paramName
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Name of the parameter representing the destination array.
+- api3: ThrowInvalidPolylineBlockTerminator()
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowInvalidPolylineBlockTerminator
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L212
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineBlockTerminator
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineBlockTerminator
+- markdown: Throws an when the polyline block terminator is invalid.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowInvalidPolylineBlockTerminator()
+- api3: ThrowInvalidPolylineCharacter(char, int)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowInvalidPolylineCharacter_System_Char_System_Int32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L171
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineCharacter(System.Char,System.Int32)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineCharacter(System.Char,System.Int32)
+- markdown: Throws an when an unexpected character is encountered in the polyline.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowInvalidPolylineCharacter(char character, int position)
+- h4: Parameters
+- parameters:
+ - name: character
+ type:
+ - text: char
+ url: https://learn.microsoft.com/dotnet/api/system.char
+ description: The invalid character.
+ - name: position
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: Position in the polyline where the character was found.
+- api3: ThrowInvalidPolylineFormat(long)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowInvalidPolylineFormat_System_Int64_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L199
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineFormat(System.Int64)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineFormat(System.Int64)
+- markdown: Throws an when the polyline format is malformed.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowInvalidPolylineFormat(long position)
+- h4: Parameters
+- parameters:
+ - name: position
+ type:
+ - text: long
+ url: https://learn.microsoft.com/dotnet/api/system.int64
+ description: Approximate position where the polyline became malformed.
+- api3: ThrowInvalidPolylineLength(int, int)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowInvalidPolylineLength_System_Int32_System_Int32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L156
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineLength(System.Int32,System.Int32)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowInvalidPolylineLength(System.Int32,System.Int32)
+- markdown: Throws an when the polyline length is invalid.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowInvalidPolylineLength(int length, int min)
+- h4: Parameters
+- parameters:
+ - name: length
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: The invalid length.
+ - name: min
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: The minimum required length.
+- api3: ThrowNotFiniteNumber(string)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowNotFiniteNumber_System_String_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L37
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowNotFiniteNumber(System.String)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowNotFiniteNumber(System.String)
+- markdown: Throws an when a numeric argument is not a finite value.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowNotFiniteNumber(string paramName)
+- h4: Parameters
+- parameters:
+ - name: paramName
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: Name of the parameter that had a non-finite value.
+- api3: ThrowPolylineBlockTooLong(int)
+ id: PolylineAlgorithm_Internal_Diagnostics_ExceptionGuard_ThrowPolylineBlockTooLong_System_Int32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs#L185
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowPolylineBlockTooLong(System.Int32)
+ commentId: M:PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.ThrowPolylineBlockTooLong(System.Int32)
+- markdown: Throws an when a polyline block is longer than allowed.
+- code: >-
+ [DoesNotReturn]
+
+ public static void ThrowPolylineBlockTooLong(int position)
+- h4: Parameters
+- parameters:
+ - name: position
+ type:
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ description: Position in the polyline where the block exceeded the allowed length.
+languageId: csharp
+metadata:
+ description: Centralizes exception throwing for common validation and error scenarios used across the library.
diff --git a/api-reference/1.0/PolylineAlgorithm.Internal.Diagnostics.yml b/api-reference/1.0/PolylineAlgorithm.Internal.Diagnostics.yml
new file mode 100644
index 00000000..dabb499a
--- /dev/null
+++ b/api-reference/1.0/PolylineAlgorithm.Internal.Diagnostics.yml
@@ -0,0 +1,15 @@
+### YamlMime:ApiPage
+title: Namespace PolylineAlgorithm.Internal.Diagnostics
+body:
+- api1: Namespace PolylineAlgorithm.Internal.Diagnostics
+ id: PolylineAlgorithm_Internal_Diagnostics
+ metadata:
+ uid: PolylineAlgorithm.Internal.Diagnostics
+ commentId: N:PolylineAlgorithm.Internal.Diagnostics
+- h3: Classes
+- parameters:
+ - type:
+ text: ExceptionGuard
+ url: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.html
+ description: Centralizes exception throwing for common validation and error scenarios used across the library.
+languageId: csharp
diff --git a/api-reference/1.0/PolylineAlgorithm.InvalidPolylineException.yml b/api-reference/1.0/PolylineAlgorithm.InvalidPolylineException.yml
index fd2c31fe..b776c617 100644
--- a/api-reference/1.0/PolylineAlgorithm.InvalidPolylineException.yml
+++ b/api-reference/1.0/PolylineAlgorithm.InvalidPolylineException.yml
@@ -3,7 +3,7 @@ title: Class InvalidPolylineException
body:
- api1: Class InvalidPolylineException
id: PolylineAlgorithm_InvalidPolylineException
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/InvalidPolylineException.cs#L19
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/InvalidPolylineException.cs#L17
metadata:
uid: PolylineAlgorithm.InvalidPolylineException
commentId: T:PolylineAlgorithm.InvalidPolylineException
@@ -15,10 +15,7 @@ body:
- name: Assembly
value: PolylineAlgorithm.dll
- markdown: Exception thrown when a polyline is determined to be malformed or invalid during processing.
-- code: >-
- [SuppressMessage("Design", "CA1032:Implement standard exception constructors", Justification = "Internal use only.")]
-
- public sealed class InvalidPolylineException : Exception, ISerializable
+- code: 'public sealed class InvalidPolylineException : Exception, ISerializable'
- h4: Inheritance
- inheritance:
- text: object
@@ -71,6 +68,35 @@ body:
url: https://learn.microsoft.com/dotnet/api/system.object.tostring
- h2: Remarks
- markdown: This exception is used internally to indicate that a polyline string does not conform to the expected format or contains errors.
+- h2: Constructors
+- api3: InvalidPolylineException()
+ id: PolylineAlgorithm_InvalidPolylineException__ctor
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/InvalidPolylineException.cs#L22
+ metadata:
+ uid: PolylineAlgorithm.InvalidPolylineException.#ctor
+ commentId: M:PolylineAlgorithm.InvalidPolylineException.#ctor
+- markdown: Initializes a new instance of the class.
+- code: public InvalidPolylineException()
+- api3: InvalidPolylineException(string, Exception)
+ id: PolylineAlgorithm_InvalidPolylineException__ctor_System_String_System_Exception_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/InvalidPolylineException.cs#L43
+ metadata:
+ uid: PolylineAlgorithm.InvalidPolylineException.#ctor(System.String,System.Exception)
+ commentId: M:PolylineAlgorithm.InvalidPolylineException.#ctor(System.String,System.Exception)
+- markdown: Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.
+- code: public InvalidPolylineException(string message, Exception innerException)
+- h4: Parameters
+- parameters:
+ - name: message
+ type:
+ - text: string
+ url: https://learn.microsoft.com/dotnet/api/system.string
+ description: The error message that explains the reason for the exception.
+ - name: innerException
+ type:
+ - text: Exception
+ url: https://learn.microsoft.com/dotnet/api/system.exception
+ description: The exception that is the cause of the current exception, or a null reference if no inner exception is specified.
languageId: csharp
metadata:
description: Exception thrown when a polyline is determined to be malformed or invalid during processing.
diff --git a/api-reference/1.0/PolylineAlgorithm.Polyline.yml b/api-reference/1.0/PolylineAlgorithm.Polyline.yml
deleted file mode 100644
index 5da10f97..00000000
--- a/api-reference/1.0/PolylineAlgorithm.Polyline.yml
+++ /dev/null
@@ -1,315 +0,0 @@
-### YamlMime:ApiPage
-title: Struct Polyline
-body:
-- api1: Struct Polyline
- id: PolylineAlgorithm_Polyline
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L20
- metadata:
- uid: PolylineAlgorithm.Polyline
- commentId: T:PolylineAlgorithm.Polyline
-- facts:
- - name: Namespace
- value:
- text: PolylineAlgorithm
- url: PolylineAlgorithm.html
- - name: Assembly
- value: PolylineAlgorithm.dll
-- markdown: >-
- Represents an immutable, read-only encoded polyline string.
-
- Provides methods for creation, inspection, and conversion of polyline data from various character sources.
-- code: 'public readonly struct Polyline : IEquatable'
-- h4: Implements
-- list:
- - text: IEquatable
- url: https://learn.microsoft.com/dotnet/api/system.iequatable-1
-- h4: Inherited Members
-- list:
- - text: object.Equals(object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
- - text: object.Equals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
- - text: object.GetHashCode()
- url: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- - text: object.GetType()
- url: https://learn.microsoft.com/dotnet/api/system.object.gettype
- - text: object.ReferenceEquals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- - text: object.ToString()
- url: https://learn.microsoft.com/dotnet/api/system.object.tostring
-- h2: Remarks
-- markdown: This struct is designed to be lightweight and efficient, allowing for quick comparisons and memory-safe operations.
-- h2: Constructors
-- api3: Polyline()
- id: PolylineAlgorithm_Polyline__ctor
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L28
- metadata:
- uid: PolylineAlgorithm.Polyline.#ctor
- commentId: M:PolylineAlgorithm.Polyline.#ctor
-- markdown: Initializes a new, empty instance of the struct.
-- code: public Polyline()
-- h2: Properties
-- api3: IsEmpty
- id: PolylineAlgorithm_Polyline_IsEmpty
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L50
- metadata:
- uid: PolylineAlgorithm.Polyline.IsEmpty
- commentId: P:PolylineAlgorithm.Polyline.IsEmpty
-- markdown: Gets a value indicating whether this is empty.
-- code: public bool IsEmpty { get; }
-- h4: Property Value
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
-- api3: Length
- id: PolylineAlgorithm_Polyline_Length
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L55
- metadata:
- uid: PolylineAlgorithm.Polyline.Length
- commentId: P:PolylineAlgorithm.Polyline.Length
-- markdown: Gets the length of the polyline in characters.
-- code: public long Length { get; }
-- h4: Property Value
-- parameters:
- - type:
- - text: long
- url: https://learn.microsoft.com/dotnet/api/system.int64
-- h2: Methods
-- api3: CopyTo(char[])
- id: PolylineAlgorithm_Polyline_CopyTo_System_Char___
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L69
- metadata:
- uid: PolylineAlgorithm.Polyline.CopyTo(System.Char[])
- commentId: M:PolylineAlgorithm.Polyline.CopyTo(System.Char[])
-- markdown: Copies the characters of this polyline to the specified destination array.
-- code: public void CopyTo(char[] destination)
-- h4: Parameters
-- parameters:
- - name: destination
- type:
- - text: char
- url: https://learn.microsoft.com/dotnet/api/system.char
- - '['
- - ']'
- description: The destination array to copy the characters to.
-- h4: Exceptions
-- parameters:
- - type:
- - text: ArgumentNullException
- url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when destination is null.
- - type:
- - text: ArgumentException
- url: https://learn.microsoft.com/dotnet/api/system.argumentexception
- description: Thrown when the length of destination does not match the polyline's length.
-- api3: Equals(Polyline)
- id: PolylineAlgorithm_Polyline_Equals_PolylineAlgorithm_Polyline_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L110
- metadata:
- uid: PolylineAlgorithm.Polyline.Equals(PolylineAlgorithm.Polyline)
- commentId: M:PolylineAlgorithm.Polyline.Equals(PolylineAlgorithm.Polyline)
-- markdown: Indicates whether the current object is equal to another object of the same type.
-- code: public bool Equals(Polyline other)
-- h4: Parameters
-- parameters:
- - name: other
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: An object to compare with this object.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if the current object is equal to the other parameter; otherwise, false.
-- api3: Equals(object)
- id: PolylineAlgorithm_Polyline_Equals_System_Object_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L119
- metadata:
- uid: PolylineAlgorithm.Polyline.Equals(System.Object)
- commentId: M:PolylineAlgorithm.Polyline.Equals(System.Object)
-- markdown: Indicates whether this instance and a specified object are equal.
-- code: public override bool Equals(object obj)
-- h4: Parameters
-- parameters:
- - name: obj
- type:
- - text: object
- url: https://learn.microsoft.com/dotnet/api/system.object
- description: The object to compare with the current instance.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if obj and this instance are the same type and represent the same value; otherwise, false.
-- api3: FromCharArray(char[])
- id: PolylineAlgorithm_Polyline_FromCharArray_System_Char___
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L168
- metadata:
- uid: PolylineAlgorithm.Polyline.FromCharArray(System.Char[])
- commentId: M:PolylineAlgorithm.Polyline.FromCharArray(System.Char[])
-- markdown: Creates a from a Unicode character array.
-- code: public static Polyline FromCharArray(char[] polyline)
-- h4: Parameters
-- parameters:
- - name: polyline
- type:
- - text: char
- url: https://learn.microsoft.com/dotnet/api/system.char
- - '['
- - ']'
- description: A character array representing an encoded polyline.
-- h4: Returns
-- parameters:
- - type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The instance corresponding to the specified character array.
-- h4: Exceptions
-- parameters:
- - type:
- - text: ArgumentNullException
- url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when polyline is null.
-- api3: FromMemory(ReadOnlyMemory)
- id: PolylineAlgorithm_Polyline_FromMemory_System_ReadOnlyMemory_System_Char__
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L205
- metadata:
- uid: PolylineAlgorithm.Polyline.FromMemory(System.ReadOnlyMemory{System.Char})
- commentId: M:PolylineAlgorithm.Polyline.FromMemory(System.ReadOnlyMemory{System.Char})
-- markdown: Creates a from a read-only memory region of characters.
-- code: public static Polyline FromMemory(ReadOnlyMemory polyline)
-- h4: Parameters
-- parameters:
- - name: polyline
- type:
- - text: ReadOnlyMemory
- url: https://learn.microsoft.com/dotnet/api/system.readonlymemory-1
- - <
- - text: char
- url: https://learn.microsoft.com/dotnet/api/system.char
- - '>'
- description: A read-only memory region representing an encoded polyline.
-- h4: Returns
-- parameters:
- - type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The instance corresponding to the specified memory region.
-- api3: FromString(string)
- id: PolylineAlgorithm_Polyline_FromString_System_String_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L188
- metadata:
- uid: PolylineAlgorithm.Polyline.FromString(System.String)
- commentId: M:PolylineAlgorithm.Polyline.FromString(System.String)
-- markdown: Creates a from a string.
-- code: public static Polyline FromString(string polyline)
-- h4: Parameters
-- parameters:
- - name: polyline
- type:
- - text: string
- url: https://learn.microsoft.com/dotnet/api/system.string
- description: A string representing an encoded polyline.
-- h4: Returns
-- parameters:
- - type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The instance corresponding to the specified string.
-- h4: Exceptions
-- parameters:
- - type:
- - text: ArgumentNullException
- url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when polyline is null.
-- api3: GetHashCode()
- id: PolylineAlgorithm_Polyline_GetHashCode
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L124
- metadata:
- uid: PolylineAlgorithm.Polyline.GetHashCode
- commentId: M:PolylineAlgorithm.Polyline.GetHashCode
-- markdown: Returns the hash code for this instance.
-- code: public override int GetHashCode()
-- h4: Returns
-- parameters:
- - type:
- - text: int
- url: https://learn.microsoft.com/dotnet/api/system.int32
- description: A 32-bit signed integer that is the hash code for this instance.
-- api3: ToString()
- id: PolylineAlgorithm_Polyline_ToString
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L87
- metadata:
- uid: PolylineAlgorithm.Polyline.ToString
- commentId: M:PolylineAlgorithm.Polyline.ToString
-- markdown: Returns a string representation of the polyline.
-- code: public override string ToString()
-- h4: Returns
-- parameters:
- - type:
- - text: string
- url: https://learn.microsoft.com/dotnet/api/system.string
- description: A string containing the characters of the polyline, or an empty string if the polyline is empty.
-- h2: Operators
-- api3: operator ==(Polyline, Polyline)
- id: PolylineAlgorithm_Polyline_op_Equality_PolylineAlgorithm_Polyline_PolylineAlgorithm_Polyline_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L140
- metadata:
- uid: PolylineAlgorithm.Polyline.op_Equality(PolylineAlgorithm.Polyline,PolylineAlgorithm.Polyline)
- commentId: M:PolylineAlgorithm.Polyline.op_Equality(PolylineAlgorithm.Polyline,PolylineAlgorithm.Polyline)
-- markdown: Determines whether two instances are equal.
-- code: public static bool operator ==(Polyline left, Polyline right)
-- h4: Parameters
-- parameters:
- - name: left
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The first polyline to compare.
- - name: right
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The second polyline to compare.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if the polylines are equal; otherwise, false.
-- api3: operator !=(Polyline, Polyline)
- id: PolylineAlgorithm_Polyline_op_Inequality_PolylineAlgorithm_Polyline_PolylineAlgorithm_Polyline_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/Polyline.cs#L150
- metadata:
- uid: PolylineAlgorithm.Polyline.op_Inequality(PolylineAlgorithm.Polyline,PolylineAlgorithm.Polyline)
- commentId: M:PolylineAlgorithm.Polyline.op_Inequality(PolylineAlgorithm.Polyline,PolylineAlgorithm.Polyline)
-- markdown: Determines whether two instances are not equal.
-- code: public static bool operator !=(Polyline left, Polyline right)
-- h4: Parameters
-- parameters:
- - name: left
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The first polyline to compare.
- - name: right
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The second polyline to compare.
-- h4: Returns
-- parameters:
- - type:
- - text: bool
- url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if the polylines are not equal; otherwise, false.
-languageId: csharp
-metadata:
- description: >-
- Represents an immutable, read-only encoded polyline string.
-
- Provides methods for creation, inspection, and conversion of polyline data from various character sources.
diff --git a/api-reference/1.0/PolylineAlgorithm.PolylineDecoder.yml b/api-reference/1.0/PolylineAlgorithm.PolylineDecoder.yml
deleted file mode 100644
index 446fdd9c..00000000
--- a/api-reference/1.0/PolylineAlgorithm.PolylineDecoder.yml
+++ /dev/null
@@ -1,149 +0,0 @@
-### YamlMime:ApiPage
-title: Class PolylineDecoder
-body:
-- api1: Class PolylineDecoder
- id: PolylineAlgorithm_PolylineDecoder
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineDecoder.cs#L11
- metadata:
- uid: PolylineAlgorithm.PolylineDecoder
- commentId: T:PolylineAlgorithm.PolylineDecoder
-- facts:
- - name: Namespace
- value:
- text: PolylineAlgorithm
- url: PolylineAlgorithm.html
- - name: Assembly
- value: PolylineAlgorithm.dll
-- markdown: >-
- Decodes encoded polyline strings into sequences of geographic coordinates.
-
- Implements the interface.
-- code: 'public sealed class PolylineDecoder : AbstractPolylineDecoder, IPolylineDecoder'
-- h4: Inheritance
-- inheritance:
- - text: object
- url: https://learn.microsoft.com/dotnet/api/system.object
- - text: AbstractPolylineDecoder
- url: PolylineAlgorithm.Abstraction.AbstractPolylineDecoder-2.html
- - text: PolylineDecoder
- url: PolylineAlgorithm.PolylineDecoder.html
-- h4: Implements
-- list:
- - text: IPolylineDecoder
- url: PolylineAlgorithm.Abstraction.IPolylineDecoder-2.html
-- h4: Inherited Members
-- list:
- - text: AbstractPolylineDecoder.Options
- url: PolylineAlgorithm.Abstraction.AbstractPolylineDecoder-2.html#PolylineAlgorithm_Abstraction_AbstractPolylineDecoder_2_Options
- - text: AbstractPolylineDecoder.Decode(Polyline)
- url: PolylineAlgorithm.Abstraction.AbstractPolylineDecoder-2.html#PolylineAlgorithm_Abstraction_AbstractPolylineDecoder_2_Decode__0_
- - text: object.Equals(object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
- - text: object.Equals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
- - text: object.GetHashCode()
- url: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- - text: object.GetType()
- url: https://learn.microsoft.com/dotnet/api/system.object.gettype
- - text: object.ReferenceEquals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- - text: object.ToString()
- url: https://learn.microsoft.com/dotnet/api/system.object.tostring
-- h4: Extension Methods
-- list:
- - text: PolylineDecoderExtensions.Decode(IPolylineDecoder, string)
- url: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.html#PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode_PolylineAlgorithm_Abstraction_IPolylineDecoder_PolylineAlgorithm_Polyline_PolylineAlgorithm_Coordinate__System_String_
- - text: PolylineDecoderExtensions.Decode(IPolylineDecoder, char[])
- url: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.html#PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode_PolylineAlgorithm_Abstraction_IPolylineDecoder_PolylineAlgorithm_Polyline_PolylineAlgorithm_Coordinate__System_Char___
- - text: PolylineDecoderExtensions.Decode(IPolylineDecoder, ReadOnlyMemory)
- url: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.html#PolylineAlgorithm_Extensions_PolylineDecoderExtensions_Decode_PolylineAlgorithm_Abstraction_IPolylineDecoder_PolylineAlgorithm_Polyline_PolylineAlgorithm_Coordinate__System_ReadOnlyMemory_System_Char__
-- h2: Remarks
-- markdown: This abstract class provides a base implementation for decoding polylines, allowing subclasses to define how to handle specific polyline formats.
-- h2: Constructors
-- api3: PolylineDecoder()
- id: PolylineAlgorithm_PolylineDecoder__ctor
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineDecoder.cs#L13
- metadata:
- uid: PolylineAlgorithm.PolylineDecoder.#ctor
- commentId: M:PolylineAlgorithm.PolylineDecoder.#ctor
-- markdown: Initializes a new instance of the class with default encoding options.
-- code: public PolylineDecoder()
-- api3: PolylineDecoder(PolylineEncodingOptions)
- id: PolylineAlgorithm_PolylineDecoder__ctor_PolylineAlgorithm_PolylineEncodingOptions_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineDecoder.cs#L17
- metadata:
- uid: PolylineAlgorithm.PolylineDecoder.#ctor(PolylineAlgorithm.PolylineEncodingOptions)
- commentId: M:PolylineAlgorithm.PolylineDecoder.#ctor(PolylineAlgorithm.PolylineEncodingOptions)
-- markdown: Initializes a new instance of the class with the specified encoding options.
-- code: public PolylineDecoder(PolylineEncodingOptions options)
-- h4: Parameters
-- parameters:
- - name: options
- type:
- - text: PolylineEncodingOptions
- url: PolylineAlgorithm.PolylineEncodingOptions.html
- description: The to use for encoding operations.
-- h4: Exceptions
-- parameters:
- - type:
- - text: ArgumentNullException
- url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when options is null
-- h2: Methods
-- api3: CreateCoordinate(double, double)
- id: PolylineAlgorithm_PolylineDecoder_CreateCoordinate_System_Double_System_Double_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineDecoder.cs#L21
- metadata:
- uid: PolylineAlgorithm.PolylineDecoder.CreateCoordinate(System.Double,System.Double)
- commentId: M:PolylineAlgorithm.PolylineDecoder.CreateCoordinate(System.Double,System.Double)
-- markdown: Creates a coordinate instance from the given latitude and longitude values.
-- code: protected override Coordinate CreateCoordinate(double latitude, double longitude)
-- h4: Parameters
-- parameters:
- - name: latitude
- type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
- description: The latitude value.
- - name: longitude
- type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
- description: The longitude value.
-- h4: Returns
-- parameters:
- - type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: A coordinate instance of type .
-- api3: GetReadOnlyMemory(Polyline)
- id: PolylineAlgorithm_PolylineDecoder_GetReadOnlyMemory_PolylineAlgorithm_Polyline_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineDecoder.cs#L26
- metadata:
- uid: PolylineAlgorithm.PolylineDecoder.GetReadOnlyMemory(PolylineAlgorithm.Polyline)
- commentId: M:PolylineAlgorithm.PolylineDecoder.GetReadOnlyMemory(PolylineAlgorithm.Polyline)
-- markdown: Converts the provided polyline instance into a for decoding.
-- code: protected override ReadOnlyMemory GetReadOnlyMemory(Polyline polyline)
-- h4: Parameters
-- parameters:
- - name: polyline
- type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: The instance containing the encoded polyline data to decode.
-- h4: Returns
-- parameters:
- - type:
- - text: ReadOnlyMemory
- url: https://learn.microsoft.com/dotnet/api/system.readonlymemory-1
- - <
- - text: char
- url: https://learn.microsoft.com/dotnet/api/system.char
- - '>'
- description: A representing the encoded polyline data.
-languageId: csharp
-metadata:
- description: >-
- Decodes encoded polyline strings into sequences of geographic coordinates.
-
- Implements the interface.
diff --git a/api-reference/1.0/PolylineAlgorithm.PolylineEncoder.yml b/api-reference/1.0/PolylineAlgorithm.PolylineEncoder.yml
deleted file mode 100644
index 2cc3a5dd..00000000
--- a/api-reference/1.0/PolylineAlgorithm.PolylineEncoder.yml
+++ /dev/null
@@ -1,161 +0,0 @@
-### YamlMime:ApiPage
-title: Class PolylineEncoder
-body:
-- api1: Class PolylineEncoder
- id: PolylineAlgorithm_PolylineEncoder
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoder.cs#L11
- metadata:
- uid: PolylineAlgorithm.PolylineEncoder
- commentId: T:PolylineAlgorithm.PolylineEncoder
-- facts:
- - name: Namespace
- value:
- text: PolylineAlgorithm
- url: PolylineAlgorithm.html
- - name: Assembly
- value: PolylineAlgorithm.dll
-- markdown: >-
- Provides functionality to encode a collection of geographic coordinates into an encoded polyline string.
-
- Implements the interface.
-- code: 'public sealed class PolylineEncoder : AbstractPolylineEncoder, IPolylineEncoder'
-- h4: Inheritance
-- inheritance:
- - text: object
- url: https://learn.microsoft.com/dotnet/api/system.object
- - text: AbstractPolylineEncoder
- url: PolylineAlgorithm.Abstraction.AbstractPolylineEncoder-2.html
- - text: PolylineEncoder
- url: PolylineAlgorithm.PolylineEncoder.html
-- h4: Implements
-- list:
- - text: IPolylineEncoder
- url: PolylineAlgorithm.Abstraction.IPolylineEncoder-2.html
-- h4: Inherited Members
-- list:
- - text: AbstractPolylineEncoder.Options
- url: PolylineAlgorithm.Abstraction.AbstractPolylineEncoder-2.html#PolylineAlgorithm_Abstraction_AbstractPolylineEncoder_2_Options
- - text: AbstractPolylineEncoder.Encode(IEnumerable)
- url: PolylineAlgorithm.Abstraction.AbstractPolylineEncoder-2.html#PolylineAlgorithm_Abstraction_AbstractPolylineEncoder_2_Encode_System_Collections_Generic_IEnumerable__0__
- - text: object.Equals(object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)
- - text: object.Equals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)
- - text: object.GetHashCode()
- url: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- - text: object.GetType()
- url: https://learn.microsoft.com/dotnet/api/system.object.gettype
- - text: object.ReferenceEquals(object, object)
- url: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- - text: object.ToString()
- url: https://learn.microsoft.com/dotnet/api/system.object.tostring
-- h4: Extension Methods
-- list:
- - text: PolylineEncoderExtensions.Encode(IPolylineEncoder, ICollection)
- url: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.html#PolylineAlgorithm_Extensions_PolylineEncoderExtensions_Encode_PolylineAlgorithm_Abstraction_IPolylineEncoder_PolylineAlgorithm_Coordinate_PolylineAlgorithm_Polyline__System_Collections_Generic_ICollection_PolylineAlgorithm_Coordinate__
- - text: PolylineEncoderExtensions.Encode(IPolylineEncoder, Coordinate[])
- url: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.html#PolylineAlgorithm_Extensions_PolylineEncoderExtensions_Encode_PolylineAlgorithm_Abstraction_IPolylineEncoder_PolylineAlgorithm_Coordinate_PolylineAlgorithm_Polyline__PolylineAlgorithm_Coordinate___
-- h2: Remarks
-- markdown: This abstract class serves as a base for specific polyline encoders, allowing customization of the encoding process.
-- h2: Constructors
-- api3: PolylineEncoder()
- id: PolylineAlgorithm_PolylineEncoder__ctor
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoder.cs#L13
- metadata:
- uid: PolylineAlgorithm.PolylineEncoder.#ctor
- commentId: M:PolylineAlgorithm.PolylineEncoder.#ctor
-- markdown: Initializes a new instance of the class with default encoding options.
-- code: public PolylineEncoder()
-- api3: PolylineEncoder(PolylineEncodingOptions)
- id: PolylineAlgorithm_PolylineEncoder__ctor_PolylineAlgorithm_PolylineEncodingOptions_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoder.cs#L17
- metadata:
- uid: PolylineAlgorithm.PolylineEncoder.#ctor(PolylineAlgorithm.PolylineEncodingOptions)
- commentId: M:PolylineAlgorithm.PolylineEncoder.#ctor(PolylineAlgorithm.PolylineEncodingOptions)
-- markdown: Initializes a new instance of the class with the specified encoding options.
-- code: public PolylineEncoder(PolylineEncodingOptions options)
-- h4: Parameters
-- parameters:
- - name: options
- type:
- - text: PolylineEncodingOptions
- url: PolylineAlgorithm.PolylineEncodingOptions.html
- description: The to use for encoding operations.
-- h4: Exceptions
-- parameters:
- - type:
- - text: ArgumentNullException
- url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when options is null
-- h2: Methods
-- api3: CreatePolyline(ReadOnlyMemory)
- id: PolylineAlgorithm_PolylineEncoder_CreatePolyline_System_ReadOnlyMemory_System_Char__
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoder.cs#L31
- metadata:
- uid: PolylineAlgorithm.PolylineEncoder.CreatePolyline(System.ReadOnlyMemory{System.Char})
- commentId: M:PolylineAlgorithm.PolylineEncoder.CreatePolyline(System.ReadOnlyMemory{System.Char})
-- markdown: Creates a polyline instance from the provided read-only sequence of characters.
-- code: protected override Polyline CreatePolyline(ReadOnlyMemory polyline)
-- h4: Parameters
-- parameters:
- - name: polyline
- type:
- - text: ReadOnlyMemory
- url: https://learn.microsoft.com/dotnet/api/system.readonlymemory-1
- - <
- - text: char
- url: https://learn.microsoft.com/dotnet/api/system.char
- - '>'
- description: A containing the encoded polyline characters.
-- h4: Returns
-- parameters:
- - type:
- - text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: An instance of representing the encoded polyline.
-- api3: GetLatitude(Coordinate)
- id: PolylineAlgorithm_PolylineEncoder_GetLatitude_PolylineAlgorithm_Coordinate_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoder.cs#L21
- metadata:
- uid: PolylineAlgorithm.PolylineEncoder.GetLatitude(PolylineAlgorithm.Coordinate)
- commentId: M:PolylineAlgorithm.PolylineEncoder.GetLatitude(PolylineAlgorithm.Coordinate)
-- markdown: Extracts the latitude value from the specified coordinate.
-- code: protected override double GetLatitude(Coordinate coordinate)
-- h4: Parameters
-- parameters:
- - name: coordinate
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
-- h4: Returns
-- parameters:
- - type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
- description: The latitude value as a .
-- api3: GetLongitude(Coordinate)
- id: PolylineAlgorithm_PolylineEncoder_GetLongitude_PolylineAlgorithm_Coordinate_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoder.cs#L26
- metadata:
- uid: PolylineAlgorithm.PolylineEncoder.GetLongitude(PolylineAlgorithm.Coordinate)
- commentId: M:PolylineAlgorithm.PolylineEncoder.GetLongitude(PolylineAlgorithm.Coordinate)
-- markdown: Extracts the longitude value from the specified coordinate.
-- code: protected override double GetLongitude(Coordinate coordinate)
-- h4: Parameters
-- parameters:
- - name: coordinate
- type:
- - text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
-- h4: Returns
-- parameters:
- - type:
- - text: double
- url: https://learn.microsoft.com/dotnet/api/system.double
- description: The longitude value as a .
-languageId: csharp
-metadata:
- description: >-
- Provides functionality to encode a collection of geographic coordinates into an encoded polyline string.
-
- Implements the interface.
diff --git a/api-reference/1.0/PolylineAlgorithm.PolylineEncoding.yml b/api-reference/1.0/PolylineAlgorithm.PolylineEncoding.yml
index 8b249376..127dbf53 100644
--- a/api-reference/1.0/PolylineAlgorithm.PolylineEncoding.yml
+++ b/api-reference/1.0/PolylineAlgorithm.PolylineEncoding.yml
@@ -3,7 +3,7 @@ title: Class PolylineEncoding
body:
- api1: Class PolylineEncoding
id: PolylineAlgorithm_PolylineEncoding
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L19
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L23
metadata:
uid: PolylineAlgorithm.PolylineEncoding
commentId: T:PolylineAlgorithm.PolylineEncoding
@@ -48,136 +48,239 @@ body:
coordinates. It also provides validation utilities to ensure values conform to expected ranges for latitude and
longitude.
- h2: Methods
-- api3: Denormalize(int, CoordinateValueType)
- id: PolylineAlgorithm_PolylineEncoding_Denormalize_System_Int32_PolylineAlgorithm_CoordinateValueType_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L91
+- api3: Denormalize(int, uint)
+ id: PolylineAlgorithm_PolylineEncoding_Denormalize_System_Int32_System_UInt32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L121
metadata:
- uid: PolylineAlgorithm.PolylineEncoding.Denormalize(System.Int32,PolylineAlgorithm.CoordinateValueType)
- commentId: M:PolylineAlgorithm.PolylineEncoding.Denormalize(System.Int32,PolylineAlgorithm.CoordinateValueType)
-- markdown: Converts a normalized integer value to its denormalized double representation based on the specified type.
-- code: public static double Denormalize(int value, CoordinateValueType type)
+ uid: PolylineAlgorithm.PolylineEncoding.Denormalize(System.Int32,System.UInt32)
+ commentId: M:PolylineAlgorithm.PolylineEncoding.Denormalize(System.Int32,System.UInt32)
+- markdown: Converts a normalized integer coordinate value back to its floating-point representation based on the specified precision.
+- code: public static double Denormalize(int value, uint precision = 5)
- h4: Parameters
- parameters:
- name: value
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: The normalized integer value to be denormalized. Must be within the valid range for the specified type.
- - name: type
+ description: The integer value to denormalize. Typically produced by the method.
+ - name: precision
type:
- - text: CoordinateValueType
- url: PolylineAlgorithm.CoordinateValueType.html
- description: The type that defines the valid range for value.
+ - text: uint
+ url: https://learn.microsoft.com/dotnet/api/system.uint32
+ description: The number of decimal places used during normalization. Default is 5, matching standard polyline encoding precision.
+ optional: true
- h4: Returns
- parameters:
- type:
- text: double
url: https://learn.microsoft.com/dotnet/api/system.double
- description: The denormalized double representation of the input value. Returns 0.0 if value is 0.
+ description: The denormalized floating-point coordinate value.
- h4: Remarks
- markdown: >-
- The denormalization process divides the input value by a predefined precision factor to
- produce the resulting double. Ensure that value is validated against the specified type before calling this method.
+
+
+ This method reverses the normalization performed by . It takes an integer value and converts it
+
+ to a double by dividing it by 10 raised to the power of the specified precision. If precision is 0,
+
+ the value is returned as a double without division.
+
+
+
+
+
+ The calculation is performed inside a checked block to ensure that any arithmetic overflow is detected
+
+ and an is thrown.
+
+
+
+
+
+ For example, with a precision of 5:
+
+
+
A value of 3778903 becomes 37.78903
A value of -12241230 becomes -122.4123
+
+
+
+
+
+ If the input value is 0, the method returns 0.0 immediately.
+
+
- h4: Exceptions
- parameters:
- type:
- - text: ArgumentOutOfRangeException
- url: https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception
- description: Thrown when value is outside the valid range for the specified type.
-- api3: GetCharCount(int)
- id: PolylineAlgorithm_PolylineEncoding_GetCharCount_System_Int32_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L222
+ - text: OverflowException
+ url: https://learn.microsoft.com/dotnet/api/system.overflowexception
+ description: Thrown if the arithmetic operation overflows during conversion.
+- api3: GetRequiredBufferSize(int)
+ id: PolylineAlgorithm_PolylineEncoding_GetRequiredBufferSize_System_Int32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L297
metadata:
- uid: PolylineAlgorithm.PolylineEncoding.GetCharCount(System.Int32)
- commentId: M:PolylineAlgorithm.PolylineEncoding.GetCharCount(System.Int32)
-- markdown: >-
- Determines the number of characters required to represent the specified integer value within predefined
-
- variance ranges.
-- code: public static int GetCharCount(int variance)
+ uid: PolylineAlgorithm.PolylineEncoding.GetRequiredBufferSize(System.Int32)
+ commentId: M:PolylineAlgorithm.PolylineEncoding.GetRequiredBufferSize(System.Int32)
+- markdown: Calculates the number of characters required to encode a delta value in polyline format.
+- code: public static int GetRequiredBufferSize(int delta)
- h4: Parameters
- parameters:
- - name: variance
+ - name: delta
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
description: >-
- The integer value for which the character count is calculated. Must be within the range of a 32-bit signed
+ The integer delta value to calculate the encoded size for. This value typically represents the difference between
- integer.
+ consecutive coordinate values in polyline encoding.
- h4: Returns
- parameters:
- type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: >-
- The number of characters required to represent the variance value, based on its magnitude.
-
- Returns a value between 1 and 6 inclusive.
+ description: The number of characters required to encode the specified delta value. The minimum return value is 1.
- h4: Remarks
- markdown: >-
- The method uses predefined ranges to efficiently determine the character count. Smaller
+
+
+ This method determines how many characters will be needed to represent an integer delta value when encoded
+
+ using the polyline encoding algorithm. It performs the same zigzag encoding transformation as
+
+ but only calculates the required buffer size without actually writing any data.
+
+
+
+
+
+ The calculation process:
- values require fewer characters, while larger values require more. This method is optimized for performance
- using a switch expression.
-- api3: Normalize(double, CoordinateValueType)
- id: PolylineAlgorithm_PolylineEncoding_Normalize_System_Double_PolylineAlgorithm_CoordinateValueType_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L180
+
Applies zigzag encoding: left-shifts the value by 1 bit, then inverts all bits if the original value was negative
Counts how many 5-bit chunks are needed to represent the encoded value
Each chunk requires one character, with a minimum of 1 character for any value
+
+
+
+
+
+ This method is useful for pre-allocating buffers of the correct size before encoding polyline data, helping to avoid
+
+ buffer overflow checks during the actual encoding process.
+
+
+
+
+
+ The method uses a long internally to prevent overflow during the left-shift operation on large negative values.
+
+
+- h4: See Also
+- list:
+ - - text: PolylineEncoding
+ url: PolylineAlgorithm.PolylineEncoding.html
+ - .
+ - text: TryWriteValue
+ url: PolylineAlgorithm.PolylineEncoding.html#PolylineAlgorithm_PolylineEncoding_TryWriteValue_System_Int32_System_Span_System_Char__System_Int32__
+ - (
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ - ','
+ - " "
+ - text: Span
+ url: https://learn.microsoft.com/dotnet/api/system.span-1
+ - <
+ - text: char
+ url: https://learn.microsoft.com/dotnet/api/system.char
+ - '>'
+ - ','
+ - " "
+ - ref
+ - " "
+ - text: int
+ url: https://learn.microsoft.com/dotnet/api/system.int32
+ - )
+- api3: Normalize(double, uint)
+ id: PolylineAlgorithm_PolylineEncoding_Normalize_System_Double_System_UInt32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L61
metadata:
- uid: PolylineAlgorithm.PolylineEncoding.Normalize(System.Double,PolylineAlgorithm.CoordinateValueType)
- commentId: M:PolylineAlgorithm.PolylineEncoding.Normalize(System.Double,PolylineAlgorithm.CoordinateValueType)
-- markdown: Normalizes a given numeric value based on the specified type and precision settings.
-- code: public static int Normalize(double value, CoordinateValueType type)
+ uid: PolylineAlgorithm.PolylineEncoding.Normalize(System.Double,System.UInt32)
+ commentId: M:PolylineAlgorithm.PolylineEncoding.Normalize(System.Double,System.UInt32)
+- markdown: Normalizes a geographic coordinate value to an integer representation based on the specified precision.
+- code: public static int Normalize(double value, uint precision = 5)
- h4: Parameters
- parameters:
- name: value
type:
- text: double
url: https://learn.microsoft.com/dotnet/api/system.double
- description: The numeric value to normalize. Must be a finite number.
- - name: type
+ description: The numeric value to normalize. Must be a finite number (not NaN or infinity).
+ - name: precision
type:
- - text: CoordinateValueType
- url: PolylineAlgorithm.CoordinateValueType.html
- description: The type against which the value is validated. Determines the acceptable range for the value.
+ - text: uint
+ url: https://learn.microsoft.com/dotnet/api/system.uint32
+ description: >-
+ The number of decimal places of precision to preserve in the normalized value.
+
+ The value is multiplied by 10^precision before rounding.
+
+ Default is 5, which is standard for polyline encoding.
+ optional: true
- h4: Returns
- parameters:
- type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: An integer representing the normalized value. Returns 0 if the input value is 0.0.
+ description: An integer representing the normalized value. Returns 0 if the input value is 0.0.
- h4: Remarks
- markdown: >-
- This method validates the input value to ensure it is finite and within the acceptable range
+
+
+ This method converts a floating-point coordinate value into a normalized integer by multiplying it by 10 raised
+
+ to the power of the specified precision, then truncating the result to an integer.
+
+
+
+
+
+ For example, with the default precision of 5:
- for the specified type. If the value is valid, it applies a normalization algorithm using a predefined precision
- factor.
+
A value of 37.78903 becomes 3778903
A value of -122.4123 becomes -12241230
+
+
+
+
+
+ The method validates that the input value is finite (not NaN or infinity) before performing normalization.
+
+ If the precision is 0, the value is rounded without multiplication.
+
+
- h4: Exceptions
- parameters:
- type:
- text: ArgumentOutOfRangeException
url: https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception
- description: >-
- Thrown when value is not a finite number or is outside the valid range for the specified
-
- type.
-- api3: TryReadValue(ref int, ref ReadOnlyMemory, ref int)
- id: PolylineAlgorithm_PolylineEncoding_TryReadValue_System_Int32__System_ReadOnlyMemory_System_Char___System_Int32__
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L40
+ description: Thrown when value is not a finite number (NaN or infinity).
+ - type:
+ - text: OverflowException
+ url: https://learn.microsoft.com/dotnet/api/system.overflowexception
+ description: Thrown when the normalized result exceeds the range of a 32-bit signed integer during the conversion from double to int.
+- api3: TryReadValue(ref int, ReadOnlyMemory, ref int)
+ id: PolylineAlgorithm_PolylineEncoding_TryReadValue_System_Int32__System_ReadOnlyMemory_System_Char__System_Int32__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L168
metadata:
- uid: PolylineAlgorithm.PolylineEncoding.TryReadValue(System.Int32@,System.ReadOnlyMemory{System.Char}@,System.Int32@)
- commentId: M:PolylineAlgorithm.PolylineEncoding.TryReadValue(System.Int32@,System.ReadOnlyMemory{System.Char}@,System.Int32@)
-- markdown: Attempts to read a value from the specified buffer and updates the variance.
-- code: public static bool TryReadValue(ref int variance, ref ReadOnlyMemory buffer, ref int position)
+ uid: PolylineAlgorithm.PolylineEncoding.TryReadValue(System.Int32@,System.ReadOnlyMemory{System.Char},System.Int32@)
+ commentId: M:PolylineAlgorithm.PolylineEncoding.TryReadValue(System.Int32@,System.ReadOnlyMemory{System.Char},System.Int32@)
+- markdown: Attempts to read an encoded integer value from a polyline buffer, updating the specified delta and position.
+- code: public static bool TryReadValue(ref int delta, ReadOnlyMemory buffer, ref int position)
- h4: Parameters
- parameters:
- - name: variance
+ - name: delta
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: A reference to the integer that will be updated based on the value read from the buffer.
+ description: Reference to the integer accumulator that will be updated with the decoded value.
- name: buffer
type:
- text: ReadOnlyMemory
@@ -186,38 +289,61 @@ body:
- text: char
url: https://learn.microsoft.com/dotnet/api/system.char
- '>'
- description: A reference to the read-only memory buffer containing the data to be processed.
+ description: The buffer containing polyline-encoded characters.
- name: position
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: A reference to the current position within the buffer. The position is incremented as the method reads data.
+ description: Reference to the current position in the buffer. This value is updated as characters are read.
- h4: Returns
- parameters:
- type:
- text: bool
url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if a value was successfully read and the end of the buffer was not reached; otherwise, false.
+ description: true if a value was successfully read and decoded; false if the buffer ended before a complete value was read.
- h4: Remarks
- markdown: >-
- This method processes the buffer starting at the specified position and attempts to decode a value.
- The decoded value is used to update the variance parameter. The method stops reading when a
- termination condition is met or the end of the buffer is reached.
-- api3: TryWriteValue(int, ref Span, ref int)
- id: PolylineAlgorithm_PolylineEncoding_TryWriteValue_System_Int32_System_Span_System_Char___System_Int32__
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L133
+
+
+ This method decodes a value from a polyline-encoded character buffer, starting at the given position. It reads
+
+ characters sequentially, applying the polyline decoding algorithm, and updates the delta with
+
+ the decoded value. The position is advanced as characters are processed.
+
+
+
+
+
+ The decoding process continues until a character with a value less than the algorithm's space constant is encountered,
+
+ which signals the end of the encoded value. If the buffer is exhausted before a complete value is read, the method returns false.
+
+
+
+
+
+ The decoded value is added to delta using zigzag decoding, which handles both positive and negative values.
+
+
+- api3: TryWriteValue(int, Span, ref int)
+ id: PolylineAlgorithm_PolylineEncoding_TryWriteValue_System_Int32_System_Span_System_Char__System_Int32__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L236
metadata:
- uid: PolylineAlgorithm.PolylineEncoding.TryWriteValue(System.Int32,System.Span{System.Char}@,System.Int32@)
- commentId: M:PolylineAlgorithm.PolylineEncoding.TryWriteValue(System.Int32,System.Span{System.Char}@,System.Int32@)
-- markdown: Attempts to write a value derived from the specified variance into the provided buffer at the given position.
-- code: public static bool TryWriteValue(int variance, ref Span buffer, ref int position)
+ uid: PolylineAlgorithm.PolylineEncoding.TryWriteValue(System.Int32,System.Span{System.Char},System.Int32@)
+ commentId: M:PolylineAlgorithm.PolylineEncoding.TryWriteValue(System.Int32,System.Span{System.Char},System.Int32@)
+- markdown: Attempts to write an encoded integer value to a polyline buffer, updating the specified position.
+- code: public static bool TryWriteValue(int delta, Span buffer, ref int position)
- h4: Parameters
- parameters:
- - name: variance
+ - name: delta
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: The integer value used to calculate the output to be written into the buffer.
+ description: >-
+ The integer value to encode and write to the buffer. This value typically represents the difference between consecutive
+
+ coordinate values in polyline encoding.
- name: buffer
type:
- text: Span
@@ -226,26 +352,175 @@ body:
- text: char
url: https://learn.microsoft.com/dotnet/api/system.char
- '>'
- description: A reference to the span of characters where the value will be written.
+ description: The destination buffer where the encoded characters will be written. Must have sufficient capacity to hold the encoded value.
- name: position
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
description: >-
- A reference to the current position in the buffer where writing begins. This value is updated to reflect the new
+ Reference to the current position in the buffer. This value is updated as characters are written to reflect the new position
- position after writing.
+ after encoding is complete.
- h4: Returns
- parameters:
- type:
- text: bool
url: https://learn.microsoft.com/dotnet/api/system.boolean
- description: true if the value was successfully written to the buffer; otherwise, false.
+ description: >-
+ true if the value was successfully encoded and written to the buffer; false if the buffer
+
+ does not have sufficient remaining capacity to hold the encoded value.
+- h4: Remarks
+- markdown: >-
+
+
+ This method encodes an integer delta value into a polyline-encoded format and writes it to the provided character buffer,
+
+ starting at the given position. It applies zigzag encoding followed by the polyline encoding algorithm to represent
+
+ both positive and negative values efficiently.
+
+
+
+
+
+ The encoding process first converts the value using zigzag encoding (left shift by 1, with bitwise inversion for negative values),
+
+ then writes it as a sequence of characters. Each character encodes 5 bits of data, with continuation bits indicating whether
+
+ more characters follow. The position is advanced as characters are written.
+
+
+
+
+
+ Before writing, the method validates that sufficient space is available in the buffer by calling .
+
+ If the buffer does not have enough remaining capacity, the method returns false without modifying the buffer or position.
+
+
+
+
+
+ This method is the inverse of and can be used to encode coordinate deltas for polyline serialization.
+
+
+- api3: ValidateBlockLength(ReadOnlySpan)
+ id: PolylineAlgorithm_PolylineEncoding_ValidateBlockLength_System_ReadOnlySpan_System_Char__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L437
+ metadata:
+ uid: PolylineAlgorithm.PolylineEncoding.ValidateBlockLength(System.ReadOnlySpan{System.Char})
+ commentId: M:PolylineAlgorithm.PolylineEncoding.ValidateBlockLength(System.ReadOnlySpan{System.Char})
+- markdown: Validates the block structure of a polyline segment, ensuring each encoded value does not exceed 7 characters and the polyline ends correctly.
+- code: public static void ValidateBlockLength(ReadOnlySpan polyline)
+- h4: Parameters
+- parameters:
+ - name: polyline
+ type:
+ - text: ReadOnlySpan
+ url: https://learn.microsoft.com/dotnet/api/system.readonlyspan-1
+ - <
+ - text: char
+ url: https://learn.microsoft.com/dotnet/api/system.char
+ - '>'
+ description: A span representing the polyline segment to validate.
+- h4: Remarks
+- markdown: >-
+
+
+ Iterates through the polyline, counting the length of each block (a sequence of characters representing an encoded value).
+
+ Throws an if any block exceeds 7 characters or if the polyline does not end with a valid block terminator.
+
+
+- h4: Exceptions
+- parameters:
+ - type:
+ - text: ArgumentException
+ url: https://learn.microsoft.com/dotnet/api/system.argumentexception
+ description: Thrown when a block exceeds 7 characters or the polyline does not end with a valid block terminator.
+- api3: ValidateCharRange(ReadOnlySpan)
+ id: PolylineAlgorithm_PolylineEncoding_ValidateCharRange_System_ReadOnlySpan_System_Char__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L391
+ metadata:
+ uid: PolylineAlgorithm.PolylineEncoding.ValidateCharRange(System.ReadOnlySpan{System.Char})
+ commentId: M:PolylineAlgorithm.PolylineEncoding.ValidateCharRange(System.ReadOnlySpan{System.Char})
+- markdown: Validates that all characters in the polyline segment are within the allowed ASCII range for polyline encoding.
+- code: public static void ValidateCharRange(ReadOnlySpan polyline)
+- h4: Parameters
+- parameters:
+ - name: polyline
+ type:
+ - text: ReadOnlySpan
+ url: https://learn.microsoft.com/dotnet/api/system.readonlyspan-1
+ - <
+ - text: char
+ url: https://learn.microsoft.com/dotnet/api/system.char
+ - '>'
+ description: A span representing the polyline segment to validate.
+- h4: Remarks
+- markdown: >-
+
+
+ Uses SIMD vectorization for efficient validation of large spans. Falls back to scalar checks for any block where an invalid character is detected.
+
+
+
+
+
+ The valid range is from '?' (63) to '_' (95), inclusive. If an invalid character is found, an is thrown.
+
+
+- h4: Exceptions
+- parameters:
+ - type:
+ - text: ArgumentException
+ url: https://learn.microsoft.com/dotnet/api/system.argumentexception
+ description: Thrown when an invalid character is found in the polyline segment.
+- api3: ValidateFormat(ReadOnlySpan)
+ id: PolylineAlgorithm_PolylineEncoding_ValidateFormat_System_ReadOnlySpan_System_Char__
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncoding.cs#L369
+ metadata:
+ uid: PolylineAlgorithm.PolylineEncoding.ValidateFormat(System.ReadOnlySpan{System.Char})
+ commentId: M:PolylineAlgorithm.PolylineEncoding.ValidateFormat(System.ReadOnlySpan{System.Char})
+- markdown: Validates the format of a polyline segment, ensuring all characters are valid and block structure is correct.
+- code: public static void ValidateFormat(ReadOnlySpan polyline)
+- h4: Parameters
+- parameters:
+ - name: polyline
+ type:
+ - text: ReadOnlySpan
+ url: https://learn.microsoft.com/dotnet/api/system.readonlyspan-1
+ - <
+ - text: char
+ url: https://learn.microsoft.com/dotnet/api/system.char
+ - '>'
+ description: A span representing the polyline segment to validate.
- h4: Remarks
- markdown: >-
- This method performs bounds checking to ensure that the buffer has sufficient space to
+
+
+ This method performs two levels of validation on the provided polyline segment:
+
+
+
+
+ Character Range Validation: Checks that every character in the polyline is within the valid ASCII range for polyline encoding ('?' [63] to '_' [95], inclusive).
+ Uses SIMD acceleration for efficient validation of large segments.
+
+ Block Structure Validation: Ensures that each encoded value (block) does not exceed 7 characters and that the polyline ends with a valid block terminator.
+
+
- accommodate the calculated value. If the buffer does not have enough space, the method returns false without modifying the buffer or position.
+ If an invalid character or block structure is detected, an is thrown with details about the error.
+
+
+- h4: Exceptions
+- parameters:
+ - type:
+ - text: ArgumentException
+ url: https://learn.microsoft.com/dotnet/api/system.argumentexception
+ description: Thrown when an invalid character is found or the block structure is invalid.
languageId: csharp
metadata:
description: >-
diff --git a/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptions.yml b/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptions.yml
index 49c71468..2e3880ce 100644
--- a/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptions.yml
+++ b/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptions.yml
@@ -3,7 +3,7 @@ title: Class PolylineEncodingOptions
body:
- api1: Class PolylineEncodingOptions
id: PolylineAlgorithm_PolylineEncodingOptions
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L18
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L29
metadata:
uid: PolylineAlgorithm.PolylineEncodingOptions
commentId: T:PolylineAlgorithm.PolylineEncodingOptions
@@ -14,7 +14,7 @@ body:
url: PolylineAlgorithm.html
- name: Assembly
value: PolylineAlgorithm.dll
-- markdown: Options for configuring polyline encoding.
+- markdown: Provides configuration options for polyline encoding operations.
- code: public sealed class PolylineEncodingOptions
- h4: Inheritance
- inheritance:
@@ -37,15 +37,28 @@ body:
- text: object.ToString()
url: https://learn.microsoft.com/dotnet/api/system.object.tostring
- h2: Remarks
-- markdown: This class allows you to set options such as buffer size and logger factory for encoding operations.
+- markdown: >-
+
+
+ This class allows you to configure various aspects of polyline encoding, including:
+
+
+
+
The level for coordinate encoding
The for memory allocation strategy
The for diagnostic logging
+
+
+
+ All properties have internal setters and should be configured through a builder or factory pattern.
+
+
- h2: Properties
- api3: LoggerFactory
id: PolylineAlgorithm_PolylineEncodingOptions_LoggerFactory
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L34
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L41
metadata:
uid: PolylineAlgorithm.PolylineEncodingOptions.LoggerFactory
commentId: P:PolylineAlgorithm.PolylineEncodingOptions.LoggerFactory
-- markdown: Gets or sets the precision for encoding coordinates.
+- markdown: Gets the logger factory used for diagnostic logging during encoding operations.
- code: public ILoggerFactory LoggerFactory { get; }
- h4: Property Value
- parameters:
@@ -53,22 +66,62 @@ body:
- text: ILoggerFactory
url: https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.iloggerfactory
- h4: Remarks
-- markdown: The default logger factory is , which does not log any messages.
-- api3: MaxBufferSize
- id: PolylineAlgorithm_PolylineEncodingOptions_MaxBufferSize
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L26
+- markdown: >-
+ The default logger factory is , which does not log any messages.
+
+ To enable logging, provide a custom implementation.
+- api3: Precision
+ id: PolylineAlgorithm_PolylineEncodingOptions_Precision
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L60
metadata:
- uid: PolylineAlgorithm.PolylineEncodingOptions.MaxBufferSize
- commentId: P:PolylineAlgorithm.PolylineEncodingOptions.MaxBufferSize
-- markdown: Gets the maximum buffer size for encoding operations.
-- code: public int MaxBufferSize { get; }
+ uid: PolylineAlgorithm.PolylineEncodingOptions.Precision
+ commentId: P:PolylineAlgorithm.PolylineEncodingOptions.Precision
+- markdown: Gets the precision level used for encoding coordinate values.
+- code: public uint Precision { get; }
+- h4: Property Value
+- parameters:
+ - type:
+ - text: uint
+ url: https://learn.microsoft.com/dotnet/api/system.uint32
+- h4: Remarks
+- markdown: >-
+
+
+ The precision determines the number of decimal places to which each coordinate value (latitude or longitude)
+
+ is multiplied and truncated (not rounded) before encoding. For example, a precision of 5 means each coordinate is multiplied by 10^5
+
+ and truncated to an integer before encoding.
+
+
+
+
+
+ This setting does not directly correspond to a physical distance or accuracy in meters, but rather controls
+
+ the granularity of the encoded values.
+
+
+- api3: StackAllocLimit
+ id: PolylineAlgorithm_PolylineEncodingOptions_StackAllocLimit
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptions.cs#L73
+ metadata:
+ uid: PolylineAlgorithm.PolylineEncodingOptions.StackAllocLimit
+ commentId: P:PolylineAlgorithm.PolylineEncodingOptions.StackAllocLimit
+- markdown: Gets the maximum buffer size (in characters) that can be allocated on the stack for encoding operations.
+- code: public int StackAllocLimit { get; }
- h4: Property Value
- parameters:
- type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- h4: Remarks
-- markdown: The default maximum buffer size is 64,000 bytes (64 KB). This can be adjusted based on the expected size of the polyline data, but should be enough for common cases.
+- markdown: >-
+ When the required buffer size for encoding exceeds this limit, memory will be allocated on the heap instead of the stack.
+
+ This setting specifically applies to stack allocation of character arrays (stackalloc char[]) used during polyline encoding,
+
+ balancing performance and stack safety.
languageId: csharp
metadata:
- description: Options for configuring polyline encoding.
+ description: Provides configuration options for polyline encoding operations.
diff --git a/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptionsBuilder.yml b/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptionsBuilder.yml
index 91c4c2a6..92e6d942 100644
--- a/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptionsBuilder.yml
+++ b/api-reference/1.0/PolylineAlgorithm.PolylineEncodingOptionsBuilder.yml
@@ -3,7 +3,7 @@ title: Class PolylineEncodingOptionsBuilder
body:
- api1: Class PolylineEncodingOptionsBuilder
id: PolylineAlgorithm_PolylineEncodingOptionsBuilder
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L15
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L15
metadata:
uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder
commentId: T:PolylineAlgorithm.PolylineEncodingOptionsBuilder
@@ -15,7 +15,7 @@ body:
- name: Assembly
value: PolylineAlgorithm.dll
- markdown: Provides a builder for configuring options for polyline encoding operations.
-- code: public class PolylineEncodingOptionsBuilder
+- code: public sealed class PolylineEncodingOptionsBuilder
- h4: Inheritance
- inheritance:
- text: object
@@ -32,8 +32,6 @@ body:
url: https://learn.microsoft.com/dotnet/api/system.object.gethashcode
- text: object.GetType()
url: https://learn.microsoft.com/dotnet/api/system.object.gettype
- - text: object.MemberwiseClone()
- url: https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone
- text: object.ReferenceEquals(object, object)
url: https://learn.microsoft.com/dotnet/api/system.object.referenceequals
- text: object.ToString()
@@ -41,7 +39,7 @@ body:
- h2: Methods
- api3: Build()
id: PolylineAlgorithm_PolylineEncodingOptionsBuilder_Build
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L37
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L38
metadata:
uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder.Build
commentId: M:PolylineAlgorithm.PolylineEncodingOptionsBuilder.Build
@@ -55,7 +53,7 @@ body:
description: A configured instance.
- api3: Create()
id: PolylineAlgorithm_PolylineEncodingOptionsBuilder_Create
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L27
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L28
metadata:
uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder.Create
commentId: M:PolylineAlgorithm.PolylineEncodingOptionsBuilder.Create
@@ -69,11 +67,11 @@ body:
description: An instance for configuring polyline encoding options.
- api3: WithLoggerFactory(ILoggerFactory)
id: PolylineAlgorithm_PolylineEncodingOptionsBuilder_WithLoggerFactory_Microsoft_Extensions_Logging_ILoggerFactory_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L72
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L97
metadata:
uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory)
commentId: M:PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory)
-- markdown: Sets the logger factory for logging during encoding operations.
+- markdown: Configures the to be used for logging during polyline encoding operations.
- code: public PolylineEncodingOptionsBuilder WithLoggerFactory(ILoggerFactory loggerFactory)
- h4: Parameters
- parameters:
@@ -81,46 +79,63 @@ body:
type:
- text: ILoggerFactory
url: https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.iloggerfactory
- description: The instance of a logger factory.
+ description: The instance to use for logging. If null, a will be used instead.
- h4: Returns
- parameters:
- type:
- text: PolylineEncodingOptionsBuilder
url: PolylineAlgorithm.PolylineEncodingOptionsBuilder.html
- description: The current builder instance.
-- h4: Exceptions
+ description: The current instance for method chaining.
+- api3: WithPrecision(uint)
+ id: PolylineAlgorithm_PolylineEncodingOptionsBuilder_WithPrecision_System_UInt32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L82
+ metadata:
+ uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithPrecision(System.UInt32)
+ commentId: M:PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithPrecision(System.UInt32)
+- markdown: Sets the coordinate encoding precision.
+- code: public PolylineEncodingOptionsBuilder WithPrecision(uint precision)
+- h4: Parameters
+- parameters:
+ - name: precision
+ type:
+ - text: uint
+ url: https://learn.microsoft.com/dotnet/api/system.uint32
+ description: The number of decimal places to use for encoding coordinate values. Default is 5.
+- h4: Returns
- parameters:
- type:
- - text: ArgumentNullException
- url: https://learn.microsoft.com/dotnet/api/system.argumentnullexception
- description: Thrown when loggerFactory is null.
-- api3: WithMaxBufferSize(int)
- id: PolylineAlgorithm_PolylineEncodingOptionsBuilder_WithMaxBufferSize_System_Int32_
- src: https://github.com/petesramek/polyline-algorithm-csharp/blob/preview/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L54
+ - text: PolylineEncodingOptionsBuilder
+ url: PolylineAlgorithm.PolylineEncodingOptionsBuilder.html
+ description: The current instance for method chaining.
+- api3: WithStackAllocLimit(int)
+ id: PolylineAlgorithm_PolylineEncodingOptionsBuilder_WithStackAllocLimit_System_Int32_
+ src: https://github.com/petesramek/polyline-algorithm-csharp/blob/develop/1.0/src/PolylineAlgorithm/PolylineEncodingOptionsBuilder.cs#L61
metadata:
- uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithMaxBufferSize(System.Int32)
- commentId: M:PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithMaxBufferSize(System.Int32)
-- markdown: Sets the buffer size for encoding operations.
-- code: public PolylineEncodingOptionsBuilder WithMaxBufferSize(int bufferSize)
+ uid: PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithStackAllocLimit(System.Int32)
+ commentId: M:PolylineAlgorithm.PolylineEncodingOptionsBuilder.WithStackAllocLimit(System.Int32)
+- markdown: Configures the buffer size used for stack allocation during polyline encoding operations.
+- code: public PolylineEncodingOptionsBuilder WithStackAllocLimit(int stackAllocLimit)
- h4: Parameters
- parameters:
- - name: bufferSize
+ - name: stackAllocLimit
type:
- text: int
url: https://learn.microsoft.com/dotnet/api/system.int32
- description: The maximum buffer size. Must be greater than 11.
+ description: The maximum buffer size to use for stack allocation. Must be greater than or equal to 1.
- h4: Returns
- parameters:
- type:
- text: PolylineEncodingOptionsBuilder
url: PolylineAlgorithm.PolylineEncodingOptionsBuilder.html
- description: The current builder instance.
+ description: The current instance for method chaining.
+- h4: Remarks
+- markdown: This method allows customization of the internal buffer size for encoding, which can impact performance and memory usage.
- h4: Exceptions
- parameters:
- type:
- text: ArgumentOutOfRangeException
url: https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception
- description: Thrown when bufferSize is less than or equal to 11.
+ description: Thrown if stackAllocLimit is less than 1.
languageId: csharp
metadata:
description: Provides a builder for configuring options for polyline encoding operations.
diff --git a/api-reference/1.0/PolylineAlgorithm.yml b/api-reference/1.0/PolylineAlgorithm.yml
index ace2f946..b60dc3c0 100644
--- a/api-reference/1.0/PolylineAlgorithm.yml
+++ b/api-reference/1.0/PolylineAlgorithm.yml
@@ -20,20 +20,6 @@ body:
text: InvalidPolylineException
url: PolylineAlgorithm.InvalidPolylineException.html
description: Exception thrown when a polyline is determined to be malformed or invalid during processing.
- - type:
- text: PolylineDecoder
- url: PolylineAlgorithm.PolylineDecoder.html
- description: >-
- Decodes encoded polyline strings into sequences of geographic coordinates.
-
- Implements the interface.
- - type:
- text: PolylineEncoder
- url: PolylineAlgorithm.PolylineEncoder.html
- description: >-
- Provides functionality to encode a collection of geographic coordinates into an encoded polyline string.
-
- Implements the interface.
- type:
text: PolylineEncoding
url: PolylineAlgorithm.PolylineEncoding.html
@@ -44,28 +30,9 @@ body:
- type:
text: PolylineEncodingOptions
url: PolylineAlgorithm.PolylineEncodingOptions.html
- description: Options for configuring polyline encoding.
+ description: Provides configuration options for polyline encoding operations.
- type:
text: PolylineEncodingOptionsBuilder
url: PolylineAlgorithm.PolylineEncodingOptionsBuilder.html
description: Provides a builder for configuring options for polyline encoding operations.
-- h3: Structs
-- parameters:
- - type:
- text: Coordinate
- url: PolylineAlgorithm.Coordinate.html
- description: Represents a geographic coordinate as a pair of latitude and longitude values.
- - type:
- text: Polyline
- url: PolylineAlgorithm.Polyline.html
- description: >-
- Represents an immutable, read-only encoded polyline string.
-
- Provides methods for creation, inspection, and conversion of polyline data from various character sources.
-- h3: Enums
-- parameters:
- - type:
- text: CoordinateValueType
- url: PolylineAlgorithm.CoordinateValueType.html
- description: Represents the type of a geographic coordinate value.
languageId: csharp
diff --git a/api-reference/1.0/toc.yml b/api-reference/1.0/toc.yml
index b69f5d3f..290b7c63 100644
--- a/api-reference/1.0/toc.yml
+++ b/api-reference/1.0/toc.yml
@@ -5,24 +5,12 @@
- name: Classes
- name: InvalidPolylineException
href: PolylineAlgorithm.InvalidPolylineException.yml
- - name: PolylineDecoder
- href: PolylineAlgorithm.PolylineDecoder.yml
- - name: PolylineEncoder
- href: PolylineAlgorithm.PolylineEncoder.yml
- name: PolylineEncoding
href: PolylineAlgorithm.PolylineEncoding.yml
- name: PolylineEncodingOptions
href: PolylineAlgorithm.PolylineEncodingOptions.yml
- name: PolylineEncodingOptionsBuilder
href: PolylineAlgorithm.PolylineEncodingOptionsBuilder.yml
- - name: Structs
- - name: Coordinate
- href: PolylineAlgorithm.Coordinate.yml
- - name: Polyline
- href: PolylineAlgorithm.Polyline.yml
- - name: Enums
- - name: CoordinateValueType
- href: PolylineAlgorithm.CoordinateValueType.yml
- name: PolylineAlgorithm.Abstraction
href: PolylineAlgorithm.Abstraction.yml
items:
@@ -32,9 +20,9 @@
- name: AbstractPolylineEncoder
href: PolylineAlgorithm.Abstraction.AbstractPolylineEncoder-2.yml
- name: Interfaces
- - name: IPolylineDecoder
+ - name: IPolylineDecoder
href: PolylineAlgorithm.Abstraction.IPolylineDecoder-2.yml
- - name: IPolylineEncoder
+ - name: IPolylineEncoder
href: PolylineAlgorithm.Abstraction.IPolylineEncoder-2.yml
- name: PolylineAlgorithm.Extensions
href: PolylineAlgorithm.Extensions.yml
@@ -44,3 +32,9 @@
href: PolylineAlgorithm.Extensions.PolylineDecoderExtensions.yml
- name: PolylineEncoderExtensions
href: PolylineAlgorithm.Extensions.PolylineEncoderExtensions.yml
+- name: PolylineAlgorithm.Internal.Diagnostics
+ href: PolylineAlgorithm.Internal.Diagnostics.yml
+ items:
+ - name: Classes
+ - name: ExceptionGuard
+ href: PolylineAlgorithm.Internal.Diagnostics.ExceptionGuard.yml
diff --git a/api-reference/api-reference.json b/api-reference/api-reference.json
index 78956c32..c5797921 100644
--- a/api-reference/api-reference.json
+++ b/api-reference/api-reference.json
@@ -14,37 +14,21 @@
"exclude": [
"_docs/**"
]
- },
- {
- "dest": "",
- "files": [ "*.yml" ],
- "group": "v1.0",
- "src": "1.0",
- "rootTocPath": "~/toc.html"
- },
- {
- "dest": "",
- "files": [ "*.yml" ],
- "group": "v1.1",
- "src": "1.1",
- "rootTocPath": "~/toc.html"
}
],
"resource": [
{
"files": [
- "media/**"
+ "media/**",
+ "versions.json"
]
}
],
- "groups": {
- "v1.0": { "dest": "1.0" },
- "v1.1": { "dest": "1.1" }
- },
"output": "_docs",
"template": [
"default",
- "modern"
+ "modern",
+ "docs-versioning"
],
"maxParallelism": 1,
"globalMetadata": {
diff --git a/api-reference/docs-versioning/layout/_master.tmpl b/api-reference/docs-versioning/layout/_master.tmpl
new file mode 100644
index 00000000..68043875
--- /dev/null
+++ b/api-reference/docs-versioning/layout/_master.tmpl
@@ -0,0 +1,163 @@
+{{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}}
+{{!include(/^public/.*/)}}
+{{!include(favicon.ico)}}
+{{!include(logo.svg)}}
+
+
+
+
+ {{#redirect_url}}
+
+ {{/redirect_url}}
+ {{^redirect_url}}
+ {{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}
+
+
+ {{#_description}}{{/_description}}
+ {{#description}}{{/description}}
+
+
+
+
+
+ {{#_noindex}}{{/_noindex}}
+
+ {{#_disableNewTab}}{{/_disableNewTab}}
+ {{#_disableTocFilter}}{{/_disableTocFilter}}
+ {{#docurl}}{{/docurl}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{#_googleAnalyticsTagId}}
+
+
+ {{/_googleAnalyticsTagId}}
+ {{/redirect_url}}
+
+
+ {{^redirect_url}}
+
+
+ {{^_disableNavbar}}
+
+ {{/_disableNavbar}}
+
+
+
+ {{^_disableToc}}
+