using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using wijmoSample1.Models.FileExplorer;
using wijmoSample1.Models.Maps;
using ActionResult = System.Web.Mvc.ActionResult;

namespace wijmoSample1.Controllers
{
    public class MapsController : Controller
    {
        public ActionResult Overview()
        {
            return View();
        }

        public ActionResult MapSource()
        {
            return View();
        }

        public ActionResult VectorLayer()
        {
            return View();
        }

        public ActionResult VectorLayerGeoJson()
        {
            return View();
        }

        public ActionResult Factories()
        {
            return View();
        }

        public ActionResult FlightRoutes()
        {
            return View();
        }

        public ActionResult Grid()
        {
            return View();
        }

        public ActionResult Marks()
        {
            return View();
        }

        public ActionResult Cities()
        {
            return View();
        }

        public ActionResult MapChart()
        {
            return View();
        }

        public ActionResult ReadKmzData()
        {
            var stream = new System.IO.FileStream(Server.MapPath("~/Content/Maps/data/worldmap.kmz"), System.IO.FileMode.Open, System.IO.FileAccess.Read);
            return new DataContractJsonResult<Models.Maps.VectorLayerWijJsonData>(MapsAction.ReadKmzFile(stream), new[] { typeof(VectorLayerWijJsonData), typeof(C1VectorItemBase), typeof(C1VectorPlacemark), typeof(C1VectorPolyline), typeof(C1VectorPolygon), typeof(PointD) });
        }

        private MapsAction _action;
        private MapsAction MapsAction
        {
            get
            {
                return _action ?? (_action = new MapsAction());
            }
        }
    }
}
