/// <summary> /// Mapcell2s the index of the area.取得大图的index映射到分区网格的index /// </summary> /// <returns>The area index.</returns> /// <param name="grid">Grid.</param> /// <param name="gridArea">Grid area.</param> /// <param name="index">Index.</param> /// <param name="scale">Scale.</param> int mapIndex2AreaIndex(GridBase grid, GridBase gridArea, int index, int scale) { int areaIndex = -1; int col = grid.GetColumn(index); int row = grid.GetRow(index); col = col / scale; row = row / scale; areaIndex = gridArea.GetCellIndex(col, row); return(areaIndex); }
/// 分区网格的index转成大地图每屏的index List <int> areaIndex2MapPageIndexs(GridBase grid, GridBase gridArea, int areaIndex, int scale) { List <int> ret = new List <int>(); int col = gridArea.GetColumn(areaIndex); int row = gridArea.GetRow(areaIndex); col = col * scale; row = row * scale; for (int i = col + editorCfg.pageSize / 2; i < col + scale - 1; i = i + editorCfg.pageSize) { for (int j = row + editorCfg.pageSize / 2; j < row + scale - 1; j = j + editorCfg.pageSize) { ret.Add(grid.GetCellIndex(i, j)); } } return(ret); }