예제 #1
0
 public void Run(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
 {
     foreach (PaneGrp grp in panegrps)
     {
         pages.AddPaneGrp(grp);
     }
 }
예제 #2
0
 public void Run(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
 {
     DistribAlgImpl impl = null;
     switch (layout.DistribType)
     {
         case DistribType.Book:
             impl = new BookDistribAlgImpl(pages, panegrps, layout);
             break;
         case DistribType.Lines:
             impl = new LinesDistribAlgImpl(pages, panegrps, layout);
             break;
     }
     impl.Run();
 }
예제 #3
0
        public FormattedBook(LogPages pages, BookLayout layout, PageDrawOptions opts)
        {
            m_layout = layout;
            m_hcnt = layout.HorizontalCount;
            m_vcnt = layout.VerticalCount;
            m_pagesPerSheet = 2 * m_vcnt * m_hcnt;
            m_opts = opts;

            List<LogPage> tmp = new List<LogPage>();
            tmp.AddRange(pages.Pages);
            m_originalPages = tmp.ToArray();

            m_smallPageCount = pages.Count;

            // logicke stranky doplnene o null
            List<LogPage> virtpages = new List<LogPage>();
            virtpages.AddRange(pages.Pages);

            while (m_smallPageCount % m_pagesPerSheet > 0)
            {
                m_smallPageCount++;
                virtpages.Add(null);
            }

            // logicke stranky doplnene o null obracene
            List<LogPage> revvirtpages = new List<LogPage>();
            revvirtpages.AddRange(virtpages);
            revvirtpages.Reverse();

            m_sheetCount = m_smallPageCount / m_pagesPerSheet;

            m_pages = new LogPage[m_smallPageCount];

            if (layout.DistribType == DistribType.Lines)
            {
                IEnumerator<LogPage> actpage = virtpages.GetEnumerator();
                for (int i = 0; i < m_sheetCount; i++)
                {
                    for (int l = 0; l < m_vcnt; l++)
                    {
                        for (int j = 0; j < 2; j++)
                        {
                            for (int k = 0; k < m_hcnt; k++)
                            {
                                actpage.MoveNext();
                                m_pages[PageIndex(i, k, l, j)] = actpage.Current;
                            }
                        }
                    }
                }
            }
            if (layout.DistribType == DistribType.Book)
            {
                if (m_hcnt % 2 == 1) // liche horizontalne
                {
                    for (int i = 0; i < m_smallPageCount; i++) m_pages[i] = virtpages[i];
                }
                else // sude horizontalne
                {
                    IEnumerator<LogPage> incer = virtpages.GetEnumerator();
                    IEnumerator<LogPage> decer = revvirtpages.GetEnumerator();
                    for (int i = 0; i < m_smallPageCount; i += 4)
                    {
                        incer.MoveNext(); m_pages[i + 0] = incer.Current;
                        incer.MoveNext(); m_pages[i + 1] = incer.Current;
                        decer.MoveNext(); m_pages[i + 2] = decer.Current;
                        decer.MoveNext(); m_pages[i + 3] = decer.Current; 
                    }
                }
            }
        }
예제 #4
0
 public DistribAlgImpl(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
 {
     m_pages = pages;
     m_stack.AddRange(panegrps);
     m_layout = layout;
 }
예제 #5
0
 public LinesDistribAlgImpl(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
     : base(pages, panegrps, layout)
 {
 }