Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (9 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

File:
1 edited

Legend:

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

    r8509 r8510  
    118118            ".add_to_slippymap_chooser", true);
    119119    public static final StringProperty PROP_TILECACHE_DIR;
    120 
    121120    static {
    122121        String defPath = null;
     
    167166                for (String[] entry: content) {
    168167                    panel.add(new JLabel(tr(entry[0]) + ":"), GBC.std());
    169                     panel.add(GBC.glue(5,0), GBC.std());
     168                    panel.add(GBC.glue(5, 0), GBC.std());
    170169                    panel.add(createTextField(entry[1]), GBC.eol().fill(GBC.HORIZONTAL));
    171170                }
     
    173172                for (Entry<String, String> e: clickedTile.getMetadata().entrySet()) {
    174173                    panel.add(new JLabel(tr("Metadata ") + tr(e.getKey()) + ":"), GBC.std());
    175                     panel.add(GBC.glue(5,0), GBC.std());
     174                    panel.add(GBC.glue(5, 0), GBC.std());
    176175                    String value = e.getValue();
    177176                    if ("lastModification".equals(e.getKey()) || "expirationTime".equals(e.getKey())) {
     
    222221            try {
    223222                return new TMSCachedTileLoader(listener, "TMS",
    224                         Main.pref.getInteger("socket.timeout.connect",15) * 1000,
     223                        Main.pref.getInteger("socket.timeout.connect", 15) * 1000,
    225224                        Main.pref.getInteger("socket.timeout.read", 30) * 1000,
    226225                        headers,
     
    277276        tileCache.clear();
    278277        if (tileLoader instanceof CachedTileLoader) {
    279             ((CachedTileLoader)tileLoader).clearCache(tileSource);
     278            ((CachedTileLoader) tileLoader).clearCache(tileSource);
    280279        }
    281280        redraw();
     
    311310
    312311    protected static int checkMaxZoomLvl(int maxZoomLvl, TileSource ts) {
    313         if(maxZoomLvl > MAX_ZOOM) {
     312        if (maxZoomLvl > MAX_ZOOM) {
    314313            maxZoomLvl = MAX_ZOOM;
    315314        }
    316         if(maxZoomLvl < PROP_MIN_ZOOM_LVL.get()) {
     315        if (maxZoomLvl < PROP_MIN_ZOOM_LVL.get()) {
    317316            maxZoomLvl = PROP_MIN_ZOOM_LVL.get();
    318317        }
     
    333332
    334333    static int checkMinZoomLvl(int minZoomLvl, TileSource ts) {
    335         if(minZoomLvl < MIN_ZOOM) {
     334        if (minZoomLvl < MIN_ZOOM) {
    336335            /*Main.debug("Min. zoom level should not be less than "+MIN_ZOOM+"! Setting to that.");*/
    337336            minZoomLvl = MIN_ZOOM;
    338337        }
    339         if(minZoomLvl > PROP_MAX_ZOOM_LVL.get()) {
     338        if (minZoomLvl > PROP_MAX_ZOOM_LVL.get()) {
    340339            /*Main.debug("Min. zoom level should not be more than Max. zoom level! Setting to Max.");*/
    341340            minZoomLvl = getMaxZoomLvl(ts);
     
    460459        Map<String, String> headers = null;
    461460        if (tileSource instanceof TemplatedTMSTileSource) {
    462             headers = (((TemplatedTMSTileSource)tileSource).getHeaders());
     461            headers = (((TemplatedTMSTileSource) tileSource).getHeaders());
    463462        }
    464463
     
    513512         * getScaleFactor(...) is supposed to be between 0.75 and 3
    514513         */
    515         int intResult = (int)Math.floor(result);
     514        int intResult = (int) Math.floor(result);
    516515        if (intResult > getMaxZoomLvl())
    517516            return getMaxZoomLvl();
     
    525524        super(info);
    526525
    527         if(!isProjectionSupported(Main.getProjection())) {
     526        if (!isProjectionSupported(Main.getProjection())) {
    528527            JOptionPane.showMessageDialog(Main.parent,
    529528                    tr("TMS layers do not support the projection {0}.\n{1}\n"
     
    568567            @Override
    569568            public void actionPerformed(ActionEvent ae) {
    570                 autoLoad= !autoLoad;
     569                autoLoad = !autoLoad;
    571570            }
    572571        });
     
    966965        // And how many pixels into the image itself does that
    967966        // correlate to?
    968         int img_x_offset = (int)(screen_x_offset * imageXScaling + 0.5);
    969         int img_y_offset = (int)(screen_y_offset * imageYScaling + 0.5);
     967        int img_x_offset = (int) (screen_x_offset * imageXScaling + 0.5);
     968        int img_y_offset = (int) (screen_y_offset * imageYScaling + 0.5);
    970969        // Now calculate the other corner of the image that we need
    971970        // by scaling the 'target' rectangle's dimensions.
    972         int img_x_end = img_x_offset + (int)(target.getWidth() * imageXScaling + 0.5);
    973         int img_y_end = img_y_offset + (int)(target.getHeight() * imageYScaling + 0.5);
     971        int img_x_end = img_x_offset + (int) (target.getWidth() * imageXScaling + 0.5);
     972        int img_y_end = img_y_offset + (int) (target.getHeight() * imageYScaling + 0.5);
    974973
    975974        if (Main.isDebugEnabled()) {
     
    10331032        Color oldColor = g.getColor();
    10341033        g.setColor(Color.black);
    1035         g.drawString(text,x+1,y+1);
     1034        g.drawString(text, x+1, y+1);
    10361035        g.setColor(oldColor);
    1037         g.drawString(text,x,y);
     1036        g.drawString(text, x, y);
    10381037    }
    10391038
     
    11221121    private Coordinate getShiftedCoord(EastNorth en) {
    11231122        LatLon ll = getShiftedLatLon(en);
    1124         return new Coordinate(ll.lat(),ll.lon());
    1125     }
    1126 
    1127     private final TileSet nullTileSet = new TileSet((LatLon)null, (LatLon)null, 0);
     1123        return new Coordinate(ll.lat(), ll.lon());
     1124    }
     1125
     1126    private final TileSet nullTileSet = new TileSet((LatLon) null, (LatLon) null, 0);
     1127
    11281128    private final class TileSet {
    11291129        private int x0, x1, y0, y1;
     
    11351135         */
    11361136        private TileSet(EastNorth topLeft, EastNorth botRight, int zoom) {
    1137             this(getShiftedLatLon(topLeft), getShiftedLatLon(botRight),zoom);
     1137            this(getShiftedLatLon(topLeft), getShiftedLatLon(botRight), zoom);
    11381138        }
    11391139
     
    11461146                return;
    11471147
    1148             x0 = (int)tileSource.lonToTileX(topLeft.lon(),  zoom);
    1149             y0 = (int)tileSource.latToTileY(topLeft.lat(),  zoom);
    1150             x1 = (int)tileSource.lonToTileX(botRight.lon(), zoom);
    1151             y1 = (int)tileSource.latToTileY(botRight.lat(), zoom);
     1148            x0 = (int) tileSource.lonToTileX(topLeft.lon(),  zoom);
     1149            y0 = (int) tileSource.latToTileY(topLeft.lat(),  zoom);
     1150            x1 = (int) tileSource.lonToTileX(botRight.lon(), zoom);
     1151            y1 = (int) tileSource.latToTileY(botRight.lat(), zoom);
    11521152            if (x0 > x1) {
    11531153                int tmp = x0;
     
    11601160                y1 = tmp;
    11611161            }
    1162             tileMax = (int)Math.pow(2.0, zoom);
     1162            tileMax = (int) Math.pow(2.0, zoom);
    11631163            if (x0 < 0) {
    11641164                x0 = 0;
     
    12461246                    return Math.abs(t.getXtile() - centerX) + Math.abs(t.getYtile() - centerY);
    12471247                }
     1248
    12481249                @Override
    12491250                public int compare(Tile o1, Tile o2) {
     
    12751276        }
    12761277    }
    1277 
    12781278
    12791279    private static class TileSetInfo {
     
    13071307        private final TileSet[] tileSets;
    13081308        private final TileSetInfo[] tileSetInfos;
     1309
    13091310        public DeepTileSet(EastNorth topLeft, EastNorth botRight, int minZoom, int maxZoom) {
    13101311            this.topLeft = topLeft;
     
    13151316            this.tileSetInfos = new TileSetInfo[maxZoom - minZoom + 1];
    13161317        }
     1318
    13171319        public TileSet getTileSet(int zoom) {
    13181320            if (zoom < minZoom)
     
    13831385            }
    13841386            // Do binary search between currentZoomLevel and displayZoomLevel
    1385             while (zoom > displayZoomLevel && !tsi.hasVisibleTiles && tsi.hasOverzoomedTiles){
     1387            while (zoom > displayZoomLevel && !tsi.hasVisibleTiles && tsi.hasOverzoomedTiles) {
    13861388                zoom = (zoom + displayZoomLevel)/2;
    13871389                tsi = dts.getTileSetInfo(zoom);
     
    14891491            myDrawString(g, tr("Pixel scale: {0}", getScaleFactor(currentZoomLevel)), 50, 170);
    14901492            myDrawString(g, tr("Best zoom: {0}", getBestZoom()), 50, 185);
    1491             if(tileLoader instanceof TMSCachedTileLoader) {
    1492                 TMSCachedTileLoader cachedTileLoader = (TMSCachedTileLoader)tileLoader;
     1493            if (tileLoader instanceof TMSCachedTileLoader) {
     1494                TMSCachedTileLoader cachedTileLoader = (TMSCachedTileLoader) tileLoader;
    14931495                int offset = 185;
    1494                 for(String part: cachedTileLoader.getStats().split("\n")) {
    1495                     myDrawString(g, tr("Cache stats: {0}", part), 50, offset+=15);
    1496                 }
    1497 
     1496                for (String part: cachedTileLoader.getStats().split("\n")) {
     1497                    myDrawString(g, tr("Cache stats: {0}", part), 50, offset += 15);
     1498                }
    14981499            }
    14991500        }
Note: See TracChangeset for help on using the changeset viewer.