Debian Codegraph @

src/uk/me/parabola/imgfmt/app/mdr/Mdr18.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2011.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 or
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13 package uk.me.parabola.imgfmt.app.mdr;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import uk.me.parabola.imgfmt.app.ImgFileWriter;
19
20 /**
21 * This is an index into 19 showing the start of each new type.
22 *
23 * Section 19 creates the data for this, we just write it out here.
24 *
25 * @author Steve Ratcliffe
26 */
27 public class Mdr18 extends MdrSection implements HasHeaderFlags {
28 private List<Mdr18Record> poiTypes = new ArrayList<>();
29
30 public Mdr18(MdrConfig config) {
31 setConfig(config);
32 }
33
34 public void writeSectData(ImgFileWriter writer) {
35 int poiSize = getSizes().getSize(19);
36 for (Mdr18Record pt : poiTypes) {
37 writer.put2u(pt.getType() | 0x4000);
38 writer.putNu(poiSize, pt.getRecord());
39 }
40 }
41
42 public int getItemSize() {
43 return 2 + getSizes().getSize(19);
44 }
45
46 protected int numberOfItems() {
47 return poiTypes.size();
48 }
49
50 public void setPoiTypes(List<Mdr18Record> poiTypes) {
51 this.poiTypes = poiTypes;
52 }
53
54 public int getExtraValue() {
55 return 4 + getSizes().getSize(19)-1;
56 }
57 }