格网图片行列索引。
示例#1
0
 /// <summary>
 /// 初始化TileIndex类的新实例,通过指定的对象初始化新对象的值。
 /// </summary>
 /// <param name="tileIndex">地图格网行列索引</param>
 public TileIndex(TileIndex tileIndex)
 {
     if (tileIndex == null)
     {
         return;
     }
     this.ColIndex = tileIndex.ColIndex;
     this.RowIndex = tileIndex.RowIndex;
 }
示例#2
0
        public void GetTileTest_ByTempLayer()
        {
            Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");

            TileInfo tileInfo = new TileInfo();
            tileInfo.Scale = 0.00000002;
            tileInfo.Height = 512;
            tileInfo.Width = 512;
            TileIndex tileIndex = new TileIndex() { RowIndex = 2, ColIndex = 1 };
            tileInfo.TileIndex = tileIndex;

            MapParameter mapParameter = map.GetDefaultMapParameter("世界地图");

            List<Layer> tempLayer = new List<Layer>();
            tempLayer.Add(mapParameter.Layers[12]);
            mapParameter.Layers = tempLayer;

            ImageOutputOption imageOutputOption = new ImageOutputOption();
            imageOutputOption.ImageReturnType = ImageReturnType.BINARY;
            imageOutputOption.Transparent = false;
            imageOutputOption.ImageOutputFormat = ImageOutputFormat.PNG;

            MapImage mapImage = map.GetTile("世界地图", tileInfo, imageOutputOption, mapParameter);
            using (MemoryStream memoryStream = new MemoryStream(mapImage.ImageData))
            {
                Bitmap bmp = new Bitmap(memoryStream);
                Assert.IsTrue(bmp.Width == 512);
                Assert.IsTrue(bmp.Height == 512);
                System.Drawing.Color color = bmp.GetPixel(240, 389);
                Assert.IsTrue(color.R == 242);
                Assert.IsTrue(color.G == 239);
                Assert.IsTrue(color.B == 233);
            }

            Assert.IsNull(null);
        }