- Timestamp:
- 2020-01-13T23:28:16+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r15603 r15704 118 118 CrossingWays.Ways.class, // ID 601 .. 699 119 119 CrossingWays.Boundaries.class, // ID 601 .. 699 120 CrossingWays.Barrier.class, // ID 601 .. 699121 120 CrossingWays.SelfCrossing.class, // ID 601 .. 699 122 121 SimilarNamedWays.class, // ID 701 .. 799 -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r15691 r15704 35 35 public abstract class CrossingWays extends Test { 36 36 37 static final String BARRIER = "barrier"; 37 38 static final String HIGHWAY = "highway"; 38 39 static final String RAILWAY = "railway"; … … 54 55 */ 55 56 private enum WayType { 56 B UILDING, HIGHWAY, RAILWAY, RESIDENTIAL_AREA, WATERWAY, WAY;57 BARRIER, BUILDING, HIGHWAY, RAILWAY, RESIDENTIAL_AREA, WATERWAY, WAY; 57 58 58 59 static WayType of(Way w) { 60 if (w.hasKey(CrossingWays.BARRIER)) 61 return BARRIER; 59 62 if (isBuilding(w)) 60 63 return BUILDING; … … 102 105 || isCoastline(w) 103 106 || isBuilding(w) 107 || w.hasKey(BARRIER) 104 108 || isResidentialArea(w)); 105 109 } … … 115 119 return true; 116 120 } 117 if ((w1.hasKey( HIGHWAY, RAILWAY, WATERWAY) && isResidentialArea(w2))118 || (w2.hasKey( HIGHWAY, RAILWAY, WATERWAY) && isResidentialArea(w1)))121 if ((w1.hasKey(BARRIER, HIGHWAY, RAILWAY, WATERWAY) && isResidentialArea(w2)) 122 || (w2.hasKey(BARRIER, HIGHWAY, RAILWAY, WATERWAY) && isResidentialArea(w1))) 119 123 return true; 120 124 if (isSubwayOrTramOrRazed(w2)) { … … 137 141 138 142 if (types[0] == types[1]) { 139 switch(types[0]) { 140 case BUILDING: 141 return new MessageHelper(tr("Crossing buildings"), 610); 142 case HIGHWAY: 143 return new MessageHelper(tr("Crossing highways"), 620); 144 case RAILWAY: 145 return new MessageHelper(tr("Crossing railways"), 630); 146 case RESIDENTIAL_AREA: 147 return new MessageHelper(tr("Crossing residential areas"), 640); 148 case WATERWAY: 149 return new MessageHelper(tr("Crossing waterways"), 650); 150 case WAY: 151 default: 152 return new MessageHelper(tr("Crossing ways"), CROSSING_WAYS); 143 switch (types[0]) { 144 case BARRIER: 145 return new MessageHelper(tr("Crossing barriers"), 603); 146 case BUILDING: 147 return new MessageHelper(tr("Crossing buildings"), 610); 148 case HIGHWAY: 149 return new MessageHelper(tr("Crossing highways"), 620); 150 case RAILWAY: 151 return new MessageHelper(tr("Crossing railways"), 630); 152 case RESIDENTIAL_AREA: 153 return new MessageHelper(tr("Crossing residential areas"), 640); 154 case WATERWAY: 155 return new MessageHelper(tr("Crossing waterways"), 650); 156 case WAY: 157 default: 158 return new MessageHelper(tr("Crossing ways"), CROSSING_WAYS); 153 159 } 154 160 } else { 155 161 switch (types[0]) { 162 case BARRIER: 163 switch (types[1]) { 156 164 case BUILDING: 157 switch (types[1]) { 158 case HIGHWAY: 159 return new MessageHelper(tr("Crossing building/highway"), 612); 160 case RAILWAY: 161 return new MessageHelper(tr("Crossing building/railway"), 613); 162 case RESIDENTIAL_AREA: 163 return new MessageHelper(tr("Crossing building/residential area"), 614); 164 case WATERWAY: 165 return new MessageHelper(tr("Crossing building/waterway"), 615); 166 case WAY: 167 default: 168 return new MessageHelper(tr("Crossing building/way"), 611); 169 } 165 return new MessageHelper(tr("Crossing barrier/building"), 661); 170 166 case HIGHWAY: 171 switch (types[1]) { 172 case RAILWAY: 173 return new MessageHelper(tr("Crossing highway/railway"), 622); 174 case WATERWAY: 175 return new MessageHelper(tr("Crossing highway/waterway"), 623); 176 case WAY: 177 default: 178 return new MessageHelper(tr("Crossing highway/way"), 621); 179 } 167 return new MessageHelper(tr("Crossing barrier/highway"), 662); 180 168 case RAILWAY: 181 switch (types[1]) { 182 case WATERWAY: 183 return new MessageHelper(tr("Crossing railway/waterway"), 632); 184 case WAY: 185 default: 186 return new MessageHelper(tr("Crossing railway/way"), 631); 187 } 169 return new MessageHelper(tr("Crossing barrier/railway"), 663); 170 case WATERWAY: 171 return new MessageHelper(tr("Crossing barrier/waterway"), 664); 172 case WAY: 173 default: 174 return new MessageHelper(tr("Crossing barrier/way"), 665); 175 } 176 case BUILDING: 177 switch (types[1]) { 178 case HIGHWAY: 179 return new MessageHelper(tr("Crossing building/highway"), 612); 180 case RAILWAY: 181 return new MessageHelper(tr("Crossing building/railway"), 613); 188 182 case RESIDENTIAL_AREA: 189 switch (types[1]) { 190 case WAY: 191 default: 192 return new MessageHelper(tr("Crossing residential area/way"), 641); 193 } 183 return new MessageHelper(tr("Crossing building/residential area"), 614); 194 184 case WATERWAY: 185 return new MessageHelper(tr("Crossing building/waterway"), 615); 186 case WAY: 195 187 default: 196 return new MessageHelper(tr("Crossing waterway/way"), 651); 188 return new MessageHelper(tr("Crossing building/way"), 611); 189 } 190 case HIGHWAY: 191 switch (types[1]) { 192 case RAILWAY: 193 return new MessageHelper(tr("Crossing highway/railway"), 622); 194 case WATERWAY: 195 return new MessageHelper(tr("Crossing highway/waterway"), 623); 196 case WAY: 197 default: 198 return new MessageHelper(tr("Crossing highway/way"), 621); 199 } 200 case RAILWAY: 201 switch (types[1]) { 202 case WATERWAY: 203 return new MessageHelper(tr("Crossing railway/waterway"), 632); 204 case WAY: 205 default: 206 return new MessageHelper(tr("Crossing railway/way"), 631); 207 } 208 case RESIDENTIAL_AREA: 209 switch (types[1]) { 210 case WAY: 211 default: 212 return new MessageHelper(tr("Crossing residential area/way"), 641); 213 } 214 case WATERWAY: 215 default: 216 return new MessageHelper(tr("Crossing waterway/way"), 651); 197 217 } 198 218 } … … 258 278 259 279 /** 260 * Crossing barriers ways test.261 */262 public static class Barrier extends CrossingWays {263 264 protected static final int CROSSING_BARRIERS = 603;265 266 /**267 * Constructs a new crossing {@code Barrier} test.268 */269 public Barrier() {270 super(tr("Crossing barriers"), CROSSING_BARRIERS);271 }272 273 @Override274 public boolean isPrimitiveUsable(OsmPrimitive p) {275 return super.isPrimitiveUsable(p) && p.hasKey("barrier");276 }277 278 @Override279 boolean ignoreWaySegmentCombination(Way w1, Way w2) {280 return areLayerOrLevelDifferent(w1, w2);281 }282 }283 284 /**285 280 * Self crossing ways test (for all the rest) 286 281 */ … … 290 285 291 286 CrossingWays.Ways normalTest = new Ways(); 292 CrossingWays.Barrier barrierTest = new Barrier();293 287 CrossingWays.Boundaries boundariesTest = new Boundaries(); 294 288 … … 302 296 @Override 303 297 public boolean isPrimitiveUsable(OsmPrimitive p) { 304 return super.isPrimitiveUsable(p) && !(normalTest.isPrimitiveUsable(p) || barrierTest.isPrimitiveUsable(p)298 return super.isPrimitiveUsable(p) && !(normalTest.isPrimitiveUsable(p) 305 299 || boundariesTest.isPrimitiveUsable(p)); 306 300 }
Note:
See TracChangeset
for help on using the changeset viewer.