Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic vanilla extract loader/server in Java
- Loading branch information
Showing
8 changed files
with
288 additions
and
74 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,61 @@ | |||
package org.opentripplanner.osm; | |||
|
|||
import java.io.OutputStream; | |||
import java.io.PrintStream; | |||
import java.util.Locale; | |||
|
|||
/** | |||
* Write OSM ways and nodes out to a simple human-readable text format. | |||
*/ | |||
public class OSMTextOutput { | |||
|
|||
OutputStream out; | |||
PrintStream print; | |||
OSM osm; | |||
NodeTracker nodesSeen; | |||
|
|||
public OSMTextOutput (OutputStream out, OSM osm) { | |||
this.osm = osm; | |||
this.out = out; | |||
this.print = new PrintStream(out); | |||
nodesSeen = new NodeTracker(); | |||
} | |||
|
|||
public void printWay(long wayId) { | |||
Way way = osm.ways.get(wayId); | |||
print.print("W "); | |||
print.print(wayId); | |||
print.print(' '); | |||
print.print(way.tags); | |||
print.print('\n'); | |||
for (long nodeId : way.nodes) { | |||
if (nodesSeen.contains(nodeId)) { | |||
printNodeFull(nodeId); | |||
// printNodeRef(nodeId); | |||
} else { | |||
printNodeFull(nodeId); | |||
nodesSeen.add(nodeId); | |||
} | |||
} | |||
} | |||
|
|||
public void printNodeRef(long nodeId) { | |||
print.print("N "); | |||
print.print(nodeId); | |||
print.print('\n'); | |||
} | |||
|
|||
public void printNodeFull(long nodeId) { | |||
print.print("N "); | |||
print.print(nodeId); | |||
print.print(' '); | |||
Node node = osm.nodes.get(nodeId); | |||
print.printf(Locale.US, "%2.6f", node.lat); | |||
print.print(' '); | |||
print.printf(Locale.US, "%3.6f", node.lon); | |||
print.print(' '); | |||
print.print(node.tags); | |||
print.print('\n'); | |||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.