IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 52 | 52 | */ |
| 53 | 53 | public static TagCollection getDirectionalTags(Tagged way) { |
| 54 | 54 | final TagCollection collection = new TagCollection(); |
| | 55 | |
| | 56 | // TODO: uncomment the next line if needed |
| | 57 | //final Tag cityWall = new Tag("barrier", "city_wall"); |
| | 58 | |
| 55 | 59 | for (Map.Entry<String, String> entry : way.getKeys().entrySet()) { |
| 56 | 60 | final Tag tag = new Tag(entry.getKey(), entry.getValue()); |
| 57 | 61 | final boolean isDirectional = DIRECTIONAL_TAGS.contains(tag) || tag.isDirectionKey(); |
| 58 | 62 | if (isDirectional) { |
| 59 | 63 | final boolean cannotBeCorrected = ReverseWayTagCorrector.getTagCorrections(tag).isEmpty(); |
| 60 | | if (cannotBeCorrected) { |
| | 64 | |
| | 65 | // TODO: delete the inline comment if you want to restrict two_sided for city_wall only |
| | 66 | if (cannotBeCorrected && !(/*tag.equals(cityWall) && */way.isKeyTrue("two_sided"))) { |
| | 67 | // two_sided=yes is a special (documented) barrier=city_wall attribute, see #197140 |
| 61 | 68 | collection.add(tag); |
| 62 | 69 | } |
| 63 | 70 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 6 | 6 | import org.junit.Rule; |
| 7 | 7 | import org.junit.Test; |
| 8 | 8 | import org.openstreetmap.josm.data.osm.Tag; |
| | 9 | import org.openstreetmap.josm.data.osm.Tagged; |
| | 10 | import org.openstreetmap.josm.data.osm.Way; |
| 9 | 11 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 10 | 12 | |
| 11 | 13 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
| … |
… |
|
| 33 | 35 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("aerialway", "station")).size()); |
| 34 | 36 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("incline", "up")).size()); |
| 35 | 37 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("oneway", "yes")).size()); |
| | 38 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("barrier", "kerb")).size()); |
| | 39 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("barrier", "city_wall")).size()); |
| | 40 | |
| | 41 | final Tagged twoSidedCityWall = new Way(); |
| | 42 | twoSidedCityWall.put("barrier", "city_wall"); |
| | 43 | twoSidedCityWall.put("two_sided", "yes"); |
| | 44 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(twoSidedCityWall).size()); |
| 36 | 45 | } |
| 37 | 46 | } |