private void showlocations() { foreach (Place p in _vm.Places) { Grid MyGrid = new Grid(); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.Background = new SolidColorBrush(Colors.Transparent); BitmapImage bmi = new BitmapImage(new Uri("/Assets/pushpinPhone.png", UriKind.Relative)); Image img = new Image(); img.Tag = (p); img.Source = bmi; MyGrid.Children.Add(img); //Creating a MapOverlay and adding the Grid to it. MapOverlay MyOverlay = new MapOverlay(); MyOverlay.Content = MyGrid; MyOverlay.GeoCoordinate = new GeoCoordinate(p.Latitude, p.Longitude); MyOverlay.PositionOrigin = new Point(0, 0.5); //Creating a MapLayer and adding the MapOverlay to it MapLayer MyLayer = new MapLayer(); MyLayer.Add(MyOverlay); mapWithMyLocation.Layers.Add(MyLayer); } }
private void AddMapIcon(Map map, GeoCoordinate geoPosition) { // Create a small circle to mark the current location. Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = geoPosition; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); // Add the MapLayer to the Map. maploc.Layers.Add(myLocationLayer); }
private void ShowMyLocationOnTheMap() { // Make my current location the center of the Map. this.mapWithMyLocation.Center = new GeoCoordinate(positionLatitude, positionLongitude); this.mapWithMyLocation.ZoomLevel = 12; // 绘制圆形为当前的位置 Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; // 创建一个包含圆形的MapOverlay MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0, 0); myLocationOverlay.GeoCoordinate = new GeoCoordinate(positionLatitude, positionLongitude); // 创建一个MapLayer包含MapOverlay MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); mapWithMyLocation.Layers.Clear(); // 将MapLayer加入到地图中 mapWithMyLocation.Layers.Add(myLocationLayer); }
private async void ShowMyLocationOnTheMap() { // Get my current location. Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); // Make my current location the center of the Map. this.mapWithMyLocation.Center = myGeoCoordinate; this.mapWithMyLocation.ZoomLevel = 13; // Create a small circle to mark the current location. Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); // Add the MapLayer to the Map. mapWithMyLocation.Layers.Add(myLocationLayer); txTop.Text = ("My Location - Lat " + myGeoCoordinate.Latitude.ToString("0.0000") + " Lon " + myGeoCoordinate.Longitude.ToString("0.0000")); }
private void Form1_Load(object sender, EventArgs e) { MapOverlay overlayWithText = new MapOverlay { Alignment = ContentAlignment.BottomRight, JoiningOrientation = Orientation.Vertical, Margin = new Padding(0, 4, 8, 8), Padding = new Padding(7) }; overlayWithText.Items.Add(new MapOverlayTextItem { Text = "Copyright © 2015. Microsoft and its suppliers. All rights reserved." }); map.Overlays.Add(overlayWithText); Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location); MapOverlay overlayWithImage = new MapOverlay { Alignment = ContentAlignment.BottomRight, JoiningOrientation = Orientation.Vertical, Margin = new Padding(0, 0, 8, 4), Padding = new Padding(0), }; overlayWithImage.Items.Add(new MapOverlayImageItem { ImageUri = new Uri(baseUri, "..\\..\\Images\\BingLogo.png") }); map.Overlays.Add(overlayWithImage); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { string quakeQueryString = string.Empty; if (NavigationContext.QueryString.TryGetValue("quake", out quakeQueryString)) { quake = Earthquake.DeserializeFromQueryString(quakeQueryString); } else return; ContentPanel.DataContext = quake; QuakeMap.Center = quake.Location; Pushpin pin = new Pushpin { GeoCoordinate = quake.Location, Content = quake.FormattedMagnitude }; if (quake.Magnitude >= appSettings.MinimumWarningMagnitudeSetting) pin.Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush; MapOverlay overlay = new MapOverlay(); overlay.Content = pin; overlay.GeoCoordinate = quake.Location; overlay.PositionOrigin = new Point(0, 1); MapLayer layer = new MapLayer(); layer.Add(overlay); QuakeMap.Layers.Add(layer); base.OnNavigatedTo(e); }
public static MapOverlay DrawPushpin(MapLayer pushpinMapLayer, GeoCoordinate coord, bool isCurrentUserLocation, bool isDestination = false) { //Creating a Grid element. Grid MyGrid = new Grid(); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.Background = new SolidColorBrush(Colors.Transparent); Image img = new Image(); img.Source = new BitmapImage(new Uri(isDestination ? Constants.DestinationPin : (isCurrentUserLocation ? Constants.TrackPinEndImage : Constants.TrackPinImage), UriKind.Relative)); img.Margin = new Thickness(-15, -45, 0, 0); MyGrid.Children.Add(img); //Creating a MapOverlay and adding the Pushpin to it. MapOverlay MyOverlay = new MapOverlay(); MyOverlay.Content = MyGrid; MyOverlay.GeoCoordinate = coord; MyOverlay.PositionOrigin = new Point(0, 0.5); //Add the MapOverlay containing the pushpin to the MapLayer pushpinMapLayer.Add(MyOverlay); return(MyOverlay); }
private async void AddPushpins(IEnumerable <AddressViewModel> addresses) { await Task.Run(() => { MapLayer layer = new MapLayer(); foreach (AddressViewModel address in addresses) { Deployment.Current.Dispatcher.BeginInvoke(() => { MapOverlay overlay = new MapOverlay(); Pushpin pushpin = new Pushpin() { Content = address.Name }; pushpin.Tap += (sender, e) => { address.ShowDetails.Execute(null); }; overlay.Content = pushpin; overlay.GeoCoordinate = address.Coordinate; layer.Add(overlay); }); } Deployment.Current.Dispatcher.BeginInvoke(() => { addressMap.Layers.Add(layer); }); }); }
private void addLocationToMap() { myMap = map; GeoCoordinate myGeocoordinate = new GeoCoordinate(latitude, longitude); myMap.Center = myGeocoordinate; myMap.ZoomLevel = 14; Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0, 1); myLocationOverlay.GeoCoordinate = myGeocoordinate; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); myMap.Layers.Add(myLocationLayer); }
private async void ShowMyLocationOnTheMap() { // Get my current location. Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); // Create a small circle to mark the current location. Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); // Add the MapLayer to the Map. Haritam.Layers.Add(myLocationLayer); }
private async void ShowMyLocationOnTheMap() { Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverterRed.ConvertGeocoordinateRed(myGeocoordinate); this.map.Center = myGeoCoordinate; this.map.ZoomLevel = 17; Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); map.Layers.Add(myLocationLayer); }
void App_PositionUpdated(object sender, EventArgs e) { Dispatcher.BeginInvoke(() => { ForeLocationCount++; if(oneMarker == null){ oneMarker = new MapOverlay(); MapLayer oneMarkerLayer = new MapLayer(); Ellipse Circhegraphic = new Ellipse(); Circhegraphic.Fill = new SolidColorBrush(Colors.Yellow); Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); Circhegraphic.StrokeThickness = 10; Circhegraphic.Opacity = 0.8; Circhegraphic.Height = 30; Circhegraphic.Width = 30; oneMarker.Content = Circhegraphic; oneMarker.PositionOrigin = new Point(0.5, 0.5); oneMarkerLayer.Add(oneMarker); map1.Layers.Add(oneMarkerLayer); } oneMarker.GeoCoordinate = App.lastLocation; if (!App.RunningInBackground) { map1.Center = oneMarker.GeoCoordinate; } statusBox.Text = "Count :" + ForeLocationCount + "/"+ App.GottenLocationsCunt + ", sess: " + App.RunningInBackgroundCunt; }); }
private async Task <GeoCoordinate> ShowMyCurrentLocationOnTheMap() { // Get my current location. Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); myGeocoordinate = myGeoposition.Coordinate; wayPoints.Add(new GeoCoordinate(myGeocoordinate.Latitude, myGeocoordinate.Longitude)); //GeoCoordinate myxGeocoordinate = new GeoCoordinate(47.6785619, -122.1311156); myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); // Make my current location the center of the Map. this.mapPostItinerary.Center = myGeoCoordinate; this.mapPostItinerary.ZoomLevel = 16; // Create a MapOverlay to contain the circle. myCurentLocationOverlay = MarkerDraw.DrawMapMarker(myGeoCoordinate); // Create a MapLayer to contain the MapOverlay. myLocationLayer = new MapLayer(); myLocationLayer.Add(myCurentLocationOverlay); // Add the MapLayer to the Map. mapPostItinerary.Layers.Add(myLocationLayer); return(myGeoCoordinate); }
private void AddResultToMap(GeoCoordinate location) { if (markerLayer != null) { map1.Layers.Remove(markerLayer); markerLayer = null; } markerLayer = new MapLayer(); map1.Layers.Add(markerLayer); oneMarker = new MapOverlay(); oneMarker.GeoCoordinate = location; Ellipse Circhegraphic = new Ellipse(); Circhegraphic.Fill = new SolidColorBrush(Colors.Yellow); Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); Circhegraphic.StrokeThickness = 30; Circhegraphic.Opacity = 0.8; Circhegraphic.Height = 80; Circhegraphic.Width = 80; oneMarker.Content = Circhegraphic; oneMarker.PositionOrigin = new Point(0.5, 0.5); Circhegraphic.MouseLeftButtonDown += textt_MouseLeftButtonDown; markerLayer.Add(oneMarker); map1.Center = oneMarker.GeoCoordinate; }
/*For see you location on the map*/ private async void ShowMyLocationOnTheMap() { // Get my current location. Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); // Make my current location the center of the Map. //MessageBox.Show("Latitude" + myGeoCoordinate.Latitude+ "Longitud: " + myGeoCoordinate.Longitude + "Altitud:"+myGeoCoordinate.Altitude); place = myGeocoordinate.ToGeoCoordinate().ToString(); this.mapWithMyLocation.Center = myGeoCoordinate; this.mapWithMyLocation.ZoomLevel = 13; // Create a small circle to mark the current location. Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); // Add the MapLayer to the Map. mapWithMyLocation.Layers.Add(myLocationLayer); }
void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { RedZone newRedZone = lstRedZones.Items.Last() as RedZone; layers = new MapLayer(); image = new BitmapImage(); image.UriSource = (new Uri(newRedZone.FbUser.Picture.data.url, UriKind.Absolute)); brush = new ImageBrush(); brush.ImageSource = image; ellipse = new Ellipse(); ellipse.DataContext = newRedZone; ellipse.Height = newRedZone.Radius / 5; ellipse.Width = newRedZone.Radius / 5; ellipse.Fill = brush; ellipse.Hold += ellipse_Hold; overlay = new MapOverlay(); overlay.GeoCoordinate = new GeoCoordinate(newRedZone.Latitude, newRedZone.Longitude); overlay.Content = ellipse; layers.Add(overlay); myMap.Layers.Add(layers); } }
private void AddPinOnMap() { geo1 = new GeoCoordinate(Convert.ToDouble(ObjRootObjectJourney.data.latlong[0].latitude), Convert.ToDouble(ObjRootObjectJourney.data.latlong[0].longitude)); geo2 = new GeoCoordinate(Convert.ToDouble(ObjRootObjectJourney.data.latlong[ObjRootObjectJourney.data.latlong.Count - 1].latitude), Convert.ToDouble(ObjRootObjectJourney.data.latlong[ObjRootObjectJourney.data.latlong.Count - 1].longitude)); Image pinIMG = new Image(); pinIMG.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Images/map/pin_green.png", UriKind.Relative)); pinIMG.Width = 50; pinIMG.Height = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = pinIMG; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = geo1; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); mapJourney.Layers.Add(myLocationLayer); myLocationLayer = null; myLocationOverlay = null; pinIMG = null; pinIMG = new Image(); pinIMG.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Images/map/pin_red.png", UriKind.Relative)); pinIMG.Width = 50; pinIMG.Height = 50; myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = pinIMG; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = geo2; myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); mapJourney.Layers.Add(myLocationLayer); myLocationLayer = null; myLocationOverlay = null; pinIMG = null; mapJourney.ZoomLevel = ZoomLevel; mapJourney.Center = geo2; }
private void Websocket_MessageReceived(object sender, MessageReceivedEventArgs e) { try { var json = e.Message; TreinenWebsocketResponse result = JsonConvert.DeserializeObject <TreinenWebsocketResponse>(json); if (result.Treinen.Any()) { Deployment.Current.Dispatcher.BeginInvoke(() => { treinenLayer.Clear(); //Show treinen on map foreach (var trein in result.Treinen) { MapOverlay overlay = new MapOverlay(); overlay.Content = new TreinMapControl(trein); overlay.GeoCoordinate = new GeoCoordinate(trein.Lat, trein.Lng); treinenLayer.Add(overlay); } }); } } catch (Exception ex) { } }
private async void InitApartments() { var apartments = await App.MobileService.GetTable <Apartment>().Where(a => a.Published == true).ToListAsync(); listApartments.ItemsSource = apartments; mapApartments.Layers.Clear(); MapLayer layer = new MapLayer(); foreach (Apartment apartment in apartments) { MapOverlay overlay = new MapOverlay(); overlay.GeoCoordinate = new GeoCoordinate(apartment.Latitude, apartment.Longitude); overlay.PositionOrigin = new Point(0, 0); Grid grid = new Grid { Height = 40, Width = 25, Background = new SolidColorBrush(Colors.Red) }; TextBlock text = new TextBlock { Text = apartment.Bedrooms.ToString(), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; grid.Children.Add(text); overlay.Content = grid; grid.Tap += (s, e) => { MessageBox.Show( "Address: " + apartment.Address + Environment.NewLine + apartment.Bedrooms + " bedrooms", "Apartment", MessageBoxButton.OK); mapApartments.SetView(overlay.GeoCoordinate, 15, MapAnimationKind.Parabolic); }; layer.Add(overlay); } mapApartments.Layers.Add(layer); }
void Seanslar_getCompleted(seanslar sender) { loader.IsIndeterminate = false; PanoramaRoot.Title = sender.SalonBilgisi.name; pItem1.DataContext = sender.SalonBilgisi; listFilmler.ItemsSource = sender.SalonBilgisi.movies; if (sender.SalonBilgisi.latitude.ToString() != "false") { SalonCoordinate = new GeoCoordinate(double.Parse(sender.SalonBilgisi.latitude), double.Parse(sender.SalonBilgisi.longitude)); myMap.SetView(SalonCoordinate, 17); pinpoint_salon newPin = new pinpoint_salon(); MapOverlay newOverlay = new MapOverlay(); newOverlay.Content = newPin; newOverlay.GeoCoordinate = SalonCoordinate; newOverlay.PositionOrigin = new Point(0, 0); MapLayer MyLayer = new MapLayer(); MyLayer.Add(newOverlay); myMap.Layers.Add(MyLayer); } else { myMap.Visibility = Visibility.Collapsed; recMap.Visibility = System.Windows.Visibility.Collapsed; } }
private MapOverlay MakeDotMarker(GeoCoordinate location, bool isDestination) { MapOverlay Marker = new MapOverlay(); Marker.GeoCoordinate = location; Ellipse Circhegraphic = new Ellipse(); if (isDestination == true) { Circhegraphic.Fill = new SolidColorBrush(Colors.Green); Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Purple); } else { Circhegraphic.Fill = new SolidColorBrush(Colors.Yellow); Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); } Circhegraphic.StrokeThickness = 30; Circhegraphic.Opacity = 0.8; Circhegraphic.Height = 80; Circhegraphic.Width = 80; Marker.Content = Circhegraphic; Marker.PositionOrigin = new Point(0.5, 0.5); Circhegraphic.MouseLeftButtonDown += textt_MouseLeftButtonDown; return(Marker); }
private async void InitApartments() { var apartments = await App.MobileService.GetTable<Apartment>().Where(a => a.Published == true).ToListAsync(); listApartments.ItemsSource = apartments; mapApartments.Layers.Clear(); MapLayer layer = new MapLayer(); foreach (Apartment apartment in apartments) { MapOverlay overlay = new MapOverlay(); overlay.GeoCoordinate = new GeoCoordinate(apartment.Latitude, apartment.Longitude); overlay.PositionOrigin = new Point(0, 0); Grid grid = new Grid { Height = 40, Width = 25, Background = new SolidColorBrush(Colors.Red) }; TextBlock text = new TextBlock { Text = apartment.Bedrooms.ToString(), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; grid.Children.Add(text); overlay.Content = grid; grid.Tap += (s, e) => { MessageBox.Show( "Address: " + apartment.Address + Environment.NewLine + apartment.Bedrooms + " bedrooms", "Apartment", MessageBoxButton.OK); mapApartments.SetView(overlay.GeoCoordinate, 15, MapAnimationKind.Parabolic); }; layer.Add(overlay); } mapApartments.Layers.Add(layer); }
private void addLocationToMap() { myMap = map; GeoCoordinate myGeocoordinate = new GeoCoordinate(latitude, longitude); myMap.Center = myGeocoordinate; myMap.ZoomLevel = 14; Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0, 1); myLocationOverlay.GeoCoordinate = myGeocoordinate; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); myMap.Layers.Add(myLocationLayer); }
void Start_ReverceGeoCoding(MapOverlay Marker) { if (geoRev.IsBusy != true && (Marker != null)) { if (Marker == DestinationMarker) { DestinationRevGeoNow = true; DestinationTitle.Text = ""; GeoProgress2.IsEnabled = true; GeoProgress2.IsIndeterminate = true; } else { DestinationRevGeoNow = false; OriginTitle.Text = ""; GeoProgress1.IsEnabled = true; GeoProgress1.IsIndeterminate = true; } // Set the geo coordinate for the query geoRev.GeoCoordinate = Marker.GeoCoordinate; geoRev.QueryAsync(); Debug.WriteLine("RevGeocodeAsync started for location: "); } }
private void DisplayData(MapLayer layer) { foreach (Cat cat in catCollection) { foreach (Place place in cat.Places) { MapPolyline newPolyline = new MapPolyline(); newPolyline.StrokeColor = Colors.Magenta; newPolyline.StrokeThickness = 5; newPolyline.Path = new GeoCoordinateCollection(); foreach (Diamond diamond in place.Diamonds) { MapOverlay newMapOverlay = new MapOverlay(); newMapOverlay.Content = new DiamondControl(diamond); newMapOverlay.GeoCoordinate = diamond.Point; newMapOverlay.PositionOrigin = new Point(0, 0.5); layer.Add(newMapOverlay); newPolyline.Path.Add(diamond.Point); } overheadMap.Map.MapElements.Add(newPolyline); } } }
public async void ShowLocationOnMap() { Geolocator geolocator = new Geolocator(); Geoposition geoposition = await geolocator.GetGeopositionAsync(); // Get geolocation Geocoordinate geocoordinate = geoposition.Coordinate; geoCoordinate = CoordinateConverter.ConvertGeocoordinate(geocoordinate); // Convert to a maps control compatible class map.Center = geoCoordinate; // Set current location as the centre of the map map.ZoomLevel = 13; // Create blue circle shown in app Ellipse marker = new Ellipse(); marker.Fill = new SolidColorBrush(Colors.Blue); marker.Height = 20; marker.Width = 20; marker.Opacity = 50; // Overlay blue circle on map control MapOverlay mapOverlay = new MapOverlay(); mapOverlay.Content = marker; mapOverlay.PositionOrigin = new Point(0.5, 0.5); mapOverlay.GeoCoordinate = geoCoordinate; MapLayer mapLayer = new MapLayer(); mapLayer.Add(mapOverlay); map.Layers.Add(mapLayer); }
private static void UserLocationChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { var mapControl = dependencyObject as MapControl; var newValue = args.NewValue as OneBusAway.Model.Point; if (newValue != null) { mapControl.userLocation = newValue.ToCoordinate(); MapOverlay locationOverlay = null; if (mapControl.userLocationLayer.Count == 0) { locationOverlay = new MapOverlay(); locationOverlay.Content = new UserLocationIcon(); mapControl.userLocationLayer.Add(locationOverlay); } else { locationOverlay = mapControl.userLocationLayer[0]; } locationOverlay.GeoCoordinate = mapControl.userLocation; } else if (mapControl.userLocationLayer.Count > 0) { mapControl.userLocationLayer.RemoveAt(0); } }
private void mapPostItinerary_Tap(object sender, System.Windows.Input.GestureEventArgs e) { if (endPointOverlay != null) { myLocationLayer.Remove(endPointOverlay); } GeoCoordinate asd = this.mapPostItinerary.ConvertViewportPointToGeoCoordinate(e.GetPosition(this.mapPostItinerary)); //MessageBox.Show("lat: " + asd.Latitude + "; long: " + asd.Longitude); //dat pushpin endPointOverlay = MarkerDraw.DrawMapMarker(asd); // Create a MapLayer to contain the MapOverlay. myLocationLayer.Add(endPointOverlay); // Add the MapLayer to the Map. mapPostItinerary.Layers.Remove(myLocationLayer); mapPostItinerary.Layers.Add(myLocationLayer); //mapPostItinerary.Layers.Remove() //hien thi thong tin diem den tren textbox geoQ.GeoCoordinate = asd; geoQ.QueryAsync(); }
private async void ShowMyLocationOnTheMap() { Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); // Make my current location the center of the Map. this.mapWithMyLocation.Center = myGeoCoordinate; this.mapWithMyLocation.ZoomLevel = 13; // Create a small circle to mark the current location. BitmapImage bmi = new BitmapImage(new Uri("/Assets/pushpinRood.png", UriKind.Relative)); Image img = new Image(); img.Source = bmi; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = img; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); // Add the MapLayer to the Map. mapWithMyLocation.Layers.Add(myLocationLayer); }
private void AddResultToMap(GeoCoordinate location) { if (PolyCircle != null) { map1.MapElements.Remove(PolyCircle); PolyCircle = null; } if (markerLayer != null) { map1.Layers.Remove(markerLayer); markerLayer = null; } markerLayer = new MapLayer(); map1.Layers.Add(markerLayer); oneMarker = new MapOverlay(); oneMarker.GeoCoordinate = location; Ellipse Circhegraphic = new Ellipse(); Circhegraphic.Fill = new SolidColorBrush(Colors.Yellow); Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); Circhegraphic.StrokeThickness = 30; Circhegraphic.Opacity = 0.8; Circhegraphic.Height = 80; Circhegraphic.Width = 80; oneMarker.Content = Circhegraphic; oneMarker.PositionOrigin = new Point(0.5, 0.5); Circhegraphic.MouseLeftButtonDown += textt_MouseLeftButtonDown; DoCreateTheAreaCircle(); if (PolyCircle != null && PolyCircle.Path != null) { twoMarker = new MapOverlay(); twoMarker.GeoCoordinate = PolyCircle.Path[0]; Ellipse Cirche2 = new Ellipse(); Cirche2.Fill = new SolidColorBrush(Colors.Yellow); Cirche2.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); Cirche2.StrokeThickness = 15; Cirche2.Opacity = 0.8; Cirche2.Height = 40; Cirche2.Width = 40; twoMarker.Content = Cirche2; twoMarker.PositionOrigin = new Point(0.5, 0.5); Cirche2.MouseLeftButtonDown += area_MouseLeftButtonDown; markerLayer.Add(twoMarker); } markerLayer.Add(oneMarker); map1.Center = oneMarker.GeoCoordinate; }
private async void ShowMyLocationOnTheMap() { // Get my current location. Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); // Create a small circle to mark the current location. Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); // Add the MapLayer to the Map. Haritam.Layers.Add(myLocationLayer); }
private void showlocations() { foreach (Place p in _vm.Places) { Grid MyGrid = new Grid(); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.Background = new SolidColorBrush(Colors.Transparent); BitmapImage bmi = new BitmapImage(new Uri("/Assets/pushpinPhone.png", UriKind.Relative)); Image img = new Image(); img.Tag = (p); img.Source = bmi; MyGrid.Children.Add(img); //Creating a MapOverlay and adding the Grid to it. MapOverlay MyOverlay = new MapOverlay(); MyOverlay.Content = MyGrid; MyOverlay.GeoCoordinate = new GeoCoordinate(p.Latitude, p.Longitude); MyOverlay.PositionOrigin = new Point(0, 0.5); //Creating a MapLayer and adding the MapOverlay to it MapLayer MyLayer = new MapLayer(); MyLayer.Add(MyOverlay); mapWithMyLocation.Layers.Add(MyLayer); } }
public Town(int id, int playerId, string name, NVector pos) { this.id = id; this.playerId = playerId; this.name = name; this.pos = pos.Clone(); level = 1; overlay = new MapOverlay(); res = new Dictionary <string, double>(); res[C.Worker] = 0; res[C.Inhabitant] = 0; resStatistic = new RoundResStatistic(); resStatistic.NextRound(); modi = new Dictionary <string, string>(); info = new TownInfoMgmt(); info.town = this; //todo add dynamic if (L.b.gameOptions["usageTown"].Bool()) { modi["produce"] = "125%"; } }
public void mainWindow(int windowid) { GUILayout.BeginVertical(); if (GUILayout.Button("Overlay")) { showOverlayWindow = !showOverlayWindow; } GUILayout.Space(1); GUILayout.Space(1); if (MapOverlay.getHoverCell().HasValue) { Cell cell = MapOverlay.getHoverCell().Value; GUILayout.Label("Temperature: " + WeatherFunctions.GetCellTemperature(PD.index, currentLayer, cell) + " °K"); GUILayout.Label("Pressure: " + WeatherFunctions.GetCellPressure(PD.index, currentLayer, cell) + " Pa"); GUILayout.Label("Rel Humidity: " + WeatherFunctions.GetCellRH(PD.index, currentLayer, cell) * 100 + " %"); GUILayout.Label("Air Density: " + String.Format("{0:0.000000}", WeatherFunctions.D_Wet(PD.index, cell, WeatherFunctions.GetCellAltitude(PD.index, currentLayer, cell))) + " Kg/m³"); GUILayout.Label("wind horz: " + String.Format("{0:0.0000}", WeatherFunctions.GetCellwindH(PD.index, currentLayer, cell)) + " m/s"); GUILayout.Label("wind Dir : " + String.Format("{0:000.0}", WeatherFunctions.GetCellwindDir(PD.index, currentLayer, cell)) + " °"); GUILayout.Label("wind vert : " + String.Format("{0:+0.00000;-0.00000}", WeatherFunctions.GetCellwindV(PD.index, currentLayer, cell)) + " m/s"); GUILayout.Label("CCN : " + WeatherFunctions.GetCellCCN(PD.index, currentLayer, cell) * 100 + " %"); GUILayout.Label("Cloud water : " + WeatherFunctions.GetCellWaterContent(PD.index, currentLayer, cell) + " Kg/m³"); int Iced = Math.Sign(WeatherFunctions.GetCelldropletSize(PD.index, currentLayer, cell)); GUILayout.Label("droplet Size: " + Math.Abs(WeatherFunctions.GetCelldropletSize(PD.index, currentLayer, cell) * 1000.0f) + " mm"); GUILayout.Label("cloud thickness: " + WeatherFunctions.GetCellthickness(PD.index, currentLayer, cell) + " m " + (Iced < 0 ? "Iced" : Iced > 0 ? "Liqd" : "None")); GUILayout.Label("rain duration: " + WeatherFunctions.GetCellrainDuration(PD.index, currentLayer, cell) + " cycles"); GUILayout.Label("rain decay: " + WeatherFunctions.GetCellrainDecay(PD.index, currentLayer, cell) / 256.0f); } GUILayout.EndVertical(); GUI.DragWindow(); }
/// <summary> /// Adds an overlay to display on top of the map. /// Has no effect if the overlay is already being displayed. /// </summary> /// <param name="overlay">Overlay to display.</param> public void AddOverlay(MapOverlay overlay) { if (!overlays.Contains(overlay)) { overlays.Add(overlay); } }
private async void ShowMyLocationOnTheMap() { Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate); this.BettingMap.Center = myGeoCoordinate; this.BettingMap.ZoomLevel = 15; Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = myGeoCoordinate; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); BettingMap.Layers.Add(myLocationLayer); }
public ComoLlegar() { InitializeComponent(); var markerLayer = new MapLayer(); var posicion = new GeoCoordinate(-34.5584560886206, -58.4167098999023); var pushpin = new MapOverlay() { GeoCoordinate = posicion, }; markerLayer.Add(pushpin); Mapa.Layers.Add(markerLayer); Mapa.Center = posicion; Mapa.ZoomLevel = 14; if (App.Configuration.IsLocationEnabled && PositionService.GetCurrentLocation().Location != null) { pushpin = new MapOverlay { GeoCoordinate = PositionService.GetCurrentLocation().Location, ContentTemplate = App.Current.Resources["locationPushpinTemplate"] as DataTemplate, }; markerLayer.Add(pushpin); Mapa.SetView(Mapa.CreateBoundingRectangle()); } }
public void BufferFlip(PlanetData PD) { Logger("BufferFlip! cycle = " + CellUpdater.run); List <KWSCellMap <WeatherCell> > temp = PD.LiveMap; PD.LiveMap = PD.BufferMap; PD.BufferMap = temp; KWSCellMap <SoilCell> temp1 = PD.LiveSoilMap; PD.LiveSoilMap = PD.BufferSoilMap; PD.BufferSoilMap = temp1; List <KWSCellMap <WeatherCell> > temp2 = PD.LiveStratoMap; PD.LiveStratoMap = PD.BufferStratoMap; PD.BufferStratoMap = temp2; PD.updateTime = currentTime; //update the update time WeatherDatabase.PlanetaryData[PD.index] = PD; CellUpdater.run++; currentTime = 0; MapOverlay.refreshCellColours(); //if(CellUpdater.run % 50 == 0) WeatherDatabase.SavePlanetaryData(cellindex, HighLogic.SaveFolder); }
private async void txtboxEnd_KeyDown(object sender, KeyEventArgs e) { if (e.Key.Equals(Key.Enter)) { Task <string> returnString = Request.RequestToBingMap.sendGeoCodingRequest(txtboxEnd.Text.Trim()); //handle json return to get lat & long JObject jsonObject = JObject.Parse(await returnString); string xlong = jsonObject.SelectToken("resourceSets[0].resources[0].point.coordinates[1]").ToString().Trim(); string xlat = jsonObject.SelectToken("resourceSets[0].resources[0].point.coordinates[0]").ToString().Trim(); //set marker again if (endPointOverlay != null) { myLocationLayer.Remove(endPointOverlay); } //dat pushpin endPointOverlay = MarkerDraw.DrawMapMarker(new GeoCoordinate(Convert.ToDouble(xlat), Convert.ToDouble(xlong))); // Create a MapLayer to contain the MapOverlay. myLocationLayer.Add(endPointOverlay); // Add the MapLayer to the Map. mapPostItinerary.Layers.Remove(myLocationLayer); mapPostItinerary.Layers.Add(myLocationLayer); this.Focus(); } }
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { var rootObject = JsonConvert.DeserializeObject<Rootobject>(e.Result); double lat, longitude; MapPolyline line = new MapPolyline(); line.StrokeColor = Colors.Green; line.StrokeThickness = 2; double[] coord = new double[2 * rootObject.direction[0].stop.Length]; for (int i = 0; i < rootObject.direction[0].stop.Length; i++) { lat = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lat); longitude = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lon); line.Path.Add(new GeoCoordinate(lat, longitude)); Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Green); myCircle.Height = 15; myCircle.Width = 15; myCircle.Opacity = 60; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = new GeoCoordinate(lat, longitude, 200); MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); map.Layers.Add(myLocationLayer); } map.MapElements.Add(line); }
void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { var rootObject = JsonConvert.DeserializeObject <Rootobject>(e.Result); double lat, longitude; MapPolyline line = new MapPolyline(); line.StrokeColor = Colors.Red; line.StrokeThickness = 2; double[] coord = new double[2 * rootObject.direction[0].stop.Length]; for (int i = 0; i < rootObject.direction[0].stop.Length; i++) { lat = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lat); longitude = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lon); line.Path.Add(new GeoCoordinate(lat, longitude)); Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 10; myCircle.Width = 10; myCircle.Opacity = 60; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = new GeoCoordinate(lat, longitude, 200); MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); map.Layers.Add(myLocationLayer); } map.MapElements.Add(line); }
private void AddPoint(Map controlMap, GeoCoordinate geo) { // With the new Map control: // Map -> MapLayer -> MapOverlay -> UIElements // - Add a MapLayer to the Map // - Add an MapOverlay to that layer // - We can add a single UIElement to that MapOverlay.Content MapLayer ml = new MapLayer(); MapOverlay mo = new MapOverlay(); // Add an Ellipse UI Ellipse r = new Ellipse(); r.Fill = new SolidColorBrush(Color.FromArgb(255, 240, 5, 5)); // the item is placed on the map at the top left corner so // in order to center it, we change the margin to a negative // margin equal to half the width and height r.Width = r.Height = 12; r.Margin = new Thickness(-6, -6, 0, 0); // Add the Ellipse to the Content mo.Content = r; // Set the GeoCoordinate of that content mo.GeoCoordinate = geo; // Add the MapOverlay to the MapLayer ml.Add(mo); // Add the MapLayer to the Map controlMap.Layers.Add(ml); }
public void DrawPoint(Map map, GeoCoordinate position, Color color, BitmapImage picture = null, int sizeInd = 0) { var border = new Border() { CornerRadius = new CornerRadius(50), Width = 30 + sizeInd * 10, Height = 30 + sizeInd * 10, BorderThickness = new Thickness(5), BorderBrush = new SolidColorBrush(color), Background = new SolidColorBrush(color) }; if (picture != null) border.Child = new Image() { Source = picture }; var myOverlay = new MapOverlay() { Content = border, GeoCoordinate = position, PositionOrigin = new Point(0, 0.5) }; MapLayer.Add(myOverlay); if (map.Layers.Count == 0) map.Layers.Add(MapLayer); }
private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { Position item = lstPositions.Items.Last() as Position; layers = new MapLayer(); image = new BitmapImage(); image.UriSource = (new Uri(Friend.Picture, UriKind.Absolute)); grid = new Grid(); grid.DataContext = item; grid.Tap += grid_Tap; textBlock = new TextBlock(); textBlock.Text = item.Counter.ToString(); textBlock.VerticalAlignment = VerticalAlignment.Bottom; textBlock.HorizontalAlignment = HorizontalAlignment.Center; brush = new ImageBrush(); brush.ImageSource = image; ellipse = new Ellipse(); ellipse.Height = 100; ellipse.Width = 100; ellipse.Fill = brush; grid.Children.Add(ellipse); grid.Children.Add(textBlock); overlay = new MapOverlay(); overlay.GeoCoordinate = new GeoCoordinate(item.Latitude, item.Longitude); overlay.Content = grid; layers.Add(overlay); myMap.Layers.Add(layers); } }
public Pushpin(GeoPosition<GeoCoordinate> position, string type, GeoPosition<GeoCoordinate> referencePosition = null, RoutedEventHandler pushpinEvent = null) { _referencePosition = referencePosition; _pushpinEvent = pushpinEvent; _position = position; _type = type; _pushpinOverlay = GetPushpinOverlay(); }
public CustomPushPinWithToolTip(HeritageProperty item, MapOverlay overlay) { this.ParentOverlay = overlay; this.Item = item; this.Description = item.Name; InitializeComponent(); Loaded += UCCustomToolTip_Loaded; }
public detail() { InitializeComponent(); List<Stand> tab = (List<Stand>)PhoneApplicationService.Current.State["stands"]; int index = (int)PhoneApplicationService.Current.State["index"]; //MessageBox.Show(index.ToString()); Stand item = tab[index]; station_id.Text = "Station n°" + item.Id; add.Text = item.Add.ToString(); ab.Text = "Places : " + item.Ab.ToString(); ap.Text = "Velos : " + item.Ap.ToString(); ac.Text = "Capacité disponible : " + item.Ac.ToString(); tc.Text = "Capacité totale: : " + item.Tc.ToString(); GeoCoordinate loc = new GeoCoordinate(); //Location loc = new Location(); loc.Longitude = item.Lng; loc.Latitude = item.Lat; Map Carte = new Map(); Carte.Center = loc; Carte.ZoomLevel = 17.0; Pushpin pin = new Pushpin(); pin.GeoCoordinate = loc; //pin.Location = loc; ContentMap.Children.Add(Carte); ImageBrush imgBrush = new ImageBrush(); imgBrush.Stretch = System.Windows.Media.Stretch.UniformToFill; imgBrush.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"velo_bleu.png", UriKind.Relative)); Grid MyGrid = new Grid(); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.Background = new SolidColorBrush(Colors.Transparent); Rectangle MyRectangle = new Rectangle(); MyRectangle.Fill = imgBrush; MyRectangle.Height = 52; MyRectangle.Width = 85; MyRectangle.SetValue(Grid.RowProperty, 0); MyRectangle.SetValue(Grid.ColumnProperty, 0); MyGrid.Children.Add(MyRectangle); MapLayer layer = new MapLayer(); MapOverlay overlay = new MapOverlay(); overlay.GeoCoordinate = pin.GeoCoordinate; overlay.Content = MyGrid; layer.Add(overlay); //Carte.Children.Add(pin); Carte.Layers.Add(layer); }
void DrawRoute(RunData item) { JustRunDataContext db = new JustRunDataContext(JustRunDataContext.ConnectionString); GeoCoordinateCollection geoCollection = new GeoCoordinateCollection(); var geoCords = db.GeoCords.Where(p => p.No == item.No); foreach(var gc in geoCords) { GeoCoordinate _geoCord=new GeoCoordinate(); _geoCord.Longitude=gc.Longitude; _geoCord.Latitude=gc.Latitude; geoCollection.Add(_geoCord); } if (geoCollection.Count != 0) Map.Center = geoCollection[0]; else { MessageBox.Show(AppResources.NoGeoFoundMsg); NavigationService.GoBack(); return; } Map.ZoomLevel = 16; Time.Text = item.Datetime.ToShortTimeString(); Date.Text = item.Datetime.ToShortDateString(); foreach (var geoCord in geoCollection) { _line.Path.Add(geoCord); } MapOverlay myLocationOverlay = new MapOverlay(); BitmapImage tn = new BitmapImage(); tn.SetSource(Application.GetResourceStream(new Uri(@"Assets/finishflag.png", UriKind.Relative)).Stream); Image img = new Image(); img.Source = tn; img.Height = 80; img.Width = 80; myLocationOverlay.Content = img; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = geoCollection[geoCollection.Count - 1]; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); myLocationOverlay = new MapOverlay(); tn = new BitmapImage(); tn.SetSource(Application.GetResourceStream(new Uri(@"Assets/GreenBall.png", UriKind.Relative)).Stream); img = new Image(); img.Source = tn; img.Height = 25; img.Width = 25; myLocationOverlay.Content = img; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = geoCollection[0]; myLocationLayer.Add(myLocationOverlay); Map.Layers.Add(myLocationLayer); Map.Center = geoCollection[geoCollection.Count / 2]; }
private void PinCurrentPosition() { var currentPosition = new GeoCoordinate(App.ViewModel.CurrentPosition.Latitude, App.ViewModel.CurrentPosition.Longitude); marker = new UserLocationMarker() { GeoCoordinate = currentPosition }; mapOverlay = new MapOverlay() { Content = this.marker, GeoCoordinate = currentPosition }; var mapLayer = new MapLayer { this.mapOverlay }; MyMap.Layers.Add(mapLayer); }
public static NotifyCollectionChangedEventHandler SetItemsCollection(this MapLayer layer, INotifyCollectionChanged collection, DataTemplate template) { if (collection == null) return null; Action<IList> RemoveMapOverlays = (items) => { if (items == null || items.Count == 0) return; for (int i = layer.Count - 1; i >= 0; i--) if (items.Contains(layer[i].Content)) layer.RemoveAt(i); }; Action<IList> CreateMapOverlays = (items) => { if (items == null || items.Count == 0) return; foreach (var item in items) { var overlay = new MapOverlay(); var coord = item as IHasCoordinate; overlay.ContentTemplate = template; overlay.Content = item; overlay.GeoCoordinate = coord.Coordinate; overlay.PositionOrigin = new System.Windows.Point(0.5, 1); layer.Add(overlay); } }; NotifyCollectionChangedEventHandler ItemsChanged = (sender, e) => { switch (e.Action) { case System.Collections.Specialized.NotifyCollectionChangedAction.Add: CreateMapOverlays(e.NewItems); break; case System.Collections.Specialized.NotifyCollectionChangedAction.Move: break; case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: RemoveMapOverlays(e.OldItems); break; case System.Collections.Specialized.NotifyCollectionChangedAction.Replace: RemoveMapOverlays(e.OldItems); CreateMapOverlays(e.NewItems); break; case System.Collections.Specialized.NotifyCollectionChangedAction.Reset: layer.Clear(); CreateMapOverlays(collection as IList); break; default: break; } }; collection.CollectionChanged += ItemsChanged; return ItemsChanged; }
void map1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Debug.WriteLine("map_MouseLeftButtonUp " + markerSelected + ", addPoint: " + addPoint); if (addPoint) { if (markerLayer == null) // create layer if it does not exists yet { markerLayer = new MapLayer(); map1.Layers.Add(markerLayer); } MarkerCounter++; MapOverlay oneMarker = new MapOverlay(); oneMarker.GeoCoordinate = map1.ConvertViewportPointToGeoCoordinate(e.GetPosition(map1)); Ellipse Circhegraphic = new Ellipse(); Circhegraphic.Fill = new SolidColorBrush(Colors.Yellow); Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); Circhegraphic.StrokeThickness = 10; Circhegraphic.Opacity = 0.8; Circhegraphic.Height = 30; Circhegraphic.Width = 30; oneMarker.Content = Circhegraphic; oneMarker.PositionOrigin = new Point(0.5, 0.5); Circhegraphic.MouseLeftButtonDown += Circhegraphic_MouseLeftButtonDown; Circhegraphic.MouseLeftButtonUp += Circhegraphic_MouseLeftButtonUp; markerLayer.Add(oneMarker); if (dynamicPolyline == null) // create polyline if it does not exists yet { dynamicPolyline = new MapPolyline(); dynamicPolyline.StrokeColor = Color.FromArgb(0x80, 0xFF, 0x00, 0x00); dynamicPolyline.StrokeThickness = 5; dynamicPolyline.Path = new GeoCoordinateCollection() { map1.ConvertViewportPointToGeoCoordinate(e.GetPosition(map1)) }; map1.MapElements.Add(dynamicPolyline); } else // just add points to polyline here { dynamicPolyline.Path.Add(map1.ConvertViewportPointToGeoCoordinate(e.GetPosition(map1))); } } addPoint = false; markerSelected = false; }
public void ShowOnMap(double latitude, double longitude) { var geoPosition = new GeoCoordinate(latitude, longitude); myMap.SetView(geoPosition, 18, MapAnimationKind.Parabolic); mapOverlay = new MapOverlay(); userMarker = new UserLocationMarker(); mapOverlay.Content = userMarker; mapOverlay.GeoCoordinate = geoPosition; var mapLayer = new MapLayer { mapOverlay }; myMap.Layers.Add(mapLayer); }
protected void CreateNewPin(IVehicle vehicle) { var pushpin = new Pushpin(); var mapLayer = new MapLayer(); var overlay = new MapOverlay(); pushpin.DataContext = vehicle; pushpin.Content = vehicle.Name; pushpin.Tap += pushpin_tap; mapLayer.Add(overlay); overlay.GeoCoordinate = new GeoCoordinate(vehicle.X, vehicle.Y); overlay.Content = pushpin; _mapController.Layers.Add(mapLayer); }
private void AddResultToMap(String locationAddress, GeoCoordinate location) { System.Windows.Input.Touch.FrameReported += Touch_FrameReported; // set class variable this.locationAddress = locationAddress; this.locationResult = location; MapLayer oneMarkerLayer = new MapLayer(); oneMarker = new MapOverlay(); Canvas canCan = new Canvas(); TextBlock MarkerTxt = new TextBlock { Text = "Drag" }; MarkerTxt.Foreground = new SolidColorBrush(Colors.Black); MarkerTxt.HorizontalAlignment = HorizontalAlignment.Center; Canvas.SetLeft(MarkerTxt, 10); Canvas.SetTop(MarkerTxt, -20); Canvas.SetZIndex(MarkerTxt, 5); canCan.Children.Add(MarkerTxt); Uri imgUri = new Uri("/Assets/icons/pushpin.png", UriKind.RelativeOrAbsolute); BitmapImage imgSourceR = new BitmapImage(imgUri); ImageBrush imgBrush = new ImageBrush() { ImageSource = imgSourceR }; //canCan.Children.Add(imgSourceR) Image image = new Image { Height = 64, Width = 64, Source = imgSourceR }; canCan.Children.Add(image); oneMarker.Content = new Rectangle() { Fill = imgBrush, }; oneMarker.Content = canCan; oneMarker.PositionOrigin = new Point(0.5, 0.5); oneMarker.GeoCoordinate = location; MarkerTxt.MouseLeftButtonDown += marker_MouseLeftButtonDown; oneMarkerLayer.Add(oneMarker); map1.Layers.Add(oneMarkerLayer); map1.Center = oneMarker.GeoCoordinate; }
private void PinMap(GeoCoordinate geoPosition, string locationName) { MyMap.SetView(geoPosition, 16, MapAnimationKind.Parabolic); var mapOverlayPin = new MapOverlay(); var pin = new Pushpin() { Content = locationName }; mapOverlayPin.Content = pin; mapOverlayPin.GeoCoordinate = geoPosition; var mapLayer = new MapLayer { mapOverlayPin }; MyMap.Layers.Add(mapLayer); selectedCoordinate = geoPosition; }
private void MarcarPosicaoNoMapa(double latitude, double longitude, Color cor) { Ellipse marcacao = new Ellipse(); marcacao.Fill = new SolidColorBrush(cor); marcacao.Height = 10; marcacao.Width = 10; MapLayer camada = new MapLayer(); MapOverlay sobrecamada = new MapOverlay(); sobrecamada.Content = marcacao; sobrecamada.GeoCoordinate = new GeoCoordinate(latitude, longitude); camada.Add(sobrecamada); Mapa.Layers.Add(camada); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); MapLayer layer0 = new MapLayer(); Pushpin pushpin1 = new Pushpin(); pushpin1.GeoCoordinate = new GeoCoordinate(47.6097, -122.3331); MapOverlay overlay1 = new MapOverlay(); pushpin1.Content = new Ellipse { Fill = new SolidColorBrush(Colors.Red), Width = 40, Height = 40 }; layer0.Add(overlay1); myMap.Layers.Add(layer0); }
public ItineraryDetails() { InitializeComponent(); //check tinh trang hanh trinh if (GlobalData.selectedItinerary.status.Equals(null)) { } else { } MapOverlay overlay = new MapOverlay(); //set point on map //draw start poit overlay = UserControls.MarkerDraw.DrawMapMarker(new GeoCoordinate(GlobalData.selectedItinerary.start_address_lat, GlobalData.selectedItinerary.start_address_long)); wayPoints.Add(new GeoCoordinate(GlobalData.selectedItinerary.start_address_lat, GlobalData.selectedItinerary.start_address_long)); layer.Add(overlay); //draw end point overlay = UserControls.MarkerDraw.DrawMapMarker(new GeoCoordinate(GlobalData.selectedItinerary.end_address_lat, GlobalData.selectedItinerary.end_address_long)); wayPoints.Add(new GeoCoordinate(GlobalData.selectedItinerary.end_address_lat, GlobalData.selectedItinerary.end_address_long)); layer.Add(overlay); mapItineraryDetails.Layers.Add(layer); //driection routeQuery = new RouteQuery(); //GeocodeQuery Mygeocodequery = null; routeQuery.QueryCompleted += routeQuery_QueryCompleted; routeQuery.TravelMode = TravelMode.Driving; routeQuery.RouteOptimization = RouteOptimization.MinimizeDistance; routeQuery.Waypoints = wayPoints; routeQuery.QueryAsync(); //set itinerary info txtDescription.Text = GlobalData.selectedItinerary.description; txtStartAddress.Text = GlobalData.selectedItinerary.start_address; txtEndAddress.Text = GlobalData.selectedItinerary.end_address; txtCost.Text = GlobalData.selectedItinerary.cost; txtPhone.Text = GlobalData.selectedItinerary.phone; txtLeaveDay.Text = GlobalData.selectedItinerary.leave_date; txtDistance.Text = GlobalData.selectedItinerary.distance.ToString(); txtDuration.Text = GlobalData.selectedItinerary.duration.ToString(); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); Trip currentTrip = ViewModel.Trip; if (currentTrip.IsActif) EndStack.Visibility = Visibility.Collapsed; else EndStack.Visibility = Visibility.Visible; //Bind les POI a la map ObservableCollection<DependencyObject> children = MapExtensions.GetChildren(statsMap); var obj = children.FirstOrDefault(x => x.GetType() == typeof(MapItemsControl)) as MapItemsControl; if (obj.ItemsSource != null) { (obj.ItemsSource as IList).Clear(); obj.ItemsSource = null; } obj.ItemsSource = (ViewModel.PointOfInterestList); //Ajout du départ MapLayer layer1 = new MapLayer(); Pushpin pushpin1 = new Pushpin(); pushpin1.GeoCoordinate = currentTrip.CoordinateDeparture; pushpin1.Background = new SolidColorBrush(Color.FromArgb(255, 105, 105, 105)); pushpin1.Content = AppResources.AddTripDeparture; MapOverlay overlay1 = new MapOverlay(); overlay1.Content = pushpin1; overlay1.GeoCoordinate = currentTrip.CoordinateDeparture; overlay1.PositionOrigin = new Point(0, 1); layer1.Add(overlay1); statsMap.Layers.Add(layer1); //Ajout de la destination MapLayer layer2 = new MapLayer(); Pushpin pushpin2 = new Pushpin(); pushpin2.GeoCoordinate = currentTrip.CoordinateDestination; pushpin2.Content = AppResources.AddTripArrival; pushpin2.Background = new SolidColorBrush(Color.FromArgb(255, 105, 105, 105)); MapOverlay overlay2 = new MapOverlay(); overlay2.Content = pushpin2; overlay2.GeoCoordinate = currentTrip.CoordinateDestination; overlay2.PositionOrigin = new Point(0, 1); layer2.Add(overlay2); statsMap.Layers.Add(layer2); }
private void CreatePushpins() { var overlay = new MapOverlay(); overlay.GeoCoordinate = new System.Device.Location.GeoCoordinate(19.433481, -99.134065); BitmapImage bmp = new BitmapImage(new Uri("/mexico.jpg", UriKind.Relative)); overlay.Content = new Image() { Source = bmp, Width = 50 }; var overlay2 = new MapOverlay(); overlay2.GeoCoordinate = new System.Device.Location.GeoCoordinate(-12.115488, -77.044122); BitmapImage bmp2 = new BitmapImage(new Uri("/peru.jpg", UriKind.Relative)); overlay2.Content = new Image() { Source = bmp2, Width=50 }; var layer = new MapLayer(); layer.Add(overlay); layer.Add(overlay2); map.Layers.Add(layer); }