• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# BasicGeoposition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BasicGeoposition的典型用法代码示例。如果您正苦于以下问题:C# BasicGeoposition类的具体用法?C# BasicGeoposition怎么用?C# BasicGeoposition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BasicGeoposition类属于命名空间,在下文中一共展示了BasicGeoposition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CalculateCircle

        public static List<BasicGeoposition> CalculateCircle(BasicGeoposition center, int radius)
        {

            List<BasicGeoposition> geoPositions = new List<BasicGeoposition>();

            double earthRadius = 6371000D;
            double circunference = 2D * Math.PI * earthRadius;

            for (int i = 0; i <= 360; i++)
            {
                double bearing = ToRad(i);
                double circunferenceLatitudeCorrected = 2D * Math.PI * Math.Cos(ToRad(center.Latitude)) * earthRadius;
                double lat1 = circunference / 360D * center.Latitude;
                double lon1 = circunferenceLatitudeCorrected / 360D * center.Longitude;
                double lat2 = lat1 + Math.Sin(bearing) * radius;
                double lon2 = lon1 + Math.Cos(bearing) * radius;

                BasicGeoposition newBasicPosition = new BasicGeoposition();
                newBasicPosition.Latitude = lat2 / (circunference / 360D);
                newBasicPosition.Longitude = lon2 / (circunferenceLatitudeCorrected / 360D);
                geoPositions.Add(newBasicPosition);
            }

            return geoPositions;

        }
开发者ID:kevinamorim,项目名称:treasure-hunt,代码行数:26,代码来源:GeoHelper.cs


示例2: GetPositionFromAddressAsync

        public async Task<MapLocation> GetPositionFromAddressAsync(string address)
        {
            var locator = new Geolocator();
            locator.DesiredAccuracyInMeters = 50;
            TimeSpan maxAge = new TimeSpan(0, 0, 1);
            TimeSpan timeout = new TimeSpan(0, 0, 15);
            // var position = await locator.GetGeopositionAsync();

            var basicGeoposition = new BasicGeoposition();
            var point = new Geopoint(basicGeoposition);

            var mapLocationFinderResult = await MapLocationFinder.FindLocationsAsync(address, point, 2);

            if (mapLocationFinderResult.Status == MapLocationFinderStatus.Success)
            {
                try
                {
                    return mapLocationFinderResult.Locations[0];
                }
                catch (Exception e)
                {
                    return null;
                }
                
                
            }

            return default(MapLocation);
        }
开发者ID:frederikdesmedt,项目名称:Windows-App,代码行数:29,代码来源:MapService.cs


示例3: AddPushpin

        public void AddPushpin(BasicGeoposition location, string text)
        {
            var pin = new Grid
            {
                Width = 200,
                Height = 100,
                Margin = new Thickness(-12),
                HorizontalAlignment = HorizontalAlignment.Left
               
            };

            var pinImage = new Image { Source = new BitmapImage(new Uri("ms-appx:///Assets/my-position.png")), Width = 60, Height = 60};
            pin.Children.Add(pinImage);

            pin.Children.Add(new TextBlock
            {
                TextTrimming = TextTrimming.CharacterEllipsis,
                Text = text,
                FontSize = 14,
                FontWeight = FontWeights.Bold,
                Foreground = new SolidColorBrush(Colors.Black),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top
            });

            MapControl.SetLocation(pin, new Geopoint(location));
            Map.Children.Add(pin);
        }
开发者ID:gcbalbas,项目名称:ZalandoTestApp,代码行数:28,代码来源:GeolocatorPage.xaml.cs


示例4: LocationData

        public LocationData(string name, string street, string streetNumber, string zipcode, string city, string country, int rating,
                double longitude, double latitude, List<string> openTimes, List<string> closeTimes, List<string> happyhourFrom, List<string> happyhourTo)
        {
            id = -1;
            this.name = name;
            this.street = street;
            this.streetNumber = streetNumber;
            this.zipcode = zipcode;
            this.city = city;
            this.country = country;
            this.rating = rating;
            this.longitude = longitude;
            this.latitude = latitude;

            position = new BasicGeoposition();
            position.Longitude = longitude;
            position.Latitude = latitude;

            pubdays = new List<PubDay>();
            for (int i = 0; i < 7; i++)
            {
                pubdays.Add(new PubDay(i));
            }

            //getOpenAndClosingTime(openTimes, closeTimes, happyhourFrom, happyhourTo);
        }
