Changeset 4387 in josm for trunk/src/org
- Timestamp:
- 2011-08-31T17:15:24+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
r3995 r4387 109 109 protected Map<OsmPrimitiveType, Integer> getSourceStatistics() { 110 110 HashMap<OsmPrimitiveType, Integer> ret = new HashMap<OsmPrimitiveType, Integer>(); 111 for (OsmPrimitiveType type: OsmPrimitiveType. values()) {111 for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) { 112 112 if (!getSourceTagsByType(type).isEmpty()) { 113 113 ret.put(type, getSourcePrimitivesByType(type).size()); … … 119 119 protected Map<OsmPrimitiveType, Integer> getTargetStatistics() { 120 120 HashMap<OsmPrimitiveType, Integer> ret = new HashMap<OsmPrimitiveType, Integer>(); 121 for (OsmPrimitiveType type: OsmPrimitiveType. values()) {121 for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) { 122 122 int count = OsmPrimitive.getFilteredList(target, type.getOsmClass()).size(); 123 123 if (count > 0) { … … 139 139 protected void pasteFromHomogeneousSource() { 140 140 TagCollection tc = null; 141 for (OsmPrimitiveType type : OsmPrimitiveType. values()) {141 for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) { 142 142 TagCollection tc1 = getSourceTagsByType(type); 143 143 if (!tc1.isEmpty()) { … … 185 185 */ 186 186 protected boolean canPasteFromHeterogeneousSourceWithoutConflict(Collection<OsmPrimitive> targets) { 187 for (OsmPrimitiveType type :OsmPrimitiveType.values()) {187 for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) { 188 188 if (hasTargetPrimitives(type.getOsmClass())) { 189 189 TagCollection tc = TagCollection.unionOfAllPrimitives(getSourcePrimitivesByType(type)); … … 203 203 protected void pasteFromHeterogeneousSource() { 204 204 if (canPasteFromHeterogeneousSourceWithoutConflict(target)) { 205 for (OsmPrimitiveType type :OsmPrimitiveType.values()) {205 for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) { 206 206 if (hasSourceTagsByType(type) && hasTargetPrimitives(type.getOsmClass())) { 207 207 buildChangeCommand(target, getSourceTagsByType(type)); … … 220 220 if (dialog.isCanceled()) 221 221 return; 222 for (OsmPrimitiveType type :OsmPrimitiveType.values()) {222 for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) { 223 223 if (hasSourceTagsByType(type) && hasTargetPrimitives(type.getOsmClass())) { 224 224 buildChangeCommand(OsmPrimitive.getFilteredList(target, type.getOsmClass()), dialog.getResolution(type)); -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveType.java
r4172 r4387 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 6 7 import java.text.MessageFormat; 8 import java.util.Arrays; 9 import java.util.Collection; 7 10 8 11 public enum OsmPrimitiveType { … … 15 18 CLOSEDWAY (marktr(/* ICON(data/) */"closedway"), null, WayData.class), 16 19 MULTIPOLYGON (marktr(/* ICON(data/) */"multipolygon"), null, RelationData.class); 20 21 private final static Collection<OsmPrimitiveType> DATA_VALUES = Arrays.asList(NODE, WAY, RELATION); 17 22 18 23 private final String apiTypeName; … … 61 66 } 62 67 68 public static Collection<OsmPrimitiveType> dataValues() { 69 return DATA_VALUES; 70 } 71 63 72 public OsmPrimitive newInstance(long uniqueId, boolean allowNegative) { 64 73 switch (this) { -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r4191 r4387 78 78 allPrimitivesResolver = new TagConflictResolver(); 79 79 resolvers = new HashMap<OsmPrimitiveType, TagConflictResolver>(); 80 for (OsmPrimitiveType type: OsmPrimitiveType. values()) {80 for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) { 81 81 resolvers.put(type, new TagConflictResolver()); 82 82 resolvers.get(type).getModel().addPropertyChangeListener(this);
Note:
See TracChangeset
for help on using the changeset viewer.