- Timestamp:
- 2010-01-23T21:15:17+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r2801 r2886 546 546 } 547 547 } 548 548 setSelectedMembersIdx(selectedIndices); 549 } 550 551 /** 552 * Selects the members in the collection selectedIndices 553 * 554 * @param selectedIndices the collection of selected member indices 555 */ 556 public void setSelectedMembersIdx(Collection<Integer> selectedIndices) { 557 if (selectedIndices == null || selectedIndices.isEmpty()) { 558 getSelectionModel().clearSelection(); 559 return; 560 } 549 561 // select the members 550 562 // … … 740 752 741 753 /** 742 * Sort the relation members by the way they are linked.754 * Sort the selected relation members by the way they are linked. 743 755 */ 744 756 void sort() { … … 746 758 ArrayList<RelationMember> sortedMembers = null; 747 759 ArrayList<RelationMember> newMembers; 748 if (selectedMembers. isEmpty()) {760 if (selectedMembers.size() <= 1) { 749 761 newMembers = sortMembers(members); 762 sortedMembers = newMembers; 750 763 } else { 751 764 sortedMembers = sortMembers(selectedMembers); … … 774 787 775 788 /** 776 * Reverse the relation members.777 */778 void reverse() {779 Collections.reverse(members);780 fireTableDataChanged();781 }782 783 /**784 789 * Determines the direction of way k with respect to the way ref_i. 785 790 * The way ref_i is assumed to have the direction ref_direction and … … 790 795 * Else the direction is given as follows: 791 796 * Let the relation be a route of oneway streets, and someone travels them in the given order. 792 * Direction is FORWARD forif it is legel and BACKWARD if it is illegal to do so for the given way.797 * Direction is FORWARD if it is legel and BACKWARD if it is illegal to do so for the given way. 793 798 * 794 799 **/ … … 855 860 * determine, if the way i is a roundabout and if yes, what type of roundabout 856 861 */ 857 private Direction roundaboutType(int i) { //FIXME862 private Direction roundaboutType(int i) { 858 863 RelationMember m = members.get(i); 859 864 if (m == null || !m.isWay()) return NONE; … … 894 899 895 900 /** 901 * Reverse the relation members. 902 */ 903 void reverse() { 904 List<Integer> selectedIndices = getSelectedIndices(); 905 List<Integer> selectedIndicesReversed = getSelectedIndices(); 906 907 if (selectedIndices.size() <= 1) { 908 Collections.reverse(members); 909 fireTableDataChanged(); 910 setSelectedMembers(members); 911 } else { 912 Collections.reverse(selectedIndicesReversed); 913 914 ArrayList<RelationMember> newMembers = new ArrayList<RelationMember>(members); 915 916 for (int i=0; i < selectedIndices.size(); i++) { 917 newMembers.set(selectedIndices.get(i), members.get(selectedIndicesReversed.get(i))); 918 } 919 920 if (members.size() != newMembers.size()) throw new AssertionError(); 921 members.clear(); 922 members.addAll(newMembers); 923 fireTableDataChanged(); 924 setSelectedMembersIdx(selectedIndices); 925 } 926 } 927 928 /** 896 929 * refresh the cache of member WayConnectionTypes 897 930 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationNodeMap.java
r2578 r2886 88 88 89 89 if (nodeLinks.getValue().size() < 2) { 90 // System.err.println("DELETE: "+nodeLinks.getKey()+" "+nodeLinks.getValue());91 90 if (nodeLinks.getValue().size() != 1) throw new AssertionError(); 92 91 … … 98 97 continue; 99 98 } 100 // System.err.println(nodeLinks.getKey()+" "+nodeLinks.getValue());101 102 99 } 103 // System.err.println("");104 // System.err.println(remaining);105 // System.err.println("");106 // System.err.println(nodesMap);107 // System.err.println("");108 // System.err.println(waysMap);109 110 100 } 111 101 … … 132 122 */ 133 123 public Integer popAdjacent(Integer i) { 134 // System.err.print("Adjacent["+i+"]:");135 124 TreeSet<Node> nodes = waysMap.get(i); 136 // System.err.print(nodes);137 125 for (Node n : nodes) { 138 // System.err.print(" {"+n.getId()+"} ");139 126 TreeSet<Integer> adj = nodesMap.get(n); 140 127 if (!adj.isEmpty()) { … … 142 129 done(j); 143 130 waysMap.get(j).remove(n); 144 // System.err.println(j);145 131 return j; 146 132 }
Note:
See TracChangeset
for help on using the changeset viewer.