use of de.topobyte.osm4j.core.model.iface.OsmEntity in project osm4j-pbf by topobyte.
the class PbfWriter method addTagsToStringTable.
private void addTagsToStringTable(Collection<? extends OsmEntity> entities) {
for (OsmEntity entity : entities) {
for (int k = 0; k < entity.getNumberOfTags(); k++) {
OsmTag tag = entity.getTag(k);
stringTable.incr(tag.getKey());
stringTable.incr(tag.getValue());
}
}
}
use of de.topobyte.osm4j.core.model.iface.OsmEntity in project osm4j-pbf by topobyte.
the class PbfWriter method addUsersToStringTable.
private void addUsersToStringTable(Collection<? extends OsmEntity> entities) {
for (OsmEntity entity : entities) {
OsmMetadata metadata = entity.getMetadata();
if (metadata == null) {
continue;
}
String user = metadata.getUser();
if (user == null) {
continue;
}
stringTable.incr(user);
}
}
use of de.topobyte.osm4j.core.model.iface.OsmEntity in project osm4j-pbf by topobyte.
the class PbfWriter method serializeMetadataDense.
private void serializeMetadataDense(Osmformat.DenseInfo.Builder b, Collection<? extends OsmEntity> entities) {
long lasttimestamp = 0, lastchangeset = 0;
int lastuserSid = 0, lastuid = 0;
for (OsmEntity e : entities) {
OsmMetadata metadata = e.getMetadata();
if (metadata == null) {
metadata = new Metadata(-1, -1, -1, "", -1);
}
int uid = (int) metadata.getUid();
int userSid = stringTable.getIndex(metadata.getUser());
int timestamp = (int) (metadata.getTimestamp() / dateGranularity);
int version = metadata.getVersion();
long changeset = metadata.getChangeset();
b.addVersion(version);
b.addTimestamp(timestamp - lasttimestamp);
lasttimestamp = timestamp;
b.addChangeset(changeset - lastchangeset);
lastchangeset = changeset;
b.addUid(uid - lastuid);
lastuid = uid;
b.addUserSid(userSid - lastuserSid);
lastuserSid = userSid;
}
}
Aggregations