Changeset 24978 in osm
- Timestamp:
- 2011-01-05T14:05:35+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressEditContainer.java
r24141 r24978 52 52 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 53 53 import org.openstreetmap.josm.data.osm.visitor.Visitor; 54 import org.openstreetmap.josm.tools.CheckParameterUtil; 54 55 55 56 /** … … 70 71 */ 71 72 72 public class AddressEditContainer implements Visitor, DataSetListener, IAddressEditContainerListener {73 public class AddressEditContainer implements Visitor, DataSetListener, IAddressEditContainerListener, IProblemVisitor { 73 74 74 75 private Collection<? extends OsmPrimitive> workingSet; … … 98 99 private HashMap<String, String> values = new HashMap<String, String>(); 99 100 101 /** The list containing the problems */ 102 private List<IProblem> problems = new ArrayList<IProblem>(); 103 100 104 /** The change listeners. */ 101 105 private List<IAddressEditContainerListener> listeners = new ArrayList<IAddressEditContainerListener>(); … … 214 218 if (aNode != null) { 215 219 addAndClassifyAddress(aNode); 220 aNode.visit(this); 216 221 } 217 222 markNodeAsVisited(n); … … 463 468 return all; 464 469 } 470 471 /** 472 * @return the problems 473 */ 474 protected List<IProblem> getProblems() { 475 return problems; 476 } 477 478 /** 479 * Clears the problem list. 480 */ 481 protected void clearProblems() { 482 problems.clear(); 483 } 465 484 466 485 /** … … 540 559 shadowUnresolvedAddresses.clear(); 541 560 shadowIncompleteAddresses.clear(); 561 542 562 // update clients 543 563 fireContainerChanged(); … … 674 694 fireEntityChanged(entity); 675 695 } 696 697 /* (non-Javadoc) 698 * @see org.openstreetmap.josm.plugins.fixAddresses.IProblemVisitor#addProblem(org.openstreetmap.josm.plugins.fixAddresses.IProblem) 699 */ 700 @Override 701 public void addProblem(IProblem problem) { 702 problems.add(problem); 703 } 704 705 /* (non-Javadoc) 706 * @see org.openstreetmap.josm.plugins.fixAddresses.IProblemVisitor#removeProblemsOfSource(org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity) 707 */ 708 @Override 709 public void removeProblemsOfSource(IOSMEntity entity) { 710 CheckParameterUtil.ensureParameterNotNull(entity, "entity"); 711 712 List<IProblem> problemsToRemove = new ArrayList<IProblem>(); 713 for (IProblem problem : problems) { 714 if (problem.getSource() == entity) { 715 problemsToRemove.add(problem); 716 } 717 } 718 719 for (IProblem iProblem : problemsToRemove) { 720 problems.remove(iProblem); 721 } 722 } 676 723 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/IOSMEntity.java
r24089 r24978 70 70 */ 71 71 public void removeCommandListener(ICommandListener listener); 72 73 /** 74 * Collects problems and possible solutions. 75 * 76 * @param visitor the problem visitor 77 */ 78 public void visit(IProblemVisitor visitor); 72 79 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMAddress.java
r24229 r24978 628 628 } 629 629 630 /* (non-Javadoc) 631 * @see org.openstreetmap.josm.plugins.fixAddresses.OSMEntityBase#visit(org.openstreetmap.josm.plugins.fixAddresses.IProblemVisitor) 632 */ 633 public void visit(IProblemVisitor visitor) { 634 CheckParameterUtil.ensureParameterNotNull(visitor, "visitor"); 635 636 if (!hasStreetName()) { 637 638 } 639 } 640 641 /* (non-Javadoc) 642 * @see org.openstreetmap.josm.plugins.fixAddresses.OSMEntityBase#toString() 643 */ 630 644 @Override 631 645 public String toString() { … … 633 647 } 634 648 649 /** 650 * Gets the formatted string representation of the given node. 651 * 652 * @param node the node 653 * @return the format string 654 */ 635 655 public static String getFormatString(OSMAddress node) { 636 656 // TODO: Add further countries here -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMEntityBase.java
r24115 r24978 202 202 return this.getName().compareTo(o.getName()); 203 203 } 204 205 @Override 206 public void visit(IProblemVisitor visitor) { 207 // do nothing 208 } 204 209 205 210 /* (non-Javadoc) -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/AbstractAddressEditAction.java
r24114 r24978 175 175 @Override 176 176 public void entityChanged(IOSMEntity node) { 177 container.removeProblemsOfSource(node); // clear problems of changed node... 178 node.visit(container); // .. and revisit it. 177 179 updateEnabledState(); 178 180 }
Note:
See TracChangeset
for help on using the changeset viewer.