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()); }
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)); }
public void UpdateTotalSize(BitmapSize size) { _totalSize = size; _collection.Clear(); foreach (BitmapTile tile in EnumerateBitmapTiles().ToArray()) { _collection.Add(tile); } if (CheckSettings()) { UpdateTiles(); } }
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); }
public ObservableBitmapTileSet(MapPoint center, double zoom, BitmapSize totalSize, BitmapSize tileSize, ObservableMapTileSet tileSet) : base(center, zoom, totalSize, tileSize, tileSet) { }