Subject: [PATCH] #23203
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/actions/SimplifyWayAction.java b/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
|
a
|
b
|
|
| 203 | 203 | @Override |
| 204 | 204 | public void actionPerformed(ActionEvent e) { |
| 205 | 205 | DataSet ds = getLayerManager().getEditDataSet(); |
| 206 | | ds.update(() -> { |
| 207 | | List<Way> ways = ds.getSelectedWays().stream() |
| 208 | | .filter(p -> !p.isIncomplete()) |
| 209 | | .collect(Collectors.toList()); |
| 210 | | if (ways.isEmpty()) { |
| 211 | | alertSelectAtLeastOneWay(); |
| 212 | | return; |
| 213 | | } else if (!confirmWayWithNodesOutsideBoundingBox(ways) || (ways.size() > 10 && !confirmSimplifyManyWays(ways.size()))) { |
| 214 | | return; |
| 215 | | } |
| | 206 | List<Way> ways = ds.getSelectedWays().stream() |
| | 207 | .filter(p -> !p.isIncomplete()) |
| | 208 | .collect(Collectors.toList()); |
| | 209 | if (ways.isEmpty()) { |
| | 210 | alertSelectAtLeastOneWay(); |
| | 211 | return; |
| | 212 | } else if (!confirmWayWithNodesOutsideBoundingBox(ways) || (ways.size() > 10 && !confirmSimplifyManyWays(ways.size()))) { |
| | 213 | return; |
| | 214 | } |
| 216 | 215 | |
| 217 | | String lengthstr = SystemOfMeasurement.getSystemOfMeasurement().getDistText( |
| 218 | | ways.stream().mapToDouble(Way::getLength).sum()); |
| | 216 | String lengthstr = SystemOfMeasurement.getSystemOfMeasurement().getDistText( |
| | 217 | ways.stream().mapToDouble(Way::getLength).sum()); |
| 219 | 218 | |
| 220 | | double err = askSimplifyWays(ways, trn( |
| 221 | | "You are about to simplify {0} way with a total length of {1}.", |
| 222 | | "You are about to simplify {0} ways with a total length of {1}.", |
| 223 | | ways.size(), ways.size(), lengthstr), false); |
| | 219 | double err = askSimplifyWays(ways, trn( |
| | 220 | "You are about to simplify {0} way with a total length of {1}.", |
| | 221 | "You are about to simplify {0} ways with a total length of {1}.", |
| | 222 | ways.size(), ways.size(), lengthstr), false); |
| 224 | 223 | |
| 225 | | if (err > 0) { |
| 226 | | simplifyWays(ways, err); |
| 227 | | } |
| 228 | | }); |
| | 224 | if (err > 0) { |
| | 225 | simplifyWays(ways, err); |
| | 226 | } |
| 229 | 227 | } |
| 230 | 228 | |
| 231 | 229 | /** |