public GetEntireImage ( string mapName, |
||
mapName | string | 地图名称。 |
mapParameter | 地图参数。 | |
imageOutputOption | 图片输出设置。 | |
Результат |
public void GetEntireImageTest_Error() { Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest"); string mapName = ""; ImageOutputOption option = new ImageOutputOption(); option.ImageOutputFormat = ImageOutputFormat.PNG; option.ImageReturnType = ImageReturnType.URL; MapImage image = null; try { image = map.GetEntireImage(mapName, string.Empty, new MapParameter(), option); } catch (ArgumentNullException e) { Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: mapName"); } }
public void GetEntireImageTest_MapParamerterISNULL() { Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest"); string mapName = "世界地图"; ImageOutputOption option = new ImageOutputOption(); option.ImageOutputFormat = ImageOutputFormat.PNG; option.ImageReturnType = ImageReturnType.URL; MapImage image = map.GetEntireImage(mapName, string.Empty, null, option); Assert.IsTrue(image.ImageUrl.Contains("http://192.168.116.114:8090/iserver/services/map-world/rest/maps/%e4%b8%96%e7%95%8c%e5%9c%b0%e5%9b%be/entireimage.png?layerName=&redirect=true&transparent=False&")); }
public void GetEntireImageTest_BMP() { Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest"); string mapName = "世界地图"; ImageOutputOption option = new ImageOutputOption(); option.ImageOutputFormat = ImageOutputFormat.BMP; option.ImageReturnType = ImageReturnType.BINARY; MapImage image = map.GetEntireImage(mapName, null, option); Assert.IsNull(image.ImageUrl); Assert.IsNotNull(image.ImageData); using (MemoryStream memoryStream = new MemoryStream(image.ImageData)) { Bitmap bmp = new Bitmap(memoryStream); Assert.IsTrue(bmp.Width == 256); Assert.IsTrue(bmp.Height == 256); System.Drawing.Color color = bmp.GetPixel(200, 163); Assert.AreEqual(color.ToString(), "Color [A=255, R=153, G=179, B=204]"); } }
public void GetEntireImageTest() { Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest"); string mapName = "世界地图"; ImageOutputOption option = new ImageOutputOption(); option.ImageOutputFormat = ImageOutputFormat.PNG; option.ImageReturnType = ImageReturnType.URL; MapImage image = map.GetEntireImage(mapName, string.Empty, new MapParameter(), option); //Assert.AreEqual(image.MapParameter.Viewer.Height, 256); //Assert.AreEqual(image.MapParameter.Viewer.Width, 256); Assert.IsNotNull(image.ImageUrl); Assert.IsNull(image.ImageData); }