2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2013-05-07 18:12:25 +02:00
|
|
|
|
// Copyright © Clemens Fischer 2012-2013
|
2012-07-07 17:19:10 +02:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2012-05-04 12:52:20 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A collection of geographic locations.
|
|
|
|
|
|
/// </summary>
|
2012-11-22 21:42:29 +01:00
|
|
|
|
public partial class LocationCollection : ObservableCollection<Location>
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
public LocationCollection()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public LocationCollection(IEnumerable<Location> locations)
|
|
|
|
|
|
{
|
2012-12-15 18:54:40 +01:00
|
|
|
|
foreach (var location in locations)
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
Add(location);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
|
public static LocationCollection Parse(string s)
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
LocationCollection locations = new LocationCollection();
|
|
|
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
|
foreach (var locString in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
locations.Add(Location.Parse(locString));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return locations;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|