开发者ID:PCVinnie,项目名称:Happyhour,代码行数:26,代码来源:LocationData.cs


示例5: handleResults

 private async void handleResults(PhotoCollection results, ObservableCollection<ThumbnailImage> List)
 {
     foreach (var res in results)
     {
         Geopoint point = null;
         if (res.Longitude != 0 && res.Latitude != 0)
         {
             var position = new BasicGeoposition()
             {
                 Latitude = res.Latitude,
                 Longitude = res.Longitude
             };
             point = new Geopoint(position);
         }
         else if (res.Tags.Contains("cars"))
         {
             var position = new BasicGeoposition()
             {
                 Longitude = 13.416350,
                 Latitude = 52.526105
             };
             point = new Geopoint(position);
         }
         List.Add(new ThumbnailImage() { ImagePath = new Uri(res.ThumbnailUrl), ImageTitle = res.Title, BigImage = new Uri(res.LargeUrl), GeoLocation = point });
     }
 }
开发者ID:mmohareb,项目名称:SimpleFlickrClient,代码行数:26,代码来源:MainViewModel.cs


示例6: AddPushpin

        public void AddPushpin(BasicGeoposition location, string text, string id)
        {
            var pin = new Grid()
            {
                Width = 50,
                Height = 50,
                Margin = new Windows.UI.Xaml.Thickness(-12)
            };

            pin.Children.Add(new Image()
            {
                Source = new BitmapImage(new Uri("ms-appx:///Assets/pinPoint.png", UriKind.RelativeOrAbsolute)),
                Width = 50,
                Height = 50
             });

            pin.Children.Add(new TextBlock()
            {
                Text = text,
                FontSize = 12,
                Foreground = new SolidColorBrush(Colors.Yellow),
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center
            });

            pin.Tag = id;
            pin.Tapped += pin_Tapped;

            MapControl.SetLocation(pin, new Geopoint(location));
            myMapControl.Children.Add(pin);
        }
开发者ID:sameemir,项目名称:Whistler,代码行数:31,代码来源:LookingFor.xaml.cs


示例7: BoundedImage

        public BoundedImage(MapView map, Uri imageUri, BasicGeoposition northWest, BasicGeoposition southEast)
        {
            _map = map;
            _northWest = northWest;
            _southEast = southEast;

            _img = new Image();
            _img.Stretch = Stretch.Fill;
            _img.Source = new BitmapImage(imageUri);
            this.Children.Add(_img);

            _map.ViewChanged += (center, zoom, heading) =>
            {
                UpdatePosition();
            };

            _map.SizeChanged += (s, a) =>
            {
                this.Width = _map.ActualWidth;
                this.Height = _map.ActualHeight;

                UpdatePosition();
            };

            UpdatePosition();
        }
开发者ID:ponnuswa,项目名称:Flickr_TestApp,代码行数:26,代码来源:BoundedImage.cs


示例8: AddMapa

        public AddMapa()
        {
            this.InitializeComponent();

            rootFrame = Window.Current.Content as Frame;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility
                    = AppViewBackButtonVisibility.Visible;

            SystemNavigationManager.GetForCurrentView().BackRequested += AddMapa_BackRequested;

            mapControl.ZoomInteractionMode = MapInteractionMode.GestureAndControl;
            mapControl.TiltInteractionMode = MapInteractionMode.GestureAndControl;
            mapControl.MapServiceToken = "ift37edNFjWtwMkOrquL~7gzuj1f0EWpVbWWsBaVKtA~Amh-DIg5R0ZPETQo7V-k2m785NG8XugPBOh52EElcvxaioPYSYWXf96wL6E_0W1g";

            // Specify a known location

            BasicGeoposition posicion = new BasicGeoposition() { Latitude = 2.4448143, Longitude = -76.6147395 };
            Geopoint point = new Geopoint(posicion);

            // Set map location
            mapControl.Center = point;
            mapControl.ZoomLevel = 13.0f;
            mapControl.LandmarksVisible = true;

            AddIcons();

            //GridMapa.Children.Add(mapControl);

        }
