Exemplo n.º 1
0
  @Test
  public void testFordAccess() {
    ReaderNode node = new ReaderNode(0, 0.0, 0.0);
    node.setTag("ford", "yes");

    ReaderWay way = new ReaderWay(1);
    way.setTag("highway", "unclassified");
    way.setTag("ford", "yes");

    // Node and way are initially blocking
    assertTrue(encoder.isBlockFords());
    assertFalse(encoder.acceptWay(way) > 0);
    assertTrue(encoder.handleNodeTags(node) > 0);

    try {
      // Now they are passable
      encoder.setBlockFords(false);
      assertTrue(encoder.acceptWay(way) > 0);
      assertFalse(encoder.handleNodeTags(node) > 0);
    } finally {
      encoder.setBlockFords(true);
    }
  }
Exemplo n.º 2
0
  @Test
  public void testBarrierAccess() {
    ReaderNode node = new ReaderNode(1, -1, -1);
    node.setTag("barrier", "lift_gate");
    node.setTag("access", "yes");
    // no barrier!
    assertTrue(encoder.handleNodeTags(node) == 0);

    node = new ReaderNode(1, -1, -1);
    node.setTag("barrier", "lift_gate");
    node.setTag("bicycle", "yes");
    // barrier!
    assertTrue(encoder.handleNodeTags(node) > 0);

    node = new ReaderNode(1, -1, -1);
    node.setTag("barrier", "lift_gate");
    node.setTag("access", "yes");
    node.setTag("bicycle", "yes");
    // should this be a barrier for motorcars too?
    // assertTrue(encoder.handleNodeTags(node) > 0);

    node = new ReaderNode(1, -1, -1);
    node.setTag("barrier", "lift_gate");
    node.setTag("access", "no");
    node.setTag("motorcar", "yes");
    // no barrier!
    assertTrue(encoder.handleNodeTags(node) == 0);

    node = new ReaderNode(1, -1, -1);
    node.setTag("barrier", "bollard");
    // barrier!
    assertTrue(encoder.handleNodeTags(node) > 0);

    // ignore other access tags for absolute barriers!
    node.setTag("motorcar", "yes");
    // still barrier!
    assertTrue(encoder.handleNodeTags(node) > 0);
  }