Пример #1
0
        static DistanceTo()
        {
            riverSpree = new Point[]
            {
                MapMath.LocationToPoint(52.529198, 13.274099),
                MapMath.LocationToPoint(52.531835, 13.29234),
                MapMath.LocationToPoint(52.522116, 13.298541),
                MapMath.LocationToPoint(52.520569, 13.317349),
                MapMath.LocationToPoint(52.524877, 13.322434),
                MapMath.LocationToPoint(52.522788, 13.329),
                MapMath.LocationToPoint(52.517056, 13.332075),
                MapMath.LocationToPoint(52.522514, 13.340743),
                MapMath.LocationToPoint(52.517239, 13.356665),
                MapMath.LocationToPoint(52.523063, 13.372158),
                MapMath.LocationToPoint(52.519198, 13.379453),
                MapMath.LocationToPoint(52.522462, 13.392328),
                MapMath.LocationToPoint(52.520921, 13.399703),
                MapMath.LocationToPoint(52.515333, 13.406054),
                MapMath.LocationToPoint(52.514863, 13.416354),
                MapMath.LocationToPoint(52.506034, 13.435923),
                MapMath.LocationToPoint(52.496473, 13.461587),
                MapMath.LocationToPoint(52.487641, 13.483216),
                MapMath.LocationToPoint(52.488739, 13.491456),
                MapMath.LocationToPoint(52.464011, 13.503386)
            };

            satellite = new Point[]
            {
                MapMath.LocationToPoint(52.590117, 13.39915),
                MapMath.LocationToPoint(52.437385, 13.553989)
            };
        }
Пример #2
0
        //

        private byte[] BackgroundPaint()
        {
            byte[] buffer = new byte[256 * 256 * 4];

            Parallel.For(0, 256, y =>
            {
                Parallel.For(0, 256, x =>
                {
                    // Convert the tile's (x,y) coordinates to proper (lat,lon) coordinates and feed them to the distribution function.
                    int pixelX       = tile.X * 256 + x;
                    int pixelY       = tile.Y * 256 + y;
                    LatLong location = MapMath.PixelToLatLong(pixelX, pixelY, tile.ZoomLevel);

                    int b = x * 4 + y * 256 * 4;
                    int g = b + 1;
                    int r = b + 2;
                    int a = b + 3;

                    byte colorG = (byte)(distribution.BrandenburgDensity(location.Latitude, location.Longitude) / distribution.MaxBrandenburg * 255);
                    byte colorB = (byte)(distribution.RiverDensity(location.Latitude, location.Longitude) / distribution.MaxRiver * 255);
                    byte colorR = (byte)(distribution.SatelliteDensity(location.Latitude, location.Longitude) / distribution.MaxSatellite * 255);

                    buffer[b] = colorB;
                    buffer[g] = colorG;
                    buffer[r] = colorR;
                    buffer[a] = 128;
                });
            });
            return(buffer);
        }
Пример #3
0
 public static double Brandenburg(double latitude, double longitude)
 {
     return(DistanceToBrandenburg(MapMath.LocationToPoint(latitude, longitude)));
 }
Пример #4
0
 public static double River(double latitude, double longitude)
 {
     return(DistanceToRiver(MapMath.LocationToPoint(latitude, longitude)));
 }
Пример #5
0
 public static double Satellite(double latitude, double longitude)
 {
     return(DistanceToSatellite(MapMath.LocationToPoint(latitude, longitude)));
 }