/// <summary> /// Called, when mouse/finger/pen click/touch map /// </summary> /// <param name="touchPoints">List of all touched points</param> private bool OnTouchStart(List <Geometries.Point> touchPoints) { // Sanity check if (touchPoints.Count == 0) { return(false); } // We have a new interaction with the screen, so stop all navigator animations Navigator.StopRunningAnimation(); var args = new TouchedEventArgs(touchPoints); TouchStarted?.Invoke(this, args); if (args.Handled) { return(true); } if (touchPoints.Count == 2) { (_previousCenter, _previousRadius, _previousAngle) = GetPinchValues(touchPoints); _mode = TouchMode.Zooming; _innerRotation = Viewport.Rotation; } else { _mode = TouchMode.Dragging; _previousCenter = touchPoints.First(); } return(true); }
/// <summary> /// Called, when mouse/finger/pen click/touch map /// </summary> /// <param name="touchPoints">List of all touched points</param> private bool OnTouchStart(List <Geometries.Point> touchPoints) { // Sanity check if (touchPoints.Count == 0) { return(false); } var args = new TouchedEventArgs(touchPoints); TouchStarted?.Invoke(this, args); if (args.Handled) { return(true); } if (touchPoints.Count == 2) { (_previousCenter, _previousRadius, _previousAngle) = GetPinchValues(touchPoints); _mode = TouchMode.Zooming; _innerRotation = Viewport.Rotation; } else { _mode = TouchMode.Dragging; _previousCenter = touchPoints.First(); } return(true); }
public async Task MapTouchStarted(object sender, TouchedEventArgs e) { // if we have a touch start, all move and TouchEnd events are processed // this can be: // - a new user action (click, doubleClick, drag, longTap) // - a second click following a first TouchStart, (move .... ), TouchEnd if (!waitingFirstTimer && !waitingSecondTimerForClick) { TouchMoveCount = 0; userActionCompleted = false; touchEndInsideFirsTimerOccured = false; touchEndInsideSecondTimerForClickOccured = false; secondTouchStartedInsideFirsTimerOccured = false; secondTouchStartedInsideSecondClickTimerTimerOccured = false; waitingFirstTimer = true; waitingSecondTimerForClick = false; savedSender = sender; savedTouchedEventArgs = e; Logger.Clear(); Logger.Log($" MapTouchStarted : First MapTouch\r\n\t Double Tap Enabled = {((MapControl)sender).UseDoubleTap} ; MapInfo Enabled = {IsMapInfoLayer}\r\n\t starting first timer for {RBGlobals.RBG_MillisecondsBeforeDragging} ms"); Device.StartTimer(TimeSpan.FromMilliseconds(RBGlobals.RBG_MillisecondsBeforeDragging), MapTouchFirstTimerHandler); Device.StartTimer(TimeSpan.FromMilliseconds(2000), () => { Logger.WriteToDebugLabel(RBG_DebugLabel); // logger.FlushOnDiagnosticDebug(); return(false); }); } else { if (waitingFirstTimer) { Logger.Log($" MapTouchStarted : Second mapTouch during the first timer period"); secondTouchStartedInsideFirsTimerOccured = true; } else if (waitingSecondTimerForClick) { Logger.Log($" MapTouchStarted : Second mapTouch during the second timer period (waiting for second click)"); secondTouchStartedInsideSecondClickTimerTimerOccured = true; } else { throw new Exception("RBLayer: MapTouchStarted : Having both timers active is not possible, there is a fault in the logic !"); } } }
private void MapControlOnTouchEnded(object sender, TouchedEventArgs e) { if (polyDraw == null) { return; } //MapMarkersLayer.Delayer.MillisecondsToWait = 500; GameState.Instance.marker.CreateMarker(polyDraw); var markerProvider = MapMarkersLayer.DataSource as MapMarkerProvider; markerProvider?.RemoveMarker(polyDraw.id); polyDraw = null; }
/// <summary> /// Called when touch enters map /// </summary> /// <param name="touchPoints">List of all touched points</param> private bool OnTouchEntered(List <Geometries.Point> touchPoints) { // Sanity check if (touchPoints.Count == 0) { return(false); } var args = new TouchedEventArgs(touchPoints); TouchEntered?.Invoke(this, args); return(args.Handled); }
/// <summary> /// Called, when mouse/finger/pen anymore click/touch map /// </summary> /// <param name="touchPoints">List of all touched points</param> /// <param name="releasedPoint">Released point, which was touched before</param> private bool OnTouchEnd(List <Geometries.Point> touchPoints, Geometries.Point releasedPoint) { var args = new TouchedEventArgs(touchPoints); TouchEnded?.Invoke(this, args); // Last touch released if (touchPoints.Count == 0) { _mode = TouchMode.None; _map.RefreshData(_viewport.Extent, _viewport.Resolution, true); } return(args.Handled); }
/// <summary> /// Called, when mouse/finger/pen anymore click/touch map /// </summary> /// <param name="touchPoints">List of all touched points</param> /// <param name="releasedPoint">Released point, which was touched before</param> private bool OnTouchEnd(List <Geometries.Point> touchPoints, Geometries.Point releasedPoint) { var args = new TouchedEventArgs(touchPoints); TouchEnded?.Invoke(this, args); // Last touch released if (touchPoints.Count == 0) { InvalidateCanvas(); _mode = TouchMode.None; _map.ViewChanged(true); } return(args.Handled); }
private void MapControlOnMouseMove(object sender, TouchedEventArgs e) { if (polyDraw == null) { return; } var info = MapControl.GetMapInfo(e.ScreenPoints.First(), 12); var lastPos = polyDraw.polyline.Last(); if (new Point(lastPos[0], lastPos[1]).Distance(new Point(info.WorldPosition.X, info.WorldPosition.Y)) > 5) { polyDraw.polyline.Add(new float[] { (float)info.WorldPosition.X, (float)info.WorldPosition.Y }); MapMarkersLayer.DataHasChanged(); } }
private void MapControlOnMouseLeftButtonDown(object sender, TouchedEventArgs e) { var info = MapControl.GetMapInfo(e.ScreenPoints.First(), 12); //GPSEditPopup.IsOpen = false; if (info.Feature is GPSTrackerFeature gpsTrackerFeature) { //GPSEdit.Tracker = gpsTrackerFeature.Tracker; //GPSEditPopup.Placement = PlacementMode.Mouse; //GPSEditPopup.StaysOpen = false; //GPSEditPopup.AllowsTransparency = true; //GPSEditPopup.IsOpen = true; //e.Handled = true; } if (polyDraw == null && CanDraw) { polyDraw = new ActiveMarker { id = GameState.Instance.marker.GenerateMarkerName(MarkerChannel.Global), channel = 0, color = "ColorBlack", type = "hd_dot", shape = "POLYLINE", text = "", size = "1,1", alpha = 1, dir = 0, brush = "Solid" }; polyDraw.pos.Clear(); polyDraw.pos.Add((float)info.WorldPosition.X); polyDraw.pos.Add((float)info.WorldPosition.Y); polyDraw.polyline.Add(new float[] { (float)info.WorldPosition.X, (float)info.WorldPosition.Y }); var markerProvider = MapMarkersLayer.DataSource as MapMarkerProvider; markerProvider?.AddMarker(polyDraw, false); MapMarkersLayer.DataHasChanged(); } }
public async Task MapTouchEnd(object sender, TouchedEventArgs e) { if (waitingFirstTimer) { touchEndInsideFirsTimerOccured = true; Logger.Log($" MapTouchEnd : Occured during first timer"); } else if (waitingSecondTimerForClick) { touchEndInsideSecondTimerForClickOccured = true; Logger.Log($" MapTouchEnd : Occured during second timer"); } else if (userActionCompleted == true) { Logger.Log($" MapTouchEnd : MapTouchEnd occured with no timer active and useraction terminated !"); } else { Logger.Log($" MapTouchEnd : MapTouchEnd occured with no timer active and useraction still pending !"); } }
/// <summary> /// Called when touch enters map /// </summary> /// <param name="touchPoints">List of all touched points</param> private bool OnTouchEntered(List <Geometries.Point> touchPoints) { // Sanity check if (touchPoints.Count == 0) { return(false); } var args = new TouchedEventArgs(touchPoints); TouchEntered?.Invoke(this, args); if (args.Handled) { return(true); } // We have an interaction with the screen, so stop all animations Navigator.StopRunningAnimation(); return(true); }
private async void MapTouchEnded(object sender, TouchedEventArgs e) { await RBLayer.MapTouchEnd(sender, e); }
private async void MapTouchMouve(object sender, TouchedEventArgs e) { await RBLayer.MapTouchMove(sender, e); }
private async Task MapLongTapEndOrDraggingStarted(object sender, TouchedEventArgs e) { // no touchend since delay sarted, we assume it is drag ! Logger.Log($" MapLongTapEndOrDraggingStarted : TODO Handle lonTap versus drag ...."); //await ((IRBLayer)this).LayerTouchStarted(sender, e); }
public async Task MapTouchMove(object sender, TouchedEventArgs e) { TouchMoveCount++; Logger.Log($" MapTouchMove # {TouchMoveCount} : "); }
/// <summary> /// Called, when mouse/finger/pen moves over map /// </summary> /// <param name="touchPoints">List of all touched points</param> private bool OnTouchMove(List <Geometries.Point> touchPoints) { var args = new TouchedEventArgs(touchPoints); TouchMove?.Invoke(this, args); if (args.Handled) { return(true); } switch (_mode) { case TouchMode.Dragging: { if (touchPoints.Count != 1) { return(false); } var touchPosition = touchPoints.First(); if (!Map.PanLock && _previousCenter != null && !_previousCenter.IsEmpty()) { _viewport.Transform(touchPosition, _previousCenter); RefreshGraphics(); } _previousCenter = touchPosition; } break; case TouchMode.Zooming: { if (touchPoints.Count != 2) { return(false); } var(prevCenter, prevRadius, prevAngle) = (_previousCenter, _previousRadius, _previousAngle); var(center, radius, angle) = GetPinchValues(touchPoints); double rotationDelta = 0; if (!Map.RotationLock) { _innerRotation += angle - prevAngle; _innerRotation %= 360; if (_innerRotation > 180) { _innerRotation -= 360; } else if (_innerRotation < -180) { _innerRotation += 360; } if (Viewport.Rotation == 0 && Math.Abs(_innerRotation) >= Math.Abs(UnSnapRotationDegrees)) { rotationDelta = _innerRotation; } else if (Viewport.Rotation != 0) { if (Math.Abs(_innerRotation) <= Math.Abs(ReSnapRotationDegrees)) { rotationDelta = -Viewport.Rotation; } else { rotationDelta = _innerRotation - Viewport.Rotation; } } } _viewport.Transform(center, prevCenter, Map.ZoomLock ? 1 : radius / prevRadius, rotationDelta); (_previousCenter, _previousRadius, _previousAngle) = (center, radius, angle); RefreshGraphics(); } break; } return(true); }
/// <summary> /// Called, when mouse/finger/pen moves over map /// </summary> /// <param name="touchPoints">List of all touched points</param> private bool OnTouchMove(List <Geometries.Point> touchPoints) { var args = new TouchedEventArgs(touchPoints); TouchMove?.Invoke(this, args); if (args.Handled) { return(true); } switch (_mode) { case TouchMode.Dragging: { if (touchPoints.Count != 1) { return(false); } var touchPosition = touchPoints.First(); if (_previousCenter != null && !_previousCenter.IsEmpty()) { _map.Viewport.Transform(touchPosition.X, touchPosition.Y, _previousCenter.X, _previousCenter.Y); ViewportLimiter.LimitExtent(_map.Viewport, _map.PanMode, _map.PanLimits, _map.Envelope); InvalidateCanvas(); } _previousCenter = touchPosition; } break; case TouchMode.Zooming: { if (touchPoints.Count < 2) { return(false); } var(prevCenter, prevRadius, prevAngle) = (_previousCenter, _previousRadius, _previousAngle); var(center, radius, angle) = GetPinchValues(touchPoints); double rotationDelta = 0; if (RotationLock) { _innerRotation += angle - prevAngle; _innerRotation %= 360; if (_innerRotation > 180) { _innerRotation -= 360; } else if (_innerRotation < -180) { _innerRotation += 360; } if (_map.Viewport.Rotation == 0 && Math.Abs(_innerRotation) >= Math.Abs(UnSnapRotationDegrees)) { rotationDelta = _innerRotation; } else if (_map.Viewport.Rotation != 0) { if (Math.Abs(_innerRotation) <= Math.Abs(ReSnapRotationDegrees)) { rotationDelta = -_map.Viewport.Rotation; } else { rotationDelta = _innerRotation - _map.Viewport.Rotation; } } } _map.Viewport.Transform(center.X, center.Y, prevCenter.X, prevCenter.Y, radius / prevRadius, rotationDelta); (_previousCenter, _previousRadius, _previousAngle) = (center, radius, angle); ViewportLimiter.Limit(_map.Viewport, _map.ZoomMode, _map.ZoomLimits, _map.Resolutions, _map.PanMode, _map.PanLimits, _map.Envelope); InvalidateCanvas(); } break; } return(true); }