282 | | // see #18083: check if we will combine ways at nodes outside of the download area |
283 | | Set<Node> endNodesOutside = new HashSet<>(); |
284 | | for (Way w : selectedWays) { |
285 | | final Node[] endnodes = {w.firstNode(), w.lastNode()}; |
286 | | for (Node n : endnodes) { |
287 | | if (!n.isNew() && !n.isReferrersDownloaded() && !endNodesOutside.add(n)) { |
288 | | new Notification(tr("Combine ways refused<br>" + "(A shared node may have additional referrers)")) |
289 | | .setIcon(JOptionPane.INFORMATION_MESSAGE).show(); |
290 | | return; |
291 | | |
292 | | } |
293 | | } |
294 | | } |
295 | | |
| 337 | /** |
| 338 | * Check whether user is about to combine ways with unknown parents. |
| 339 | * Request confirmation if he is. |
| 340 | * @param ways the primitives to operate on |
| 341 | * @return true, if operating on outlying primitives is OK; false, otherwise |
| 342 | * @since xxx |
| 343 | */ |
| 344 | public static boolean checkAndConfirmCombineOutlyingWays(Collection<Way> ways) { |
| 345 | return Boolean.TRUE.equals(GuiHelper.runInEDTAndWaitAndReturn(() -> checkAndConfirmOutlyingOperation("combine", |
| 346 | tr("Combine confirmation"), |
| 347 | tr("You are about to combine ways which can have other referrers not yet downloaded." |
| 348 | + "<br>" |
| 349 | + "This can cause problems because other objects (that you do not see) might use them." |
| 350 | + "<br>" |
| 351 | + "Do you really want to combine?"), |
| 352 | "", // not used, we never combine incomplete ways |
| 353 | ways, Collections.emptyList()))); |
| 354 | } |
| 355 | |