开发者ID:simonbedoya,项目名称:PlansPop-W10,代码行数:30,代码来源:AddMapa.xaml.cs


示例9: ExecuteQuery

        // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn631249.aspx
        public async Task<List<Portable.Model.GeocodeResult>> ExecuteQuery(string query)
        {
            throw new NotImplementedException("Not yet fully implemented, testing only");

            try
            {
                // TODO: center for Austria (lat, lon), hint Austria in search string
                BasicGeoposition queryHint = new BasicGeoposition();
                queryHint.Latitude = 47.643;
                queryHint.Longitude = -122.131;
                Geopoint hintPoint = new Geopoint(queryHint);

                MapLocationFinderResult result = await MapLocationFinder.FindLocationsAsync(query, hintPoint);

                if (result.Status == MapLocationFinderStatus.Success)
                {
                    return result.Locations.Select(l => new Portable.Model.GeocodeResult()
                    {
                        Latitude = l.Point.Position.Latitude,
                        Longitude = l.Point.Position.Longitude,
                        Name = l.DisplayName,
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            return new List<GeocodeResult>();
        }
开发者ID:christophwille,项目名称:Sprudelsuche,代码行数:32,代码来源:WpaGeocodeService.cs


示例10: getAddressBtn_Click

        private async void getAddressBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Request permission to get location
                //Pop up will occur if your app doesnot have permission to access location service of device
                var accessStatus = await Geolocator.RequestAccessAsync();

                switch (accessStatus)
                {
                    case GeolocationAccessStatus.Allowed:
                        // The location to reverse geocode.
                        //For now i am getting my current location
                        Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 50, DesiredAccuracy = PositionAccuracy.High }; //Set the desired accuracy that you want in meters
                        Geoposition pos = await geolocator.GetGeopositionAsync();


                        BasicGeoposition location = new BasicGeoposition();
                        location.Latitude = pos.Coordinate.Point.Position.Latitude;
                        location.Longitude = pos.Coordinate.Point.Position.Longitude;

                        Geopoint pointToReverseGeocode = new Geopoint(location);

                        // Reverse geocode the specified geographic location.
                        MapLocationFinderResult result =
                              await MapLocationFinder.FindLocationsAtAsync(pointToReverseGeocode);

                        // If the query returns results, display the name of the town
                        // contained in the address of the first result.
                        if (result.Status == MapLocationFinderStatus.Success)
                        {
                            continent.Text = result.Locations[0].Address.Continent;
                            countryName.Text = result.Locations[0].Address.Country;
                            countryCode.Text = result.Locations[0].Address.CountryCode;
                            region.Text = result.Locations[0].Address.Region;
                            town.Text = result.Locations[0].Address.Town;
                            street.Text = result.Locations[0].Address.Street;
                        }
                        else
                        {
                            await new MessageDialog("Something went wrong. Could not get finish current operation. Error: " + result.Status).ShowAsync();
                        }
                        break;

                    case GeolocationAccessStatus.Denied:
                        //Unable to get data
                        LoadPositionData(null);
                        break;

                    case GeolocationAccessStatus.Unspecified:
                        //Unable to get data
                        LoadPositionData(null);
                        break;
                }
            }
            catch (Exception ex)
            {
                await new MessageDialog("Something went wrong. Could not get finish current operation.").ShowAsync();
            }
        }
开发者ID:janaks09,项目名称:Windows10-Samples,代码行数:60,代码来源:MainPage.xaml.cs


示例11: button_Click

        private async void button_Click(object sender, RoutedEventArgs e)
        {

            if (MapControl1.IsStreetsideSupported)
            {
                
                
               BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 };
                Geopoint cityCenter = new Geopoint(cityPosition);
                StreetsidePanorama panoramaNearCity = await StreetsidePanorama.FindNearbyAsync(cityCenter);

                
                if (panoramaNearCity != null)
                {
                    
                    StreetsideExperience ssView = new StreetsideExperience(panoramaNearCity);
                    ssView.OverviewMapVisible = true;
                    MapControl1.CustomExperience = ssView;
                }
            }
            else
            {
                
                ContentDialog viewNotSupportedDialog = new ContentDialog()
                {
                    Title = "Streetside is not supported",
                    Content = "\nStreetside views are not supported on this device.",
                    PrimaryButtonText = "OK"
                };
                await viewNotSupportedDialog.ShowAsync();
            }
        }
