Пример #1
0
        /// <summary> Constructor.     
        /// </summary>
        /// <param name="node">The encapsulated INode.</param>
        /// <param name="parent">The parent node.</param>
        /// <param name="model">The tree model using this NodeModel.</param>
        public NodeModel(INode node, CompositeNodeModel parent, Model model)
        {
            _node = node;
            _parent = parent;
            _model = model;
            model.IncrementNumberOfNodes();

            _z = new EuclidianVector();
        }
Пример #2
0
        /// <summary> Constructor.
        /// </summary>
        /// <param name="node">The encapsulated INode.</param>
        /// <param name="parent">The parent node.</param>
        /// <param name="model">The tree model using this NodeModel.</param>
        public NodeModel(INode node, CompositeNodeModel parent, Model model)
        {
            _node   = node;
            _parent = parent;
            _model  = model;
            model.IncrementNumberOfNodes();

            _z = new EuclidianVector();
        }
Пример #3
0
        private Dictionary <NodeView, Geodesic> _geodesics = null; // geodesics linking the children

        #endregion

        #region Constructor

        /// <summary> Constructor.
        /// </summary>
        /// <param name="father">The father of this node.</param>
        /// <param name="node">The encapsulated <see cref="NodeModel"/>.</param>
        /// <param name="renderer">The drawing model.</param>
        public CompositeNodeView(CompositeNodeView father, CompositeNodeModel node, Renderer renderer)
            : base(father, node, renderer)
        {
            _node       = node;
            _childNodes = new List <NodeView>();
            _geodesics  = new Dictionary <NodeView, Geodesic>();

            NodeView __child   = null;
            NodeView __brother = null;
            bool     __first   = true;
            bool     __second  = false;

            foreach (NodeModel childNode in _node.Children)
            {
                if (childNode.IsLeaf)
                {
                    __child = new NodeView(this, childNode, renderer);
                }
                else
                {
                    __child = new CompositeNodeView(this, (CompositeNodeModel)childNode, renderer);
                }
                this.AddChild(__child);
                if (__first)
                {
                    __brother = __child;
                    __first   = false;
                    __second  = true;
                }
                else if (__second)
                {
                    __child.Brother   = __brother;
                    __brother.Brother = __child;
                    __brother         = __child;
                    __second          = false;
                }
                else
                {
                    __child.Brother = __brother;
                    __brother       = __child;
                }
            }
        }
        /// <summary>Connstructor.
        /// </summary>
        /// <param name="node">The encapsulated INode.</param>
        /// <param name="parent">The parent node.</param>
        /// <param name="model">The tree model using this NodeModel.</param>
        public CompositeNodeModel(INode node, CompositeNodeModel parent, Model model)
            : base(node, parent, model)
        {
            _children = new List<NodeModel>();

            NodeModel __child = null;
            foreach (INode childNode in node.ChildNodes)
            {
                if (childNode.IsLeaf)
                {
                    __child = new NodeModel(childNode, this, model);
                }
                else
                {
                    __child = new CompositeNodeModel(childNode, this, model);
                }
                this.AddChild(__child);
            }

            // here the down of the tree is built, so we can compute the weight
            this.ComputeWeight();
        }
Пример #5
0
        /// <summary>Connstructor.
        /// </summary>
        /// <param name="node">The encapsulated INode.</param>
        /// <param name="parent">The parent node.</param>
        /// <param name="model">The tree model using this NodeModel.</param>
        public CompositeNodeModel(INode node, CompositeNodeModel parent, Model model)
            : base(node, parent, model)
        {
            _children = new List <NodeModel>();

            NodeModel __child = null;

            foreach (INode childNode in node.ChildNodes)
            {
                if (childNode.IsLeaf)
                {
                    __child = new NodeModel(childNode, this, model);
                }
                else
                {
                    __child = new CompositeNodeModel(childNode, this, model);
                }
                this.AddChild(__child);
            }

            // here the down of the tree is built, so we can compute the weight
            this.ComputeWeight();
        }