Changeset 9062 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-11-25T01:21:14+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r9059 r9062 352 352 double a2 = p4.getY() - p3.getY(); 353 353 double b2 = p3.getX() - p4.getX(); 354 double c2 = (p4.getX() - p1.getX()) * (p3.getY() - p1.getY()) - (p3.getX() - p1.getX()) * (p4.getY() - p1.getY());355 354 356 355 // Solve the equations … … 358 357 if (det == 0) 359 358 return null; // Lines are parallel 359 360 double c2 = (p4.getX() - p1.getX()) * (p3.getY() - p1.getY()) - (p3.getX() - p1.getX()) * (p4.getY() - p1.getY()); 360 361 361 362 return new EastNorth(b1 * c2 / det + p1.getX(), -a1 * c2 / det + p1.getY()); … … 573 574 return false; 574 575 576 //iterate each side of the polygon, start with the last segment 577 Node oldPoint = polygonNodes.get(polygonNodes.size() - 1); 578 579 if (!oldPoint.isLatLonKnown()) { 580 return false; 581 } 582 575 583 boolean inside = false; 576 584 Node p1, p2; 577 578 //iterate each side of the polygon, start with the last segment579 Node oldPoint = polygonNodes.get(polygonNodes.size() - 1);580 581 if (!oldPoint.isLatLonKnown()) {582 return false;583 }584 585 585 586 for (Node newPoint : polygonNodes) { … … 708 709 */ 709 710 public static boolean isClockwise(List<Node> nodes) { 710 double area2 = 0.;711 711 int nodesCount = nodes.size(); 712 712 if (nodesCount < 3 || nodes.get(0) != nodes.get(nodesCount - 1)) { 713 713 throw new IllegalArgumentException("Way must be closed to check orientation."); 714 714 } 715 double area2 = 0.; 715 716 716 717 for (int node = 1; node <= /*sic! consider last-first as well*/ nodesCount; node++) { -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r8989 r9062 583 583 } 584 584 String[] enstrings = new String[ennum]; 585 String[] trstrings = new String[trnum];586 585 for (int i = 0; i < ennum; ++i) { 587 586 int val = ens.read(enlen); … … 597 596 enstrings[i] = new String(str, 0, val, StandardCharsets.UTF_8); 598 597 } 598 String[] trstrings = new String[trnum]; 599 599 for (int i = 0; i < trnum; ++i) { 600 600 int val = trs.read(trlen); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r8992 r9062 836 836 Matcher m = dataUrlPattern.matcher(url); 837 837 if (m.matches()) { 838 String mediatype = m.group(1);839 838 String base64 = m.group(2); 840 839 String data = m.group(3); … … 850 849 } 851 850 } 851 String mediatype = m.group(1); 852 852 if ("image/svg+xml".equals(mediatype)) { 853 853 String s = new String(bytes, StandardCharsets.UTF_8); -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r8846 r9062 93 93 } 94 94 int zoom; 95 double lat, lon;96 95 try { 97 96 zoom = Integer.parseInt(parts[0]); … … 100 99 return null; 101 100 } 101 double lat, lon; 102 102 try { 103 103 lat = Double.parseDouble(parts[1]); -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r8924 r9062 67 67 */ 68 68 public static WindowGeometry centerInWindow(Component reference, Dimension extent) { 69 Window parentWindow = null;70 69 while (reference != null && !(reference instanceof Window)) { 71 70 reference = reference.getParent(); … … 73 72 if (reference == null) 74 73 return new WindowGeometry(new Point(0, 0), extent); 75 parentWindow = (Window) reference;74 Window parentWindow = (Window) reference; 76 75 Point topLeft = new Point( 77 76 Math.max(0, (parentWindow.getSize().width - extent.width) /2), -
trunk/src/org/openstreetmap/josm/tools/date/PrimaryDateParser.java
r8870 r9062 41 41 42 42 private static boolean isDateInShortStandardFormat(String date) { 43 char[] dateChars;44 43 // We can only parse the date if it is in a very specific format. 45 44 // eg. 2007-09-23T08:25:43Z … … 49 48 } 50 49 51 dateChars = date.toCharArray();50 char[] dateChars = date.toCharArray(); 52 51 53 52 // Make sure any fixed characters are in the correct place. … … 108 107 109 108 private static boolean isDateInLongStandardFormat(String date) { 110 char[] dateChars;111 109 // We can only parse the date if it is in a very specific format. 112 110 // eg. 2007-09-23T08:25:43.000Z … … 116 114 } 117 115 118 dateChars = date.toCharArray();116 char[] dateChars = date.toCharArray(); 119 117 120 118 // Make sure any fixed characters are in the correct place.
Note:
See TracChangeset
for help on using the changeset viewer.