예제 #1
0
        public override string TeXChunk(PivotTable table)
        {
            var captionText = _builderRepository.ChunkFor(table.Caption);
            var pivoter     = new Pivoter();
            var pivotData   = pivoter.PivotData(table.Data, table.PivotInfo);

            return(TableWriter.PivotTable(captionText, table.Label, pivotData.DefaultView, table.Data.Table, table.PivotInfo, table.TexTranslations, table.Converter, _builderRepository));
        }
예제 #2
0
        public override void Build(BarPlot barPlot, BuildTracker tracker)
        {
            var captionText = _builderRepository.ChunkFor(barPlot.Caption);

            tracker.Track(barPlot.Caption.Items);
            tracker.Track(barPlot.Caption);

            tracker.TeX.Append(FigureWriter.BarPlotFigure(captionText, barPlot, TeX.Converter.DefaultConverter.Instance));
        }
        public override void Build(PlotTwoOrdinates plot, BuildTracker tracker)
        {
            var captionText = _builderRepository.ChunkFor(plot.Caption);

            tracker.Track(plot.Caption.Items);
            tracker.Track(plot.Caption);

            tracker.TeX.Append(FigureWriter.PlotTwoOrdinatesFigure(captionText, plot, TeX.Converter.DefaultConverter.Instance));
        }
예제 #4
0
        public override void Build(Figure figure, BuildTracker tracker)
        {
            var captionText = _builderRepository.ChunkFor(figure.Caption);

            tracker.Track(figure.Caption.Items);
            tracker.Track(figure.Caption);

            tracker.TeX.Append(FigureWriter.IncludeFigure(figure.Position, captionText, figure.Label, figure.RelativeFilePath, figure.Landscape, DefaultConverter.Instance));
        }
        public override void Build(ITransportBuilder transportBuilder, OSPSuiteTracker buildTracker)
        {
            var listToReport = new List <object>();

            listToReport.Add(new Paragraph(transportBuilder.Name));
            listToReport.AddRange(this.ReportDescription(transportBuilder, buildTracker));

            listToReport.Add(String.Format(Constants.PROPERTY_PROMPT_FORMAT, Constants.TYPE, transportBuilder.TransportType.ToString("F")));

            listToReport.Add(new SubParagraph(Constants.PLACE_OF_TRANSPORT));
            listToReport.Add(Constants.PLACE_OF_TRANSPORT_PHRASE);
            listToReport.Add(new LineBreak());
            listToReport.Add(new Par());
            var leftSide = new Text("{0}{1}", (new Text(Constants.SOURCE_CRITERIA)
            {
                FontStyle = Text.FontStyles.bold
            }),
                                    (new Text(_builderRepository.ChunkFor(transportBuilder.SourceCriteria))
            {
                Converter = NoConverter.Instance
            }));
            var rightSide = new Text("{0}{1}", (new Text(Constants.TARGET_CRITERIA)
            {
                FontStyle = Text.FontStyles.bold
            }),
                                     (new Text(_builderRepository.ChunkFor(transportBuilder.TargetCriteria))
            {
                Converter = NoConverter.Instance
            }));

            listToReport.Add(new SideBySide(leftSide, rightSide));

            listToReport.Add(new Paragraph(Constants.KINETIC));
            listToReport.Add(transportBuilder.Formula);

            if (transportBuilder.Parameters.Any())
            {
                listToReport.Add(new Paragraph(Constants.PARAMETERS));
                listToReport.Add(transportBuilder.Parameters.OrderBy(x => x.Name));
            }

            _builderRepository.Report(listToReport, buildTracker);
        }
예제 #6
0
        public override string TeXChunk(List list)
        {
            var texList = new List <string>();

            foreach (var item in list.Items)
            {
                texList.Add(_builderRepository.ChunkFor(item));
            }

            switch (list.ListStyle)
            {
            case List.ListStyles.enumerated:
                return(TeX.ListWriter.EnumeratedList(texList.ToArray()));

            default:
                return(TeX.ListWriter.ItemizedList(texList.ToArray()));
            }
        }
예제 #7
0
        public override string TeXChunk(StructureElement element)
        {
            var tex = new StringBuilder();

            tex.Append(Helper.Needspace(Helper.BaseLineSkip(6)));
            tex.Append(Helper.LineFeed());
            var content = (element.Text == null) ? element.Name : _builderRepository.ChunkFor(element.Text);

            if (string.IsNullOrEmpty(element.TableOfContentsTitle) || !element.CreateTableOfContentsEntry)
            {
                tex.Append(Helper.CreateStructureElement(element.Element, content, element.Converter, element.CreateTableOfContentsEntry));
            }
            else
            {
                tex.Append(Helper.CreateStructureElement(element.Element, content, element.Converter, element.TableOfContentsTitle));
            }

            tex.Append(Helper.Label(element.Label));
            tex.Append(Helper.LineFeed());
            return(tex.ToString());
        }
