Changeset 29189 in osm
- Timestamp:
- 2013-01-11T19:31:28+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 2 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); -
applications/editors/josm/plugins/smed2/src/smed2/Smed2Action.java
r29184 r29189 113 113 editFrame.setResizable(true); 114 114 editFrame.setAlwaysOnTop(true); 115 editFrame.setVisible( true);115 editFrame.setVisible(false); 116 116 panelMain = new PanelMain(); 117 117 editFrame.add(panelMain); … … 169 169 Node nextNode = null; 170 170 Node node = null; 171 Way nextWay = null; 172 Way way = null; 171 173 172 174 if (selection.size() == 0) showFrame.setVisible(false); … … 179 181 showFrame.setVisible(true); 180 182 showFrame.showFeature(node, map); 183 } 184 } else { 185 showFrame.setVisible(false); 186 } 187 } 188 else if (osm instanceof Way) { 189 nextWay = (Way) osm; 190 if (selection.size() == 1) { 191 if (nextWay.compareTo(way) != 0) { 192 way = nextWay; 193 showFrame.setVisible(true); 194 showFrame.showFeature(way, map); 181 195 } 182 196 } else {
Note:
See TracChangeset
for help on using the changeset viewer.