Exemplo n.º 1
0
 /// <summary>
 /// Retrieves the current velocity (in pixels per second) of the giben touch point.
 /// The returned values are only valid if <see cref="GetTouchActive"/> holds true for the same touchpoint.
 /// </summary>
 /// <param name="touch">The touchpoint.</param>
 /// <returns>The two-dimensional velocitiy of the touchpoint.</returns>
 public float2 GetVelocity(TouchPoints touch)
 {
     return(new float2(
                GetAxis(_velocityIDs[2 * (touch - TouchPoints.Touchpoint_0)]),
                GetAxis(_velocityIDs[2 * (touch - TouchPoints.Touchpoint_0) + 1])
                ));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the current position of the given touchpoint.
 /// The returned values are only valid if <see cref="GetTouchActive"/> holds true for the same touchpoint.
 /// </summary>
 /// <param name="touch">The touchpoint.</param>
 /// <returns>The X/Y postion of the given touchpoint.</returns>
 public float2 GetPosition(TouchPoints touch)
 {
     return(new float2(
                GetAxis(2 * (touch - TouchPoints.Touchpoint_0) + (int)TouchAxes.Touchpoint_0_X),
                GetAxis(2 * (touch - TouchPoints.Touchpoint_0) + (int)TouchAxes.Touchpoint_0_Y)
                ));
 }
Exemplo n.º 3
0
        public IReturnType Calculate(ValidSetOfTouchPoints set)
        {
            TouchPoints points = new TouchPoints();
            foreach (var touchPoint in set)
            {
                points.Add(new TouchInfo() { ActionType = touchPoint.Action.ToTouchAction(), Position = touchPoint.Position, TouchDeviceId = touchPoint.TouchDeviceId });
            }

            return points;
        }
Exemplo n.º 4
0
        Polygon CreatePolygon(TouchPoints points)
        {
            Polygon p = new Polygon();

            foreach (var point in points)
            {
                p.Points.Add(point);
            }

            return p;
        }
Exemplo n.º 5
0
        public string GetSecondCalibrationCommonds()
        {
            PosePositions.Clear();
            TouchPoints.Clear();

            var commonds = new List <BaseCommand>();

            var lengths = new[] { 70, 80, 90, 100, 110, 120, 130 };   // coordinate_x
            var rotates = new[] { 90, 100, 110, 120, 130, 140, 150 }; // step

            var coor_Z = (int)ArmPositionCalculator.SharedInstance.ToCoordinate(ArmPositionCalculator.SharedInstance.ProbbedPose).Item3;


            var tapDistance = CommandHelper.GetTapDistance();

            for (var i = 0; i < lengths.Length; i++)
            {
                var length = lengths[i];
                var rotate = rotates[i];
                var pose   = ArmPositionCalculator.SharedInstance.ToPose(new Tuple <double, double, double>(length, 0, coor_Z));
                var x      = pose.X - tapDistance;
                var y      = pose.Y - tapDistance;

                commonds.Add(new PoseCommand(x, y, 0));
                commonds.Tap();
                commonds.WaitForTouch();

                commonds.TouchInSameRadius(new List <int> {
                    rotate, -2 * rotate
                });

                commonds.Rotate(rotate);
            }

            commonds.Reset();

            commonds.Add(new DoneCommand(TaskNameCalibration));

            commonds.Add(new PauseCommand(30, -1));

            if (commonds.Count <= 0)
            {
                return(string.Empty);
            }

            JsonSerializerSettings settings = new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.Auto
            };
            string serialized = JsonConvert.SerializeObject(commonds, settings);

            return(serialized);
            //List<Base> deserializedList = JsonConvert.DeserializeObject<List<Base>>(Serialized, settings);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Returns a value signalling if the given touchpoint is currently active (if something hits the screen).
 /// </summary>
 /// <param name="touch">The touchpoint to check.</param>
 /// <returns>true if this touch is acitve (a finger is on the screen), otherwise false.</returns>
 public bool GetTouchActive(TouchPoints touch)
 {
     return(GetButton((int)touch));
 }