예제 #8
0
        public override string TeXChunk(T text)
        {
            if (string.IsNullOrEmpty(text.Content))
            {
                return(string.Empty);
            }

            string newText;

            if (text.Items.Count > 0)
            {
                newText = text.Content;
                for (var i = 0; i < text.Items.Count; i++)
                {
                    newText = newText.Replace($"{{{i}}}", $"@{i}@");
                }

                newText = text.Converter.StringToTeX(newText);

                for (var i = 0; i < text.Items.Count; i++)
                {
                    newText = newText.Replace($"@{i}@", $"{{{i}}}");
                }

                var texChunks = new List <object>();
                text.Items.Each(item => texChunks.Add(_builderRepository.ChunkFor(item)));

                newText = string.Format(newText, texChunks.ToArray());
            }
            else
            {
                newText = text.Converter.StringToTeX(text.Content);
            }

            return(AlignedText(text.Alignment, StyledText(text.FontStyle, newText)));
        }
 public override string TeXChunk(SideBySide sideBySide)
 {
     return(TeX.Helper.SideBySide(_builderRepository.ChunkFor(sideBySide.LeftSide),
                                  _builderRepository.ChunkFor(sideBySide.RightSide)));
 }
예제 #10
0
        public override string TeXChunk(Table table)
        {
            var captionText = _builderRepository.ChunkFor(table.Caption);

            return(TableWriter.Table(captionText, table.Label, table.Data, table.Converter, _builderRepository));
        }
예제 #11
0
        private static string createRow(DataRowView row, Dictionary <string, char> tableNotes, ITeXConverter converter, ITeXBuilderRepository builderRepository, DataRelation relation = null, int?level = null)
        {
            var rowLine = new StringBuilder();

            rowLine.Append(setPagebreakDesirability(getPagebreakDesirability(row, level)));

            var columnsCount = 0;

            foreach (DataColumn col in row.DataView.Table.Columns)
            {
                if (col.IsHidden())
                {
                    continue;
                }
                if (relation != null)
                {
                    if (relation.ChildColumns.Contains(col))
                    {
                        continue;
                    }
                }
                columnsCount++;
                if (columnsCount > 1)
                {
                    rowLine.AppendFormat(" {0} ", VALUE_SEPARATOR);
                }
                var colValue = row[col.ColumnName];
                if (colValue == null || colValue == DBNull.Value)
                {
                    continue;
                }
                // datatype specifics
                string value;
                if (col.DataType == typeof(double) || col.DataType == typeof(float))
                {
                    value = converter.StringToTeX(_numericFormatter.Format(Convert.ToDouble(colValue)));
                }
                else if (col.DataType == typeof(DateTime))
                {
                    value = converter.StringToTeX(((DateTime)colValue).ToShortTimeString());
                }
                else if (col.DataType == typeof(Text))
                {
                    value = builderRepository.ChunkFor(colValue);
                }
                else
                {
                    value = converter.StringToTeX(colValue.ToString());
                }
                rowLine.Append(value);
            }
            rowLine.Append(Helper.LineBreak());
            rowLine.Append(phantomline());
            var first = true;

            foreach (DataRelation childrelation in row.DataView.Table.ChildRelations)
            {
                var childView = row.CreateChildView(childrelation);
                if (childView.Count == 0)
                {
                    continue;
                }
                if (first)
                {
                    rowLine.Append(CLine(1, columnsCount));
                    first = false;
                }

                rowLine.Append(multiFirstColumn(columnsCount, ColumnAlignments.c,
                                                createChildTable(childView, tableNotes, childrelation, converter, builderRepository, ref level)));
                rowLine.Append(Helper.LineBreak());
                rowLine.Append(phantomline());
            }
            if (row.DataView.Table.ChildRelations.Count > 0)
            {
                rowLine.Append(CLine(1, columnsCount));
            }

            return(rowLine.ToString());
        }
예제 #12
0
 public override string TeXChunk(IEnumerable <IFormulaUsablePath> formulaUsablePaths)
 {
     return(_builderRepository.ChunkFor(tableFor(formulaUsablePaths)));
 }
 public override string TeXChunk(DescriptorCriteria descriptorCriteria)
 {
     return(_builderRepository.ChunkFor(listFor(descriptorCriteria)));
 }
예제 #14
0
 public override void Build(TextBox objectToReport, BuildTracker tracker)
 {
     tracker.TeX.Append(TeX.Helper.TextBox(objectToReport.Converter.StringToTeX(objectToReport.Title), _builderRepository.ChunkFor(objectToReport.Content)));
 }
예제 #15
0
 public override string TeXChunk(string stringToReport)
 {
     return(_builderRepository.ChunkFor(new Text(stringToReport)));
 }