コード例 #1
0
 public void UpdateRasterEnvelope(float rasterScale, int beginX, int beginY, int xSize, int ySize)
 {
     _rasterEnvelopeOfWnd.Location = new Point(beginX, beginY);
     _rasterEnvelopeOfWnd.Width    = xSize;
     _rasterEnvelopeOfWnd.Height   = ySize;
     //
     if (_wndExtandMultiple > 1)
     {
         float scale          = _rasterEnvelopeOfWnd.Width / _wndWidth;
         float extandWidth    = (_wndExtandMultiple * _wndWidth - _wndWidth) / 2f;
         float extandHeight   = (_wndExtandMultiple * _wndHeight - _wndHeight) / 2f;
         int   extandHalfCols = (int)(extandWidth * scale);
         int   extandHalfRows = (int)(extandHeight * scale);
         _rasterEnvelopeOfVirtualWnd.Location = new Point(beginX - extandHalfCols, beginY - extandHalfRows);
         _rasterEnvelopeOfVirtualWnd.Width    = _rasterEnvelopeOfWnd.Width + 2 * extandHalfCols;
         _rasterEnvelopeOfVirtualWnd.Height   = _rasterEnvelopeOfWnd.Height + 2 * extandHalfRows;
     }
     else//virtual window size = actual window size
     {
         _rasterEnvelopeOfVirtualWnd = _rasterEnvelopeOfWnd;
     }
     //计算当前显示级别
     _currentLevel = _tileComputer.GetNearestLevel(rasterScale);
     //
     UpdateCachedTiles();
 }