Changeset 30737 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
- Timestamp:
- 2014-10-18T23:07:52+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
r29535 r30737 37 37 public TheRing( Way source ) { 38 38 this.source = source; 39 segments = new ArrayList< RingSegment>(1);39 segments = new ArrayList<>(1); 40 40 segments.add(new RingSegment(source)); 41 41 } 42 42 43 43 public static boolean areAllOfThoseRings( Collection<Way> ways ) { 44 List<Way> rings = new ArrayList< Way>();44 List<Way> rings = new ArrayList<>(); 45 45 for( Way way : ways ) { 46 46 if( way.isClosed() ) … … 70 70 public static List<Relation> makeManySimpleMultipolygons( Collection<Way> selection, List<Command> commands ) { 71 71 log("---------------------------------------"); 72 List<TheRing> rings = new ArrayList< TheRing>(selection.size());72 List<TheRing> rings = new ArrayList<>(selection.size()); 73 73 for( Way w : selection ) 74 74 rings.add(new TheRing(w)); … … 77 77 rings.get(i).collide(rings.get(j)); 78 78 redistributeSegments(rings); 79 List<Relation> relations = new ArrayList< Relation>();80 Map<Relation, Relation> relationCache = new HashMap< Relation, Relation>();79 List<Relation> relations = new ArrayList<>(); 80 Map<Relation, Relation> relationCache = new HashMap<>(); 81 81 for( TheRing r : rings ) { 82 82 commands.addAll(r.getCommands(relationCache)); … … 247 247 public static void redistributeSegments( List<TheRing> rings ) { 248 248 // build segments map 249 Map<RingSegment, TheRing> segmentMap = new HashMap< RingSegment, TheRing>();249 Map<RingSegment, TheRing> segmentMap = new HashMap<>(); 250 250 for( TheRing ring : rings ) 251 251 for( RingSegment seg : ring.segments ) … … 317 317 318 318 // build a map of referencing relations 319 Map<Relation, Integer> referencingRelations = new HashMap< Relation, Integer>();320 List<Command> relationCommands = new ArrayList< Command>();319 Map<Relation, Integer> referencingRelations = new HashMap<>(); 320 List<Command> relationCommands = new ArrayList<>(); 321 321 for( OsmPrimitive p : source.getReferrers() ) { 322 322 if( p instanceof Relation ) { … … 342 342 // поÑ�тому Ñ�охранÑ�етÑ�Ñ� только первое изменение 343 343 344 List<Command> commands = new ArrayList< Command>();344 List<Command> commands = new ArrayList<>(); 345 345 boolean foundOwnWay = false; 346 346 for( RingSegment seg : segments ) { … … 464 464 if( pos <= 0 || pos >= nodes.size() - 1 ) 465 465 return null; 466 List<Node> newNodes = new ArrayList< Node>(nodes.subList(pos, nodes.size()));466 List<Node> newNodes = new ArrayList<>(nodes.subList(pos, nodes.size())); 467 467 nodes.subList(pos + 1, nodes.size()).clear(); 468 468 return new RingSegment(newNodes); … … 489 489 return null; 490 490 491 List<Node> newNodes = new ArrayList< Node>();491 List<Node> newNodes = new ArrayList<>(); 492 492 if( pos2 > pos1 ) { 493 493 newNodes.addAll(nodes.subList(pos2, nodes.size())); … … 499 499 } else { 500 500 newNodes.addAll(nodes.subList(pos2, pos1 + 1)); 501 nodes.addAll(new ArrayList< Node>(nodes.subList(0, pos2 + 1)));501 nodes.addAll(new ArrayList<>(nodes.subList(0, pos2 + 1))); 502 502 nodes.subList(0, pos1).clear(); 503 503 } … … 513 513 if( nodes == null ) 514 514 throw new IllegalArgumentException("Won't give you wayNodes: it is a reference"); 515 List<Node> wayNodes = new ArrayList< Node>(nodes);515 List<Node> wayNodes = new ArrayList<>(nodes); 516 516 if( isRing ) 517 517 wayNodes.add(wayNodes.get(0));
Note:
See TracChangeset
for help on using the changeset viewer.
