Changeset 30738 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java
- Timestamp:
- 2014-10-19T01:27:04+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/BoundaryFixer.java
r28762 r30738 16 16 public class BoundaryFixer extends MultipolygonFixer { 17 17 18 public BoundaryFixer() {19 super("boundary", "multipolygon");20 }18 public BoundaryFixer() { 19 super("boundary", "multipolygon"); 20 } 21 21 22 /**23 * For boundary relations both "boundary" and "multipolygon" types are applicable, but24 * it should also have key boundary=administrative to be fully boundary.25 * @see http://wiki.openstreetmap.org/wiki/Relation:boundary26 */27 @Override28 public boolean isFixerApplicable(Relation rel) {29 return super.isFixerApplicable(rel) && "administrative".equals(rel.get("boundary"));30 }22 /** 23 * For boundary relations both "boundary" and "multipolygon" types are applicable, but 24 * it should also have key boundary=administrative to be fully boundary. 25 * @see http://wiki.openstreetmap.org/wiki/Relation:boundary 26 */ 27 @Override 28 public boolean isFixerApplicable(Relation rel) { 29 return super.isFixerApplicable(rel) && "administrative".equals(rel.get("boundary")); 30 } 31 31 32 @Override33 public boolean isRelationGood(Relation rel) {34 for( RelationMember m : rel.getMembers() ) {32 @Override 33 public boolean isRelationGood(Relation rel) { 34 for( RelationMember m : rel.getMembers() ) { 35 35 if (m.getType().equals(OsmPrimitiveType.RELATION) && !"subarea".equals(m.getRole())) { 36 36 setWarningMessage(tr("Relation without ''subarea'' role found")); … … 43 43 if (m.getType().equals(OsmPrimitiveType.WAY) && !("outer".equals(m.getRole()) || "inner".equals(m.getRole()))) { 44 44 setWarningMessage(tr("Way without ''inner'' or ''outer'' role found")); 45 return false;45 return false; 46 46 } 47 47 } 48 clearWarningMessage();49 return true;50 }48 clearWarningMessage(); 49 return true; 50 } 51 51 52 @Override53 public Command fixRelation(Relation rel) {54 Relation r = rel;55 Relation rr = fixMultipolygonRoles(r);56 boolean fixed = false;57 if (rr != null) {58 fixed = true;59 r = rr;60 }61 rr = fixBoundaryRoles(r);62 if (rr != null) {63 fixed = true;64 r = rr;65 }66 return fixed ? new ChangeCommand(rel, r) : null;67 }52 @Override 53 public Command fixRelation(Relation rel) { 54 Relation r = rel; 55 Relation rr = fixMultipolygonRoles(r); 56 boolean fixed = false; 57 if (rr != null) { 58 fixed = true; 59 r = rr; 60 } 61 rr = fixBoundaryRoles(r); 62 if (rr != null) { 63 fixed = true; 64 r = rr; 65 } 66 return fixed ? new ChangeCommand(rel, r) : null; 67 } 68 68 69 private Relation fixBoundaryRoles( Relation source ) {69 private Relation fixBoundaryRoles( Relation source ) { 70 70 Relation r = new Relation(source); 71 71 boolean fixed = false;
Note:
See TracChangeset
for help on using the changeset viewer.
