Пример #1
0
 public async static void Update(GeoCoord geo)
 {
     try
     {
         var visibileAPs = await WlanClient.GetWiFiAP();
         foreach (var y in visibileAPs)
         {
             apLocs.Add(new Tuple<GeoCoord, WiFiAP>(geo, y));
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
 }
Пример #2
0
        /// <returns>Meters squared</returns>
        internal double DistSqr(GeoCoord x0)
        {
            // Determine the actual size of the geography.
            // From http://en.wikipedia.org/wiki/Latitude,
            // and assuming the earth is spherical (e=1)

            var offsetMeters = OffsetInMeters(x0);
            var ret = Math.Pow(offsetMeters.X, 2) + Math.Pow(offsetMeters.Y, 2);
            return ret;
        }
Пример #3
0
        public FakePoint OffsetInMeters(GeoCoord geoC)
        {
            // Determine the actual size of the geography.
            // From http://en.wikipedia.org/wiki/Latitude,
            // and assuming the earth is spherical (e=1)

            double x = -(this.Longitude - geoC.Longitude) * LonDegreeSizeInMeters;
            double y = (this.Latitude - geoC.Latitude) * LatDegreeSizeInMeters;
            var ret = new FakePoint(x, y);
            return ret;
        }
Пример #4
0
        public GeoCoord FromPixelOffset2(double x, double y, int levelOfDetail)
        {
            ulong twotoPow = 2;
            for (int i = 1; i < levelOfDetail; i++)
            {
                twotoPow *= 2;
            }

            double MapSize = (uint)256 << levelOfDetail;
            //  MapSize /= 8;
            double Longitude = x / (PiDiv180 * MapSize);
            double Latitude = y * Math.Cos(this.Latitude * PiDiv180) / (PiDiv180 * MapSize);
            var ret = new GeoCoord(Latitude, Longitude);
            return ret;
        }
Пример #5
0
 public GeoCoord FromOffset(double x, double y)
 {
     double Longitude = this.Longitude + x / LonDegreeSizeInMeters;
     double Latitude = this.Latitude - y / LatDegreeSizeInMeters;
     var ret = new GeoCoord(Latitude, Longitude);
     return ret;
 }
Пример #6
0
 public static GeoCoord Minimizer(Func<GeoCoord, double> f, GeoCoord guess)
 {
     var ret = Minimizer((x) => f(new GeoCoord(x[0], x[1])), new double[] { guess.Latitude, guess.Longitude }, new double[] { 0.1, 0.1 });
     return new GeoCoord(ret[0], ret[1]);
 }