XAML-Map-Control/MapControl/LocationCollection.cs

39 lines
1,003 B
C#

// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2014 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace MapControl
{
/// <summary>
/// A collection of geographic locations.
/// </summary>
public partial class LocationCollection : ObservableCollection<Location>
{
public LocationCollection()
{
}
public LocationCollection(IEnumerable<Location> locations)
: base(locations)
{
}
public LocationCollection(List<Location> locations)
: base(locations)
{
}
public static LocationCollection Parse(string s)
{
var strings = s.Split(new char[] { ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
return new LocationCollection(strings.Select(l => Location.Parse(l)));
}
}
}