Changeset 11109 in josm
- Timestamp:
- 2016-10-09T04:03:32+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r11108 r11109 161 161 // Among existing nodes, try to keep the oldest used one 162 162 if (!n.getReferrers().isEmpty()) { 163 if (targetNode == null) { 164 targetNode = n; 165 } else if (n.getId() < targetNode.getId()) { 163 if (targetNode == null || n.getId() < targetNode.getId()) { 166 164 targetNode = n; 167 165 } 168 } else if (oldestNode == null) { 169 oldestNode = n; 170 } else if (n.getId() < oldestNode.getId()) { 166 } else if (oldestNode == null || n.getId() < oldestNode.getId()) { 171 167 oldestNode = n; 172 168 } … … 200 196 if (!nodesToDelete.contains(n) && !n.equals(targetNode)) { 201 197 newNodes.add(n); 202 } else if (newNodes.isEmpty()) { 203 newNodes.add(targetNode); 204 } else if (!newNodes.get(newNodes.size()-1).equals(targetNode)) { 198 } else if (newNodes.isEmpty() || !newNodes.get(newNodes.size()-1).equals(targetNode)) { 205 199 // make sure we collapse a sequence of deleted nodes 206 200 // to exactly one occurrence of the merged target node -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r10420 r11109 131 131 boolean zip; 132 132 FileFilter ff = fc.getFileFilter(); 133 if (zipRequired) { 134 zip = true; 135 } else if (joz.equals(ff)) { 133 if (zipRequired || joz.equals(ff)) { 136 134 zip = true; 137 135 } else if (jos.equals(ff)) { -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r10662 r11109 101 101 alertSelectAtLeastOneWay(); 102 102 return; 103 } else if (!confirmWayWithNodesOutsideBoundingBox(ways)) { 104 return; 105 } else if (ways.size() > 10 && !confirmSimplifyManyWays(ways.size())) { 103 } else if (!confirmWayWithNodesOutsideBoundingBox(ways) || (ways.size() > 10 && !confirmSimplifyManyWays(ways.size()))) { 106 104 return; 107 105 } -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r10601 r11109 79 79 Set<OsmPrimitive> ret = new HashSet<>(); 80 80 for (OsmPrimitive p: primitives) { 81 if (p.isNewOrUndeleted()) { 82 ret.add(p); 83 } else if (p.isModified() && !p.isIncomplete()) { 81 if (p.isNewOrUndeleted() || (p.isModified() && !p.isIncomplete())) { 84 82 ret.add(p); 85 83 } -
trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
r11108 r11109 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 5 6 6 7 import java.util.Arrays; … … 46 47 47 48 /** 48 * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - mode 049 * Unit test of {@link MergeNodesAction#selectTargetLocationNode} 49 50 */ 50 51 @Test 51 public void testSelectTargetLocationNode Mode0() {52 public void testSelectTargetLocationNode() { 52 53 Main.pref.putInteger("merge-nodes.mode", 0); 53 54 assertEquals(1, MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))).getId()); 54 }55 55 56 /**57 * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - mode 158 */59 @Test60 public void testSelectTargetLocationNodeMode1() {61 56 Main.pref.putInteger("merge-nodes.mode", 1); 62 57 assertEquals(LatLon.ZERO, MergeNodesAction.selectTargetLocationNode( 63 58 Arrays.asList(new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE))).getCoor()); 64 }65 59 66 /**67 * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - mode 2 with a single node68 */69 @Test70 public void testSelectTargetLocationNodeMode2SingleNode() {71 60 Main.pref.putInteger("merge-nodes.mode", 2); 72 61 assertEquals(LatLon.NORTH_POLE, MergeNodesAction.selectTargetLocationNode( 73 62 Arrays.asList(new Node(LatLon.NORTH_POLE))).getCoor()); 74 63 } 64 65 /** 66 * Unit test of {@link MergeNodesAction#selectTargetNode} 67 */ 68 @Test 69 public void testSelectTargetNode() { 70 assertNull(MergeNodesAction.selectTargetNode(Collections.emptyList())); 71 assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(new Node(1))).getId()); 72 } 75 73 }
Note:
See TracChangeset
for help on using the changeset viewer.