aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.Backend/Services/Processors/AbstractProcessor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Costasdev.Busurbano.Backend/Services/Processors/AbstractProcessor.cs')
-rw-r--r--src/Costasdev.Busurbano.Backend/Services/Processors/AbstractProcessor.cs56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/Costasdev.Busurbano.Backend/Services/Processors/AbstractProcessor.cs b/src/Costasdev.Busurbano.Backend/Services/Processors/AbstractProcessor.cs
deleted file mode 100644
index 343f511..0000000
--- a/src/Costasdev.Busurbano.Backend/Services/Processors/AbstractProcessor.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Costasdev.Busurbano.Backend.Services;
-
-public abstract class AbstractRealTimeProcessor : IArrivalsProcessor
-{
- public abstract Task ProcessAsync(ArrivalsContext context);
-
- protected static List<(double Lat, double Lon)> Decode(string encodedPoints)
- {
- if (string.IsNullOrEmpty(encodedPoints))
- return new List<(double, double)>();
-
- var poly = new List<(double, double)>();
- char[] polylineChars = encodedPoints.ToCharArray();
- int index = 0;
-
- int currentLat = 0;
- int currentLng = 0;
- int next5bits;
- int sum;
- int shifter;
-
- while (index < polylineChars.Length)
- {
- // calculate next latitude
- sum = 0;
- shifter = 0;
- do
- {
- next5bits = (int)polylineChars[index++] - 63;
- sum |= (next5bits & 31) << shifter;
- shifter += 5;
- } while (next5bits >= 32 && index < polylineChars.Length);
-
- if (index >= polylineChars.Length)
- break;
-
- currentLat += (sum & 1) == 1 ? ~(sum >> 1) : (sum >> 1);
-
- // calculate next longitude
- sum = 0;
- shifter = 0;
- do
- {
- next5bits = (int)polylineChars[index++] - 63;
- sum |= (next5bits & 31) << shifter;
- shifter += 5;
- } while (next5bits >= 32 && index < polylineChars.Length);
-
- currentLng += (sum & 1) == 1 ? ~(sum >> 1) : (sum >> 1);
-
- poly.Add((Convert.ToDouble(currentLat) / 100000.0, Convert.ToDouble(currentLng) / 100000.0));
- }
-
- return poly;
- }
-}