From 547fa4d1dad6e0d94cf892dd9080280ca95a1f47 Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Thu, 17 Dec 2015 00:21:20 +0100 Subject: [PATCH] Implemented route --- NavCityBreda/Model/Route.cs | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/NavCityBreda/Model/Route.cs b/NavCityBreda/Model/Route.cs index 786e678..322af44 100644 --- a/NavCityBreda/Model/Route.cs +++ b/NavCityBreda/Model/Route.cs @@ -1,12 +1,48 @@ -using System; +using NavCityBreda.Helpers; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Windows.Devices.Geolocation; namespace NavCityBreda.Model { - class Route + public class Route { + private GeoboundingBox _bounds; + public GeoboundingBox Bounds { get { if (_bounds == null) CalculateBounds(); return _bounds; } } + + public string Name { get; private set; } + public string Description { get; private set; } + public string Landmarks { get; private set; } + public int Minutes { get; private set; } + + private List _waypoints; + public List Waypoints { get { return _waypoints; } } + + public Route(string name, string desc, string landmarks, int minutes) + { + Name = name; + Description = desc; + Landmarks = landmarks; + Minutes = minutes; + _waypoints = new List(); + } + + public void Add(Waypoint w) + { + _waypoints.Add(w); + } + + public void Remove(Waypoint w) + { + _waypoints.Remove(w); + } + + private void CalculateBounds() + { + _bounds = BoundingBox.GetBoundingBox(_waypoints.Select(p => p.Location).ToList()); + } } }