void UpdateMapElements(GeoCoordinate currentLoc) { Center = currentLoc; Pushpins.Clear(); Pushpins.Add(new Pushpin { Location = currentLoc }); Speed = (currentLoc.Speed * 3.6).ToString(); Altitude = currentLoc.Altitude.ToString(); if (IsRecording == false) { return; } RouteLocations.Add(currentLoc); if (RouteLocations.Count - 2 >= 0) { Distance = Distance + RouteLocations[RouteLocations.Count - 2].GetDistanceTo(currentLoc); } if (Routes.Count == 0) { var routeModel = new RouteModel(RouteLocations); Routes.Add(routeModel); Route = routeModel; } NotifyPropertyChanged(() => Route); NotifyPropertyChanged(() => Routes); }
private void InitMap() { foreach (var sensor in sensors.List) { PushpinModel pin = new PushpinModel { //Location is the field of Pushpin class Location = new Location(sensor.Latitude, sensor.Longitude), Latitude = sensor.Latitude, Longtitude = sensor.Longitude, Title = sensor.Name.ToString(), Type = sensor.GetType().Name, Description = sensor.Description }; ToolTipService.SetToolTip(pin, new ToolTip() { DataContext = pin, Style = Application.Current.Resources["CustomInfoboxStyle"] as Style }); Pushpins.Add(pin); //MapWithMarkers.Children.Add(pin); } }
public void OnNavigatedTo(NavigationEventArgs e) { Pushpins.Clear(); EventSelected = (Event)e.Parameter; if (EventSelected.PointsOfInterest == null) { EventSelected.PointsOfInterest = new ObservableCollection <PointOfInterest>(); } else { SavedPointsOfInterest = new ObservableCollection <PointOfInterest>(EventSelected.PointsOfInterest); foreach (PointOfInterest p in EventSelected.PointsOfInterest) { BasicGeoposition position = new BasicGeoposition() { Latitude = p.Latitude, Longitude = p.Longitude }; Pushpins.Add(new MapIcon() { Location = new Geopoint(position), NormalizedAnchorPoint = new Point(0.5, 1), Title = p.Name }); } } }
private void CreateNewPushpin(GeoCoordinate location) { PushpinModel p = new PushpinModel(); p.Location = location; Pushpins.Add(p); }
private void _drawHaltestellen(IEnumerable <IHaltestelle> haltestellen) { Pushpins.Clear(); foreach (IHaltestelle haltestelle in haltestellen) { Location location = new Location(haltestelle.Location.X, haltestelle.Location.Y); Pushpins.Add(new VtmPushpin() { Haltestelle = haltestelle, Location = location }); } }
public void AddElement(MapReference key, MapOverlay element) { if (Pushpins.ContainsKey(key)) { Pushpins[key].Add(element); } else { Pushpins.Add(key, new List <MapOverlay> { element }); } }
public void UpdatePins() { Pushpins.Clear(); foreach (PushpinModel p in listModels) { Pushpins.Add(p); } NotifyPropertyChanged("Pushpins"); // Make sure we still have the right ApplicationBar if (ApplicationBar != _mainAppBar) { ApplicationBar = _mainAppBar; } }
public async Task MapDoubleClick(object sender, MapInputEventArgs e) { //Delete zoom behavior on doubleclick var camera = (MapControl)sender; var currentCamera = camera.ActualCamera; await camera.TrySetSceneAsync(MapScene.CreateFromCamera(currentCamera)); //End of delete zoom behavior try { if (PushpinTitle == null || PushpinTitle == "") { throw new EmptyFieldException("Title"); } if (EventSelected.PointsOfInterest.Where(pi => pi.Name == PushpinTitle).FirstOrDefault() != null) { throw new PushpinTitleTakenException(); } MapIcon newPushpin = new MapIcon { Location = e.Location, ZIndex = 0, NormalizedAnchorPoint = new Point(0.5, 1), Title = PushpinTitle, }; Pushpins.Add(newPushpin); EventSelected.PointsOfInterest.Add(new PointOfInterest() { Latitude = e.Location.Position.Latitude, Longitude = e.Location.Position.Longitude, Name = PushpinTitle, Description = null, EventId = EventSelected.EventId, ToBeRemoved = false, }); } catch (EventException ex) { await _dialogService.ShowMessage(ex.Message, ex.Title); } }
public MapViewModel() { Points.Add(new PointItem { Name = "Steinbake Leitdamm", Location = new Location(53.51217, 8.16603) }); Points.Add(new PointItem { Name = "Buhne 2", Location = new Location(53.50926, 8.15815) }); Points.Add(new PointItem { Name = "Buhne 4", Location = new Location(53.50468, 8.15343) }); Points.Add(new PointItem { Name = "Buhne 6", Location = new Location(53.50092, 8.15267) }); Points.Add(new PointItem { Name = "Buhne 8", Location = new Location(53.49871, 8.15321) }); Points.Add(new PointItem { Name = "Buhne 10", Location = new Location(53.49350, 8.15563) }); Pushpins.Add(new PointItem { Name = "WHV - Eckwarderhörne", Location = new Location(53.5495, 8.1877) }); Pushpins.Add(new PointItem { Name = "JadeWeserPort", Location = new Location(53.5914, 8.14) }); Pushpins.Add(new PointItem { Name = "Kurhaus Dangast", Location = new Location(53.447, 8.1114) }); Pushpins.Add(new PointItem { Name = "Eckwarderhörne", Location = new Location(53.5207, 8.2323) }); Polylines.Add(new Polyline { Locations = LocationCollection.Parse("53.5140,8.1451 53.5123,8.1506 53.5156,8.1623 53.5276,8.1757 53.5491,8.1852 53.5495,8.1877 53.5426,8.1993 53.5184,8.2219 53.5182,8.2386 53.5195,8.2387") }); Polylines.Add(new Polyline { Locations = LocationCollection.Parse("53.5978,8.1212 53.6018,8.1494 53.5859,8.1554 53.5852,8.1531 53.5841,8.1539 53.5802,8.1392 53.5826,8.1309 53.5867,8.1317 53.5978,8.1212") }); }