Changeset 6639 in josm
- Timestamp:
- 2014-01-06T12:27:11+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r6380 r6639 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.awt.geom.Area;11 10 import java.util.ArrayList; 12 11 import java.util.Collection; … … 338 337 339 338 // TODO: Only display this warning when nodes outside dataSourceArea are deleted 340 Area dataSourceArea = Main.main.getCurrentDataSet().getDataSourceArea();341 339 boolean ok = Command.checkAndConfirmOutlyingOperation("joinarea", tr("Join area confirmation"), 342 340 trn("The selected way has nodes outside of the downloaded data region.", … … 347 345 + tr("Please abort if you are not sure"), 348 346 tr("The selected area is incomplete. Continue?"), 349 dataSourceArea,allNodes, null);347 allNodes, null); 350 348 if(!ok) return; 351 349 -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r6411 r6639 49 49 50 50 protected boolean confirmWayWithNodesOutsideBoundingBox(List<? extends OsmPrimitive> primitives) { 51 return DeleteCommand.checkAndConfirmOutlyingDelete( Main.main.getEditLayer(),primitives, null);51 return DeleteCommand.checkAndConfirmOutlyingDelete(primitives, null); 52 52 } 53 53 -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r6507 r6639 438 438 + "This will cause problems because you don''t see the real object." 439 439 + "<br>" + "Do you really want to unglue?"), 440 getEditLayer().data.getDataSourceArea(),primitives, null);440 primitives, null); 441 441 } 442 442 } -
trunk/src/org/openstreetmap/josm/command/Command.java
r6538 r6639 191 191 * @param outsideDialogMessage the message text to be displayed when data is outside of the download area 192 192 * @param incompleteDialogMessage the message text to be displayed when data is incomplete 193 * @param area the area used to determine whether data is outlying194 193 * @param primitives the primitives to operate on 195 194 * @param ignore {@code null} or a primitive to be ignored … … 198 197 public static boolean checkAndConfirmOutlyingOperation(String operation, 199 198 String dialogTitle, String outsideDialogMessage, String incompleteDialogMessage, 200 Area area,Collection<? extends OsmPrimitive> primitives,199 Collection<? extends OsmPrimitive> primitives, 201 200 Collection<? extends OsmPrimitive> ignore) { 202 201 boolean outside = false; … … 205 204 if (osm.isIncomplete()) { 206 205 incomplete = true; 207 } else if ( area != null && isOutlying(osm, area)206 } else if (osm.isOutsideDownloadArea() 208 207 && (ignore == null || !ignore.contains(osm))) { 209 208 outside = true; … … 241 240 } 242 241 243 private static boolean isOutlying(OsmPrimitive osm, Area area) {244 if (osm instanceof Node && !osm.isNewOrUndeleted()) {245 return !((Node) osm).getCoor().isIn(area);246 } else if (osm instanceof Way) {247 for (Node n : ((Way) osm).getNodes()) {248 if (isOutlying(n, area)) {249 return true;250 }251 }252 return false;253 }254 return false;255 }256 242 } -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r6524 r6639 7 7 8 8 import java.awt.GridBagLayout; 9 import java.awt.geom.Area;10 9 import java.util.ArrayList; 11 10 import java.util.Collection; … … 253 252 if (parents.isEmpty()) 254 253 return null; 255 if (!silent && !checkAndConfirmOutlyingDelete( layer,parents, null))254 if (!silent && !checkAndConfirmOutlyingDelete(parents, null)) 256 255 return null; 257 256 return new DeleteCommand(layer,parents); … … 355 354 } 356 355 357 if (!silent && !checkAndConfirmOutlyingDelete( layer,356 if (!silent && !checkAndConfirmOutlyingDelete( 358 357 primitivesToDelete, Utils.filteredCollection(primitivesToDelete, Way.class))) 359 358 return null; … … 450 449 } 451 450 452 public static boolean checkAndConfirmOutlyingDelete(OsmDataLayer layer, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) { 453 return checkAndConfirmOutlyingDelete(layer.data.getDataSourceArea(), primitives, ignore); 454 } 455 456 public static boolean checkAndConfirmOutlyingDelete(Area area, Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) { 451 public static boolean checkAndConfirmOutlyingDelete(Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore) { 457 452 return Command.checkAndConfirmOutlyingOperation("delete", 458 453 tr("Delete confirmation"), … … 466 461 + "This will cause problems because you don''t see the real object." 467 462 + "<br>" + "Do you really want to delete?"), 468 area,primitives, ignore);463 primitives, ignore); 469 464 } 470 465 -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r6556 r6639 376 376 return false; 377 377 } 378 379 @Override 380 public boolean isOutsideDownloadArea() { 381 return !isNewOrUndeleted() && getDataSet() != null && getDataSet().getDataSourceArea() != null 382 && !getCoor().isIn(getDataSet().getDataSourceArea()); 383 } 378 384 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r6629 r6639 1367 1367 */ 1368 1368 public abstract boolean concernsArea(); 1369 1370 /** 1371 * Tests if this primitive lies outside of the downloaded area of its {@link DataSet}. 1372 * @return {@code true} if this primitive lies outside of the downloaded area 1373 */ 1374 public abstract boolean isOutsideDownloadArea(); 1369 1375 } -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r6575 r6639 550 550 return isMultipolygon() && hasAreaTags(); 551 551 } 552 553 @Override 554 public boolean isOutsideDownloadArea() { 555 return false; 556 } 552 557 } -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r6491 r6639 726 726 return hasAreaTags(); 727 727 } 728 729 @Override 730 public boolean isOutsideDownloadArea() { 731 for (final Node n : nodes) { 732 if (n.isOutsideDownloadArea()) { 733 return true; 734 } 735 } 736 return false; 737 } 728 738 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/BarriersEntrances.java
r6192 r6639 27 27 @Override 28 28 public void visit(Node n) { 29 if (n.hasTag("barrier", "entrance") ) {29 if (n.hasTag("barrier", "entrance") && !n.isOutsideDownloadArea()) { 30 30 for (OsmPrimitive p : n.getReferrers()) { 31 31 if (p.hasKey("barrier")) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r6258 r6639 409 409 } 410 410 411 if (DeleteCommand.checkAndConfirmOutlyingDelete( Main.main.getCurrentDataSet().getDataSourceArea(),nodes, Collections.singleton(target)))411 if (DeleteCommand.checkAndConfirmOutlyingDelete(nodes, Collections.singleton(target))) 412 412 return MergeNodesAction.mergeNodes(Main.main.getEditLayer(), nodes, target); 413 413 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java
r6494 r6639 64 64 65 65 private void testForError(Way w, Node wayNode, OsmPrimitive p) { 66 if (isArea(p)) { 66 if (wayNode.isOutsideDownloadArea()) { 67 } else if (isArea(p)) { 67 68 addError(w, wayNode, p); 68 69 } else {
Note:
See TracChangeset
for help on using the changeset viewer.