Skip to content

Commit c6aff1d

Browse files
committed
removed program and made the project library
1 parent 30272c6 commit c6aff1d

File tree

4 files changed

+57
-106
lines changed

4 files changed

+57
-106
lines changed

samples/PolylineAlgorithm.NetTopologySuite.Sample/NetTopologyPolylineDecoder.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,27 @@ namespace PolylineAlgorithm.NetTopologySuite.Sample;
99
using PolylineAlgorithm.Abstraction;
1010
using System;
1111

12-
internal sealed class NetTopologyPolylineDecoder : AbstractPolylineDecoder<string, Point> {
12+
/// <summary>
13+
/// Represents a polyline decoder that converts encoded polyline strings into a collection of geographic coordinates using NetTopologySuite.
14+
/// </summary>
15+
public sealed class NetTopologyPolylineDecoder : AbstractPolylineDecoder<string, Point> {
1316
protected override Point CreateCoordinate(double latitude, double longitude) {
1417
return new Point(latitude, longitude);
1518
}
1619

17-
protected override ReadOnlyMemory<char> GetReadOnlyMemory(string? polyline) {
20+
/// <summary>
21+
/// Converts the provided polyline string into a read-only memory of characters.
22+
/// </summary>
23+
/// <param name="polyline">
24+
/// The encoded polyline string to be converted into a read-only memory of characters.
25+
/// </param>
26+
/// <returns>
27+
/// A <see cref="ReadOnlyMemory{T}"/> containing the characters of the polyline string.
28+
/// </returns>
29+
/// <exception cref="ArgumentException">
30+
/// Thrown when the provided polyline string is null, empty, or consists only of whitespace characters.
31+
/// </exception>
32+
protected override ReadOnlyMemory<char> GetReadOnlyMemory(string polyline) {
1833
if (string.IsNullOrWhiteSpace(polyline)) {
1934
throw new ArgumentException("Value cannot be null, empty or whitespace.", nameof(polyline));
2035
}

samples/PolylineAlgorithm.NetTopologySuite.Sample/NetTopologyPolylineEncoder.cs

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ namespace PolylineAlgorithm.NetTopologySuite.Sample;
88
using global::NetTopologySuite.Geometries;
99
using PolylineAlgorithm.Abstraction;
1010

11-
internal sealed class NetTopologyPolylineEncoder : AbstractPolylineEncoder<Point, string> {
12-
11+
/// <summary>
12+
/// Encodes a collection of geographic coordinates into an encoded polyline string using NetTopologySuite's Point type.
13+
/// </summary>
14+
public sealed class NetTopologyPolylineEncoder : AbstractPolylineEncoder<Point, string> {
15+
/// <summary>
16+
/// Creates a string representation of the provided polyline.
17+
/// </summary>
18+
/// <param name="polyline">
19+
/// The polyline to encode as a string.
20+
/// </param>
21+
/// <returns>
22+
/// An encoded polyline string representation of the provided polyline.
23+
/// </returns>
1324
protected override string CreatePolyline(ReadOnlyMemory<char> polyline) {
1425
if (polyline.IsEmpty) {
1526
return string.Empty;
@@ -18,11 +29,33 @@ protected override string CreatePolyline(ReadOnlyMemory<char> polyline) {
1829
return polyline.ToString();
1930
}
2031

21-
protected override double GetLatitude(Point? current) {
22-
return current?.X ?? 0d;
32+
/// <summary>
33+
/// Extracts the latitude value from the specified coordinate.
34+
/// </summary>
35+
/// <param name="current">
36+
/// The coordinate from which to extract the latitude value. This should be a not null <see cref="Point"/> instance.
37+
/// </param>
38+
/// <returns>
39+
/// The latitude value as a <see cref="double"/>.
40+
/// </returns>
41+
protected override double GetLatitude(Point current) {
42+
// Validate parameter
43+
44+
return current.X;
2345
}
2446

25-
protected override double GetLongitude(Point? current) {
26-
return current?.Y ?? 0d;
47+
/// <summary>
48+
/// Extracts the longitude value from the specified coordinate.
49+
/// </summary>
50+
/// <param name="current">
51+
/// The coordinate from which to extract the longitude value. This should be a not null <see cref="Point"/> instance.
52+
/// </param>
53+
/// <returns>
54+
/// The longitude value as a <see cref="double"/>.
55+
/// </returns>
56+
protected override double GetLongitude(Point current) {
57+
// Validate parameter
58+
59+
return current.Y;
2760
}
2861
}

samples/PolylineAlgorithm.NetTopologySuite.Sample/PolylineAlgorithm.NetTopologySuite.Sample.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net9.0</TargetFrameworks>
4+
<TargetFramework>netstandard2.1</TargetFramework>
65
<LangVersion>13.0</LangVersion>
76
<Nullable>enable</Nullable>
87
<ImplicitUsings>enable</ImplicitUsings>

samples/PolylineAlgorithm.NetTopologySuite.Sample/Program.cs

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)