开发者ID:myCodePixel,项目名称:blogsamples,代码行数:32,代码来源:MainPage.xaml.cs


示例12: button1_Click

        private async void button1_Click(object sender, RoutedEventArgs e)
        {
            if (MapControl1.Is3DSupported)
            {
                
                MapControl1.Style = MapStyle.Aerial3D;
                 BasicGeoposition hwGeoposition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 };
                Geopoint hwPoint = new Geopoint(hwGeoposition);

                
                MapScene hwScene = MapScene.CreateFromLocationAndRadius(hwPoint, 80, 0, 60);
                                                                                     
                
                await MapControl1.TrySetSceneAsync(hwScene, MapAnimationKind.Bow);
            }
            else
            {
                
                ContentDialog viewNotSupportedDialog = new ContentDialog()
                {
                    Title = "3D is not supported",
                    Content = "\n3D views are not supported on this device.",
                    PrimaryButtonText = "OK"
                };
                await viewNotSupportedDialog.ShowAsync();
            }
            }
开发者ID:myCodePixel,项目名称:blogsamples,代码行数:27,代码来源:MainPage.xaml.cs


示例13: GetRandomPoints

        public static IEnumerable<PointList> GetRandomPoints(Geopoint point1, Geopoint point2, int nrOfPoints)
        {
            var result = new List<PointList>();
            var p1 = new BasicGeoposition
            {
                Latitude = Math.Min(point1.Position.Latitude, point2.Position.Latitude),
                Longitude = Math.Min(point1.Position.Longitude, point2.Position.Longitude)
            };
            var p2 = new BasicGeoposition
            {
                Latitude = Math.Max(point1.Position.Latitude, point2.Position.Latitude),
                Longitude = Math.Max(point1.Position.Longitude, point2.Position.Longitude)
            };

            var dLat = p2.Latitude - p1.Latitude;
            var dLon = p2.Longitude - p1.Longitude;

            var r = new Random(DateTime.Now.Millisecond);
            for (var i = 0; i < nrOfPoints; i++)
            {
                var item = new PointList { Name = "Point " + i };
                item.Points.Add(new Geopoint(
                  new BasicGeoposition
                  {
                      Latitude = p1.Latitude + (r.NextDouble() * dLat),
                      Longitude = p1.Longitude + (r.NextDouble() * dLon)
                  }));
                result.Add(item);
            }
            return result;
        }
开发者ID:crua9,项目名称:Tech-Reviews-and-Help-Windows-app,代码行数:31,代码来源:PointList.cs


示例14: GetAtDistanceBearing

        private BasicGeoposition GetAtDistanceBearing(BasicGeoposition point, double distance, double bearing)
        {
            double degreesToRadian = Math.PI / 180.0;
            double radianToDegrees = 180.0 / Math.PI;
            double earthRadius = 6378137.0;

            double latA = point.Latitude * degreesToRadian;
            double lonA = point.Longitude * degreesToRadian;
            double angularDistance = distance / earthRadius;
            double trueCourse = bearing * degreesToRadian;

            double lat = Math.Asin(
                Math.Sin(latA) * Math.Cos(angularDistance) +
                Math.Cos(latA) * Math.Sin(angularDistance) * Math.Cos(trueCourse));

            double dlon = Math.Atan2(
                Math.Sin(trueCourse) * Math.Sin(angularDistance) * Math.Cos(latA),
                Math.Cos(angularDistance) - Math.Sin(latA) * Math.Sin(lat));

            double lon = ((lonA + dlon + Math.PI) % (Math.PI * 2)) - Math.PI;

            BasicGeoposition result = new BasicGeoposition { Latitude = lat * radianToDegrees, Longitude = lon * radianToDegrees };

            return result;
        }
