示例#1
0
        /// <summary>
        /// Mapping the point
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PenFound(object sender, PenFoundEventArgs e)
        {
            var point = _mapper.FromPresentation(e.Frame.Point.X, e.Frame.Point.Y);
            var frame = e.Frame.ApplyRebase(point);

            if (PenPositionChanged != null)
            {
                PenPositionChanged(this, new VirtualPenPositionEventArgs(frame, CalibratorGrid.Contains(point)));
            }
        }
示例#2
0
        /// <summary>
        /// Mapping the point
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PenFound(object sender, PenFoundEventArgs e)
        {
            Debug.WriteLine("Pen Nr\t{0} at {1},{2}", e.Frame.Number, e.Frame.Point.X, e.Frame.Point.Y);
            Point  point       = e.Frame.Point;
            double distortionX = (double)CalibratorGrid.ScreenSize.Width / (double)TransformWidth;
            double distortionY = (double)CalibratorGrid.ScreenSize.Height / (double)TransformHeight;

            //point.X *= (int)Math.Round((double)CalibratorGrid.ScreenSize.Width / TransformWidth);
            //point.Y *= (int)Math.Round((double)CalibratorGrid.ScreenSize.Height / TransformHeight);

            point.X = (int)Math.Round(distortionX * (double)e.Frame.Point.X);
            point.Y = (int)Math.Round(distortionY * (double)e.Frame.Point.Y);

            PointFrame frame = e.Frame.ApplyRebase(point);

            if (PenPositionChanged != null)
            {
                PenPositionChanged(this, new VirtualPenPositionEventArgs(frame, true));
            }
        }