Changeset 5413 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2012-08-09T23:56:29+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r5297 r5413 15 15 import java.util.Arrays; 16 16 import java.util.Collection; 17 import java.util.HashSet; 17 18 import java.util.Iterator; 18 19 import java.util.LinkedList; 20 import java.util.Set; 19 21 import java.util.concurrent.CopyOnWriteArrayList; 20 22 … … 57 59 public final class ConflictDialog extends ToggleDialog implements MapView.EditLayerChangeListener, IConflictListener, SelectionChangedListener{ 58 60 61 /** 62 * Replies the color used to paint conflicts. 63 * 64 * @return the color used to paint conflicts 65 * @since 1221 66 * @see #paintConflicts 67 */ 59 68 static public Color getColor() { 60 69 return Main.pref.getColor(marktr("conflict"), Color.gray); 61 70 } 62 71 63 /** the collection of conflicts displayed by this conflict dialog*/72 /** the collection of conflicts displayed by this conflict dialog */ 64 73 private ConflictCollection conflicts; 65 74 … … 176 185 177 186 /** 178 * Paint all conflicts that can be expressed on the main window. 187 * Paints all conflicts that can be expressed on the main window. 188 * 189 * @param g The {@code Graphics} used to paint 190 * @param nc The {@code NavigatableComponent} used to get screen coordinates of nodes 191 * @since 86 179 192 */ 180 193 public void paintConflicts(final Graphics g, final NavigatableComponent nc) { … … 183 196 return; 184 197 g.setColor(preferencesColor); 185 Visitor conflictPainter = new AbstractVisitor(){ 198 Visitor conflictPainter = new AbstractVisitor() { 199 // Manage a stack of visited relations to avoid infinite recursion with cyclic relations (fix #7938) 200 private final Set<Relation> visited = new HashSet<Relation>(); 186 201 public void visit(Node n) { 187 202 Point p = nc.getPoint(n); … … 206 221 public void visit(Relation e) { 207 222 for (RelationMember em : e.getMembers()) { 208 em.getMember().visit(this); 223 OsmPrimitive m = em.getMember(); 224 if (m instanceof Node || m instanceof Way) { 225 m.visit(this); 226 } else if (m instanceof Relation && !visited.contains(m)) { 227 visited.add((Relation) m); 228 try { 229 m.visit(this); 230 } finally { 231 visited.remove(m); 232 } 233 } 209 234 } 210 235 }
Note:
See TracChangeset
for help on using the changeset viewer.