Changeset 24028 in osm for applications/editors/josm
- Timestamp:
- 2010-11-02T20:43:02+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressEditContainer.java
r24026 r24028 89 89 private List<AddressNode> shadowIncompleteAddresses = new ArrayList<AddressNode>(100); 90 90 91 /** The visited nodes cache to increase iteration sp ped. */91 /** The visited nodes cache to increase iteration speed. */ 92 92 private HashSet<Node> visitedNodes = new HashSet<Node>(); 93 /** The visited ways cache to increase iteration sp ped. */93 /** The visited ways cache to increase iteration speed. */ 94 94 private HashSet<Way> visitedWays = new HashSet<Way>(); 95 95 /** The tag list used within the data area. */ 96 96 private HashSet<String> tags = new HashSet<String>(); 97 /** The tag list used within the data area. */ 98 private HashMap<String, String> values = new HashMap<String, String>(); 97 99 98 100 /** The change listeners. */ … … 241 243 // Assignment failed: Street is not known (yet) -> add to 'unresolved' list 242 244 shadowUnresolvedAddresses.add(aNode); 243 244 if ("BaDaubringen".equals(aNode.getCity())) {245 @SuppressWarnings("unused")246 int x = 0;247 }248 245 } 249 246 250 247 if (!aNode.isComplete()) { 251 248 shadowIncompleteAddresses.add(aNode); 252 253 if ("BaDaubringen".equals(aNode.getCity())) {254 @SuppressWarnings("unused")255 int x = 0;256 }257 249 } 258 250 } … … 276 268 if (!tags.contains(key)) { 277 269 tags.add(key); 270 } 271 272 String v = w.get(key); 273 if (!values.containsKey(v)) { 274 values.put(v, key); 278 275 } 279 276 } … … 395 392 return tags; 396 393 } 397 394 395 /** 396 * @return the values 397 */ 398 protected HashMap<String, String> getValues() { 399 return values; 400 } 401 398 402 /** 399 403 * Gets the number of streets in the container. -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressFinderThread.java
r24023 r24028 211 211 // guess values 212 212 for (int i = 0; i < guessers.length; i++) { 213 if (!guessers[i].needsGuess()) continue; 214 213 215 osmPrimitive.visit(guessers[i]); 216 217 if (guessers[i].currentValue == null && i == 0) { 218 System.err.println("Guess #" + i + " failed for " + aNode); 219 } 214 220 } 215 221 } … … 243 249 @Override 244 250 public void visit(Way w) { 245 if (TagUtils. hasHighwayTag(w)) {251 if (TagUtils.isStreetSupportingHousenumbers(w)) { 246 252 AddressNode aNode = getAddressNode(); 247 253 double dist = OsmUtils.getMinimumDistanceToWay(aNode.getCoor(), w); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressNode.java
r24026 r24028 342 342 * has either no street name, post code or city. 343 343 * 344 * @return true, if this instance needs at least one guessed value. 345 */ 346 public boolean needsGuess() { 347 return needsGuessedValue(TagUtils.ADDR_CITY_TAG) || 348 needsGuessedValue(TagUtils.ADDR_POSTCODE_TAG) || 349 needsGuessedValue(TagUtils.ADDR_STREET_TAG); 350 } 351 352 /** 353 * Check if this instance needs guessed value for a given tag. 344 354 * @return true, if successful 345 355 */ 346 public boolean needsGuess () {347 return !hasStreetName() || !hasCity() || !hasPostCode();356 public boolean needsGuessedValue(String tag) { 357 return MISSING_TAG.equals(getTagValueWithGuess(tag)); 348 358 } 349 359 -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixUnresolvedStreetsAction.java
r23981 r24028 40 40 41 41 addressEditContainer = new AddressEditContainer(); 42 42 43 DataSet.addSelectionListener(this); 43 44 } … … 60 61 addressEditContainer.attachToDataSet(newSelection); 61 62 try { 63 //generateTagCode(addressEditContainer); 62 64 AddressEditDialog dlg = new AddressEditDialog(addressEditContainer); 63 65 dlg.setVisible(true); … … 111 113 .toUpperCase().replaceAll(":", "_"), tag)); 112 114 } 115 116 for (String value : addrVisitor.getValues().keySet()) { 117 String tag = addrVisitor.getValues().get(value); 118 119 String tags = tag.toUpperCase().replaceAll(":", "_"); 120 String values = value.toUpperCase().replaceAll(":", "_"); 121 System.out.println(String.format( 122 "public static final String %s_%s_VALUE = \"%s\";", tags, values 123 , value)); 124 } 113 125 } 114 126 -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/GuessedValueHandler.java
r24018 r24028 123 123 } 124 124 125 /** 126 * Check if we need to visit the OSM data 127 * 128 * @return true, if successful 129 */ 130 public boolean needsGuess() { 131 return aNode.needsGuessedValue(tag); 132 } 133 125 134 /* (non-Javadoc) 126 135 * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Node) -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmUtils.java
r24023 r24028 72 72 double min = Math.min(Math.min(ac, mc), bc); 73 73 74 74 75 if (min < 5.0) { // close enough? 75 76 return min; -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/TagUtils.java
r24023 r24028 17 17 import org.openstreetmap.josm.data.osm.Relation; 18 18 import org.openstreetmap.josm.data.osm.RelationMember; 19 import org.openstreetmap.josm.data.osm.Way; 19 20 20 21 /** … … 1877 1878 public static String getEmbankmentValue(OsmPrimitive osmPrimitive) { 1878 1879 return osmPrimitive != null ? osmPrimitive.get(EMBANKMENT_TAG) : null; 1880 } 1881 1882 /** 1883 * Checks if the given street supporting housenumbers. Usually motor ways and primary roads have 1884 * no addresses, also no paths or tracks. 1885 * 1886 * @param w the w 1887 * @return true, if is street supporting housenumbers 1888 */ 1889 public static boolean isStreetSupportingHousenumbers(Way w) { 1890 if (w == null) return false; 1891 if (!hasHighwayTag(w)) { 1892 return false; 1893 } 1894 1895 // TODO: Should be configurable 1896 String hwType = getHighwayValue(w); 1897 1898 return HIGHWAY_RESIDENTIAL_VALUE.equals(hwType) || 1899 HIGHWAY_SECONDARY_VALUE.equals(hwType) || 1900 HIGHWAY_TERTIARY_VALUE.equals(hwType) || 1901 HIGHWAY_LIVING_STREET_VALUE.equals(hwType) || 1902 HIGHWAY_UNCLASSIFIED_VALUE.equals(hwType); 1879 1903 } 1880 1904 … … 2005 2029 public static final String ADDR_HOUSENAME_TAG = "addr:housename"; 2006 2030 2031 /* Highway types */ 2032 public static final String HIGHWAY_CYCLEWAY_VALUE = "cycleway"; 2033 public static final String HIGHWAY_FOOTWAY_VALUE = "footway"; 2034 public static final String HIGHWAY_MOTORWAY_LINK_VALUE = "motorway_link"; 2035 public static final String HIGHWAY_MOTORWAY_VALUE = "motorway"; 2036 public static final String HIGHWAY_PATH_VALUE = "path"; 2037 public static final String HIGHWAY_RESIDENTIAL_VALUE = "residential"; 2038 public static final String HIGHWAY_LIVING_STREET_VALUE = "living_street"; 2039 public static final String HIGHWAY_ROAD_VALUE = "road"; 2040 public static final String HIGHWAY_SECONDARY_VALUE = "secondary"; 2041 public static final String HIGHWAY_SERVICE_VALUE = "service"; 2042 public static final String HIGHWAY_STEPS_VALUE = "steps"; 2043 public static final String HIGHWAY_TERTIARY_VALUE = "tertiary"; 2044 public static final String HIGHWAY_TRACK_VALUE = "track"; 2045 public static final String HIGHWAY_TRUNK_LINK_VALUE = "trunk_link"; 2046 public static final String HIGHWAY_TRUNK_VALUE = "trunk"; 2047 public static final String HIGHWAY_UNCLASSIFIED_VALUE = "unclassified"; 2048 2007 2049 /* Relation keys */ 2008 2050
Note:
See TracChangeset
for help on using the changeset viewer.