- Timestamp:
- 2009-08-08T11:32:27+02:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r1925 r1928 319 319 for(Way wayToAdd : newWays) 320 320 { 321 RelationMember em = new RelationMember(); 322 em.member = wayToAdd; 323 em.role = rm.role; 321 RelationMember em = new RelationMember(rm.role, wayToAdd); 324 322 if(em.role != null && em.role.length() > 0 && !("multipolygon".equals(type))) { 325 323 warnmerole = true; -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r1856 r1928 15 15 /** 16 16 * Default constructor. Does nothing. 17 * @deprecated Use other constructors because RelationMember class will became immutable 18 * in the future 17 19 */ 20 @Deprecated 18 21 public RelationMember() { } 19 22 … … 38 41 /** 39 42 * Replies true, if this relation member refers to the primitive 40 * 43 * 41 44 * @param primitive the primitive to check 42 45 * @return true, if this relation member refers to the primitive -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListMergeModel.java
r1925 r1928 100 100 @Override 101 101 protected RelationMember cloneEntryForMergedList(RelationMember entry) { 102 RelationMember member = new RelationMember(); 103 member.role = entry.role; 104 member.member = entry.member; 105 return member; 102 return new RelationMember(entry.role, entry.member); 106 103 } 107 104 -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1925 r1928 595 595 if (rm.member == osm) 596 596 { 597 RelationMember mem = new RelationMember(); 598 mem.role = rm.role; 599 mem.member = rm.member; 597 RelationMember mem = new RelationMember(rm.role, rm.member); 600 598 rel.members.remove(mem); 601 599 break; -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r1924 r1928 122 122 public String type; 123 123 public long id; 124 public RelationMember relationMember;124 public String role; 125 125 } 126 126 … … 204 204 throw new SAXException(tr("Found <member> element in non-relation.")); 205 205 RelationMemberData emd = new RelationMemberData(); 206 emd.relationMember = new RelationMember();207 206 String value = atts.getValue("ref"); 208 207 if (value == null) … … 220 219 emd.type= value; 221 220 value = atts.getValue("role"); 222 emd.r elationMember.role = value;221 emd.role = value; 223 222 224 223 if (emd.id == 0) … … 393 392 * and populate them later. 394 393 */ 395 private void createRelations() {394 private void createRelations() throws SAXException { 396 395 397 396 // pass 1 - create all relations … … 414 413 415 414 for (RelationMemberData emd : e.getValue()) { 416 RelationMember em = emd.relationMember;415 OsmPrimitive member; 417 416 if (emd.type.equals("node")) { 418 em.member = findNode(emd.id);419 if ( em.member == null) {420 em.member = new Node(emd.id);421 ds.addPrimitive( em.member);417 member = findNode(emd.id); 418 if (member == null) { 419 member = new Node(emd.id); 420 ds.addPrimitive(member); 422 421 } 423 422 } else if (emd.type.equals("way")) { 424 em.member = hm.get(emd.id);425 if ( em.member == null) {426 em.member = findWay(emd.id);427 } 428 if ( em.member == null) {429 em.member = new Way(emd.id);430 ds.addPrimitive( em.member);423 member = hm.get(emd.id); 424 if (member == null) { 425 member = findWay(emd.id); 426 } 427 if (member == null) { 428 member = new Way(emd.id); 429 ds.addPrimitive(member); 431 430 } 432 431 } else if (emd.type.equals("relation")) { 433 em.member = findRelation(emd.id);434 if ( em.member == null) {435 em.member = new Relation(emd.id);436 ds.addPrimitive( em.member);432 member = findRelation(emd.id); 433 if (member == null) { 434 member = new Relation(emd.id); 435 ds.addPrimitive(member); 437 436 } 438 437 } else { 439 // this is an error.438 throw new SAXException(tr("Unknown relation member type {0}", emd.type)); 440 439 } 441 en.members.add( em);440 en.members.add(new RelationMember(emd.role, member)); 442 441 } 443 442 } -
trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
r1910 r1928 95 95 int idx = (start + j) % 500; 96 96 Node n = nodes.get(idx); 97 RelationMember member = new RelationMember(); 98 member.member = n; 99 member.role = "role-" + j; 100 r.members.add(member); 97 r.members.add(new RelationMember("role-" + j, n)); 101 98 } 102 99 int numWaysInRelation = (int)Math.round(Math.random() * 10); … … 105 102 int idx = (start + j) % 500; 106 103 Way w = ways.get(idx); 107 RelationMember member = new RelationMember(); 108 member.member = w; 109 member.role = "role-" + j; 110 r.members.add(member); 104 r.members.add(new RelationMember("role-" + j, w)); 111 105 } 112 106 ds.addPrimitive(r); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r1925 r1928 87 87 r.put("name", "relation-" +i); 88 88 for (int j =0; j < 10; j++) { 89 RelationMember member = new RelationMember(); 90 member.role = "node-" + j; 91 member.member = lookupNode(ds, i + j); 89 RelationMember member = new RelationMember("node-" + j, lookupNode(ds, i + j)); 90 r.members.add(member); 92 91 } 93 92 for (int j =0; j < 5; j++) { 94 RelationMember member = new RelationMember(); 95 member.role = "way-" + j; 96 member.member = lookupWay(ds, i + j); 93 RelationMember member = new RelationMember("way-" + j, lookupWay(ds, i + j)); 97 94 r.members.add(member); 98 95 } 99 96 if (i > 5) { 100 97 for (int j =0; j < 3; j++) { 101 RelationMember member = new RelationMember(); 102 member.role = "relation-" + j; 103 member.member = lookupRelation(ds, j); 98 RelationMember member = new RelationMember("relation-" + j, lookupRelation(ds, j)); 104 99 logger.info(MessageFormat.format("adding relation {0} to relation {1}", j, i)); 105 100 r.members.add(member);
Note:
See TracChangeset
for help on using the changeset viewer.