-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransitLineData.cs
45 lines (40 loc) · 1.5 KB
/
TransitLineData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using Sprache;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace IndoorCO2App_Multiplatform
{
public class TransitLineData
{
public string VehicleType;
public long ID;
public string NWRType;
public string Name;
public string ShortenedName;
public double latitude; //used for cached Data
public double longitude; //used for cached Data
public TransitLineData(string vehicleType, string NWRType, long ID, string name, double latitude, double longitude)
{
this.VehicleType = vehicleType;
this.ID = ID;
this.Name = name;
this.NWRType = NWRType;
this.ShortenedName = Regex.Replace(Name, @":\s*.*?=>\s*", ": ");
this.latitude = Math.Round(latitude, 3); //we round to 3rd decimal = ~100m
this.longitude = Math.Round(longitude, 3); //we round to 3rd decimal = varies in length but between 110 - 50 m in most inhabited areas
}
public override string ToString()
{
string ShortenedName = Regex.Replace(Name, @":\s*.*?=>\s*", ": ");
if(MainPage.MainPageSingleton.favouredLocations.Contains(NWRType+"_"+ID.ToString()))
{
return $"★ {ShortenedName} ";
}
else return $"{ShortenedName} ";
}
}
}