Ignore:
Timestamp:
2016-09-03T16:43:42+02:00 (8 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/jrender/src/jrender/Jrender.java

    r32906 r32907  
    1 /* Copyright 2014 Malcolm Herring
    2  *
    3  * This is free software: you can redistribute it and/or modify
    4  * it under the terms of the GNU General Public License as published by
    5  * the Free Software Foundation, version 3 of the License.
    6  *
    7  * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
    8  */
    9 
     1// License: GPL. For details, see LICENSE file.
    102package jrender;
    113
     
    2719import javax.imageio.ImageIO;
    2820
     21import render.ChartContext;
     22import render.Renderer;
    2923import s57.S57map;
     24import s57.S57map.Feature;
     25import s57.S57map.Snode;
    3026import s57.S57osm;
    31 import s57.S57map.*;
    32 import render.*;
    3327
    34 public class Jrender {
     28/**
     29 * @author Malcolm Herring
     30 */
     31public final class Jrender {
     32    private Jrender() {
     33        // Hide default constructor for utilities classes
     34    }
    3535
    3636    static String srcdir;
     
    4646
    4747    static class Context implements ChartContext {
    48        
    49       static double top;
    50       static double mile;
    51      
    52       public Context () {
    53             top = (1.0 - Math.log(Math.tan(map.bounds.maxlat) + 1.0 / Math.cos(map.bounds.maxlat)) / Math.PI) / 2.0 * 256.0 * 4096.0 * Math.pow(2, (zoom - 12));
    54             mile = (2 * ((zoom < 12) ? (256 / (int)(Math.pow(2, (11 - zoom)))) : 256) + 256) / ((Math.toDegrees(map.bounds.maxlat) - Math.toDegrees(map.bounds.minlat)) * 60);
    55       }
    56      
     48
     49        static double top;
     50        static double mile;
     51
     52        Context() {
     53            top = (1.0 - Math.log(Math.tan(map.bounds.maxlat) + 1.0 / Math.cos(map.bounds.maxlat)) / Math.PI)
     54                    / 2.0 * 256.0 * 4096.0 * Math.pow(2, (zoom - 12));
     55            mile = (2 * ((zoom < 12) ? (256 / (int) (Math.pow(2, (11 - zoom)))) : 256) + 256)
     56                    / ((Math.toDegrees(map.bounds.maxlat) - Math.toDegrees(map.bounds.minlat)) * 60);
     57        }
     58
     59        @Override
    5760        public Point2D getPoint(Snode coord) {
    5861            double x = (Math.toDegrees(coord.lon) - Math.toDegrees(map.bounds.minlon)) * 256.0 * 2048.0 * Math.pow(2, (zoom - 12)) / 180.0;
    59             double y = ((1.0 - Math.log(Math.tan(coord.lat) + 1.0 / Math.cos(coord.lat)) / Math.PI) / 2.0 * 256.0 * 4096.0 * Math.pow(2, (zoom - 12))) - top;
     62            double y = ((1.0 - Math.log(Math.tan(coord.lat) + 1.0 / Math.cos(coord.lat)) / Math.PI)
     63                    / 2.0 * 256.0 * 4096.0 * Math.pow(2, (zoom - 12))) - top;
    6064            return new Point2D.Double(x, y);
    6165        }
    6266
     67        @Override
    6368        public double mile(Feature feature) {
    6469            return mile;
    6570        }
    6671
     72        @Override
    6773        public boolean clip() {
    6874            return false;
    6975        }
    7076
     77        @Override
    7178        public Color background(S57map map) {
    7279            return new Color(0, true);
    7380        }
    7481
     82        @Override
    7583        public RuleSet ruleset() {
    7684            return RuleSet.SEAMARK;
    7785        }
    7886    }
    79    
     87
    8088    static void tile(int z, int s, int xn, int yn) throws IOException {
    81         int border = (z < 12) ? (256 / (int)(Math.pow(2, (11 - zoom)))) : 256;
    82         int scale = (int)Math.pow(2, z - 12);
     89        int border = (z < 12) ? (256 / (int) (Math.pow(2, (11 - zoom)))) : 256;
     90        int scale = (int) Math.pow(2, z - 12);
    8391        int xdir = (scale > 0) ? (scale * xtile) + xn : xtile;
    8492        int ynam = (scale > 0) ? (scale * ytile) + yn : ytile;
     
    116124        }
    117125    }
    118    
     126
    119127    static void clean(int z, int xn, int yn) throws Exception {
    120128        int scale = (int) Math.pow(2, z - 12);
     
    135143        }
    136144    }
    137    
     145
    138146    public static void main(String[] args) throws Exception {
    139147        if (args.length < 5) {
Note: See TracChangeset for help on using the changeset viewer.