示例#1
0
    private void UpdateMetersPerPixel()
    {
        const float refD = 1000.0f; // one kilometer

        double earthRadius = WGS84EarthRadius(pos.latitude);
        int    numTiles    = (1 << zoom);
        var    pxPos       = numTiles * Mercator.CoordToPoint(pos);
        var    refPos      = new GlobalPosition(pos.latitude, pos.longitude + Mathf.Rad2Deg * refD / earthRadius);
        var    pxRef       = numTiles * Mercator.CoordToPoint(refPos);

        metersPerPixel = refD / Mathf.Abs(pxPos.x - pxRef.x);
    }
示例#2
0
 public Vector2 PixelPosition(GlobalPosition pos)
 {
     return((1 << GoogleMapsDriver.main.zoom) * Mercator.CoordToPoint(pos));
 }