private void SetMapIconPosition(DependencyObject icon, Models.Geoposition geoLocation, Point anchorPoint) { var nativeCoordinate = CoordinateConverter.ConvertToNative(geoLocation); MapControl.SetLocation(icon, nativeCoordinate); MapControl.SetNormalizedAnchorPoint(icon, anchorPoint); }
public static Geopoint ConvertToNative(Models.Geoposition position) { return(new Geopoint(new BasicGeoposition { Latitude = position.Latitude, Longitude = position.Longitude })); }
public override void AddUser() { var geoposition = new Models.Geoposition { Latitude = Settings.UserLatitude, Longitude = Settings.UserLongitude }; var userIcon = new UserIcon(); _mapItems.Items.Add(userIcon); SetMapIconPosition(userIcon, geoposition, new Point(0.5, 0.5)); }
public override async Task <IEnumerable <Models.Geoposition> > CalculateRoute(Models.Geoposition from, Models.Geoposition to) { Geopoint nativeFrom = CoordinateConverter.ConvertToNative(from); Geopoint nativeTo = CoordinateConverter.ConvertToNative(to); MapRouteFinderResult routeResult = await MapRouteFinder.GetDrivingRouteAsync( nativeFrom, nativeTo, MapRouteOptimization.Time, MapRouteRestrictions.None); List <Models.Geoposition> result = new List <Models.Geoposition>(); IReadOnlyList <BasicGeoposition> routePositions = routeResult?.Route?.Path?.Positions; if (routePositions?.Any() == true) { foreach (BasicGeoposition position in routePositions) { result.Add(new Models.Geoposition { Latitude = position.Latitude, Longitude = position.Longitude }); } } return(result); }