Changeset 6305 in josm
- Timestamp:
- 2013-10-06T22:07:36+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r6084 r6305 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import java.util.Arrays; 3 5 4 6 /** … … 21 23 22 24 /** 23 * 25 * Returns the role of this relation member. 24 26 * @return Role name or "". Never returns null 25 27 * @since 1930 … … 30 32 31 33 /** 32 * 34 * Determines if this relation member has a role. 33 35 * @return True if role is set 34 36 * @since 1930 … … 39 41 40 42 /** 41 * 43 * Determines if this relation member's role is in the given list. 44 * @param roles The roles to look after 45 * @return True if role is in the given list 46 * @since 6305 47 */ 48 public boolean hasRole(String ... roles) { 49 return Arrays.asList(roles).contains(role); 50 } 51 52 /** 53 * Determines if this relation member is a relation. 42 54 * @return True if member is relation 43 55 * @since 1937 … … 48 60 49 61 /** 50 * 62 * Determines if this relation member is a way. 51 63 * @return True if member is way 52 64 * @since 1937 … … 66 78 67 79 /** 68 * 80 * Determines if this relation member is a node. 69 81 * @return True if member is node 70 82 * @since 1937 … … 75 87 76 88 /** 77 * 89 * Returns the relation member as a relation. 78 90 * @return Member as relation 79 91 * @since 1937 … … 84 96 85 97 /** 86 * 98 * Returns the relation member as a way. 87 99 * @return Member as way 88 100 * @since 1937 … … 93 105 94 106 /** 95 * 107 * Returns the relation member as a node. 96 108 * @return Member as node 97 109 * @since 1937 … … 102 114 103 115 /** 104 * 116 * Returns the relation member. 105 117 * @return Member. Returned value is never null. 106 118 * @since 1937 … … 111 123 112 124 /** 113 * 125 * Constructs a new {@code RelationMember}. 114 126 * @param role Can be null, in this case it's save as "" 115 127 * @param member Cannot be null -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r6240 r6305 248 248 for (RelationMember rm : r.getMembers()) { 249 249 if (rm.isWay()) { 250 if (!( "inner".equals(rm.getRole()) || "outer".equals(rm.getRole()) || !rm.hasRole())) {250 if (!(rm.hasRole("inner", "outer") || !rm.hasRole())) { 251 251 addError(r, new TestError(this, Severity.WARNING, tr("No useful role for multipolygon member"), WRONG_MEMBER_ROLE, rm.getMember())); 252 252 } 253 253 } else { 254 if (!"admin_centre".equals(rm.getRole()) && !"label".equals(rm.getRole()))254 if (!rm.hasRole("admin_centre", "label", "subarea", "land_area")) { 255 255 addError(r, new TestError(this, Severity.WARNING, tr("Non-Way in multipolygon"), WRONG_MEMBER_TYPE, rm.getMember())); 256 } 256 257 } 257 258 }
Note:
See TracChangeset
for help on using the changeset viewer.