Ticket #7421: bug7421.patch
| File bug7421.patch, 1.3 KB (added by , 12 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/CreateCircleAction.java
9 9 import java.util.ArrayList; 10 10 import java.util.Arrays; 11 11 import java.util.Collection; 12 import java.util.Collections; 12 13 import java.util.Comparator; 13 14 import java.util.LinkedList; 14 15 import java.util.List; … … 230 231 } 231 232 } 232 233 wayToAdd.add(wayToAdd.get(0)); // close the circle 234 235 // Set circle direction same as selected nodes (see: #7421) 236 if(nodes.size() == 3) { 237 double[] x = new double[2]; 238 double[] y = new double[2]; 239 for(int i = 0; i < 2; i++) { 240 x[i] = nodes.get(i+1).getEastNorth().east() - nodes.get(i).getEastNorth().east(); 241 y[i] = nodes.get(i+1).getEastNorth().north() - nodes.get(i).getEastNorth().north(); 242 } 243 double pvect = x[0] * y[1] - x[1] * y[0]; 244 if(pvect < 0) 245 Collections.reverse(wayToAdd); 246 } 247 233 248 if (existingWay == null) { 234 249 Way newWay = new Way(); 235 250 newWay.setNodes(wayToAdd);
