Changeset 11702 in josm


Ignore:
Timestamp:
2017-03-08T21:18:57+01:00 (7 months ago)
Author:
Don-vip
Message:

more usages of Utils.clamp

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r11613 r11702  
    294294
    295295        // shrink to range
    296         heatMapDrawGain = Math.min(Math.max(-10, heatMapDrawGain), 10);
     296        heatMapDrawGain = Utils.clamp(heatMapDrawGain, -10, 10);
    297297
    298298        neutralColor = getColor(layerName, true);
     
    732732
    733733        // adjust global settings
    734         final int globalLineWidth = Math.min(Math.max(lineWidth, 1), 20);
     734        final int globalLineWidth = Utils.clamp(lineWidth, 1, 20);
    735735
    736736        // cache scale of view
     
    11571157
    11581158        // adjust global settings ( zero = default line width )
    1159         final int globalLineWidth = (0 == lineWidth) ? 1 : Math.min(Math.max(lineWidth, 1), 20);
     1159        final int globalLineWidth = (0 == lineWidth) ? 1 : Utils.clamp(lineWidth, 1, 20);
    11601160
    11611161        // 1st setup virtual paint area ----------------------------------------
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java

    r11674 r11702  
    184184        mapImage.offsetY = Math.round(offsetYF);
    185185
    186         mapImage.alpha = Math.min(255, Math.max(0, Main.pref.getInteger("mappaint.icon-image-alpha", 255)));
     186        mapImage.alpha = Utils.clamp(Main.pref.getInteger("mappaint.icon-image-alpha", 255), 0, 255);
    187187        Integer pAlpha = Utils.colorFloat2int(c.get(keys[ICON_OPACITY_IDX], null, float.class));
    188188        if (pAlpha != null) {
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r11386 r11702  
    323323        // we will run up to MAX_DOWNLOAD_THREADS concurrent fetchers.
    324324        int threadsNumber = Main.pref.getInteger("osm.download.threads", OsmApi.MAX_DOWNLOAD_THREADS);
    325         threadsNumber = Math.min(Math.max(threadsNumber, 1), OsmApi.MAX_DOWNLOAD_THREADS);
     325        threadsNumber = Utils.clamp(threadsNumber, 1, OsmApi.MAX_DOWNLOAD_THREADS);
    326326        final ExecutorService exec = Executors.newFixedThreadPool(
    327327                threadsNumber, Utils.newThreadFactory(getClass() + "-%d", Thread.NORM_PRIORITY));
Note: See TracChangeset for help on using the changeset viewer.