private async void MainMap_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { GeoboundingBox bounds; try { var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader(); bounds = new GeoboundingBox(MainMap.TopLeft, MainMap.BottomRight); } catch (Exception) { return; } long lm = DateTime.Now.Ticks; LastMove = lm; await Task.Delay(50); if (LastMove == lm) { if (MainMap.ZoomLevel < MainMap.StopVisibilityThreshold) { return; } try { AddStopsInBounds(bounds, false); } catch (TaskCanceledException) { } } }
private void MapCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { var bounds = sender.GetBounds(); _busSwarm.SetViewRegion(bounds); _busStops.SetViewRegion(bounds); }
private void OnMapCameraChanged(MapControl mapControl, MapActualCameraChangedEventArgs args) { if (this.isDragging) { // Reset the map center to the stored center value. // This prevents the map from panning when we drag across it. this.map.Center = this.center; } }
private void Map_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { var buttons = new Dictionary <Point, Button>(); foreach (var child in Map.Children) { var btn = child as Button; Point point; try { point = btn.TransformToVisual(Map).TransformPoint(new Point()); } catch (Exception) { return; } if (point.X > 0 && point.X <= Map.ActualWidth && point.Y > 0 && point.Y <= Map.ActualHeight) { btn.IsTabStop = true; buttons.Add(point, btn); } else { btn.IsTabStop = false; } } Button previosBtn = null; var orderedButtons = buttons.OrderBy(b => b.Key.X); foreach (var point in orderedButtons) { var button = point.Value; button.XYFocusUp = button; button.XYFocusRight = button; button.XYFocusLeft = previosBtn != null ? previosBtn : button; button.XYFocusDown = MainControlsViewOldAdventuresButton; if (previosBtn != null) { previosBtn.XYFocusRight = button; } previosBtn = button; } if (orderedButtons.Count() > 1) { orderedButtons.Last().Value.XYFocusRight = orderedButtons.First().Value; orderedButtons.First().Value.XYFocusLeft = orderedButtons.Last().Value; } }
private void Control_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { // This if (_xamarinMap.OnRegionChanged != null) { _xamarinMap.OnRegionChanged(); } // or this MessagingCenter.Send <object>(this, "RegionChanged"); }
private void OnActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { var camera = args.Camera; var pos = new CameraPosition( camera.Location.Position.ToPosition(), sender.ZoomLevel, camera.Heading, camera.Pitch); Map?.SendCameraChanged(pos); }
private void MapMain_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { // Stop following the user if he changed the view if (MapState != MapPositionState.None && args.ChangeReason == MapCameraChangeReason.UserInteraction && Math.Abs(args.Camera.Location.Position.Latitude - CurrentPosition.Point.Position.Latitude) > 0.0000001 && Math.Abs(args.Camera.Location.Position.Longitude - CurrentPosition.Point.Position.Longitude) > 0.0000001) { MapState = MapPositionState.None; } // Stop rotating the map if the user rotates if (MapState == MapPositionState.FollowAndRotate && args.ChangeReason == MapCameraChangeReason.UserInteraction && Math.Abs(args.Camera.Heading - CurrentHeading.HeadingTrueNorth.Value) > 0.0000001) { MapState = MapPositionState.None; } }
private async void MapCameraChanged(MapControl mapControl, MapActualCameraChangedEventArgs args) { var currentTime = DateTime.Now; var timeElapsed = currentTime - _bboxFiringTime; if (timeElapsed.TotalSeconds > 1) { _bboxFiringTime = currentTime; } else { return; } var boundingBox = GetBoundingBox(); var searchByBboxResult = await Requests.GetLocationByBBox(boundingBox); SearchByBBoxTaskCompletion(searchByBboxResult); }
private void MapMain_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { // Stop following the user if he changed the view if (MapState != MapPositionState.None && args.ChangeReason == MapCameraChangeReason.UserInteraction && Math.Abs(args.Camera.Location.Position.Latitude - CurrentPosition.Point.Position.Latitude) > 0.0000001 && Math.Abs(args.Camera.Location.Position.Longitude - CurrentPosition.Point.Position.Longitude) > 0.0000001) MapState = MapPositionState.None; // Stop rotating the map if the user rotates if (MapState == MapPositionState.FollowAndRotate && args.ChangeReason == MapCameraChangeReason.UserInteraction && Math.Abs(args.Camera.Heading - CurrentHeading.HeadingTrueNorth.Value) > 0.0000001) MapState = MapPositionState.None; }
// TODO WORKARROUND for Xamarin.Forms.GoogleMaps's event CameraIdled doesn't work private void NativeMap_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { _map?.SendCameraIdled(new CameraPosition(args.Camera.Location.Position.ToPosition(), sender.ZoomLevel)); }
private async void MainMap_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { GeoboundingBox bounds; try { bounds = new GeoboundingBox(MainMap.TopLeft, MainMap.BottomRight); } catch (Exception) { return; } long lm = DateTime.Now.Ticks; LastMove = lm; await Task.Delay(50); if (LastMove == lm) { if (MainMap.ZoomLevel < MainMap.StopVisibilityThreshold) return; try { AddStopsInBounds(bounds); } catch (TaskCanceledException) { } } }
private void MapControl_ActualCameraChanged(MapControl sender, MapActualCameraChangedEventArgs args) { com.codename1.googlemaps.MapContainer.fireMapChangeEvent(mapId, (int)mapControl.ZoomLevel, mapControl.Center.Position.Latitude, mapControl.Center.Position.Longitude); }
MapCameraChangeReason IMapActualCameraChangedEventArgsResolver.ChangeReason(MapActualCameraChangedEventArgs e) => e.ChangeReason;
MapCamera IMapActualCameraChangedEventArgsResolver.Camera(MapActualCameraChangedEventArgs e) => e.Camera;
/// <summary> /// Indicates the reason the <see cref="MapControl.ActualCameraChanged"/> event was triggered. /// </summary> /// <param name="e">The requested <see cref="MapActualCameraChangedEventArgs"/>.</param> /// <returns>The reason the <see cref="MapControl.ActualCameraChanged"/> event was triggered.</returns> public static MapCameraChangeReason ChangeReason(this MapActualCameraChangedEventArgs e) => Resolver.ChangeReason(e);
/// <summary> /// Gets the current position of the map's camera. /// </summary> /// <param name="e">The requested <see cref="MapActualCameraChangedEventArgs"/>.</param> /// <returns>The current position of the map's camera.</returns> public static MapCamera Camera(this MapActualCameraChangedEventArgs e) => Resolver.Camera(e);