Changeset 8345 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-05-11T10:52:33+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ColorHelper.java
r6830 r8345 32 32 Integer.parseInt(html.substring(2,4),16), 33 33 Integer.parseInt(html.substring(4,6),16), 34 (html.length() == 8 ? Integer.parseInt(html.substring(6,8),16) : 255));34 html.length() == 8 ? Integer.parseInt(html.substring(6,8),16) : 255); 35 35 } catch (NumberFormatException e) { 36 36 return null; -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r8342 r8345 449 449 CheckParameterUtil.ensureValidCoordinates(secondNode, "secondNode"); 450 450 451 double dy1 = (firstNode.getY() - commonNode.getY());452 double dy2 = (secondNode.getY() - commonNode.getY());453 double dx1 = (firstNode.getX() - commonNode.getX());454 double dx2 = (secondNode.getX() - commonNode.getX());451 double dy1 = firstNode.getY() - commonNode.getY(); 452 double dy2 = secondNode.getY() - commonNode.getY(); 453 double dx1 = firstNode.getX() - commonNode.getX(); 454 double dx2 = secondNode.getX() - commonNode.getX(); 455 455 456 456 return dy1 * dx2 - dx1 * dy2 > 0; … … 651 651 dlat = lat2 - lat1; 652 652 653 double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2));653 double a = Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2); 654 654 double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 655 655 return 6367000 * c; … … 668 668 dlat = lat2 - lat1; 669 669 670 double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2));670 double a = Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2); 671 671 double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 672 672 return 6367000 * c; -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r8292 r8345 694 694 switch(pluralMode) { 695 695 case MODE_NOTONE: /* bg, da, de, el, en, en_GB, es, et, eu, fi, gl, is, it, iw_IL, nb, nl, sv */ 696 return ( (n != 1) ? 1 : 0);696 return (n != 1) ? 1 : 0; 697 697 case MODE_NONE: /* id, ja, km, tr, zh_CN, zh_TW */ 698 698 return 0; 699 699 case MODE_GREATERONE: /* fr, pt_BR */ 700 return ( (n > 1) ? 1 : 0);700 return (n > 1) ? 1 : 0; 701 701 case MODE_CS: 702 return ( (n == 1) ? 0 : (((n >= 2) && (n <= 4)) ? 1 : 2));702 return (n == 1) ? 0 : (((n >= 2) && (n <= 4)) ? 1 : 2); 703 703 //case MODE_AR: 704 704 // return ((n == 0) ? 0 : ((n == 1) ? 1 : ((n == 2) ? 2 : ((((n % 100) >= 3) 705 705 // && ((n % 100) <= 10)) ? 3 : ((((n % 100) >= 11) && ((n % 100) <= 99)) ? 4 : 5))))); 706 706 case MODE_PL: 707 return ( (n == 1) ? 0 : (((((n % 10) >= 2) && ((n % 10) <= 4))708 && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2) );707 return (n == 1) ? 0 : (((((n % 10) >= 2) && ((n % 10) <= 4)) 708 && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2); 709 709 //case MODE_RO: 710 710 // return ((n == 1) ? 0 : ((((n % 100) > 19) || (((n % 100) == 0) && (n != 0))) ? 2 : 1)); 711 711 case MODE_LT: 712 return (( (n % 10) == 1) && ((n % 100) != 11) ? 0 : (((n % 10) >= 2)713 && (((n % 100) < 10) || ((n % 100) >= 20)) ? 1 : 2) );712 return ((n % 10) == 1) && ((n % 100) != 11) ? 0 : (((n % 10) >= 2) 713 && (((n % 100) < 10) || ((n % 100) >= 20)) ? 1 : 2); 714 714 case MODE_RU: 715 return ((( (n % 10) == 1) && ((n % 100) != 11)) ? 0 : (((((n % 10) >= 2)716 && ((n % 10) <= 4)) && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2) );715 return (((n % 10) == 1) && ((n % 100) != 11)) ? 0 : (((((n % 10) >= 2) 716 && ((n % 10) <= 4)) && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2); 717 717 case MODE_SK: 718 return ( (n == 1) ? 1 : (((n >= 2) && (n <= 4)) ? 2 : 0));718 return (n == 1) ? 1 : (((n >= 2) && (n <= 4)) ? 2 : 0); 719 719 //case MODE_SL: 720 720 // return (((n % 100) == 1) ? 1 : (((n % 100) == 2) ? 2 : ((((n % 100) == 3) -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r8338 r8345 291 291 public static String getURL(double dlat, double dlon, int zoom) { 292 292 // Truncate lat and lon to something more sensible 293 int decimals = (int) Math.pow(10, (zoom / 3));294 double lat = (Math.round(dlat * decimals));293 int decimals = (int) Math.pow(10, zoom / 3); 294 double lat = Math.round(dlat * decimals); 295 295 lat /= decimals; 296 double lon = (Math.round(dlon * decimals));296 double lon = Math.round(dlon * decimals); 297 297 lon /= decimals; 298 298 return Main.getOSMWebsite() + "/#map="+zoom+"/"+lat+"/"+lon; -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r8338 r8345 148 148 // create a shortcut object from an string as saved in the preferences 149 149 private Shortcut(String prefString) { 150 List<String> s = (new ArrayList<>(Main.pref.getCollection(prefString)));150 List<String> s = new ArrayList<>(Main.pref.getCollection(prefString)); 151 151 this.shortText = prefString.substring(15); 152 152 this.longText = s.get(0);
Note:
See TracChangeset
for help on using the changeset viewer.