public void Pan(byte address, PanDirection direction, byte speedPercent) { var message = _requestBuilder.Pan(address, direction, getMovementSpeedValue(speedPercent)); _logger.LogDebugMessage($"Pan {direction} / {speedPercent} => {message}"); _transport.SendMessage(message); }
// wird benachrichtigt wenn Translationsgeste in der LeapListener-Klasse detektiert wurde private void PanAction(PanDirection sd) { // Properties der View (MainWindow) werden entsprechend der detektierten Translationsrichtung angepasst // während der Entwicklungsphase: diente lediglich als Parameterwert zur Anzeige im MainWindow (WPF) - nicht sichtbar da "collapsed" switch (sd) { case PanDirection.Up: PanY += TRANSL_SHIFT; //KeyboardInput.UpArrowKey(); //KeyboardInput.UpArrowKeyReleased(); break; case PanDirection.Down: PanY -= TRANSL_SHIFT; // KeyboardInput.DownArrowKey(); // KeyboardInput.DownArrowKeyReleased(); break; case PanDirection.Left: PanX -= TRANSL_SHIFT; // KeyboardInput.LeftArrowKey(); // KeyboardInput.LeftArrowKeyReleased(); break; case PanDirection.Right: //KeyboardInput.RightArrowKey(); //KeyboardInput.RightArrowKeyReleased(); PanX += TRANSL_SHIFT; break; } }
private Vector CalculatePanVector(PanDirection panDirection) { Vector vector; switch (panDirection) { case PanDirection.Up: vector = new Vector(0, -PanAmount); break; case PanDirection.Down: vector = new Vector(0, PanAmount); break; case PanDirection.Left: vector = new Vector(-PanAmount, 0); break; case PanDirection.Right: vector = new Vector(PanAmount, 0); break; default: throw new Exception($"Unexpected PanDirection: {panDirection}"); } return(vector); }
private Vector3 GetVectorForDirection(PanDirection dir, bool animate) { Vector3 direction = new Vector3(0, 0, 0); float factor = animate ? 0.1f : 0.05f; switch (dir) { case PanDirection.Up: direction = -factor * App.Scene.Up; break; case PanDirection.Down: direction = factor * App.Scene.Up; break; case PanDirection.Left: direction = -factor * App.Scene.Right; break; case PanDirection.Right: direction = factor * App.Scene.Right; break; default: throw new ArgumentOutOfRangeException(nameof(dir), dir, null); } return(direction); }
public static void Pan(this PerspectiveCamera camera, PanDirection direction) { var vecLeft = Vector3D.CrossProduct(camera.LookDirection, camera.UpDirection); TranslateTransform3D xTrans; switch (direction) { case PanDirection.Left: xTrans = new TranslateTransform3D(vecLeft * panFactor); camera.Position = xTrans.Transform(camera.Position); break; case PanDirection.Right: xTrans = new TranslateTransform3D(-vecLeft * panFactor); camera.Position = xTrans.Transform(camera.Position); break; case PanDirection.Up: xTrans = new TranslateTransform3D(-camera.UpDirection * panFactor); camera.Position = xTrans.Transform(camera.Position); break; case PanDirection.Down: xTrans = new TranslateTransform3D(camera.UpDirection * panFactor); camera.Position = xTrans.Transform(camera.Position); break; case PanDirection.None: break; default: throw new ArgumentOutOfRangeException(nameof(direction), direction, null); } }
private void MovePoints() { LayerOverlay pointsOverlay = (LayerOverlay)mapView.Overlays["PointsOverlay"]; InMemoryFeatureLayer pointsLayer = (InMemoryFeatureLayer)pointsOverlay.Layers["PointsLayer"]; Collection <Feature> features = new Collection <Feature>(); for (int i = 0; i < pointsLayer.InternalFeatures.Count; i++) { PointShape shape = pointsLayer.InternalFeatures[i].GetShape() as PointShape; string id = pointsLayer.InternalFeatures[i].Id; PanDirection direction = (PanDirection)PanDirection.Parse(typeof(PanDirection), id, true); if (shape.X > pointsBoundary.UpperLeftPoint.X && shape.X < pointsBoundary.LowerRightPoint.X && shape.Y < pointsBoundary.UpperLeftPoint.Y && shape.Y > pointsBoundary.LowerRightPoint.Y) { UpdatePointShape(shape, direction); } else { id = ReverseDirection(shape, direction).ToString(); } features.Add(new Feature(shape.X, shape.Y, id)); } pointsLayer.InternalFeatures.Clear(); foreach (Feature item in features) { pointsLayer.InternalFeatures.Add(item); } pointsOverlay.Refresh(); }
private object GetRandomDirection() { int i = random.Next(8); PanDirection panDirection = (PanDirection)i; return(panDirection); }
public static PanDirection GetRandomDirection() { int i = random.Next(8); PanDirection panDirection = (PanDirection)i; return(panDirection); }
public override void PanMove(string VideoSource, PanDirection Direction, [System.Xml.Serialization.XmlElementAttribute(DataType = "duration")] string Timeout) { ParametersValidation validation = new ParametersValidation(); validation.Add(ParameterType.String, "VideoSource", VideoSource); validation.Add(ParameterType.OptionalString, "Timeout", Timeout); validation.Add(ParameterType.String, "Direction", Direction.ToString()); ExecuteVoidCommand(validation, ProvisioningServiceTest.PanMoveTest); }
public PelcoDEMessage Pan(byte address, PanDirection direction, byte speed) { var cmd = direction switch { PanDirection.Left => PelcoDEMessageType.PanLeft, PanDirection.Right => PelcoDEMessageType.PanRight, _ => throw new ArgumentOutOfRangeException(nameof(direction), direction, null) }; return(buildPanTiltContinuously(address, cmd, speed)); }
void Move(PanDirection direction, Speed speed) { var data = new byte[] { (byte)(0x80 + Id), 0x01, 0x06, 0x01, (byte)speed, 0x00, (byte)direction, 0x03, 0xff }; _socket.Send(data); }
private object ReverseDirection(PointShape shape, PanDirection direction) { PanDirection newDirection = PanDirection.Down; switch (direction) { case PanDirection.Up: newDirection = PanDirection.Down; break; case PanDirection.UpperRight: newDirection = PanDirection.LowerLeft; break; case PanDirection.Right: newDirection = PanDirection.Left; break; case PanDirection.LowerRight: newDirection = PanDirection.UpperLeft; break; case PanDirection.Down: newDirection = PanDirection.Up; break; case PanDirection.LowerLeft: newDirection = PanDirection.UpperRight; break; case PanDirection.Left: newDirection = PanDirection.Right; break; case PanDirection.UpperLeft: newDirection = PanDirection.LowerRight; break; default: break; } UpdatePointShape(shape, newDirection); return(newDirection); }
private void UpdatePointShape(PointShape shape, PanDirection direction) { switch (direction) { case PanDirection.Up: shape.Y++; break; case PanDirection.UpperRight: shape.X++; shape.Y++; break; case PanDirection.Right: shape.X++; break; case PanDirection.LowerRight: shape.X++; shape.Y--; break; case PanDirection.Down: shape.Y--; break; case PanDirection.LowerLeft: shape.X--; shape.Y--; break; case PanDirection.Left: shape.X--; break; case PanDirection.UpperLeft: shape.X--; shape.Y++; break; default: break; } }
// ---------------------------------------- End Button Events ---------------------------------------- #endregion #region Camera Commands // ---------------------------------------- Begin Camera Commands ---------------------------------------- private void PanCamera(int cameraNumber, PanDirection direction, int tiltSpeed, int panSpeed) { byte[] command = new byte[9]; //Up: 8x 01 06 01 VV WW 03 01 FF // VV = pan speed 0x01 - 0x18 - 24 dec // WW = tilt speed 0x01 - 0x14 - 20 dec command[0] = (byte)(0x80 | (byte)cameraNumber); command[1] = 0x01; command[2] = 0x06; command[3] = 0x01; command[4] = (byte)panSpeed; command[5] = (byte)tiltSpeed; switch (direction) { case PanDirection.Up: command[6] = 0x03; command[7] = 0x01; break; case PanDirection.Down: command[6] = 0x03; command[7] = 0x02; break; case PanDirection.Left: command[6] = 0x01; command[7] = 0x03; break; case PanDirection.Right: command[6] = 0x02; command[7] = 0x03; break; default: break; } command[8] = COMMAND_TERMINATOR; SendCommand(SerialCapturePort, command); }
private void PanRelative(int cameraNumber, PanDirection direction, int panSpeed, int tiltSpeed, int stepSpeed) { byte[] command = new byte[15]; //Up: 8x 01 06 03 VV WW 0Y 0Y 0Y 0Y 0Z 0Z 0Z 0Z FF // VV = pan speed 0x01 - 0x18 - 24 dec // WW = tilt speed 0x01 - 0x14 - 20 dec // YY = pan position // ZZ = tilt position command[0] = (byte)(0x80 | (byte)cameraNumber); command[1] = 0x01; command[2] = 0x06; command[3] = 0x03; command[4] = (byte)panSpeed; command[5] = (byte)tiltSpeed; switch (direction) { case PanDirection.Up: CameraBitShift((Int16)stepSpeed).CopyTo(command, 10); break; case PanDirection.Down: CameraBitShift((Int16)(stepSpeed * -1)).CopyTo(command, 10); break; case PanDirection.Left: CameraBitShift((Int16)(stepSpeed * -1)).CopyTo(command, 6); break; case PanDirection.Right: CameraBitShift((Int16)stepSpeed).CopyTo(command, 6); break; default: break; } command[14] = COMMAND_TERMINATOR; SendCommand(SerialCapturePort, command); }
public void Pan(PanDirection dir, bool animate = false) { var direction = GetVectorForDirection(dir, animate); if (animate) { ValueAnimation panAnimation = new ValueAnimation(); panAnimation.InterpolationMethod = InterpMethod.Linear; panAnimation.SetKeyFrame(0.0f, App.RootNode.Position); panAnimation.SetKeyFrame(0.3f, App.RootNode.Position + direction); ObjectAnimation mainNodeAnimation = new ObjectAnimation(); mainNodeAnimation.AddAttributeAnimation("Position", panAnimation, WrapMode.Once, 1f); App.RootNode.ObjectAnimation = mainNodeAnimation; } else { App.RootNode.Position += direction; } }
public void pan(PanDirection direction) { switch (direction) { case PanDirection.up: pan(new Point(0, -10)); break; case PanDirection.down: pan(new Point(0, 10)); break; case PanDirection.left: pan(new Point(-10, 0)); break; case PanDirection.right: pan(new Point(10, 0)); break; } }
// wird aufgerufen wenn eine Translationsgeste detektiert wurde private void PanAction(PanDirection sd) { switch (sd) { case PanDirection.Left: // Abonennten benachrichtigen über Event-Auslösung LeapPan?.Invoke(PanDirection.Left); break; case PanDirection.Right: LeapPan?.Invoke(PanDirection.Right); break; case PanDirection.Up: LeapPan?.Invoke(PanDirection.Up); break; case PanDirection.Down: LeapPan?.Invoke(PanDirection.Down); break; } }
private void Button_Click(object sender, RoutedEventArgs e) { Button button = (Button)sender; string buttonText = button.Tag.ToString(); switch (buttonText) { case "Up": case "Down": case "Right": case "Left": PanDirection panDirection = (PanDirection)Enum.Parse(typeof(PanDirection), buttonText); mapView.Pan(panDirection, 20); break; case "Pan": float degree = float.Parse(tbDegree.Text); int percentage = Int32.Parse(tbPercentage.Text); mapView.Pan(degree, percentage); break; } }
private void PanAllDrirection(float zoom, PanDirection panDirection) { switch (panDirection) { case PanDirection.Left: this.OffsetX += (int)(this.Width * 0.1f / zoom); break; case PanDirection.Up: this.OffsetY += (int)(this.Height * 0.1f / zoom); break; case PanDirection.Right: this.OffsetX -= (int)(this.Width * 0.1f / zoom); break; case PanDirection.Down: this.OffsetY -= (int)(this.Height * 0.1f / zoom); break; default: break; } }
private void ImageDisplay_PreviewMouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { Vector offset = e.GetPosition(ImageDisplay) - mMouseDownLocation; if (Math.Abs(offset.X) > Math.Max(sMinimumDragDistance, SystemParameters.MinimumHorizontalDragDistance) || Math.Abs(offset.Y) > Math.Max(sMinimumDragDistance, SystemParameters.MinimumVerticalDragDistance)) { if (IsPopupZoomed) //Only pan when zoomed in { PanDirection direction = PanDirection.None; double angle = Vector.AngleBetween(new Vector(0, -1), offset); if (angle < 0) { angle += 360; } System.Diagnostics.Debug.Assert(angle >= 0 && angle < 360, "Expecting angle to be in range 0 <= angle < 360"); if (angle > Octant * 7.5) { direction = PanDirection.North; } else if (angle > Octant * 6.5) { direction = PanDirection.NorthWest; } else if (angle > Octant * 5.5) { direction = PanDirection.West; } else if (angle > Octant * 4.5) { direction = PanDirection.SouthWest; } else if (angle > Octant * 3.5) { direction = PanDirection.South; } else if (angle > Octant * 2.5) { direction = PanDirection.SouthEast; } else if (angle > Octant * 1.5) { direction = PanDirection.East; } else if (angle > Octant * 0.5) { direction = PanDirection.NorthEast; } else { direction = PanDirection.North; } SetPanning(direction, offset.LengthSquared); } else { //Not zoomed in, so start a drag CloseImagePopup(); StartDrag(); } } else { if (IsPopupZoomed) { SetPanning(PanDirection.None, 0D); } } } }
public static void Rotate(this PerspectiveCamera camera, PanDirection direction, BoundingBox bbox) { RotateTransform3D xRot; var angle = (Math.PI / 64).ToDegrees(); var target = bbox.Center.ToPoint3D(); Point3D upPoint; switch (direction) { case PanDirection.Left: upPoint = new TranslateTransform3D(camera.UpDirection).Transform(camera.Position); xRot = new RotateTransform3D(new AxisAngleRotation3D(camera.UpDirection, angle), target); camera.Position = xRot.Transform(camera.Position); camera.LookDirection = target - camera.Position; camera.UpDirection = xRot.Transform(upPoint) - camera.Position; break; case PanDirection.Right: upPoint = new TranslateTransform3D(camera.UpDirection).Transform(camera.Position); xRot = new RotateTransform3D(new AxisAngleRotation3D(camera.UpDirection, -angle), target); camera.Position = xRot.Transform(camera.Position); camera.LookDirection = target - camera.Position; camera.UpDirection = xRot.Transform(upPoint) - camera.Position; break; case PanDirection.Up: upPoint = new TranslateTransform3D(camera.UpDirection).Transform(camera.Position); xRot = new RotateTransform3D( new AxisAngleRotation3D(Vector3D.CrossProduct(camera.UpDirection, camera.LookDirection), -angle), target); camera.Position = xRot.Transform(camera.Position); camera.LookDirection = target - camera.Position; camera.UpDirection = xRot.Transform(upPoint) - camera.Position; break; case PanDirection.Down: upPoint = new TranslateTransform3D(camera.UpDirection).Transform(camera.Position); xRot = new RotateTransform3D( new AxisAngleRotation3D(Vector3D.CrossProduct(camera.UpDirection, camera.LookDirection), angle), target); camera.Position = xRot.Transform(camera.Position); camera.LookDirection = target - camera.Position; camera.UpDirection = xRot.Transform(upPoint) - camera.Position; break; case PanDirection.None: break; default: throw new ArgumentOutOfRangeException(nameof(direction), direction, null); } }
public OscillatingPanEffect(AudioTrack audioTrack, TimeSpan speed, float increment, PanDirection startDirection = PanDirection.LeftToRight) : base(audioTrack) { Speed = speed; Increment = increment; }
private void SetPanning(PanDirection direction, double amount) { if (ImagePopupZoom == null) { return; //Can't do any panning if there's no zoom transform. } double straightAmount = amount * sPanScollSpeed / ImagePopupZoom.ScaleX; //Panning should be scale-independent //If at a 45 degree angle, then the amount to scroll in the vertical and horizontal directions, to get the same distance in angular movement double angleAmount = Math.Sqrt(straightAmount * straightAmount / 2); switch (direction) { case PanDirection.None: mCurrentPanAmount = new Vector(0, 0); Mouse.OverrideCursor = Cursors.ScrollAll; break; case PanDirection.North: mCurrentPanAmount = new Vector(0, -straightAmount); Mouse.OverrideCursor = Cursors.ScrollN; break; case PanDirection.NorthEast: mCurrentPanAmount = new Vector(angleAmount, -angleAmount); Mouse.OverrideCursor = Cursors.ScrollNE; break; case PanDirection.East: mCurrentPanAmount = new Vector(straightAmount, 0); Mouse.OverrideCursor = Cursors.ScrollE; break; case PanDirection.SouthEast: mCurrentPanAmount = new Vector(angleAmount, angleAmount); Mouse.OverrideCursor = Cursors.ScrollSE; break; case PanDirection.South: mCurrentPanAmount = new Vector(0, straightAmount); Mouse.OverrideCursor = Cursors.ScrollS; break; case PanDirection.SouthWest: mCurrentPanAmount = new Vector(-angleAmount, angleAmount); Mouse.OverrideCursor = Cursors.ScrollSW; break; case PanDirection.West: mCurrentPanAmount = new Vector(-straightAmount, 0); Mouse.OverrideCursor = Cursors.ScrollW; break; case PanDirection.NorthWest: mCurrentPanAmount = new Vector(-angleAmount, -angleAmount); Mouse.OverrideCursor = Cursors.ScrollNW; break; default: System.Diagnostics.Debug.Fail("Unexpected pan direction"); break; } }
private object ReverseDirection(PointShape shape, PanDirection direction) { PanDirection newDirection = PanDirection.Down; switch (direction) { case PanDirection.Up: newDirection = PanDirection.Down; break; case PanDirection.UpperRight: newDirection = PanDirection.LowerLeft; break; case PanDirection.Right: newDirection = PanDirection.Left; break; case PanDirection.LowerRight: newDirection = PanDirection.UpperLeft; break; case PanDirection.Down: newDirection = PanDirection.Up; break; case PanDirection.LowerLeft: newDirection = PanDirection.UpperRight; break; case PanDirection.Left: newDirection = PanDirection.Right; break; case PanDirection.UpperLeft: newDirection = PanDirection.LowerRight; break; default: break; } UpdatePointShape(shape, newDirection); return newDirection; }
private void OnDirectionPan(PanDirection panDirection) { var panVector = CalculatePanVector(panDirection); VectorPanCommand?.Execute(panVector); }
public abstract void PanMove(string VideoSource, PanDirection Direction, [System.Xml.Serialization.XmlElementAttribute(DataType = "duration")] string Timeout);
// ---------------------------------------- Begin Camera Commands ---------------------------------------- private void PanCamera(int cameraNumber, PanDirection direction, int tiltSpeed, int panSpeed) { byte[] command = new byte[9]; //Up: 8x 01 06 01 VV WW 03 01 FF // VV = pan speed 0x01 - 0x18 - 24 dec // WW = tilt speed 0x01 - 0x14 - 20 dec command[0] = (byte)(0x80 | (byte)cameraNumber); command[1] = 0x01; command[2] = 0x06; command[3] = 0x01; command[4] = (byte)panSpeed; command[5] = (byte)tiltSpeed; switch (direction) { case PanDirection.Up: command[6] = 0x03; command[7] = 0x01; break; case PanDirection.Down: command[6] = 0x03; command[7] = 0x02; break; case PanDirection.Left: command[6] = 0x01; command[7] = 0x03; break; case PanDirection.Right: command[6] = 0x02; command[7] = 0x03; break; default: break; } command[8] = COMMAND_TERMINATOR; SendCommand(SerialCapturePort, command); }