Example #1
0
        public static TreeViewItem GetTreeItems(Pointcloud data, GeometryModel3D[] models)
        {
            var treeItem = new TreeViewItem()
            {
                Header      = data.Name,
                DataContext = data
            };

            if (models == null)
            {
                return(null);
            }

            foreach (var model in models)
            {
                var subItem = new TreeViewItem()
                {
                    Header      = model.Name,
                    DataContext = model
                };

                var numberOfPointsItem = new TreeViewItem()
                {
                    Header = "Number of Points: " + ((PointGeometryModel3D)model).Geometry.Positions.Count
                };

                subItem.Items.Add(numberOfPointsItem);


                var hideItem = new TreeViewItem()
                {
                    Header = "hide",
                };

                hideItem.MouseUp += delegate(object sender, MouseButtonEventArgs args)
                {
                    if (model.Visibility == Visibility.Visible)
                    {
                        model.Visibility = Visibility.Hidden;
                        hideItem.Header  = "show";
                    }
                    else
                    {
                        model.Visibility = Visibility.Visible;
                        hideItem.Header  = "hide";
                    }
                };

                subItem.Items.Add(hideItem);

                treeItem.Items.Add(subItem);
            }

            return(treeItem);
        }
Example #2
0
        public static GeometryModel3D[] GetModels(NViewMatch nvm)
        {
            var showCameras = true;

            var tg = new MatrixTransform3D(nvm.Transform);

            List <GeometryModel3D> models = new List <GeometryModel3D>();

            if (showCameras)
            {
                foreach (var cameraPosition in nvm.CameraPositions)
                {
                    var pos = GetCamera(cameraPosition);

                    foreach (var c in pos)
                    {
                        c.Transform = tg;
                        models.Add(c);
                    }
                }
            }

            if (nvm.Patches.Count <= 0)
            {
                return(models.ToArray());
            }

            PointGeometryModel3D model = new PointGeometryModel3D();

            model.Color = Color.White;

            model.Geometry = Pointcloud.ConvertToPointGeometry3D(
                nvm.Patches.Select(patch => new PclWrapper.Points
            {
                x = patch.Position.X,
                y = patch.Position.Y,
                z = patch.Position.Z,
                r = (byte)patch.Color.Red,
                g = (byte)patch.Color.Green,
                b = (byte)patch.Color.Blue,
                a = 255
            }).ToArray());

            models.Add(model);

            model.Transform = tg;

            return(models.ToArray());
        }
Example #3
0
    /// <summary>
    /// Draw buttons to swap current behavior.
    /// </summary>
    private void OnGUI()
    {
        GUIStyle  scanButtonStyle = new GUIStyle("button");
        Texture2D blueTexture     = new Texture2D(1, 1);

        blueTexture.SetPixel(0, 0, new Color(0.0F, 0.4F, 1.0F, 0.8F));
        blueTexture.Apply();
        scanButtonStyle.normal.background = blueTexture;
        scanButtonStyle.fontSize          = 25;


        Pointcloud pointCloudRef = GameObject.Find("Tango Point Cloud Controller").GetComponent <Pointcloud>();

        if (GUI.Button(new Rect(Screen.width - 270, Screen.height - 200, 250, 80), "First Person View", scanButtonStyle))
        {
            EnableCamera(CameraType.FIRST_PERSON);
            pointCloudRef.ClearPointClouds();
            pointCloudRef.m_scan_state = Pointcloud.SCAN_STATE_OFF;
        }

        if (GUI.Button(new Rect(Screen.width - 270, Screen.height - 100, 250, 80), "Third Person View", scanButtonStyle))
        {
            EnableCamera(CameraType.THIRD_PERSON);
            pointCloudRef.ClearPointClouds();
            pointCloudRef.m_scan_state = Pointcloud.SCAN_STATE_OFF;
        }

        /*if (GUI.Button(new Rect(Screen.width - Common.UI_BUTTON_SIZE_X - Common.UI_BUTTON_GAP_X,
         *                      Screen.height - ((Common.UI_BUTTON_SIZE_Y + Common.UI_LABEL_GAP_Y) * 3),
         *                      Common.UI_BUTTON_SIZE_X,
         *                              Common.UI_BUTTON_SIZE_Y), "<size=20>First</size>", scanButtonStyle))
         *      {
         *  EnableCamera(CameraType.FIRST_PERSON);
         * }
         *      if (GUI.Button(new Rect(Screen.width - Common.UI_BUTTON_SIZE_X - Common.UI_BUTTON_GAP_X,
         *                              Screen.height - ((Common.UI_BUTTON_SIZE_Y + Common.UI_LABEL_GAP_Y) * 2),
         *                              Common.UI_BUTTON_SIZE_X,
         *                              Common.UI_BUTTON_SIZE_Y), "<size=20>Third</size>", scanButtonStyle))
         *      {
         *              EnableCamera(CameraType.THIRD_PERSON);
         *      }*/
    }
Example #4
0
 public static GeometryModel3D[] GetModels(Pointcloud pointcloud)
 {
     return(GetModels((PointGeometry3D)pointcloud.Data));
 }