-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(here): adding support for encoding flexible polylines for the au…
…tosuggest, browse, and discover endpoints (#56) * feat(here): adding a polyline encoder/decoder * feat(here): adding tests for polyline support * feat(here): adding polyline encoding support for the autosuggest, browse, and discover endpoints
- Loading branch information
1 parent
2fd4107
commit 98c7dd9
Showing
24 changed files
with
16,549 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// <copyright file="FlexiblePolyline.cs" company="Geo.NET"> | ||
// Copyright (c) Geo.NET. | ||
// Licensed under the MIT license. See the LICENSE file in the solution root for full license information. | ||
// </copyright> | ||
|
||
namespace Geo.Here.Models.Parameters | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
/// <summary> | ||
/// The polyline information to be added as a filter in the geocoding request. | ||
/// </summary> | ||
public class FlexiblePolyline | ||
{ | ||
/// <summary> | ||
/// Gets or sets the coordinates that make up the polyline. | ||
/// </summary> | ||
public IEnumerable<LatLngZ> Coordinates { get; set; } = Array.Empty<LatLngZ>(); | ||
|
||
/// <summary> | ||
/// Gets or sets the precision of the coordinate to be encoded. | ||
/// </summary> | ||
public int Precision { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the third dimension, which may be a level, altitude, elevation or some other custom value. | ||
/// </summary> | ||
public ThirdDimension ThirdDimension { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets precision for <see cref="ThirdDimension"/> value. | ||
/// </summary> | ||
public int ThirdDimensionPrecision { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// <copyright file="LatLngZ.cs" company="Geo.NET"> | ||
// Copyright (c) Geo.NET. | ||
// Licensed under the MIT license. See the LICENSE file in the solution root for full license information. | ||
// </copyright> | ||
|
||
namespace Geo.Here.Models.Parameters | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// A coordinate triple. | ||
/// </summary> | ||
public class LatLngZ | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="LatLngZ"/> class. | ||
/// </summary> | ||
/// <param name="latitude">The latitude of the point.</param> | ||
/// <param name="longitude">The longitude of the point.</param> | ||
/// <param name="thirdDimension">Optional. The Z dimension of the point. Default = 0.</param> | ||
public LatLngZ(double latitude, double longitude, double thirdDimension = 0) | ||
{ | ||
Latitude = latitude; | ||
Longitude = longitude; | ||
Z = thirdDimension; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the latitude of the point. | ||
/// </summary> | ||
public double Latitude { get; } | ||
|
||
/// <summary> | ||
/// Gets the longitude of the point. | ||
/// </summary> | ||
public double Longitude { get; } | ||
|
||
/// <summary> | ||
/// Gets the Z dimension of the point. | ||
/// </summary> | ||
public double Z { get; } | ||
|
||
/// <inheritdoc/> | ||
public override string ToString() | ||
{ | ||
return "LatLngZ [Latitude=" + Latitude + ", Longitude=" + Longitude + ", Z=" + Z + "]"; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override bool Equals(object obj) | ||
{ | ||
if (this == obj) | ||
{ | ||
return true; | ||
} | ||
|
||
if (obj is LatLngZ latLngZ) | ||
{ | ||
if (latLngZ.Latitude == Latitude && latLngZ.Longitude == Longitude && latLngZ.Z == Z) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override int GetHashCode() | ||
{ | ||
return HashCode.Combine(Latitude, Longitude, Z); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// <copyright file="ThirdDimension.cs" company="Geo.NET"> | ||
// Copyright (c) Geo.NET. | ||
// Licensed under the MIT license. See the LICENSE file in the solution root for full license information. | ||
// </copyright> | ||
|
||
namespace Geo.Here.Models.Parameters | ||
{ | ||
/// <summary> | ||
/// 3rd dimension specification. | ||
/// Example a level, altitude, elevation or some other custom value. | ||
/// ABSENT is default when there is no third dimension en/decoding required. | ||
/// </summary> | ||
public enum ThirdDimension | ||
{ | ||
/// <summary> | ||
/// The third dimension is absent. | ||
/// </summary> | ||
Absent = 0, | ||
|
||
/// <summary> | ||
/// The third dimension is level. | ||
/// </summary> | ||
Level = 1, | ||
|
||
/// <summary> | ||
/// The third dimension uses altitude. | ||
/// </summary> | ||
Altitude = 2, | ||
|
||
/// <summary> | ||
/// The third dimension uses elevation. | ||
/// </summary> | ||
Elevation = 3, | ||
|
||
/// <summary> | ||
/// A reserved number. | ||
/// </summary> | ||
Reserved1 = 4, | ||
|
||
/// <summary> | ||
/// A reserved number. | ||
/// </summary> | ||
Reserved2 = 5, | ||
|
||
/// <summary> | ||
/// A custom number. | ||
/// </summary> | ||
Custom1 = 6, | ||
|
||
/// <summary> | ||
/// A custom number. | ||
/// </summary> | ||
Custom2 = 7, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.