public void EncodeTest() { PES.MapService.MapSearchService.IMapService target = new PES.MapService.MapSearchService.MapService(); // TODO: 初始化为适当的值 string latitude = "22.59300"; // TODO: 初始化为适当的值 string longitude = "113.87087"; // TODO: 初始化为适当的值 string expected = string.Empty; // TODO: 初始化为适当的值 string actual; actual = target.Encode(latitude, longitude); PES.MapService.Entity.LatLon latlon = target.Decode(actual); if (latlon == null) { Assert.Fail("latalon为null"); } else { if (latlon.Latitude != Convert.ToDecimal(latitude)) { Assert.Fail("latlon.Latitude error,result is {0}",latlon.Latitude); } if (latlon.Longitude != Convert.ToDecimal(longitude)) { Assert.Fail("latlon.Longitude error,result is {0}", latlon.Longitude); } } // Assert.AreNotEqual(expected, actual); //Assert.Inconclusive("验证此测试方法的正确性。"); }
public string GetVehicleLocationInfo(string vehicleCode) { IGPSTrackManager trackManager = new GPSTrackManager(); EGPSCurrentInfo currentInfo; try { currentInfo = trackManager.GetCurrentInfo(new Guid(vehicleCode)); } catch (GPSCurrentInfoNullException ex) { Logger.Error(ex); throw ex; } IMapService ms = new PES.MapService.MapSearchService.MapService(); string encode = ms.Encode(currentInfo.Latitude.ToString(), currentInfo.Longitude.ToString()); LocationInfo locationInfo = ms.InverseGeocoding(currentInfo.Latitude.ToString(), currentInfo.Longitude.ToString()); return string.Format("{0},{1}", encode, locationInfo.ToString()); }
private static string[] GetEncodeLatLon(bool isNotEncode, IList<EGPSCurrentInfo> ltCurrentInfo) { IList<LatLon> ltLatLon = new List<LatLon>(); foreach (EGPSCurrentInfo currentInfo in ltCurrentInfo) { ltLatLon.Add(new LatLon(currentInfo.Latitude, currentInfo.Longitude)); } IMapService mapService = new PES.MapService.MapSearchService.MapService(); string[] arrLatLonEncode = null; if (!isNotEncode) { arrLatLonEncode = mapService.Encode(ltLatLon.ToArray()); } return arrLatLonEncode; }
private LocationInfo GetLocationByLatitudeLongitude(decimal longtitude, decimal latitude) { IMapService mapService = new PES.MapService.MapSearchService.MapService(); string encodeLatLon = mapService.Encode(latitude.ToString(), longtitude.ToString()); LocationInfo locationInfo = mapService.InverseGeocoding(encodeLatLon); return locationInfo; }
public void EncodeArrayTest() { PES.MapService.MapSearchService.IMapService target = new PES.MapService.MapSearchService.MapService(); LatLon[] latlons = new LatLon[] { new LatLon(22.593m,113.87087m), new LatLon(22.97033m,113.33485m) }; string[] expected = new string[] { "ISGRCFVUADRDDG", "IRAFFVXTWWTDGA" }; string []actual; actual = target.Encode(latlons); if (expected[0] != actual[0] || expected[1] != actual[1]) { Assert.Fail("Encode() failed, result:{0},{1}", actual[0], actual[1]); } }