Ticket #12867: power.diff
File power.diff, 2.4 KB (added by , 8 years ago) |
---|
-
src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
41 41 protected static final Collection<String> POWER_TOWER_TAGS = Arrays.asList("tower", "pole"); 42 42 /** Values for {@code power} key interpreted as power stations */ 43 43 protected static final Collection<String> POWER_STATION_TAGS = Arrays.asList("station", "sub_station", "substation", "plant", "generator"); 44 /** Values for {@code building} key interpreted as power stations */ 45 protected static final Collection<String> BUILDING_STATION_TAGS = Arrays.asList("transformer_tower"); 44 46 /** Values for {@code power} key interpreted as allowed power items */ 45 47 protected static final Collection<String> POWER_ALLOWED_TAGS = Arrays.asList("switch", "transformer", "busbar", "generator", "switchgear", 46 48 "portal", "terminal", "insulator"); … … 173 175 * @return {@code true} if power key is set and equal to station/sub_station/plant 174 176 */ 175 177 protected static final boolean isPowerStation(OsmPrimitive p) { 176 return isPowerIn(p, POWER_STATION_TAGS) ;178 return isPowerIn(p, POWER_STATION_TAGS) || isBuildingIn(p, BUILDING_STATION_TAGS); 177 179 } 178 180 179 181 /** … … 195 197 } 196 198 197 199 /** 198 * Helper function to check if power tag sis a certain value.200 * Helper function to check if power tag is a certain value. 199 201 * @param p The primitive to be tested 200 202 * @param values List of possible values 201 203 * @return {@code true} if power key is set and equal to possible values … … 205 207 return v != null && values != null && values.contains(v); 206 208 } 207 209 210 /** 211 * Helper function to check if building tag is a certain value. 212 * @param p The primitive to be tested 213 * @param values List of possible values 214 * @return {@code true} if power key is set and equal to possible values 215 */ 216 private static boolean isBuildingIn(OsmPrimitive p, Collection<String> values) { 217 String v = p.get("building"); 218 return v != null && values != null && values.contains(v); 219 } 220 208 221 protected static class PowerLineError extends TestError { 209 222 private final Way line; 210 223