- Timestamp:
- 2009-12-13T15:54:49+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r2521 r2628 332 332 333 333 for (RelationMember rm : r.getMembers()) { 334 if (rm.isWay()) { 335 if (rm.getMember() == way) { 336 if (!("route".equals(type)) && !("multipolygon".equals(type))) { 334 if (rm.isWay() && rm.getMember() == way) { 335 boolean insert = true; 336 if ("restriction".equals(type)) 337 { 338 /* this code assumes the restriction is correct. No real error checking done */ 339 String role = rm.getRole(); 340 if("from".equals(role) || "to".equals(role)) 341 { 342 OsmPrimitive via = null; 343 for (RelationMember rmv : r.getMembers()) { 344 if("via".equals(rmv.getRole())){ 345 via = rmv.getMember(); 346 } 347 } 348 List<Node> nodes = new ArrayList<Node>(); 349 if(via != null) { 350 if(via instanceof Node) { 351 nodes.add((Node)via); 352 } else if(via instanceof Way) { 353 nodes.add(((Way)via).lastNode()); 354 nodes.add(((Way)via).firstNode()); 355 } 356 } 357 Way res = null; 358 for(Node n : nodes) { 359 if(changedWay.isFirstLastNode(n)) { 360 res = way; 361 } 362 } 363 if(res == null) 364 { 365 for (Way wayToAdd : newWays) { 366 for(Node n : nodes) { 367 if(wayToAdd.isFirstLastNode(n)) { 368 res = wayToAdd; 369 } 370 } 371 } 372 if(res != null) 373 { 374 if (c == null) { 375 c = new Relation(r); 376 } 377 c.addMember(new RelationMember(role, res)); 378 c.removeMembersFor(way); 379 insert = false; 380 } 381 } 382 else 383 insert = false; 384 } 385 else if(!"via".equals(role)) 337 386 warnme = true; 338 } 339 if (c == null) { 340 c = new Relation(r); 341 } 342 387 } 388 else if (!("route".equals(type)) && !("multipolygon".equals(type))) { 389 warnme = true; 390 } 391 if (c == null) { 392 c = new Relation(r); 393 } 394 395 if(insert) 396 { 343 397 int j = i; 344 398 boolean backwards = "backward".equals(rm.getRole());
Note:
See TracChangeset
for help on using the changeset viewer.