示例#1
0
        /// <summary>
        /// Dynamically removes visible
        /// </summary>
        /// <param name="position">Position of visible to add</param>
        public override void DynamicalRemove(SerializablePosition position)
        {
            RemoveVisible(position);
            IWpfVisible v   = position.Parameters as IWpfVisible;
            Action      act = () =>
            {
                Visual3D vis = v.GetVisual(this);
                if (vis != null)
                {
                    viewport.Children.Remove(vis);
                }
                dict.Remove(position);
            };

            control.Dispatcher.Invoke(act);
        }
示例#2
0
        internal void Init()
        {
            int count = Count;

            FieldOfView = fieldOfView;
            viewport.Children.Clear();
            dict.Clear();
            for (int i = 0; i < count; i++)
            {
                SerializablePosition p   = this[i] as SerializablePosition;
                IWpfVisible          v   = p.Parameters as IWpfVisible;
                Visual3D             vis = v.GetVisual(this);
                if (vis != null)
                {
                    dict[p] = vis;
                    viewport.Children.Add(vis);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Dynamically adds visible
        /// </summary>
        /// <param name="position">Position of visible to add</param>
        public override void DynamicalAdd(SerializablePosition position)
        {
            if (!show)
            {
                return;
            }
            AddVisible(position);
            IWpfVisible v   = position.Parameters as IWpfVisible;
            Action      act = () =>
            {
                Visual3D vis = v.GetVisual(this);
                if (vis != null)
                {
                    viewport.Children.Add(vis);
                }
                dict[position] = vis;
            };

            control.Dispatcher.Invoke(act);
        }