Changeset 11852 in josm


Ignore:
Timestamp:
2017-04-08T01:08:59+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S1444 - "public static" fields should be constant

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r11746 r11852  
    7575    }
    7676
    77     public static volatile ValidatorLayer errorLayer;
     77    private static volatile ValidatorLayer errorLayer;
    7878
    7979    /** The validate action */
     
    8181
    8282    /** Grid detail, multiplier of east,north values for valuable cell sizing */
    83     public static double griddetail;
     83    private static double griddetail;
    8484
    8585    private static final Collection<String> ignoredErrors = new TreeSet<>();
     
    215215    }
    216216
     217    /**
     218     * Initializes error layer.
     219     */
    217220    public static synchronized void initializeErrorLayer() {
    218221        if (!ValidatorPreference.PREF_LAYER.get())
     
    222225            Main.getLayerManager().addLayer(errorLayer);
    223226        }
     227    }
     228
     229    /**
     230     * Resets error layer.
     231     * @since 11852
     232     */
     233    public static synchronized void resetErrorLayer() {
     234        errorLayer = null;
    224235    }
    225236
     
    303314            OsmValidator.griddetail = 1.0;
    304315        }
     316    }
     317
     318    /**
     319     * Returns grid detail, multiplier of east,north values for valuable cell sizing
     320     * @return grid detail
     321     * @since 11852
     322     */
     323    public static double getGridDetail() {
     324        return griddetail;
    305325    }
    306326
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r11608 r11852  
    323323
    324324        List<List<WaySegment>> cells = new ArrayList<>();
    325         for (Point2D cell : ValUtil.getSegmentCells(n1, n2, OsmValidator.griddetail)) {
     325        for (Point2D cell : ValUtil.getSegmentCells(n1, n2, OsmValidator.getGridDetail())) {
    326326            List<WaySegment> segments = cellSegments.get(cell);
    327327            if (segments == null) {
  • trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java

    r10378 r11852  
    4343        Set<Point2D> cellNodes = new HashSet<>();
    4444        Point2D cell;
     45        double griddetail = OsmValidator.getGridDetail();
    4546
    4647        // First, round coordinates
    4748        // CHECKSTYLE.OFF: SingleSpaceSeparator
    48         long x0 = Math.round(n1.getEastNorth().east()  * OsmValidator.griddetail);
    49         long y0 = Math.round(n1.getEastNorth().north() * OsmValidator.griddetail);
    50         long x1 = Math.round(n2.getEastNorth().east()  * OsmValidator.griddetail);
    51         long y1 = Math.round(n2.getEastNorth().north() * OsmValidator.griddetail);
     49        long x0 = Math.round(n1.getEastNorth().east()  * griddetail);
     50        long y0 = Math.round(n1.getEastNorth().north() * griddetail);
     51        long x1 = Math.round(n2.getEastNorth().east()  * griddetail);
     52        long y1 = Math.round(n2.getEastNorth().north() * griddetail);
    5253        // CHECKSTYLE.ON: SingleSpaceSeparator
    5354
     
    7677        // Then floor coordinates, in case the way is in the border of the cell.
    7778        // CHECKSTYLE.OFF: SingleSpaceSeparator
    78         x0 = (long) Math.floor(n1.getEastNorth().east()  * OsmValidator.griddetail);
    79         y0 = (long) Math.floor(n1.getEastNorth().north() * OsmValidator.griddetail);
    80         x1 = (long) Math.floor(n2.getEastNorth().east()  * OsmValidator.griddetail);
    81         y1 = (long) Math.floor(n2.getEastNorth().north() * OsmValidator.griddetail);
     79        x0 = (long) Math.floor(n1.getEastNorth().east()  * griddetail);
     80        y0 = (long) Math.floor(n1.getEastNorth().north() * griddetail);
     81        x1 = (long) Math.floor(n2.getEastNorth().east()  * griddetail);
     82        y1 = (long) Math.floor(n2.getEastNorth().north() * griddetail);
    8283        // CHECKSTYLE.ON: SingleSpaceSeparator
    8384
  • trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java

    r10880 r11852  
    162162            e.scheduleRemoval(Collections.singleton(this));
    163163        } else if (e.getRemovedLayer() == this) {
    164             OsmValidator.errorLayer = null;
     164            OsmValidator.resetErrorLayer();
    165165        }
    166166    }
Note: See TracChangeset for help on using the changeset viewer.