private void SearchForMidway(FilterEditModel filters) { GeoCoordinate searchCoordinate; // get itinerary from Google Directions GoogleItinerary itineraryComputer = new GoogleItinerary(); GoogleItineraryBase response = itineraryComputer.GetItinerary(filters.PositionA, filters.PositionB); // push polylines to view for rendering Steps = new Dictionary <double, double>(); foreach (var step in response.routes[0].legs[0].steps) { Steps.Add(step.end_location["lat"], step.end_location["lng"]); } // compute mid point ? // TODO // if google response is not relevant, use As The Crow Flies method searchCoordinate = MidPoint(filters.PositionA, filters.PositionB); Positions.Add(filters.PositionA.Latitude, filters.PositionA.Longitude); Positions.Add(filters.PositionB.Latitude, filters.PositionB.Longitude); InitLocationsByCoordinate(searchCoordinate, filters.OnlyOpenBars); }
public SearchResultModel(FilterEditModel filters) : this() { Mode = filters.Mode; switch (Mode) { case FilterMode.Geolocation: { SearchForGeolocation(filters); break; } case FilterMode.Midway: { SearchForMidway(filters); break; } default: { SearchForDefault(filters); break; } } }
private void SearchForDefault(FilterEditModel filters) { var backOffice = new BackOffice(); foreach (Location location in backOffice.Locations) { if (filters.ZipCodes.Contains(location.ZipCode) && location.IsValid && (!filters.OnlyOpenBars || location.IsOpenNow)) { Locations.Add(location); } } }
public ActionResult SearchFromLocation(double latitude, double longitude, string open) { var model = new FilterEditModel(latitude, longitude, open); return View("Search", model); }
public ActionResult SearchFromBetween(double latA, double lngA, double latB, double lngB, string open) { var model = new FilterEditModel(latA, lngA, latB, lngB, open); return View("Search", model); }
public ActionResult Search(IList<string> zipcodes, string open) { var model = new FilterEditModel(zipcodes, open); return View(model); }
private void SearchForGeolocation(FilterEditModel filters) { InitLocationsByCoordinate(filters.PositionA, filters.OnlyOpenBars); Positions.Add(filters.PositionA.Latitude, filters.PositionA.Longitude); }
private void SearchForMidway(FilterEditModel filters) { GeoCoordinate searchCoordinate; // get itinerary from Google Directions GoogleItinerary itineraryComputer = new GoogleItinerary(); GoogleItineraryBase response = itineraryComputer.GetItinerary(filters.PositionA, filters.PositionB); // push polylines to view for rendering Steps = new Dictionary<double, double>(); foreach (var step in response.routes[0].legs[0].steps) { Steps.Add(step.end_location["lat"], step.end_location["lng"]); } // compute mid point ? // TODO // if google response is not relevant, use As The Crow Flies method searchCoordinate = MidPoint(filters.PositionA, filters.PositionB); Positions.Add(filters.PositionA.Latitude, filters.PositionA.Longitude); Positions.Add(filters.PositionB.Latitude, filters.PositionB.Longitude); InitLocationsByCoordinate(searchCoordinate, filters.OnlyOpenBars); }