Ticket #17845: 17845_v3.patch
| File 17845_v3.patch, 1.9 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
28 28 import org.openstreetmap.josm.data.osm.IPrimitive; 29 29 import org.openstreetmap.josm.data.osm.Node; 30 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 31 import org.openstreetmap.josm.data.osm.Relation; 32 import org.openstreetmap.josm.data.osm.RelationMember; 31 33 import org.openstreetmap.josm.data.osm.Way; 32 34 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 33 35 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match; … … 570 572 } 571 573 572 574 /** 575 * Returns true if role is in relation. Returns false if not a relation or it does not have the role. 576 * @param env the environment 577 * @param roles The roles to count in the relation 578 * @return The number of relation members with the specified role 579 * @since xxx 580 */ 581 public static int count_roles(final Environment env, String... roles) { // NO_UCD (unused code) 582 int rValue = 0; 583 if (env.osm instanceof Relation) { 584 List<String> roleList = Arrays.asList(roles); 585 Relation rel = (Relation) env.osm; 586 for (RelationMember member : rel.getMembers()) { 587 if (roleList.contains(member.getRole())) rValue++; 588 } 589 } 590 return rValue; 591 } 592 593 /** 573 594 * Returns the area of a closed way or multipolygon in square meters or {@code null}. 574 595 * @param env the environment 575 596 * @return the area of a closed way or multipolygon in square meters or {@code null}
