- Timestamp:
- 2009-08-08T22:39:04+02:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r1926 r1938 92 92 List<RelationMember> members = new ArrayList<RelationMember>(); 93 93 for (RelationMember m : r.getMembers()) { 94 OsmPrimitive mo = map.get(m. member);94 OsmPrimitive mo = map.get(m.getMember()); 95 95 if(mo != null) /* TODO - This only prevents illegal data, but kills the relation */ 96 96 { 97 97 RelationMember mnew = new RelationMember(m); 98 mnew.member = map.get(m. member);98 mnew.member = map.get(m.getMember()); 99 99 members.add(mnew); 100 100 } -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r1930 r1938 305 305 306 306 for (RelationMember rm : r.getMembers()) { 307 if (rm. member instanceof Way) {308 if (rm. member== selectedWay)307 if (rm.isWay()) { 308 if (rm.getMember() == selectedWay) 309 309 { 310 310 if(!("route".equals(type)) && !("multipolygon".equals(type))) { -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1930 r1938 328 328 rolesToReAdd = null; 329 329 for (RelationMember rm : r.getMembers()) { 330 if (rm. member instanceof Node) {331 if (rm. member== originalNode) {330 if (rm.isNode()) { 331 if (rm.getMember() == originalNode) { 332 332 if (newRel == null) { 333 333 newRel = new Relation(r); -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r1925 r1938 446 446 } else if (osm instanceof Relation) { 447 447 for (RelationMember member : ((Relation)osm).getMembers()) { 448 if (member.member != null) { 449 isParent |= child.match(member.member); 448 if (member.getMember() != null) { 449 // TODO Nullable member will not be allowed 450 isParent |= child.match(member.getMember()); 450 451 } 451 452 } -
trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java
r1925 r1938 120 120 Relation r = (Relation)parent; 121 121 for (RelationMember member : r.getMembers()) { 122 if (member. member== child) {123 OsmParentChildPair pair = new OsmParentChildPair(parent, member. member);122 if (member.getMember() == child) { 123 OsmParentChildPair pair = new OsmParentChildPair(parent, member.getMember()); 124 124 if (! pairs.contains(pair)) { 125 125 pairs.add(pair); -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r1930 r1938 118 118 int position = 0; 119 119 for (RelationMember member : relation.getMembers()) { 120 if (!member. member.hasEqualSemanticAttributes(oldway)120 if (!member.getMember().hasEqualSemanticAttributes(oldway) 121 121 || !member.hasRole()) { 122 122 position++; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1925 r1938 349 349 350 350 for (RelationMember m : r.getMembers()) { 351 if (m. member.incomplete || m.member.deleted) continue;352 353 if (m. member instanceof Node) {354 Point p = nc.getPoint( (Node) m.member);351 if (m.getMember().incomplete || m.getMember().deleted) continue; 352 353 if (m.isNode()) { 354 Point p = nc.getPoint(m.getNode()); 355 355 if (p.x < 0 || p.y < 0 356 356 || p.x > nc.getWidth() || p.y > nc.getHeight()) continue; 357 357 358 358 g.drawOval(p.x-3, p.y-3, 6, 6); 359 } else if (m. member instanceof Way) {359 } else if (m.isWay()) { 360 360 GeneralPath path = new GeneralPath(); 361 361 362 362 boolean first = true; 363 for (Node n : ((Way) m.member).getNodes()) {363 for (Node n : m.getWay().getNodes()) { 364 364 if (n.incomplete || n.deleted) continue; 365 365 Point p = nc.getPoint(n); -
trunk/src/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModel.java
r1925 r1938 571 571 HashMap<Long,OsmPrimitive> candidates = new HashMap<Long, OsmPrimitive>(); 572 572 for (RelationMember m : r.getMembers()) { 573 if (m. member.id > 0 && !candidates.values().contains(m.member)) {574 candidates.put(m. member.id,m.member);573 if (m.getMember().id > 0 && !candidates.values().contains(m.getMember())) { 574 candidates.put(m.getMember().id, m.getMember()); 575 575 } 576 576 } -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListMergeModel.java
r1930 r1938 25 25 public boolean isEqualEntry(RelationMember e1, RelationMember e2) { 26 26 boolean ret = e1.getRole().equals(e2.getRole()); 27 if (e1. member.id > 0 ) {28 ret = ret && (e1. member.id == e2.member.id);27 if (e1.getMember().id > 0 ) { 28 ret = ret && (e1.getMember().id == e2.getMember().id); 29 29 } else { 30 30 ret = ret && (e1 == e2); -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberTableCellRenderer.java
r1930 r1938 17 17 import org.openstreetmap.josm.data.osm.Node; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 import org.openstreetmap.josm.data.osm.Relation;20 19 import org.openstreetmap.josm.data.osm.RelationMember; 21 import org.openstreetmap.josm.data.osm.Way;22 20 import org.openstreetmap.josm.gui.conflict.ListMergeModel; 23 21 import org.openstreetmap.josm.tools.ImageProvider; … … 158 156 159 157 protected void renderPrimitive(RelationMember member) { 160 String displayName = member. member.getName();158 String displayName = member.getMember().getName(); 161 159 setText(displayName); 162 setToolTipText(buildToolTipText(member. member));163 if (member. member instanceof Node) {160 setToolTipText(buildToolTipText(member.getMember())); 161 if (member.isNode()) { 164 162 setIcon(nodeIcon); 165 } else if (member. member instanceof Way) {163 } else if (member.isWay()) { 166 164 setIcon(wayIcon); 167 } else if (member. member instanceof Relation) {165 } else if (member.isRelation()) { 168 166 setIcon(relationIcon); 169 167 } else { -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1930 r1938 593 593 for (RelationMember rm : cur.getMembers()) { 594 594 for (OsmPrimitive osm : sel) { 595 if (rm. member== osm)595 if (rm.getMember() == osm) 596 596 { 597 597 rel.members.remove(rm); … … 800 800 if (!r.deleted && !r.incomplete) { 801 801 for (RelationMember m : r.getMembers()) { 802 if (newSelection.contains(m. member)) {802 if (newSelection.contains(m.getMember())) { 803 803 Collection<RelationMember> value = roles.get(r); 804 804 if (value == null) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r1925 r1938 271 271 Collection<OsmPrimitive> selection = Main.map.mapView.getEditLayer().data.getSelected(); 272 272 for (RelationMember member: r.getMembers()) { 273 if (selection.contains(member. member)) {273 if (selection.contains(member.getMember())) { 274 274 members.add(member); 275 275 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java
r1925 r1938 48 48 if (parent == null) return false; 49 49 for (RelationMember m: parent.getMembers()) { 50 if (m. member instanceof Relation) {51 Relation child = (Relation)m.member;50 if (m.isRelation()) { 51 Relation child = m.getRelation(); 52 52 if (child.equals(relation)) return true; 53 53 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationNodeMap.java
r1921 r1938 9 9 /** 10 10 * A mapping from Node positions to elements in a Relation (currently Nodes and Ways only) 11 * 11 * 12 12 * @author Christiaan Welvaart <cjw@time4t.net> 13 * 13 * 14 14 */ 15 15 public class RelationNodeMap { … … 29 29 for (i = 0; i < members.size(); ++i) { 30 30 RelationMember m = members.get(i); 31 if (m. member.incomplete)31 if (m.getMember().incomplete) 32 32 { 33 33 remaining.add(Integer.valueOf(i)); … … 47 47 if (result == null) { 48 48 result = points.get(node).first(); 49 if (members.get(current). member == members.get(result).member) {49 if (members.get(current).getMember() == members.get(result).getMember()) { 50 50 result = points.get(node).last(); 51 51 } … … 59 59 60 60 void add(int n, RelationMember m) { 61 if (m. member instanceof Way) {62 Way w = (Way) m.member;61 if (m.isWay()) { 62 Way w = m.getWay(); 63 63 if (w.lastNode() == w.firstNode()) 64 64 { … … 77 77 points.get(w.lastNode()).add(Integer.valueOf(n)); 78 78 } 79 } else if (m. member instanceof Node) {80 Node node = (Node) m.member;79 } else if (m.isNode()) { 80 Node node = m.getNode(); 81 81 nodes.put(node, Integer.valueOf(n)); 82 82 } else { … … 87 87 boolean remove(int n, RelationMember a) { 88 88 boolean result; 89 if (a. member instanceof Way) {90 Way w = (Way) a.member;89 if (a.isWay()) { 90 Way w = a.getWay(); 91 91 if (w.firstNode() == w.lastNode()) 92 92 { … … 99 99 } 100 100 } else { 101 result = (nodes.remove(a. member) != null);101 result = (nodes.remove(a.getMember()) != null); 102 102 } 103 103 return result; … … 135 135 if (!set.isEmpty()) { 136 136 result = set.first(); 137 Way w = (Way) members.get(result).member;137 Way w = members.get(result).getWay(); 138 138 points.get(w.firstNode()).remove(result); 139 139 points.get(w.lastNode()).remove(result); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTreeModel.java
r1925 r1938 73 73 int count = 0; 74 74 for(RelationMember member : parent.getMembers()) { 75 if (member. member instanceof Relation) {75 if (member.isRelation()) { 76 76 count++; 77 77 } … … 93 93 int count=0; 94 94 for (RelationMember member : parent.getMembers()) { 95 if (!(member. member instanceof Relation)) {95 if (!(member.isRelation())) { 96 96 continue; 97 97 } 98 98 if (count == idx) 99 return (Relation)member.member;99 return member.getRelation(); 100 100 count++; 101 101 } … … 118 118 int idx = 0; 119 119 for (RelationMember member : parent.getMembers()) { 120 if (!(member. member instanceof Relation)) {120 if (!(member.isRelation())) { 121 121 continue; 122 122 } 123 if (member. member== child) return idx;123 if (member.getMember() == child) return idx; 124 124 idx++; 125 125 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r1925 r1938 204 204 remember(relation.id, OsmPrimitiveType.RELATION); 205 205 for (RelationMember member : relation.getMembers()) { 206 appendGeneric(member. member);206 appendGeneric(member.getMember()); 207 207 } 208 208 return this; -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r1930 r1938 133 133 for (RelationMember em : e.getMembers()) { 134 134 out.print(" <member type='"); 135 out.print(OsmPrimitiveType.from(em. member).getAPIName());136 out.println("' ref='"+getUsedId(em. member)+"' role='" +135 out.print(OsmPrimitiveType.from(em.getMember()).getAPIName()); 136 out.println("' ref='"+getUsedId(em.getMember())+"' role='" + 137 137 XmlWriter.encode(em.getRole()) + "' />"); 138 138 } -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r1928 r1938 377 377 Set<Long> expectedWayIds = new HashSet<Long>(); 378 378 for (RelationMember m : lookupRelation(ds, 6).getMembers()) { 379 if (m. member instanceof Way) {380 expectedWayIds.add(m. member.id);379 if (m.isWay()) { 380 expectedWayIds.add(m.getMember().id); 381 381 } 382 382 } 383 383 for (RelationMember m : lookupRelation(ds, 7).getMembers()) { 384 if (m. member instanceof Way) {385 expectedWayIds.add(m. member.id);384 if (m.isWay()) { 385 expectedWayIds.add(m.getMember().id); 386 386 } 387 387 } 388 388 for (RelationMember m : lookupRelation(ds, 8).getMembers()) { 389 if (m. member instanceof Way) {390 expectedWayIds.add(m. member.id);389 if (m.isWay()) { 390 expectedWayIds.add(m.getMember().id); 391 391 } 392 392 } 393 393 for (RelationMember m : lookupRelation(ds, 9).getMembers()) { 394 if (m. member instanceof Way) {395 expectedWayIds.add(m. member.id);394 if (m.isWay()) { 395 expectedWayIds.add(m.getMember().id); 396 396 } 397 397 } … … 421 421 if (r == null) return ret; 422 422 for (RelationMember m: r.getMembers()) { 423 if (m. member instanceof Node) {424 ret.add(m. member.id);425 } else if (m. member instanceof Way) {426 ret.addAll(getNodeIdsInWay( (Way)m.member));427 } else if (m. member instanceof Relation) {428 ret.addAll(getNodeIdsInRelation( (Relation)m.member));423 if (m.isNode()) { 424 ret.add(m.getMember().id); 425 } else if (m.isWay()) { 426 ret.addAll(getNodeIdsInWay(m.getWay())); 427 } else if (m.isRelation()) { 428 ret.addAll(getNodeIdsInRelation(m.getRelation())); 429 429 } 430 430 } … … 473 473 Set<Long> expectedWayIds = new HashSet<Long>(); 474 474 for (RelationMember m : lookupRelation(ds, 6).getMembers()) { 475 if (m. member instanceof Way) {476 expectedWayIds.add(m. member.id);475 if (m.isWay()) { 476 expectedWayIds.add(m.getMember().id); 477 477 } 478 478 } 479 479 for (RelationMember m : lookupRelation(ds, 7).getMembers()) { 480 if (m. member instanceof Way) {481 expectedWayIds.add(m. member.id);480 if (m.isWay()) { 481 expectedWayIds.add(m.getMember().id); 482 482 } 483 483 } 484 484 for (RelationMember m : lookupRelation(ds, 8).getMembers()) { 485 if (m. member instanceof Way) {486 expectedWayIds.add(m. member.id);485 if (m.isWay()) { 486 expectedWayIds.add(m.getMember().id); 487 487 } 488 488 } 489 489 for (RelationMember m : lookupRelation(ds, 9).getMembers()) { 490 if (m. member instanceof Way) {491 expectedWayIds.add(m. member.id);490 if (m.isWay()) { 491 expectedWayIds.add(m.getMember().id); 492 492 } 493 493 }
Note:
See TracChangeset
for help on using the changeset viewer.