Changeset 2099 in josm for trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
- Timestamp:
- 2009-09-12T16:39:20+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r2095 r2099 104 104 } 105 105 106 protected void completeTagCollectionWithMissingTags(TagCollection tc, Collection<Way> combinedWays) { 106 protected static void completeTagCollectionWithMissingTags(TagCollection tc, Collection<? extends OsmPrimitive> merged) { 107 for (String key: tc.getKeys()) { 108 // make sure the empty value is in the tag set if a tag is not present 109 // on all merged nodes 110 // 111 for (OsmPrimitive p: merged) { 112 if (p.get(key) == null) { 113 tc.add(new Tag(key)); // add a tag with key and empty value 114 } 115 } 116 } 117 // remove irrelevant tags 118 // 119 tc.removeByKey("created_by"); 120 } 121 122 protected static void completeTagCollectionForEditing(TagCollection tc) { 107 123 for (String key: tc.getKeys()) { 108 124 // make sure the empty value is in the tag set such that we can delete the tag … … 110 126 // 111 127 tc.add(new Tag(key,"")); 112 for (Way w: combinedWays) { 113 if (w.get(key) == null) { 114 tc.add(new Tag(key)); // add a tag with key and empty value 115 } 116 } 117 } 118 // remove irrelevant tags 119 // 120 tc.removeByKey("created_by"); 128 } 121 129 } 122 130 … … 165 173 TagCollection completeWayTags = new TagCollection(wayTags); 166 174 completeTagCollectionWithMissingTags(completeWayTags, ways); 175 TagCollection tagsToEdit = new TagCollection(completeWayTags); 176 completeTagCollectionForEditing(tagsToEdit); 167 177 168 178 CombinePrimitiveResolverDialog dialog = CombinePrimitiveResolverDialog.getInstance(); 169 dialog.getTagConflictResolverModel().populate( completeWayTags);179 dialog.getTagConflictResolverModel().populate(tagsToEdit); 170 180 dialog.setTargetPrimitive(targetWay); 171 181 dialog.getRelationMemberConflictResolverModel().populate( … … 177 187 // resolve tag conflicts if necessary 178 188 // 179 if (! wayTags.isApplicableToPrimitive() || !referringRelations.getRelations().isEmpty()) {189 if (!completeWayTags.isApplicableToPrimitive() || !referringRelations.getRelations().isEmpty()) { 180 190 dialog.setVisible(true); 181 191 if (dialog.isCancelled()) 182 192 return; 183 193 } 184 185 186 194 187 195 LinkedList<Command> cmds = new LinkedList<Command>();
Note:
See TracChangeset
for help on using the changeset viewer.