Ignore:
Timestamp:
2016-06-12T20:40:45+02:00 (8 years ago)
Author:
stoecker
Message:

gsoc-core - patch by Michael Zangl - fix #12955 - remove deprecation usage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java

    r10234 r10363  
    4242    /** Values for {@code power} key interpreted as power stations */
    4343    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");
    4446    /** Values for {@code power} key interpreted as allowed power items */
    4547    protected static final Collection<String> POWER_ALLOWED_TAGS = Arrays.asList("switch", "transformer", "busbar", "generator", "switchgear",
     
    174176     */
    175177    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);
    177179    }
    178180
     
    196198
    197199    /**
    198      * Helper function to check if power tags is a certain value.
     200     * Helper function to check if power tag is a certain value.
    199201     * @param p The primitive to be tested
    200202     * @param values List of possible values
     
    203205    private static boolean isPowerIn(OsmPrimitive p, Collection<String> values) {
    204206        String v = p.get("power");
     207        return v != null && values != null && values.contains(v);
     208    }
     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");
    205218        return v != null && values != null && values.contains(v);
    206219    }
Note: See TracChangeset for help on using the changeset viewer.