开发者ID:pjcbakx,项目名称:RouteFencingWindows10,代码行数:25,代码来源:LocationData.cs


示例15: showSpaceNeedleButton_Click

        private async void showSpaceNeedleButton_Click(object sender, RoutedEventArgs e)
        {
            if (myMap.Is3DSupported)
            {
                this.myMap.Style = MapStyle.Aerial3DWithRoads;

                BasicGeoposition spaceNeedlePosition = new BasicGeoposition();
                spaceNeedlePosition.Latitude = 47.6204;
                spaceNeedlePosition.Longitude = -122.3491;

                Geopoint spaceNeedlePoint = new Geopoint(spaceNeedlePosition);

                MapScene spaceNeedleScene = MapScene.CreateFromLocationAndRadius(spaceNeedlePoint,
                                                                                    400, /* show this many meters around */
                                                                                    135, /* looking at it to the south east*/
                                                                                    60 /* degrees pitch */);

                await myMap.TrySetSceneAsync(spaceNeedleScene);
            }
            else
            {
                string status = "3D views are not supported on this device.";
                rootPage.NotifyUser(status, NotifyType.ErrorMessage);
            }

           
        }
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:27,代码来源:Scenario4.xaml.cs


示例16: AddRegion

      public void AddRegion(GeofenceCircularRegion region)
      {
          if (string.IsNullOrEmpty(region.Id))
              return;

          RemoveRegion(region.Id);

          var position = new BasicGeoposition();
          position.Latitude = region.Latitude;
          position.Longitude = region.Longitude;

          var geocircle = new Geocircle(position, region.Radius);

          Windows.Devices.Geolocation.Geofencing.MonitoredGeofenceStates mask = 0;

          if (region.NotifyOnEntry)
          {
              mask |= Windows.Devices.Geolocation.Geofencing.MonitoredGeofenceStates.Entered;
          }

          if (region.NotifyOnExit)
          {
              mask |= Windows.Devices.Geolocation.Geofencing.MonitoredGeofenceStates.Exited;
          }


          var geofence = new Windows.Devices.Geolocation.Geofencing.Geofence(region.Id, geocircle, mask, false, new TimeSpan(0, 0, CrossGeofence.StayedInDuration / 1000), DateTime.Now, TimeSpan.MaxValue);
          Windows.Devices.Geolocation.Geofencing.GeofenceMonitor.Current.Geofences.Add(geofence);

          GeofenceStore.SharedInstance.Save(region);
      }
开发者ID:lampshade9909,项目名称:xamarin-plugins,代码行数:31,代码来源:GeofenceImplementation.cs


示例17: MapView

        public MapView()
        {

            mapControl = new MapControl();
            mapControl.ZoomInteractionMode = MapInteractionMode.GestureAndControl;
            mapControl.TiltInteractionMode = MapInteractionMode.GestureAndControl;
            mapControl.MapServiceToken = "ift37edNFjWtwMkOrquL~7gzuj1f0EWpVbWWsBaVKtA~Amh-DIg5R0ZPETQo7V-k2m785NG8XugPBOh52EElcvxaioPYSYWXf96wL6E_0W1g";

            // Specify a known location
            BasicGeoposition cityPosition;
            Geopoint cityCenter;

            cityPosition = new BasicGeoposition() { Latitude = 2.4448143, Longitude = -76.6147395 };
            cityCenter = new Geopoint(cityPosition);

            // Set map location
            mapControl.Center = cityCenter;
            mapControl.ZoomLevel = 13.0f;
            mapControl.LandmarksVisible = true;

            AddIcons();

            this.Children.Add(mapControl);


            //this.Children.Add(_map);
        }
开发者ID:simonbedoya,项目名称:PlansPop-W10,代码行数:27,代码来源:MapView.cs


