public override void Initialize(Vector2d latLon, int zoom) { _worldHeightFixed = false; // Swiss grid meters, not lat/lag _centerLatitudeLongitude = SwissConversions.LatLonToMeters(latLon); _zoom = zoom; _initialZoom = zoom; var referenceTileRect = SwissConversions.TileBounds(SwissConversions.MetersToTileId(_centerLatitudeLongitude, AbsoluteZoom)); _centerMercator = referenceTileRect.Center; _worldRelativeScale = (float)(_unityTileSize / referenceTileRect.Size.x); _mapVisualizer.Initialize(this, _fileSource); _tileProvider.Initialize(this); // TODO geoAR: remove logging Debug.Log("Center lat/lon: " + _centerLatitudeLongitude); Debug.Log("Center Mercator: " + _centerMercator); Debug.Log("Reference tile: min=" + referenceTileRect.Min + ", max=" + referenceTileRect.Max + ", size=" + referenceTileRect.Size); Debug.Log("Relative scale: " + _worldRelativeScale); SendInitialized(); }
public override void OnInitialized() { var centerTile = SwissConversions.MetersToTileId(_map.CenterLatitudeLongitude, _map.AbsoluteZoom); AddTile(new UnwrappedTileId(_map.AbsoluteZoom, centerTile.X, centerTile.Y)); for (int x = centerTile.X - _west; x <= centerTile.X + _east; x++) { // iterate from south to north because y-axis is pointing to north for (int y = centerTile.Y - _south; y <= centerTile.Y + _north; y++) { AddTile(new UnwrappedTileId(_map.AbsoluteZoom, x, y)); } } }