Show all landmarks on map
This commit is contained in:
@@ -3,7 +3,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
@@ -15,6 +14,9 @@ using Windows.UI.Xaml.Media;
|
|||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using Windows.Devices.Geolocation;
|
using Windows.Devices.Geolocation;
|
||||||
using Windows.UI.Xaml.Controls.Maps;
|
using Windows.UI.Xaml.Controls.Maps;
|
||||||
|
using NavCityBreda.Model;
|
||||||
|
using Windows.Storage.Streams;
|
||||||
|
using Windows.UI.Popups;
|
||||||
|
|
||||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||||
|
|
||||||
@@ -35,8 +37,28 @@ namespace NavCityBreda.Views
|
|||||||
this.DataContext = new MapVM();
|
this.DataContext = new MapVM();
|
||||||
|
|
||||||
CurrenPosition = new MapIcon();
|
CurrenPosition = new MapIcon();
|
||||||
|
Map.MapElements.Add(CurrenPosition);
|
||||||
|
|
||||||
App.Geo.PositionChanged += Geo_PositionChanged;
|
App.Geo.PositionChanged += Geo_PositionChanged;
|
||||||
|
|
||||||
|
DrawLandmarks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawLandmarks()
|
||||||
|
{
|
||||||
|
foreach(Route r in App.RouteManager.Routes)
|
||||||
|
{
|
||||||
|
foreach(Landmark l in r.Waypoints.Where(l => l is Landmark))
|
||||||
|
{
|
||||||
|
MapIcon m = new MapIcon();
|
||||||
|
m.Location = l.Location;
|
||||||
|
m.NormalizedAnchorPoint = new Point(0.5, 1.0);
|
||||||
|
m.Title = l.Name;
|
||||||
|
m.ZIndex = 10;
|
||||||
|
//m.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///" + l.Image));
|
||||||
|
Map.MapElements.Add(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Geo_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
|
private void Geo_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
|
||||||
@@ -53,8 +75,14 @@ namespace NavCityBreda.Views
|
|||||||
CurrenPosition.NormalizedAnchorPoint = new Point(0.5, 1.0);
|
CurrenPosition.NormalizedAnchorPoint = new Point(0.5, 1.0);
|
||||||
CurrenPosition.Title = "Current Position";
|
CurrenPosition.Title = "Current Position";
|
||||||
CurrenPosition.ZIndex = 999;
|
CurrenPosition.ZIndex = 999;
|
||||||
|
}
|
||||||
|
|
||||||
Map.MapElements.Add(CurrenPosition);
|
private void Map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
|
||||||
|
{
|
||||||
|
MessageDialog m = new MessageDialog("Not yet implemnted. Not sure how to get the tapped element.", "Element tapped");
|
||||||
|
m.ShowAsync();
|
||||||
|
|
||||||
|
Map.TrySetViewBoundsAsync(App.RouteManager.Routes.First().Bounds, new Thickness(10), MapAnimationKind.Bow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user