示例18: LoadVehicleDetails

        public async Task LoadVehicleDetails()
        {
            listOfNewVehicles = new List<HSLVehicle>();

            //Client request to get the data from the HSL server 
            HttpClient httpClient = new HttpClient();
            httpClient.MaxResponseContentBufferSize = 512000;
            string uri = "http://dev.hsl.fi/siriaccess/vm/json?operatorRef=HSL&" + DateTime.Now.Ticks.ToString();
            HttpResponseMessage response = await httpClient.GetAsync(uri);
            try
            {
                response.EnsureSuccessStatusCode();
                Stream StreamResponse = await response.Content.ReadAsStreamAsync();
                DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(RootObject));
                RootObject returnedData = (RootObject)s.ReadObject(StreamResponse);
                if (returnedData.Siri.ServiceDelivery.VehicleMonitoringDelivery.Count == 1)
                {
                    try
                    {
                        CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
                        await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            //Get the list of vehicles from the returned data
                            var AllVehicle = from m in returnedData.Siri.ServiceDelivery.VehicleMonitoringDelivery[0].VehicleActivity
                                             select m;
                            foreach (VehicleActivity singleVehicle in AllVehicle)
                            {
                                HSLVehicle hslVehicle = new HSLVehicle();
                                hslVehicle.LineRef = singleVehicle.MonitoredVehicleJourney.LineRef.value;
                                hslVehicle.VehicleRef = singleVehicle.MonitoredVehicleJourney.VehicleRef.value;

                                hslVehicle.Latitude = singleVehicle.MonitoredVehicleJourney.VehicleLocation.Latitude;
                                hslVehicle.Longitude = singleVehicle.MonitoredVehicleJourney.VehicleLocation.Longitude;

                                //Convert latitude and longitude to Geopoint
                                BasicGeoposition queryHint = new BasicGeoposition();
                                queryHint.Latitude = hslVehicle.Latitude;
                                queryHint.Longitude = hslVehicle.Longitude;
                                hslVehicle.Location = new Geopoint(queryHint);

                                //Add items to the observable collection
                                listOfNewVehicles.Add(hslVehicle);
                                //VehicleItems.Add(hslVehicle);
                            }
                            updateObservableCollectionVehicles(listOfNewVehicles);
                        });
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            response.Dispose();
            httpClient.Dispose();
        }
开发者ID:nkeshri,项目名称:Jongla,代码行数:60,代码来源:HSLVehicleViewModel.cs


示例19: Convert

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var coord = value as ObservableCoordinate;
            if (coord != null)
            {
                var position = new BasicGeoposition
                    {
                        Latitude = coord.Latitude,
                        Longitude = coord.Longitude
                    };
                return new Geopoint(position);
            }

            var viewmodel = value as CafeSummaryViewModel;
            if (viewmodel != null)
            {
                var position = new BasicGeoposition
                    {
                        Latitude = viewmodel.Latitude,
                        Longitude = viewmodel.Longitude
                    };
                return new Geopoint(position);
            }

            return value;
        }
开发者ID:kieranlynam,项目名称:LondonCoffee,代码行数:26,代码来源:GeopointConverter.cs


示例20: GetAtDistanceBearing

        public static BasicGeoposition GetAtDistanceBearing(this BasicGeoposition point, double distance, double bearing)
        {
            const double degreesToRadian = Math.PI / 180.0;
            const double radianToDegrees = 180.0 / Math.PI;
            const double earthRadius = 6378137.0;

            var latA = point.Latitude * degreesToRadian;
            var lonA = point.Longitude * degreesToRadian;
            var angularDistance = distance / earthRadius;
            var trueCourse = bearing * degreesToRadian;

            var lat = Math.Asin(
                Math.Sin(latA) * Math.Cos(angularDistance) +
                Math.Cos(latA) * Math.Sin(angularDistance) * Math.Cos(trueCourse));

            var dlon = Math.Atan2(
                Math.Sin(trueCourse) * Math.Sin(angularDistance) * Math.Cos(latA),
                Math.Cos(angularDistance) - Math.Sin(latA) * Math.Sin(lat));

            var lon = ((lonA + dlon + Math.PI) % (Math.PI * 2)) - Math.PI;

            var result = new BasicGeoposition { Latitude = lat * radianToDegrees, Longitude = lon * radianToDegrees };

            return result;
        }
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:25,代码来源:MapUtils.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BasicMLDataSet类代码示例发布时间:2022-05-24
下一篇:
C# BasicBlocks类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap