2012-11-22 21:42:29 +01:00
|
|
|
|
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
|
2016-02-23 20:07:30 +01:00
|
|
|
|
// © 2016 Clemens Fischer
|
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;
|
2013-11-05 18:00:03 +01:00
|
|
|
|
using System.Linq;
|
2012-05-04 12:52:20 +02:00
|
|
|
|
|
|
|
|
|
|
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)
|
2013-11-05 18:00:03 +01:00
|
|
|
|
: base(locations)
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-11-05 18:00:03 +01:00
|
|
|
|
public LocationCollection(List<Location> locations)
|
|
|
|
|
|
: base(locations)
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
2013-11-05 18:00:03 +01:00
|
|
|
|
}
|
2012-05-04 12:52:20 +02:00
|
|
|
|
|
2013-11-05 18:00:03 +01:00
|
|
|
|
public static LocationCollection Parse(string s)
|
|
|
|
|
|
{
|
|
|
|
|
|
var strings = s.Split(new char[] { ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
|
2012-05-04 12:52:20 +02:00
|
|
|
|
|
2013-11-05 18:00:03 +01:00
|
|
|
|
return new LocationCollection(strings.Select(l => Location.Parse(l)));
|
2012-05-04 12:52:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|