using Igdc;
using System.Windows;

namespace Editor.Extensions
{
    public static class PointArrayExt
    {
        public static MapDto ToDto(this Point[,] array)
        {
            var dto = new MapDto();
            for (var x = 0; x < array.GetUpperBound(0) + 1; x++)
                for (var y = 0; y < array.GetUpperBound(1) + 1; y++)
                {
                    var value = array[x, y];
                    dto.Elements[new MapDto.MapDtoElement { X = x, Y = y }]
                        = new MapDto.MapDtoElement { X = (int)value.X, Y = (int)value.Y };
                }
            return dto;
        }
    }
}