Changeset 11351 in josm for trunk


Ignore:
Timestamp:
2016-11-30T13:19:01+01:00 (3 years ago)
Author:
Don-vip
Message:

findbugs - SE_BAD_FIELD_INNER_CLASS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r11294 r11351  
    17951795    }
    17961796
    1797     private class ComputeStyleListWorker extends RecursiveTask<List<StyleRecord>> implements Visitor {
     1797    private static class ComputeStyleListWorker extends RecursiveTask<List<StyleRecord>> implements Visitor {
    17981798        private final transient List<? extends OsmPrimitive> input;
    17991799        private final transient List<StyleRecord> output;
     
    18011801        private final transient ElemStyles styles = MapPaintStyles.getStyles();
    18021802        private final int directExecutionTaskSize;
    1803 
    1804         private final boolean drawArea = circum <= Main.pref.getInteger("mappaint.fillareas", 10_000_000);
    1805         private final boolean drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true);
    1806         private final boolean drawRestriction = Main.pref.getBoolean("mappaint.restriction", true);
     1803        private final double circum;
     1804        private final NavigatableComponent nc;
     1805
     1806        private final boolean drawArea;
     1807        private final boolean drawMultipolygon;
     1808        private final boolean drawRestriction;
    18071809
    18081810        /**
    18091811         * Constructs a new {@code ComputeStyleListWorker}.
     1812         * @param circum distance on the map in meters that 100 screen pixels represent
     1813         * @param nc navigatable component
    18101814         * @param input the primitives to process
    18111815         * @param output the list of styles to which styles will be added
    18121816         * @param directExecutionTaskSize the threshold deciding whether to subdivide the tasks
    18131817         */
    1814         ComputeStyleListWorker(final List<? extends OsmPrimitive> input, List<StyleRecord> output, int directExecutionTaskSize) {
     1818        ComputeStyleListWorker(double circum, NavigatableComponent nc,
     1819                final List<? extends OsmPrimitive> input, List<StyleRecord> output, int directExecutionTaskSize) {
     1820            this.circum = circum;
     1821            this.nc = nc;
    18151822            this.input = input;
    18161823            this.output = output;
    18171824            this.directExecutionTaskSize = directExecutionTaskSize;
     1825            this.drawArea = circum <= Main.pref.getInteger("mappaint.fillareas", 10_000_000);
     1826            this.drawMultipolygon = drawArea && Main.pref.getBoolean("mappaint.multipolygon", true);
     1827            this.drawRestriction = Main.pref.getBoolean("mappaint.restriction", true);
    18181828            this.styles.setDrawMultipolygon(drawMultipolygon);
    18191829        }
     
    18281838                    final int toIndex = Math.min(fromIndex + directExecutionTaskSize, input.size());
    18291839                    final List<StyleRecord> output = new ArrayList<>(directExecutionTaskSize);
    1830                     tasks.add(new ComputeStyleListWorker(input.subList(fromIndex, toIndex), output, directExecutionTaskSize).fork());
     1840                    tasks.add(new ComputeStyleListWorker(circum, nc, input.subList(fromIndex, toIndex), output, directExecutionTaskSize).fork());
    18311841                }
    18321842                for (ForkJoinTask<List<StyleRecord>> task : tasks) {
     
    19381948
    19391949            // Need to process all relations first.
    1940             // Reason: Make sure, ElemStyles.getStyleCacheWithRange is
    1941             // not called for the same primitive in parallel threads.
    1942             // (Could be synchronized, but try to avoid this for
    1943             // performance reasons.)
    1944             THREAD_POOL.invoke(new ComputeStyleListWorker(relations, allStyleElems,
     1950            // Reason: Make sure, ElemStyles.getStyleCacheWithRange is not called for the same primitive in parallel threads.
     1951            // (Could be synchronized, but try to avoid this for performance reasons.)
     1952            THREAD_POOL.invoke(new ComputeStyleListWorker(circum, nc, relations, allStyleElems,
    19451953                    Math.max(20, relations.size() / THREAD_POOL.getParallelism() / 3)));
    1946             THREAD_POOL.invoke(new ComputeStyleListWorker(new CompositeList<>(nodes, ways), allStyleElems,
     1954            THREAD_POOL.invoke(new ComputeStyleListWorker(circum, nc, new CompositeList<>(nodes, ways), allStyleElems,
    19471955                    Math.max(100, (nodes.size() + ways.size()) / THREAD_POOL.getParallelism() / 3)));
    19481956
Note: See TracChangeset for help on using the changeset viewer.