Beispiel #1
0
        /// <summary>
        /// Handler for Triangle selection.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void m_renderer_SelectedTris(object sender, SelectTriangleEventArgs e)
        {
            if (!Input.GetKey(System.Windows.Forms.Keys.LControlKey))
            {
                foreach (Triangle tri in SelectedTriangles.SelectedItems)
                {
                    tri.IsSelected = false;
                }

                SelectedTriangles.SelectedItems.Clear();
            }

            if (e.SelectedTris.Count != 0)
            {
                foreach (Triangle tri in e.SelectedTris)
                {
                    if (SelectedTriangles.SelectedItems.Contains(tri))
                    {
                        tri.IsSelected = false;

                        SelectedTriangles.SelectedItems.Remove(tri);
                    }

                    else
                    {
                        tri.IsSelected = true;

                        SelectedTriangles.SelectedItems.Add(tri);
                    }
                }
            }


            PropGrid.Update();
        }
Beispiel #2
0
        /// <summary>
        /// Handles Triangle selection.
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnSelectObject(SelectTriangleEventArgs e)
        {
            EventHandler <SelectTriangleEventArgs> handler = SelectedTris;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Handler for selection of items in m_tree.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void m_tree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            SelectedCategory = null;
            SelectedGroup = null;

            if ((e.NewValue != null) && (e.NewValue.GetType() == typeof(Group)))
            {
                Group grp = e.NewValue as Group;

                SelectedGroup = grp;

                SelectTriangleEventArgs args = new SelectTriangleEventArgs();

                args.SelectedTris = new List<Triangle>(grp.Triangles);

                m_renderer_SelectedTris(this, args);
            }

            if ((e.NewValue != null) && (e.NewValue.GetType() == typeof(Category)))
            {
                SelectedCategory = (Category)e.NewValue;

                SelectTriangleEventArgs args = new SelectTriangleEventArgs();

                args.SelectedTris = new List<Triangle>();

                foreach (Group grp in SelectedCategory.Groups)
                {
                    foreach (Triangle tri in grp.Triangles)
                        args.SelectedTris.Add(tri);
                }

                m_renderer_SelectedTris(this, args);
            }

            else
                SelectedCategory = null;
        }