protected override async void AddIncidentToMap(IncidentModel incident) { var geoLocation = CoordinateConverter.ConvertToNative(incident.GeoLocation); var mapIcon = new MapIcon(); mapIcon.CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible; mapIcon.Location = geoLocation; mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0); mapIcon.ZIndex = 1000; var iconImageUri = default(Uri); switch (incident.IncidentCategory) { case IncidentType.Alert: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_alert.png"); break; case IncidentType.Animal: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_animal.png"); break; case IncidentType.Arrest: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_arrest.png"); break; case IncidentType.Car: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_car.png"); break; case IncidentType.Fire: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_siren.png"); break; case IncidentType.OfficerRequired: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_officer.png"); break; case IncidentType.Stranger: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_stranger.png"); break; default: iconImageUri = new Uri("ms-appx:///Assets/Pins/pin_car.png"); break; } RandomAccessStreamReference stream = RandomAccessStreamReference.CreateFromUri(iconImageUri); mapIcon.Image = await stream.ScaleTo(40, 58); _nativeMap.MapElements.Add(mapIcon); _pushpinMappings.Add(mapIcon, incident.Id); }
private Models.Geoposition GetIconPosition(DependencyObject icon) { if (icon == null) { return(default(Models.Geoposition)); } Geopoint geoLocation = MapControl.GetLocation(icon); return(CoordinateConverter.ConvertToAbstraction(geoLocation)); }