Changeset 27321 in osm for applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap
- Timestamp:
- 2011-12-27T19:27:27+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/GuessAddressRunnable.java
r26509 r27321 40 40 * adds the guessed value to a shadowed field by calling {@link OSMAddress#setGuessedValue(String, String)}. 41 41 */ 42 public class GuessAddressRunnable extends PleaseWaitRunnable implements Visitor{42 public class GuessAddressRunnable extends PleaseWaitRunnable { 43 43 private List<OSMAddress> addressesToGuess; 44 44 private List<IProgressMonitorFinishedListener> finishListeners = new ArrayList<IProgressMonitorFinishedListener>(); … … 115 115 finishListeners.clear(); 116 116 } 117 118 /* (non-Javadoc) 119 * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Node) 120 */ 121 @Override 122 public void visit(Node n) { 123 if (n == null) return; 124 if (curAddressNode == null) return; 125 126 // If the coordinates are null, we are screwed anyway 127 LatLon ll = curAddressNode.getCoor(); 128 if (ll == null) return; 129 130 double dist = ll.greatCircleDistance(n.getCoor()); 131 132 if (dist < minDist) { 133 minDist = dist; 134 } 135 } 136 137 /* (non-Javadoc) 138 * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Way) 139 */ 140 @Override 141 public void visit(Way w) { 142 // skip non-streets and streets without name 143 if (!TagUtils.hasHighwayTag(w)) return; 144 if (!TagUtils.hasNameTag(w)) return; 145 146 for (Node node : w.getNodes()) { 147 visit(node); 148 } 149 } 150 151 /* (non-Javadoc) 152 * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Relation) 153 */ 154 @Override 155 public void visit(Relation e) { 156 // nothing to do yet 157 } 158 159 /* (non-Javadoc) 160 * @see org.openstreetmap.josm.data.osm.visitor.Visitor#visit(org.openstreetmap.josm.data.osm.Changeset) 161 */ 162 @Override 163 public void visit(Changeset cs) { 164 // nothing to do yet 165 } 166 117 167 118 /* (non-Javadoc) 168 119 * @see org.openstreetmap.josm.gui.PleaseWaitRunnable#cancel() … … 187 138 protected void realRun() throws SAXException, IOException, 188 139 OsmTransferException { 140 189 141 if (Main.main.getCurrentDataSet() == null || addressesToGuess == null) return; 190 142 … … 276 228 277 229 if (dist < minDist && dist < getMaxDistance()) { 278 //System.out.println(String.format("New guess %s: %4.2f m", TagUtils.getNameValue(w), dist));230 System.out.println(String.format("New guess %s: %4.2f m", TagUtils.getNameValue(w), dist)); 279 231 minDist = dist; 280 232 currentValue = TagUtils.getNameValue(w);
Note:
See TracChangeset
for help on using the changeset viewer.