示例#1
0
    private void UpdateAnchor()
    {
        // Get the tile Id in the center of the screen (at lon/lat)
        anchor = GeoCalculator.AbsoluteCoordinateToTile(longitude, latitude, zoomLevel);

        // Get the upper left corner (in meters) of the anchor tile
        var anchorMeters = GeoCalculator.AbsoluteTileToMeters(anchor.X, anchor.Y, anchor.Z);

        // Calculate the offset (in units) between the requested lon/lat and the anchor
        anchorOffsetInUnits = GeoCalculator.RelativeMetersToPixels(anchorMeters - currentMeters, zoomLevel).ToVector2() * pixelsToUnits;

        // Also need to update the map bounds
        UpdateMapBounds();
    }