// Get the supplied area, in pixels public IRectangle GetRectPixels(Int32 _scale, IRectangleD _rect) { Point ptLB = GetBitmapCoordinate(new PointF((float)_rect.XMin, (float)_rect.YMin), _scale); Point ptRT = GetBitmapCoordinate(new PointF((float)_rect.XMax, (float)_rect.YMax), _scale); // left-top pixel is at (0, 0), reversed by Y return(new Rectangle(ptLB.X, ptRT.Y, ptRT.X, ptLB.Y)); }
// Get the supplied area, in pixels public IRectangle GetRectPixels(Int32 scale, IRectangleD rect) { int d = (1 << (_scaleHi - scale + 1)) * _tileSizeY; double c = Math.Pow(2.0, scale - _scaleLo); //reverse y Rectangle rectPixels = new Rectangle((int)((rect.XMin) / c), Math.Max(0, Math.Min(d - 1, (int)((-rect.YMax) / c))), (int)((rect.XMax) / c), Math.Max(0, Math.Min(d - 1, (int)((-rect.YMin) / c)))); return(rectPixels); }
// Get the supplied area, in tiles public IRectangle GetRectTiles(Int32 _scale, IRectangleD _rect) { IRectangle rectTiles = GetRectPixels(_scale, _rect); rectTiles.XMin = rectTiles.XMin / m_nTileSizeX; rectTiles.YMin = rectTiles.YMin / m_nTileSizeY; rectTiles.XMax = rectTiles.XMax / m_nTileSizeX; rectTiles.YMax = rectTiles.YMax / m_nTileSizeY; return(rectTiles); }
// Get the supplied area, in pixels public IRectangle GetRectPixels(Int32 _scale, IRectangleD _rect) { int d = (1 << (m_nScaleHi - _scale + 1)) * m_nTileSizeY; double c = Math.Pow(2.0, _scale - m_nScaleLo); // y should be reversed Rectangle rect = new Rectangle((int)((_rect.XMin) / c), Math.Max(0, Math.Min(d - 1, (int)(d / 2 - (_rect.YMax) / c))), (int)((_rect.XMax) / c), Math.Max(0, Math.Min(d - 1, (int)(d / 2 - (_rect.YMin) / c)))); return(rect); }
// Get the supplied area, in tiles public IRectangle GetRectTiles(Int32 scale, IRectangleD rect) { IRectangle rectTiles = GetRectPixels(scale, rect); rectTiles.XMin = rectTiles.XMin / _tileSizeX; rectTiles.YMin = rectTiles.YMin / _tileSizeY; rectTiles.XMax = rectTiles.XMax / _tileSizeX; rectTiles.YMax = rectTiles.YMax / _tileSizeY; return(rectTiles); }
public IRectangle GetRectPixels(int _scale, IRectangleD _rect) { //_rect is in the coordinate system of the image, in this case mercator spherical projection GlobalMercator p = new GlobalMercator(); //reverse the scale values (Manifold goes the opposite way to TMS / Google / Microsoft) Int32 zoom = ScaleHi - _scale; Point ptLB = p.GetPixels(new PointD(_rect.XMin, _rect.YMin), zoom); Point ptRT = p.GetPixels(new PointD(_rect.XMax, _rect.YMax), zoom); // bottom-left pixel is at (0, 0) return(new Rectangle(Convert.ToInt32(ptLB.X), Convert.ToInt32(ptLB.Y), Convert.ToInt32(ptRT.X), Convert.ToInt32(ptRT.Y))); }
public IRectangle GetRectTiles(int _scale, IRectangleD _rect) { IRectangle rectFix = GetRectPixels(_scale, _rect); rectFix.XMax = rectFix.XMax - 1; rectFix.YMax = rectFix.YMax - 1; rectFix.XMin = rectFix.XMin / m_TileSizeX; rectFix.YMin = rectFix.YMin / m_TileSizeY; rectFix.XMax = rectFix.XMax / m_TileSizeX; rectFix.YMax = rectFix.YMax / m_TileSizeY; return(rectFix); }
// Get the supplied area, in tiles public IRectangle GetRectTiles(Int32 _scale, IRectangleD _rect) { IRectangle rectFix = GetRectPixels(_scale, _rect); rectFix.XMax = rectFix.XMax - 1; rectFix.YMax = rectFix.YMax - 1; rectFix.XMin = rectFix.XMin / m_nTileSizeX; rectFix.YMin = rectFix.YMin / m_nTileSizeY; rectFix.XMax = rectFix.XMax / m_nTileSizeX; rectFix.YMax = rectFix.YMax / m_nTileSizeY; return rectFix; }
// Get the supplied area, in pixels public IRectangle GetRectPixels(Int32 _scale, IRectangleD _rect) { Point ptLB = GetBitmapCoordinate(new PointF((float)_rect.XMin, (float)_rect.YMin), _scale); Point ptRT = GetBitmapCoordinate(new PointF((float)_rect.XMax, (float)_rect.YMax), _scale); // left-top pixel is at (0, 0), reversed by Y return new Rectangle(ptLB.X, ptRT.Y, ptRT.X, ptLB.Y); }
public IRectangle GetRectPixels(int _scale, IRectangleD _rect) { //_rect is in the coordinate system of the image, in this case mercator spherical projection GlobalMercator p = new GlobalMercator(); //reverse the scale values (Manifold goes the opposite way to TMS / Google / Microsoft) Int32 zoom = ScaleHi - _scale; Point ptLB = p.GetPixels(new PointD(_rect.XMin, _rect.YMin), zoom); Point ptRT = p.GetPixels(new PointD(_rect.XMax, _rect.YMax), zoom); // bottom-left pixel is at (0, 0) return new Rectangle(Convert.ToInt32(ptLB.X), Convert.ToInt32(ptLB.Y), Convert.ToInt32(ptRT.X), Convert.ToInt32(ptRT.Y)); }
// Get the supplied area, in pixels public IRectangle GetRectPixels(Int32 _scale, IRectangleD _rect) { int d = (1 << (m_nScaleHi - _scale + 1)) * m_nTileSizeY; double c = Math.Pow(2.0, _scale - m_nScaleLo); // y should be reversed Rectangle rect = new Rectangle((int)((_rect.XMin) / c), Math.Max(0, Math.Min(d - 1, (int)(d / 2 - (_rect.YMax) / c))), (int)((_rect.XMax) / c), Math.Max(0, Math.Min(d - 1, (int)(d / 2 - (_rect.YMin) / c)))); return rect; }