Skip to content
Commits on Source (5)
......@@ -407,6 +407,7 @@
<include name="styles/default/**"/>
<include name="styles/noname/**"/>
<include name="chars/ascii/row02.trans"/>
<include name="typ-files/**"/>
</fileset>
</copy>
......
mkgmap (0.0.0+svn4380-2) UNRELEASED; urgency=medium
mkgmap (0.0.0+svn4398-1) unstable; urgency=medium
* New upstream SVN snapshot.
* Drop Name field from upstream metadata.
* Update copyright file.
-- Bas Couwenberg <sebastic@debian.org> Mon, 09 Dec 2019 09:19:15 +0100
-- Bas Couwenberg <sebastic@debian.org> Wed, 01 Jan 2020 08:52:05 +0100
mkgmap (0.0.0+svn4380-1) unstable; urgency=medium
......
......@@ -13,7 +13,8 @@ Copyright: 2006-2015, Steve Ratcliffe <sr@parabola.me.uk>
2015, Maxim Duester
License: GPL-2+
Files: src/uk/me/parabola/mkgmap/combiners/GmapiBuilder.java
Files: resources/typ-files/mapnik.txt
src/uk/me/parabola/mkgmap/combiners/GmapiBuilder.java
src/uk/me/parabola/imgfmt/app/dem/DEMFile.java
src/uk/me/parabola/imgfmt/app/dem/DEMHeader.java
src/uk/me/parabola/imgfmt/app/dem/DEMSection.java
......
svn.version: 4380
build.timestamp: 2019-11-28T14:08:04+0000
svn.version: 4398
build.timestamp: 2019-12-18T08:25:16+0000
......@@ -44,8 +44,8 @@ prefix1:it = "Via", "Piazza", "Viale"
prefix2:it = "del ", "dei ", "della ", "delle ", "di "
# portugese
prefix1:pt = "Rua", "Avenida", "Travessa"
prefix2:pt = "da ", "do ", "de ", "das ", "dos "
prefix1:pt = "Rua", "Avenida", "Travessa", "Alameda", "Beco", "Estrada", "Rodovia"
prefix2:pt = "da ", "do ", "de ", "das ", "dos ", "d'"
# spanish
prefix1:es = "Avenida", "Calle", "Paseo"
......@@ -56,9 +56,11 @@ prefix2:es = "de las ", "de los ", "de la ", "del ", "de ", "d'", "las ", "los "
# Map three letter ISO country codes to list of used languages for road names.
# It is assumed that the style sets mkgmap:country to one of these ISO codes.
lang:AGO = pt
lang:AND = es, ca
lang:ARG = es
lang:BOL = es
lang:BRA = pt
lang:CAN = en, fr
lang:CHE = de, fr, it
lang:CHL = es
......@@ -72,10 +74,12 @@ lang:ESH = es
lang:ESP = es, gl, eu, ca
lang:FRA = fr
lang:GBR = en
lang:GNB = pt
lang:GTM = es
lang:GUY = en
lang:HND = es
lang:MEX = es
lang:MOZ = pt
lang:NIC = es
lang:PAN = es
lang:PER = es
......
This diff is collapsed.
;-------------------------------------------------------------------------------
; This is an example TYP file.
; A TYP file controls how the Garmin device renders polygons, lines and points.
; See https://wiki.openstreetmap.org/wiki/Mkgmap/help/typ_compile
; for more information.
;
; This example sets most polygons to have the same drawOrder
; See https://wiki.openstreetmap.org/wiki/Editing_OSM_Map_On_Garmin/Area_Types
; so that mkgmap option --order-by-decreasing-area works in an optimum manner.
; It exposes all the known non-extended Garmin polygon representations, eg
; 0x01-0x03=City and provides some hidden polygons for naming large areas such
; as Counties, Islands...
;-------------------------------------------------------------------------------
;
[_drawOrder]
; nothing shows, even with: Type=0x00,2
Type=0x01,2
Type=0x02,2
Type=0x03,2
Type=0x04,2
Type=0x05,2
Type=0x06,2
; 0x07/Airport default drawOrder is lower that most other polygons on some Garmin devices; make it the same.
Type=0x07,2
Type=0x08,2
Type=0x09,2
Type=0x0a,2
Type=0x0b,2
Type=0x0c,2
Type=0x0d,2
Type=0x0e,2
Type=0x0f,2
Type=0x10,2
Type=0x11,2
Type=0x12,2
Type=0x13,2
; the following Greens default drawOrder is lower than most on some Garmin devices; make them the same.
Type=0x14,2
Type=0x15,2
Type=0x16,2
Type=0x17,2
Type=0x18,2
Type=0x19,2
Type=0x1a,2
Type=0x1b,2
Type=0x1c,2
Type=0x1d,2
Type=0x1e,2
Type=0x1f,2
Type=0x20,2
; to here
Type=0x21,2
Type=0x22,2
Type=0x23,2
Type=0x24,2
Type=0x25,2
Type=0x26,2
Type=0x27,2
Type=0x28,2
Type=0x29,2
Type=0x2a,2
Type=0x2b,2
Type=0x2c,2
Type=0x2d,2
Type=0x2e,2
Type=0x2f,2
Type=0x30,2
Type=0x31,2
Type=0x32,2
Type=0x33,2
Type=0x34,2
Type=0x35,2
Type=0x36,2
Type=0x37,2
Type=0x38,2
Type=0x39,2
Type=0x3a,2
Type=0x3b,2
Type=0x3c,2
Type=0x3d,2
Type=0x3e,2
Type=0x3f,2
Type=0x40,2
Type=0x41,2
Type=0x42,2
Type=0x43,2
Type=0x44,2
Type=0x45,2
Type=0x46,2
Type=0x47,2
Type=0x48,2
Type=0x49,2
; The following two are overview/main background. Give them a lower drawOrder.
Type=0x4a,1
Type=0x4b,1
Type=0x4c,2
Type=0x4d,2
Type=0x4e,2
Type=0x4f,2
Type=0x50,2
Type=0x51,2
Type=0x52,2
Type=0x53,2
Type=0x54,2
Type=0x55,2
; The following don't seem to have any known pre-defined meaning to Garmin
; devices and can be used to give a 'hover' or 'select' name and details without
; other representation, being hidden with a lower drawOrder than the background.
Type=0x56,0
Type=0x57,0
Type=0x58,0
Type=0x59,0
Type=0x5a,0
Type=0x5b,0
Type=0x5c,0
Type=0x5d,0
Type=0x5e,0
Type=0x5f,0
[end]
......@@ -95,6 +95,11 @@ public class Label {
return s.trim();
}
/**
* two or more whitespace characters are replaced by a single space
* @param s string to trim
* @return the trimmed string or null if s is null or empty
*/
public static String squashSpaces(String s) {
if(s == null || s.isEmpty())
return null;
......
......@@ -14,6 +14,7 @@ package uk.me.parabola.imgfmt.app.net;
import java.util.LinkedHashMap;
import java.util.Map;
import uk.me.parabola.mkgmap.reader.osm.Element;
import uk.me.parabola.mkgmap.reader.osm.TagDict;
......@@ -23,6 +24,11 @@ import uk.me.parabola.mkgmap.reader.osm.TagDict;
*
*/
public final class AccessTagsAndBits {
private AccessTagsAndBits() {
// private constructor to hide the implicit public one
}
// constants for vehicle class
public static final byte FOOT = 0x01;
public static final byte BIKE = 0x02;
......@@ -60,8 +66,9 @@ public final class AccessTagsAndBits {
for (Map.Entry<String, Byte> entry : ACCESS_TAGS.entrySet()) {
ACCESS_TAGS_COMPILED.put(TagDict.getInstance().xlate(entry.getKey()), entry.getValue());
}
};
}
public static final Map<String, Byte> ROUTE_TAGS;
static {
ROUTE_TAGS = new LinkedHashMap<>();
......
......@@ -46,10 +46,9 @@ public class AngleChecker {
private boolean ignoreSharpAngles;
private boolean cycleMap;
// private final Coord test = new Coord(48.074815,16.272771);
private final int MIN_ANGLE = 0x10;
private final int MIN_LOW_SPEED_ANGLE = 0x20;
private static final int MIN_ANGLE = 0x10;
private static final int MIN_LOW_SPEED_ANGLE = 0x20;
private int mask;
private int mrnd;
......@@ -76,55 +75,49 @@ public class AngleChecker {
orAccessMask |= arc.getRoadDef().getAccess();
roadDefs.add(arc.getRoadDef());
}
public float getInitialHeading() {
return initialHeading;
}
public boolean isOneway() {
return isOneWayTrueCount == arcs.size();
}
public boolean isForward() {
return isForwardTrueCount == arcs.size();
}
/**
* @return
*/
public void setInitialHeading(float modIH) {
while (modIH > 180)
modIH -= 360;
modIH -= 360;
while (modIH < -180)
modIH += 360;
modIH += 360;
initialHeading = modIH;
imgHeading = calcEncodedBearing(initialHeading);
for (RouteArc arc : arcs){
imgHeading = calcEncodedBearing(initialHeading);
for (RouteArc arc : arcs) {
arc.setInitialHeading(modIH);
}
}
public String toString(){
public String toString() {
return arcs.get(0).toString();
}
}
private byte calcEncodedBearing (float b) {
private byte calcEncodedBearing(float b) {
return (byte) ((RouteArc.directionFromDegrees(b) + mrnd) & mask);
}
public void config(EnhancedProperties props) {
// undocumented option - usually used for debugging only
ignoreSharpAngles = props.getProperty("ignore-sharp-angles", false);
cycleMap = props.getProperty("cycle-map", false);
// float a = 0;
// for (int i = 0; i <= 1440; i++){
// int ar = (int) Math.round(a * 256.0 / 360);
// int am = ar & 0xf0;
// log.error(a,ar,"0x" + Integer.toHexString(am));
// a +=0.25;
// if (a >= 180)
// a -= 360;
// }
return;
}
public void check(Map<Integer, RouteNode> nodes) {
......@@ -183,25 +176,17 @@ public class AngleChecker {
if (angleAttr.maskedAngle < 0)
angleAttr.maskedAngle += 256;
if (ag1.isOneway() && ag1.isForward()){
// the "incoming" arc is a wrong direction oneway
angleAttr.noAccess = true;
} else if (ag2.isOneway() && ag2.isForward() == false){
// the "outgoing" arc is a wrong direction oneway
if (ag1.isOneway() && ag1.isForward()
|| ag2.isOneway() && !ag2.isForward()) {
// the "incoming" arc or the "outgoing" is a wrong direction oneway
angleAttr.noAccess = true;
}
// if (node.getCoord().distance(test) < 2){
// if (angleAttr.angle == 20){
// angleAttr.maskedMinAngle = 0x30;
// continue;
// }
// }
int sumSpeeds = ag1.maxRoadSpeed + ag2.maxRoadSpeed;
if (sumSpeeds <= 1)
continue;
byte pathAccessMask = (byte) (ag1.orAccessMask & ag2.orAccessMask);
if (pathAccessMask == 0){
if (pathAccessMask == 0) {
// no common vehicle allowed on both arcs
angleAttr.noAccess = true;
}
......@@ -290,7 +275,7 @@ public class AngleChecker {
int modIH = ag2.imgHeading + usedIncrement;
if (modIH > 128)
modIH -= 256;
ag2.setInitialHeading(modIH * 360/256);
ag2.setInitialHeading(modIH * 360 / 256f);
int modAngle = Math.round(ag2.getInitialHeading() - ag1.getInitialHeading());
if (modAngle < 0)
modAngle += 360;
......@@ -309,7 +294,7 @@ public class AngleChecker {
int modIH = ag1.imgHeading - usedIncrement;
if (modIH < -128)
modIH += 256;
ag1.setInitialHeading(modIH * 360/256);
ag1.setInitialHeading(modIH * 360 / 256f);
int modAngle = Math.round(ag2.getInitialHeading() - ag1.getInitialHeading());
if (modAngle < 0)
modAngle += 360;
......@@ -329,7 +314,6 @@ public class AngleChecker {
log.info(sharpAngle, "don't know how to enlarge it further");
}
}
return;
}
......@@ -380,7 +364,7 @@ public class AngleChecker {
ag.addArc(arc2);
} else{
arc1 = arc2;
if (iter.hasNext() == false)
if (!iter.hasNext())
addArc1 = true;
break;
}
......
......@@ -37,7 +37,7 @@ public class NETFileReader extends ImgFile {
private final NETHeader netHeader = new NETHeader();
// To begin with we only need LBL offsets.
private final Map<Integer, Integer> offsetLabelMap = new HashMap<Integer, Integer>();
private final Map<Integer, Integer> offsetLabelMap = new HashMap<>();
private List<Integer> offsets;
private List<City> cities;
......@@ -79,9 +79,9 @@ public class NETFileReader extends ImgFile {
*/
public List<RoadDef> getRoads() {
ImgFileReader reader = getReader();
int start = netHeader.getRoadDefinitionsStart();
long start = netHeader.getRoadDefinitionsStart();
List<RoadDef> roads = new ArrayList<RoadDef>();
List<RoadDef> roads = new ArrayList<>();
int record = 0;
for (int off : offsets) {
reader.position(start + off);
......@@ -182,7 +182,8 @@ public class NETFileReader extends ImgFile {
initFlag >>= 5;
}
node += skip + 1;
int right = 0, left = 0;
int right = 0;
int left = 0;
if (initFlag == 0) {
right = left = getCityOrZip(reader, size, endPos);
} else if ((initFlag & 0x4) != 0) {
......@@ -208,8 +209,7 @@ public class NETFileReader extends ImgFile {
assert false : "ERRROR overflow";
return 0;
}
int cnum = reader.getNu(size);
return cnum;
return reader.getNu(size);
}
/**
......@@ -252,11 +252,10 @@ public class NETFileReader extends ImgFile {
private void readLabelOffsets() {
ImgFileReader reader = getReader();
offsets = readOffsets();
int start = netHeader.getRoadDefinitionsStart();
long start = netHeader.getRoadDefinitionsStart();
for (int off : offsets) {
reader.position(start + off);
int labelOffset = reader.get3u();
// TODO what if top bit is not set?, there can be more than one name and we will miss them
offsetLabelMap.put(off, labelOffset & 0x7fffff);
}
}
......@@ -283,10 +282,9 @@ public class NETFileReader extends ImgFile {
}
// Sort in address order in the hope of speeding up reading.
List<Integer> offsets = new ArrayList<>(allOffsets);
allOffsets = null;
offsets.sort(null);
return offsets;
List<Integer> sortedOffsets = new ArrayList<>(allOffsets);
sortedOffsets.sort(null);
return sortedOffsets;
}
public void setCities(List<City> cities) {
......
......@@ -16,7 +16,6 @@
*/
package uk.me.parabola.imgfmt.app.net;
import uk.me.parabola.imgfmt.ReadFailedException;
import uk.me.parabola.imgfmt.app.CommonHeader;
import uk.me.parabola.imgfmt.app.ImgFileReader;
import uk.me.parabola.imgfmt.app.ImgFileWriter;
......@@ -51,7 +50,7 @@ public class NETHeader extends CommonHeader {
*
* @param reader The header is read from here.
*/
protected void readFileHeader(ImgFileReader reader) throws ReadFailedException {
protected void readFileHeader(ImgFileReader reader) {
roadDefinitions.readSectionInfo(reader, false);
roadShift = reader.get1u();
......
......@@ -67,17 +67,14 @@ public class NOD1Part {
// maximal width and height of the bounding box, since
// NOD 1 coordinate offsets are at most 16 bit wide.
private static final int MAX_SIZE_UNSAFE = 1 << 16;
// private static final int MAX_SIZE = MAX_SIZE_UNSAFE / 2;
private static final int MAX_SIZE = MAX_SIZE_UNSAFE - 0x800;
// Table A has at most 0x100 entries
private static final int MAX_TABA_UNSAFE = 0x100;
// private static final int MAX_TABA = MAX_TABA_UNSAFE / 2;
private static final int MAX_TABA = MAX_TABA_UNSAFE - 0x8;
// Table B has at most 0x100 entries
private static final int MAX_TABB_UNSAFE = 0x100;
// private static final int MAX_TABB = MAX_TABB_UNSAFE / 2;
private static final int MAX_TABB = MAX_TABB_UNSAFE - 0x2;
// Nodes size is max 0x2000 to cope with signed 14 bit node offsets
......@@ -183,9 +180,9 @@ public class NOD1Part {
// The area that actually has nodes.
private final BBox bboxActual = new BBox();
private List<RouteNode> nodes = new ArrayList<RouteNode>();
private List<RouteNode> nodes = new ArrayList<>();
private TableA tabA = new TableA();
private Map<RouteNode,RouteNode> destNodes = new LinkedHashMap<RouteNode, RouteNode>();
private Map<RouteNode,RouteNode> destNodes = new LinkedHashMap<>();
/**
* Create an unbounded NOD1Part.
......@@ -218,18 +215,16 @@ public class NOD1Part {
* external arc at a deeper level of recursion.
*/
public void addNode(RouteNode node) {
assert bbox == null || bbox.contains(node.getCoord())
: "trying to add out-of-bounds node: " + node;
assert bbox == null || bbox.contains(node.getCoord()) : "trying to add out-of-bounds node: " + node;
bboxActual.extend(node.getCoord());
nodes.add(node);
for (RouteArc arc : node.arcsIteration()) {
tabA.addArc(arc);
RouteNode dest = arc.getDest();
if (arc.isInternal() == false){
if (!arc.isInternal()) {
destNodes.put(dest, dest);
}
else if (bbox != null && !bbox.contains(dest.getCoord()) || dest.getGroup() != node.getGroup()) {
} else if (bbox != null && !bbox.contains(dest.getCoord()) || dest.getGroup() != node.getGroup()) {
arc.setInternal(false);
destNodes.put(dest, dest);
}
......@@ -243,7 +238,7 @@ public class NOD1Part {
if (arc.getSource() != node){
tabA.addArc(arc);
RouteNode dest = arc.getDest();
if (arc.isInternal() == false)
if (!arc.isInternal())
destNodes.put(dest, dest);
else if (bbox != null && !bbox.contains(dest.getCoord()) || dest.getGroup() != node.getGroup()) {
arc.setInternal(false);
......@@ -268,7 +263,7 @@ public class NOD1Part {
* Subdivide this part recursively until it satisfies the constraints.
*/
protected List<RouteCenter> subdivideHelper(int depth) {
List<RouteCenter> centers = new LinkedList<RouteCenter>();
List<RouteCenter> centers = new LinkedList<>();
if (satisfiesConstraints()) {
centers.add(this.toRouteCenter());
......
......@@ -18,7 +18,6 @@ package uk.me.parabola.imgfmt.app.net;
import java.util.Arrays;
import uk.me.parabola.imgfmt.ReadFailedException;
import uk.me.parabola.imgfmt.app.CommonHeader;
import uk.me.parabola.imgfmt.app.ImgFileReader;
import uk.me.parabola.imgfmt.app.ImgFileWriter;
......@@ -61,7 +60,7 @@ public class NODHeader extends CommonHeader {
*
* @param reader The header is read from here.
*/
protected void readFileHeader(ImgFileReader reader) throws ReadFailedException {
protected void readFileHeader(ImgFileReader reader) {
nodes.readSectionInfo(reader, false);
flags = reader.get2u();
reader.get2u();
......@@ -92,8 +91,8 @@ public class NODHeader extends CommonHeader {
// multiplier shift for road + arc length values, the smaller the shift the higher the precision and NOD size
// as it has an influence on the number of bits needed to encode a length
final static int DISTANCE_MULT_SHIFT = 1; // 0..7 1 seems to be a good compromise
final static int DISTANCE_MULT = 1 << DISTANCE_MULT_SHIFT;
static final int DISTANCE_MULT_SHIFT = 1; // 0..7 1 seems to be a good compromise
static final int DISTANCE_MULT = 1 << DISTANCE_MULT_SHIFT;
protected void writeFileHeader(ImgFileWriter writer) {
nodes.setPosition(HEADER_LEN);
nodes.writeSectionInfo(writer);
......
......@@ -238,7 +238,7 @@ public class NumberPreparer {
/**
* The current state of the writing process.
*/
static abstract class State {
abstract static class State {
protected final Side left = new Side(true);
protected final Side right = new Side(false);
......
......@@ -326,7 +326,7 @@ public class RouteNode implements Comparable<RouteNode> {
}
public Iterable<RouteArc> arcsIteration() {
return () -> arcs.iterator();
return arcs::iterator;
}
public List<RouteRestriction> getRestrictions() {
......@@ -362,7 +362,7 @@ public class RouteNode implements Comparable<RouteNode> {
}
}
}
if (roundaboutArcs.size() > 0) {
if (!roundaboutArcs.isEmpty()) {
// get the coordinates of a box bounding the junctions of the roundabout
int minRoundaboutLat = coord.getHighPrecLat();
int maxRoundaboutLat = minRoundaboutLat;
......@@ -484,10 +484,9 @@ public class RouteNode implements Comparable<RouteNode> {
log.warn("Roundabout " + rd + " overlaps " + fb.getRoadDef() + " at " + coord.toOSMURL());
}
}
else if(fb.isForward()) {
if(!rd.messagePreviouslyIssued("roundabout forks/overlaps")) {
log.warn("Roundabout " + rd + " forks at " + coord.toOSMURL());
}
else if (fb.isForward()
&& !rd.messagePreviouslyIssued("roundabout forks/overlaps")) {
log.warn("Roundabout " + rd + " forks at " + coord.toOSMURL());
}
}
}
......@@ -557,14 +556,15 @@ public class RouteNode implements Comparable<RouteNode> {
boolean connectsToNonRoundaboutSegment = false;
RouteArc nextRoundaboutArc = null;
for (RouteArc nba : nb.arcs) {
if (nba.isDirect() == false)
if (!nba.isDirect())
continue;
if (!nba.getRoadDef().isSynthesised()) {
if (nba.getRoadDef().isRoundabout()) {
if (nba.isForward())
nextRoundaboutArc = nba;
} else
} else {
connectsToNonRoundaboutSegment = true;
}
}
}
......@@ -723,7 +723,6 @@ public class RouteNode implements Comparable<RouteNode> {
if (nodes.size() < 3)
return;
// System.out.println(road + " " + nodes.size() + " " + forwardArcs.size());
ArrayList<RouteArc> newArcs = new ArrayList<>();
IntArrayList arcPositions = forwardArcPositions;
List<RouteArc> roadArcs = forwardArcs;
......@@ -772,15 +771,14 @@ public class RouteNode implements Comparable<RouteNode> {
newArc.setIndirect();
newArcs.add(newArc);
arcToStepNode = newArc;
stepNode = destNode;
partialArcLength = 0;
if (cl >= finalClass)
break;
}
}
if (newArcs.isEmpty() == false){
int directArcPos = arcPositions.getInt(i);
if (!newArcs.isEmpty()) {
int directArcPos = arcPositions.getInt(i);
assert nodes.get(i).arcs.get(directArcPos).isDirect();
assert nodes.get(i).arcs.get(directArcPos).getRoadDef() == newArcs.get(0).getRoadDef();
assert nodes.get(i).arcs.get(directArcPos).isForward() == newArcs.get(0).isForward();
......@@ -790,7 +788,6 @@ public class RouteNode implements Comparable<RouteNode> {
int reverseArcPos = reverseArcPositions.get(i-1); // i-1 because first node doesn't have reverse arc
if (directArcPos < reverseArcPos)
reverseArcPositions.set(i - 1, reverseArcPos + newArcs.size());
}
}
}
......
......@@ -38,8 +38,6 @@ import static uk.me.parabola.imgfmt.app.net.AccessTagsAndBits.*;
* @author Robert Vollmert
*/
public class RouteRestriction {
//private static final Logger log = Logger.getLogger(RouteRestriction.class);
// first three bytes of the header -- might specify the type of restriction
// and when it is active
private static final byte RESTRICTION_TYPE = 0x05; // 0x07 spotted, meaning?
......@@ -63,16 +61,16 @@ public class RouteRestriction {
private final byte exceptMask;
private final byte flags; // meaning of bits 0x01 and 0x10 are not clear
private final static byte F_EXCEPT_FOOT = 0x02;
private final static byte F_EXCEPT_EMERGENCY = 0x04;
private final static byte F_MORE_EXCEPTIONS = 0x08;
private static final byte F_EXCEPT_FOOT = 0x02;
private static final byte F_EXCEPT_EMERGENCY = 0x04;
private static final byte F_MORE_EXCEPTIONS = 0x08;
private final static byte EXCEPT_CAR = 0x01;
private final static byte EXCEPT_BUS = 0x02;
private final static byte EXCEPT_TAXI = 0x04;
private final static byte EXCEPT_DELIVERY = 0x10;
private final static byte EXCEPT_BICYCLE = 0x20;
private final static byte EXCEPT_TRUCK = 0x40;
private static final byte EXCEPT_CAR = 0x01;
private static final byte EXCEPT_BUS = 0x02;
private static final byte EXCEPT_TAXI = 0x04;
private static final byte EXCEPT_DELIVERY = 0x10;
private static final byte EXCEPT_BICYCLE = 0x20;
private static final byte EXCEPT_TRUCK = 0x40;
/**
*
......@@ -87,21 +85,21 @@ public class RouteRestriction {
RouteArc arc = arcs.get(i);
assert arc.getDest() != viaNode;
}
byte flags = 0;
byte tmpFlags = 0;
if ((mkgmapExceptMask & FOOT) != 0)
flags |= F_EXCEPT_FOOT;
tmpFlags |= F_EXCEPT_FOOT;
if ((mkgmapExceptMask & EMERGENCY) != 0)
flags |= F_EXCEPT_EMERGENCY;
tmpFlags |= F_EXCEPT_EMERGENCY;
exceptMask = translateExceptMask(mkgmapExceptMask);
if(exceptMask != 0)
flags |= F_MORE_EXCEPTIONS;
tmpFlags |= F_MORE_EXCEPTIONS;
int numArcs = arcs.size();
assert numArcs < 8;
flags |= ((numArcs) << 5);
this.flags = flags;
tmpFlags |= ((numArcs) << 5);
this.flags = tmpFlags;
}
......@@ -170,12 +168,10 @@ public class RouteRestriction {
offsets[pos++] = calcOffset(arc.getDest(), tableOffset);
else
offsets[pos++] = arc.getIndexB();
if (arc.getSource() == viaNode){
if (!viaWritten && arc.getSource() == viaNode) {
// there will be two nodes with source node = viaNode, but we write the source only once
if (!viaWritten){
offsets[pos++] = calcOffset(viaNode, tableOffset);
viaWritten = true;
}
offsets[pos++] = calcOffset(viaNode, tableOffset);
viaWritten = true;
}
}
......
......@@ -39,13 +39,13 @@ public class TableA {
private int offset;
// arcs for roundabouts
private final HashMap<RoadDef,Integer> roundaboutArcs = new LinkedHashMap<RoadDef,Integer>();
private final HashMap<RoadDef,Integer> roundaboutArcs = new LinkedHashMap<>();
// arcs for unpaved ways
private final HashMap<RoadDef,Integer> unpavedArcs = new LinkedHashMap<RoadDef,Integer>();
private final HashMap<RoadDef,Integer> unpavedArcs = new LinkedHashMap<>();
// arcs for ferry ways
private final HashMap<RoadDef,Integer> ferryArcs = new LinkedHashMap<RoadDef,Integer>();
private final HashMap<RoadDef,Integer> ferryArcs = new LinkedHashMap<>();
// arcs for paved ways
private final HashMap<RoadDef,Integer> pavedArcs = new LinkedHashMap<RoadDef,Integer>();
private final HashMap<RoadDef,Integer> pavedArcs = new LinkedHashMap<>();
private static int count;
......
......@@ -25,9 +25,9 @@ import uk.me.parabola.imgfmt.app.ImgFileWriter;
*/
public class TableB {
private final ArrayList<RouteNode> nodes = new ArrayList<RouteNode>();
private final ArrayList<RouteNode> nodes = new ArrayList<>();
private final static int ITEM_SIZE = 3;
private static final int ITEM_SIZE = 3;
private int offset;
......@@ -64,7 +64,6 @@ public class TableB {
public void addNode(RouteNode node) {
int i = nodes.indexOf(node);
if (i < 0) {
//i = nodes.size();
nodes.add(node);
}
}
......
......@@ -31,7 +31,7 @@ public class TableC {
private final TableA tabA;
private final List<RouteRestriction> restrictions = new ArrayList<RouteRestriction>();
private final List<RouteRestriction> restrictions = new ArrayList<>();
public TableC(TableA tabA) {
this.tabA = tabA;
......