コード例 #1
0
 public BitmapTileSet(MapPoint center, double zoom, BitmapSize totalSize, BitmapSize tileSize, MapTileSet <TTileCollection> tileSet)
 {
     _tileSet    = tileSet;
     _totalSize  = totalSize;
     _tileSize   = tileSize;
     _center     = center;
     _zoom       = zoom;
     _collection = CreateCollection(EnumerateBitmapTiles());
 }
コード例 #2
0
ファイル: BitmapTile.cs プロジェクト: jaenudin86/TaxiOnline
        public BitmapSize GetOffsetFromCoordinates(MapPoint coordinates, BitmapSize totalSize, double mapZoom)
        {
            // double correctionScale = Math.Pow(2.0, mapZoom - _tile.Zoom);
            double    xScale        = (double)_bounds.Width / _square.Size.LongitudeOffset;// *correctionScale;
            MapVector leftTopOffset = new MapVector(_square.LeftTop.Latitude - coordinates.Latitude, coordinates.Longitude - _square.LeftTop.Longitude);
            int       x             = (int)Math.Round(/*(double)totalSize.Width / 2.0 */ leftTopOffset.LongitudeOffset * xScale);
            double    yTiles        = CoordinatesHelper.GetTilesFromLatitude(_square.LeftTop.Latitude, _tile.Zoom) - CoordinatesHelper.GetTilesFromLatitude(coordinates.Latitude, _tile.Zoom);
            int       y             = (int)Math.Round(/*(double)totalSize.Height / 2.0*/ -(double)_bounds.Height * yTiles);// * correctionScale);

            return(new BitmapSize(x, y));
        }
コード例 #3
0
 public void UpdateTotalSize(BitmapSize size)
 {
     _totalSize = size;
     _collection.Clear();
     foreach (BitmapTile tile in EnumerateBitmapTiles().ToArray())
     {
         _collection.Add(tile);
     }
     if (CheckSettings())
     {
         UpdateTiles();
     }
 }
コード例 #4
0
        public BitmapSize?GetOffsetFromCoordinates(MapPoint coordinates)
        {
            BitmapTile targetTile = _collection.FirstOrDefault(tile => tile.ContainsCoordinates(coordinates));

            if (targetTile == null)
            {
                return(null);
            }
            BitmapRect bounds     = GetSquareBitmapBounds(targetTile.Tile);
            BitmapSize tileOffset = targetTile.GetOffsetFromCoordinates(coordinates, _totalSize, _zoom);

            return(new BitmapSize(bounds.Left + tileOffset.Width, bounds.Top + tileOffset.Height));
            //return targetTile == null ? null : (BitmapSize?)targetTile.GetOffsetFromCoordinates(coordinates, _totalSize, _zoom);
        }
コード例 #5
0
 public ObservableBitmapTileSet(MapPoint center, double zoom, BitmapSize totalSize, BitmapSize tileSize, ObservableMapTileSet tileSet)
     : base(center, zoom, totalSize, tileSize, tileSet)
 {
 }