예제 #1
0
        public Texts MapNewText(int[] destColumnsWidth)
        {
            Texts reMapTexts = new Texts();

            foreach (SignRowTextBlock rowRootBlock in this)
            {
                if (rowRootBlock.Count >= destColumnsWidth.Length)
                {
                    //从两头往中间映射
                    Texts beginTexts = new Texts();
                    Texts endTexts   = new Texts();
                    for (int beginPtr = 0, endPtr = rowRootBlock.Count - 1, destEptr = destColumnsWidth.Length - 1;
                         beginPtr <= endPtr && beginPtr <= destEptr; beginPtr++, endPtr--, destEptr--)
                    {
                        if (!rowRootBlock[beginPtr].EmptyBlock)
                        {
                            if (beginPtr == endPtr)
                            {
                                beginTexts.Add(rowRootBlock[beginPtr].Text.CopyInNewLoction(beginPtr + 1, beginPtr + 1));
                                break;
                            }
                            beginTexts.Add(rowRootBlock[beginPtr].Text.CopyInNewLoction(beginPtr + 1, beginPtr + 1));
                        }
                        if (!rowRootBlock[endPtr].EmptyBlock)
                        {
                            endTexts.Insert(0, rowRootBlock[endPtr].Text.CopyInNewLoction(destEptr + 1, destEptr + 1));
                        }
                    }
                    reMapTexts.AddRange(beginTexts);
                    reMapTexts.AddRange(endTexts);
                }
                else if (rowRootBlock.Count == 1)
                {
                    reMapTexts.Add(rowRootBlock[0].Text.CopyInNewLoction(1, destColumnsWidth.Length));
                }
                else
                {
                    //使用插桩分组方式
                    //0.053064275 0.156950673 0.091928251 0.200298954 0.183856502 0.313901345
                    //0.086956522 0.204508857 0.09178744 0.161030596 0.086956522 0.095008052 0.120772947 0.152979066
                    //能插入的位置为 1 ,2 , 3 ,4 ,5, 6, 7 取1  2  3  4    6 映ColumnIndex为 11 22 33 44 56 78
                    blockPercent  = rowRootBlock.BlockPercent();
                    columnPercent = GetColumnPercent(destColumnsWidth);
                    List <Point> groupLocation = GroupColumnArray();
                    for (int i = 0; i < rowRootBlock.Count; i++)
                    {
                        if (!rowRootBlock[i].EmptyBlock)
                        {
                            reMapTexts.Add(rowRootBlock[i].Text.CopyInNewLoction(groupLocation[i].X + 1, groupLocation[i].Y + 1));
                        }
                    }
                }
            }
            return(reMapTexts);
        }
예제 #2
0
        private void InitModuleByReport()
        {
            texts.Clear();
            int[] reportColumnsWidth = report.Columns.GetColumnsWidth(usedColumns);
            int[] x2columns          = null;
            if (usedColumns != null)
            {
                x2columns = new int[usedColumns.Length];
                for (int index = 1; index < usedColumns.Length; index++)
                {
                    x2columns[index] = x2columns[index - 1];
                    if (usedColumns[index] == 0)
                    {
                        x2columns[index] -= 1;
                    }
                }
            }

            Texts            tempRowTexts = null;
            SignRowTextBlock rowRootBlock = null;

            foreach (int bandID in bandsID)
            {
                for (int index = 0; index < report.Bands.BandDict[bandID].BandCount; index++)
                {
                    tempRowTexts = report.Texts.GetTextsBy(bandID, index + 1);
                    tempRowTexts = reMapTexts(tempRowTexts, usedColumns, x2columns, x2columns);
                    texts.AddRange(tempRowTexts);
                    rowRootBlock = new SignRowTextBlock(tempRowTexts, reportColumnsWidth);
                    Add(rowRootBlock);
                }
            }
        }