Changeset 6629 in josm
- Timestamp:
- 2014-01-05T12:03:37+01:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/validator/unnecessary.mapcss
r6548 r6629 16 16 assertNoMatch: "way emergency=designated"; 17 17 } 18 19 /* see ticket #7639 -- Warn when a node has the same tags as its parent way. */ 20 way >:sameTags node:tagged { 21 throwWarning: tr("Nodes duplicating parent way tags"); 22 } -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r6610 r6629 671 671 672 672 /** 673 * Replies true if other isn't null and has the same tags (key/value-pairs) as this.674 *675 * @param other the other object primitive676 * @return true if other isn't null and has the same tags (key/value-pairs) as this.677 */678 public boolean hasSameTags(OsmPrimitive other) {679 // We cannot directly use Arrays.equals(keys, other.keys) as keys is not ordered by key680 // but we can at least check if both arrays are null or of the same size before creating681 // and comparing the key maps (costly operation, see #7159)682 return (keys == null && other.keys == null)683 || (keys != null && other.keys != null && keys.length == other.keys.length && (keys.length == 0 || getKeys().equals(other.getKeys())));684 }685 686 /**687 673 * What to do, when the tags have changed by one of the tag-changing methods. 688 674 */ -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r6491 r6629 10 10 import java.util.Collections; 11 11 import java.util.Date; 12 import java.util.HashMap; 12 13 import java.util.HashSet; 13 14 import java.util.LinkedHashSet; … … 726 727 } 727 728 729 /** 730 * Returns {@link #getKeys()} for which {@code key} does not fulfill {@link #isUninterestingKey}. 731 */ 732 public Map<String, String> getInterestingTags() { 733 Map<String, String> result = new HashMap<String, String>(); 734 String[] keys = this.keys; 735 if (keys != null) { 736 for (int i = 0; i < keys.length; i += 2) { 737 if (!isUninterestingKey(keys[i])) { 738 result.put(keys[i], keys[i + 1]); 739 } 740 } 741 } 742 return result; 743 } 744 728 745 private static volatile Match directionKeys = null; 729 746 private static volatile Match reversedDirectionKeys = null; … … 1115 1132 1116 1133 /** 1134 * Replies true if other isn't null and has the same interesting tags (key/value-pairs) as this. 1135 * 1136 * @param other the other object primitive 1137 * @return true if other isn't null and has the same interesting tags (key/value-pairs) as this. 1138 */ 1139 public boolean hasSameInterestingTags(OsmPrimitive other) { 1140 // We cannot directly use Arrays.equals(keys, other.keys) as keys is not ordered by key 1141 // but we can at least check if both arrays are null or of the same size before creating 1142 // and comparing the key maps (costly operation, see #7159) 1143 return (keys == null && other.keys == null) 1144 || (keys != null && other.keys != null && keys.length == other.keys.length 1145 && (keys.length == 0 || getInterestingTags().equals(other.getInterestingTags()))); 1146 } 1147 1148 /** 1117 1149 * Replies true if this primitive and other are equal with respect to their 1118 1150 * semantic attributes. … … 1133 1165 // can't do an equals check on the internal keys array because it is not ordered 1134 1166 // 1135 return hasSameTags(other); 1167 return hasSameInterestingTags(other); 1136 1168 } 1137 1169 -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6613 r6629 36 36 import org.openstreetmap.josm.data.validation.tests.MultipolygonTest; 37 37 import org.openstreetmap.josm.data.validation.tests.NameMismatch; 38 import org.openstreetmap.josm.data.validation.tests.NodesDuplicatingWayTags;39 38 import org.openstreetmap.josm.data.validation.tests.OpeningHourTest; 40 39 import org.openstreetmap.josm.data.validation.tests.OverlappingWays; … … 110 109 DuplicateRelation.class, // ID 1901 .. 1999 111 110 WayConnectedToArea.class, // ID 2301 .. 2399 112 NodesDuplicatingWayTags.class, // ID 2401 .. 2499113 111 PowerLines.class, // ID 2501 .. 2599 114 112 Addresses.class, // ID 2601 .. 2699 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r6611 r6629 9 9 10 10 import org.openstreetmap.josm.data.osm.Node; 11 import org.openstreetmap.josm.data.osm.OsmUtils;12 11 import org.openstreetmap.josm.data.osm.Relation; 13 12 import org.openstreetmap.josm.data.osm.Tag; … … 15 14 import org.openstreetmap.josm.gui.mappaint.Cascade; 16 15 import org.openstreetmap.josm.gui.mappaint.Environment; 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 17 import org.openstreetmap.josm.tools.Predicates; 18 18 import org.openstreetmap.josm.tools.Utils; … … 58 58 59 59 public static Condition createPseudoClassCondition(String id, boolean not, Context context) { 60 return new PseudoClassCondition(id, not); 60 return new PseudoClassCondition(id, not, context); 61 61 } 62 62 … … 305 305 public final boolean not; 306 306 307 public PseudoClassCondition(String id, boolean not) { 307 public PseudoClassCondition(String id, boolean not, Context context) { 308 308 this.id = id; 309 309 this.not = not; 310 CheckParameterUtil.ensureThat(!"sameTags".equals(id) || Context.LINK.equals(context), "sameTags only supported in LINK context"); 310 311 } 311 312 … … 322 323 return true; 323 324 return false; 324 } else if (equal(id, "modified")) 325 } else if (equal(id, "modified")) { 325 326 return e.osm.isModified() || e.osm.isNewOrUndeleted(); 326 else if (equal(id, "new")) 327 } else if (equal(id, "new")) { 327 328 return e.osm.isNew(); 328 else if (equal(id, "connection") && (e.osm instanceof Node)) 329 } else if (equal(id, "connection") && (e.osm instanceof Node)) { 329 330 return ((Node) e.osm).isConnectionNode(); 330 else if (equal(id, "tagged")) 331 } else if (equal(id, "tagged")) { 331 332 return e.osm.isTagged(); 333 } else if ("sameTags".equals(id)) { 334 return e.osm.hasSameInterestingTags(Utils.firstNonNull(e.child, e.parent)); 335 } 332 336 return true; 333 337 }
Note:
See TracChangeset
for help on using the changeset viewer.