Exemplo 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>();
 }
Exemplo n.º 2
0
        private void Start(ScriptType scriptType)
        {
            UI.Cursor = System.Windows.Input.Cursors.Wait;
            Settings settings = new Settings();
            settings.electricSchemeTypeCode = 0;
            settings.firstPageFormat = "Формат А3 лист 1";
            settings.firstPageHeaderLineX = 0;
            settings.firstPageHeaderLineY = -12;
            settings.firstPageUttermostPositionY = -225;
            settings.subsequentPageFormat = "Формат А3_каб.журнал";
            settings.subsequentPageHeaderLineX = 0;
            settings.subsequentPageHeaderLineY = 287;
            settings.subsequentPageUttermostPositionY = 20;
            settings.lineFont = new E3Font();
            settings.headerFont = new E3Font(height: 3.5);
            settings.separatingSymbols = "?!.:, -";
            settings.verticalLineWidth = 0.5;
            settings.horizontalLineWidth = 0.2;
            settings.headerVerticalLineWidth = 0.5;
            settings.headerHorizontalLineWidth = 0.5;
            settings.bottomLineWidth = 0.5;
            settings.sheetTypeAttribute = "marka2";
            SaveSettings(settings);

            E3Project project = new E3Project(applicationInfo.ProcessId);
            Sheet sheet = project.GetSheetById(0);

            List<ConnectionInfo> connectionInfos;

            if (scriptType == ScriptType.ByConnections)
                connectionInfos = GetConnectionInfosByConnections(project, sheet, settings.electricSchemeTypeCode);
            else
                connectionInfos = GetConnectionInfosByCoresAndWires(project);

            connectionInfos.RemoveAll(ci => ci.assignmentFrom != ci.assignmentTo || String.IsNullOrEmpty(ci.assignmentFrom)); // удаляем все соединения, не идущие внутри одного шкафа
            ConnectionInfoComparer comparer = new ConnectionInfoComparer();
            connectionInfos.Sort(comparer);

            StringSeparator separator = new StringSeparator(settings.separatingSymbols.ToCharArray(), settings.lineFont, project.GetTextById(0));
            LineTemplate lineTemplate = new LineTemplate(new List<double>() { 35, 45, 45, 45, 45, 45, 45, 45, 45 }, settings.lineFont, 8, settings.verticalLineWidth, settings.horizontalLineWidth);
            LineTemplate headerLineTemplate = new LineTemplate(new List<double>() { 35, 45, 45, 45, 45, 45, 45, 45, 45 }, settings.headerFont, 8, settings.headerVerticalLineWidth, settings.headerHorizontalLineWidth);
            List<string> headerColumnNames = new List<string>(9){"Имя цепи", "От \"Места\"", "От \"Поз. обозначения\"", "От \"Вывода\"", "К \"Месту\"", "К \"Поз. обозначению\"", "К \"Выводу\"", "Тип провода", "Примечание"};
            Dictionary<string, Table> assignmentTables = new Dictionary<string, Table>();
            foreach (ConnectionInfo info in connectionInfos)
            {
                if (!assignmentTables.ContainsKey(info.assignmentFrom))
                {
                    HeaderText headerText = new HeaderText("Таблица соединений шкафа "+info.assignmentFrom, settings.headerFont, settings.headerFont.height + 1);
                    TablePageTemplate firstPageTemplate = new TablePageTemplate(settings.firstPageFormat, settings.firstPageHeaderLineX, settings.firstPageHeaderLineY, settings.firstPageUttermostPositionY, headerText);
                    TablePageTemplate subsequentPageTemplate = new TablePageTemplate(settings.subsequentPageFormat, settings.subsequentPageHeaderLineX, settings.subsequentPageHeaderLineY, settings.subsequentPageUttermostPositionY);
                    assignmentTables.Add(info.assignmentFrom, new Table(project, headerLineTemplate, headerColumnNames, lineTemplate, settings.bottomLineWidth, separator, firstPageTemplate, subsequentPageTemplate));
                }
                assignmentTables[info.assignmentFrom].AddLine(new List<string>(8) { info.signal, info.locationFrom, info.deviceFrom, info.pinFrom, info.locationTo, info.deviceTo, info.pinTo, info.type });
            }
            foreach (string key in assignmentTables.Keys)
            {
                assignmentTables[key].AddFinalGraphicLine();
                foreach (int id in assignmentTables[key].SheetIds)
                {
                    sheet.Id = id;
                    sheet.SetAttribute(settings.sheetTypeAttribute, key);
                }
            }
            project.Release();
            UI.Cursor = System.Windows.Input.Cursors.Arrow;
        }
Exemplo n.º 3
0
 public Table(E3Project project, LineTemplate headerLineTemplate, List<string> headerLineTexts, LineTemplate lineTemplate, double bottomLineWidth, StringSeparator separator, TablePageTemplate firstSheetTemplate)
     : this(project, headerLineTemplate,headerLineTexts, lineTemplate, bottomLineWidth, separator, firstSheetTemplate, null)
 {
 }
Exemplo n.º 4
0
 private List<int> CreateLineGraphics(double xLeft, double yTop, LineTemplate template, double lineHeight = 0 )
 {
     if (lineHeight == 0)
         lineHeight = template.Height;
     double yBottom = currentSheet.MoveDown(yTop, lineHeight);
     double xRight = currentSheet.MoveRight(xLeft, template.Width);
     List<int> ids = new List<int>();
     ids.Add(graphic.CreateLine(currentSheet.Id, xLeft, yTop, xRight, yTop, template.HorizontalLineWidth)); // верхняя горизонтальная линия
     ids.Add(graphic.CreateLine(currentSheet.Id, xLeft, yBottom, xRight, yBottom, template.HorizontalLineWidth)); // нижняя горизонтальная линия
     double xLine = xLeft;
     foreach (double width in template.ColumnWidths)
     {
         ids.Add(graphic.CreateLine(currentSheet.Id, xLine, yTop, xLine, yBottom, template.VerticalLineWidth)); // вертикальная линия
         xLine = currentSheet.MoveRight(xLine, width);
     }
     ids.Add(graphic.CreateLine(currentSheet.Id, xLine, yTop, xLine, yBottom, template.VerticalLineWidth)); // самая правая вертикальная линия
     return ids;
 }