Ticket #14093: PowerLines.java.patch
File PowerLines.java.patch, 1.8 KB (added by , 8 years ago) |
---|
-
PowerLines.java
9 9 import java.util.List; 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.command.ChangePropertyCommand;13 12 import org.openstreetmap.josm.data.osm.Node; 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 14 import org.openstreetmap.josm.data.osm.Relation; … … 61 60 String fixValue = null; 62 61 TestError.Builder error = null; 63 62 Node errorNode = null; 64 boolean canFix = false;65 63 for (Node n : w.getNodes()) { 66 64 if (!isPowerTower(n)) { 67 65 if (!isPowerAllowed(n) && IN_DOWNLOADED_AREA.test(n)) { … … 72 70 errorNode = n; 73 71 } 74 72 } 75 } else if (fixValue == null) { 76 // First tower/pole tag found, remember it 77 fixValue = n.get("power"); 78 canFix = true; 79 } else if (!fixValue.equals(n.get("power"))) { 80 // The power line contains both "tower" and "pole" -> cannot fix this error 81 canFix = false; 82 } 73 } 83 74 } 84 if (error != null && canFix) { 85 final ChangePropertyCommand fix = new ChangePropertyCommand(errorNode, "power", fixValue); 86 potentialErrors.add(error.fix(() -> fix).build()); 87 } else if (error != null) { 75 if (error != null) { 88 76 potentialErrors.add(error.build()); 89 77 } 90 78 } else if (w.isClosed() && isPowerStation(w)) {