Package org.openstreetmap.osmosis.plugin.elasticsearch.model.shape.ESShape

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.shape.ESShape.ESShapeBuilder


    List<WayNode> wayNodes = new ArrayList<WayNode>();
    wayNodes.add(new WayNode(1l));
    wayNodes.add(new WayNode(2l));
    when(way.getWayNodes()).thenReturn(wayNodes);

    ESShapeBuilder builder = new ESShapeBuilder();
    builder.addLocation(1.0, 2.0).addLocation(2.0, 3.0);

    ESWay expected = ESWay.Builder.create().id(1l)
        .addLocation(1.0, 2.0).addLocation(2.0, 3.0)
        .addTag("highway", "primary").build();

    // Action
    ESWay actual = ESWay.Builder.buildFromEntity(way, builder.build());

    // Assert
    assertEquals(expected, actual);
  }
View Full Code Here


    List<WayNode> wayNodes = new ArrayList<WayNode>();
    wayNodes.add(new WayNode(1l));
    wayNodes.add(new WayNode(2l));
    when(way.getWayNodes()).thenReturn(wayNodes);

    ESShapeBuilder builder = new ESShapeBuilder();
    builder.addLocation(1.0, 2.0);

    // Action
    ESWay.Builder.buildFromEntity(way, builder.build());
  }
View Full Code Here

    Node node = OsmDataBuilder.buildSampleNode();

    Iterator<MultiGetItemResponse> iteratorMocked = mock(Iterator.class);
    doReturn(iteratorMocked).when(entityDao).getNodeItems(any(List.class));

    ESShape builder = new ESShapeBuilder(1).addLocation(1.0, 2.0).build();
    doReturn(builder).when(entityDao).getShape(iteratorMocked, 1);

    BulkRequestBuilder bulkRequestBuilderMocked = mock(BulkRequestBuilder.class);
    when(clientMocked.prepareBulk()).thenReturn(bulkRequestBuilderMocked);
View Full Code Here

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

    Iterator<MultiGetItemResponse> iteratorMocked = mock(Iterator.class);
    doReturn(iteratorMocked).when(entityDao).getNodeItems(any(List.class));

    ESShape builder = new ESShapeBuilder(1).addLocation(1.0, 2.0).addLocation(2.0, 3.0)
        .addLocation(3.0, 2.0).addLocation(1.0, 2.0).build();
    doReturn(builder).when(entityDao).getShape(iteratorMocked, 4);

    BulkRequestBuilder bulkRequestBuilderMocked = mock(BulkRequestBuilder.class);
    when(clientMocked.prepareBulk()).thenReturn(bulkRequestBuilderMocked);
View Full Code Here

  private ESShapeBuilder shapeBuilder;

  @Before
  public void setUp() throws Exception {
    shapeBuilder = new ESShapeBuilder();
  }
View Full Code Here

    Iterator<MultiGetItemResponse> iterator = responses.iterator();
    return iterator;
  }

  protected ESShape getShape(Iterator<MultiGetItemResponse> iterator, int size) {
    ESShapeBuilder shapeBuilder = new ESShapeBuilder(size);
    for (int i = 0; i < size; i++) {
      GetResponse response = iterator.next().getResponse();
      if (!response.isExists()) continue;
      @SuppressWarnings("unchecked")
      Map<String, Object> shape = (Map<String, Object>) response.getField("shape").getValue();
      @SuppressWarnings("unchecked")
      List<Double> coordinates = (List<Double>) shape.get("coordinates");
      shapeBuilder.addLocation(coordinates.get(1), coordinates.get(0));
    }
    return shapeBuilder.build();
  }
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.plugin.elasticsearch.model.shape.ESShape.ESShapeBuilder

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.