Ejemplo n.º 1
0
 public Table(E3Project project, LineTemplate headerLineTemplate, List<string> headerLineTexts, LineTemplate lineTemplate, double bottomLineWidth, StringSeparator separator, TablePageTemplate firstPagetTemplate, TablePageTemplate subsequentPageTemplate = null )
 {
     this.project = project;
     this.firstPageTemplate = firstPagetTemplate;
     if (subsequentPageTemplate == null)
         this.subsequentPageTemplate = firstPagetTemplate;
     else
         this.subsequentPageTemplate = subsequentPageTemplate;
     this.headerLineTemplate = headerLineTemplate;
     this.bottomLineWidth = bottomLineWidth;
     this.headerLineTexts = headerLineTexts;
     this.lineTemplate = lineTemplate;
     this.separator = separator;
     this.graphic = project.GetGraphicById(0);
     this.group = project.GetGroupById(0);
     this.text = project.GetTextById(0);
     currentSheet = project.GetSheetById(0);
     sheetCount = 0;
     sheetIds = new List<int>();
 }
Ejemplo n.º 2
0
 private void PlaceSchemes(List<SymbolScheme> schemes, E3Project project, Sheet sheet, E3Text text, string sheetMark)
 {
     double gridStep = 4;
     Group group = project.GetGroupById(0);
     Graphic graphic = project.GetGraphicById(0);
     int sheetCount=1;
     CreateSheet(sheet, sheetMark, ref sheetCount);
     bool needToCreate = false;
     double availableWith = sheet.DrawingArea.Width * 0.9;
     double startX = sheet.MoveRight(sheet.DrawingArea.Left, sheet.DrawingArea.Width * 0.05);
     Point sheetCenter = new Point(sheet.MoveRight(sheet.DrawingArea.Left, sheet.DrawingArea.Width / 2), sheet.MoveDown(sheet.DrawingArea.Top, sheet.DrawingArea.Height / 2));
     double totalSchemeWidth = gridStep;
     List<SymbolScheme> notPlacedSchemes = new List<SymbolScheme>();
     foreach (SymbolScheme scheme in schemes)
     {
         if (scheme.Size.Width > availableWith)
         {
             if (needToCreate)
                 CreateSheet(sheet, sheetMark, ref sheetCount);
             else
                 needToCreate = true;
             scheme.Place(sheet, graphic, group, text, sheetCenter);
             continue;
         }
         totalSchemeWidth += scheme.Size.Width + gridStep;
         if (totalSchemeWidth < availableWith)
             notPlacedSchemes.Add(scheme);
         else
         {
             if (needToCreate)
                 CreateSheet(sheet, sheetMark, ref sheetCount);
             else
                 needToCreate = true;
             double width = notPlacedSchemes.Sum(s => s.Size.Width);
             double totalGap = availableWith - width;
             double gap = totalGap / (notPlacedSchemes.Count + 1);
             double x = startX;
             foreach (SymbolScheme notPlacedScheme in notPlacedSchemes)
             {
                 x = sheet.MoveRight(x, gap + notPlacedScheme.Size.Width / 2 );
                 notPlacedScheme.Place(sheet, graphic, group, text, new Point(x, sheetCenter.Y));
                 x = sheet.MoveRight(x, notPlacedScheme.Size.Width / 2);
             }
             notPlacedSchemes.Clear();
             totalSchemeWidth = gridStep + scheme.Size.Width;
             notPlacedSchemes.Add(scheme);
         }
     }
     if (notPlacedSchemes.Count > 0)
     {
         if (needToCreate)
             CreateSheet(sheet, sheetMark, ref sheetCount);
         double width = notPlacedSchemes.Sum(s => s.Size.Width);
         double totalGap = availableWith - width;
         double gap = totalGap / (notPlacedSchemes.Count + 1);
         double x = startX;
         foreach (SymbolScheme notPlacedScheme in notPlacedSchemes)
         {
             x = sheet.MoveRight(x, gap + notPlacedScheme.Size.Width / 2);
             notPlacedScheme.Place(sheet, graphic, group, text, new Point(x, sheetCenter.Y));
             x = sheet.MoveRight(x, notPlacedScheme.Size.Width / 2);
         }
     }
 }