void MapWithEvents_MouseLeftButtonDown(object sender, MouseEventArgs e) { // Updates the count of mouse pans. ShowEvent("MapWithEvents_MouseLeftButtonDown"); if (this.isShiftDown) { this.isMouseDown = true; e.Handled = true; // Creates a location for a single polygon point and adds it to // the polygon's point location list. this.polygonStartPoint = e.GetPosition(this.MyMap); //Convert the mouse coordinates to a location on the map Location polygonPointLocation = MyMap.ViewportPointToLocation(this.polygonStartPoint); mapPolygon.Locations.Add(polygonPointLocation); // A visual representation of a polygon point. Rectangle r = new Rectangle(); r.Fill = new SolidColorBrush(Colors.Red); r.Stroke = new SolidColorBrush(Colors.Yellow); r.StrokeThickness = 1; r.Width = 8; r.Height = 8; // Adds a small square where the user clicked, to mark the polygon point. polygonPointLayer.AddChild(r, polygonPointLocation); //Set focus back to the map so that +/- work for zoom in/out MyMap.Focus(); } }
void MapWithEvents_MouseMove(object sender, MouseEventArgs e) { // Updates the count of mouse double clicks. ShowEvent("MapWithEvents_MouseMove"); if (this.isShiftDown && this.isMouseDown) { this.polygonEndPoint = e.GetPosition(this.MyMap); //Convert the mouse coordinates to a location on the map Location upperRight = MyMap.ViewportPointToLocation(this.polygonStartPoint); Location lowerRight = MyMap.ViewportPointToLocation(new Point(this.polygonStartPoint.X, this.polygonEndPoint.Y)); Location lowerLeft = MyMap.ViewportPointToLocation(this.polygonEndPoint); Location upperLeft = MyMap.ViewportPointToLocation(new Point(this.polygonEndPoint.X, this.polygonStartPoint.Y)); mapPolygon.Locations.Clear(); mapPolygon.Locations.Add(upperRight); mapPolygon.Locations.Add(lowerRight); mapPolygon.Locations.Add(lowerLeft); mapPolygon.Locations.Add(upperLeft); // Adds a small square where the user clicked, to mark the polygon point. polygonPointLayer.Children.Clear(); //Set focus back to the map so that +/- work for zoom in/out MyMap.Focus(); } }
public void SetViewModel(BingMapViewModel vm) { _vm = vm; DataContext = _vm; // Focus the camera to the map MyMap.Focus(); // Set map to Aerial mode with labels MyMap.Mode = new AerialMode(true); }
private void MyMap_Loaded(object sender, RoutedEventArgs e) { // Zoom to fit this.ZoomMapToFitPins(this.MyMap, App.MapVM.ImageLocations); MyMap.Focus(); Task.Delay(1000).ContinueWith( t => this.Dispatcher.Invoke(new Action(() => ImageHelper.SnapshotMap(App.MapVM.ProjectId, this.MyMap))) ); }
public MainWindow() { InitializeComponent(); MyMap.Mode = new RoadMode(); BgVideo.Source = new Uri($"{AppDomain.CurrentDomain.BaseDirectory}/bg.mp4"); BgVideo.Play(); MyMap.Focus(); ButtonSizes(); ShowLocations(Enums.LocationType.Base); }
private void Find(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { if (Enabled) { EnableAppButtons(false); getLocation.Text = "Stop"; getLocation.IconUri = new Uri("/Images/dark.transport.stop.png", UriKind.Relative); getLocation.IsEnabled = true; MyMap.Focus(); query = new GeocodeQuery() { GeoCoordinate = new GeoCoordinate(0, 0), SearchTerm = Search.Text }; query.QueryCompleted += GetGeoCoordinate; query.QueryAsync(); } } }
private void ClearFunc() { TimerForCarAnimation.Stop(); routeResult.Locations.Clear(); routeResult.ManeuverPointsForDegreesAnimation.Clear(); routeResult.RoutePathForDegreesAnimation.Clear(); routeResult.Distance = 0; routeResult.Duration = 0; if (SearchResultsCollection != null) { SearchResultsCollection.Clear(); } TempIndexForLocationCollection = 0; DriverWaiting = true; MyMap.Focus(); MyMap.Children.Clear(); MyMap.Children.Add(new Pushpin() { Location = GetCurrentLocationService.CurrentLocation() }); AddDriversToMapService.AddDriversOnTheMap(MyMap, DriversRepo.GetDrivers()); }
private void btnZoom_Click(object sender, RoutedEventArgs e) { MyMap.Focus(); MyMap.ZoomLevel++; }
private void btnCalles_Click(object sender, RoutedEventArgs e) { MyMap.Focus(); MyMap.Mode = new RoadMode(); }
private void btnSaltelite_Click(object sender, RoutedEventArgs e) { MyMap.Focus(); MyMap.Mode = new AerialMode(true); }
private void HybridMode_Clicked(object sender, RoutedEventArgs e) { MyMap.Mode = new AerialMode(true); MyMap.Focus(); }
private void RoadMode_Clicked(object sender, RoutedEventArgs e) { MyMap.Mode = new RoadMode(); MyMap.Focus(); }
private void MyMap_Loaded(object sender, RoutedEventArgs e) { MyMap.Focus(); }