Changeset 9480 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java
r9372 r9480 376 376 @Override 377 377 protected List<PolygonLevel> compute() { 378 if (to - from < directExecutionTaskSize) {378 if (to - from <= directExecutionTaskSize) { 379 379 return computeDirectly(); 380 380 } else { 381 381 final Collection<ForkJoinTask<List<PolygonLevel>>> tasks = new ArrayList<>(); 382 382 for (int fromIndex = from; fromIndex < to; fromIndex += directExecutionTaskSize) { 383 final List<PolygonLevel> output = new ArrayList<>(); 384 tasks.add(new Worker(input, fromIndex, Math.min(fromIndex + directExecutionTaskSize, to), output, directExecutionTaskSize)); 385 } 386 for (ForkJoinTask<List<PolygonLevel>> task : tasks) { 387 output.addAll(task.join()); 383 tasks.add(new Worker(input, fromIndex, Math.min(fromIndex + directExecutionTaskSize, to), new ArrayList<PolygonLevel>(), directExecutionTaskSize)); 384 } 385 for (ForkJoinTask<List<PolygonLevel>> task : ForkJoinTask.invokeAll(tasks)) { 386 List<PolygonLevel> res = task.join(); 387 if (res == null) { 388 return null; 389 } 390 output.addAll(res); 388 391 } 389 392 return output; -
trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
r9476 r9480 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import static org.junit.Assert.assertNull; 3 5 4 6 import java.io.FileInputStream; … … 42 44 DataSet ds = OsmReader.parseDataSet(Compression.BZIP2.getUncompressedInputStream(is), null); 43 45 for (Relation r : ds.getRelations()) { 44 new MultipolygonBuilder().makeFromWays(r.getMemberPrimitives(Way.class));46 assertNull(new MultipolygonBuilder().makeFromWays(r.getMemberPrimitives(Way.class))); 45 47 } 46 48 }
Note:
See TracChangeset
for help on using the changeset viewer.