Exemplo n.º 1
0
    //Retrieve 10 similar landmarks in a given location
    public List <Landmark> getSimilar(Landmark l)
    {
        ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
        string          response     = client.DownloadString(url + Translation.Instance.getStartLat() + ',' + Translation.Instance.getStartLon() + "&type=" + l.getType());
        JsonData        jsonResponse = JsonMapper.ToObject(response);
        List <Landmark> results      = new List <Landmark>();

        for (int i = 0; i < Constants.NUM_CANDIDATES; i++)
        {
            JsonData res = jsonResponse["results"];
            //If there are enough valid results
            if (res.Count > i)
            {
                results.Add(jsonParse(res[i], l.getType()));
            }
        }
        return(results);
    }