Changeset 23982 in osm for applications/editors
- Timestamp:
- 2010-11-01T04:02:26+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressFinderThread.java
r23973 r23982 34 34 35 35 public class AddressFinderThread extends PleaseWaitRunnable implements Visitor { 36 private AddressEditContainer container;36 private List<AddressNode> addressesToGuess; 37 37 private double minDist; 38 38 private AddressNode curAddressNode; … … 43 43 44 44 /** 45 * @param AddressEditContainer45 * @param nodes 46 46 */ 47 public AddressFinderThread( AddressEditContainer AddressEditContainer, String title) {47 public AddressFinderThread(List<AddressNode> nodes, String title) { 48 48 super(title != null ? title : tr("Searching")); 49 setAddressEditContainer( AddressEditContainer);49 setAddressEditContainer(nodes); 50 50 } 51 51 52 public void setAddressEditContainer( AddressEditContainer AddressEditContainer) {52 public void setAddressEditContainer(List<AddressNode> nodes) { 53 53 if (isRunning) { 54 54 throw new ConcurrentModificationException(); 55 55 } 56 this. container = AddressEditContainer;56 this.addressesToGuess = nodes; 57 57 } 58 58 59 public AddressEditContainergetAddressEditContainer() {60 return container;59 public List<AddressNode> getAddressEditContainer() { 60 return addressesToGuess; 61 61 } 62 62 /** … … 140 140 protected void realRun() throws SAXException, IOException, 141 141 OsmTransferException { 142 if (Main.main.getCurrentDataSet() == null || container== null) return;142 if (Main.main.getCurrentDataSet() == null || addressesToGuess == null) return; 143 143 144 144 isRunning = true; … … 148 148 149 149 try { 150 progressMonitor.setTicksCount( container.getNumberOfUnresolvedAddresses());150 progressMonitor.setTicksCount(addressesToGuess.size()); 151 151 152 List<AddressNode> shadowCopy = new ArrayList<AddressNode>( container.getUnresolvedAddresses());152 List<AddressNode> shadowCopy = new ArrayList<AddressNode>(addressesToGuess); 153 153 for (AddressNode aNode : shadowCopy) { 154 154 minDist = Double.MAX_VALUE; 155 155 curAddressNode = aNode; 156 157 if (aNode.hasStreetName()) { 158 progressMonitor.worked(1); 159 continue; 160 } 156 161 157 162 // check for cancel … … 180 185 progressMonitor.worked(1); 181 186 } 182 // request container update183 container.invalidate();184 187 } finally { 185 188 isRunning = false; -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressNode.java
r23970 r23982 250 250 if (hasGuessedStreetName()) { 251 251 setOSMTag(TagUtils.ADDR_STREET_TAG, guessedStreetName); 252 guessedStreetName = null; 252 253 } 253 254 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditDialog.java
r23980 r23982 299 299 300 300 for (int i = 0; i < actions.length; i++) { 301 actions[i].setEvent(null); 301 302 actions[i].setContainer(container); 302 303 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/GuessAddressDataAction.java
r23963 r23982 80 80 */ 81 81 private void internalGuessAddresses(List<AddressNode> nodes) { 82 Main.worker.submit(new AddressFinderThread(container, tr("Guess street names"))); 82 Main.worker.submit(new AddressFinderThread(nodes, tr("Guess street names"))); 83 if (container != null) { 84 container.invalidate(); 85 } 83 86 } 84 87 }
Note:
See TracChangeset
for help on using the changeset viewer.