Examples of DenseInfo


Examples of org.openstreetmap.osmosis.osmbinary.Osmformat.DenseInfo

          + "), and longitudes (" + lonList.size() + ") don't match");
    }

    Iterator<Integer> keysValuesIterator = nodes.getKeysValsList().iterator();

    DenseInfo denseInfo;
    if (nodes.hasDenseinfo()) {
      denseInfo = nodes.getDenseinfo();
    } else {
      denseInfo = null;
    }

    long nodeId = 0;
    long latitude = 0;
    long longitude = 0;
    int userId = 0;
    int userSid = 0;
    long timestamp = 0;
    long changesetId = 0;
    for (int i = 0; i < idList.size(); i++) {
      CommonEntityData entityData;
      org.openstreetmap.osmosis.core.domain.v0_6.Node node;

      // Delta decode node fields.
      nodeId += idList.get(i);
      latitude += latList.get(i);
      longitude += lonList.get(i);

      if (denseInfo != null) {
        // Delta decode dense info fields.
        userId += denseInfo.getUid(i);
        userSid += denseInfo.getUserSid(i);
        timestamp += denseInfo.getTimestamp(i);
        changesetId += denseInfo.getChangeset(i);

        // Build the user, but only if one exists.
        OsmUser user;
        if (userId >= 0) {
          user = new OsmUser(userId, fieldDecoder.decodeString(userSid));
        } else {
          user = OsmUser.NONE;
        }

        entityData = new CommonEntityData(nodeId, denseInfo.getVersion(i),
            fieldDecoder.decodeTimestamp(timestamp), user, changesetId);
      } else {
        entityData = new CommonEntityData(nodeId, EMPTY_VERSION, EMPTY_TIMESTAMP, OsmUser.NONE,
            EMPTY_CHANGESET);
      }
View Full Code Here

Examples of org.openstreetmap.osmosis.osmbinary.Osmformat.DenseInfo

        int j = 0; // Index into the keysvals array.

        // Stuff for dense info
        long lasttimestamp = 0, lastchangeset = 0;
        int lastuserSid = 0, lastuid = 0;
        DenseInfo di = null;
        if (nodes.hasDenseinfo()) {
          di = nodes.getDenseinfo();
        }
        for (int i = 0; i < nodes.getIdCount(); i++) {
            Node tmp;
            List<Tag> tags = new ArrayList<Tag>(0);
            long lat = nodes.getLat(i) + lastLat;
            lastLat = lat;
            long lon = nodes.getLon(i) + lastLon;
            lastLon = lon;
            long id = nodes.getId(i) + lastId;
            lastId = id;
            double latf = parseLat(lat), lonf = parseLon(lon);
            // If empty, assume that nothing here has keys or vals.
            if (nodes.getKeysValsCount() > 0) {
                while (nodes.getKeysVals(j) != 0) {
                    int keyid = nodes.getKeysVals(j++);
                    int valid = nodes.getKeysVals(j++);
                    tags.add(new Tag(getStringById(keyid), getStringById(valid)));
                }
                j++; // Skip over the '0' delimiter.
            }
            // Handle dense info.
            if (di != null) {
              int uid = di.getUid(i) + lastuid; lastuid = uid;
              int userSid = di.getUserSid(i) + lastuserSid; lastuserSid = userSid;
              long timestamp = di.getTimestamp(i) + lasttimestamp; lasttimestamp = timestamp;
              int version = di.getVersion(i);
              long changeset = di.getChangeset(i) + lastchangeset; lastchangeset = changeset;

              Date date = new Date(date_granularity * timestamp);

              OsmUser user;
              if (uid < 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.