Changeset 4663 in josm
- Timestamp:
- 2011-12-14T17:45:56+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r4604 r4663 574 574 List<Integer> position = new ArrayList<Integer>(); 575 575 private String positionString = null; 576 void add(RelationMember r, Integer p) 577 { 576 void add(RelationMember r, Integer p) { 578 577 role.add(r); 579 578 position.add(p); 580 579 } 581 String getPositionString() 582 { 583 if(positionString == null) 584 { 580 String getPositionString() { 581 if (positionString == null) { 585 582 Collections.sort(position); 586 583 positionString = String.valueOf(position.get(0)); 587 584 int cnt = 0; 588 585 int last = position.get(0); 589 for (int i = 1; i < position.size(); ++i) {586 for (int i = 1; i < position.size(); ++i) { 590 587 int cur = position.get(i); 591 if (cur == last+1) {588 if (cur == last + 1) { 592 589 ++cnt; 593 590 } else if (cnt == 0) { 594 positionString += "," +String.valueOf(cur);591 positionString += "," + String.valueOf(cur); 595 592 } else { 596 if(cnt == 1) { 597 positionString += ","+String.valueOf(last); 598 } else if(cnt > 1) { 599 positionString += "-"+String.valueOf(last); 600 } 601 positionString += "-"+String.valueOf(cur); 593 positionString += "-" + String.valueOf(last); 594 positionString += "," + String.valueOf(cur); 602 595 cnt = 0; 603 596 } 604 597 last = cur; 605 598 } 606 if(cnt == 1) { 607 positionString += ","+String.valueOf(last); 608 } else if(cnt > 1) { 609 positionString += "-"+String.valueOf(last); 610 } 611 } 612 if(positionString.length() > 20) { 613 positionString = positionString.substring(0,17)+"..."; 599 if (cnt >= 1) { 600 positionString += "-" + String.valueOf(last); 601 } 602 } 603 if (positionString.length() > 20) { 604 positionString = positionString.substring(0, 17) + "..."; 614 605 } 615 606 return positionString;
Note:
See TracChangeset
for help on using the changeset viewer.