Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
- Timestamp:
- 2014-04-26T17:39:23+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r6987 r7005 72 72 * Remember movements, so the user can later undo it for certain nodes 73 73 */ 74 private static final Map<Node, EastNorth> rememberMovements = new HashMap< Node, EastNorth>();74 private static final Map<Node, EastNorth> rememberMovements = new HashMap<>(); 75 75 76 76 /** … … 98 98 if (!isEnabled()) 99 99 return; 100 final Collection<Command> commands = new LinkedList< Command>();100 final Collection<Command> commands = new LinkedList<>(); 101 101 final Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); 102 102 try { … … 145 145 } 146 146 147 final List<Node> nodeList = new ArrayList< Node>();148 final List<WayData> wayDataList = new ArrayList< WayData>();147 final List<Node> nodeList = new ArrayList<>(); 148 final List<WayData> wayDataList = new ArrayList<>(); 149 149 final Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); 150 150 … … 165 165 if (nodeList.size() == 2 || nodeList.isEmpty()) { 166 166 OrthogonalizeAction.rememberMovements.clear(); 167 final Collection<Command> commands = new LinkedList< Command>();167 final Collection<Command> commands = new LinkedList<>(); 168 168 169 169 if (nodeList.size() == 2) { // fixed direction … … 202 202 */ 203 203 private static List<List<WayData>> buildGroups(List<WayData> wayDataList) { 204 List<List<WayData>> groups = new ArrayList< List<WayData>>();205 Set<WayData> remaining = new HashSet< WayData>(wayDataList);204 List<List<WayData>> groups = new ArrayList<>(); 205 Set<WayData> remaining = new HashSet<>(wayDataList); 206 206 while (!remaining.isEmpty()) { 207 List<WayData> group = new ArrayList< WayData>();207 List<WayData> group = new ArrayList<>(); 208 208 groups.add(group); 209 209 Iterator<WayData> it = remaining.iterator(); 210 210 WayData next = it.next(); 211 211 it.remove(); 212 extendGroupRec(group, next, new ArrayList< WayData>(remaining));212 extendGroupRec(group, next, new ArrayList<>(remaining)); 213 213 remaining.removeAll(group); 214 214 } … … 283 283 284 284 // put the nodes of all ways in a set 285 final HashSet<Node> allNodes = new HashSet< Node>();285 final HashSet<Node> allNodes = new HashSet<>(); 286 286 for (WayData w : wayDataList) { 287 287 for (Node n : w.way.getNodes()) { … … 291 291 292 292 // the new x and y value for each node 293 final HashMap<Node, Double> nX = new HashMap< Node, Double>();294 final HashMap<Node, Double> nY = new HashMap< Node, Double>();293 final HashMap<Node, Double> nX = new HashMap<>(); 294 final HashMap<Node, Double> nY = new HashMap<>(); 295 295 296 296 // calculate the centroid of all nodes … … 314 314 final Direction[][] ORIENTATIONS = {HORIZONTAL, VERTICAL}; 315 315 for (Direction[] orientation : ORIENTATIONS){ 316 final HashSet<Node> s = new HashSet< Node>(allNodes);316 final HashSet<Node> s = new HashSet<>(allNodes); 317 317 int s_size = s.size(); 318 318 for (int dummy = 0; dummy < s_size; ++dummy) { … … 322 322 final Node dummy_n = s.iterator().next(); // pick arbitrary element of s 323 323 324 final HashSet<Node> cs = new HashSet< Node>(); // will contain each node that can be reached from dummy_n324 final HashSet<Node> cs = new HashSet<>(); // will contain each node that can be reached from dummy_n 325 325 cs.add(dummy_n); // walking only on horizontal / vertical segments 326 326 … … 381 381 382 382 // rotate back and log the change 383 final Collection<Command> commands = new LinkedList< Command>();383 final Collection<Command> commands = new LinkedList<>(); 384 384 for (Node n: allNodes) { 385 385 EastNorth tmp = new EastNorth(nX.get(n), nY.get(n));
Note:
See TracChangeset
for help on using the changeset viewer.