public System.Drawing.Point getNewPixelOffsetOfLeftTop(int level, int row1, int col1) { BdCoodOffsetProvider p = BdCoodOffsetProvider.getInstance(); System.Drawing.Point org_leftBottom = getMetersFromRowCol(row1, col1, level); LatLng lpt = MetersToLatLon(org_leftBottom); LatLng testPoint = p.doAdjust(lpt, level); LatLng meters = BdCoodOffsetProvider.BaiduGPS2BaiduMercator(new LatLng(testPoint.latitude, testPoint.longitude)); double resolution = GetResolutionForLevel(level); System.Drawing.Point new_leftBottom = new System.Drawing.Point((int)(meters.longitude / resolution), (int)(meters.latitude / resolution)); return(new_leftBottom); }
public RCRange getBaiduRCRangeFromGPS(Envelope area, int level) { int PIC_SIZE = 256; double resolution = GetResolutionForLevel(level); BdCoodOffsetProvider p = BdCoodOffsetProvider.getInstance(); LatLng leftTopLpt = new LatLng(area.YMax, area.XMin); LatLng testPoint = p.doAdjust(leftTopLpt, level); LatLng meters = BdCoodOffsetProvider.BaiduGPS2BaiduMercator(new LatLng(testPoint.latitude, testPoint.longitude)); System.Drawing.Point new_leftTop = new System.Drawing.Point((int)(meters.longitude / resolution), (int)(meters.latitude / resolution)); LatLng rightBottomLpt = new LatLng(area.YMin, area.XMax); testPoint = p.doAdjust(rightBottomLpt, level); meters = BdCoodOffsetProvider.BaiduGPS2BaiduMercator(new LatLng(testPoint.latitude, testPoint.longitude)); System.Drawing.Point new_rightBottom = new System.Drawing.Point((int)(meters.longitude / resolution), (int)(meters.latitude / resolution)); return(new RCRange() { MaxCol = (new_rightBottom.X + 5) / PIC_SIZE, MaxRow = (new_leftTop.Y + 5) / PIC_SIZE, MinCol = (new_leftTop.X - 5) / PIC_SIZE, MinRow = (new_rightBottom.Y - 5) / PIC_SIZE }); }