예제 #1
0
            bool execute_upload_command(int action, string data)
            {
                UploadCommands c = (UploadCommands)action;

                // server.updateServerMsg("Received data from " + getTypeString(clientType) + clientID + " : " + c.ToString());
                try
                {
                    switch (c)
                    {
                    case UploadCommands.Update_knect_data_in_Base64_format:    //	Update knect data in Base64 String format	Used by Kinect Client
                        if (clientType == (int)clientTypes.KINECT)
                        {
                            KinectData k = new KinectData();
                            k.AssignByAllParameterStringInBase64(data);
                            k.transformTo(GUIComponents.fc.fp.getTranfMatrix()[clientID]);
                            kinectParameter = k;
                            updateKinectInfo(kinectParameter.printKinectParameters());
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }

                    case UploadCommands.Update_fused_knect_data_in_Base64_format:    //	Update fused knect data in Base64 String format	Used by Data Processor Client
                        if (clientType == (int)clientTypes.DATA_PROCESSOR)
                        {
                            //  server.fusedKinectParametersString = data;

                            server.fusedKinectParameter.AssignByAllParameterStringInBase64(data);

                            return(true);
                        }
                        else
                        {
                            return(false);
                        }

                    case UploadCommands.Update_raw_data:
                        if (clientType == (int)clientTypes.KINECT)
                        {
                            parentGUI.kinectCompList[clientID].updateKinectImages(data);    //colorImageWritableBitmap,depthImageWritableBitmap);

                            return(true);
                        }
                        return(false);

                    default:
                        return(false);
                    }
                }
                catch
                {
                    return(false);
                }
            }
예제 #2
0
            public void updateKinectInfo(string text)
            {
                if (!MainWindow.getUpdateGUI())
                {
                    return;
                }

                if (clientType != (int)clientTypes.KINECT)
                {
                    return;
                }

                if (this.parentGUI.kinectCompList[clientID].g.Dispatcher.Thread != Thread.CurrentThread)
                {
                    this.parentGUI.kinectCompList[clientID].g.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new updateKinectInfouCallback(this.updateKinectInfo), text);
                }
                else
                {
                    /* print kinect parameters on GUI */
                    this.parentGUI.kinectCompList[clientID].infoTextBlock.Text = "[Kinect " + clientID + "]" + Environment.NewLine
                                                                                 + kinectParameter.printKinectParameters() + Environment.NewLine;
                }
            }
예제 #3
0
        public void updateResult(string text, bool draw)
        {
            if (this.infoTxtBlk.Dispatcher.Thread != Thread.CurrentThread)
            {
                this.infoTxtBlk.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new UpdateResultCallback(this.updateResult), text, draw);
            }
            else
            {
                try {
                    if (kinectList == null)
                    {
                        return;
                    }

                    this.infoTxtBlk.Text = "[Fused Kinect Result]" + Environment.NewLine + fusedKinectParameters.printKinectParameters();
                    //show synchy info
                    this.infoTxtBlk.Text = this.infoTxtBlk.Text + "[Synchy Info] num = " + GUIComponents.synchyList.Count + Environment.NewLine;
                    for (int i = 0; i < GUIComponents.synchyList.Count; ++i)
                    {
                        this.infoTxtBlk.Text = this.infoTxtBlk.Text + i + " : " + GUIComponents.synchyList[i].printSynchy() + Environment.NewLine;
                    }

                    MatrixProcessor mp = new MatrixProcessor();
                    server.fusedKinectParameter = fusedKinectParameters;

                    if (!draw)
                    {
                        return;
                    }

                    //3D plot functions
                    show_viewport3D.Children.Clear();
                    ClearViewport();

                    PerspectiveCamera cam = (PerspectiveCamera)show_viewport3D.Camera;
                    show_viewport3D.Children.Add(new ModelVisual3D()
                    {
                        Content = new DirectionalLight(Colors.White, new Vector3D(cam.LookDirection.X, cam.LookDirection.Y, cam.LookDirection.Z))
                    });
                    show_viewport3D.Children.Add(new ModelVisual3D()
                    {
                        Content = new DirectionalLight(Colors.White, new Vector3D(-cam.LookDirection.X, -cam.LookDirection.Y, -cam.LookDirection.Z))
                    });

                    drawSynchy();

                    PerspectiveCamera c = (PerspectiveCamera)show_viewport3D.Camera.GetCurrentValueAsFrozen();
                    for (int i = 0; i < transfMatrix.Count; ++i)
                    {
                        drawFrameAxis(i);
                    }

                    if (fusedKinectParameters != null)
                    {
                        if (fusedKinectParameters.skeletonArray != null)
                        {
                            for (int j = 0; j < fusedKinectParameters.skeletonArray.Length; ++j)
                            {
                                if (fusedKinectParameters.skeletonArray[j] != null)
                                {
                                    drawSkeleton(fusedKinectParameters.skeletonArray[j]);
                                }
                            }
                        }
                    }

                    show_viewport3D.UpdateLayout();
                } catch (Exception ex) {
                    string ss = ex.ToString();
                }
            }
        }