Changeset 8775 in josm for trunk/src/org
- Timestamp:
- 2015-09-21T21:45:50+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r8540 r8775 16 16 import java.util.Collections; 17 17 import java.util.List; 18 import java.util.TreeSet; 18 19 import java.util.regex.Matcher; 19 20 import java.util.regex.Pattern; … … 31 32 import org.openstreetmap.josm.gui.util.RotationAngle; 32 33 import org.openstreetmap.josm.io.XmlWriter; 34 import org.openstreetmap.josm.tools.AlphanumComparator; 33 35 import org.openstreetmap.josm.tools.ColorHelper; 34 36 import org.openstreetmap.josm.tools.Geometry; … … 375 377 376 378 /** 379 * Joins a list of {@code values} into a single string with fields separated by {@code separator}. 380 * @param separator the separator 381 * @param values collection of objects 382 * @return assembled string 383 * @see Utils#join 384 */ 385 public static String join_list(final String separator, final List<String> values) { 386 return Utils.join(separator, values); 387 } 388 389 /** 377 390 * Returns the value of the property {@code key}, e.g., {@code prop("width")}. 378 391 * @param env the environment … … 444 457 } 445 458 return env.parent.get(key); 459 } 460 461 /** 462 * Gets a list of all non-null values of the key {@code key} from the object's parent(s). 463 * 464 * The values are sorted according to {@link AlphanumComparator}. 465 * @param env the environment 466 * @param key the OSM key 467 * @return a list of non-null values of the key {@code key} from the object's parent(s) 468 */ 469 public static List<String> parent_tags(final Environment env, String key) { 470 if (env.parent == null) { 471 if (env.osm != null) { 472 final Collection<String> tags = new TreeSet<>(AlphanumComparator.getInstance()); 473 // we don't have a matched parent, so just search all referrers 474 for (OsmPrimitive parent : env.osm.getReferrers()) { 475 String value = parent.get(key); 476 if (value != null) { 477 tags.add(value); 478 } 479 } 480 return new ArrayList<>(tags); 481 } 482 return Collections.emptyList(); 483 } 484 return Collections.singletonList(env.parent.get(key)); 446 485 } 447 486
Note:
See TracChangeset
for help on using the changeset viewer.