Changeset 1925 in josm
- Timestamp:
- 2009-08-08T08:52:03+02:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r1911 r1925 93 93 continue; 94 94 } 95 for (RelationMember rm : r. members) {95 for (RelationMember rm : r.getMembers()) { 96 96 if (rm.member instanceof Way) { 97 97 for(Way w : selectedWays) { … … 228 228 newRel.members.clear(); 229 229 HashSet<String> rolesToReAdd = new HashSet<String>(); 230 for (RelationMember rm : r. members) {230 for (RelationMember rm : r.getMembers()) { 231 231 // Don't copy the member if it to one of our ways, just keep a 232 232 // note to re-add it later on. -
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r1862 r1925 96 96 Relation enew = new Relation(e); 97 97 List<RelationMember> members = new ArrayList<RelationMember>(); 98 for (RelationMember m : e. members) {98 for (RelationMember m : e.getMembers()) { 99 99 if (! map.containsKey(m.member)) { 100 100 m.member.visit(this); -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r1912 r1925 130 130 continue; 131 131 } 132 for (RelationMember rm : r. members) {132 for (RelationMember rm : r.getMembers()) { 133 133 if (rm.member instanceof Node) { 134 134 for (Node n : allNodes) { … … 278 278 newRel.members.clear(); 279 279 HashSet<String> rolesToReAdd = new HashSet<String>(); 280 for (RelationMember rm : r. members) {280 for (RelationMember rm : r.getMembers()) { 281 281 // Don't copy the member if it points to one of our nodes, 282 282 // just keep a note to re-add it later on. -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r1862 r1925 91 91 rnew.id = 0; 92 92 List<RelationMember> members = new ArrayList<RelationMember>(); 93 for (RelationMember m : r. members) {93 for (RelationMember m : r.getMembers()) { 94 94 OsmPrimitive mo = map.get(m.member); 95 95 if(mo != null) /* TODO - This only prevents illegal data, but kills the relation */ -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r1924 r1925 304 304 int i = 0; 305 305 306 for (RelationMember rm : r. members) {306 for (RelationMember rm : r.getMembers()) { 307 307 if (rm.member instanceof Way) { 308 308 if (rm.member == selectedWay) -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r1924 r1925 327 327 newRel = null; 328 328 rolesToReAdd = null; 329 for (RelationMember rm : r. members) {329 for (RelationMember rm : r.getMembers()) { 330 330 if (rm.member instanceof Node) { 331 331 if (rm.member == originalNode) { … … 340 340 } 341 341 if (newRel != null) { 342 for (RelationMember rm : r. members) {342 for (RelationMember rm : r.getMembers()) { 343 343 //if (rm.member != selectedNode) { 344 344 newRel.members.add(rm); -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r1924 r1925 445 445 } 446 446 } else if (osm instanceof Relation) { 447 for (RelationMember member : ((Relation)osm). members) {447 for (RelationMember member : ((Relation)osm).getMembers()) { 448 448 if (member.member != null) { 449 449 isParent |= child.match(member.member); -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r1924 r1925 164 164 PrimitiveNameFormatter formatter = new PrimitiveNameFormatter(); 165 165 String role = new String(); 166 for (RelationMember m : ref. members) {166 for (RelationMember m : ref.getMembers()) { 167 167 if (m.member == osm) { 168 168 role = m.role; -
trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java
r1910 r1925 119 119 } else if (parent instanceof Relation) { 120 120 Relation r = (Relation)parent; 121 for (RelationMember member : r. members) {121 for (RelationMember member : r.getMembers()) { 122 122 if (member.member == child) { 123 123 OsmParentChildPair pair = new OsmParentChildPair(parent, member.member); -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r1862 r1925 117 117 for (Relation relation : Main.main.getCurrentDataSet().relations) { 118 118 int position = 0; 119 for (RelationMember member : relation. members) {119 for (RelationMember member : relation.getMembers()) { 120 120 if (!member.member.hasEqualSemanticAttributes(oldway) 121 121 || member.role.length() == 0) { -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r1910 r1925 401 401 public void unlinkPrimitiveFromRelations(OsmPrimitive primitive) { 402 402 for (Relation relation : relations) { 403 Iterator<RelationMember> it = relation. members.iterator();403 Iterator<RelationMember> it = relation.getMembers().iterator(); 404 404 while(it.hasNext()) { 405 405 RelationMember member = it.next(); … … 442 442 continue; 443 443 } 444 for (RelationMember member: parent. members) {444 for (RelationMember member: parent.getMembers()) { 445 445 if (member.refersTo(child)) { 446 446 parents.add(parent); -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r1762 r1925 4 4 import static org.openstreetmap.josm.tools.I18n.trn; 5 5 6 import java.util.ArrayList; 6 7 import java.util.Arrays; 7 import java.util.ArrayList;8 8 import java.util.Collection; 9 9 import java.util.List; 10 10 11 import org.openstreetmap.josm.Main; 11 12 import org.openstreetmap.josm.data.osm.visitor.Visitor; 12 import org.openstreetmap.josm. Main;13 import org.openstreetmap.josm.tools.CopyList; 13 14 14 15 /** … … 24 25 */ 25 26 public final List<RelationMember> members = new ArrayList<RelationMember>(); 27 28 /** 29 * @return Members of the relation. Changes made in returned list are not mapped 30 * back to the primitive, use setMembers() to modify the members 31 * @since 1925 32 */ 33 public List<RelationMember> getMembers() { 34 return new CopyList<RelationMember>(members.toArray(new RelationMember[members.size()])); 35 } 36 37 /** 38 * 39 * @param members 40 * @since 1925 41 */ 42 public void setMembers(List<RelationMember> members) { 43 this.members.clear(); 44 this.members.addAll(members); 45 } 26 46 27 47 final static String[] defnames = {"name", "ref", "restriction", "note"}; … … 59 79 // we must not add the members themselves, but instead 60 80 // add clones of the members 61 for (RelationMember em : ((Relation)osm). members) {81 for (RelationMember em : ((Relation)osm).getMembers()) { 62 82 members.add(new RelationMember(em)); 63 83 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitor.java
r1523 r1925 5 5 import java.util.HashSet; 6 6 7 import org.openstreetmap.josm.data.osm.Node; 8 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 9 import org.openstreetmap.josm.data.osm.Relation; 8 10 import org.openstreetmap.josm.data.osm.RelationMember; 9 import org.openstreetmap.josm.data.osm.Node;10 import org.openstreetmap.josm.data.osm.OsmPrimitive;11 11 import org.openstreetmap.josm.data.osm.Way; 12 12 … … 43 43 */ 44 44 public void visit(Relation e) { 45 for (RelationMember m : e. members)45 for (RelationMember m : e.getMembers()) 46 46 if (m.member instanceof Node) visit((Node)m.member); 47 47 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r1724 r1925 5 5 import org.openstreetmap.josm.data.Bounds; 6 6 import org.openstreetmap.josm.data.ProjectionBounds; 7 import org.openstreetmap.josm.data.coor.CachedLatLon; 7 8 import org.openstreetmap.josm.data.coor.EastNorth; 8 import org.openstreetmap.josm.data.coor.CachedLatLon;9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 import org.openstreetmap.josm.data.osm.Node; … … 33 33 public void visit(Relation e) { 34 34 // only use direct members 35 for (RelationMember m : e. members) {35 for (RelationMember m : e.getMembers()) { 36 36 if (!(m.member instanceof Relation)) { 37 37 m.member.visit(this); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/CollectBackReferencesVisitor.java
r1862 r1925 73 73 for (Relation r : ds.relations) { 74 74 if (r.incomplete || r.deleted) continue; 75 for (RelationMember m : r. members) {75 for (RelationMember m : r.getMembers()) { 76 76 if (m.member == p) { 77 77 if (!data.contains(r)) { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1899 r1925 485 485 if(selectedCall) 486 486 { 487 for (RelationMember m : r. members)487 for (RelationMember m : r.getMembers()) 488 488 { 489 489 if (m.member != null && !m.member.incomplete && !m.member.deleted … … 507 507 if(r.isSelected()) /* draw ways*/ 508 508 { 509 for (RelationMember m : r. members)509 for (RelationMember m : r.getMembers()) 510 510 { 511 511 if (m.member != null && !m.member.incomplete && !m.member.deleted … … 532 532 533 533 /* find the "from", "via" and "to" elements */ 534 for (RelationMember m : r. members)534 for (RelationMember m : r.getMembers()) 535 535 { 536 536 //if(restrictionDebug) … … 782 782 r.clearErrors(); 783 783 784 for (RelationMember m : r. members)784 for (RelationMember m : r.getMembers()) 785 785 { 786 786 if(m.member == null) -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java
r1910 r1925 91 91 } 92 92 clone.members.clear(); 93 for (RelationMember member: r. members) {93 for (RelationMember member: r.getMembers()) { 94 94 RelationMember cloneMember = new RelationMember(member); 95 95 cloneMember.member = mappedPrimitives.get(member.member); … … 189 189 // 190 190 rememberRelationPartial(r); 191 for (RelationMember member: r. members) {191 for (RelationMember member: r.getMembers()) { 192 192 if (isAlreadyRemembered(member.member)) { 193 193 // referred primitive already remembered -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r1862 r1925 192 192 boolean replacedSomething = false; 193 193 LinkedList<RelationMember> newMembers = new LinkedList<RelationMember>(); 194 for (RelationMember myMember : r. members) {194 for (RelationMember myMember : r.getMembers()) { 195 195 OsmPrimitive mergedMember = merged.get(myMember.member); 196 196 if (mergedMember == null) { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1899 r1925 348 348 g.setColor(col); 349 349 350 for (RelationMember m : r. members) {350 for (RelationMember m : r.getMembers()) { 351 351 if (m.member.incomplete || m.member.deleted) continue; 352 352 -
trunk/src/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModel.java
r1898 r1925 570 570 571 571 HashMap<Long,OsmPrimitive> candidates = new HashMap<Long, OsmPrimitive>(); 572 for (RelationMember m : r. members) {572 for (RelationMember m : r.getMembers()) { 573 573 if (m.member.id > 0 && !candidates.values().contains(m.member)) { 574 574 candidates.put(m.member.id,m.member); -
trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListMergeModel.java
r1655 r1925 15 15 /** 16 16 * The model for merging two lists of relation members 17 * 17 * 18 18 * 19 19 */ … … 63 63 /** 64 64 * populates the model with the relation members in relation my and their 65 * 65 * 66 66 * @param my my relation. Must not be null. 67 67 * @param their their relation. Must not be null. 68 * 68 * 69 69 * @throws IllegalArgumentException if my is null 70 70 * @throws IllegalArgumentException if their is null … … 80 80 getTheirEntries().clear(); 81 81 82 for (RelationMember n : my. members) {82 for (RelationMember n : my.getMembers()) { 83 83 getMyEntries().add(n); 84 84 } 85 for (RelationMember n : their. members) {85 for (RelationMember n : their.getMembers()) { 86 86 getTheirEntries().add(n); 87 87 } … … 108 108 /** 109 109 * Builds the command to resolve conflicts in the node list of a way 110 * 110 * 111 111 * @param my my relation. Must not be null. 112 112 * @param their their relation. Must not be null -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r1898 r1925 190 190 } 191 191 public void visit(Relation e) { 192 for (RelationMember em : e. members) {192 for (RelationMember em : e.getMembers()) { 193 193 em.member.visit(this); 194 194 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1911 r1925 591 591 Relation rel = new Relation(cur); 592 592 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); 593 for (RelationMember rm : cur. members) {593 for (RelationMember rm : cur.getMembers()) { 594 594 for (OsmPrimitive osm : sel) { 595 595 if (rm.member == osm) … … 802 802 for (Relation r : Main.main.getCurrentDataSet().relations) { 803 803 if (!r.deleted && !r.incomplete) { 804 for (RelationMember m : r. members) {804 for (RelationMember m : r.getMembers()) { 805 805 if (newSelection.contains(m.member)) { 806 806 Collection<RelationMember> value = roles.get(r); -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r1916 r1925 270 270 Collection<RelationMember> members = new HashSet<RelationMember>(); 271 271 Collection<OsmPrimitive> selection = Main.map.mapView.getEditLayer().data.getSelected(); 272 for (RelationMember member: r. members) {272 for (RelationMember member: r.getMembers()) { 273 273 if (selection.contains(member.member)) { 274 274 members.add(member); … … 368 368 /** 369 369 * Creates a new relation with a copy of the current editor state 370 * 370 * 371 371 */ 372 372 class DuplicateAction extends AbstractAction implements ListSelectionListener { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r1889 r1925 51 51 * ChildRelationBrowser is a UI component which provides a tree-like view on the hierarchical 52 52 * structure of relations 53 * 53 * 54 54 * 55 55 */ … … 67 67 /** 68 68 * Replies the {@see OsmDataLayer} this editor is related to 69 * 69 * 70 70 * @return the osm data layer 71 71 */ … … 88 88 /** 89 89 * builds the panel with the command buttons 90 * 90 * 91 91 * @return the button panel 92 92 */ … … 114 114 /** 115 115 * constructor 116 * 116 * 117 117 * @param layer the {@see OsmDataLayer} this browser is related to. Must not be null. 118 118 * @exception IllegalArgumentException thrown, if layer is null … … 128 128 /** 129 129 * constructor 130 * 130 * 131 131 * @param layer the {@see OsmDataLayer} this browser is related to. Must not be null. 132 132 * @param root the root relation … … 140 140 /** 141 141 * populates the browser with a relation 142 * 142 * 143 143 * @param r the relation 144 144 */ … … 149 149 /** 150 150 * populates the browser with a list of relation members 151 * 151 * 152 152 * @param members the list of relation members 153 153 */ … … 159 159 /** 160 160 * replies the parent dialog this browser is embedded in 161 * 161 * 162 162 * @return the parent dialog; null, if there is no {@see Dialog} as parent dialog 163 163 */ … … 172 172 /** 173 173 * Action for editing the currently selected relation 174 * 175 * 174 * 175 * 176 176 */ 177 177 class EditAction extends AbstractAction implements TreeSelectionListener { … … 278 278 /** 279 279 * The asynchronous task for downloading relation members. 280 * 281 * 280 * 281 * 282 282 */ 283 283 class DownloadAllChildrenTask extends PleaseWaitRunnable { … … 338 338 * warns the user if a relation couldn't be loaded because it was deleted on 339 339 * the server (the server replied a HTTP code 410) 340 * 340 * 341 341 * @param r the relation 342 342 */ … … 360 360 /** 361 361 * Remembers the child relations to download 362 * 362 * 363 363 * @param parent the parent relation 364 364 */ 365 365 protected void rememberChildRelationsToDownload(Relation parent) { 366 366 downloadedRelationIds.add(parent.id); 367 for (RelationMember member: parent. members) {367 for (RelationMember member: parent.getMembers()) { 368 368 if (member.member instanceof Relation) { 369 369 Relation child = (Relation)member.member; … … 378 378 * Merges the primitives in <code>ds</code> to the dataset of the 379 379 * edit layer 380 * 380 * 381 381 * @param ds the data set 382 382 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r1922 r1925 27 27 import java.util.Iterator; 28 28 import java.util.List; 29 import java.util.Set;30 29 import java.util.logging.Logger; 31 30 32 31 import javax.swing.AbstractAction; 33 32 import javax.swing.BorderFactory; 34 import javax.swing.DefaultListSelectionModel;35 33 import javax.swing.JButton; 36 34 import javax.swing.JComponent; … … 42 40 import javax.swing.JTabbedPane; 43 41 import javax.swing.JTable; 44 import javax.swing.JTextField;45 42 import javax.swing.KeyStroke; 46 43 import javax.swing.SwingUtilities; … … 87 84 /** 88 85 * This dialog is for editing relations. 89 * 86 * 90 87 */ 91 88 public class GenericRelationEditor extends RelationEditor { … … 114 111 * Creates a new relation editor for the given relation. The relation will be saved if the user 115 112 * selects "ok" in the editor. 116 * 113 * 117 114 * If no relation is given, will create an editor for a new relation. 118 * 115 * 119 116 * @param layer the {@see OsmDataLayer} the new or edited relation belongs to 120 117 * @param relation relation to edit, or null to create a new one. … … 206 203 /** 207 204 * builds the panel with the OK and the Cancel button 208 * 205 * 209 206 * @return the panel with the OK and the Cancel button 210 207 */ … … 221 218 /** 222 219 * build the panel with the buttons on the left 223 * 220 * 224 221 * @return 225 222 */ … … 260 257 /** 261 258 * builds the panel with the tag editor 262 * 259 * 263 260 * @return the panel with the tag editor 264 261 */ … … 325 322 /** 326 323 * builds the panel for the relation member editor 327 * 324 * 328 325 * @return the panel for the relation member editor 329 326 */ … … 439 436 /** 440 437 * builds the panel with the table displaying the currently selected primitives 441 * 438 * 442 439 * @return 443 440 */ … … 454 451 /** 455 452 * builds the {@see JSplitPane} which divides the editor in an upper and a lower half 456 * 453 * 457 454 * @return the split panel 458 455 */ … … 475 472 /** 476 473 * build the panel with the buttons on the left 477 * 474 * 478 475 * @return 479 476 */ … … 530 527 /** 531 528 * build the panel with the buttons for adding or removing the current selection 532 * 529 * 533 530 * @return 534 531 */ … … 659 656 * checks whether the current relation has members referring to itself. If so, 660 657 * warns the users and provides an option for removing these members. 661 * 658 * 662 659 */ 663 660 protected void cleanSelfReferences() { … … 1047 1044 * Apply the updates for an existing relation which has not been changed 1048 1045 * outside of the relation editor. 1049 * 1046 * 1050 1047 */ 1051 1048 protected void applyExistingConflictingRelation() { … … 1060 1057 * Apply the updates for an existing relation which has been changed 1061 1058 * outside of the relation editor. 1062 * 1059 * 1063 1060 */ 1064 1061 protected void applyExistingNonConflictingRelation() { … … 1367 1364 /** 1368 1365 * Creates a new relation with a copy of the current editor state 1369 * 1366 * 1370 1367 */ 1371 1368 class DuplicateRelationAction extends AbstractAction { … … 1389 1386 /** 1390 1387 * Action for editing the currently selected relation 1391 * 1392 * 1388 * 1389 * 1393 1390 */ 1394 1391 class EditAction extends AbstractAction implements ListSelectionListener { … … 1408 1405 Collection<RelationMember> members = new HashSet<RelationMember>(); 1409 1406 Collection<OsmPrimitive> selection = getLayer().data.getSelected(); 1410 for (RelationMember member: r. members) {1407 for (RelationMember member: r.getMembers()) { 1411 1408 if (selection.contains(member.member)) { 1412 1409 members.add(member); … … 1485 1482 /** 1486 1483 * The asynchronous task for downloading relation members. 1487 * 1484 * 1488 1485 */ 1489 1486 class DownloadTask extends PleaseWaitRunnable { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r1922 r1925 69 69 public void populate(Relation relation) { 70 70 members.clear(); 71 if (relation != null && relation.members != null) {71 if (relation != null) { 72 72 // make sure we work with clones of the relation members 73 73 // in the model. 74 members.addAll(new Relation(relation). members);74 members.addAll(new Relation(relation).getMembers()); 75 75 } 76 76 fireTableDataChanged(); … … 328 328 /** 329 329 * Replies the number of members which refer to a particular primitive 330 * 330 * 331 331 * @param primitive the primitive 332 332 * @return the number of members which refer to a particular primitive … … 344 344 /** 345 345 * updates the role of the members given by the indices in <code>idx</code> 346 * 346 * 347 347 * @param idx the array of indices 348 348 * @param role the new role … … 362 362 /** 363 363 * Get the currently selected relation members 364 * 364 * 365 365 * @return a collection with the currently selected relation members 366 366 */ … … 375 375 /** 376 376 * Replies the set of selected referers. Never null, but may be empty. 377 * 377 * 378 378 * @return the set of selected referers 379 379 */ … … 389 389 * Replies true, if the selected {@see OsmPrimitive}s in the layer belonging 390 390 * to this model are in sync with the selected referers in this model. 391 * 391 * 392 392 * @return 393 393 */ … … 400 400 /** 401 401 * Selects the members in the collection selectedMembers 402 * 402 * 403 403 * @param selectedMembers the collection of selected members 404 404 */ … … 441 441 * to an editable relation, i.e. a relation which is not 442 442 * incomplete. 443 * 443 * 444 444 * @param index the index 445 445 * @return true, if the index-th relation members referrs … … 460 460 * Replies true if there is at least one relation member in this model 461 461 * which refers to at least on the primitives in <code>primitives</code>. 462 * 462 * 463 463 * @param primitives the collection of primitives 464 464 * @return true if there is at least one relation member in this model … … 485 485 * Selects all mebers which refer to {@see OsmPrimitive}s in the collections 486 486 * <code>primitmives</code>. Does nothing is primitives is null. 487 * 487 * 488 488 * @param primitives the collection of primitives 489 489 */ … … 507 507 * Replies true if the layer this model belongs to is equal to the active 508 508 * layer 509 * 509 * 510 510 * @return true if the layer this model belongs to is equal to the active 511 511 * layer -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java
r1856 r1925 47 47 protected boolean isReferringRelation(Relation parent) { 48 48 if (parent == null) return false; 49 for (RelationMember m: parent. members) {49 for (RelationMember m: parent.getMembers()) { 50 50 if (m.member instanceof Relation) { 51 51 Relation child = (Relation)m.member; … … 70 70 /** 71 71 * Populates the browser with the list of referring relations in the {@see DataSet} ds. 72 * 72 * 73 73 * @param ds the data set 74 74 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTreeModel.java
r1848 r1925 17 17 * This is a {@see TreeModel} which provides the hierarchical structure of {@see Relation}s 18 18 * to a {@see JTree}. 19 * 19 * 20 20 * The model is initialized with a root relation or with a list of {@see RelationMember}s, see 21 21 * {@see #populate(Relation)} and {@see #populate(List)} respectively. 22 * 22 * 23 23 * 24 24 */ … … 51 51 /** 52 52 * constructor 53 * 53 * 54 54 * @param members a list of members 55 55 */ … … 65 65 * Replies the number of children of type relation for a particular 66 66 * relation <code>parent</code> 67 * 67 * 68 68 * @param parent the parent relation 69 69 * @return the number of children of type relation … … 71 71 protected int getNumRelationChildren(Relation parent) { 72 72 if (parent == null) return 0; 73 if (parent.members == null) return 0;74 73 int count = 0; 75 for(RelationMember member : parent. members) {74 for(RelationMember member : parent.getMembers()) { 76 75 if (member.member instanceof Relation) { 77 76 count++; … … 84 83 * Replies the i-th child of type relation for a particular relation 85 84 * <code>parent</code>. 86 * 85 * 87 86 * @param parent the parent relation 88 87 * @param idx the index … … 93 92 if (parent == null) return null; 94 93 int count=0; 95 for (RelationMember member : parent. members) {94 for (RelationMember member : parent.getMembers()) { 96 95 if (!(member.member instanceof Relation)) { 97 96 continue; … … 107 106 * Replies the index of a particular <code>child</code> with respect to its 108 107 * <code>parent</code>. 109 * 108 * 110 109 * @param parent the parent relation 111 110 * @param child the child relation … … 113 112 * <code>parent</code>; -1 if either parent or child are null or if <code>child</code> 114 113 * isn't a child of <code>parent</code>. 115 * 114 * 116 115 */ 117 116 protected int getIndexForRelationChild(Relation parent, Relation child) { 118 117 if (parent == null || child == null) return -1; 119 118 int idx = 0; 120 for (RelationMember member : parent. members) {119 for (RelationMember member : parent.getMembers()) { 121 120 if (!(member.member instanceof Relation)) { 122 121 continue; … … 130 129 /** 131 130 * Populates the model with a root relation 132 * 131 * 133 132 * @param root the root relation 134 133 * @see #populate(List) 135 * 134 * 136 135 */ 137 136 public void populate(Relation root) { … … 145 144 /** 146 145 * Populates the model with a list of relation members 147 * 146 * 148 147 * @param members the relation members 149 148 */ … … 170 169 * Notifies tree model listeners about an update of the 171 170 * trees nodes. 172 * 171 * 173 172 * @param path the tree path to the node 174 173 */ … … 183 182 /** 184 183 * Invoke to notify all listeners about an update of a particular node 185 * 184 * 186 185 * @param pathToNode the tree path to the node 187 186 */ -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ac/AutoCompletionCache.java
r1916 r1925 18 18 * AutoCompletionCache temporarily holds a cache of keys with a list of 19 19 * possible auto completion values for each key. 20 * 20 * 21 21 * The cache can initialize itself from the current JOSM data set such that 22 22 * <ol> … … 25 25 * this key</li> 26 26 * </ol> 27 * 27 * 28 28 * Building up auto completion lists should not 29 29 * slow down tabbing from input field to input field. Looping through the complete … … 87 87 /** 88 88 * make sure, <code>key</code> is in the cache 89 * 89 * 90 90 * @param key the key 91 91 */ … … 100 100 /** 101 101 * make sure, value is one of the auto completion values allowed for key 102 * 102 * 103 103 * @param key the key 104 104 * @param value the value … … 115 115 * make sure, the keys and values of all tags held by primitive are 116 116 * in the auto completion cache 117 * 117 * 118 118 * @param primitive an OSM primitive 119 119 */ … … 127 127 /** 128 128 * Caches all member roles of the relation <code>relation</code> 129 * 129 * 130 130 * @param relation the relation 131 131 */ 132 132 protected void cacheRelationMemberRoles(Relation relation){ 133 for (RelationMember m: relation. members) {133 for (RelationMember m: relation.getMembers()) { 134 134 if (m.role == null || m.role.trim().equals("")) { 135 135 continue; … … 144 144 * initializes the cache from the primitives in the dataset of 145 145 * {@see #layer} 146 * 146 * 147 147 */ 148 148 public void initFromJOSMDataset() { … … 165 165 /** 166 166 * replies the keys held by the cache 167 * 167 * 168 168 * @return the list of keys held by the cache 169 169 */ … … 175 175 * replies the auto completion values allowed for a specific key. Replies 176 176 * an empty list if key is null or if key is not in {@link #getKeys()}. 177 * 177 * 178 178 * @param key 179 179 * @return the list of auto completion values … … 187 187 /** 188 188 * Replies the list of member roles 189 * 189 * 190 190 * @return the list of member roles 191 191 */ … … 197 197 * Populates the an {@see AutoCompletionList} with the currently cached 198 198 * member roles. 199 * 199 * 200 200 * @param list the list to populate 201 201 */ -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r1898 r1925 203 203 if (relation.id == 0) return this; 204 204 remember(relation.id, OsmPrimitiveType.RELATION); 205 for (RelationMember member : relation. members) {205 for (RelationMember member : relation.getMembers()) { 206 206 appendGeneric(member.member); 207 207 } -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r1898 r1925 131 131 } else { 132 132 out.println(">"); 133 for (RelationMember em : e. members) {133 for (RelationMember em : e.getMembers()) { 134 134 out.print(" <member type='"); 135 135 out.print(OsmPrimitiveType.from(em.member).getAPIName()); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r1910 r1925 381 381 // 382 382 Set<Long> expectedWayIds = new HashSet<Long>(); 383 for (RelationMember m : lookupRelation(ds, 6). members) {384 if (m.member instanceof Way) { 385 expectedWayIds.add(m.member.id); 386 } 387 } 388 for (RelationMember m : lookupRelation(ds, 7). members) {389 if (m.member instanceof Way) { 390 expectedWayIds.add(m.member.id); 391 } 392 } 393 for (RelationMember m : lookupRelation(ds, 8). members) {394 if (m.member instanceof Way) { 395 expectedWayIds.add(m.member.id); 396 } 397 } 398 for (RelationMember m : lookupRelation(ds, 9). members) {383 for (RelationMember m : lookupRelation(ds, 6).getMembers()) { 384 if (m.member instanceof Way) { 385 expectedWayIds.add(m.member.id); 386 } 387 } 388 for (RelationMember m : lookupRelation(ds, 7).getMembers()) { 389 if (m.member instanceof Way) { 390 expectedWayIds.add(m.member.id); 391 } 392 } 393 for (RelationMember m : lookupRelation(ds, 8).getMembers()) { 394 if (m.member instanceof Way) { 395 expectedWayIds.add(m.member.id); 396 } 397 } 398 for (RelationMember m : lookupRelation(ds, 9).getMembers()) { 399 399 if (m.member instanceof Way) { 400 400 expectedWayIds.add(m.member.id); … … 425 425 HashSet<Long> ret = new HashSet<Long>(); 426 426 if (r == null) return ret; 427 for (RelationMember m: r. members) {427 for (RelationMember m: r.getMembers()) { 428 428 if (m.member instanceof Node) { 429 429 ret.add(m.member.id); … … 477 477 // 478 478 Set<Long> expectedWayIds = new HashSet<Long>(); 479 for (RelationMember m : lookupRelation(ds, 6). members) {480 if (m.member instanceof Way) { 481 expectedWayIds.add(m.member.id); 482 } 483 } 484 for (RelationMember m : lookupRelation(ds, 7). members) {485 if (m.member instanceof Way) { 486 expectedWayIds.add(m.member.id); 487 } 488 } 489 for (RelationMember m : lookupRelation(ds, 8). members) {490 if (m.member instanceof Way) { 491 expectedWayIds.add(m.member.id); 492 } 493 } 494 for (RelationMember m : lookupRelation(ds, 9). members) {479 for (RelationMember m : lookupRelation(ds, 6).getMembers()) { 480 if (m.member instanceof Way) { 481 expectedWayIds.add(m.member.id); 482 } 483 } 484 for (RelationMember m : lookupRelation(ds, 7).getMembers()) { 485 if (m.member instanceof Way) { 486 expectedWayIds.add(m.member.id); 487 } 488 } 489 for (RelationMember m : lookupRelation(ds, 8).getMembers()) { 490 if (m.member instanceof Way) { 491 expectedWayIds.add(m.member.id); 492 } 493 } 494 for (RelationMember m : lookupRelation(ds, 9).getMembers()) { 495 495 if (m.member instanceof Way) { 496 496 expectedWayIds.add(m.member.id);
Note:
See TracChangeset
for help on using the changeset viewer.