- Timestamp:
- 2020-02-12T07:15:15+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
r15811 r15846 56 56 getProgressMonitor().indeterminateSubTask(tr("Initializing nodes to download ...")); 57 57 reader.setRecurseDownRelations(fullRelation); 58 reader.appendIds(ids); 58 if (ids != null) { 59 ids.forEach(reader::append); 60 } 59 61 } 60 62 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r15811 r15846 52 52 * <pre> 53 53 * MultiFetchServerObjectReader reader = MultiFetchServerObjectReader() 54 * .append(2345,2334,4444)55 54 * .append(new Node(72343)); 56 55 * reader.parseOsm(); … … 132 131 * @param id the id 133 132 */ 134 p rotected void remember(PrimitiveId id) {133 public void append(PrimitiveId id) { 135 134 if (id.isNew()) return; 136 135 switch(id.getType()) { … … 153 152 public MultiFetchServerObjectReader append(DataSet ds, long id, OsmPrimitiveType type) { 154 153 OsmPrimitive p = ds.getPrimitiveById(id, type); 155 switch(type) { 156 case NODE: 157 return appendNode((Node) p); 158 case WAY: 159 return appendWay((Way) p); 160 case RELATION: 161 return appendRelation((Relation) p); 162 default: 163 return this; 164 } 154 return append(p); 165 155 } 166 156 … … 173 163 public MultiFetchServerObjectReader appendNode(Node node) { 174 164 if (node == null || node.isNew()) return this; 175 remember(node.getPrimitiveId());165 append(node.getPrimitiveId()); 176 166 return this; 177 167 } … … 186 176 if (way == null || way.isNew()) return this; 187 177 if (recurseDownAppended) { 188 for (Node node : way.getNodes()) { 189 if (!node.isNew()) { 190 remember(node.getPrimitiveId()); 191 } 192 } 193 } 194 remember(way.getPrimitiveId()); 178 append(way.getNodes()); 179 } 180 append(way.getPrimitiveId()); 195 181 return this; 196 182 } … … 204 190 protected MultiFetchServerObjectReader appendRelation(Relation relation) { 205 191 if (relation == null || relation.isNew()) return this; 206 remember(relation.getPrimitiveId());192 append(relation.getPrimitiveId()); 207 193 if (recurseDownAppended) { 208 194 for (RelationMember member : relation.getMembers()) { … … 246 232 public MultiFetchServerObjectReader append(Collection<? extends OsmPrimitive> primitives) { 247 233 if (primitives == null) return this; 248 for (OsmPrimitive primitive : primitives) { 249 append(primitive); 250 } 251 return this; 252 } 253 254 /** 255 * appends a list of {@link PrimitiveId} to the list of ids which will be fetched from the server. 256 * 257 * @param ids the list of primitive Ids (ignored, if null) 258 * @return this 259 * @since 15811 260 * 261 */ 262 public MultiFetchServerObjectReader appendIds(Collection<PrimitiveId> ids) { 263 if (ids == null) 264 return this; 265 for (PrimitiveId id : ids) { 266 if (id.isNew()) continue; 267 switch (id.getType()) { 268 case NODE: 269 nodes.add(id.getUniqueId()); 270 break; 271 case WAY: 272 case CLOSEDWAY: 273 ways.add(id.getUniqueId()); 274 break; 275 case MULTIPOLYGON: 276 case RELATION: 277 relations.add(id.getUniqueId()); 278 break; 279 default: 280 throw new AssertionError(); 281 } 282 } 234 primitives.forEach(this::append); 283 235 return this; 284 236 }
Note:
See TracChangeset
for help on using the changeset viewer.