Exemplo n.º 1
0
        private static PositionMap _ParseChildren(ElementNode parentNode, PositionValue parentPosition)
        {
            // Traverse every node.  Nodes with the position property will affect the childrens'
            // positions.
            PositionMap childValues = new PositionMap();

            PositionModule positionProperty = parentNode.Properties.Get(PositionDescriptor._typeId) as PositionModule;

            foreach (ElementNode childNode in parentNode.Children)
            {
                PositionValue childPosition = positionProperty.GetPositionValues(childNode.Id);
                if (childPosition != null)
                {
                    // Parent has a modifying position for the child.
                    childPosition = _Multiply(parentPosition, childPosition);
                }
                else
                {
                    // Child inherits parent's position.
                    childPosition = new PositionValue(parentPosition);
                }

                childValues[childNode.Id] = childPosition;
                childValues.AddRange(_ParseChildren(childNode, childPosition));
            }

            return(childValues);
        }
Exemplo n.º 2
0
        public SetupForm(PositionModule positionProperty)
        {
            if(positionProperty.Owner == null) {
                throw new InvalidOperationException("Property must be attached to a node.");
            }

            InitializeComponent();

            _positionProperty = positionProperty;
            _children = _positionProperty.Owner.Children.ToArray();
            _positions = _children.Select(x => _positionProperty.GetPositionValues(x.Id)).ToArray();

            listBoxNodeChildren.DisplayMember = "Name";
            listBoxNodeChildren.ValueMember = "Id";
            listBoxNodeChildren.DataSource = _children;
        }
Exemplo n.º 3
0
        public SetupForm(PositionModule positionProperty)
        {
            if (positionProperty.Owner == null)
            {
                throw new InvalidOperationException("Property must be attached to a node.");
            }

            InitializeComponent();

            _positionProperty = positionProperty;
            _children         = _positionProperty.Owner.Children.ToArray();
            _positions        = _children.Select(x => _positionProperty.GetPositionValues(x.Id)).ToArray();

            listBoxNodeChildren.DisplayMember = "Name";
            listBoxNodeChildren.ValueMember   = "Id";
            listBoxNodeChildren.DataSource    = _children;
        }