Ticket #17845: 17845_v2.patch
File 17845_v2.patch, 1.8 KB (added by , 5 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 role 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_role(final Environment env, String role) { // NO_UCD (unused code) 582 int rValue = 0; 583 if (env.osm instanceof Relation) { 584 Relation rel = (Relation) env.osm; 585 for (RelationMember member : rel.getMembers()) { 586 if (role.equals(member.getRole())) rValue++; 587 } 588 } 589 return rValue; 590 } 591 592 /** 573 593 * Returns the area of a closed way or multipolygon in square meters or {@code null}. 574 594 * @param env the environment 575 595 * @return the area of a closed way or multipolygon in square meters or {@code null}