Remove output.

This commit is contained in:
Holt59 2018-02-25 21:40:20 +01:00
parent 05c4f0da2a
commit 20a64255aa

View File

@ -29,22 +29,38 @@ public class BinaryGraphReader extends BinaryReader implements GraphReader {
*/ */
public static RoadType toRoadType(char ch) { public static RoadType toRoadType(char ch) {
switch (ch) { switch (ch) {
case 'a': return RoadType.MOTORWAY; case 'a':
case 'b': return RoadType.TRUNK; return RoadType.MOTORWAY;
case 'c': return RoadType.PRIMARY; case 'b':
case 'd': return RoadType.SECONDARY; return RoadType.TRUNK;
case 'e': return RoadType.MOTORWAY_LINK; case 'c':
case 'f': return RoadType.TRUNK_LINK; return RoadType.PRIMARY;
case 'g': return RoadType.PRIMARY_LINK; case 'd':
case 'h': return RoadType.SECONDARY_LINK; return RoadType.SECONDARY;
case 'i': return RoadType.TERTIARY; case 'e':
case 'j': return RoadType.RESIDENTIAL; return RoadType.MOTORWAY_LINK;
case 'k': return RoadType.UNCLASSIFIED; case 'f':
case 'l': return RoadType.ROAD; return RoadType.TRUNK_LINK;
case 'm': return RoadType.LIVING_STREET; case 'g':
case 'n': return RoadType.SERVICE; return RoadType.PRIMARY_LINK;
case 'o': return RoadType.ROUNDABOUT; case 'h':
case 'z': return RoadType.COASTLINE; return RoadType.SECONDARY_LINK;
case 'i':
return RoadType.TERTIARY;
case 'j':
return RoadType.RESIDENTIAL;
case 'k':
return RoadType.UNCLASSIFIED;
case 'l':
return RoadType.ROAD;
case 'm':
return RoadType.LIVING_STREET;
case 'n':
return RoadType.SERVICE;
case 'o':
return RoadType.ROUNDABOUT;
case 'z':
return RoadType.COASTLINE;
} }
return RoadType.UNCLASSIFIED; return RoadType.UNCLASSIFIED;
} }
@ -61,8 +77,6 @@ public class BinaryGraphReader extends BinaryReader implements GraphReader {
@Override @Override
public Graph read() throws IOException { public Graph read() throws IOException {
System.out.println(getClass());
// Read and check magic number and file version. // Read and check magic number and file version.
checkMagicNumberOrThrow(dis.readInt()); checkMagicNumberOrThrow(dis.readInt());
checkVersionOrThrow(dis.readInt()); checkVersionOrThrow(dis.readInt());
@ -85,8 +99,8 @@ public class BinaryGraphReader extends BinaryReader implements GraphReader {
// Read nodes. // Read nodes.
for (int node = 0; node < nbNodes; ++node) { for (int node = 0; node < nbNodes; ++node) {
float longitude = ((float)dis.readInt ()) / 1E6f; float longitude = ((float) dis.readInt()) / 1E6f;
float latitude = ((float)dis.readInt ()) / 1E6f; float latitude = ((float) dis.readInt()) / 1E6f;
nbSuccessors[node] = dis.readUnsignedByte(); nbSuccessors[node] = dis.readUnsignedByte();
nodes.add(new Node(node, new Point(longitude, latitude))); nodes.add(new Node(node, new Point(longitude, latitude)));
} }
@ -134,8 +148,7 @@ public class BinaryGraphReader extends BinaryReader implements GraphReader {
float dlon = (dis.readShort()) / 2.0e5f; float dlon = (dis.readShort()) / 2.0e5f;
float dlat = (dis.readShort()) / 2.0e5f; float dlat = (dis.readShort()) / 2.0e5f;
points.add(new Point(lastPoint.getLongitude() + dlon, points.add(new Point(lastPoint.getLongitude() + dlon, lastPoint.getLatitude() + dlat));
lastPoint.getLatitude() + dlat));
} }
points.add(nodes.get(destNode).getPoint()); points.add(nodes.get(destNode).getPoint());
@ -173,8 +186,8 @@ public class BinaryGraphReader extends BinaryReader implements GraphReader {
* @throws IOException * @throws IOException
*/ */
private RoadInformation readRoadInformation() throws IOException { private RoadInformation readRoadInformation() throws IOException {
char type = (char)dis.readUnsignedByte(); char type = (char) dis.readUnsignedByte();
int x = dis.readUnsignedByte() ; int x = dis.readUnsignedByte();
return new RoadInformation(toRoadType(type), (x & 0x80) > 0, (x & 0x7F) * 5, dis.readUTF()); return new RoadInformation(toRoadType(type), (x & 0x80) > 0, (x & 0x7F) * 5, dis.readUTF());
} }