Ejemplo n.º 1
0
 private void image_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (m_DragEnabled)
     {
         // update depth data
         m_DraggedObj.DepthArray = AssemblyZoneManager.getDepthArrayFromAssemblyZone(m_DraggedObj);
         AssemblyZoneManager.Instance.updateCurrentAssemblyZone(m_DraggedObj);
         m_DragEnabled = false;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Manual create a new AssemblyZone by clicking on to the GUI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createANewObj(object sender, MouseButtonEventArgs e)
        {
            Image <Gray, Int32> img = HciLab.Kinect.CameraManager.Instance.DepthImage;

            if (img != null)
            {
                // define a new zone
                AssemblyZone z = AssemblyZoneManager.Instance.createAssemblyZoneFromFactory();
                z.X = (int)e.GetPosition(m_Image).X;
                z.Y = (int)e.GetPosition(m_Image).Y;

                z.Z = img.Data[z.Y, z.X, 0];
                if (z.Z == 0)
                {
                    AssemblyZoneManager.Instance.decreaseIDByOne();
                    return;
                }

                // check if box is bigger than depth frame
                if (MANUAL_ZONE_WIDTH + z.X < img.Width)
                {
                    z.Width = MANUAL_ZONE_WIDTH;
                }
                else
                {
                    z.Width = img.Width - z.X;
                }

                if (MANUAL_ZONE_HEIGHT + z.Y < img.Height)
                {
                    z.Height = MANUAL_ZONE_HEIGHT;
                }
                else
                {
                    z.Height = img.Height - z.Y;
                }

                z.DepthArray = AssemblyZoneManager.getDepthArrayFromAssemblyZone(z);
                Resources["checkBoxCollection"] = null;
                AssemblyZoneManager.Instance.CurrentLayout.AssemblyZones.Add(z);
                Resources["checkBoxCollection"] = AssemblyZoneManager.Instance.CurrentLayout.AssemblyZones;
            }
        }