public string Encode(LatLon[] latlons) { string postString = string.Format("latlon={0}&customer=1", LatLon.ToParasString(latlons)); string responseText = WebRequestHelper.UploadData(URL_ENCODE, postString, TIMEOUT, Encoding.UTF8); return responseText; }
public bool IsInArea(LatLon max, LatLon min) { bool inArea = true; if (_latitude > max.Latitude || _latitude < min.Latitude) { inArea = false; } else if (_longitude > max.Longitude || _longitude < min.Longitude) { inArea = false; } return inArea; }
public static string ToParasString(LatLon[] arrLatLon, EnumLotLonParasStringType type) { if (arrLatLon == null || arrLatLon.Length == 0) return string.Empty; StringBuilder sb = new StringBuilder(); foreach (LatLon latlon in arrLatLon) { if (type == EnumLotLonParasStringType.LatitudeFirst) { sb.AppendFormat("{0},{1};", latlon.Latitude, latlon.Longitude); } else { sb.AppendFormat("{0},{1};", latlon.Longitude, latlon.Latitude); } } return sb.ToString().TrimEnd(';'); }
private bool IsAllIn(LatLon[] arr, out IList<LocationInfo> ltLocationInfo) { ltLocationInfo = new List<LocationInfo>(); foreach (var item in arr) { LocationInfo temp; if (!InArea(item.Latitude, item.Longitude, out temp)) return false; ltLocationInfo.Add(temp); } return true; }