Subversion Repositories display

Rev

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

/*
 * Copyright (C) 2014 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 3 or
 * 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.
 */

package test.files;

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

import test.elements.Line;

/**
 * A single segment of a road. Roads in NET can have a number of lines as part of the road.
 *
 * @author Steve Ratcliffe
 */

public class Segment {
        private char div;
        private byte idx;
        private Line line;
        private int numPoints;

        public int getDiv() {
                return div & 0xffff;
        }

        public void setDiv(int div) {
                this.div = (char) (div & 0xffff);
        }

        public int getIdx() {
                return idx & 0xff;
        }

        public void setIdx(int idx) {
                this.idx = (byte) idx;
        }

        public int getDivAndNum() {
                return ((getDiv() << 16) & 0xffff0000) | getIdx();
        }

        public Line getLine() {
                return line;
        }

        public void setLine(Line line) {
                this.line = line;
                numPoints = line.getCoords().size();
        }

        public int getNumPoints() {
                return numPoints;
        }

        public Coord getCoord(int coordNumber) {
                return line.getCoords().get(coordNumber);
        }
}