Changeset 16438 in josm for trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
- Timestamp:
- 2020-05-17T14:18:22+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r16136 r16438 14 14 import java.util.Map; 15 15 import java.util.Set; 16 import java.util.stream.Collectors; 17 import java.util.stream.IntStream; 16 18 17 19 import javax.swing.JOptionPane; … … 234 236 // Choose nodes used as anchor points for projection. 235 237 Node[] anchors = nodePairFurthestApart(nodes); 236 Collection<Command> cmds = new ArrayList<>(nodes.size());237 238 Line line = new Line(anchors[0], anchors[1]); 238 for (Node node: nodes) {239 if (node != anchors[0] && node != anchors[1])240 cmds.add(line.projectionCommand(node));241 }239 Collection<Command> cmds = nodes.stream() 240 .filter(node -> node != anchors[0] && node != anchors[1]) 241 .map(line::projectionCommand) 242 .collect(Collectors.toList()); 242 243 return new SequenceCommand(tr("Align Nodes in Line"), cmds); 243 244 } … … 312 313 // see #9081 comment 6 313 314 EastNorth c = node.getEastNorth(); 314 double[] angle = new double[4]; 315 for (int i = 0; i < 4; i++) { 316 angle[i] = PolarCoor.computeAngle(neighbors.get(i).getEastNorth(), c); 317 } 315 double[] angle = IntStream.range(0, 4) 316 .mapToDouble(i -> PolarCoor.computeAngle(neighbors.get(i).getEastNorth(), c)).toArray(); 318 317 double[] deltaAngle = new double[3]; 319 318 for (int i = 0; i < 3; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.