Changeset 29189 in osm for applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
- Timestamp:
- 2013-01-11T19:31:28+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29186 r29189 66 66 ArrayList<Long> way = map.ways.get(feature.refs); 67 67 Coord coord = map.nodes.get(way.get(0)); 68 double ll at = coord.lat;69 double ll on = coord.lon;70 double area = 0.0;68 double llon = Math.toRadians(coord.lon); 69 double llat = Math.toRadians(coord.lat); 70 double sigma = 0.0; 71 71 for (long node : way) { 72 72 coord = map.nodes.get(node); 73 area += ((llon * coord.lat) - (llat * coord.lon)); 74 llat = coord.lat; 75 llon = coord.lon; 73 double lat = Math.toRadians(coord.lat); 74 double lon = Math.toRadians(coord.lon); 75 sigma += (lon * Math.sin(llat)) - (llon * Math.sin(lat)); 76 llon = lon; 77 llat = lat; 76 78 } 77 return Math.abs( area) / 2.0 * 60.0 * 60.0;79 return Math.abs(sigma) / 2.0 * 3444 * 3444; 78 80 } 79 81 return 0.0; … … 81 83 82 84 public static Coord findCentroid(Feature feature) { 85 double tst = calcArea(feature); 83 86 Coord coord; 84 87 ArrayList<Long> way = map.ways.get(feature.refs); … … 102 105 double lon = coord.lon; 103 106 double lat = coord.lat; 104 double arc = Math.sqrt(Math.pow((lon-llon), 2) + Math.pow((lat-llat), 2));107 double arc = (Math.acos(Math.cos(Math.toRadians(lon-llon)) * Math.cos(Math.toRadians(lat-llat)))); 105 108 slat += (lat * arc); 106 109 slon += (lon * arc);
Note:
See TracChangeset
for help on using the changeset viewer.