Changeset 2077 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2009-09-07T23:06:19+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r2070 r2077 110 110 * id=<code>id</code> 111 111 */ 112 protected void remember(DataSet ds, long id ) throws IllegalArgumentException, NoSuchElementException{112 protected void remember(DataSet ds, long id, OsmPrimitiveType type) throws IllegalArgumentException, NoSuchElementException{ 113 113 if (ds == null) 114 114 throw new IllegalArgumentException(tr("parameter ''{0}'' must not be null", "ds")); 115 115 if (id <= 0) return; 116 OsmPrimitive primitive = ds.getPrimitiveById(id );116 OsmPrimitive primitive = ds.getPrimitiveById(id, type); 117 117 if (primitive == null) 118 118 throw new NoSuchElementException(tr("no primitive with id {0} in local dataset. Can't infer primitive type", id)); … … 122 122 123 123 /** 124 * appends a list of ids to the list of ids which will be fetched from the server. ds must 125 * include an {@see OsmPrimitive} for each id in ids. 126 * 127 * id is ignored if id <= 0. 128 * 129 * @param ds the dataset 130 * @param ids the list of ids 124 * appends a {@see Node}s id to the list of ids which will be fetched from the server. 125 * 126 * @param node the node (ignored, if null) 131 127 * @return this 132 128 * 133 129 */ 134 public MultiFetchServerObjectReader append(DataSet ds, long ... ids) { 135 if (ids == null) return this; 136 for (int i=0; i < ids.length; i++) { 137 remember(ds, ids[i]); 138 } 139 return this; 140 } 141 142 /** 143 * appends a collection of ids to the list of ids which will be fetched from the server. ds must 144 * include an {@see OsmPrimitive} for each id in ids. 145 * 146 * id is ignored if id <= 0. 147 * 148 * @param ds the dataset 149 * @param ids the collection of ids 150 * @return this 151 * 152 */ 153 public MultiFetchServerObjectReader append(DataSet ds, Collection<Long> ids) { 154 if (ids == null) return null; 155 for (long id: ids) { 156 append(ds,id); 130 public MultiFetchServerObjectReader append(DataSet ds, long id, OsmPrimitiveType type) { 131 switch(type) { 132 case NODE: 133 Node n = (Node)ds.getPrimitiveById(id,type); 134 append(n); 135 break; 136 case WAY: 137 Way w= (Way)ds.getPrimitiveById(id,type); 138 append(w); 139 break; 140 case RELATION: 141 Relation r = (Relation)ds.getPrimitiveById(id,type); 142 append(r); 143 break; 157 144 } 158 145 return this; … … 376 363 String msg = ""; 377 364 switch(type) { 378 379 380 365 case NODE: msg = tr("Fetching node with id {0} from ''{1}''", id, OsmApi.getOsmApi().getBaseUrl()); break; 366 case WAY: msg = tr("Fetching way with id {0} from ''{1}''", id, OsmApi.getOsmApi().getBaseUrl()); break; 367 case RELATION: msg = tr("Fetching relation with id {0} from ''{1}''", id, OsmApi.getOsmApi().getBaseUrl()); break; 381 368 } 382 369 progressMonitor.setCustomText(msg); … … 414 401 String msg = ""; 415 402 switch(type) { 416 417 418 403 case NODE: msg = tr("Fetching a package of nodes from ''{0}''", OsmApi.getOsmApi().getBaseUrl()); break; 404 case WAY: msg = tr("Fetching a package of ways from ''{0}''", OsmApi.getOsmApi().getBaseUrl()); break; 405 case RELATION: msg = tr("Fetching a package of relations from ''{0}''", OsmApi.getOsmApi().getBaseUrl()); break; 419 406 } 420 407 progressMonitor.setCustomText(msg);
Note:
See TracChangeset
for help on using the changeset viewer.