using GeoCoordinatePortable;
using PositioningWebApp.Models.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PositioningWebApp.Services
{
	public class Distance
	{
		public double Coumpiute(List<Marker> markers)
		{
			double ret = 0;
			for (int i = 0; i < markers.Count - 1; i++)
			{
				var first = new GeoCoordinate(markers[i].Latitude, markers[i].Longitude);
				var second = new GeoCoordinate(markers[i + 1].Latitude, markers[i + 1].Longitude);
				ret = ret + first.GetDistanceTo(second);
			}
			return ret;
		}
	}
}
