Skip to content

Commit

Permalink
Document more of the API for BinaryParser.
Browse files Browse the repository at this point in the history
  • Loading branch information
scrosby committed Sep 8, 2010
1 parent e60be5b commit a1b2112
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src.java/crosby/binary/BinaryParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public abstract class BinaryParser implements BlockReaderAdapter {
protected int date_granularity;
private String strings[];

/** Take a Info protocol buffer containing a date and convert it into a java Date object */
protected Date getDate(Osmformat.Info info) {
if (info.hasTimestamp()) {
return new Date(date_granularity * (long) info.getTimestamp());
Expand Down Expand Up @@ -70,18 +71,19 @@ public boolean skipBlock(FileBlockPosition block) {
}



/** Convert a latitude value stored in a protobuf into a double, compensating for granularity and latitude offset */
public double parseLat(long degree) {
// Support non-zero offsets. (We don't currently generate them)
return (granularity * degree + lat_offset) * .000000001;
}

/** Convert a longitude value stored in a protobuf into a double, compensating for granularity and longitude offset */
public double parseLon(long degree) {
// Support non-zero offsets. (We don't currently generate them)
return (granularity * degree + lon_offset) * .000000001;
}


/** Parse a Primitive block (containing a string table, other paramaters, and PrimitiveGroups */
public void parse(Osmformat.PrimitiveBlock block) {
Osmformat.StringTable stablemessage = block.getStringtable();
strings = new String[stablemessage.getSCount()];
Expand All @@ -106,10 +108,15 @@ public void parse(Osmformat.PrimitiveBlock block) {
}
}

/** Parse a list of Relation protocol buffers and send the resulting relations to a sink. */
protected abstract void parseRelations(List<Osmformat.Relation> rels);
/** Parse a DenseNode protocol buffer and send the resulting nodes to a sink. */
protected abstract void parseDense(Osmformat.DenseNodes nodes);
/** Parse a list of Node protocol buffers and send the resulting nodes to a sink. */
protected abstract void parseNodes(List<Osmformat.Node> nodes);
/** Parse a list of Way protocol buffers and send the resulting ways to a sink. */
protected abstract void parseWays(List<Osmformat.Way> ways);
/** Parse a header message. */
protected abstract void parse(Osmformat.HeaderBlock header);

}

0 comments on commit a1b2112

Please sign in to comment.