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/WMSLayer.java

    r8470 r8510  
    239239    }
    240240
    241     public boolean hasAutoDownload(){
     241    public boolean hasAutoDownload() {
    242242        return autoDownloadEnabled;
    243243    }
     
    265265            int maxY = getImageYIndex(maxEn.north());
    266266
    267             for (int x=minX; x<=maxX; x++) {
    268                 for (int y=minY; y<=maxY; y++) {
     267            for (int x = minX; x <= maxX; x++) {
     268                for (int y = minY; y <= maxY; y++) {
    269269                    requestedTiles.add(new Point(x, y));
    270270                }
     
    300300            }
    301301        }
    302         for(int x = 0; x<dax; ++x) {
    303             for(int y = 0; y<day; ++y) {
     302        for (int x = 0; x < dax; ++x) {
     303            for (int y = 0; y < day; ++y) {
    304304                if (images[x][y] == null) {
    305                     images[x][y]= new GeorefImage(this);
     305                    images[x][y] = new GeorefImage(this);
    306306                }
    307307            }
     
    314314
    315315    @Override public String getToolTipText() {
    316         if(autoDownloadEnabled)
     316        if (autoDownloadEnabled)
    317317            return tr("WMS layer ({0}), automatically downloading in zoom {1}", getName(), resolutionText);
    318318        else
     
    321321
    322322    private int modulo(int a, int b) {
    323         return a % b >= 0 ? a%b : a%b+b;
     323        return a % b >= 0 ? a % b : a % b+b;
    324324    }
    325325
     
    331331    @Override
    332332    public void paint(Graphics2D g, final MapView mv, Bounds b) {
    333         if(info.getUrl() == null || (usesInvalidUrl && !isInvalidUrlConfirmed)) return;
     333        if (info.getUrl() == null || (usesInvalidUrl && !isInvalidUrlConfirmed)) return;
    334334
    335335        if (autoResolutionEnabled && !Utils.equalsEpsilon(getBestZoom(), mv.getDist100Pixel())) {
     
    340340
    341341        ProjectionBounds bounds = mv.getProjectionBounds();
    342         bminx= getImageXIndex(bounds.minEast);
    343         bminy= getImageYIndex(bounds.minNorth);
    344         bmaxx= getImageXIndex(bounds.maxEast);
    345         bmaxy= getImageYIndex(bounds.maxNorth);
    346 
    347         leftEdge = (int)(bounds.minEast * getPPD());
    348         bottomEdge = (int)(bounds.minNorth * getPPD());
     342        bminx = getImageXIndex(bounds.minEast);
     343        bminy = getImageYIndex(bounds.minNorth);
     344        bmaxx = getImageXIndex(bounds.maxEast);
     345        bmaxy = getImageYIndex(bounds.maxNorth);
     346
     347        leftEdge = (int) (bounds.minEast * getPPD());
     348        bottomEdge = (int) (bounds.minNorth * getPPD());
    349349
    350350        if (zoomIsTooBig()) {
    351             for(int x = 0; x<images.length; ++x) {
    352                 for(int y = 0; y<images[0].length; ++y) {
     351            for (int x = 0; x < images.length; ++x) {
     352                for (int y = 0; y < images[0].length; ++y) {
    353353                    GeorefImage image = images[x][y];
    354354                    image.paint(g, mv, image.getXIndex(), image.getYIndex(), leftEdge, bottomEdge);
     
    369369
    370370    public int getImageXIndex(double coord) {
    371         return (int)Math.floor(((coord - dx) * info.getPixelPerDegree()) / imageSize);
     371        return (int) Math.floor(((coord - dx) * info.getPixelPerDegree()) / imageSize);
    372372    }
    373373
    374374    public int getImageYIndex(double coord) {
    375         return (int)Math.floor(((coord - dy) * info.getPixelPerDegree()) / imageSize);
     375        return (int) Math.floor(((coord - dy) * info.getPixelPerDegree()) / imageSize);
    376376    }
    377377
    378378    public int getImageX(int imageIndex) {
    379         return (int)(imageIndex * imageSize * (getPPD() / info.getPixelPerDegree()) + dx * getPPD());
     379        return (int) (imageIndex * imageSize * (getPPD() / info.getPixelPerDegree()) + dx * getPPD());
    380380    }
    381381
    382382    public int getImageY(int imageIndex) {
    383         return (int)(imageIndex * imageSize * (getPPD() / info.getPixelPerDegree()) + dy * getPPD());
     383        return (int) (imageIndex * imageSize * (getPPD() / info.getPixelPerDegree()) + dy * getPPD());
    384384    }
    385385
     
    442442    }
    443443
    444     protected void downloadAndPaintVisible(Graphics g, final MapView mv, boolean real){
     444    protected void downloadAndPaintVisible(Graphics g, final MapView mv, boolean real) {
    445445
    446446        int newDax = dax;
     
    461461        }
    462462
    463         for(int x = bminx; x<=bmaxx; ++x) {
    464             for(int y = bminy; y<=bmaxy; ++y){
    465                 images[modulo(x,dax)][modulo(y,day)].changePosition(x, y);
     463        for (int x = bminx; x <= bmaxx; ++x) {
     464            for (int y = bminy; y <= bmaxy; ++y) {
     465                images[modulo(x, dax)][modulo(y, day)].changePosition(x, y);
    466466            }
    467467        }
     
    470470        Set<ProjectionBounds> areaToCache = new HashSet<>();
    471471
    472         for(int x = bminx; x<=bmaxx; ++x) {
    473             for(int y = bminy; y<=bmaxy; ++y){
    474                 GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
     472        for (int x = bminx; x <= bmaxx; ++x) {
     473            for (int y = bminy; y <= bmaxy; ++y) {
     474                GeorefImage img = images[modulo(x, dax)][modulo(y, day)];
    475475                if (!img.paint(g, mv, x, y, leftEdge, bottomEdge)) {
    476476                    addRequest(new WMSRequest(x, y, info.getPixelPerDegree(), real, true));
     
    487487    }
    488488
    489     @Override public void visitBoundingBox(BoundingXYVisitor v) {
    490         for(int x = 0; x<dax; ++x) {
    491             for(int y = 0; y<day; ++y)
    492                 if(images[x][y].getImage() != null){
     489    @Override
     490    public void visitBoundingBox(BoundingXYVisitor v) {
     491        for (int x = 0; x < dax; ++x) {
     492            for (int y = 0; y < day; ++y)
     493                if (images[x][y].getImage() != null) {
    493494                    v.visit(images[x][y].getMin());
    494495                    v.visit(images[x][y].getMax());
     
    497498    }
    498499
    499     @Override public Action[] getMenuEntries() {
     500    @Override
     501    public Action[] getMenuEntries() {
    500502        return new Action[]{
    501503                LayerListDialog.getInstance().createActivateLayerAction(this),
     
    665667        try {
    666668            for (WMSRequest request: finishedRequests) {
    667                 GeorefImage img = images[modulo(request.getXIndex(),dax)][modulo(request.getYIndex(),day)];
     669                GeorefImage img = images[modulo(request.getXIndex(), dax)][modulo(request.getYIndex(), day)];
    668670                if (img.equalPosition(request.getXIndex(), request.getYIndex())) {
    669671                    WMSException we = request.getException();
     
    684686            super(tr("Download visible tiles"));
    685687        }
     688
    686689        @Override
    687690        public void actionPerformed(ActionEvent ev) {
     
    708711        // the snapLevels, which are in meters per pixel. It works, though.
    709712        double dist = Main.map.mapView.getDist100Pixel();
    710         for(int i = snapLevels.length-2; i >= 0; i--) {
    711             if(snapLevels[i+1]/3 + snapLevels[i]*2/3 > dist)
     713        for (int i = snapLevels.length-2; i >= 0; i--) {
     714            if (snapLevels[i+1]/3 + snapLevels[i]*2/3 > dist)
    712715                return snapLevels[i+1];
    713716        }
     
    724727     */
    725728    private static void updateResolutionSetting(WMSLayer layer, boolean snap) {
    726         if(snap) {
     729        if (snap) {
    727730            layer.resolution = getBestZoom();
    728731            layer.resolutionText = MapView.getDistText(layer.resolution);
     
    751754        // prevents some flickering when zooming with auto-resolution enabled
    752755        // and instead gradually updates each tile.
    753         if(!snap) {
    754             for(int x = 0; x<layer.dax; ++x) {
    755                 for(int y = 0; y<layer.day; ++y) {
     756        if (!snap) {
     757            for (int x = 0; x < layer.dax; ++x) {
     758                for (int y = 0; y < layer.day; ++y) {
    756759                    layer.images[x][y].changePosition(-1, -1);
    757760                }
     
    800803            super(tr("Reload erroneous tiles"));
    801804        }
     805
    802806        @Override
    803807        public void actionPerformed(ActionEvent ev) {
     
    808812            for (int x = 0; x < dax; ++x) {
    809813                for (int y = 0; y < day; ++y) {
    810                     GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
    811                     if(img.getState() == State.FAILED){
     814                    GeorefImage img = images[modulo(x, dax)][modulo(y, day)];
     815                    if (img.getState() == State.FAILED) {
    812816                        addRequest(new WMSRequest(img.getXIndex(), img.getYIndex(), info.getPixelPerDegree(), true, false));
    813817                    }
     
    824828            super(tr("Alpha channel"));
    825829        }
     830
    826831        @Override
    827832        public void actionPerformed(ActionEvent ev) {
     
    900905            super(tr("Set WMS Bookmark"));
    901906        }
     907
    902908        @Override
    903909        public void actionPerformed(ActionEvent ev) {
     
    930936                for (int x = 0; x < dax; ++x) {
    931937                    for (int y = 0; y < day; ++y) {
    932                         GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
    933                         if(img.getState() == State.NOT_IN_CACHE){
     938                        GeorefImage img = images[modulo(x, dax)][modulo(y, day)];
     939                        if (img.getState() == State.NOT_IN_CACHE) {
    934940                            addRequest(new WMSRequest(img.getXIndex(), img.getYIndex(), info.getPixelPerDegree(), false, true));
    935941                        }
     
    982988            grabbers.clear();
    983989            grabberThreads.clear();
    984             for (int i=0; i<threadCount; i++) {
     990            for (int i = 0; i < threadCount; i++) {
    985991                WMSGrabber grabber = getGrabber(i == 0 && threadCount > 1);
    986992                grabbers.add(grabber);
     
    10141020                || event.getKey().equals(PROP_OVERLAP_EAST.getKey())
    10151021                || event.getKey().equals(PROP_OVERLAP_NORTH.getKey())) {
    1016             for (int i=0; i<images.length; i++) {
    1017                 for (int k=0; k<images[i].length; k++) {
     1022            for (int i = 0; i < images.length; i++) {
     1023                for (int k = 0; k < images[i].length; k++) {
    10181024                    images[i][k] = new GeorefImage(this);
    10191025                }
     
    11111117        imageSize = in.readInt();
    11121118        info.setPixelPerDegree(in.readDouble());
    1113         doSetName((String)in.readObject());
    1114         info.setExtendedUrl((String)in.readObject());
    1115         images = (GeorefImage[][])in.readObject();
     1119        doSetName((String) in.readObject());
     1120        info.setExtendedUrl((String) in.readObject());
     1121        images = (GeorefImage[][]) in.readObject();
    11161122
    11171123        for (GeorefImage[] imgs : images) {
Note: See TracChangeset for help on using the changeset viewer.