public ViewMap() { InitializeComponent(); GeoCoordinateWatcher gcw; gcw = new GeoCoordinateWatcher(GeoPositionAccuracy.High); // gcw.PositionChanged += new EventHandler( ""); gcw.Start(); GeoCoordinate co; co = gcw.Position.Location; if (thisApp.Long == -1000 && thisApp.Lat == -1000) { MessageBox.Show("Geographical coordinates have not been set yet."); } else { co = new GeoCoordinate((double)thisApp.Lat, (double)thisApp.Long); var pushPin = new Pushpin(); var location = co; PushpinLayer.AddChild(pushPin, location); } // co.Latitude = 45; // co.Longitude = 25; map1.SetView(co, 10); }
public WorkoutMapStatisticsPage() { InitializeComponent(); routeLine = new MapPolyline(); routeLine.Locations = selectedWorkout.routeLine.Locations; // Where the magic happens: Note: ALL routes MUST have a polyline, otherwise the application WILL ofcourse, CRASH! routeLine.Stroke = new SolidColorBrush(Colors.Blue); routeLine.StrokeThickness = 5; Pushpin pStart = new Pushpin(); pStart.Content = "Start"; pStart.Background = new SolidColorBrush(Colors.Green); Pushpin pFinish = new Pushpin(); pFinish.Content = "Finish"; pFinish.Background = new SolidColorBrush(Colors.Red); layer.AddChild(pStart, new GeoCoordinate(routeLine.Locations.First().Latitude, routeLine.Locations.First().Longitude)); layer.AddChild(pFinish, new GeoCoordinate(routeLine.Locations.Last().Latitude, routeLine.Locations.Last().Longitude)); map2.Children.Add(routeLine); map2.Children.Add(layer); textBlock5.Text = selectedWorkout.workoutName; textBlock6.Text = selectedWorkout.startTime; textBlock7.Text = String.Format("{0:F2}", selectedWorkout.distanceRan); textBlock8.Text = string.Format("{0:00}:{1:00}:{2:00}", selectedWorkout.elapsedTimeTS.Hours, selectedWorkout.elapsedTimeTS.Minutes, selectedWorkout.elapsedTimeTS.Seconds); ; double latitude; double longitude; getWorkoutRouteLocation(out latitude, out longitude); map2.Center = new GeoCoordinate(latitude, longitude); map2.ZoomLevel = 16; }
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { if (e.Position.Location.IsUnknown) { MessageBox.Show("Please wait while your prosition is determined...."); return; } this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude); if (this.map.Children.Count != 0) { var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin")); if (pushpin != null) { this.map.Children.Remove(pushpin); } } Pushpin locationPushpin = new Pushpin(); locationPushpin.Background = new SolidColorBrush(Colors.Purple); locationPushpin.Content = "You are here"; locationPushpin.Tag = "locationPushpin"; locationPushpin.Location = watcher.Position.Location; this.map.Children.Add(locationPushpin); this.map.SetView(watcher.Position.Location, 10.0); locationPushpin.Location = new GeoCoordinate(8.570515, 8.308844); }
void Tick(object sender, EventArgs e) { try { var response = new WebClient(); response.DownloadStringCompleted += (s, ea) => { JObject parsejson = JObject.Parse(ea.Result); double lat = double.Parse( parsejson["latitude"]["DMS"]["value"].ToString()); double lon = double.Parse( parsejson["longitude"]["DMS"]["value"].ToString()); // double lat = 35.88923; // double lon = 14.51721; map.Center.Latitude = lat; map.Center.Longitude = lon; Pushpin mypin = new Pushpin(); mypin.Location = new GeoCoordinate(lat,lon); map.Children.Add(mypin); }; response.DownloadStringAsync(new Uri(ip + "gps/coordinates")); } catch (Exception ex) { System.Windows.MessageBox.Show("Connection error. Please try again. " + ex.Message); } }
/// <summary> /// Gets the visual representation of the contents of this container. If it is /// a single pushpin, the pushpin itself is returned. If multiple pushpins are present /// a pushpin with the given clusterTemplate is returned. /// </summary> public FrameworkElement GetElement(DataTemplate clusterTemplate) { if (_pushpins.Count == 1) { return _pushpins[0]; } else { Pushpin retPin = new Pushpin() { Location = _pushpins.First().Location, Content = _pushpins.Select(pin => pin.DataContext).ToList(), ContentTemplate = clusterTemplate, Background = new SolidColorBrush((Color)Application.Current.Resources["PhoneAccentColor"]) }; retPin.MouseLeftButtonUp += new MouseButtonEventHandler( (object sender, MouseButtonEventArgs e) => { _map.Center = retPin.Location; _map.ZoomLevel = _map.ZoomLevel + 3; }); return retPin; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { SystemTray.IsVisible = true; _centerId = NavigationContext.QueryString["CenterId"]; _centerName = NavigationContext.QueryString["CenterName"]; pivot.Title = _centerName; try { txtNoPacients.Visibility = Visibility.Collapsed; txtNoNeeds.Visibility = Visibility.Collapsed; _center = (await Service.GetTable<Center>() .Where(t => t.Id == _centerId).ToListAsync()).FirstOrDefault(); if (e.NavigationMode == NavigationMode.New) { var isAttending = (await Service.GetTable<DisasterAttend>() .Where(t => t.DisasterId == _center.DisasterId && t.ParticipantId == App.User.Id) .ToListAsync()).FirstOrDefault(); if (App.User.Type == UserType.Medic && isAttending != null) { var button = new ApplicationBarIconButton { IconUri = new Uri("/Assets/AppBar/add.png", UriKind.RelativeOrAbsolute), IsEnabled = true, Text = "add patient" }; button.Click += AddPatient_Click; ApplicationBar.Buttons.Add(button); } } var pin = new Pushpin() { Location = new GeoCoordinate(_center.Latitude, _center.Longitude), Content = _centerName, }; map.Children.Add(pin); map.Center = new GeoCoordinate(_center.Latitude, _center.Longitude); var patients = await Service.GetTable<Pacient>().Where(t => t.CenterId == _centerId).ToListAsync(); if (patients.Count == 0) txtNoPacients.Visibility = Visibility.Visible; else lstPacients.ItemsSource = patients; var needs = await Service.GetTable<Needs>().Where(t => t.CenterId == _centerId).ToListAsync(); if (needs.Count == 0) txtNoNeeds.Visibility = Visibility.Visible; else lstNeeds.ItemsSource = needs; } catch (Exception ex) { MessageBox.Show("Something went wrong!"); } }
void drawConcertToMap() { map1.Children.Clear(); //map1.Mode = new AerialMode(); Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate(Double.Parse(concert.Latitude, CultureInfo.InvariantCulture), Double.Parse(concert.Longitude, CultureInfo.InvariantCulture)); pin.MouseLeftButtonUp += new MouseButtonEventHandler(pinMouseLeftButtonUp); pin.Template = (ControlTemplate)this.Resources["PinTemplate"]; pin.Name = concert.Title; map1.Children.Add(pin); //Se hace un setView para encuadrar el Mapa. Para esto, se ponen todos los puntos en un IEnumerable y el sistema hace el encuadre solo List<GeoCoordinate> l = new List<GeoCoordinate>(); foreach (Pushpin p in map1.Children) { l.Add(p.Location); } loc = l; map1.SetView(LocationRect.CreateLocationRect(loc)); map1.ZoomLevel = 15; }
void JobMapView_Loaded(object sender, RoutedEventArgs e) { mapJobLocation.CredentialsProvider = new ApplicationIdCredentialsProvider(AppResources.BingMapsApiKey); // Set the center coordinate and zoom level GeoCoordinate mapCenter = new GeoCoordinate(App.JobVM.JobInfo.LocationLatitude, App.JobVM.JobInfo.LocationLongitude); int zoom = 15; // Create a pushpin to put at the center of the view Pushpin pin1 = new Pushpin(); pin1.Location = mapCenter; pin1.Style = (Style)App.Current.Resources["PushpinStyle"]; TextBlock pinContent = new TextBlock { Text = App.JobVM.JobInfo.Ranking.ToString(), FontSize = 18.667, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Style = (Style)App.Current.Resources["PhoneTextYellowStyle"] }; pin1.Content = pinContent; mapJobLocation.Children.Add(pin1); // Set the map style to Aerial mapJobLocation.Mode = new RoadMode(); isRoadMode = true; // Set the view and put the map on the page mapJobLocation.SetView(mapCenter, zoom); }
public SelectDestination() { InitializeComponent(); street.Visibility = Visibility.Visible; (ApplicationBar.Buttons[1] as ApplicationBarIconButton).IsEnabled = true; GeoCoordinate geo = new GeoCoordinate(); geo = MainPage.bookingData.current_location; googlemap.Center = geo; googlemap.ZoomLevel = 16; zzoom.IsEnabled = true; positionLoaded = true; Microsoft.Phone.Controls.Maps.Pushpin new_pushpin = new Microsoft.Phone.Controls.Maps.Pushpin(); new_pushpin.Location = geo; pushPinCurrentLocation = new MapLayer(); new_pushpin.Content = "Current Location:\n "; new_pushpin.Content += MainPage.bookingData.current_location_address; new_pushpin.Visibility = Visibility.Visible; googlemap.Children.Add(pushPinCurrentLocation); pushPinCurrentLocation.AddChild(new_pushpin, geo, PositionOrigin.BottomLeft); if (MainPage.bookingData.isDesSet == true) { AddressMapping(); } }
public MapCalls() { this.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentUICulture.Name); InitializeComponent(); ((MapCallsViewModel)DataContext).StartLocationService(); var bw = new BackgroundWorker(); bw.RunWorkerCompleted += (o, e) => { _rvList = ReturnVisitsInterface.GetReturnVisits(SortOrder.DateNewestToOldest, -1); for (_index = 0; _index < _rvList.Length; _index++) { if (_rvList[_index].Latitude == 0 || _rvList[_index].Longitude == 0){ MakeGeocodeRequest(GetGeocodeAddress(_rvList[_index])); break; } var p = new Pushpin { Location = new Location { Longitude = _rvList[_index].Longitude, Latitude = _rvList[_index].Latitude }, Content = _rvList[_index] }; p.DoubleTap += POnDoubleTap; mRvMaps.Children.Add(p); } }; bw.RunWorkerAsync(); }
private void setupMap() { if (App.ViewModel.Settings.Locations.Count > 0) { //set the Bing maps key map.CredentialsProvider = new ApplicationIdCredentialsProvider(App.ViewModel.Settings.BingMapsKey); // Set the center coordinate and zoom level GeoCoordinate mapCenter = new GeoCoordinate(App.ViewModel.Settings.Locations[0].Latitude, App.ViewModel.Settings.Locations[0].Longitude); int zoom = 15; // create a pushpins for each location Pushpin pin = null; for (int i = 0; i < App.ViewModel.Settings.Locations.Count; i++) { pin = new Pushpin(); pin.Location = new GeoCoordinate(App.ViewModel.Settings.Locations[i].Latitude, App.ViewModel.Settings.Locations[i].Longitude); pin.Content = App.ViewModel.Settings.Locations[i].Title; map.Children.Add(pin); } // Set the map style to Aerial map.Mode = new RoadMode(); // Set the view and put the map on the page map.SetView(mapCenter, zoom); } else { //notify user } }
// Constructor public MainPage() { InitializeComponent(); bikePaths = new BikePaths(); trees = Tree.ParseCsv(); map = new Map(); map.CredentialsProvider = new ApplicationIdCredentialsProvider("Atvj6eBBbDS6-dL7shp9KmzY-0v0NL2ETYCFoHIDzQwK8_9bJ2ZdRgeMAj0sDs_F"); // Set the center coordinate and zoom level GeoCoordinate mapCenter = new GeoCoordinate(45.504693, -73.576494); int zoom = 14; // Create a pushpin to put at the center of the view Pushpin pin1 = new Pushpin(); pin1.Location = mapCenter; pin1.Content = "McGill University"; map.Children.Add(pin1); bikePaths.AddPathsToMap(map); // Set the map style to Aerial map.Mode = new Microsoft.Phone.Controls.Maps.AerialMode(); // Set the view and put the map on the page map.SetView(mapCenter, zoom); ContentPanel.Children.Add(map); }
/// <summary> /// Gets the visual representation of the contents of this container. If it is /// a single pushpin, the pushpin itself is returned. If multiple pushpins are present /// a pushpin with the given clusterTemplate is returned. /// </summary> public FrameworkElement GetElement(DataTemplate clusterTemplate) { if (_pushpins.Count == 1) { return _pushpins[0]; } else { Pushpin pp = new Pushpin() { Location = _pushpins.First().Location, Content = /*_pushpins.Select(pin => pin.DataContext).Count().ToString()*/_pushpins.Count.ToString(), ContentTemplate = clusterTemplate, Tag = _pushpins, Background = new SolidColorBrush(Colors.Red) }; pp.MouseLeftButtonUp += (s, e) => { Pushpin p = (Pushpin)s; List<Pushpin> lp = (List<Pushpin>)p.Tag; MessageBox.Show(lp.Count().ToString()); }; return pp; } }
/// <summary> /// Constructor /// </summary> public Map() { InitializeComponent(); // Make sure that data context is loaded if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } // Set the data context DataContext = App.ViewModel; // Set up map view & map pushpin #if WP8 MapView = new Microsoft.Phone.Maps.Controls.Map(); MapPushpin = new Microsoft.Phone.Maps.Toolkit.Pushpin(); MapPushpin.Name = "MapPushpin"; MapPushpin.GeoCoordinate = App.ViewModel.Restaurant.Location; ObservableCollection <DependencyObject> children = MapExtensions.GetChildren(MapView); children.Add(MapPushpin); MapExtensionsSetup(MapView); #else MapView = new Microsoft.Phone.Controls.Maps.Map(); MapView.ZoomBarVisibility = Visibility.Visible; MapPushpin = new Microsoft.Phone.Controls.Maps.Pushpin(); MapPushpin.Location = App.ViewModel.Restaurant.Location; MapView.Children.Add(MapPushpin); #endif MapView.ZoomLevel = 12; MapView.Center = App.ViewModel.Restaurant.Location; ContentPanel.Children.Add(MapView); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string stopCoords = ""; if (NavigationContext.QueryString.TryGetValue("stopCoords", out stopCoords)) { coordsArray = stopCoords.Split(new Char[] { '|' }); System.Diagnostics.Debug.WriteLine("stopCoords:" + stopCoords); } for (int i = 0; i < coordsArray.Length; i++) { String coordStr = coordsArray[i]; String[] coordTempArray = coordStr.Split(','); System.Diagnostics.Debug.WriteLine("coordStr:" + coordStr + "," + coordTempArray[0] + "," + coordTempArray[1]); Pushpin p = new Pushpin(); p.Template = this.Resources["pinStop"] as ControlTemplate; p.Location = new GeoCoordinate(Convert.ToDouble(coordTempArray[1]), Convert.ToDouble(coordTempArray[0])); mapControl.Items.Add(p); //set the first one as the center if (i == coordsArray.Length/2) { map1.SetView(p.Location, 13.0); } } }
protected override void OnNavigatedTo(NavigationEventArgs e) { this.RestoreState(); string meetingIdToLoad = "0"; if (NavigationContext.QueryString.TryGetValue("MeetingId", out meetingIdToLoad)) { var foundMeeting = App.ViewModel.UpcomingMeetings.FirstOrDefault(m => m.MeetingId == int.Parse(meetingIdToLoad)) ?? App.ViewModel.PastMeetings.FirstOrDefault(m => m.MeetingId == int.Parse(meetingIdToLoad)); if (foundMeeting != null) { DataContext = foundMeeting; //LocationMap.ZoomBarVisibility = Visibility.Visible; LocationMap.Center = new GeoCoordinate(Convert.ToDouble(33.65467), Convert.ToDouble(-112.17849)); LocationMap.ZoomLevel = 11.00; var pin1 = new Pushpin { Location = LocationMap.Center, Content= "Foothills Rec Center", }; LocationMap.Children.Add(pin1); } } }
private void OnLoadJobComplete(bool payload) { if (payload) { BuildAppBar(); // Set the center coordinate and zoom level GeoCoordinate mapCenter = new GeoCoordinate(App.JobVM.JobInfo.LocationLatitude, App.JobVM.JobInfo.LocationLongitude); int zoom = 15; // Create a pushpin to put at the center of the view Pushpin pin1 = new Pushpin(); pin1.Location = mapCenter; pin1.Style = (Style)App.Current.Resources["PushpinStyle"]; TextBlock pinContent = new TextBlock { Text = App.JobVM.JobInfo.Ranking.ToString(), FontSize = 18.667, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; pin1.Content = pinContent; mapJobLocation.Children.Add(pin1); // Set the map style to Aerial mapJobLocation.Mode = new Microsoft.Phone.Controls.Maps.RoadMode(); // Set the view and put the map on the page mapJobLocation.SetView(mapCenter, zoom); //Show or hide application app bar btn //appBarApply.IsEnabled = !String.IsNullOrWhiteSpace(App.JobVM.JobInfo.ApplyURL); } }
public void Pushpins(Collection<Marker> markers) { Deployment.Current.Dispatcher.BeginInvoke(() => { //this.pushpinCollection.Clear(); Style style = this.Resources["PushpinMarkerStyle"] as Style; //foreach (var item in this.googlemap.Children) //{ // if (item is Pushpin) // { // this.googlemap.Children.Remove(item); // } //} foreach (Marker item in markers) { Pushpin locationPushpin = new Pushpin(); locationPushpin.Background = new SolidColorBrush(Colors.Gray); locationPushpin.Content = Math.Round(item.db); locationPushpin.Location = new GeoCoordinate(item.lat, item.lng); this.googlemap.Children.Add(locationPushpin); //locationPushpin.Style = style; //PushpinModel model = new PushpinModel(); //model.Content = Math.Round(item.db).ToString(); //model.Location = new GeoCoordinate(item.lat, item.lng); //this.pushpinCollection.Add(model); } //this.pushpins.DataContext = this.pushpinCollection; }); }
//Función para abrir el detalle de una oficina //void showOfficeInfo(office o) //{ // (App.Current as App).selectedOffice = o; // NavigationService.Navigate(new Uri("/officeDetails.xaml", UriKind.Relative)); /*officeDetails root = Application.Current.RootVisual as officeDetails; root.o = o;*/ //MessageBox.Show(o.nombre); //} //Dibujamos las oficinas descargadas en el Mapa (y el punto donde nos encontramos void draw_ClockToMap() { map1.Children.Clear(); //map1.Mode = new AerialMode(); Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate(clock.Lat, clock.Lng); pin.MouseLeftButtonUp += new MouseButtonEventHandler(pin1_MouseLeftButtonUp); pin.Template = (ControlTemplate)this.Resources["PushpinClock"]; pin.Name = clock.City; map1.Children.Add(pin); //Se hace un setView para encuadrar el Mapa. Para esto, se ponen todos los puntos en un IEnumerable y el sistema hace el encuadre solo List<GeoCoordinate> l = new List<GeoCoordinate>(); foreach (Pushpin p in map1.Children) { l.Add(p.Location); } loc = l; map1.SetView(LocationRect.CreateLocationRect(loc)); map1.ZoomLevel = 8; }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string fromToAddress = ""; //var fromToAddress = NavigationContext.QueryString["fromToAddress"]; if (NavigationContext.QueryString.TryGetValue("fromToAddress", out fromToAddress)) { addressArray = fromToAddress.Split(new Char[] {'|'}); fromToListBox.ItemsSource = addressArray; System.Diagnostics.Debug.WriteLine("fromToAddress:" + fromToAddress); } string fromToCoords = ""; if (NavigationContext.QueryString.TryGetValue("fromToCoords", out fromToCoords)) { coordsArray = fromToCoords.Split(new Char[] { '|' }); System.Diagnostics.Debug.WriteLine("fromToCoords:" + fromToCoords); } string latitude = ""; if (NavigationContext.QueryString.TryGetValue("latitude", out latitude)) { } string longitude = ""; if (NavigationContext.QueryString.TryGetValue("longitude", out longitude)) { System.Diagnostics.Debug.WriteLine("latitude:" + latitude + ",longitude:" + longitude); Pushpin p = new Pushpin(); p.Template = this.Resources["pinMyLoc"] as ControlTemplate; p.Location = new GeoCoordinate(Convert.ToDouble(latitude), Convert.ToDouble(longitude)); mapControl.Items.Add(p); } for (int i = 0; i < coordsArray.Length; i++) { String coordStr = coordsArray[i]; String [] coordTempArray = coordStr.Split(','); System.Diagnostics.Debug.WriteLine("coordStr:" + coordStr + "," + coordTempArray[0] + "," + coordTempArray[1]); Pushpin p = new Pushpin(); p.Template = this.Resources["pinStop"] as ControlTemplate; p.Location = new GeoCoordinate(Convert.ToDouble(coordTempArray[1]), Convert.ToDouble(coordTempArray[0])); mapControl.Items.Add(p); //set the first one as the center if (i == 0) { map1.SetView(p.Location, 14.0); } } }
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { if (e.Position.Location.IsUnknown) { MessageBox.Show("Please wait while your prosition is determined...."); return; } this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude); if (this.map.Children.Count != 0) { var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin")); if (pushpin != null) { this.map.Children.Remove(pushpin); } } Pushpin locationPushpin = new Pushpin(); locationPushpin.Background = new SolidColorBrush(Colors.Purple); locationPushpin.Content = "You are here"; locationPushpin.Tag = "locationPushpin"; locationPushpin.Location = watcher.Position.Location; this.map.Children.Add(locationPushpin); this.map.SetView(watcher.Position.Location, 10.0); Pushpin hospitalPushpin = new Pushpin(); Pushpin hospital_Pushpin = new Pushpin(); Pushpin hospital__Pushpin = new Pushpin(); //hospitalPushpin.Location = watcher.Position.Location; String phoneNo = "07069779250"; hospitalPushpin.Content = "Bingham University Clinic"+"\n"+phoneNo; hospitalPushpin.Location = new GeoCoordinate(8.957914, 7.699131); //hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]); hospitalPushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp); this.map.Children.Add(hospitalPushpin); String phone_No = "08139698896"; hospital_Pushpin.Content = "General Hospital Wuse" + "\n" + phone_No; hospital_Pushpin.Location = new GeoCoordinate(9.062964, 7.469072); //hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]); hospital_Pushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp); this.map.Children.Add(hospital_Pushpin); String phone__No = "08139698896"; hospital__Pushpin.Content = "General Hospital Karu" + "\n" + phone__No; hospital__Pushpin.Location = new GeoCoordinate(9.026158, 7.61304); //hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]); hospital__Pushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp); this.map.Children.Add(hospital__Pushpin); }
private void LocationServiceValueCallback(GeoPositionChangedEventArgs<GeoCoordinate> value) { MapDemo.Children.Clear(); MapDemo.Center = new GeoCoordinate(value.Position.Location.Latitude, value.Position.Location.Longitude); Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate(value.Position.Location.Latitude, value.Position.Location.Longitude); MapDemo.Children.Add(pin); }
Pushpin addLocationPin(double? latitude, double? longitude, object content) { Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate((double)latitude, (double)longitude); pin.Content = content; map1.Children.Add(pin); return pin; }
public PoiPushpin(PointOfInterest poi) { Pushpin = new Microsoft.Phone.Controls.Maps.Pushpin(); PointOfInterest = poi; Comments = new ObservableCollection<Comment>(); Tags = new ObservableCollection<string>(); }
public Pushpin Create(ImageBrush imageBrush, GeoCoordinate geoCoordinate) { var pushpin = new Pushpin { Location = geoCoordinate, Content = new Image {Source = imageBrush.ImageSource, Stretch = Stretch.UniformToFill, Height = 75, Width = 75}, }; return pushpin; }
private void addPin_click(object sender, EventArgs e) { Pushpin p = new Pushpin(); p.Background = new SolidColorBrush(Colors.Blue); p.Foreground = new SolidColorBrush(Colors.White); p.Location = new GeoCoordinate(SharedInformation.pinLat, SharedInformation.pinLong); p.Content = SharedInformation.pinContent; map1.Children.Add(p); }
private async void AddressMapping() { googlemap.Children.Remove(pushPinLayer); pushPinLayer = new MapLayer(); try { GeoCoordinate geo = new GeoCoordinate(MainPage.bookingData.lat, MainPage.bookingData.lng); Microsoft.Phone.Controls.Maps.Pushpin new_pushpin = new Microsoft.Phone.Controls.Maps.Pushpin(); new_pushpin.Location = geo; googlemap.Center = geo; string url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + geo.Latitude + "," + geo.Longitude + "&sensor=true"; var client = new WebClient(); string response = await client.DownloadStringTaskAsync(new Uri(url)); JObject root = JObject.Parse(response); JArray items = (JArray)root["results"]; JObject item; JToken jtoken; item = (JObject)items[0]; JArray add_comp = (JArray)item["address_components"]; string address = null; string[] add_types = { "street_number", "route", "neighborhood", "locality", "city", "country" }; foreach (var comp in add_comp) { if (add_types.Any(comp["types"].ToString().Contains)) { address += comp["long_name"].ToString() + ", "; if (comp["types"].ToString().Contains("city") | comp["types"].ToString().Contains("country")) { address += "\n"; } } } (ApplicationBar.Buttons[0] as ApplicationBarIconButton).IsEnabled = true; (ApplicationBar.Buttons[2] as ApplicationBarIconButton).IsEnabled = true; new_pushpin.Content = "Destination Location:\n" + address; Address.Text = address; new_pushpin.Visibility = Visibility.Visible; googlemap.Children.Add(pushPinLayer); pushPinLayer.AddChild(new_pushpin, geo, PositionOrigin.BottomLeft); MainPage.bookingData.set_destination_attributes(address, geo); LatitudeTextBlock.Text = "Latitude: " + geo.Latitude.ToString("0.00"); //geoposition.Coordinate.Latitude.ToString("0.00"); // LongitudeTextBlock.Text = "Longitude: " + geo.Longitude.ToString("0.00");//geoposition.Coordinate.Longitude.ToString("0.00"); // } catch (Exception ed) { MessageBox.Show(ed.ToString()); } }
private void locateMe_click(object sender, EventArgs e) { Pushpin p = new Pushpin(); p.Background = new SolidColorBrush(Colors.Yellow); p.Foreground = new SolidColorBrush(Colors.Black); p.Location = new GeoCoordinate(SharedInformation.myLatitude, SharedInformation.myLongitude); p.Content = "I'm here"; map1.Children.Add(p); map1.SetView(new GeoCoordinate(SharedInformation.myLatitude, SharedInformation.myLongitude, 160), 2); }
void AEDFinderService_GetAllAEDsCompleted(object sender, AEDFinderServiceReference.GetAllAEDsCompletedEventArgs e) { ObservableCollection<AEDFinderServiceReference.aed> aedList = e.Result; foreach (AEDFinderServiceReference.aed aed in aedList) { Pushpin pin = new Pushpin(); pin.Location = new GeoCoordinate((double)aed.lat, (double)aed.@long); map1.Children.Add(pin); } }
public Map() { InitializeComponent(); loc = new List<Stations>(); localPushpins = new List<Pushpin>(); myPushpin = new Pushpin(); final = new Pushpin(); myRouteLayer = new MapLayer(); wc = new WebClient(); watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); }
void g_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { //hrow new NotImplementedException(); textBlock1.Text = e.Position.Location.Latitude.ToString(); map1.Center = e.Position.Location; Pushpin p = new Pushpin(); p.Location = e.Position.Location; map1.Children.Add(p); }
public SuggestionPage() { InitializeComponent(); RunExampleQueries(); watcher = new GeoCoordinate(SearchLatitude, SearchLongitude); this.map.Center = new GeoCoordinate(SearchLatitude, SearchLongitude); Microsoft.Phone.Controls.Maps.Pushpin locationPushpin = new Microsoft.Phone.Controls.Maps.Pushpin(); locationPushpin.Tag = "locationPushpin"; locationPushpin.Location = watcher; locationPushpin.Content = "Me"; this.map.Children.Add(locationPushpin); this.map.SetView(watcher, 18.0); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/GPS;component/AddressPlotting.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.bingMap = ((Microsoft.Phone.Controls.Maps.Map)(this.FindName("bingMap"))); this.bingMapLocator = ((Microsoft.Phone.Controls.Maps.Pushpin)(this.FindName("bingMapLocator"))); this.locator = ((System.Windows.Shapes.Ellipse)(this.FindName("locator"))); this.GetAddress = ((System.Windows.Controls.Button)(this.FindName("GetAddress"))); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/BingMapDemo;component/MainPage.xaml", System.UriKind.Relative)); this.BlinkLocator = ((System.Windows.Media.Animation.Storyboard)(this.FindName("BlinkLocator"))); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.bingMap = ((Microsoft.Phone.Controls.Maps.Map)(this.FindName("bingMap"))); this.bingMapLocator = ((Microsoft.Phone.Controls.Maps.Pushpin)(this.FindName("bingMapLocator"))); this.locator = ((System.Windows.Shapes.Ellipse)(this.FindName("locator"))); this.Start = ((System.Windows.Controls.Button)(this.FindName("Start"))); this.txtStatus = ((System.Windows.Controls.TextBox)(this.FindName("txtStatus"))); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/TakeMeThere;component/MapPage_gMap.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.MyMap = ((Microsoft.Phone.Controls.Maps.Map)(this.FindName("MyMap"))); this.MapTileLayer_gMap = ((Microsoft.Phone.Controls.Maps.MapTileLayer)(this.FindName("MapTileLayer_gMap"))); this.CurrentMark = ((Microsoft.Phone.Controls.Maps.Pushpin)(this.FindName("CurrentMark"))); this.CurrentMarkRotate = ((System.Windows.Media.RotateTransform)(this.FindName("CurrentMarkRotate"))); this.MapItemsControl_PushPins = ((Microsoft.Phone.Controls.Maps.MapItemsControl)(this.FindName("MapItemsControl_PushPins"))); this.Grid_GPSStatus = ((System.Windows.Controls.Grid)(this.FindName("Grid_GPSStatus"))); this.TextBlock_GPSStatus = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_GPSStatus"))); this.Grid_SearchBox = ((System.Windows.Controls.Grid)(this.FindName("Grid_SearchBox"))); this.TextBox_SearchBox = ((System.Windows.Controls.TextBox)(this.FindName("TextBox_SearchBox"))); this.Grid_Search = ((System.Windows.Controls.Grid)(this.FindName("Grid_Search"))); this.Grid_ZoomUp = ((System.Windows.Controls.Grid)(this.FindName("Grid_ZoomUp"))); this.Grid_ZoomDown = ((System.Windows.Controls.Grid)(this.FindName("Grid_ZoomDown"))); this.Grid_GoCurrentLocation = ((System.Windows.Controls.Grid)(this.FindName("Grid_GoCurrentLocation"))); this.Grid_GoTargetLocation = ((System.Windows.Controls.Grid)(this.FindName("Grid_GoTargetLocation"))); this.Grid_TargetName = ((System.Windows.Controls.Grid)(this.FindName("Grid_TargetName"))); this.TextBlock_TargetName = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_TargetName"))); this.Grid_Info = ((System.Windows.Controls.Grid)(this.FindName("Grid_Info"))); this.Grid_VisibilitySwitch = ((System.Windows.Controls.Grid)(this.FindName("Grid_VisibilitySwitch"))); this.Grid_LockPin = ((System.Windows.Controls.Grid)(this.FindName("Grid_LockPin"))); this.TextBlock_LockPin = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_LockPin"))); this.Grid_Distance = ((System.Windows.Controls.Grid)(this.FindName("Grid_Distance"))); this.TextBlock_Distance = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_Distance"))); this.TextBlock_Distance_Unit = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_Distance_Unit"))); this.Grid_EstimateTimeArrival = ((System.Windows.Controls.Grid)(this.FindName("Grid_EstimateTimeArrival"))); this.TextBlock_ETA_Unit = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_ETA_Unit"))); this.TextBlock_ETA = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_ETA"))); this.TextBlock_AvgSpeed = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_AvgSpeed"))); this.Grid_TwoPoint_Distance = ((System.Windows.Controls.Grid)(this.FindName("Grid_TwoPoint_Distance"))); this.TextBlock_TwoPoint_Distance = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_TwoPoint_Distance"))); this.TextBlock_TwoPoint_Distance_Unit = ((System.Windows.Controls.TextBlock)(this.FindName("TextBlock_TwoPoint_Distance_Unit"))); this.Appbar_CompassButton = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("Appbar_CompassButton"))); this.Appbar_ListButton = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("Appbar_ListButton"))); }
/** * Constructor */ public MapPin() { mPushpin = new Microsoft.Phone.Controls.Maps.Pushpin(); mPushpin.Location = new System.Device.Location.GeoCoordinate(); View = mPushpin; mPushpin.MouseLeftButtonDown += new MouseButtonEventHandler( delegate(object from, MouseButtonEventArgs args) { /** * post the event to MoSync runtime */ Memory eventData = new Memory(8); const int MAWidgetEventData_eventType = 0; const int MAWidgetEventData_widgetHandle = 4; eventData.WriteInt32(MAWidgetEventData_eventType, MoSync.Constants.MAW_EVENT_MAP_PIN_CLICKED); eventData.WriteInt32(MAWidgetEventData_widgetHandle, mHandle); mRuntime.PostCustomEvent(MoSync.Constants.EVENT_TYPE_WIDGET, eventData); } ); }