Esempio n. 1
0
        public void DeletePart(int a_index)
        {
            if (a_index < m_collection.Count && a_index >= 0)
            {
                ModelPart     needDel  = m_collection[a_index];
                MeshElement3D modelDel = needDel.Node.GetModel();

                var parent = VisualTreeHelper.GetParent(modelDel);
                var pip    = parent.GetType().GetProperty("Children", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
                Visual3DCollection parentChildren = pip.GetValue(parent, null) as Visual3DCollection;
                parentChildren.Remove(modelDel);

                if (modelDel.Children.Count != 0)
                {
                    modelDel.Children.Clear();

                    int index = m_collection.IndexOf(needDel);
                    if (index > 0)
                    {
                        ModelPart parentModelPart = m_collection.ElementAt(index - 1);
                        parentModelPart.AddChild(m_collection.ElementAt(index + 1));
                    }
                    else
                    {
                        m_root.AddChild(m_collection.ElementAt(index + 1));
                    }
                }

                m_collection.Remove(needDel);
            }
        }
Esempio n. 2
0
 public void AddChild(ModelPart a_model)
 {
     if (a_model != null)
     {
         a_model.Node.SetTT(Node.GetTT());
         Node.GetModel().Children.Add(a_model.Node.GetModel());
     }
 }
Esempio n. 3
0
 public void AddChild(ModelPart a_model)
 {
     if (a_model != null)
     {
         a_model.Node.SetTT(Node.GetTT());
         Node.GetModel().Children.Add(a_model.Node.GetModel());
     }
 }
Esempio n. 4
0
        public void AddTruncatedCone()
        {
            ModelPart newModel = new ModelPart() { Name = "Part" + m_counter++, Node = new TruncatedConeNode() { TopRadius = 1, BaseRadius = 2, Height = 1, Normal = new Vector3D(0, 1, 0), Fill = new SolidColorBrush(Colors.Blue.ChangeAlpha(0x20)) } };

            if (m_collection.Count > 0)
            {
                ModelPart last = m_collection.Last();
                last.AddChild(newModel);
            }
            else
            {
                m_root.Node.GetModel().Children.Add(newModel.Node.GetModel());
            }

            m_collection.Add(newModel);
        }
Esempio n. 5
0
        public void SelectPart(int a_index)
        {
            if (a_index < m_collection.Count && a_index >= 0)
            {
                if (m_lastSelect != null)
                {
                    //m_lastSelect.Node.GetModel().Material = Materials.Blue;
                    m_lastSelect.Node.GetModel().Fill = new SolidColorBrush(Colors.Blue.ChangeAlpha(0x20));
                }

                ModelPart mp = m_collection[a_index];
                if (mp != null)
                {
                    //mp.Node.GetModel().Material = Materials.Yellow;
                    mp.Node.GetModel().Fill = new SolidColorBrush(Colors.Yellow.ChangeAlpha(0x20));
                }
                m_lastSelect = mp;
            }
        }
Esempio n. 6
0
        public void AddTruncatedCone()
        {
            ModelPart newModel = new ModelPart()
            {
                Name = "Part" + m_counter++, Node = new TruncatedConeNode()
                {
                    TopRadius = 1, BaseRadius = 2, Height = 1, Normal = new Vector3D(0, 1, 0), Fill = new SolidColorBrush(Colors.Blue.ChangeAlpha(0x20))
                }
            };

            if (m_collection.Count > 0)
            {
                ModelPart last = m_collection.Last();
                last.AddChild(newModel);
            }
            else
            {
                m_root.Node.GetModel().Children.Add(newModel.Node.GetModel());
            }

            m_collection.Add(newModel);
        }
Esempio n. 7
0
        public void SelectPart(int a_index)
        {
            if (a_index < m_collection.Count && a_index >= 0)
            {
                if (m_lastSelect != null)
                {
                    //m_lastSelect.Node.GetModel().Material = Materials.Blue;
                    m_lastSelect.Node.GetModel().Fill = new SolidColorBrush(Colors.Blue.ChangeAlpha(0x20));
                }

                ModelPart mp = m_collection[a_index];
                if (mp != null)
                {
                    //mp.Node.GetModel().Material = Materials.Yellow;
                    mp.Node.GetModel().Fill = new SolidColorBrush(Colors.Yellow.ChangeAlpha(0x20));
                }
                m_lastSelect = mp;
            }
        }