Esempio n. 1
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;
        }
Esempio n. 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;
        }
        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;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
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;
        }
        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);
        }
Esempio n. 7
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;
        }
Esempio n. 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;
        }
Esempio n. 9
0
 private bool ImageContains(InteractiveImage image, Point center)
 {
     return(image.Area.Contains(MapPoint(center, this.handDataSource.Size)));
 }
Esempio n. 10
0
 private void MoveImageToFront(InteractiveImage image)
 {
     this.images.Remove(image);
     this.images.Add(image);
 }
Esempio n. 11
0
 private bool ImageContains(InteractiveImage image, Point center)
 {
     return image.Area.Contains(MapPoint(center, this.handDataSource.Size));
 } 
Esempio n. 12
0
 private void MoveImageToFront(InteractiveImage image)
 {
     this.images.Remove(image);
     this.images.Add(image);
 }
Esempio n. 13
0
        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);
        }