Changeset 24941 in osm for applications/editors/josm
- Timestamp:
- 2011-01-02T12:10:26+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmUtils.java
r24220 r24941 98 98 99 99 /** 100 * Gets the associated street name via relation of the address node, if present. 101 * 102 * @param address the address 103 * @return true, if an associated street has been found. 100 * Checks, if the given address has a relation hosting the address values. This method looks 101 * for a relation of type 'associatedStreet' and checks the members for address values, if present. 102 * If the member has address values, this methods sets the derived properties of the address 103 * node accordingly. 104 * 105 * @param address The address to check. 106 * @return true, if an associated relation has been found. 104 107 */ 105 108 public static boolean getValuesFromRelation(OSMAddress address) { … … 111 114 OsmPrimitive addrNode = address.getOsmObject(); 112 115 116 // check all referrers of the node 113 117 for (OsmPrimitive osm : addrNode.getReferrers()) { 114 118 if (osm instanceof Relation) { 115 119 Relation r = (Relation) osm; 116 120 // Relation has the right type? 117 121 if (!TagUtils.isAssociatedStreetRelation(r)) continue; 118 122 123 // check for 'street' members 119 124 for (RelationMember rm : r.getMembers()) { 120 125 if (TagUtils.isStreetMember(rm)) { 121 126 OsmPrimitive street = rm.getMember(); 122 if (TagUtils.hasHighwayTag(street)) { 127 if (TagUtils.hasHighwayTag(street)) { 123 128 String streetName = TagUtils.getNameValue(street); 124 129 if (!StringUtils.isNullOrEmpty(streetName)) { 130 // street name found -> set property 125 131 address.setDerivedValue(TagUtils.ADDR_STREET_TAG, streetName); 126 132 hasValuesFromRel = true; 127 133 break; 128 } 129 } // TODO: Issue a warning here134 } // else: Street has no name: Ooops 135 } // else: Street member, but no highway tag: Ooops 130 136 } 131 137 } … … 152 158 * Gets the tag values from an address interpolation ref, if present. 153 159 * 154 * @param address the address155 * @return t he values from address interpolation160 * @param address The address 161 * @return true, if house numbers are given via address interpolation; otherwise false. 156 162 */ 157 163 public static boolean getValuesFromAddressInterpolation(OSMAddress address) { … … 178 184 179 185 /** 180 * Gets the local ecode as string.181 * 182 * @return the locale186 * Gets the local code as string. 187 * 188 * @return the string representation of the local. 183 189 */ 184 190 public static String getLocale() { … … 191 197 } 192 198 199 /** 200 * Helper method to set an derived value of an address node. 201 * 202 * @param address The address to change 203 * @param w the way containing the tag for the derived value. 204 * @param tag the tag to set as applied value. 205 */ 193 206 private static void applyDerivedValue(OSMAddress address, Way w, String tag) { 194 207 if (!address.hasTag(tag) && TagUtils.hasTag(w, tag)) {
Note:
See TracChangeset
for help on using the changeset viewer.