Ignore:
Timestamp:
2016-07-04T14:18:17+02:00 (9 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java

    r26835 r32556  
    1 // License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others
     1// License: GPL. For details, see LICENSE file.
    22package cadastre_fr;
    33
     
    4444    private double pixelPerEast;
    4545    private double pixelPerNorth;
    46    
    4746
    4847    public GeorefImage(BufferedImage img, EastNorth min, EastNorth max, WMSLayer wmsLayer) {
    4948        image = img;
    50  
     49
    5150        this.min = min;
    5251        this.max = max;
     
    8180     */
    8281    private EastNorthBound computeNewBounding(EastNorth p1, EastNorth p2, EastNorth p3, EastNorth p4) {
    83         EastNorth pt[] = new EastNorth[4];
     82        EastNorth[] pt = new EastNorth[4];
    8483        pt[0] = p1;
    8584        pt[1] = p2;
     
    9089        double highestEast = Double.MIN_VALUE;
    9190        double highestNorth = Double.MIN_VALUE;
    92         for(int i=0; i<=3; i++) {
     91        for (int i = 0; i <= 3; i++) {
    9392            smallestEast = Math.min(pt[i].east(), smallestEast);
    9493            smallestNorth = Math.min(pt[i].north(), smallestNorth);
     
    111110
    112111        // apply offsets defined manually when vector images are translated manually (not saved in cache)
    113         double dx=0, dy=0;
    114         if (wmsLayer!=null) {
     112        double dx = 0, dy = 0;
     113        if (wmsLayer != null) {
    115114            dx = wmsLayer.deltaEast;
    116115            dy = wmsLayer.deltaNorth;
     
    131130            } else {
    132131                Point[] croppedPoint = new Point[5];
    133                 for (int i=0; i<4; i++)
     132                for (int i = 0; i < 4; i++) {
    134133                    croppedPoint[i] = nc.getPoint(
    135134                            new EastNorth(orgCroppedRaster[i].east()+dx, orgCroppedRaster[i].north()+dy));
     135                }
    136136                croppedPoint[4] = croppedPoint[0];
    137                 for (int i=0; i<4; i++) {
     137                for (int i = 0; i < 4; i++) {
    138138                    g.setColor(Color.green);
    139139                    g.drawLine(croppedPoint[i].x, croppedPoint[i].y, croppedPoint[i+1].x, croppedPoint[i+1].y);
     
    173173    /**
    174174     * Make all pixels masked by the given georefImage transparent in this image
    175      *
    176      * @param georefImage
    177175     */
    178176    public void withdraw(GeorefImage georefImage) {
     
    189187            int heightYMaskPixel = Math.abs((int) ((maxMaskNorth - minMaskNorth) / pxPerNorth));
    190188            Graphics g = image.getGraphics();
    191             for (int x = minXMaskPixel; x < minXMaskPixel + widthXMaskPixel; x++)
    192                 for (int y = minYMaskPixel; y < minYMaskPixel + heightYMaskPixel; y++)
     189            for (int x = minXMaskPixel; x < minXMaskPixel + widthXMaskPixel; x++) {
     190                for (int y = minYMaskPixel; y < minYMaskPixel + heightYMaskPixel; y++) {
    193191                    image.setRGB(x, y, VectorImageModifier.cadastreBackgroundTransp);
     192                }
     193            }
    194194            g.dispose();
    195195        }
     
    222222        if (WMSLayer.currentFormat >= 4) {
    223223            imageOriginalHeight = in.readInt();
    224             imageOriginalWidth =  in.readInt();
    225         }
    226         image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in));
     224            imageOriginalWidth = in.readInt();
     225        }
     226        image = ImageIO.read(ImageIO.createImageInputStream(in));
    227227        updatePixelPer();
    228228    }
     
    285285        min = new EastNorth(min.east() + dx, min.north() + dy);
    286286        max = new EastNorth(max.east() + dx, max.north() + dy);
    287         for (int i=0; i<4; i++) {
     287        for (int i = 0; i < 4; i++) {
    288288            orgRaster[i] = new EastNorth(orgRaster[i].east() + dx, orgRaster[i].north() + dy);
    289289            orgCroppedRaster[i] = new EastNorth(orgCroppedRaster[i].east() + dx, orgCroppedRaster[i].north() + dy);
    290290        }
    291291    }
    292    
     292
    293293    /**
    294294     * Change this image scale by moving the min,max coordinates around an anchor
    295      * @param anchor
    296      * @param proportion
    297295     */
    298296    public void scale(EastNorth anchor, double proportion) {
    299297        min = anchor.interpolate(min, proportion);
    300298        max = anchor.interpolate(max, proportion);
    301         for (int i=0; i<4; i++) {
     299        for (int i = 0; i < 4; i++) {
    302300            orgRaster[i] = anchor.interpolate(orgRaster[i], proportion);
    303301            orgCroppedRaster[i] = anchor.interpolate(orgCroppedRaster[i], proportion);
     
    316314            return;
    317315        // rotate the bounding boxes coordinates first
    318         for (int i=0; i<4; i++) {
     316        for (int i = 0; i < 4; i++) {
    319317            orgRaster[i] = orgRaster[i].rotate(anchor, delta_ang);
    320318            orgCroppedRaster[i] = orgCroppedRaster[i].rotate(anchor, delta_ang);
     
    323321        double sin = Math.abs(Math.sin(angle+delta_ang)), cos = Math.abs(Math.cos(angle+delta_ang));
    324322        int w = imageOriginalWidth, h = imageOriginalHeight;
    325         int neww = (int)Math.floor(w*cos+h*sin);
    326         int newh = (int)Math.floor(h*cos+w*sin);
     323        int neww = (int) Math.floor(w*cos+h*sin);
     324        int newh = (int) Math.floor(h*cos+w*sin);
    327325        GraphicsConfiguration gc = getDefaultConfiguration();
    328326        BufferedImage result = gc.createCompatibleImage(neww, newh, image.getTransparency());
     
    336334        min = enb.min;
    337335        max = enb.max;
    338         angle+=delta_ang;
     336        angle += delta_ang;
    339337    }
    340338
     
    346344    public void crop(EastNorth adj1, EastNorth adj2) {
    347345        // s1 and s2 have 0,0 at top, left where all EastNorth coord. have 0,0 at bottom, left
    348         int sx1 = (int)((adj1.getX() - min.getX())*getPixelPerEast());
    349         int sy1 = (int)((max.getY() - adj2.getY())*getPixelPerNorth());
    350         int sx2 = (int)((adj2.getX() - min.getX())*getPixelPerEast());
    351         int sy2 = (int)((max.getY() - adj1.getY())*getPixelPerNorth());
     346        int sx1 = (int) ((adj1.getX() - min.getX())*getPixelPerEast());
     347        int sy1 = (int) ((max.getY() - adj2.getY())*getPixelPerNorth());
     348        int sx2 = (int) ((adj2.getX() - min.getX())*getPixelPerEast());
     349        int sy2 = (int) ((max.getY() - adj1.getY())*getPixelPerNorth());
    352350        int newWidth = Math.abs(sx2 - sx1);
    353351        int newHeight = Math.abs(sy2 - sy1);
Note: See TracChangeset for help on using the changeset viewer.