Example #1
0
 public ActionResult Index(SearchDirectModel search)
 {
     if (search.keySearch != null)
     {
         MyMapSerVices map_services = new MyMapSerVices();
         try
         {
             search.results = map_services.SearchAll(search.keySearch, 1);
         }
         catch (Exception e)
         {
             ViewBag.hasResult = false;
             ViewBag.message   = "Error:" + e.ToString();
         }
         if (search.results == null || search.results.Length == 0)
         {
             ViewBag.hasResult = false;
             ViewBag.message   = "No result!";
             return(View(search));
         }
         else
         {
             ViewBag.hasResult = true;
             return(View(search));
         }
     }
     else
     {
         ViewBag.hasResult = false;
         ViewBag.message   = "search key not found!";
         return(View());
     }
 }
Example #2
0
        public JsonResult SearchDirect(string keySearch)
        {
            SearchDirectModel search = new SearchDirectModel();

            search.keySearch = keySearch;
            MyMapSerVices map_services = new MyMapSerVices();

            search.results = map_services.SearchAll(search.keySearch, 1);
            return(Json(search, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public JsonResult SearchDirect(string keySearch)
        {
            string errMessage = null;

            SearchDirectModel search = new SearchDirectModel();

            search.keySearch = keySearch;
            MyMapSerVices map_services = new MyMapSerVices();

            try
            {
                search.results = map_services.SearchAll(search.keySearch, 1);
            }
            catch (Exception e)
            {
                errMessage = e.ToString();
            }
            return(Json(search, errMessage, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public JsonResult FindDirects(FindDirectsModel findDirects, Point[] points)
        {
            string errMessage = null;

            ViewBag.hasResult      = true;
            findDirects.startPoint = points[0];
            findDirects.endPoint   = points[1];

            MyMapSerVices map_services = new MyMapSerVices();

            try
            {
                TransportType transport = TransportType.Car;
                findDirects.directionResult = map_services.FindShortPath(points, transport);
            }
            catch (Exception e)
            {
                errMessage = e.ToString();
            }
            return(Json(findDirects.directionResult, errMessage, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public ActionResult FindDirects()
        {
            MyMapSerVices map_services = new MyMapSerVices();

            Point a = new Point();

            a.Latitude  = 14.072644954380323;
            a.Longitude = 108.43505859375;

            Point b = new Point();

            b.Latitude  = 14.30696949782579;
            b.Longitude = 108.0615234375;

            var points = new Point[2];

            points[0] = a;
            points[1] = b;
            var test = map_services.FindShortPath(points, 0);


            return(View());
        }