示例#1
0
        internal static int CompareNodesByPosition(FlexNodeBase x, FlexNodeBase y)
        {
            int result;

            if (TryCompareNullNodes(x, y, out result))
            {
                return(result);
            }

            long xPosition = (long)int.MaxValue * x.DataItem.Top + x.DataItem.Left;
            long yPosition = (long)int.MaxValue * y.DataItem.Top + y.DataItem.Left;

            return(xPosition.CompareTo(yPosition));
        }
示例#2
0
        private static bool TryCompareNullNodes(FlexNodeBase x, FlexNodeBase y, out int result)
        {
            if (x == null && y == null)
            {
                result = 0;
                return(true);
            }
            if (x == null)
            {
                result = -1;
                return(true);
            }
            if (y == null)
            {
                result = 1;
                return(true);
            }
            if (x.DataItem == null && y.DataItem == null)
            {
                result = 0;
                return(true);
            }
            if (x.DataItem == null)
            {
                result = -1;
                return(true);
            }
            if (y.DataItem == null)
            {
                result = 1;
                return(true);
            }

            result = 0;
            return(false);
        }
示例#3
0
        /// <summary>
        /// For a node returns 1. number of levels (in depth) of children 2. max number of children in a level
        /// для узла узнает количество уровней потомков и максимальное количество потомков на уровне
        /// </summary>
        /// <param name="node"></param>
        /// <param name="depth">returns value</param>
        /// <param name="count">returns value</param>
        /// <returns></returns>
        private static void GetNodeDepthWidth(FlexNodeBase node, ref int depth, ref int count)
        {
            var retCount = 0;
            var retDepth = depth + 1;

            if (node.ChildListCount > 0)
            {
                foreach (var nodeChild in node.ChildList)
                {
                    int tempCount = 0;
                    int tempDepth = 0;
                    GetNodeDepthWidth(nodeChild, ref tempDepth, ref tempCount);
                    retCount += tempCount;
                    retDepth  = Math.Max(retDepth, tempDepth + 1);
                }
            }
            else
            {
                retCount = 1;
            }

            count = Math.Max(retCount, count);
            depth = retDepth;
        }
示例#4
0
 public FlexNodeReport(FlexNodeBase parentNode, FlexItem item)
     : base(parentNode, item)
 {
 }