Subversion Repositories display

Rev

Rev 318 | 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: Jan 22, 2008
 */

package test.display;

import uk.me.parabola.imgfmt.app.ImgFileReader;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Steve Ratcliffe
 */

public class TableHeader {
    private int lon;
        private int lat;
        private long position;
    private final List<Integer> links = new ArrayList<>();

    public TableHeader() {
    }

    public TableHeader(ImgFileReader reader, int offset) {
        long orig = reader.position();
        reader.position(offset);
        reader.get();

                lon = reader.get3();
                lat = reader.get3();

        int na = reader.get() & 0xff;
        int nb = reader.get() & 0xff;
        reader.get(na * 5);

        for (int i = 0; i < nb; i++) {
            links.add(reader.getu3());
        }

        reader.position(orig);
    }

    public int getLink(int i) {
        if (i >= links.size())
            return -1;
        return links.get(i);
    }

    public void setLong(int lon) {
                this.lon = lon;
        }

        public void setLat(int lat) {
                this.lat = lat;
        }

        public int getLat() {
                return lat;
        }

        public int getLon() {
                return lon;
        }

        public void setPosition(long position) {
                this.position = position;
        }

        public long getPosition() {
                return position;
        }
}