public async void GetLocation() { Geoposition pos = await _geolocator.GetGeopositionAsync(); var pin = new MapIcon() { Location = pos.Coordinate.Point, Title = "You are here!", Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Image/Location_Icon.png")), NormalizedAnchorPoint = new Point() { X = 0.32, Y = 0.78 }, }; map.MapElements.Add(pin); await map.TrySetViewAsync(pos.Coordinate.Point, 15); (App.Current as App).User.user_x = pos.Coordinate.Point.Position.Latitude.ToString(); (App.Current as App).User.user_y = pos.Coordinate.Point.Position.Longitude.ToString(); using (var client = new HttpClient()) { try { client.BaseAddress = new Uri(@"http://pubbus-coeus.azurewebsites.net/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = await client.PutAsJsonAsync("api/users/" + (App.Current as App).User.user_id, (App.Current as App).User); //Printf("Da cap nhat vi tri: " + (App.Current as App).User.user_x + ":" + (App.Current as App).User.user_y); } catch (Exception ex) { Printf(ex.Message); } } }
public async void AddMapIcon(Geopoint snPoint,string namePin) { try { myLocation = await refreshLoc(); if (myLocation != null) { string adresse = await gs.reverseGeocode(myLocation); MapControl1.Center = myLocation; //set a map icon start MapIcon mapIconStart = new MapIcon(); mapIconStart.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/icon-map.png")); mapIconStart.Location = myLocation; mapIconStart.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIconStart.Title = namePin; mapIconStart.ZIndex = 1; MapControl1.MapElements.Add(mapIconStart); MapControl1.ZoomLevel = 14; } else { Debug.WriteLine("Erreur geoloc Null"); } } catch { } }
/// <summary> /// Constructor. /// </summary> /// <param name="position"></param> /// <param name="type"></param> /// <param name="style"></param> /// <param name="color"></param> public BaseMapIcon(Vector3 position, MapIcon type, MapIconType style, Color color) { Position = position; Type = type; Style = style; Color = color; }
public DetaljiDestinacije(ref TuristickaAgencija refTours, ref string l) { this.InitializeComponent(); tours = new TuristickaAgencija(); tours = refTours; if (l.Equals("Sarajevo")) { Geopoint lok = new Geopoint(new BasicGeoposition() { Latitude = 43.85, Longitude = 18.41 }); MapIcon myPOI = new MapIcon { Location = lok, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Destination", ZIndex = 0 }; mapa.MapElements.Add(myPOI); mapa.Center = lok; mapa.ZoomLevel = 10; } if (l.Equals("London")) { Geopoint lok = new Geopoint(new BasicGeoposition() { Latitude = 51.50, Longitude = 0.12 }); MapIcon myPOI = new MapIcon { Location = lok, NormalizedAnchorPoint = new Point(0, 0), Title = "Destination", ZIndex = 0 }; mapa.MapElements.Add(myPOI); mapa.Center = lok; mapa.ZoomLevel = 10; } if (l.Equals("Vienna")) { Geopoint lok = new Geopoint(new BasicGeoposition() { Latitude = 48.20, Longitude = 16.37 }); MapIcon myPOI = new MapIcon { Location = lok, NormalizedAnchorPoint = new Point(5.0, 1.5), Title = "Destination", ZIndex = 0 }; mapa.MapElements.Add(myPOI); mapa.Center = lok; mapa.ZoomLevel = 10; } if (l.Equals("Moscow")) { Geopoint lok = new Geopoint(new BasicGeoposition() { Latitude = 55.75, Longitude = 37.61 }); MapIcon myPOI = new MapIcon { Location = lok, NormalizedAnchorPoint = new Point(2.7, 3.3), Title = "Destination", ZIndex = 0 }; mapa.MapElements.Add(myPOI); mapa.Center = lok; mapa.ZoomLevel = 10; } }
private void DrawToSmallMiniMapText(StoredEntity entity, MinimapTextInfo info) { var camera = GameController.Game.IngameState.Camera; var mapWindow = GameController.Game.IngameState.IngameUi.Map; var mapRect = mapWindow.SmallMiniMap.GetClientRect(); var playerPos = GameController.Player.GetComponent <Positioned>().GridPos; var posZ = GameController.Player.GetComponent <Render>().Z; var screenCenter = new Vector2(mapRect.Width / 2, mapRect.Height / 2).Translate(0, -20) + new Vector2(mapRect.X, mapRect.Y) + new Vector2(mapWindow.SmallMinMapX, mapWindow.SmallMinMapY); var diag = (float)Math.Sqrt(camera.Width * camera.Width + camera.Height * camera.Height); var k = camera.Width < 1024f ? 1120f : 1024f; var scale = k / camera.Height * camera.Width * 3f / 4f / mapWindow.SmallMinMapZoom; var iconZ = entity.EntityZ; var point = screenCenter + MapIcon.DeltaInWorldToMinimapDelta(entity.GridPos - playerPos, diag, scale, (iconZ - posZ) / (9f / mapWindow.SmallMinMapZoom)); point.Y += info.TextOffsetY; if (!mapRect.Contains(point)) { return; } var size = Graphics.DrawText(WordWrap(info.Text, info.TextWrapLength), point, info.FontColor, info.FontSize, FontAlign.Center); float maxWidth = 0; float maxheight = 0; //not sure about sizes below, need test point.Y += size.Y; maxheight += size.Y; maxWidth = Math.Max(maxWidth, size.X); var background = new RectangleF(point.X - maxWidth / 2 - 3, point.Y - maxheight, maxWidth + 6, maxheight); Graphics.DrawBox(background, info.FontBackgroundColor); }
//--------------------------------------------------------Set-, Get- Metoden:---------------------------------------------------------\\ #region --Set-, Get- Metode-- #endregion //--------------------------------------------------------Sonstige Metoden:-----------------------------------------------------------\\ #region --Sonstige Metoden (Public)-- #endregion #region --Sonstige Metoden (Private)-- private void populateMap() { Geopoint home = DataStorage.INSTANCE.userData.adressHome; Geopoint work = DataStorage.INSTANCE.userData.adressWork; if (work != null) { MapIcon homeIcon = new MapIcon(); homeIcon.Location = work; homeIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); homeIcon.Title = "Work Point"; homeIcon.ZIndex = 0; map.MapElements.Add(homeIcon); map.Center = work; map.ZoomLevel = 14; } if (home != null) { MapIcon workIcon = new MapIcon(); workIcon.Location = home; workIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); workIcon.Title = "Home Point"; workIcon.ZIndex = 0; map.MapElements.Add(workIcon); map.Center = home; map.ZoomLevel = 14; } }
private void AddPushpin(string deviceID, Windows.Devices.Geolocation.BasicGeoposition position) { var mapDevices = new List <MapElement>(); Windows.Devices.Geolocation.BasicGeoposition snPosition = new Windows.Devices.Geolocation.BasicGeoposition { Latitude = position.Latitude, Longitude = position.Longitude }; var pushpin = new MapIcon { Location = new Geopoint(snPosition), NormalizedAnchorPoint = new Point(0.5, 1), ZIndex = 1000, Tag = "NEW", Title = deviceID, Image = RandomAccessStreamReference.CreateFromUri(new Uri(resourceLoader.GetString("Map_Pushpin_New"))), }; mapDevices.Add(pushpin); var mapDevicesLayer = new MapElementsLayer { ZIndex = 1, MapElements = mapDevices }; MapLayers.Add(mapDevicesLayer); CTRL_Map_Main.Layers.Add(mapDevicesLayer); }
//populate map with bus stops private async Task <BusStops[]> populateMap() { //find bus stops busStopData = await GetBusStops.API_Call(); //loop through busStopData for (int i = 0; i < busStopData.Length; i++) { //create map icon MapIcon tempMapIcon = new MapIcon(); //find location for icon BasicGeoposition iconPosition = new BasicGeoposition() { Latitude = busStopData[i].latitude, Longitude = busStopData[i].longitude }; //define icon Geopoint iconPoint = new Geopoint(iconPosition); tempMapIcon.Location = iconPoint; tempMapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); tempMapIcon.ZIndex = 0; tempMapIcon.Title = busStopData[i].long_name; //add icon to map MyMap.MapElements.Add(tempMapIcon); } return(busStopData); }
protected override void OnEntityAdded(EntityWrapper entity) { if (!Settings.Enable || currentAlerts.ContainsKey(entity)) { return; } if (entity.HasComponent <WorldItem>()) { IEntity item = entity.GetComponent <WorldItem>().ItemEntity; ItemUsefulProperties props = EvaluateItem(item); if (props.IsWorthAlertingPlayer(currencyNames, Settings)) { AlertDrawStyle drawStyle = props.GetDrawStyle(); currentAlerts.Add(entity, drawStyle); CurrentIcons[entity] = new MapIcon(entity, new HudTexture("minimap_default_icon.png", drawStyle.Color), () => Settings.ShowItemOnMap, 8); if (Settings.PlaySound && !playedSoundsCache.Contains(entity.LongId)) { playedSoundsCache.Add(entity.LongId); Sounds.AlertSound.Play(); } } } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { HardwareButtons.BackPressed += HardwareButtons_BackPressed; // Map Token for testing purpose, // otherwise you'll get an alart message in Map Control MyMap.MapServiceToken = "NGj5WksCMeAFIY5vFJQ3-Q"; geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; try { // Getting Current Location Geoposition geoposition = await geolocator.GetGeopositionAsync( maximumAge: TimeSpan.FromMinutes(5), timeout: TimeSpan.FromSeconds(10)); MapIcon mapIcon = new MapIcon(); // Locate your MapIcon mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/mygeo.png")); // Show above the MapIcon mapIcon.Title = "我的位置"; // Setting up MapIcon location mapIcon.Location = new Geopoint(new BasicGeoposition() { //Latitude = geoposition.Coordinate.Latitude, [Don't use] //Longitude = geoposition.Coordinate.Longitude [Don't use] Latitude = geoposition.Coordinate.Point.Position.Latitude, Longitude = geoposition.Coordinate.Point.Position.Longitude }); // Positon of the MapIcon mapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5); MyMap.MapElements.Add(mapIcon); List<Geolocation> allsite = await Geolocator_service.Read(); foreach(Geolocation item in allsite) { MapIcon mapItem = new MapIcon(); // Locate your MapIcon mapItem.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/geo.png")); // Show above the MapIcon mapItem.Title = item.Name; // Setting up MapIcon location mapItem.Location = new Geopoint(new BasicGeoposition() { //Latitude = geoposition.Coordinate.Latitude, [Don't use] //Longitude = geoposition.Coordinate.Longitude [Don't use] Latitude = item.Latitude, Longitude = item.Longitude }); // Positon of the MapIcon //mapItem.NormalizedAnchorPoint = new Point(0.5, 0.5); MyMap.MapElements.Add(mapItem); } // Showing in the Map // } catch (UnauthorizedAccessException) { new MessageDialog("定位服务被关闭!"); } }
async private void updateUserPosition() { Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 100 }; Geoposition pos = await geolocator.GetGeopositionAsync(); var pinIcon = new MapIcon { Location = pos.Coordinate.Point, NormalizedAnchorPoint = new Point(0.5, 1.0), ZIndex = 0, Title = "Trenutna", CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible }; string path = "ms-appx:///Assets/Icons/Pin/"; var tempColour = path + "Black" + ".png"; pinIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri(tempColour)); MapControlRestaurant.MapElements.Add(pinIcon); }
private void StartCurrentPosition() { _progressIndicator.IsIndeterminate = true; _customLayer = new MapLayer(); MapControl.Layers.Add(_customLayer); MapControl.Center = new GeoCoordinate(48.8607, 2.3504); MapControl.ZoomLevel = 10; Random rand = new Random(); foreach (var evt in model.ItemsByDate) { MapIcon posIcon = new MapIcon() { Width = 40, Height = 40, AnchorPoint = MapIconAnchorPoint.Center, Coordinate = new GeoCoordinate(evt.loc[0], evt.loc[1]), Source = new Uri("/PanoramaApp1;component/Images/MapObjects.png", UriKind.RelativeOrAbsolute), Content = GetPushPinTemplate( evt.text + " - " + evt.nb_plus, evt) }; _customLayer.Children.Add(posIcon); } _progressIndicator.IsIndeterminate = false; }
private void SetPoint(double Lat, double Long, string Name) { // Specify a known location. BasicGeoposition snPosition = new BasicGeoposition() { Latitude = Lat, Longitude = Long }; Geopoint snPoint = new Geopoint(snPosition); // Create a MapIcon. MapIcon mapIcon1 = new MapIcon(); mapIcon1.Location = snPoint; mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon1.Title = Name; mapIcon1.ZIndex = 0; // Add the MapIcon to the map. MyMap.MapElements.Add(mapIcon1); // Center the map over the POI. MyMap.Center = snPoint; MyMap.ZoomLevel = 16; }
private async void map_MapElementClick(MapControl sender, MapElementClickEventArgs args) { MapIcon icon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon; foreach (var vet in vets) { if (vet.Location.Latitude == icon.Location.Position.Latitude && vet.Location.Longitude == icon.Location.Position.Longitude) { BasicGeoposition bgp = new BasicGeoposition() { Latitude = vet.Location.Latitude, Longitude = vet.Location.Longitude }; vetPanel.DataContext = vet; vetPanel.Visibility = Visibility.Visible; if (vet.Color == "gray") { callButton.Visibility = Visibility.Collapsed; } var center = new Geopoint(bgp); await map.TrySetViewAsync(center, 10, 0, 0, MapAnimationKind.Bow); VetDetailsView.vet = vet; break; } } }
private void Gps_MessageReceived(object sender, MessageReceivedEventArgs e) { Navigation.GeodeticPosition pos = e.ReceivedMessage as Navigation.GeodeticPosition; if (pos != null) { statusTextBox.Text = "GPS Data Received at " + DateTime.Now.ToString(); StringBuilder bldr = new StringBuilder(); bldr.AppendLine("GPS Information"); bldr.AppendLine("Latitude: " + pos.Latitude); bldr.AppendLine("Longitude: " + pos.Longitude); bldr.AppendLine("Time: " + pos.TimeMillisOfWeek); bldr.AppendLine("MSL: " + pos.HeightAboveSeaLevel); contentTextBox.Text = bldr.ToString(); if (myLocation == null) { mapView.Center = new Windows.Devices.Geolocation.Geopoint(pos.GetGeoposition()); mapView.ZoomLevel = 18; myLocation = new MapIcon(); myLocation.Location = mapView.Center; myLocation.NormalizedAnchorPoint = new Point(0.5, 1.0); myLocation.Image = mapIconStreamReference; myLocation.ZIndex = 0; mapView.MapElements.Add(myLocation); } else { myLocation.Location = new Windows.Devices.Geolocation.Geopoint(pos.GetGeoposition()); } } }
private void DisplayIcon(double x, double y, MapControl MapControl1) { BasicGeoposition snPosition = new BasicGeoposition() { Latitude = x, Longitude = y }; Geopoint snPoint = new Geopoint(snPosition); // Create a MapIcon. MapIcon mapIcon1 = new MapIcon(); mapIcon1.Location = snPoint; mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon1.Title = "Pin"; mapIcon1.ZIndex = 0; // Add the MapIcon to the map. MapControl1.MapElements.Add(mapIcon1); // MapControl1.MapElements.Add(new MapIcon() { Location = new Geopoint(new BasicGeoposition() { Latitude = x - 5, Longitude = y } ), NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Pin", ZIndex=0 }); // Center the map over the POI. MapControl1.Center = snPoint; MapControl1.ZoomLevel = 14; textBlock.Text = x.ToString(); textBlock1.Text = y.ToString(); }
protected override void OnEntityAdded(EntityWrapper entity) { if (!Settings.Enable || alertTexts.ContainsKey(entity)) { return; } if (entity.IsAlive && entity.HasComponent <Monster>()) { string text = entity.Path; if (text.Contains('@')) { text = text.Split('@')[0]; } MonsterConfigLine monsterConfigLine = null; if (typeAlerts.ContainsKey(text)) { monsterConfigLine = typeAlerts[text]; AlertHandler(monsterConfigLine, entity); } else { string modAlert = entity.GetComponent <ObjectMagicProperties>().Mods.FirstOrDefault(x => modAlerts.ContainsKey(x)); if (modAlert != null) { monsterConfigLine = modAlerts[modAlert]; AlertHandler(monsterConfigLine, entity); } } MapIcon mapIcon = GetMapIconForMonster(entity, monsterConfigLine); if (mapIcon != null) { CurrentIcons[entity] = mapIcon; } } }
private async void button_Click(object sender, RoutedEventArgs e) { var accessStatus = await Geolocator.RequestAccessAsync(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: Geolocator gl = new Geolocator(); Geoposition gp = await gl.GetGeopositionAsync(); Geopoint myloc = gp.Coordinate.Point; map1.Center = myloc; map1.ZoomLevel = 15; map1.LandmarksVisible = true; MapIcon mi = new MapIcon(); mi.Location = myloc; mi.NormalizedAnchorPoint = new Point(0.5, 1.0); mi.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png")); mi.ZIndex = 0; map1.MapElements.Add(mi); break; case GeolocationAccessStatus.Denied: break; case GeolocationAccessStatus.Unspecified: break; } }
//listener for icon clicks private void mapIcon_Click(MapControl sender, MapElementClickEventArgs args) { //find which icon element has been clicked MapIcon clickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon; string long_name = clickedIcon.Title; //if user hasnt clicked his location icon if (!clickedIcon.Title.Contains("You are here")) { //loop through busStopData for (int i = 0; i < busStopData.Length; i++) { //find stop_ref if (clickedIcon.Title == busStopData[i].long_name) { //stop_ref = busStopData[i].stop_ref; makeDepartureTimes(busStopData[i].stop_ref); break; } } } else //user location was clicked { showMessage(clickedIcon.Title); } }
// Method for adding Room Location Icon public int AddMarker(Double latitude, Double longtitude, String title) { int index = gmitMap.Layers.Count; var MyLandmarks = new List <MapElement>(); Geopoint snPoint = new Geopoint(new BasicGeoposition() { Latitude = latitude, Longitude = longtitude, Altitude = 0 }, AltitudeReferenceSystem.Surface); var spaceNeedleIcon = new MapIcon { Location = snPoint, NormalizedAnchorPoint = new Point(0D, 0D), ZIndex = 1, Title = title }; MyLandmarks.Add(spaceNeedleIcon); var LandmarksLayer = new MapElementsLayer { ZIndex = 1, MapElements = MyLandmarks }; gmitMap.Layers.Add(LandmarksLayer); return(index); }
private void DrawToLargeMiniMap(Entity entity) { var icon = GetMapIcon(entity); if (icon == null) { return; } var iconZ = entity?.GetComponent <Render>()?.Z; if (iconZ == null) { return; } try { var point = LargeMapInformation.ScreenCenter + MapIcon.DeltaInWorldToMinimapDelta(entity.GetComponent <Positioned>().GridPos - LargeMapInformation.PlayerPos, LargeMapInformation.Diag, LargeMapInformation.Scale, ((float)iconZ - LargeMapInformation.PlayerPosZ) / (9f / LargeMapInformation.MapWindow.LargeMapZoom)); var size = icon.Size * 2; // icon.SizeOfLargeIcon.GetValueOrDefault(icon.Size * 2); // LogMessage($"{Name}: entity.Path - {entity.Path}"); Graphics.DrawImage(icon.Texture, new RectangleF(point.X - size / 2f, point.Y - size / 2f, size, size), icon.Color); } catch (NullReferenceException) { } }
private void CreateListElement() { try { var mapIcon = new MapIcon { Location = new Geopoint(new BasicGeoposition { Latitude = UserLocation.Latitude, Longitude = UserLocation.Longitude }), NormalizedAnchorPoint = new Point(0.5, 1.0), Title = Singleton.Singleton.Instance().CurrentUser.username }; ListMapIcons.Add(mapIcon); MapElements = new ObservableCollection<MapElement>(); foreach (var icon in ListMapIcons) { MapElements.Add(icon); } } catch (Exception) { new MessageDialog(loader.GetString("ErrorGeo")).ShowAsync(); } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { gp = await g1.GetGeopositionAsync(); Geopoint m1 = gp.Coordinate.Point; MapIcon mypoi = new MapIcon { Location = m1, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "my loc", ZIndex = 0 }; mymap.MapElements.Add(mypoi); mymap.ZoomLevel = 15; mymap.Center = m1; allusers = await App.MobileService.GetTable <detailsofperson>().ToListAsync(); int count = 0; foreach (detailsofperson det in allusers) { Geopoint mypoint = new Geopoint(new BasicGeoposition { Latitude = Convert.ToDouble(det.lat), Longitude = Convert.ToDouble(det.lng) }); myPOI = new MapIcon { Location = mypoint, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = ++count + "", ZIndex = 0 }; // add to map and center i // myPOI = new MapIcon { Location = myPoint, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "My position", ZIndex = 0 }; mymap.MapElements.Add(myPOI); } }
private async Task DrawPolyline(List<BasicGeoposition> geopositions) { ActivityMap.MapElements.Clear(); if (geopositions.Any()) { var polyLine = new MapPolyline { Path = new Geopath(geopositions), StrokeThickness = 4, StrokeColor = (Color)App.Current.Resources["StravaRedColor"] }; ActivityMap.MapElements.Add(polyLine); MapIcon startMapIcon = new MapIcon(); startMapIcon.Location = new Geopoint(geopositions.First()); startMapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5); startMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Start.png")); ActivityMap.MapElements.Add(startMapIcon); MapIcon endMapIcon = new MapIcon(); endMapIcon.Location = new Geopoint(geopositions.Last()); endMapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5); endMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/End.png")); ActivityMap.MapElements.Add(endMapIcon); var zoomed = false; while (!zoomed) zoomed = await ActivityMap.TrySetViewBoundsAsync(GeoboundingBox.TryCompute(geopositions), null, MapAnimationKind.None); } }
private async void InitializeMap() { var queryHintGeoPosition = new BasicGeoposition { Latitude = 47.643, Longitude = -122.131 }; var result = await MapLocationFinder.FindLocationsAsync(App.EventModel.EventAddress, new Geopoint(queryHintGeoPosition)); if (result != null && result.Locations.Count != 0) { await mapControl.TrySetViewAsync(result.Locations[0].Point, 16, 0, 0, MapAnimationKind.None); } var mapIconStreamReference = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/mappin.png")); var mapIcon = new MapIcon { Location = mapControl.Center, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Event location", Image = mapIconStreamReference, ZIndex = 0 }; mapControl.MapElements.Add(mapIcon); }
private async void getPosicionActual() { var accessStatus = await Geolocator.RequestAccessAsync(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; MapIcon posicionActual = new MapIcon(); posicionActual.Location = myGeocoordinate.Point; posicionActual.NormalizedAnchorPoint = new Point(0.5, 1.0); posicionActual.Title = "MiPosicion"; posicionActual.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/posicion_actual.png")); posicionActual.ZIndex = 0; VerMap.MapElements.Add(posicionActual); break; case GeolocationAccessStatus.Denied: break; case GeolocationAccessStatus.Unspecified: break; } }
/// <summary> /// Constructor. /// </summary> /// <param name="position"></param> /// <param name="type"></param> /// <param name="style"></param> public BaseMapIcon(Vector3 position, MapIcon type, MapIconType style) { Position = position; Type = type; Style = style; Color = Color.Red; }
private async void DrawPolyline(List <BasicGeoposition> geopositions) { ActivityMap.MapElements.Clear(); if (geopositions.Any()) { var polyLine = new MapPolyline { Path = new Geopath(geopositions), StrokeThickness = 4, StrokeColor = (Color)App.Current.Resources["StravaRedColor"] }; ActivityMap.MapElements.Add(polyLine); MapIcon startMapIcon = new MapIcon(); startMapIcon.Location = new Geopoint(geopositions.First()); startMapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5); startMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Start.png")); ActivityMap.MapElements.Add(startMapIcon); MapIcon endMapIcon = new MapIcon(); endMapIcon.Location = new Geopoint(geopositions.Last()); endMapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5); endMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/End.png")); ActivityMap.MapElements.Add(endMapIcon); var zoomed = false; while (!zoomed) { zoomed = await ActivityMap.TrySetViewBoundsAsync(GeoboundingBox.TryCompute(geopositions), null, MapAnimationKind.None); } } }
private async void RemovePushpin(string deviceID) { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { foreach (MapElementsLayer item in CTRL_Map_Main.Layers) { var selectedMapIcons = item.MapElements.Where(x => x is MapIcon).ToList(); if (selectedMapIcons != null) { MapIcon selectedMapIcon = selectedMapIcons.FirstOrDefault(x => x is MapIcon && ((MapIcon)x).Title == deviceID) as MapIcon; if (selectedMapIcon != null) { Debug.WriteLine($"FOUND -> {selectedMapIcon.Title}"); CTRL_Map_Main.Layers.Remove(item); return; } } } }); }
protected override async void OnNavigatedTo(NavigationEventArgs e) //OnNavigatedTo { myMap.MapElements.Clear(); //--- set position --- geolocator = new Geolocator(); try { geoposition = await geolocator.GetGeopositionAsync(); } catch (Exception ex) { MessageDialog msgbox = new MessageDialog("Could not find your current location :( /n {0}", ex.Message); msgbox.ShowAsync(); } await myMap.TrySetViewAsync(geoposition.Coordinate.Point, 17); //--- pin --- MapIcon mapIcon = new MapIcon() { NormalizedAnchorPoint = new Point(0.5, 1.0), Location = geoposition.Coordinate.Point, }; myMap.MapElements.Add(mapIcon); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); if (_locationService != null) { _locationService.PositionChanged += LocationServicePositionChanged; var initializationSuccessful = await _locationService.InitializeAsync(); if (initializationSuccessful) { await _locationService.StartListeningAsync(); } if (initializationSuccessful && _locationService.CurrentPosition != null) { Center = _locationService.CurrentPosition.Coordinate.Point; } else { Center = new Geopoint(_defaultPosition); } } var mapIcon = new MapIcon() { Location = Center, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Map_YourLocation".GetLocalized(), Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/map.png")), ZIndex = 0 }; MapIcons.Add(mapIcon); }
private void RemoveTmpPoint(MapIcon icon) { TmpMapElements.Remove(icon); mapControl.MapElements.Remove(icon); var iconPos = icon.Location.Position; if (TmpMapElements.Count > 0 && TmpMapElements.First() is MapPolyline) { if (TmpMapElements.Count == 2) { mapControl.MapElements.Remove(TmpMapElements[0]); TmpMapElements.Remove(TmpMapElements[0]); return; } List <BasicGeoposition> path = new List <BasicGeoposition>((TmpMapElements.First() as MapPolyline).Path.Positions); BasicGeoposition itemToRemove = new BasicGeoposition(); bool found = false; foreach (var item in path) { if ((Math.Abs(item.Latitude - iconPos.Latitude) < 0.000001 && (Math.Abs(item.Longitude - iconPos.Longitude) < 0.000001))) { itemToRemove = item; found = true; break; } } if (found) { path.Remove(itemToRemove); (TmpMapElements.First() as MapPolyline).Path = new Geopath(path); } } }
private async void map_Loaded(object sender, RoutedEventArgs e) { // Authorization of map services map.MapServiceToken = "QRJj0BZ57yT77gTeYfN-uw"; // Show current location // Source: https://msdn.microsoft.com/en-us/magazine/dn818495.aspx try { geoposition = await geolocator.GetGeopositionAsync(); } catch (Exception ex) { MessageDialog msgbox = new MessageDialog("Failed to obtain location information: " + ex.Message); await msgbox.ShowAsync(); } map.Center = geoposition.Coordinate.Point; map.ZoomLevel = 15; // Adding a Custom Image to the Map Control // Source: https://msdn.microsoft.com/en-us/magazine/dn818495.aspx MapIcon mapIcon = new MapIcon(); mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/MapPin.png")); mapIcon.NormalizedAnchorPoint = new Point(0.25, 0.9); mapIcon.Location = geoposition.Coordinate.Point; mapIcon.Title = "You are here"; map.MapElements.Add(mapIcon); }
/// <summary> /// Inserts the map icon on the map from Code-behind, due to accessing the map from ViewModel is troublesome. /// </summary> /// <param name="Locations">The locations.</param> public async void Insert_MapIcon_CodeBehind(List <string> Locations) { myMap.MapElements.Clear(); var geoList = new List <BasicGeoposition>(); using (var client = new HttpClient()) { foreach (var loc in Locations) { Uri geocodeRequest = new Uri(string.Format("http://dev.virtualearth.net/REST/v1/Locations?locality=" + loc + "&key=" + BingMapKey)); var json = await client.GetStringAsync(geocodeRequest); dynamic response = JObject.Parse(json); JArray latlng = (JArray)response["resourceSets"][0]["resources"][0]["point"]["coordinates"]; BasicGeoposition basicGeoposition = new BasicGeoposition() { Latitude = (double)latlng[0], Longitude = (double)latlng[1] }; geoList.Add(basicGeoposition); Geopoint geoPoint = new Geopoint(basicGeoposition); MapIcon mapIcon = new MapIcon(); mapIcon.Location = geoPoint; myMap.MapElements.Add(mapIcon); } AddLineToMap(geoList); } }
protected virtual void Awake() { currentHP = maxHP; _meshRenderer = GetComponentInChildren <MeshRenderer>(); _mapIcon = GetComponentInChildren <MapIcon>(); }
public static MapIcon CreateMapIcon(PvPPlayer player, FrameworkElement uiElement) { if (player == null) { throw new ArgumentNullException(nameof(player)); } if (uiElement == null) { throw new ArgumentNullException(nameof(uiElement)); } var playerIcon = new MapIcon { BackgroundColor = GetTeamColor(player.Team), PlayerIdentityColor = player.IdentityColor, EventContent = uiElement, }; var playerNameBinding = new Binding("Name") { Source = player, }; playerIcon.SetBinding(Timeline.Parts.MapIcon.PlayerNameProperty, playerNameBinding); return(playerIcon); }
// Init map private void InitializeMap() { var space = (ActualHeight * 40) / 100; MapPresenter.Height = ActualHeight; MapPresenter.Margin = new Thickness(0, -(space / 2), 0, -(space / 2)); if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 2)) { var scrollingHost = NearbyList.Descendants <ScrollViewer>().FirstOrDefault() as ScrollViewer; var scrollerViewerManipulation = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollingHost); var compositor = scrollerViewerManipulation.Compositor; var expression = compositor.CreateExpressionAnimation("-(ScrollManipulation.Translation.Y / 2)"); expression.SetScalarParameter("ParallaxMultiplier", (float)(space / 2)); expression.SetReferenceParameter("ScrollManipulation", scrollerViewerManipulation); var heroVisual = ElementCompositionPreview.GetElementVisual(MapPresenter); heroVisual.CenterPoint = new Vector3((float)(MapPresenter.ActualWidth / 2), (float)MapPresenter.ActualHeight, 0); heroVisual.StartAnimation("Offset.Y", expression); } mMap.Style = MapStyle.Road; mMap.ZoomLevel = 10; userPos = new MapIcon(); userPos.ZIndex = 0; userPos.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Icons/userPos32.png")); userPos.Visible = false; mMap.MapElements.Add(userPos); FindLocation(); }
/// <summary> /// Displays the currently selected area to the user. /// </summary> private void UpdateSelectionVisual() { // Clear any current polygons/pins MyMapControl.MapElements.Clear(); // Iterate through corner points and add pin icons foreach (BasicGeoposition cornerPoint in GetCornerPoints()) { MapIcon pin = new MapIcon { Location = new Geopoint(cornerPoint) }; MyMapControl.MapElements.Add(pin); } // Make sure the selection is valid if (!IsSelectionValid()) { ButtonQuery.IsEnabled = false; return; } ButtonQuery.IsEnabled = true; // Create polygon to display the selection to the user MapPolygon polygon = new MapPolygon { Path = new Geopath(GetCornerPoints()), FillColor = Color.FromArgb(50, 50, 50, 50) }; // Add polygon to the map MyMapControl.MapElements.Add(polygon); }
/// <summary> /// Handles MVVM Message for Map path. /// </summary> /// <param name="path">The path.</param> private void HandleMapPath(Geopath path) { // Remove previous paths from MapControl mapActivity.MapElements.Clear(); // Validate input path if (path != null && path.Positions.Any()) { // Configure path to draw with polyline and assign path to MapControl MapPolyline loMapPolyline = new MapPolyline(); loMapPolyline.Path = path; loMapPolyline.StrokeColor = (Color)Resources["SystemAccentColor"]; loMapPolyline.StrokeThickness = 3; mapActivity.MapElements.Add(loMapPolyline); // Configure start position icon and assign path to MapControl BasicGeoposition loStartPosition = path.Positions[0]; MapIcon loStartIcon = new MapIcon(); loStartIcon.Location = new Geopoint(loStartPosition); loStartIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); loStartIcon.Title = XportBand.Resources.Strings.MapPositionStartText; loStartIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/LocationDarkGreen.png")); mapActivity.MapElements.Add(loStartIcon); // Configure end position icon and assign path to MapControl BasicGeoposition loEndPosition = path.Positions[path.Positions.Count - 1]; MapIcon loEndIcon = new MapIcon(); loEndIcon.Location = new Geopoint(loEndPosition); loEndIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); loEndIcon.Title = XportBand.Resources.Strings.MapPositionEndText; loEndIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/LocationDarkRed.png")); mapActivity.MapElements.Add(loEndIcon); // Center map to start position and assign default zoom level to 15 (TODO: auto-zoom) mapActivity.Center = new Geopoint(loStartPosition); mapActivity.ZoomLevel = 15; } }
private void AddMapIcon() { MapIcon icon = new MapIcon(); icon.Location = new Geopoint(geo); icon.NormalizedAnchorPoint = new Point(0.5, 1.0); icon.Title = name; map.MapElements.Add(icon); }
private void AddMapIcon(Geocoordinate location, String name) { //Add an mapicon for the given location MapIcon mapIcon = new MapIcon(); mapIcon.Location = location.Point; mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon.Title = name; InputMap.MapElements.Add(mapIcon); }
private void AddIcon(double latitude, double longitude, string title, string image, bool navigate = false) { MapIcon mapIcon1 = new MapIcon(); mapIcon1.Location = new Geopoint(new BasicGeoposition() { Latitude = latitude, Longitude = longitude }); mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon1.Title = title; mapIcon1.Image = RandomAccessStreamReference.CreateFromUri(new Uri(string.Format("ms-appx:///Assets/DataImages/{0}", image))); mapIcon1.ZIndex = 0; mapControl.MapElements.Add(mapIcon1); }
private void button_Click(object sender, RoutedEventArgs e) { MapIcon mapIcon1 = new MapIcon(); mapIcon1.Location = myMap.Center; mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon1.Title = "My Friend"; mapIcon1.Image = mapIconStreamReference; mapIcon1.ZIndex = 0; myMap.MapElements.Add(mapIcon1); }
private void displayPOIbicikelj(StationInfo bicikelj) { BasicGeoposition snPosition = new BasicGeoposition() { Latitude = double.Parse(bicikelj.lat), Longitude = double.Parse(bicikelj.lng) }; Geopoint snPoint = new Geopoint(snPosition); MapIcon mapIcon = new MapIcon(); mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/bikegreen.png")); mapIcon.Location = snPoint; mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon.Title = bicikelj.name; mapIcon.ZIndex = 0; myMap.MapElements.Add(mapIcon); }
public void AddIcon() { for (int i = 0; i < pushPin.Items().Count; i++) { MapIcon myIcon = new MapIcon(); myIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); myIcon.Title = "Apartment here"; MyMap.MapElements.Add(myIcon); myIcon.Location = pushPin.MyGeopoint(i); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { var vm = new MapViewModel((Distributeurs)e.Parameter); this.DataContext = vm; var itemGeoPoint = new Geopoint(new BasicGeoposition() { Latitude = vm.ItemDistributeur.Geometry.Coordonnees[1], Longitude = vm.ItemDistributeur.Geometry.Coordonnees[0] }); var MaMapIcon1 = new MapIcon(); MaMapIcon1.Location = itemGeoPoint; MaMap.MapElements.Add(MaMapIcon1); }
private void UpdateMap() { resultsMap.Children.Clear(); foreach (PlaceViewModel p in App.ViewModel.Places) { MapIcon icon = new MapIcon(); icon.Location = new Geopoint(new BasicGeoposition() { Latitude = p.Lat, Longitude = p.Lon }); icon.Title = App.ViewModel.Places.IndexOf(p).ToString(); resultsMap.MapElements.Add(icon); } }
private void displayPOIparking(Parkirisca parking) { BasicGeoposition snPosition = new BasicGeoposition() { Latitude = parking.KoordinataY_wgs, Longitude = parking.KoordinataX_wgs }; Geopoint snPoint = new Geopoint(snPosition); MapIcon mapIcon = new MapIcon(); mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/parkgreen.png")); mapIcon.Location = snPoint; mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon.Title = parking.Ime; mapIcon.ZIndex = 0; myMap.MapElements.Add(mapIcon); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { // Specify a known location. BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 48.869465, Longitude = 2.394892 }; Geopoint cityCenter = new Geopoint(cityPosition); // Set the map location. MapControl1.Center = cityCenter; MapControl1.ZoomLevel = 14; MapControl1.LandmarksVisible = true; // Set your current location. var accessStatus = await Geolocator.RequestAccessAsync(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: // Get the current location. Geolocator geolocator = new Geolocator(); Geoposition pos = await geolocator.GetGeopositionAsync(); Geopoint myLocation = pos.Coordinate.Point; // Set the map location. MapControl1.Center = myLocation; MapControl1.ZoomLevel = 12; MapControl1.LandmarksVisible = true; BasicGeoposition startLocation = new BasicGeoposition() { Latitude = myLocation.Position.Latitude, Longitude = myLocation.Position.Longitude }; //set a map icon (mylocation) Geopoint snPoint = new Geopoint(startLocation); MapIcon mapIconStart = new MapIcon(); mapIconStart.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/map-pin.png")); mapIconStart.Location = snPoint; mapIconStart.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIconStart.Title = "Vous"; mapIconStart.ZIndex = 0; MapControl1.MapElements.Add(mapIconStart); break; case GeolocationAccessStatus.Denied: // Handle the case if access to location is denied. break; case GeolocationAccessStatus.Unspecified: // Handle the case if an unspecified error occurs. break; } }
private void updateControl() { Debug.WriteLine("UpdateControl"); BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = Latitude, Longitude = Longitude }; Geopoint cityCenter = new Geopoint(cityPosition); mapC.Center = cityCenter; MapIcon mapicon = new MapIcon(); mapicon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///images/mapicon_scaled.png")); mapicon.Location = cityCenter; mapicon.NormalizedAnchorPoint = new Point(0.5, 1.0); mapicon.ZIndex = 0; mapC.MapElements.Add(mapicon); }
private async void AddMapIcon(Geoposition geo) { MapIcon MapIcon1 = new MapIcon(); MapIcon1.Location = new Geopoint(new BasicGeoposition() { Latitude = geo.Coordinate.Latitude, Longitude = geo.Coordinate.Longitude }); MapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0); MapIcon1.Title = "My Position"; MapControl1.MapElements.Add(MapIcon1); }
private async void Page_Loaded(object sender, RoutedEventArgs e) { _cts = new CancellationTokenSource(); CancellationToken token = _cts.Token; try { var accessStatus = await Geolocator.RequestAccessAsync(); switch (accessStatus) { case GeolocationAccessStatus.Allowed: try { var geoposition = await GeoService.GetSinglePositionAsync(token); Latitude = geoposition.Point.Position.Latitude; Longitude = geoposition.Point.Position.Longitude; } catch (Exception) { } break; case GeolocationAccessStatus.Denied: ShowLocationDistance = false; break; } } catch (Exception) { } finally { _cts = null; } foreach (var location in LocationList) { var pin = new MapIcon() { Location = new Geopoint(new BasicGeoposition() { Latitude = location.Latitude, Longitude = location.Longitude }), Title = location.Name, Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/s2mpin.png")), NormalizedAnchorPoint = new Point(0.5, 1.0) }; Image pinImage = new Image(); pinImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/s2mpin.png")); pinImage.Width = 20; pinImage.Height = 20; MapControl.SetLocation(pinImage, new Geopoint(new BasicGeoposition() { Latitude = location.Latitude, Longitude = location.Longitude })); MapControl.SetNormalizedAnchorPoint(pinImage, new Point(0.5, 0.5)); mapsControlLocations.Children.Add(pinImage); } if (ShowLocationDistance) { var currentLocation = new Geopoint(new BasicGeoposition() { Latitude = Latitude, Longitude = Longitude }); await mapsControlLocations.TrySetViewAsync(currentLocation, 15, 0, 0, MapAnimationKind.None); } }
async protected override void OnNavigatedTo(NavigationEventArgs e) { Geolocator geo = new Geolocator(); Geoposition pos = await geo.GetGeopositionAsync(); BasicGeoposition upos = new BasicGeoposition() { Latitude = pos.Coordinate.Point.Position.Latitude, Longitude = pos.Coordinate.Point.Position.Longitude }; MapSet.Center = new Geopoint(upos); MapSet.ZoomLevel = 15; MapSet.LandmarksVisible = true; pin = new MapIcon(); pin.Location = new Geopoint(upos); pin.NormalizedAnchorPoint = new Point(0.5, 1.0); MapSet.MapElements.Add(pin); MapSet.MapTapped += MapSet_MapTapped; Windows.Phone.UI.Input.HardwareButtons.BackPressed += App.HardwareButtons_BackPressed; }
private void Map_Tapped(MapControl sender, MapInputEventArgs args) { if (!sender.IsEnabled) return; lat = args.Location.Position.Latitude; lon = args.Location.Position.Latitude; MapIcon icon = new MapIcon(); icon.Location = args.Location; icon.Title = ""; sender.MapElements.Clear(); sender.MapElements.Add(icon); }
public async void mapPoits(MapControl map, IEnumerable<Model.Location> locations) { foreach (Model.Location location in locations) { MapIcon mapIcon = new MapIcon(); mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon.Title = await GetDisplayName(location.Coordenadas); mapIcon.Location = location.Coordenadas; mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/MapPin.png")); mapIcon.ZIndex = 0; myMap.MapElements.Add(mapIcon); } }
private async void buttonYou_Click(object sender, RoutedEventArgs e) { var gl = new Geolocator() { DesiredAccuracy = PositionAccuracy.High }; var location = await gl.GetGeopositionAsync(TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5)); var pin = new MapIcon() { Location = location.Coordinate.Point, Title = "You are here!", Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png")), NormalizedAnchorPoint = new Point() { X = 0.32, Y = 0.78 }, }; map1.MapElements.Add(pin); map1.TrySetViewAsync(location.Coordinate.Point, 16, 0, 0, MapAnimationKind.Bow); }
private void AddPushPin() { var mapIconStreamReference = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Burger.png")); MapIcon mapIcon = new MapIcon { Location = Map.Center, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "Burger Restaurant", Image = mapIconStreamReference, ZIndex = 0 }; Map.MapElements.Add(mapIcon); }
private void SetPushpins() { if (AppGlobal.Instance._CurrentSession.CurrentRoute != null) { foreach (Bestelling b in AppGlobal.Instance._CurrentSession.CurrentRoute.Bestellingen) { // Create a MapIcon. MapIcon icon = new MapIcon(); icon.Location = new Geopoint(b.Position); icon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/icons/museum35.png")); icon.NormalizedAnchorPoint = new Point(0.5, 1.0); MapControl1.MapElements.Add(icon); } } }
public TransitStopIconWrapper(TransitStop stop) { if (stop.Path == null) { Element = new MapIcon() { Location = stop.Position.ToGeopoint(), NormalizedAnchorPoint = new Windows.Foundation.Point(0.5, 0.5), CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible, ZIndex = 5 }; } else { Element = new MapPolygon() { Path = new Windows.Devices.Geolocation.Geopath(GooglePolylineConverter.Decode(stop.Path).Select(ll => ll.ToBasicGeoposition())), StrokeColor = Colors.Black, FillColor = Colors.DarkGray, StrokeThickness = 2, ZIndex = 4 }; } AttachedProperties.SetElementType(Element, "TransitStop"); AttachedProperties.SetElementID(Element, stop.ID); Stop = stop; SetStopSize(); }
public override MapElement CreateShape(object viewModel, Geopath path) { var icon = new MapIcon { Location = new Geopoint(path.Positions[0]), NormalizedAnchorPoint = new Point(AnchorX,AnchorY), ZIndex = ZIndex}; if (!string.IsNullOrWhiteSpace(Title)) { icon.Title = Title; } if (!string.IsNullOrWhiteSpace(ImageUri)) { icon.Image = RandomAccessStreamReference.CreateFromUri(new Uri(ImageUri)); } return icon; }