Ejemplo n.º 1
0
 public static void DumpLocation(GeoPoint p, Stream stream)
 {
     using (var writer = new BinaryWriter (stream, System.Text.Encoding.UTF8, true)) {
         writer.Write (p.Lat);
         writer.Write (p.Lon);
     }
 }
Ejemplo n.º 2
0
 // Use spherical law of cosines
 public static double Distance(GeoPoint p1, GeoPoint p2)
 {
     const int EarthRadius = 6371;
     return Math.Acos (Math.Sin (DegToRad (p1.Lat)) * Math.Sin (DegToRad (p2.Lat)) +
                       Math.Cos (DegToRad (p1.Lat)) * Math.Cos (DegToRad (p2.Lat)) *
                       Math.Cos (DegToRad (p2.Lon) - DegToRad (p1.Lon))) * EarthRadius;
 }
Ejemplo n.º 3
0
 public static StationCardFragment WithStation(Station station, GeoPoint currentLocation, BikeActionStatus status)
 {
     var r = new StationCardFragment ();
     r.station = station;
     r.currentLocation = currentLocation;
     r.status = status;
     return r;
 }
Ejemplo n.º 4
0
 public StationGridAdapter(FragmentManager manager, IList<Station> stations, GeoPoint currentLocation, BikeActionStatus status)
     : base(manager)
 {
     this.stations = stations;
     this.currentLocation = currentLocation;
     this.status = status;
     this.background = ImageReference.ForDrawable (Resource.Drawable.pager_background);
     this.background2 = ImageReference.ForDrawable (Resource.Drawable.pager_background2);
 }
Ejemplo n.º 5
0
		internal async void LoadMap (GeoPoint point, FavoriteView view, ImageView mapView, long version)
		{
			var url = MakeMapUrl (point);
			var bmp = await LoadInternal (url, MapCache);
			if (bmp != null && view.VersionNumber == version) {
				mapView.AlphaAnimate (0, duration: 150, endAction: () => {
					mapView.SetImageDrawable (new RoundCornerDrawable (bmp));
					mapView.AlphaAnimate (1, duration: 250);
				});
			}
		}
Ejemplo n.º 6
0
		public static string MakeMapUrl (GeoPoint location)
		{
			const int Width = 65;
			const int Height = 42;

			var parameters = new Dictionary<string, string> {
				{ "key", ApiKey },
				{ "zoom", "13" },
				{ "sensor", "true" },
				{ "size", Width.ToPixels () + "x" + Height.ToPixels () },
				{ "center", location.Lat + "," + location.Lon },
				{ "markers", "size:tiny|" + location.Lat + "," + location.Lon }
			};

			return BuildUrl ("https://maps.googleapis.com/maps/api/staticmap?",
			                 parameters);
		}