コード例 #1
0
ファイル: HandTracker.cs プロジェクト: aabrohi/kinect-kollage
        public void HandleTranslation(InteractiveImage image, float zoomFactory)
        {
            this.hoveredImage = image;
            hoveredImage.Hovered = true;
            
            pts_gathered++;

            if (isResizing)
            {
                return;
            }
            var handClosed = handData.FingerCount <= 1;
            if (isDragging)
            {
                hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory);
            }
            if (handClosed)
            {
                //if (pts_gathered % 2 == 0)
                    startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0);
                /*else
                {
                    startDragPoint.X += handData.PalmPoint.Value.X;
                    startDragPoint.Y += handData.PalmPoint.Value.Y;

                    startDragPoint.X = startDragPoint.X / pts_gathered % 2;
                    startDragPoint.Y = startDragPoint.Y / pts_gathered % 2;
                }*/
            }
            isDragging = handClosed;
        }
コード例 #2
0
        public void HandleTranslation(InteractiveImage image, float zoomFactory)
        {
            this.hoveredImage    = image;
            hoveredImage.Hovered = true;

            pts_gathered++;

            if (isResizing)
            {
                return;
            }
            var handClosed = handData.FingerCount <= 1;

            if (isDragging)
            {
                hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory);
            }
            if (handClosed)
            {
                //if (pts_gathered % 2 == 0)
                startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0);

                /*else
                 * {
                 *  startDragPoint.X += handData.PalmPoint.Value.X;
                 *  startDragPoint.Y += handData.PalmPoint.Value.Y;
                 *
                 *  startDragPoint.X = startDragPoint.X / pts_gathered % 2;
                 *  startDragPoint.Y = startDragPoint.Y / pts_gathered % 2;
                 * }*/
            }
            isDragging = handClosed;
        }
コード例 #3
0
        public void HandleTranslation(InteractiveImage image, float zoomFactory)
        {
            this.hoveredImage    = image;
            hoveredImage.Hovered = true;

            if (isResizing)
            {
                return;
            }
            var handClosed = handData.FingerCount <= 1;

            if (isDragging)
            {
                ////  hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory);
                //  //deteremine the direction of translation
                //  float dx = (handData.PalmPoint.Value.X - startDragPoint.X);
                //  float dy = (handData.PalmPoint.Value.Y - startDragPoint.Y);
                //  //move from right to left in x direction ,top to down in y direction
                //  if (dx > 0 && dy > 0)
                //  {
                //      controlModel("translate", "+{LEFT 3}");
                //      controlModel("translate", "+{DOWN 3}");

                //  }
                //  else if (dx > 0 && dy <0)
                //  {
                //      controlModel("translate", "+{LEFT 3}");
                //      controlModel("translate", "+{UP 3}");
                //  }
                //  else if (dx < 0 && dy < 0)
                //  {
                //      controlModel("translate", "+{RIGHT 3}");
                //      controlModel("translate", "+{UP 3}");
                //  }
                //  else
                //  {
                //      controlModel("translate", "+{RIGHT 10}");
                //      controlModel("translate", "+{DOWN 10}");
                //  }
            }
            if (handClosed)
            {
                startDragPoint = new Point(handData.FingerPoints[0].Location.X, handData.FingerPoints[0].Location.Y, 0);
                TargetsListofPoints.Add(new PointR(handData.FingerPoints[0].X, handData.FingerPoints[0].Y, Environment.TickCount));
            }
            isDragging = handClosed;
        }
コード例 #4
0
ファイル: ImageForm.cs プロジェクト: aabrohi/kinect-kollage
        private void AddImage()
        {
            FileInfo newestFile = null;

            foreach (string fileName in Directory.GetFiles(@"Y:\\", "*.jpg"))
            {
                FileInfo file = new FileInfo(fileName);

                if (newestFile == null || file.CreationTime > newestFile.CreationTime)
                {
                    newestFile = file;
                }
            }

            var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(newestFile.FullName), 100, 100);

            this.images.Add(newImage);
        }
