Changeset 35468 in osm
- Timestamp:
- 2020-05-22T18:11:19+02:00 (5 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/MiddleNodesAction.java
r34812 r35468 9 9 import java.util.Collection; 10 10 import java.util.HashSet; 11 import java.util.LinkedHashSet; 11 12 import java.util.Set; 12 13 … … 44 45 } 45 46 46 Set<Node> newNodes = new HashSet<>(); 47 NodeWayUtils.addMiddle(selectedNodes, newNodes); 47 Set<Node> newSelectedNodes = new LinkedHashSet<>(); 48 NodeWayUtils.addMiddle(selectedNodes, newSelectedNodes); 48 49 49 // select only newly found nodes50 newNodes.removeAll(selectedNodes);51 getLayerManager().getEditDataSet().addSelected(newNodes); 50 // make sure that selected nodes are in the wanted order (see #josm17258) 51 getLayerManager().getEditDataSet().clearSelection(newSelectedNodes); 52 getLayerManager().getEditDataSet().addSelected(newSelectedNodes); 52 53 } 53 54 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
r35334 r35468 271 271 if (w.isClosed()) { 272 272 if ((i2-i1)*2 <= n) { // i1 ... i2 273 for (int i = i1 +1; i != i2; i++) {273 for (int i = i1; i != i2; i++) { 274 274 filteredAdd(newNodes, nodes.get(i)); 275 275 } 276 filteredAdd(newNodes, nodes.get(i2)); 276 277 } else { // i2 ... n-1 0 1 ... i1 277 for (int i = i2 +1; i != i1; i = (i+1) % n) {278 for (int i = i2; i != i1; i = (i+1) % n) { 278 279 filteredAdd(newNodes, nodes.get(i)); 279 280 } 281 filteredAdd(newNodes, nodes.get(i1)); 280 282 } 281 283 } else { 282 for (int i = i1 +1; i <i2; i++) {284 for (int i = i1; i <= i2; i++) { 283 285 filteredAdd(newNodes, nodes.get(i)); 284 286 } … … 286 288 } 287 289 } 288 if (newNodes. isEmpty()) {290 if (newNodes.size() <= 2) { 289 291 new Notification( 290 292 tr("Please select two nodes connected by way!") -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectWayNodesAction.java
r35173 r35468 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.Collection; 10 import java.util.HashSet; 10 import java.util.LinkedHashSet; 11 11 import java.util.Set; 12 12 … … 39 39 @Override 40 40 public void actionPerformed(ActionEvent e) { 41 Set<Node> selectedNodes = new HashSet<>(); 41 Set<Node> selectedNodes = new LinkedHashSet<>(); 42 42 43 43 for (OsmPrimitive p : getLayerManager().getEditDataSet().getSelected()) {
Note:
See TracChangeset
for help on using the changeset viewer.