当前位置: 首页>>代码示例>>C#>>正文


C# CLLocation.DistanceFrom方法代码示例

本文整理汇总了C#中CLLocation.DistanceFrom方法的典型用法代码示例。如果您正苦于以下问题:C# CLLocation.DistanceFrom方法的具体用法?C# CLLocation.DistanceFrom怎么用?C# CLLocation.DistanceFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CLLocation的用法示例。


在下文中一共展示了CLLocation.DistanceFrom方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateLocation

        public static void UpdateLocation(GPSLocate ms, CLLocation newLocation)
        {
            ms.LblAltitude.Text = newLocation.Altitude.ToString () + " meters";
             ms.LblLongitude.Text = newLocation.Coordinate.Longitude.ToString () + "º";
             ms.LblLatitude.Text = newLocation.Coordinate.Latitude.ToString () + "º";
             ms.LblCourse.Text = newLocation.Course.ToString () + "º";
             ms.LblSpeed.Text = newLocation.Speed.ToString () + " meters/s";

             // get the distance from here to paris
             ms.LblDistanceToParis.Text = (newLocation.DistanceFrom(new CLLocation(48.857, 2.351)) / 1000).ToString() + " km";

             var x1 =Convert.ToDouble( "40.023408");
             var y1 =Convert.ToDouble( "40.643127");
             var x2 =Convert.ToDouble( "30.753657");
             var y2 = Convert.ToDouble("30.038635");
             var longdute =newLocation.Coordinate.Longitude;
             var latidute = newLocation.Coordinate.Latitude;

             ms.checkIt.Clicked+= (sender, e) => {

            if (longdute > x2 && longdute < x1 && latidute > y2 && latidute < y1)
               new UIAlertView("Ankara Dışındasın", "Konum : " + longdute + " " + latidute, null, "OK", null).Show();
            else
               new UIAlertView("Ankara İçerisindesin", "Konum : " + longdute + " " + latidute, null, "OK", null).Show();

             };
        }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:27,代码来源:GPSLocate.cs

示例2: getAllBusStops

 //Caution: If radius is too large results will be HUGE!
 //radius in meters
 public IEnumerable<BusStop> getAllBusStops(CLLocation aboutLoc, double radius)
 {
     List<BusStop> stops = new List<BusStop>(30);
     using (LumenWorks.Framework.IO.Csv.CsvReader csv = new LumenWorks.Framework.IO.Csv.CsvReader(getReader("stops.txt"),true)) {
         while (csv.ReadNextRecord()){
             CLLocation loc = new CLLocation(double.Parse(csv["stop_lat"]), double.Parse(csv["stop_lon"]));
             if (loc.DistanceFrom(aboutLoc)<=radius)
                 stops.Add(new BusStop(csv["stop_name"],int.Parse(csv["stop_id"]), loc));
             loc.Dispose();
         }
         return stops;
     }
 }
开发者ID:jboolean,项目名称:RIT-Bus,代码行数:15,代码来源:BusDB_GTFS.cs

示例3: getClosestStop

 public BusStop? getClosestStop(CLLocation aboutLoc)
 {
     int closestId = -1;
     double closestDist=double.MaxValue;
     using (CsvReader csv = new CsvReader(getReader("stops.txt"),true)) {
         while (csv.ReadNextRecord()){
             CLLocation loc = new CLLocation(double.Parse(csv["stop_lat"]), double.Parse(csv["stop_lon"]));
             if (loc.DistanceFrom(aboutLoc)<=closestDist)
                 closestId=int.Parse(csv["stop_id"]);
             loc.Dispose();
         }
     }
     return (closestId==-1)?null:getStopInfo(closestId);
 }
开发者ID:jboolean,项目名称:RIT-Bus,代码行数:14,代码来源:BusDB_GTFS.cs

示例4: Distance

        public double Distance(double lat, double lng, XLocation b)
        {
            var firstPoint = new CLLocation(lat, lng);
            var secondPoint = new CLLocation(b.Latitude, b.Longitude);

            return firstPoint.DistanceFrom(secondPoint);
        }
开发者ID:jakkaj,项目名称:Xamling-Core,代码行数:7,代码来源:LocationTrackingSensor.cs

示例5: UpdateLocation

		static public void UpdateLocation (IMainScreen ms, CLLocation newLocation)
		{
			ms.LblAltitude.Text = newLocation.Altitude.ToString () + " meters";
			ms.LblLongitude.Text = newLocation.Coordinate.Longitude.ToString () + "º";
			ms.LblLatitude.Text = newLocation.Coordinate.Latitude.ToString () + "º";
			ms.LblCourse.Text = newLocation.Course.ToString () + "º";
			ms.LblSpeed.Text = newLocation.Speed.ToString () + " meters/s";
			
			// get the distance from here to paris
			ms.LblDistanceToParis.Text = (newLocation.DistanceFrom(new CLLocation(48.857, 2.351)) / 1000).ToString() + " km";
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:11,代码来源:MainViewController.cs

示例6: nearestStore

		//Metodo de busqueda de la tienda mas cercana.
		public ProductSearchDetailService nearestStore(CLLocation location, List<ProductSearchDetailService> stores){
			Console.WriteLine (""+location.Coordinate.Latitude);
			ProductSearchDetailService nearStore = stores.ElementAt (0);
			foreach (ProductSearchDetailService store in stores) {
				if( (location.DistanceFrom(new CLLocation(Double.Parse(store.tienda_latitud),Double.Parse(store.tienda_longitud)))) < (location.DistanceFrom(new CLLocation(Double.Parse(nearStore.tienda_latitud), Double.Parse(nearStore.tienda_longitud)))) ) {
					nearStore = store;
				}
			}
			return nearStore;
		}
开发者ID:saedaes,项目名称:ProductFinder,代码行数:11,代码来源:ProductStoresListView.cs

示例7: nearestStore

		//Metodo de busqueda de la tienda mas cercana.
		public StoresService nearestStore(CLLocation location, List<StoresService> stores){
			StoresService nearStore = stores.ElementAt (0);
			foreach (StoresService store in stores) {
				if( (location.DistanceFrom(new CLLocation(Double.Parse(store.latitud),Double.Parse(store.longitud)))) < (location.DistanceFrom(new CLLocation(Double.Parse(nearStore.latitud), Double.Parse(nearStore.longitud)))) ) {
					nearStore = store;
				}
			}
			return nearStore;
		}
开发者ID:saedaes,项目名称:ProductFinder,代码行数:10,代码来源:MapViewController.cs


注:本文中的CLLocation.DistanceFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。