if (i.hasInfo()) { Osmformat.Info info = i.getInfo(); tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info), getUser(info), info.getChangeset(), tags), nodes); } else { tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
private AvroPrimitive getPrimitive(Osmformat.Info info) { AvroPrimitive p = new AvroPrimitive(); p.setVersion((long) info.getVersion()); p.setTimestamp(info.getTimestamp()); p.setUserId((long) info.getUid()); try { p.setUserName(getStringById(info.getUid())); } catch (Exception ex) { LOGGER.warn( "Error, input file doesn't contain a valid string table for user id: " + info.getUid(), ex); p.setUserName(String.valueOf(info.getUid())); } p.setChangesetId(info.getChangeset()); p.setVisible(info.getVisible()); return p; } }
switch (method) { case NEW_MUTABLE_INSTANCE: { return new org.openstreetmap.osmosis.osmbinary.Osmformat.Info(); org.openstreetmap.osmosis.osmbinary.Osmformat.Info other = (org.openstreetmap.osmosis.osmbinary.Osmformat.Info) arg1; version_ = visitor.visitInt( hasVersion(), version_, other.hasVersion(), other.version_); timestamp_ = visitor.visitLong( hasTimestamp(), timestamp_, other.hasTimestamp(), other.timestamp_); changeset_ = visitor.visitLong( hasChangeset(), changeset_, other.hasChangeset(), other.changeset_); uid_ = visitor.visitInt( hasUid(), uid_, other.hasUid(), other.uid_); userSid_ = visitor.visitInt( hasUserSid(), userSid_, other.hasUserSid(), other.userSid_); visible_ = visitor.visitBoolean( hasVisible(), visible_, other.hasVisible(), other.visible_); if (visitor == com.google.protobuf.GeneratedMessageLite.MergeFromVisitor .INSTANCE) { if (!parseUnknownField(tag, input)) { done = true;
.setId(100001) .setLat(1000).setLon(2000) .setInfo(Info.newBuilder() .setTimestamp(1001) .setChangeset(-12) .setId(100002) .setLat(1001).setLon(2001) .setInfo(Info.newBuilder() .setVersion(102) .setTimestamp(1002) .setId(100003) .setLat(1003).setLon(2003) .setInfo(Info.newBuilder() .setVersion(103) .setUserSid(4)
if (i.hasInfo()) { Osmformat.Info info = i.getInfo(); tmp = new Way(new CommonEntityData(id, info.getVersion(), getDate(info), getUser(info), info.getChangeset(), tags), nodes); } else { tmp = new Way(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, NOCHANGESET,
@Override protected void parseNodes(List<Osmformat.Node> nodes) { for (Osmformat.Node i : nodes) { List<Tag> tags = new ArrayList<Tag>(); for (int j = 0; j < i.getKeysCount(); j++) { tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); } // long id, int version, Date timestamp, OsmUser user, // long changesetId, Collection<Tag> tags, // double latitude, double longitude Node tmp; long id = i.getId(); double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon()); if (i.hasInfo()) { Osmformat.Info info = i.getInfo(); tmp = new Node(new CommonEntityData(id, info.getVersion(), getDate(info), getUser(info), info.getChangeset(), tags), latf, lonf); } else { tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, NOCHANGESET, tags), latf, lonf); } sink.process(new NodeContainer(tmp)); } }
/** * <pre> * May be omitted in omitmeta * </pre> * * <code>optional .OSMPBF.Info info = 4;</code> */ @java.lang.SuppressWarnings({"ReferenceEquality"}) private void mergeInfo(org.openstreetmap.osmosis.osmbinary.Osmformat.Info value) { if (value == null) { throw new NullPointerException(); } if (info_ != null && info_ != org.openstreetmap.osmosis.osmbinary.Osmformat.Info.getDefaultInstance()) { info_ = org.openstreetmap.osmosis.osmbinary.Osmformat.Info.newBuilder(info_).mergeFrom(value).buildPartial(); } else { info_ = value; } bitField0_ |= 0x00000002; } /**
/** * <pre> * The visible flag is used to store history information. It indicates that * the current object version has been created by a delete operation on the * OSM API. * When a writer sets this flag, it MUST add a required_features tag with * value "HistoricalInformation" to the HeaderBlock. * If this flag is not available for some object it MUST be assumed to be * true if the file has the required_features tag "HistoricalInformation" * set. * </pre> * * <code>optional bool visible = 6;</code> */ @java.lang.Override public boolean getVisible() { return instance.getVisible(); } /**
public Osmformat.Info.Builder serializeMetadata(Entity e) { StringTable stable = getStringTable(); Osmformat.Info.Builder b = Osmformat.Info.newBuilder(); if (!omit_metadata) { if (e.getUser() == OsmUser.NONE && warncount < MAXWARN) { LOG.warning("Attention: Data being output lacks metadata. Please use omitmetadata=true"); warncount++; } if (e.getUser() != OsmUser.NONE) { b.setUid(e.getUser().getId()); b.setUserSid(stable.getIndex(e.getUser().getName())); } b.setTimestamp((int) (e.getTimestamp().getTime() / date_granularity)); b.setVersion(e.getVersion()); b.setChangeset(e.getChangesetId()); } return b; } }
/** * <code>optional .OSMPBF.Info info = 4;</code> */ @java.lang.SuppressWarnings({"ReferenceEquality"}) private void mergeInfo(org.openstreetmap.osmosis.osmbinary.Osmformat.Info value) { if (value == null) { throw new NullPointerException(); } if (info_ != null && info_ != org.openstreetmap.osmosis.osmbinary.Osmformat.Info.getDefaultInstance()) { info_ = org.openstreetmap.osmosis.osmbinary.Osmformat.Info.newBuilder(info_).mergeFrom(value).buildPartial(); } else { info_ = value; } bitField0_ |= 0x00000002; } /**
/** * <code>optional .OSMPBF.Info info = 4;</code> */ @java.lang.SuppressWarnings({"ReferenceEquality"}) private void mergeInfo(org.openstreetmap.osmosis.osmbinary.Osmformat.Info value) { if (value == null) { throw new NullPointerException(); } if (info_ != null && info_ != org.openstreetmap.osmosis.osmbinary.Osmformat.Info.getDefaultInstance()) { info_ = org.openstreetmap.osmosis.osmbinary.Osmformat.Info.newBuilder(info_).mergeFrom(value).buildPartial(); } else { info_ = value; } bitField0_ |= 0x00000002; } /**
/** Get the osmosis object representing a the user in a given Info protobuf. * @param info The info protobuf. * @return The OsmUser object */ OsmUser getUser(Osmformat.Info info) { // System.out.println(info); if (info.hasUid() && info.hasUserSid()) { if (info.getUid() < 0) { return OsmUser.NONE; } return new OsmUser(info.getUid(), getStringById(info.getUserSid())); } else { return OsmUser.NONE; } }
/** * <pre> * String IDs * </pre> * * <code>optional uint32 user_sid = 5;</code> */ @java.lang.Override public int getUserSid() { return instance.getUserSid(); } /**
/** * <pre> * String IDs * </pre> * * <code>optional uint32 user_sid = 5;</code> */ @java.lang.Override public boolean hasUserSid() { return instance.hasUserSid(); } /**
/** * <code>optional int32 uid = 4;</code> */ @java.lang.Override public int getUid() { return instance.getUid(); } /**
/** * <code>optional int32 uid = 4;</code> */ @java.lang.Override public boolean hasUid() { return instance.hasUid(); } /**
/** * <code>optional int64 changeset = 3;</code> */ @java.lang.Override public long getChangeset() { return instance.getChangeset(); } /**
private CommonEntityData buildCommonEntityData(long entityId, List<Integer> keys, List<Integer> values, Info info, PbfFieldDecoder fieldDecoder) { OsmUser user; CommonEntityData entityData; // Build the user, but only if one exists. if (info.hasUid() && info.getUid() >= 0 && info.hasUserSid()) { user = new OsmUser(info.getUid(), fieldDecoder.decodeString(info.getUserSid())); } else { user = OsmUser.NONE; } entityData = new CommonEntityData(entityId, info.getVersion(), fieldDecoder.decodeTimestamp(info.getTimestamp()), user, info.getChangeset()); buildTags(entityData, keys, values, fieldDecoder); return entityData; }
/** * <code>optional int64 timestamp = 2;</code> */ @java.lang.Override public long getTimestamp() { return instance.getTimestamp(); } /**
/** * <code>optional int32 version = 1 [default = -1];</code> */ @java.lang.Override public int getVersion() { return instance.getVersion(); } /**