diff --git a/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java b/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
index 8dc358470..6f163de4a 100644
|
a
|
b
|
public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId> ids, boolean
|
| 55 | 55 | protected void initMultiFetchReader(MultiFetchServerObjectReader reader) { |
| 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 | } |
diff --git a/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java b/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
index 23ec25627..efc0e53d4 100644
|
a
|
b
|
public static MultiFetchServerObjectReader create(final boolean fromMirror) {
|
| 131 | 131 | * |
| 132 | 132 | * @param id the id |
| 133 | 133 | */ |
| 134 | | protected void remember(PrimitiveId id) { |
| | 134 | public void append(PrimitiveId id) { |
| 135 | 135 | if (id.isNew()) return; |
| 136 | 136 | switch(id.getType()) { |
| 137 | 137 | case NODE: nodes.add(id.getUniqueId()); break; |
| … |
… |
protected void remember(PrimitiveId id) {
|
| 152 | 152 | */ |
| 153 | 153 | public MultiFetchServerObjectReader append(DataSet ds, long id, OsmPrimitiveType type) { |
| 154 | 154 | 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 | | } |
| | 155 | return append(p); |
| 165 | 156 | } |
| 166 | 157 | |
| 167 | 158 | /** |
| … |
… |
public MultiFetchServerObjectReader append(DataSet ds, long id, OsmPrimitiveType
|
| 172 | 163 | */ |
| 173 | 164 | public MultiFetchServerObjectReader appendNode(Node node) { |
| 174 | 165 | if (node == null || node.isNew()) return this; |
| 175 | | remember(node.getPrimitiveId()); |
| | 166 | append(node.getPrimitiveId()); |
| 176 | 167 | return this; |
| 177 | 168 | } |
| 178 | 169 | |
| … |
… |
public MultiFetchServerObjectReader appendNode(Node node) {
|
| 185 | 176 | public MultiFetchServerObjectReader appendWay(Way way) { |
| 186 | 177 | if (way == null || way.isNew()) return this; |
| 187 | 178 | if (recurseDownAppended) { |
| 188 | | for (Node node : way.getNodes()) { |
| 189 | | if (!node.isNew()) { |
| 190 | | remember(node.getPrimitiveId()); |
| 191 | | } |
| 192 | | } |
| | 179 | append(way.getNodes()); |
| 193 | 180 | } |
| 194 | | remember(way.getPrimitiveId()); |
| | 181 | append(way.getPrimitiveId()); |
| 195 | 182 | return this; |
| 196 | 183 | } |
| 197 | 184 | |
| … |
… |
public MultiFetchServerObjectReader appendWay(Way way) {
|
| 203 | 190 | */ |
| 204 | 191 | protected MultiFetchServerObjectReader appendRelation(Relation relation) { |
| 205 | 192 | if (relation == null || relation.isNew()) return this; |
| 206 | | remember(relation.getPrimitiveId()); |
| | 193 | append(relation.getPrimitiveId()); |
| 207 | 194 | if (recurseDownAppended) { |
| 208 | 195 | for (RelationMember member : relation.getMembers()) { |
| 209 | 196 | // avoid infinite recursion in case of cyclic dependencies in relations |
| … |
… |
public MultiFetchServerObjectReader append(OsmPrimitive primitive) {
|
| 245 | 232 | */ |
| 246 | 233 | public MultiFetchServerObjectReader append(Collection<? extends OsmPrimitive> primitives) { |
| 247 | 234 | 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 | | } |
| | 235 | primitives.forEach(this::append); |
| 283 | 236 | return this; |
| 284 | 237 | } |
| 285 | 238 | |