Changeset 1930 in josm
- Timestamp:
- 2009-08-08T11:59:13+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r1925 r1930 97 97 for(Way w : selectedWays) { 98 98 if (rm.member == w) { 99 Pair<Relation,String> pair = new Pair<Relation,String>(r, rm. role == null ? "" : rm.role);99 Pair<Relation,String> pair = new Pair<Relation,String>(r, rm.getRole()); 100 100 HashSet<Way> waylinks = new HashSet<Way>(); 101 101 if (backlinks.containsKey(pair)) { … … 232 232 // note to re-add it later on. 233 233 if (selectedWays.contains(rm.member)) { 234 rolesToReAdd.add(rm. role);234 rolesToReAdd.add(rm.getRole()); 235 235 } else { 236 236 newRel.members.add(rm); -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r1925 r1930 134 134 for (Node n : allNodes) { 135 135 if (rm.member == n) { 136 Pair<Relation,String> pair = new Pair<Relation,String>(r, rm. role);136 Pair<Relation,String> pair = new Pair<Relation,String>(r, rm.getRole()); 137 137 HashSet<Node> nodelinks = new HashSet<Node>(); 138 138 if (backlinks.containsKey(pair)) { … … 282 282 // just keep a note to re-add it later on. 283 283 if (allNodes.contains(rm.member)) { 284 rolesToReAdd.add(rm. role);284 rolesToReAdd.add(rm.getRole()); 285 285 } else { 286 286 newRel.members.add(rm); -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r1928 r1930 316 316 317 317 int j = i; 318 boolean backwards = "backward".equals(rm. role);318 boolean backwards = "backward".equals(rm.getRole()); 319 319 for(Way wayToAdd : newWays) 320 320 { 321 RelationMember em = new RelationMember(rm. role, wayToAdd);322 if(em. role != null && em.role.length() > 0&& !("multipolygon".equals(type))) {321 RelationMember em = new RelationMember(rm.getRole(), wayToAdd); 322 if(em.hasRole() && !("multipolygon".equals(type))) { 323 323 warnmerole = true; 324 324 } -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1925 r1930 335 335 rolesToReAdd = new HashSet<String>(); 336 336 } 337 rolesToReAdd.add(rm. role);337 rolesToReAdd.add(rm.getRole()); 338 338 } 339 339 } -
trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java
r1926 r1930 48 48 } 49 49 50 oldRole = relation.getMember(position). role;50 oldRole = relation.getMember(position).getRole(); 51 51 relation.getMember(position).role = newRole; 52 52 -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r1925 r1930 166 166 for (RelationMember m : ref.getMembers()) { 167 167 if (m.member == osm) { 168 role = m. role;168 role = m.getRole(); 169 169 break; 170 170 } -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r1925 r1930 119 119 for (RelationMember member : relation.getMembers()) { 120 120 if (!member.member.hasEqualSemanticAttributes(oldway) 121 || member.role.length() == 0) {121 || !member.hasRole()) { 122 122 position++; 123 123 continue; … … 127 127 String newRole = null; 128 128 for (PrefixSuffixSwitcher prefixSuffixSwitcher : prefixSuffixSwitchers) { 129 newRole = prefixSuffixSwitcher.apply(member. role);130 if (!newRole.equals(member. role)) {129 newRole = prefixSuffixSwitcher.apply(member.getRole()); 130 if (!newRole.equals(member.getRole())) { 131 131 found = true; 132 132 break; -
trunk/src/org/openstreetmap/josm/corrector/RoleCorrectionTableModel.java
r1814 r1930 42 42 return NAME_FORMATTER.getName(roleCorrection.relation); 43 43 case 1: 44 return roleCorrection.member. role;44 return roleCorrection.member.getRole(); 45 45 case 2: 46 46 return roleCorrection.newRole; -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r1928 r1930 12 12 public String role; 13 13 public OsmPrimitive member; 14 15 /** 16 * 17 * @return Role name or "". Never returns null 18 * @since 1930 19 */ 20 public String getRole() { 21 if (role == null) { 22 return ""; 23 } else { 24 return role; 25 } 26 } 27 28 /** 29 * 30 * @return True if role is set 31 * @since 1930 32 */ 33 public boolean hasRole() { 34 return role != null && !"".equals(role); 35 } 14 36 15 37 /** -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1925 r1930 556 556 w.getName()), true); 557 557 } 558 else if("from".equals(m. role)) {558 else if("from".equals(m.getRole())) { 559 559 if(fromWay != null) 560 560 r.putError(tr("More than one \"from\" way found."), true); … … 562 562 fromWay = w; 563 563 } 564 } else if("to".equals(m. role)) {564 } else if("to".equals(m.getRole())) { 565 565 if(toWay != null) 566 566 r.putError(tr("More than one \"to\" way found."), true); … … 568 568 toWay = w; 569 569 } 570 } else if("via".equals(m. role)) {570 } else if("via".equals(m.getRole())) { 571 571 if(via != null) 572 572 r.putError(tr("More than one \"via\" found."), true); … … 575 575 } 576 576 else 577 r.putError(tr("Unknown role ''{0}''.", m. role), true);577 r.putError(tr("Unknown role ''{0}''.", m.getRole()), true); 578 578 } 579 579 else if(m.member instanceof Node) 580 580 { 581 581 Node n = (Node) m.member; 582 if("via".equals(m. role))582 if("via".equals(m.getRole())) 583 583 { 584 584 if(via != null) … … 588 588 } 589 589 else 590 r.putError(tr("Unknown role ''{0}''.", m. role), true);590 r.putError(tr("Unknown role ''{0}''.", m.getRole()), true); 591 591 } 592 592 else … … 801 801 w.getName()), true); 802 802 } 803 else if("inner".equals(m. role))803 else if("inner".equals(m.getRole())) 804 804 inner.add(w); 805 else if("outer".equals(m. role))805 else if("outer".equals(m.getRole())) 806 806 outer.add(w); 807 807 else 808 808 { 809 809 r.putError(tr("No useful role ''{0}'' for Way ''{1}''.", 810 m.role == null ? "" : m.role, w.getName()), true);811 if( m.role == null || m.role.length() == 0)810 m.getRole(), w.getName()), true); 811 if(!m.hasRole()) 812 812 outer.add(w); 813 813 else if(r.isSelected()) -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListMergeModel.java
r1928 r1930 24 24 @Override 25 25 public boolean isEqualEntry(RelationMember e1, RelationMember e2) { 26 boolean ret = 27 ( (e1.role == null && e2.role == null) 28 || (e1.role != null && e1.role.equals(e2.role)) 29 ); 26 boolean ret = e1.getRole().equals(e2.getRole()); 30 27 if (e1.member.id > 0 ) { 31 28 ret = ret && (e1.member.id == e2.member.id); … … 100 97 @Override 101 98 protected RelationMember cloneEntryForMergedList(RelationMember entry) { 102 return new RelationMember(entry .role, entry.member);99 return new RelationMember(entry); 103 100 } 104 101 -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberTableCellEditor.java
r1631 r1930 15 15 /** 16 16 * {@see TableCellEditor} for the the role column in a table for {@see RelationMember}s. 17 * 17 * 18 18 */ 19 19 public class RelationMemberTableCellEditor extends AbstractCellEditor implements TableCellEditor{ … … 37 37 RelationMember member = (RelationMember)value; 38 38 39 editor.setText(member. role == null ? "" : member.role);39 editor.setText(member.getRole()); 40 40 editor.selectAll(); 41 41 return editor; -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberTableCellRenderer.java
r1911 r1930 25 25 /** 26 26 * This is the {@see TableCellRenderer} used in the tables of {@see RelationMemberMerger}. 27 * 27 * 28 28 */ 29 29 public class RelationMemberTableCellRenderer extends JLabel implements TableCellRenderer { … … 48 48 /** 49 49 * Load the image icon for an OSM primitive of type node 50 * 50 * 51 51 * @return the icon; null, if not found 52 52 */ … … 153 153 154 154 protected void renderRole(RelationMember member) { 155 setText(member. role == null ? "" : member.role);156 setToolTipText(member. role == null ? "" : member.role);155 setText(member.getRole()); 156 setToolTipText(member.getRole()); 157 157 } 158 158 -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1928 r1930 535 535 for (RelationMember r : col) { 536 536 if (text == null) { 537 text = r. role;537 text = r.getRole(); 538 538 } 539 else if (!text.equals(r. role)) {539 else if (!text.equals(r.getRole())) { 540 540 text = tr("<different>"); 541 541 break; … … 595 595 if (rm.member == osm) 596 596 { 597 RelationMember mem = new RelationMember(rm.role, rm.member); 598 rel.members.remove(mem); 597 rel.members.remove(rm); 599 598 break; 600 599 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r1927 r1930 87 87 switch (columnIndex) { 88 88 case 0: 89 return members.get(rowIndex). role;89 return members.get(rowIndex).getRole(); 90 90 case 1: 91 91 return members.get(rowIndex).member; … … 386 386 /** 387 387 * Replies the set of selected referers. Never null, but may be empty. 388 * 388 * 389 389 * @return the set of selected referers 390 390 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ac/AutoCompletionCache.java
r1925 r1930 132 132 protected void cacheRelationMemberRoles(Relation relation){ 133 133 for (RelationMember m: relation.getMembers()) { 134 if (m.role == null || m.role.trim().equals("")) { 135 continue; 136 } 137 if (!roleCache.contains(m.role)) { 138 roleCache.add(m.role); 134 if (m.hasRole() && !roleCache.contains(m.getRole())) { 135 roleCache.add(m.getRole()); 139 136 } 140 137 } -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r1925 r1930 135 135 out.print(OsmPrimitiveType.from(em.member).getAPIName()); 136 136 out.println("' ref='"+getUsedId(em.member)+"' role='" + 137 XmlWriter.encode(em. role == null ? "" : em.role) + "' />");137 XmlWriter.encode(em.getRole()) + "' />"); 138 138 } 139 139 addTags(e, "relation", false);
Note:
See TracChangeset
for help on using the changeset viewer.