示例#1
0
        public void ProcessDown(object sender, StylusEventArgs args)
        {
            downTime++;
            Console.WriteLine("downTime:" + downTime);
            Point location = args.GetPosition(_inkCanvas);
            int   index    = _spiralSummarization.getSelectedKeyFrameIndex(location);//, _spiralSummarization);

            //if (pictureTracker == null)
            //    return;
            if (index != int.MinValue)
            {
                index = _spiralSummarization.KeyFrames.IndexOf(_spiralSummarization.ShowKeyFrames[index]);
            }
            if (indexes[0] == int.MinValue)
            {
                indexes[0] = index;
            }
            else
            {
                indexes[1] = index;
            }
            Console.WriteLine("index0:" + indexes[0]);
            Console.WriteLine("index1:" + indexes[1]);
            PictureTracker pictureTracker = GetPictureTracker(args.StylusDevice.Id, location);

            pictureTracker.ProcessDown(args.StylusDevice.Id, location);
        }
示例#2
0
        private PictureTracker GetPictureTracker(int touchId)
        {
            PictureTracker pictureTracker = null;

            _pictureTrackerMap.TryGetValue(touchId, out pictureTracker);

            return(pictureTracker);
        }
示例#3
0
 //We remove the touchID from the tracking map since the fingers are no longer touch
 //the picture
 public void InInertia(PictureTracker pictureTracker)
 {
     //remove all touch id from the map
     foreach (int id in
              (from KeyValuePair <int, PictureTracker> entry in _pictureTrackerMap
               where entry.Value == pictureTracker
               select entry.Key).ToList())
     {
         _pictureTrackerMap.Remove(id);
     }
 }
示例#4
0
        public void ProcessUp(object sender, StylusEventArgs args)
        {
            Point          location       = args.GetPosition(_inkCanvas);
            PictureTracker pictureTracker = GetPictureTracker(args.StylusDevice.Id, location);

            if (pictureTracker == null)
            {
                return;
            }

            pictureTracker.ProcessUp(args.StylusDevice.Id, location);
        }
示例#5
0
        private PictureTracker GetPictureTracker(int touchId, Point location)
        {
            PictureTracker pictureTracker;

            //See if we already track the picture with the touchId
            if (_pictureTrackerMap.TryGetValue(touchId, out pictureTracker))
            {
                return(pictureTracker);
            }

            //Get the picture under the touch location
            //Picture picture = FindPicture(location);
            int index = _spiralSummarization.getSelectedKeyFrameIndex(location);//, _spiralSummarization);

            //if (index == int.MinValue)
            //    return null;

            //See if we track the picture with other ID
            if (indexes[0] == int.MinValue && indexes[1] == int.MinValue)
            {
                pictureTracker = (from KeyValuePair <int, PictureTracker> entry in _pictureTrackerMap
                                  where entry.Value.index == index
                                  select entry.Value).FirstOrDefault();
            }
            else
            {
                pictureTracker = (from KeyValuePair <int, PictureTracker> entry in _pictureTrackerMap
                                  where entry.Value.index != index
                                  select entry.Value).FirstOrDefault();
            }
            //First time
            if (pictureTracker == null)
            {
                //take from stack
                if (_pictureTrackers.Count > 0)
                {
                    pictureTracker = _pictureTrackers.Pop();
                }
                else //create new
                {
                    pictureTracker = new PictureTracker(this);
                }

                pictureTracker.index = index;
                //BringPictureToFront(picture);
            }
            //remember the corelation between the touch id and the picture
            _pictureTrackerMap[touchId] = pictureTracker;
            //MessageBox.Show(index.ToString());
            return(pictureTracker);
        }
示例#6
0
        //Inertia is completed, we can reuse the object
        public void Completed(PictureTracker pictureTracker)
        {
            Console.WriteLine("zoomState:" + zoomState);
            if (zoomState != 0)
            {
                if (indexes[0] != int.MinValue && indexes[1] != int.MinValue &&
                    indexes[0] != indexes[1])
                {
                    if (indexes[0] > indexes[1])
                    {
                        int tem = indexes[1];
                        indexes[1] = indexes[0];
                        indexes[0] = tem;
                    }
                    if (zoomState == 1)
                    {
                        if (isFocus)
                        {
                            if (!SpiralSummarization.IsZoomOut)
                            {
                                SpiralSummarization.ZoomInOut();
                            }
                        }
                        else
                        {
                            SpiralSummarization.InsertKeyFrames(indexes[0], indexes[1]);
                        }
                    }
                    else if (zoomState == 2)
                    {
                        if (isFocus)
                        {
                            if (SpiralSummarization.IsZoomOut)
                            {
                                SpiralSummarization.ZoomInOut();
                            }
                        }
                        else
                        {
                            SpiralSummarization.HiddenKeyFrames(indexes[0], indexes[1]);
                        }
                    }
                }
                else if (indexes[0] == int.MinValue && indexes[1] == int.MinValue)
                {
                    if (zoomState == 1)
                    {
                        InkTool.getInstance().InkCanvasZoom(InkCanvas, zoomRate, zoomRate + 0.1 <= 3 ? zoomRate = zoomRate + 0.1 : zoomRate, 0.5, 0.5);
                        _videoSummarizationControl.InkCanvasShowRate.Content = (zoomRate * 100).ToString() + "%";
                    }
                    else if (zoomState == 2)
                    {
                        InkTool.getInstance().InkCanvasZoom(InkCanvas, zoomRate, zoomRate > 0.15 ? zoomRate = zoomRate - 0.1 : zoomRate, 0.5, 0.5);
                        _videoSummarizationControl.InkCanvasShowRate.Content = (zoomRate * 100).ToString() + "%";
                    }
                }
            }

            else if (indexes[0] != int.MinValue && indexes[1] == int.MinValue)
            {
                VideoSummarizationTool.locateMediaPlayer(
                    _spiralSummarization.InkCollector._mainPage.VideoSummarizationControl.mediaPlayer,
                    _spiralSummarization.KeyFrames[indexes[0]]);
            }
            pictureTracker.index = int.MinValue;
            indexes[0]           = int.MinValue;
            indexes[1]           = int.MinValue;
            zoomState            = 0;
            _pictureTrackers.Push(pictureTracker);
        }