|
| 1 | +using System.Collections.Generic; |
| 2 | + |
| 3 | +namespace BinaryKits.Zpl.Label.Elements |
| 4 | +{ |
| 5 | + public class ZplAztecBarcode : ZplPositionedElementBase, IFormatElement |
| 6 | + { |
| 7 | + public int MagnificationFactor { get; protected set; } |
| 8 | + public bool ExtendedChannel { get; protected set; } |
| 9 | + public int ErrorControl { get; protected set; } |
| 10 | + public bool MenuSymbol { get; protected set; } |
| 11 | + public int SymbolCount { get; protected set; } |
| 12 | + public string IdField { get; protected set; } |
| 13 | + public string Content { get; protected set; } |
| 14 | + public bool UseHexadecimalIndicator { get; protected set; } |
| 15 | + public FieldOrientation FieldOrientation { get; protected set; } |
| 16 | + |
| 17 | + /// <summary> |
| 18 | + /// Aztec Bar Code |
| 19 | + /// </summary> |
| 20 | + /// <param name="content"></param> |
| 21 | + /// <param name="positionX"></param> |
| 22 | + /// <param name="positionY"></param> |
| 23 | + /// <param name="magnificationFactor"></param> |
| 24 | + /// <param name="extendedChannel">extended channel interpretation code indicator</param> |
| 25 | + /// <param name="errorControl">error control and symbol size/type indicator</param> |
| 26 | + /// <param name="menuSymbol">menu symbol indicator</param> |
| 27 | + /// <param name="symbolCount">number of symbols for structured append</param> |
| 28 | + /// <param name="idField">optional ID field for structured append</param> |
| 29 | + /// <param name="useHexadecimalIndicator"></param> |
| 30 | + /// <param name="fieldOrientation"></param> |
| 31 | + /// <param name="bottomToTop"></param> |
| 32 | + public ZplAztecBarcode( |
| 33 | + string content, |
| 34 | + int positionX, |
| 35 | + int positionY, |
| 36 | + int magnificationFactor = 2, |
| 37 | + bool extendedChannel = false, |
| 38 | + int errorControl = 0, |
| 39 | + bool menuSymbol = false, |
| 40 | + int symbolCount = 1, |
| 41 | + string idField = null, |
| 42 | + bool useHexadecimalIndicator = true, |
| 43 | + FieldOrientation fieldOrientation = FieldOrientation.Normal, |
| 44 | + bool bottomToTop = false |
| 45 | + ) |
| 46 | + : base(positionX, positionY, bottomToTop) |
| 47 | + { |
| 48 | + this.Content = content; |
| 49 | + this.MagnificationFactor = magnificationFactor; |
| 50 | + this.ExtendedChannel = extendedChannel; |
| 51 | + this.ErrorControl = errorControl; |
| 52 | + this.SymbolCount = symbolCount; |
| 53 | + this.IdField = idField; |
| 54 | + this.UseHexadecimalIndicator = useHexadecimalIndicator; |
| 55 | + this.FieldOrientation = fieldOrientation; |
| 56 | + } |
| 57 | + |
| 58 | + ///<inheritdoc/> |
| 59 | + public override IEnumerable<string> Render(ZplRenderOptions context) |
| 60 | + { |
| 61 | + var result = new List<string>(); |
| 62 | + result.AddRange(RenderPosition(context)); |
| 63 | + result.Add($"^BO{RenderFieldOrientation(this.FieldOrientation)},{this.MagnificationFactor},{RenderBoolean(this.ExtendedChannel)}," + |
| 64 | + $"{this.ErrorControl},{RenderBoolean(this.MenuSymbol)},{this.SymbolCount},{this.IdField}"); |
| 65 | + result.Add($"^FD{this.Content}^FS"); |
| 66 | + |
| 67 | + return result; |
| 68 | + } |
| 69 | + |
| 70 | + /// <inheritdoc /> |
| 71 | + public void SetTemplateContent(string content) |
| 72 | + { |
| 73 | + this.Content = content; |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments