/* * Copyright (C) 2006 - 2012. * * 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 uk.me.parabola.imgfmt.app.trergn; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import uk.me.parabola.imgfmt.app.BitWriter; import uk.me.parabola.imgfmt.app.Coord; import uk.me.parabola.imgfmt.app.ImgFileWriter; import uk.me.parabola.imgfmt.app.Label; import uk.me.parabola.imgfmt.app.net.RoadDef; import uk.me.parabola.log.Logger; /** * Represents a multi-segment line. Eg for a road. As with all map objects * it can only exist as part of a subdivision. * * Writing these out is particularly tricky as deltas between points are packed * into the smallest number of bits possible. * * I am not trying to make the smallest map, so it will not be totally optimum. * * @author Steve Ratcliffe */ public class Polyline extends MapObject { private static final Logger log = Logger.getLogger(Polyline.class); // flags in the label offset private static final int FLAG_NETINFO = 0x800000; private static final int FLAG_EXTRABIT = 0x400000; // flags in the type private static final int FLAG_DIR = 0x40; private static final int FLAG_2BYTE_LEN = 0x80; // Reference to NET section, if any private RoadDef roaddef; // If a road gets subdivided into several segments, this // says whether this line is the last segment. Need this // for writing extra bits. private boolean lastSegment = true; // Set if it is a one-way street for example. private boolean direction; // further labels, if any private List