Changeset 5132 in josm for trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
- Timestamp:
- 2012-03-29T23:22:07+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r4982 r5132 43 43 import org.openstreetmap.josm.data.osm.Way; 44 44 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; 45 import org.openstreetmap.josm.gui.conflict.tags.TagConflictResolutionUtil;46 45 import org.openstreetmap.josm.tools.Geometry; 47 46 import org.openstreetmap.josm.tools.Pair; … … 538 537 } 539 538 540 if (ways.size() < 2) 539 if (ways.size() < 2) { 541 540 return true; 542 543 //mostly copied from CombineWayAction.java. 541 } 542 544 543 TagCollection wayTags = TagCollection.unionOfAllPrimitives(ways); 545 TagCollection completeWayTags = new TagCollection(wayTags); 546 TagConflictResolutionUtil.combineTigerTags(completeWayTags); 547 TagConflictResolutionUtil.normalizeTagCollectionBeforeEditing(completeWayTags, ways); 548 TagCollection tagsToEdit = new TagCollection(completeWayTags); 549 TagConflictResolutionUtil.completeTagCollectionForEditing(tagsToEdit); 550 551 CombinePrimitiveResolverDialog dialog = CombinePrimitiveResolverDialog.getInstance(); 552 dialog.getTagConflictResolverModel().populate(tagsToEdit, completeWayTags.getKeysWithMultipleValues()); 553 dialog.setTargetPrimitive(ways.get(0)); 554 Collection<Relation> parentRelations = CombineWayAction.getParentRelations(ways); 555 parentRelations = filterOwnMultipolygonRelations(parentRelations, polygons); 556 dialog.getRelationMemberConflictResolverModel().populate( 557 parentRelations, 558 ways 559 ); 560 dialog.prepareDefaultDecisions(); 561 562 // resolve tag conflicts if necessary 563 // 564 if (!completeWayTags.isApplicableToPrimitive() || !parentRelations.isEmpty()) { 565 dialog.setVisible(true); 566 if (dialog.isCanceled()) 567 return false; 568 } 569 570 for (Way way : ways) { 571 dialog.setTargetPrimitive(way); 572 cmds.addAll(dialog.buildResolutionCommands()); 573 } 574 575 commitCommands(marktr("Fix tag conflicts")); 576 return true; 544 try { 545 cmds.addAll(CombinePrimitiveResolverDialog.launchIfNecessary(wayTags, ways, ways)); 546 commitCommands(marktr("Fix tag conflicts")); 547 return true; 548 } catch (UserCancelException ex) { 549 return false; 550 } 577 551 } 578 552 … … 1209 1183 Set<Way> processedInnerWays = new LinkedHashSet<Way>(); 1210 1184 1211 for (Relation r : CombineWayAction.getParentRelations(selectedWays)) {1185 for (Relation r : OsmPrimitive.getParentRelations(selectedWays)) { 1212 1186 if (r.isDeleted() || !r.isMultipolygon()) { 1213 1187 continue;
Note:
See TracChangeset
for help on using the changeset viewer.