Esempio n. 1
0
        /// <summary>
        /// Input kinect num when enter key is pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void t_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                try {
                    kinectNUM = Convert.ToInt32(iniTxtBx.Text);

                    if (kinectNUM > 0)
                    {
                        this.Content   = viewer;
                        viewer.Content = rootGrid;
                        GUIComponents guiComp = new GUIComponents(kinectNUM, this);
                        myServer      server  = new myServer(this, guiComp);

                        guiComp.setServer(server, this);
                    }
                    else
                    {
                        MessageBox.Show("Please enter number >=0");
                    }
                } catch {
                    MessageBox.Show("Please enter a positive number");
                }
            }
        }
Esempio n. 2
0
 public myClient(myServer inServer, TcpClient readClientConnected, TcpClient sendClientConnected, GUIComponents inParentGUI)
 {
     this.sendClientSocket = sendClientConnected;
     this.readClientSocket = readClientConnected;
     parentGUI             = inParentGUI;
     server = inServer;
 }
Esempio n. 3
0
        public static bool isWorking = true;//false;
        public FusedDataProcessor(int in_kinect_num, myServer in_server, GUIComponents.FusedComp in_guiGrid)
        {
            parentGUI       = in_guiGrid;
            kinectNum       = in_kinect_num;
            server          = in_server;
            infoTxtBlk      = in_guiGrid.infoTxtBlk;
            show_viewport3D = in_guiGrid.viewPort3D;
            getTransformationMatrix();
            updateDataThread = new UpdateDataThread(this);

            updateDataThreadInMain = new Thread(this.updateDataThread.ThreadProc);
            updateDataThreadInMain.IsBackground = true;
            updateDataThreadInMain.Start();
        }
Esempio n. 4
0
            /// <summary>
            /// Handle GUI components and layout
            /// </summary>
            /// <param name="parentGrid"></param>
            /// <param name="mw"></param>
            /// <param name="kinectNUM"></param>
            /// <param name="server"></param>
            public FusedComp(Grid parentGrid, MainWindow mw, int kinectNUM, myServer server)
            {
                show3DCheck.IsChecked = true;
                show3DCheck.Height    = itemHeight;
                show3DLabel.Content   = "Show 3D model";
                show3DLabel.Height    = itemHeight;

                sendFusedDataToKinectCheck.Height            = itemHeight;
                sendFusedDataToKinectCheck.IsChecked         = false;
                sendFusedDataToKinectCheck.VerticalAlignment = VerticalAlignment.Top;
                sendFusedDataToKinectCheck.Checked          += new RoutedEventHandler(sendFusedDataToKinectCheck_Checked);
                sendFusedDataToKinectCheck.Unchecked        += new RoutedEventHandler(sendFusedDataToKinectCheck_Unchecked);

                sendFusedDataToKinectLabel.Height            = itemHeight;
                sendFusedDataToKinectLabel.VerticalAlignment = VerticalAlignment.Top;
                sendFusedDataToKinectLabel.Content           = "Show fused data on client";

                updateGUICheck.Checked          += new RoutedEventHandler(updateGUICheck_Checked);
                updateGUICheck.Unchecked        += new RoutedEventHandler(updateGUICheck_Unchecked);
                updateGUICheck.IsChecked         = true;
                updateGUICheck.Height            = itemHeight;
                updateGUICheck.VerticalAlignment = VerticalAlignment.Top;

                updateGUILabel.Height            = itemHeight;
                updateGUILabel.VerticalAlignment = VerticalAlignment.Top;
                updateGUILabel.Content           = "Update GUI";

                trackBallMouse           = mw.trackball;
                viewPort3D               = mw.show_viewport3D;
                parentGrid.ShowGridLines = true;
                parentGrid.Width         = viewPortH;
                RowDefinition r0 = new RowDefinition();

                r0.Height = new GridLength(parentGrid.Height - viewPortH - itemHeight * 3);

                RowDefinition r1 = new RowDefinition();

                r1.Height = new GridLength(viewPortH + itemHeight * 3);

                ColumnDefinition c0 = new ColumnDefinition();

                c0.Width = new GridLength(viewPortH);

                parentGrid.RowDefinitions.Add(r1);
                parentGrid.ColumnDefinitions.Add(c0);
                parentGrid.RowDefinitions.Add(r0);

                trackBallMouse.Height = viewPortH;
                trackBallMouse.Width  = viewPortH;
                viewPort3D.Height     = viewPortH;
                viewPort3D.Width      = viewPortH;

                Grid.SetColumn(show3DLabel, 0);
                Grid.SetRow(show3DLabel, 0);
                show3DLabel.VerticalAlignment = VerticalAlignment.Top;
                show3DLabel.Margin            = new Thickness(20, 0, 0, 0);
                parentGrid.Children.Add(show3DLabel);

                show3DCheck.Margin = new Thickness(5, 7, 0, 0);
                Grid.SetColumn(show3DCheck, 0);
                Grid.SetRow(show3DCheck, 0);
                show3DCheck.VerticalAlignment = VerticalAlignment.Top;
                parentGrid.Children.Add(show3DCheck);


                sendFusedDataToKinectCheck.Margin = new Thickness(5, 7 + itemHeight, 0, 0);
                sendFusedDataToKinectLabel.Margin = new Thickness(20, itemHeight, 0, 0);
                Grid.SetColumn(sendFusedDataToKinectCheck, 0);
                Grid.SetRow(sendFusedDataToKinectCheck, 0);
                parentGrid.Children.Add(sendFusedDataToKinectCheck);
                parentGrid.Children.Add(sendFusedDataToKinectLabel);

                updateGUICheck.Margin = new Thickness(5, 7 + itemHeight * 2, 0, 0);
                updateGUILabel.Margin = new Thickness(20, itemHeight * 2, 0, 0);
                Grid.SetColumn(updateGUICheck, 0);
                Grid.SetRow(updateGUILabel, 0);
                parentGrid.Children.Add(updateGUILabel);
                parentGrid.Children.Add(updateGUICheck);

                mw.rootGrid.Children.Remove(trackBallMouse);
                trackBallMouse.VerticalAlignment = VerticalAlignment.Top;
                trackBallMouse.Margin            = new Thickness(0, itemHeight * 3, 0, 0);
                Grid.SetColumn(trackBallMouse, 0);
                Grid.SetRow(trackBallMouse, 0);
                parentGrid.Children.Add(trackBallMouse);

                infoTxtBlk.Text = "no data";
                Grid.SetColumn(infoTxtBlk, 0);
                Grid.SetRow(infoTxtBlk, 1);
                parentGrid.Children.Add(infoTxtBlk);


                PerspectiveCamera cam = new PerspectiveCamera();

                cam.FarPlaneDistance  = 100;
                cam.Position          = new Point3D(3, 3, 3);
                cam.FarPlaneDistance  = 100;
                cam.NearPlaneDistance = 0.1;
                cam.FieldOfView       = 70;
                cam.LookDirection     = new Vector3D(-1, -1, -1);
                cam.UpDirection       = new Vector3D(0, 1, 0);

                viewPort3D.Camera = cam;
                fp = new FusedDataProcessor(kinectNUM, server, this);
            }
Esempio n. 5
0
 /// <summary>
 /// Set the server to connect to
 /// </summary>
 /// <param name="in_server"></param>
 /// <param name="mw"></param>
 public void setServer(myServer in_server, MainWindow mw)
 {
     server = in_server;
     fc     = new FusedComp(fusedGrid, mw, kinectNUM, server);
 }