Changeset 11587 in josm
- Timestamp:
- 2017-02-19T23:52:08+01:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Bounds.java
r11272 r11587 477 477 } 478 478 479 /** 480 * Determines if these bounds are out of the world. 481 * @return true if lat outside of range [-90,90] or lon outside of range [-180,180] 482 */ 479 483 public boolean isOutOfTheWorld() { 480 484 return 481 minLat < -90 || minLat > 90 || 482 maxLat < -90 || maxLat > 90 || 483 minLon < -180 || minLon > 180 || 484 maxLon < -180 || maxLon > 180; 485 } 486 485 !LatLon.isValidLat(minLat) || 486 !LatLon.isValidLat(maxLat) || 487 !LatLon.isValidLon(minLon) || 488 !LatLon.isValidLon(maxLon); 489 } 490 491 /** 492 * Clamp the bounds to be inside the world. 493 */ 487 494 public void normalize() { 488 495 minLat = LatLon.toIntervalLat(minLat); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r11578 r11587 499 499 } 500 500 501 // CHECKSTYLE.OFF: BooleanExpressionComplexity 501 502 return 502 503 Objects.equals(this.name, other.name) && … … 527 528 Objects.equals(this.metadataHeaders, other.metadataHeaders) && 528 529 Objects.equals(this.defaultLayers, other.defaultLayers); 530 // CHECKSTYLE.ON: BooleanExpressionComplexity 529 531 } 530 532 -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r11452 r11587 725 725 726 726 /** 727 * Replies true if this primitive has a tag any of the <code>keys</code>. 728 * 729 * @param keys the keys 730 * @return true, if his primitive has a tag with any of the <code>keys</code> 731 * @since 11587 732 */ 733 public boolean hasKey(String ... keys) { 734 return keys != null && Arrays.stream(keys).anyMatch(this::hasKey); 735 } 736 737 /** 727 738 * What to do, when the tags have changed by one of the tag-changing methods. 728 739 * @param originalKeys original tags -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r11503 r11587 1178 1178 */ 1179 1179 public boolean hasEqualTechnicalAttributes(OsmPrimitive other) { 1180 // CHECKSTYLE.OFF: BooleanExpressionComplexity 1180 1181 return other != null 1181 1182 && timestamp == other.timestamp … … 1186 1187 && isVisible() == other.isVisible() 1187 1188 && Objects.equals(user, other.user); 1189 // CHECKSTYLE.ON: BooleanExpressionComplexity 1188 1190 } 1189 1191 … … 1354 1356 || "yes".equals(get("area")) 1355 1357 || "riverbank".equals(get("waterway")) 1356 || hasKey("natural") 1357 || hasKey("amenity") 1358 || hasKey("leisure") 1359 || hasKey("building") 1360 || hasKey("building:part"); 1358 || hasKey("natural", "amenity", "leisure", "building", "building:part"); 1361 1359 } 1362 1360 -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r11191 r11587 57 57 return super.isPrimitiveUsable(w) 58 58 && !isProposedOrAbandoned(w) 59 && ( (w.hasKey(HIGHWAY) && !w.hasTag(HIGHWAY, "rest_area", "services"))59 && (isHighway(w) 60 60 || w.hasKey(WATERWAY) 61 || (w.hasKey(RAILWAY) && !isSubwayOrTramOrRazed(w))61 || isRailway(w) 62 62 || isCoastline(w) 63 63 || isBuilding(w)); … … 238 238 static boolean isCoastline(OsmPrimitive w) { 239 239 return w.hasTag("natural", "water", "coastline") || w.hasTag("landuse", "reservoir"); 240 } 241 242 static boolean isHighway(OsmPrimitive w) { 243 return w.hasKey(HIGHWAY) && !w.hasTag(HIGHWAY, "rest_area", "services"); 244 } 245 246 static boolean isRailway(OsmPrimitive w) { 247 return w.hasKey(RAILWAY) && !isSubwayOrTramOrRazed(w); 240 248 } 241 249 -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r11452 r11587 111 111 @Override 112 112 public boolean isPrimitiveUsable(OsmPrimitive p) { 113 return super.isPrimitiveUsable(p) && (p.hasKey("natural") || p.hasKey("landuse"));113 return super.isPrimitiveUsable(p) && p.hasKey("natural", "landuse"); 114 114 } 115 115 } … … 185 185 || en.hasTag("railway", "buffer_stop") 186 186 || en.isKeyTrue("noexit") 187 || en.hasKey("entrance") 188 || en.hasKey("barrier")) { 187 || en.hasKey("entrance", "barrier")) { 189 188 continue; 190 189 } … … 451 450 ways.addAll(getWaySegments(w)); 452 451 QuadBuckets<Node> set = endnodes; 453 if (w.hasKey("highway" ) || w.hasKey("railway")) {452 if (w.hasKey("highway", "railway")) { 454 453 set = endnodesHighway; 455 454 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java
r11462 r11587 81 81 82 82 private static boolean isArea(OsmPrimitive p) { 83 return (p.hasKey("landuse") || p.hasKey("natural")) 84 && ElemStyles.hasAreaElemStyle(p, false); 83 return p.hasKey("landuse", "natural") && ElemStyles.hasAreaElemStyle(p, false); 85 84 } 86 85 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSortUtils.java
r9246 r11587 7 7 8 8 import org.openstreetmap.josm.data.coor.EastNorth; 9 import org.openstreetmap.josm.data.osm.Node; 9 10 import org.openstreetmap.josm.data.osm.RelationMember; 10 11 import org.openstreetmap.josm.data.osm.Way; … … 28 29 29 30 static Direction roundaboutType(Way w) { 30 if (w != null && 31 "roundabout".equals(w.get("junction")) && 32 w.getNodesCount() < 200 && 33 w.getNodesCount() > 2 && 34 w.getNode(0) != null && 35 w.getNode(1) != null && 36 w.getNode(2) != null && 37 w.isClosed()) { 38 /** do some simple determinant / cross pruduct test on the first 3 nodes 39 to see, if the roundabout goes clock wise or ccw */ 40 EastNorth en1 = w.getNode(0).getEastNorth(); 41 EastNorth en2 = w.getNode(1).getEastNorth(); 42 EastNorth en3 = w.getNode(2).getEastNorth(); 43 if (en1 != null && en2 != null && en3 != null) { 44 en1 = en2.subtract(en1); 45 en2 = en3.subtract(en2); 46 return en1.north() * en2.east() - en2.north() * en1.east() > 0 ? ROUNDABOUT_LEFT : ROUNDABOUT_RIGHT; 31 if (w != null && "roundabout".equals(w.get("junction"))) { 32 int nodesCount = w.getNodesCount(); 33 if (nodesCount > 2 && nodesCount < 200) { 34 Node n1 = w.getNode(0); 35 Node n2 = w.getNode(1); 36 Node n3 = w.getNode(2); 37 if (n1 != null && n2 != null && n3 != null && w.isClosed()) { 38 /** do some simple determinant / cross pruduct test on the first 3 nodes 39 to see, if the roundabout goes clock wise or ccw */ 40 EastNorth en1 = n1.getEastNorth(); 41 EastNorth en2 = n2.getEastNorth(); 42 EastNorth en3 = n3.getEastNorth(); 43 if (en1 != null && en2 != null && en3 != null) { 44 en1 = en2.subtract(en1); 45 en2 = en3.subtract(en2); 46 return en1.north() * en2.east() - en2.north() * en1.east() > 0 ? ROUNDABOUT_LEFT : ROUNDABOUT_RIGHT; 47 } 48 } 47 49 } 48 50 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r11566 r11587 1352 1352 */ 1353 1353 private void checkCache() { 1354 // CHECKSTYLE.OFF: BooleanExpressionComplexity 1354 1355 if ((computeCacheMaxLineLengthUsed != maxLineLength) 1355 1356 || (computeCacheColored != colored) … … 1361 1362 || (computeCacheHeatMapDrawGain != heatMapDrawGain)) 1362 1363 || (computeCacheHeatMapDrawLowerLimit != heatMapDrawLowerLimit) 1363 ) { 1364 ) { 1365 // CHECKSTYLE.ON: BooleanExpressionComplexity 1364 1366 computeCacheMaxLineLengthUsed = maxLineLength; 1365 1367 computeCacheInSync = false; -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r11381 r11587 268 268 return ImageIO.getImageReadersByMIMEType(format).hasNext() 269 269 // handles image/tiff image/tiff8 image/geotiff image/geotiff8 270 || ((format.startsWith("image/tiff") || format.startsWith("image/geotiff")) 271 && ImageIO.getImageReadersBySuffix("tiff").hasNext()) 272 || (format.startsWith("image/png") && ImageIO.getImageReadersBySuffix("png").hasNext()) 273 || (format.startsWith("image/svg") && ImageIO.getImageReadersBySuffix("svg").hasNext()) 274 || (format.startsWith("image/bmp") && ImageIO.getImageReadersBySuffix("bmp").hasNext()); 270 || isImageFormatSupported(format, "tiff", "geotiff") 271 || isImageFormatSupported(format, "png") 272 || isImageFormatSupported(format, "svg") 273 || isImageFormatSupported(format, "bmp"); 274 } 275 276 static boolean isImageFormatSupported(String format, String ... mimeFormats) { 277 for (String mime : mimeFormats) { 278 if (format.startsWith("image/" + mime)) { 279 return ImageIO.getImageReadersBySuffix(mimeFormats[0]).hasNext(); 280 } 281 } 282 return false; 275 283 } 276 284 -
trunk/tools/checkstyle/josm_checks.xml
r10416 r11587 14 14 <property name="charset" value="UTF-8"/> 15 15 <module name="TreeWalker"> 16 <module name="BooleanExpressionComplexity"> 17 <property name="max" value="6"/> 18 </module> 16 19 <module name="FileContentsHolder"/> 17 20 <module name="MissingDeprecated"/>
Note:
See TracChangeset
for help on using the changeset viewer.