Package org.openstreetmap.osmosis.core.domain.v0_6

Examples of org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData


            false,
            false);
    simpleAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 10, 30, 10, "intersecting");
    nonIntersectingBound = new Bound(-30, -50, 10, -10, "nonintersecting");
    inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 10, 10);
    outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 30, 30);
    edgeNodeEast = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 10, 20);
    edgeNodeWest = new Node(new CommonEntityData(1237, 0, new Date(), user, 0, tags), 10, -20);
    edgeNodeNorth = new Node(new CommonEntityData(1238, 0, new Date(), user, 0, tags), 20, 10);
    edgeNodeSouth = new Node(new CommonEntityData(1239, 0, new Date(), user, 0, tags), -20, 10);
  }
View Full Code Here


    polyAreaFilter = new PolygonFilter(IdTrackerType.Dynamic, polygonFile, false, false, false, false);
    polyAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 0, 30, 0, "intersecting");
    crossingIntersectingBound = new Bound(-10, 10, 30, -30, "crossing intersecting");
    nonIntersectingBound = new Bound(30, 15, 30, 15, "nonintersecting");
    inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 5, 10);
    outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 15, 15);
    edgeNode = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 15, 10);
  }
View Full Code Here


  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;
View Full Code Here

  }


  private CommonEntityData buildCommonEntityData(long entityId, List<Integer> keys, List<Integer> values,
      PbfFieldDecoder fieldDecoder) {
    CommonEntityData entityData;

    entityData = new CommonEntityData(entityId, EMPTY_VERSION, EMPTY_TIMESTAMP, OsmUser.NONE, EMPTY_CHANGESET);

    buildTags(entityData, keys, values, fieldDecoder);

    return entityData;
  }
View Full Code Here


  private void processNodes(List<Node> nodes, PbfFieldDecoder fieldDecoder) {
    for (Node node : nodes) {
      org.openstreetmap.osmosis.core.domain.v0_6.Node osmNode;
      CommonEntityData entityData;

      if (node.hasInfo()) {
        entityData = buildCommonEntityData(node.getId(), node.getKeysList(), node.getValsList(),
            node.getInfo(), fieldDecoder);
View Full Code Here

    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);
      }

      // Build the tags. The key and value string indexes are sequential
      // in the same PBF array. Each set of tags is delimited by an index
      // with a value of 0.
      Collection<Tag> tags = entityData.getTags();
      while (keysValuesIterator.hasNext()) {
        int keyIndex = keysValuesIterator.next();
        if (keyIndex == 0) {
          break;
        }
View Full Code Here


  private void processWays(List<Way> ways, PbfFieldDecoder fieldDecoder) {
    for (Way way : ways) {
      org.openstreetmap.osmosis.core.domain.v0_6.Way osmWay;
      CommonEntityData entityData;

      if (way.hasInfo()) {
        entityData = buildCommonEntityData(way.getId(), way.getKeysList(), way.getValsList(), way.getInfo(),
            fieldDecoder);
View Full Code Here


  private void processRelations(List<Relation> relations, PbfFieldDecoder fieldDecoder) {
    for (Relation relation : relations) {
      org.openstreetmap.osmosis.core.domain.v0_6.Relation osmRelation;
      CommonEntityData entityData;

      if (relation.hasInfo()) {
        entityData = buildCommonEntityData(relation.getId(), relation.getKeysList(), relation.getValsList(),
            relation.getInfo(), fieldDecoder);
View Full Code Here

   *             if a database error is encountered.
   * @return The common entity data.
   */
  @SuppressWarnings("unchecked")
  protected CommonEntityData mapCommonEntityData(ResultSet rs) throws SQLException {
    CommonEntityData entityData;
    Map<String, String> dbTags;
    Collection<Tag> tags;
   
    entityData = new CommonEntityData(
      rs.getLong("id"),
      rs.getInt("version"),
      new Date(rs.getTimestamp("tstamp").getTime()),
      buildUser(rs),
      rs.getLong("changeset_id")
    );
   
    dbTags = (Map<String, String>) rs.getObject("tags");
    if (dbTags != null) {
      tags = entityData.getTags();
      for (Entry<String, String> tagEntry : dbTags.entrySet()) {
        tags.add(new Tag(tagEntry.getKey(), tagEntry.getValue()));
      }
    }
   
View Full Code Here

   */
  @Test
  public final void testProcessNormalNode() {
    Node node =
      new Node(
        new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0),
        20.12345678, -21.98765432);
    node.getTags().add(new Tag("nodekey", "nodevalue"));
    testNodeWriter.process(node);
    try {
      testBufferedWriter.flush();
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData

Copyright © 2018 www.massapicom. 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.