コード例 #5
0
ファイル: ImageLoader.cs プロジェクト: an83/KinectTouch2
        public IList<InteractiveImage> LoadImages() 
        {
            var result = new List<InteractiveImage>();

            int x = this.startPositionX, y = this.startPositionY;
            foreach (var imagePath in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images"), "*.jpg"))
            {
                var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(imagePath), x, y);
                result.Add(newImage);
                x += (int)newImage.Area.Size.Width;
                if (x + newImage.Area.Size.Width > this.maxWidth)
                {
                    y += (int)newImage.Area.Size.Height;
                    x = startPositionX;
                }
            }

            return result;
        }
コード例 #6
0
        public IList <InteractiveImage> LoadImages()
        {
            var result = new List <InteractiveImage>();

            int x = this.startPositionX, y = this.startPositionY;

            foreach (var imagePath in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images"), "*.jpg"))
            {
                var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(imagePath), x, y);
                result.Add(newImage);
                x += (int)newImage.Area.Size.Width;
                if (x + newImage.Area.Size.Width > this.maxWidth)
                {
                    y += (int)newImage.Area.Size.Height;
                    x  = startPositionX;
                }
            }

            return(result);
        }
コード例 #7
0
ファイル: HandTracker.cs プロジェクト: an83/KinectTouch2
        public void HandleTranslation(InteractiveImage image, float zoomFactory)
        {
            this.hoveredImage = image;
            hoveredImage.Hovered = true;

            if (isResizing)
            {
                return;
            }
            var handClosed = handData.FingerCount <= 1;
            if (isDragging)
            {
                hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory);
            }
            if (handClosed)
            {
                startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0);
            }
            isDragging = handClosed;
        }
コード例 #8
0
        public void HandleTranslation(InteractiveImage image, float zoomFactory)
        {
            this.hoveredImage    = image;
            hoveredImage.Hovered = true;

            if (isResizing)
            {
                return;
            }
            var handClosed = handData.FingerCount <= 1;

            if (isDragging)
            {
                hoveredImage.Translate((handData.PalmPoint.Value.X - startDragPoint.X) * zoomFactory, (handData.PalmPoint.Value.Y - startDragPoint.Y) * zoomFactory);
            }
            if (handClosed)
            {
                startDragPoint = new Point(handData.PalmPoint.Value.X, handData.PalmPoint.Value.Y, 0);
            }
            isDragging = handClosed;
        }
コード例 #9
0
ファイル: ImageForm.cs プロジェクト: aabrohi/kinect-kollage
 private bool ImageContains(InteractiveImage image, Point center)
 {
     return(image.Area.Contains(MapPoint(center, this.handDataSource.Size)));
 }
コード例 #10
0
ファイル: ImageForm.cs プロジェクト: aabrohi/kinect-kollage
 private void MoveImageToFront(InteractiveImage image)
 {
     this.images.Remove(image);
     this.images.Add(image);
 }
コード例 #11
0
ファイル: ImageForm.cs プロジェクト: aabrohi/kinect-kollage
 private bool ImageContains(InteractiveImage image, Point center)
 {
     return image.Area.Contains(MapPoint(center, this.handDataSource.Size));
 } 
コード例 #12
0
ファイル: ImageForm.cs プロジェクト: aabrohi/kinect-kollage
 private void MoveImageToFront(InteractiveImage image)
 {
     this.images.Remove(image);
     this.images.Add(image);
 }
コード例 #13
0
ファイル: ImageForm.cs プロジェクト: aabrohi/kinect-kollage
        private void AddImage()
        {
            FileInfo newestFile = null;

            foreach (string fileName in Directory.GetFiles(@"Y:\\", "*.jpg"))
            {

                FileInfo file = new FileInfo(fileName);

                if (newestFile == null || file.CreationTime > newestFile.CreationTime)

                    newestFile = file;

            }

            var newImage = new InteractiveImage((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(newestFile.FullName), 100, 100);
            this.images.Add(newImage);
        }