예제 #1
0
        public void GestureSurface_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (!isMouseDown)
            {
                return;
            }
            Canvas   c         = (Canvas)sender;
            var      point     = e.GetPosition(c);
            RecPoint new_point = new RecPoint((float)point.X, (float)point.Y, strokeIndex, gestureTime.ElapsedMilliseconds);

            if (points.Count > 0)
            {
                RecPoint last = points.Last();

                if (new_point.Time - last.Time >= 5)                 // 200Hz
                {
                    if (strokeIndex == last.StrokeID)
                    {
                        System.Windows.Shapes.Path current_path = new System.Windows.Shapes.Path();
                        SolidColorBrush            blackBrush   = new SolidColorBrush();
                        blackBrush.Color             = ColorArray[g];
                        current_path.Stroke          = blackBrush;
                        current_path.StrokeThickness = 3;
                        GeometryGroup myGeometryGroup = new GeometryGroup();

                        LineGeometry current_line = new LineGeometry();
                        current_line.StartPoint = new System.Windows.Point(last.X, last.Y);
                        current_line.EndPoint   = new System.Windows.Point(point.X, point.Y);

                        current_path.Data = current_line;
                        c.Children.Add(current_path);
                        int lrp = Recognizer.DividePart(points, new_point, lastRecognizedPointIndex);
                        if (lrp > -1)
                        {
                            RecognizeGesture_Thread(false, false, lrp);
                        }
                    }
                    points.Add(new_point);
                }
            }
            else
            {
                points.Add(new_point);
            }
        }