| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
package uk.me.parabola.imgfmt.app.typ; |
| 14 |
|
| 15 |
import java.nio.charset.CharsetEncoder; |
| 16 |
import java.util.ArrayList; |
| 17 |
import java.util.List; |
| 18 |
|
| 19 |
import uk.me.parabola.imgfmt.app.srt.Sort; |
| 20 |
import uk.me.parabola.log.Logger; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public class TypData { |
| 28 |
private static final Logger log = Logger.getLogger(TypData.class); |
| 29 |
|
| 30 |
private final ShapeStacking stacking = new ShapeStacking(); |
| 31 |
private final TypParam param = new TypParam(); |
| 32 |
private final List<TypPolygon> polygons = new ArrayList<>(); |
| 33 |
private final List<TypLine> lines = new ArrayList<>(); |
| 34 |
private final List<TypPoint> points = new ArrayList<>(); |
| 35 |
private final List<TypIconSet> icons = new ArrayList<>(); |
| 36 |
|
| 37 |
private Sort sort; |
| 38 |
private CharsetEncoder encoder; |
| 39 |
|
| 40 |
public void addPolygonStackOrder(int level, int type, int subtype) { |
| 41 |
stacking.addPolygon(level, type, subtype); |
| 42 |
} |
| 43 |
|
| 44 |
public Sort getSort() { |
| 45 |
return sort; |
| 46 |
} |
| 47 |
|
| 48 |
public void setSort(Sort sort) { |
| 49 |
if (sort == null) |
| 50 |
return; |
| 51 |
|
| 52 |
if (this.sort != null) { |
| 53 |
int origCodepage = this.sort.getCodepage(); |
| 54 |
if (origCodepage != 0) { |
| 55 |
if (origCodepage != sort.getCodepage()) { |
| 56 |
|
| 57 |
|
| 58 |
log.warn("CodePage in TYP txt file:", sort.getCodepage(), "different from --code-page:", origCodepage); |
| 59 |
} |
| 60 |
} |
| 61 |
return; |
| 62 |
} |
| 63 |
this.sort = sort; |
| 64 |
encoder = sort.getCharset().newEncoder(); |
| 65 |
param.setCodePage(sort.getCodepage()); |
| 66 |
} |
| 67 |
|
| 68 |
public void setFamilyId(int val) { |
| 69 |
param.setFamilyId(val); |
| 70 |
} |
| 71 |
|
| 72 |
public void setProductId(int val) { |
| 73 |
param.setProductId(val); |
| 74 |
} |
| 75 |
|
| 76 |
public ShapeStacking getStacking() { |
| 77 |
return stacking; |
| 78 |
} |
| 79 |
|
| 80 |
public TypParam getParam() { |
| 81 |
return param; |
| 82 |
} |
| 83 |
|
| 84 |
public void addPolygon(TypPolygon polygon) { |
| 85 |
polygons.add(polygon); |
| 86 |
} |
| 87 |
|
| 88 |
public CharsetEncoder getEncoder() { |
| 89 |
return encoder; |
| 90 |
} |
| 91 |
|
| 92 |
public List<TypPolygon> getPolygons() { |
| 93 |
return polygons; |
| 94 |
} |
| 95 |
|
| 96 |
public void addLine(TypLine line) { |
| 97 |
lines.add(line); |
| 98 |
} |
| 99 |
|
| 100 |
public List<TypLine> getLines() { |
| 101 |
return lines; |
| 102 |
} |
| 103 |
|
| 104 |
public void addPoint(TypPoint point) { |
| 105 |
points.add(point); |
| 106 |
} |
| 107 |
|
| 108 |
public List<TypPoint> getPoints() { |
| 109 |
return points; |
| 110 |
} |
| 111 |
|
| 112 |
public void addIcon(TypIconSet current) { |
| 113 |
icons.add(current); |
| 114 |
} |
| 115 |
|
| 116 |
public List<TypIconSet> getIcons() { |
| 117 |
return icons; |
| 118 |
} |
| 119 |
} |