GetOverview() public method

获取地图的鹰眼图片。
public GetOverview ( string mapName, MapParameter mapParameter, ImageOutputOption imageOutputOption ) : Overview
mapName string 地图名称。
mapParameter SuperMap.Connector.Utility.MapParameter 地图参数。
imageOutputOption SuperMap.Connector.Utility.ImageOutputOption 图片输出设置。
return SuperMap.Connector.Utility.Overview
Example #1
0
        public void GetOverviewTest_MapParameterISNull()
        {
            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;
            Overview image = map.GetOverview(mapName, null, option);
            Assert.IsNotNull(image.ImageUrl);
            Assert.IsNull(image.ImageData);
            Assert.AreEqual(image.Viewer.Height, 256);
            Assert.AreEqual(image.Viewer.Width, 256);
            Assert.IsNotNull(image.LastModified);
            Assert.IsNotNull(image.ViewBounds);
            Assert.AreEqual(image.ViewBounds.LeftBottom.X, 84.30460372171433);
            Assert.AreEqual(image.ViewBounds.LeftBottom.Y, 15.704362017314319);
            Assert.AreEqual(image.MapName, mapName);
        }
Example #2
0
        public void GetOverviewTest_MapNameISNULL()
        {
            Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");

            ImageOutputOption option = new ImageOutputOption();
            option.ImageOutputFormat = ImageOutputFormat.PNG;
            option.ImageReturnType = ImageReturnType.BINARY;
            Overview image = null;
            try
            {
                image = map.GetOverview(string.Empty, new MapParameter(), option);
            }
            catch (ArgumentNullException e)
            {
                Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: mapName");
            }
        }
Example #3
0
        public void GetOverviewTest_png()
        {
            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.BINARY;
            Overview image = map.GetOverview(mapName, new MapParameter(), 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(26, 163);
                Assert.AreEqual(color.ToString(), "Color [A=255, R=196, G=193, B=225]");
                System.Drawing.Color color1 = bmp.GetPixel(130, 164);
                Assert.AreEqual(color1.ToString(), "Color [A=255, R=252, G=204, B=182]");
            }
        }
Example #4
0
        public void GetOverviewTest_NotTransparent()
        {
            Map map = new Map("http://" + ip + ":8090/iserver/services/map-jingjin/rest");
            string mapName = "京津地区土地利用现状图";

            ImageOutputOption option = new ImageOutputOption();
            option.ImageOutputFormat = ImageOutputFormat.PNG;
            option.ImageReturnType = ImageReturnType.BINARY;
            option.Transparent = false;
            Overview image = map.GetOverview(mapName, new MapParameter(), 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(26, 163);
                Assert.AreEqual(color.ToString(), "Color [A=255, R=255, G=255, B=255]");
                System.Drawing.Color color1 = bmp.GetPixel(200, 120);
                Assert.AreEqual(color1.ToString(), "Color [A=255, R=247, G=254, B=180]");
            }
        }
Example #5
0
 public void GetOverviewTest_View()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     string mapName = "世界地图";
     MapParameter param = new MapParameter();
     param.Viewer = new SuperMap.Connector.Utility.Rectangle();
     param.Viewer.LeftTop = new SuperMap.Connector.Utility.Point(0, 0);
     param.Viewer.RightBottom = new SuperMap.Connector.Utility.Point(512, 512);
     ImageOutputOption option = new ImageOutputOption();
     option.ImageOutputFormat = ImageOutputFormat.PNG;
     option.ImageReturnType = ImageReturnType.URL;
     Overview image = map.GetOverview(mapName, param, option);
     Assert.IsNotNull(image.ImageUrl);
     Assert.IsNull(image.ImageData);
     Assert.AreEqual(image.Viewer.Height, 512);
     Assert.AreEqual(image.Viewer.Width, 512);
     Assert.IsNotNull(image.LastModified);
     Assert.IsNotNull(image.ViewBounds);
 }