Subversion Repositories display

Rev

Rev 223 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2007 Steve Ratcliffe
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *
 * Author: Steve Ratcliffe
 * Create date: Dec 16, 2007
 */

package test.display;

/**
 * Standalone program to display the NET file as it is worked out.  Will start
 * out with what is in imgdecode by John Mechalas.
 *
 * Can produce a massive file, so may take some time to write.
 *
 * @author Steve Ratcliffe
 */

public class LblDisplay extends CommonDisplay {

        protected void print() {
                readCommonHeader();
                readHeader();
        }

        private void readHeader() {
                Displayer d = new Displayer(reader);
                d.setTitle("LBL header");
                long start = reader.position();

                readSection(d, "LBL 1 (labels)", 1, false, false);

                DisplayItem item = d.item();
                int offsetShift = item.setBytes(reader.get());
                item.addText("Label offsets x%d", 1 << offsetShift);
                d.byteValue("Label coding %d");
                readSection(d, "LBL 2 countries", 2, true, true);
                readSection(d, "LBL 3 regions", 3, true, true);
                readSection(d, "LBL 4 cities", 4, true, true);
                readSection(d, "LBL 5 poi index", 5, true, true);
                readSection(d, "LBL 6 poi properties", 6, false, false);

                d.byteValue("unk %d");
                d.byteValue("POI global properties %x");

                d.int3Value("unk %x");
                readSection(d, "LBL 7 poi types", 7, true, true);
                readSection(d, "LBL 8 zips", 8, true, true);
                readSection(d, "LBL 9 highways", 9, true, true);
                readSection(d, "LBL 10 exits", 10, true, true);
                readSection(d, "LBL 11 highway data", 11, true, true);

                d.charValue("code page %d");
                d.intValue("unk");

                readSection(d, "Sort descriptor", 12, false, false);
                readSection(d, "LBL 12 unknown", 12, false, true);

                if (getHeaderLen() > 196) {
                        readSection(d, "LBL 13", 13, false, true);
                        readSection(d, "LBL 14", 14, true, true);
                        readSection(d, "LBL 15", 15, true, true);
                }
                if (getHeaderLen() > 236) {
                        readSection(d, "LBL 16", 16, true, true);
                        readSection(d, "LBL 17", 17, true, true);
                        readSection(d, "LBL 18", 18, true, true);
                        readSection(d, "LBL 19", 19, true, true);
                        readSection(d, "LBL 20", 20, true, true);
                        readSection(d, "LBL 21", 21, true, true);
                        readSection(d, "LBL 22", 22, true, true);
                        readSection(d, "LBL 23", 23, false, true);
                        readSection(d, "LBL 24", 24, true, true);
                        readSection(d, "LBL 25", 25, true, true);
                        readSection(d, "LBL 26", 26, true, true);
                        readSection(d, "LBL 27", 27, true, true);
                        readSection(d, "LBL 28", 28, false, false);

                }
                int len = getHeaderLen() - COMMON_HEADER_LEN;
                d.rawValue((int) (len - (reader.position() - start)));

                d.print(outStream);
                analyze(outStream);
        }


        public static void main(String[] args) {
                if (args.length < 1) {
                        System.err.println("Usage: lbldisplay <filename>");
                        System.exit(1);
                }

                String name = args[0];

                CommonDisplay nd = new LblDisplay();
                nd.display(name, "LBL");
        }
}