private void UpdateDistance(double dist, GeometryLocation loc0, GeometryLocation loc1, bool flip) { _minDistance = dist; var index = flip ? 1 : 0; _minDistanceLocation[index] = loc0; _minDistanceLocation[1 - index] = loc1; if (_minDistance < _terminateDistance) { _isDone = true; } }
/** * Method that makes call to Google Places API and * retrieves list of places given specific parameters * <param name="keyword">Term to match against all content Google has indexed * including but not limited to name, type, and address</param> * <param name="type">Used to indicate status.</param> */ public PlaceSearchResponse GetPlaces(string keyword, string type, GeometryLocation location) { // Initialize API request with URL and API key RestRequest request = new RestRequest("/nearbysearch/json?", Method.GET); request.AddQueryParameter("key", _apiKey); // Add parameters to API request, these will need to be changed request.AddQueryParameter("keyword", keyword); request.AddQueryParameter("location", $"{location.Latitude}, {location.Longitude}"); request.AddQueryParameter("radius", "10000"); request.AddQueryParameter("type", type); // Get respones from API using above request IRestResponse response = _client.Execute(request); // Convert JSON response to model and return response PlaceSearchResponse apiResponse = JsonConvert.DeserializeObject <PlaceSearchResponse>(response.Content); return(apiResponse); }
public Geometry() { location = new GeometryLocation(); }