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

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


  public void buildFromWayEntity_withIncorrectWayNodeSize() {
    // Setup
    Way way = mock(Way.class);
    when(way.getId()).thenReturn(1l);
    List<Tag> tags = new ArrayList<Tag>();
    tags.add(new Tag("highway", "primary"));
    when(way.getTags()).thenReturn(tags);
    List<WayNode> wayNodes = new ArrayList<WayNode>();
    wayNodes.add(new WayNode(1l));
    wayNodes.add(new WayNode(2l));
    when(way.getWayNodes()).thenReturn(wayNodes);
View Full Code Here


    Assert.assertEquals(expected.getLongitude(), actual.getLongitude());
    // Verify Tags
    Iterator<Tag> expectedTags = expected.getTags().iterator();
    Iterator<Tag> actualTags = actual.getTags().iterator();
    while (expectedTags.hasNext() && actualTags.hasNext()) {
      Tag expectedTag = expectedTags.next();
      Tag actualTag = actualTags.next();
      Assert.assertEquals(0, expectedTag.compareTo(actualTag));
    }
    Assert.assertFalse(expectedTags.hasNext() || actualTags.hasNext());
  }
View Full Code Here

    Assert.assertEquals(expected.getId(), actual.getId());
    // Verify Tags
    Iterator<Tag> expectedTags = expected.getTags().iterator();
    Iterator<Tag> actualTags = actual.getTags().iterator();
    while (expectedTags.hasNext() && actualTags.hasNext()) {
      Tag expectedTag = expectedTags.next();
      Tag actualTag = actualTags.next();
      Assert.assertEquals(0, expectedTag.compareTo(actualTag));
    }
    Assert.assertFalse(expectedTags.hasNext() || actualTags.hasNext());
    // Verify WayNodes
    Iterator<WayNode> expectedWayNodes = expected.getWayNodes().iterator();
View Full Code Here

import org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay;

public class OsmDataBuilder {

  public static Node buildSampleNode(long id) {
    List<Tag> tags = Arrays.asList(new Tag[] { new Tag("highway", "traffic_signals") });
    CommonEntityData entityData = new CommonEntityData(id, 0, new Date(), new OsmUser(1, "nco"), 1l, tags);
    return new Node(entityData, 1.0d, 2.0d);
  }
View Full Code Here

  public static Node buildSampleNode() {
    return buildSampleNode(1);
  }

  public static Way buildSampleWay(long id, long... nodeIds) {
    List<Tag> tags = Arrays.asList(new Tag[] { new Tag("highway", "residential") });
    CommonEntityData entityData = new CommonEntityData(id, 0, new Date(), new OsmUser(1, "nco"), 1l, tags);
    List<WayNode> wayNodes = new ArrayList<WayNode>();
    for (int i = 0; i < nodeIds.length; i++)
      wayNodes.add(new WayNode(nodeIds[i]));
    return new Way(entityData, wayNodes);
View Full Code Here

  public final void testProcessNormalWay() {
    Way way =
      new Way(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    way.getWayNodes().add(new WayNode(1235));
    way.getWayNodes().add(new WayNode(1236));
    way.getTags().add(new Tag("waykey", "wayvalue"));
   
    testWayWriter.process(way);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

  public final void testProcessWayWithNoUser() {
    Way way =
      new Way(new CommonEntityData(1234, 2, timestamp, OsmUser.NONE, 0));
    way.getWayNodes().add(new WayNode(1235));
    way.getWayNodes().add(new WayNode(1236));
    way.getTags().add(new Tag("waykey", "wayvalue"));
   
    testWayWriter.process(way);
    try {
      testBufferedWriter.flush();
    } catch (IOException e) {
View Full Code Here

            List<WayNode> nodes = Lists.newArrayList();
            String nodesString = (String) feature.getAttribute("nodes");
            for (String s : nodesString.split(";")) {
                nodes.add(new WayNode(Long.parseLong(s)));
            }
            entity = new Way(entityData, nodes);
        }

        return entity;
    }
View Full Code Here

    ESNode node1 = ESNode.Builder.create().id(1).location(1, 2).build();
    ESNode node2 = ESNode.Builder.create().id(2).location(2, 3).build();
    ESNode node3 = ESNode.Builder.create().id(3).location(3, 2).build();
    index(INDEX_NAME, node1, node2, node3);

    Way way = OsmDataBuilder.buildSampleWay(1, 1, 2, 3, 1);

    // Action
    entityDao.save(way);
    refresh(INDEX_NAME);
View Full Code Here

    ESNode node2 = ESNode.Builder.create().id(2).location(2.0, 3.0).build();
    ESNode node3 = ESNode.Builder.create().id(3).location(3.0, 2.0).build();
    ESNode node4 = ESNode.Builder.create().id(4).location(4.0, 1.0).build();
    index(INDEX_NAME, node1, node2, node3, node4);

    Way way = OsmDataBuilder.buildSampleWay(1, 1, 2, 3, 4);

    // Action
    entityDao.save(way);
    refresh(INDEX_NAME);
View Full Code Here

TOP

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

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.