@Test public void TestIdentificationOfSidesWithSidewalkInfo() { ReaderWay way = new ReaderWay(1); way.setTag("sidewalk:left:surface", "asphalt"); assertEquals(OSMAttachedSidewalkProcessor.Side.LEFT, processor.identifySidesWhereSidewalkIsPresent(way)); way = new ReaderWay(1); way.setTag("sidewalk", "both"); assertEquals(OSMAttachedSidewalkProcessor.Side.BOTH, processor.identifySidesWhereSidewalkIsPresent(way)); way = new ReaderWay(1); way.setTag("sidewalk", "none"); assertEquals(OSMAttachedSidewalkProcessor.Side.NONE, processor.identifySidesWhereSidewalkIsPresent(way)); way = new ReaderWay(1); way.setTag("footway:right:width", "0.5"); assertEquals(OSMAttachedSidewalkProcessor.Side.RIGHT, processor.identifySidesWhereSidewalkIsPresent(way)); }
protected Side identifySidesWhereSidewalkIsPresent(ReaderWay osmWay) { boolean sidewalkOnLeftSide = false; boolean sidewalkOnRightSide = false; boolean sidewalkOnBothSides = false; if(osmWay.hasTag("sidewalk")) { String side = osmWay.getTag("sidewalk"); switch(side) { case VAL_LEFT: sidewalkOnLeftSide = true; break; case VAL_RIGHT: sidewalkOnRightSide = true; break; case "both": sidewalkOnBothSides = true; break; default: } } Set<String> sidewalkProperties = getSidewalkKeys(osmWay); for(String key : sidewalkProperties) { if(key.startsWith("sidewalk:left") || key.startsWith("footway:left")) sidewalkOnLeftSide = true; if(key.startsWith("sidewalk:right") || key.startsWith("footway:right")) sidewalkOnRightSide = true; if(key.startsWith("sidewalk:both") || key.startsWith("footway:both")) sidewalkOnBothSides = true; } if(sidewalkOnLeftSide && sidewalkOnRightSide) { sidewalkOnBothSides = true; } if(sidewalkOnBothSides) { return Side.BOTH; } if(sidewalkOnLeftSide) { return Side.LEFT; } if(sidewalkOnRightSide) { return Side.RIGHT; } return Side.NONE; }
OSMAttachedSidewalkProcessor { protected Side identifySidesWhereSidewalkIsPresent(ReaderWay osmWay) { boolean sidewalkOnLeftSide = false; boolean sidewalkOnRightSide = false; boolean sidewalkOnBothSides = false; if(osmWay.hasTag("sidewalk")) { String side = osmWay.getTag("sidewalk"); switch(side) { case VAL_LEFT: sidewalkOnLeftSide = true; break; case VAL_RIGHT: sidewalkOnRightSide = true; break; case "both": sidewalkOnBothSides = true; break; default: } } Set<String> sidewalkProperties = getSidewalkKeys(osmWay); for(String key : sidewalkProperties) { if(key.startsWith("sidewalk:left") || key.startsWith("footway:left")) sidewalkOnLeftSide = true; if(key.startsWith("sidewalk:right") || key.startsWith("footway:right")) sidewalkOnRightSide = true; if(key.startsWith("sidewalk:both") || key.startsWith("footway:both")) sidewalkOnBothSides = true; } if(sidewalkOnLeftSide && sidewalkOnRightSide) { sidewalkOnBothSides = true; } if(sidewalkOnBothSides) { return Side.BOTH; } if(sidewalkOnLeftSide) { return Side.LEFT; } if(sidewalkOnRightSide) { return Side.RIGHT; } return Side.NONE; } }
OSMAttachedSidewalkProcessor { protected Side identifySidesWhereSidewalkIsPresent(ReaderWay osmWay) { boolean sidewalkOnLeftSide = false; boolean sidewalkOnRightSide = false; boolean sidewalkOnBothSides = false; if(osmWay.hasTag("sidewalk")) { String side = osmWay.getTag("sidewalk"); switch(side) { case VAL_LEFT: sidewalkOnLeftSide = true; break; case VAL_RIGHT: sidewalkOnRightSide = true; break; case "both": sidewalkOnBothSides = true; break; default: } } Set<String> sidewalkProperties = getSidewalkKeys(osmWay); for(String key : sidewalkProperties) { if(key.startsWith("sidewalk:left") || key.startsWith("footway:left")) sidewalkOnLeftSide = true; if(key.startsWith("sidewalk:right") || key.startsWith("footway:right")) sidewalkOnRightSide = true; if(key.startsWith("sidewalk:both") || key.startsWith("footway:both")) sidewalkOnBothSides = true; } if(sidewalkOnLeftSide && sidewalkOnRightSide) { sidewalkOnBothSides = true; } if(sidewalkOnBothSides) { return Side.BOTH; } if(sidewalkOnLeftSide) { return Side.LEFT; } if(sidewalkOnRightSide) { return Side.RIGHT; } return Side.NONE; }  }
OSMAttachedSidewalkProcessor { protected Side identifySidesWhereSidewalkIsPresent(ReaderWay osmWay) { boolean sidewalkOnLeftSide = false; boolean sidewalkOnRightSide = false; boolean sidewalkOnBothSides = false; if(osmWay.hasTag("sidewalk")) { String side = osmWay.getTag("sidewalk"); switch(side) { case VAL_LEFT: sidewalkOnLeftSide = true; break; case VAL_RIGHT: sidewalkOnRightSide = true; break; case "both": sidewalkOnBothSides = true; break; default: } } Set<String> sidewalkProperties = getSidewalkKeys(osmWay); for(String key : sidewalkProperties) { if(key.startsWith("sidewalk:left") || key.startsWith("footway:left")) sidewalkOnLeftSide = true; if(key.startsWith("sidewalk:right") || key.startsWith("footway:right")) sidewalkOnRightSide = true; if(key.startsWith("sidewalk:both") || key.startsWith("footway:both")) sidewalkOnBothSides = true; } if(sidewalkOnLeftSide && sidewalkOnRightSide) { sidewalkOnBothSides = true; } if(sidewalkOnBothSides) { return Side.BOTH; } if(sidewalkOnLeftSide) { return Side.LEFT; } if(sidewalkOnRightSide) { return Side.RIGHT; } return Side.NONE; }  ReaderWay attachSidewalkTag(ReaderWay way, Side side); Side getPreparedSide(ReaderWay way); }
OSMAttachedSidewalkProcessor { protected Side identifySidesWhereSidewalkIsPresent(ReaderWay osmWay) { boolean sidewalkOnLeftSide = false; boolean sidewalkOnRightSide = false; boolean sidewalkOnBothSides = false; if(osmWay.hasTag("sidewalk")) { String side = osmWay.getTag("sidewalk"); switch(side) { case VAL_LEFT: sidewalkOnLeftSide = true; break; case VAL_RIGHT: sidewalkOnRightSide = true; break; case "both": sidewalkOnBothSides = true; break; default: } } Set<String> sidewalkProperties = getSidewalkKeys(osmWay); for(String key : sidewalkProperties) { if(key.startsWith("sidewalk:left") || key.startsWith("footway:left")) sidewalkOnLeftSide = true; if(key.startsWith("sidewalk:right") || key.startsWith("footway:right")) sidewalkOnRightSide = true; if(key.startsWith("sidewalk:both") || key.startsWith("footway:both")) sidewalkOnBothSides = true; } if(sidewalkOnLeftSide && sidewalkOnRightSide) { sidewalkOnBothSides = true; } if(sidewalkOnBothSides) { return Side.BOTH; } if(sidewalkOnLeftSide) { return Side.LEFT; } if(sidewalkOnRightSide) { return Side.RIGHT; } return Side.NONE; }  ReaderWay attachSidewalkTag(ReaderWay way, Side side); Side getPreparedSide(ReaderWay way); static final String KEY_ORS_SIDEWALK_SIDE; static final String VAL_RIGHT; static final String VAL_LEFT; }