//由bounds获取tile的起始和结束行列号
//[startColumn,startRow,endColumn,endRow] //Returns [0,0,-1,-1] if fails
private int[] GetTileSpanWithin(Rectangle2D bounds, double resolution)
{
Rectangle2D temp = bounds.Intersect(this.Bounds);
if (!Rectangle2D.IsNullOrEmpty(temp))
{
double x = this.Origin.X;
double y = this.Origin.Y;
int startColumn = (int)Math.Floor((double)(((temp.Left - x) + (resolution * 0.5)) / (resolution * this.TileSize)));
int startRow = (int)Math.Floor((double)(((y - temp.Top) + (resolution * 0.5)) / (resolution * this.TileSize)));
int endColumn = (int)Math.Floor((double)(((temp.Right - x) - (resolution * 0.5)) / (resolution * this.TileSize)));
int endRow = (int)Math.Floor((double)(((y - temp.Bottom) - (resolution * 0.5)) / (resolution * this.TileSize)));
return new int[] { startColumn, startRow, endColumn, endRow };
}
return new int[4] { 0, 0, -1, -1 };
}