示例#1
0
        public VerticalGroup(VerticalGroupList ownerVertGroupList, int groupNo,
                             HSpan[] hspans,
                             int startIndex,
                             int colCount)
        {
            _ownerVertGroupList = ownerVertGroupList;
            _hSpanColumns       = new HSpanColumn[colCount];
            GroupNo             = groupNo;
            int index = startIndex;

            for (int i = 0; i < colCount; ++i)
            {
                var col = new HSpanColumn(this, i);
                col.AddHSpan(hspans[index]);
                _hSpanColumns[i] = col;
                index++;
            }
            StartY = hspans[startIndex].y;
        }
示例#2
0
        public bool AddHSpans(HSpan[] hspans, int startIndex, int count)
        {
            int index = startIndex;

            //we must ...
            //1. touch one by one
            //and 2. no overlaped column
            for (int i = 0; i < _hSpanColumns.Length; ++i)
            {
                HSpanColumn col   = _hSpanColumns[i];
                HSpan       hspan = hspans[index];
                if (!col.BottomSideTouchWith(hspan.y, hspan.startX, hspan.endX))
                {
                    //found some 'untouch column'
                    //break all
                    //need another vertical group
                    return(false);
                }
                else if (i > 0 && _hSpanColumns[i - 1].BottomSideTouchWith(hspan.y, hspan.startX, hspan.endX))
                {
                    //see Test/Data/lion_1_v3_2.png for example
                    //check if current hspan dose not touch with prev column
                    //in this case => start a new column
                    return(false);
                }
                index++;
            }
            //---
            //pass all
            index = startIndex; //reset
            for (int i = 0; i < _hSpanColumns.Length; ++i)
            {
                HSpanColumn col = _hSpanColumns[i];
                col.AddHSpan(hspans[index]);
                index++;
            }
            return(true);
        }