Changeset 1898 in josm for trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
- Timestamp:
- 2009-08-03T21:18:50+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r1862 r1898 12 12 13 13 import javax.swing.JOptionPane; 14 import javax.swing.text.html.Option;15 14 16 15 import org.openstreetmap.josm.Main; … … 96 95 // Otherwise, two segments could be turned into same direction and intersection would fail. 97 96 // Or changes of shape would be too serious. 98 for (int i1=0; i1 < way. nodes.size()-1; i1++) {99 int i2 = (i1+1) % (way. nodes.size()-1);100 int i3 = (i1+2) % (way. nodes.size()-1);101 double angle1 =Math.abs(way. nodes.get(i1).getEastNorth().heading(way.nodes.get(i2).getEastNorth()));102 double angle2 = Math.abs(way. nodes.get(i2).getEastNorth().heading(way.nodes.get(i3).getEastNorth()));97 for (int i1=0; i1 < way.getNodesCount()-1; i1++) { 98 int i2 = (i1+1) % (way.getNodesCount()-1); 99 int i3 = (i1+2) % (way.getNodesCount()-1); 100 double angle1 =Math.abs(way.getNode(i1).getEastNorth().heading(way.getNode(i2).getEastNorth())); 101 double angle2 = Math.abs(way.getNode(i2).getEastNorth().heading(way.getNode(i3).getEastNorth())); 103 102 double delta = Math.abs(angle2 - angle1); 104 103 while(delta > Math.PI) { … … 162 161 163 162 Way way = (Way)osm; 164 int nodes = way. nodes.size();163 int nodes = way.getNodesCount(); 165 164 int sides = nodes - 1; 166 165 // Copy necessary data into a more suitable data structure 167 166 EastNorth en[] = new EastNorth[sides]; 168 167 for (int i=0; i < sides; i++) { 169 en[i] = new EastNorth(way. nodes.get(i).getEastNorth().east(), way.nodes.get(i).getEastNorth().north());168 en[i] = new EastNorth(way.getNode(i).getEastNorth().east(), way.getNode(i).getEastNorth().north()); 170 169 } 171 170 … … 178 177 double weights[] = new double[sides]; 179 178 for (int i=0; i < sides; i++) { 180 headings[i] = normalize_angle(way. nodes.get(i).getEastNorth().heading(way.nodes.get(i+1).getEastNorth()));181 weights[i] = way. nodes.get(i).getEastNorth().distance(way.nodes.get(i+1).getEastNorth());179 headings[i] = normalize_angle(way.getNode(i).getEastNorth().heading(way.getNode(i+1).getEastNorth())); 180 weights[i] = way.getNode(i).getEastNorth().distance(way.getNode(i+1).getEastNorth()); 182 181 } 183 182 … … 270 269 B.north() + q * (A.north() - B.north())); 271 270 272 Node n = way. nodes.get(i2);271 Node n = way.getNode(i2); 273 272 274 273 LatLon ill = Main.proj.eastNorth2latlon(intersection);
Note:
See TracChangeset
for help on using the changeset viewer.