Changeset 32907 in osm for applications/editors


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

checkstyle

Location:
applications/editors/josm/plugins/seachart
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/.settings/org.eclipse.jdt.ui.prefs

    r32394 r32907  
    1616sp_cleanup.convert_functional_interfaces=false
    1717sp_cleanup.convert_to_enhanced_for_loop=false
    18 sp_cleanup.correct_indentation=true
     18sp_cleanup.correct_indentation=false
    1919sp_cleanup.format_source_code=false
    2020sp_cleanup.format_source_code_changes_only=false
  • applications/editors/josm/plugins/seachart/jbasemap/src/jbasemap/Jbasemap.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 jbasemap;
    113
     
    2214import org.w3c.dom.Document;
    2315
     16import render.ChartContext;
     17import render.Renderer;
    2418import s57.S57map;
     19import s57.S57map.Feature;
     20import s57.S57map.GeomIterator;
     21import s57.S57map.Pflag;
     22import s57.S57map.Snode;
    2523import s57.S57obj.Obj;
    2624import s57.S57osm;
    27 import s57.S57map.*;
    28 import symbols.*;
    29 import render.*;
     25import symbols.Symbols;
    3026
    31 public class Jbasemap {
     27/**
     28 * @author Malcolm Herring
     29 */
     30public final class Jbasemap {
     31    private Jbasemap() {
     32        // Hide default constructor for utilities classes
     33    }
    3234
    3335    static String src;
     
    3941
    4042    static class Context implements ChartContext {
    41        
    42       static double top = 0;
    43       static double mile = 0;
    44      
    45       public Context () {
     43
     44        static double top = 0;
     45        static double mile = 0;
     46
     47        Context() {
    4648            top = (1.0 - Math.log(Math.tan(map.bounds.maxlat) + 1.0 / Math.cos(map.bounds.maxlat)) / Math.PI) / 2.0 * 256.0 * z2;
    4749            mile = 256 / ((Math.toDegrees(map.bounds.maxlat) - Math.toDegrees(map.bounds.minlat)) * 60);
    48       }
    49      
     50        }
     51
     52        @Override
    5053        public Point2D getPoint(Snode coord) {
    5154            double x = (Math.toDegrees(coord.lon) - Math.toDegrees(map.bounds.minlon)) * 256.0 * (z2 / 2) / 180.0;
     
    5457        }
    5558
     59        @Override
    5660        public double mile(Feature feature) {
    5761            return mile;
    5862        }
    5963
     64        @Override
    6065        public boolean clip() {
    6166            return true;
    6267        }
    6368
     69        @Override
    6470        public Color background(S57map map) {
    6571            if (map.features.containsKey(Obj.COALNE)) {
     
    7682                            if (node == null)
    7783                                continue;
    78                             if ((node.lat >= map.bounds.minlat) && (node.lat <= map.bounds.maxlat) && (node.lon >= map.bounds.minlon) && (node.lon <= map.bounds.maxlon)) {
     84                            if ((node.lat >= map.bounds.minlat) && (node.lat <= map.bounds.maxlat)
     85                             && (node.lon >= map.bounds.minlon) && (node.lon <= map.bounds.maxlon)) {
    7986                                return Symbols.Bwater;
    8087                            }
     
    8491                return Symbols.Yland;
    8592            } else {
    86                 if (map.features.containsKey(Obj.ROADWY) || map.features.containsKey(Obj.RAILWY) || map.features.containsKey(Obj.LAKARE) || map.features.containsKey(Obj.RIVERS) || map.features.containsKey(Obj.CANALS)) {
     93                if (map.features.containsKey(Obj.ROADWY) || map.features.containsKey(Obj.RAILWY) || map.features.containsKey(Obj.LAKARE) ||
     94                    map.features.containsKey(Obj.RIVERS) || map.features.containsKey(Obj.CANALS)) {
    8795                    return Symbols.Yland;
    8896                } else {
     
    92100        }
    93101
     102        @Override
    94103        public RuleSet ruleset() {
    95104            return RuleSet.BASE;
    96105        }
    97106    }
    98    
     107
    99108    public static void main(String[] args) throws IOException {
    100109        if (args.length < 5) {
  • applications/editors/josm/plugins/seachart/jicons/src/jicons/Jicons.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 jicons;
    113
     4import java.awt.Color;
     5import java.awt.Dimension;
     6import java.awt.Graphics2D;
     7import java.awt.Rectangle;
     8import java.awt.geom.Point2D;
     9import java.awt.image.BufferedImage;
    1210import java.io.BufferedReader;
    1311import java.io.File;
     
    1715import java.io.OutputStreamWriter;
    1816import java.io.Writer;
    19 import java.awt.Color;
    20 import java.awt.Dimension;
    21 import java.awt.Graphics2D;
    22 import java.awt.Rectangle;
    23 import java.awt.geom.Point2D;
    24 import java.awt.image.BufferedImage;
    2517
    2618import javax.imageio.ImageIO;
    2719
     20import org.apache.batik.dom.GenericDOMImplementation;
    2821import org.apache.batik.svggen.SVGGraphics2D;
    2922import org.apache.batik.svggen.SVGGraphics2DIOException;
    30 import org.apache.batik.dom.GenericDOMImplementation;
     23import org.w3c.dom.DOMImplementation;
    3124import org.w3c.dom.Document;
    32 import org.w3c.dom.DOMImplementation;
    33 
     25
     26import render.ChartContext;
     27import render.Renderer;
    3428import s57.S57map;
    35 import s57.S57map.*;
    36 import render.*;
    37 
    38 public class Jicons {
    39    
     29import s57.S57map.Feature;
     30import s57.S57map.Snode;
     31
     32/**
     33 * @author Malcolm Herring
     34 */
     35public final class Jicons {
     36    private Jicons() {
     37        // Hide default constructor for utilities classes
     38    }
     39
    4040    static int x = 0;
    4141    static int y = 0;
     
    5858        boolean inIcons = false;
    5959        boolean inIcon = false;
    60        
     60
    6161        if (args.length < 2) {
    6262            System.err.println("Usage: java -jar jicons.jar icon_definition_file icons_directory");
     
    6464        }
    6565        in = new BufferedReader(new FileReader(args[0]));
    66        
     66
    6767        context = new Context();
    6868        String ln;
     
    188188        System.exit(0);
    189189    }
    190    
     190
    191191    static class Context implements ChartContext {
    192        
     192
     193        @Override
    193194        public Point2D getPoint(Snode coord) {
    194195            return new Point2D.Double(x, y);
    195196        }
    196197
     198        @Override
    197199        public double mile(Feature feature) {
    198200            return Math.min(w, h);
    199201        }
    200202
     203        @Override
    201204        public boolean clip() {
    202205            return false;
    203206        }
    204207
     208        @Override
    205209        public Color background(S57map map) {
    206210            return new Color(0, true);
    207211        }
    208212
     213        @Override
    209214        public RuleSet ruleset() {
    210215            return RuleSet.ALL;
  • applications/editors/josm/plugins/seachart/josmtos57/src/josmtos57/Josmtos57.java

    r32906 r32907  
    1 /* Copyright 2015 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 josmtos57;
    113
    12 import java.io.*;
    13 import java.util.*;
     4import java.io.BufferedReader;
     5import java.io.File;
     6import java.io.FileInputStream;
     7import java.io.FileOutputStream;
     8import java.io.FileReader;
     9import java.io.IOException;
     10import java.io.UnsupportedEncodingException;
     11import java.util.ArrayList;
     12import java.util.Arrays;
     13import java.util.HashMap;
     14import java.util.Scanner;
    1415import java.util.zip.CRC32;
    1516
    1617import s57.S57dat;
     18import s57.S57dat.Fparams;
     19import s57.S57dat.S57field;
    1720import s57.S57enc;
    1821import s57.S57map;
    1922import s57.S57osm;
    20 import s57.S57dat.*;
    2123
    22 public class Josmtos57 {
     24/**
     25 * @author Malcolm Herring
     26 */
     27public final class Josmtos57 {
     28    private Josmtos57() {
     29        // Hide default constructor for utilities classes
     30    }
    2331
    2432    // http://opendatacommons.org/licenses/odbl/1-0/
    25    
     33
    2634    /*
    2735    URL website = new URL("http://www.website.com/information.asp");
    2836    try (InputStream in = website.openStream()) { Files.copy(in, target, StandardCopyOption.REPLACE_EXISTING); }
    2937     */
    30    
     38
    3139    /*
    3240     * To do:
     
    3745
    3846    static byte[] header = {
    39         '0', '0', '2', '6', '2', '3', 'L', 'E', '1', ' ', '0', '9', '0', '0', '0', '7', '3', ' ', ' ', ' ', '6', '6', '0', '4', '0', '0', '0', '0', '0', '0', '0', '0',
    40         '1', '9', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '4', '8', '0', '0', '0', '0', '1', '9', 'C', 'A', 'T', 'D', '0', '0', '0', '1',
    41         '2', '2', '0', '0', '0', '0', '6', '7', 0x1e, '0', '0', '0', '0', ';', '&', ' ', ' ', ' ', 0x1f, '0', '0', '0', '1', 'C', 'A', 'T', 'D', 0x1e, '0', '1', '0', '0',
    42         ';', '&', ' ', ' ', ' ', 'I', 'S', 'O', '/', 'I', 'E', 'C', ' ', '8', '2', '1', '1', ' ', 'R', 'e', 'c', 'o', 'r', 'd', ' ', 'I', 'd', 'e', 'n', 't', 'i', 'f',
    43         'i', 'e', 'r', 0x1f, 0x1f, '(', 'I', '(', '5', ')', ')', 0x1e, '1', '6', '0', '0', ';', '&', ' ', ' ', ' ', 'C', 'a', 't', 'a', 'l', 'o', 'g', 'u', 'e', ' ', 'D',
    44         'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', ' ', 'F', 'i', 'e', 'l', 'd', 0x1f, 'R', 'C', 'N', 'M', '!', 'R', 'C', 'I', 'D', '!', 'F', 'I', 'L', 'E', '!', 'L', 'F',
    45         'I', 'L', '!', 'V', 'O', 'L', 'M', '!', 'I', 'M', 'P', 'L', '!', 'S', 'L', 'A', 'T', '!', 'W', 'L', 'O', 'N', '!', 'N', 'L', 'A', 'T', '!', 'E', 'L', 'O', 'N',
    46         '!', 'C', 'R', 'C', 'S', '!', 'C', 'O', 'M', 'T', 0x1f, '(', 'A', '(', '2', ')', ',', 'I', '(', '1', '0', ')', ',', '3', 'A', ',', 'A', '(', '3', ')', ',', '4',
    47         'R', ',', '2', 'A', ')', 0x1e,
    48         '0', '0', '1', '0', '1', ' ', 'D', ' ', ' ', ' ', ' ', ' ', '0', '0', '0', '5', '3', ' ', ' ', ' ', '5', '5', '0', '4',
    49         '0', '0', '0', '1', '0', '0', '0', '0', '6', '0', '0', '0', '0', '0',   'C', 'A', 'T', 'D', '0', '0', '0', '4', '2', '0', '0', '0', '0', '6', 0x1e,
    50         '0', '0', '0', '0', '0', 0x1e, 'C', 'D', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'C', 'A', 'T', 'A', 'L', 'O', 'G', '.', '0', '3', '1', 0x1f,
    51         0x1f, 'V', '0', '1', 'X', '0', '1', 0x1f, 'A', 'S', 'C', 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e
     47            // CHECKSTYLE.OFF: LineLength
     48            '0', '0', '2', '6', '2', '3', 'L', 'E', '1', ' ', '0', '9', '0', '0', '0', '7', '3', ' ', ' ', ' ', '6', '6', '0', '4', '0', '0', '0', '0', '0', '0', '0', '0',
     49            '1', '9', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '4', '8', '0', '0', '0', '0', '1', '9', 'C', 'A', 'T', 'D', '0', '0', '0', '1',
     50            '2', '2', '0', '0', '0', '0', '6', '7', 0x1e, '0', '0', '0', '0', ';', '&', ' ', ' ', ' ', 0x1f, '0', '0', '0', '1', 'C', 'A', 'T', 'D', 0x1e, '0', '1', '0', '0',
     51            ';', '&', ' ', ' ', ' ', 'I', 'S', 'O', '/', 'I', 'E', 'C', ' ', '8', '2', '1', '1', ' ', 'R', 'e', 'c', 'o', 'r', 'd', ' ', 'I', 'd', 'e', 'n', 't', 'i', 'f',
     52            'i', 'e', 'r', 0x1f, 0x1f, '(', 'I', '(', '5', ')', ')', 0x1e, '1', '6', '0', '0', ';', '&', ' ', ' ', ' ', 'C', 'a', 't', 'a', 'l', 'o', 'g', 'u', 'e', ' ', 'D',
     53            'i', 'r', 'e', 'c', 't', 'o', 'r', 'y', ' ', 'F', 'i', 'e', 'l', 'd', 0x1f, 'R', 'C', 'N', 'M', '!', 'R', 'C', 'I', 'D', '!', 'F', 'I', 'L', 'E', '!', 'L', 'F',
     54            'I', 'L', '!', 'V', 'O', 'L', 'M', '!', 'I', 'M', 'P', 'L', '!', 'S', 'L', 'A', 'T', '!', 'W', 'L', 'O', 'N', '!', 'N', 'L', 'A', 'T', '!', 'E', 'L', 'O', 'N',
     55            '!', 'C', 'R', 'C', 'S', '!', 'C', 'O', 'M', 'T', 0x1f, '(', 'A', '(', '2', ')', ',', 'I', '(', '1', '0', ')', ',', '3', 'A', ',', 'A', '(', '3', ')', ',', '4',
     56            'R', ',', '2', 'A', ')', 0x1e,
     57            '0', '0', '1', '0', '1', ' ', 'D', ' ', ' ', ' ', ' ', ' ', '0', '0', '0', '5', '3', ' ', ' ', ' ', '5', '5', '0', '4',
     58            '0', '0', '0', '1', '0', '0', '0', '0', '6', '0', '0', '0', '0', '0', 'C', 'A', 'T', 'D', '0', '0', '0', '4', '2', '0', '0', '0', '0', '6', 0x1e,
     59            '0', '0', '0', '0', '0', 0x1e, 'C', 'D', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'C', 'A', 'T', 'A', 'L', 'O', 'G', '.', '0', '3', '1', 0x1f,
     60            0x1f, 'V', '0', '1', 'X', '0', '1', 0x1f, 'A', 'S', 'C', 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e
     61            // CHECKSTYLE.ON: LineLength
    5262    };
    53    
     63
    5464    static BufferedReader in;
    5565    static FileOutputStream out;
     
    5969    static ArrayList<Fparams> fields;
    6070    static byte[] record;
    61    
     71
    6272    public static void main(String[] args) throws IOException {
    6373
    6474        map = new S57map(false);
    6575        int idx = 0;
    66        
     76
    6777        if (args.length < 4) {
    6878            System.err.println("Usage: java -jar josmtos57.jar OSM_filename meta_data_filename S57_ENC_ROOT_directory S57_filename");
     
    96106            System.exit(-1);
    97107        }
    98        
     108
    99109        try {
    100110            buf = new byte[5242880];
     
    107117            System.exit(-1);
    108118        }
    109        
     119
    110120        CRC32 crc = new CRC32();
    111121        crc.update(buf, 0, idx);
     
    120130        }
    121131        out.close();
    122        
     132
    123133        buf = new byte[header.length];
    124134        System.arraycopy(header, 0, buf, 0, header.length);
     
    126136        int recs = 2;
    127137        fields = new ArrayList<>();
    128         fields.add(new Fparams(S57field.CATD, new Object[]{ "CD", recs, args[3], "", "V01X01", "BIN", Math.toDegrees(map.bounds.minlat),
    129                 Math.toDegrees(map.bounds.minlon), Math.toDegrees(map.bounds.maxlat), Math.toDegrees(map.bounds.maxlon), String.format("%08X", crc.getValue()), "" }));
     138        fields.add(new Fparams(S57field.CATD, new Object[]{"CD", recs, args[3], "", "V01X01", "BIN", Math.toDegrees(map.bounds.minlat),
     139                Math.toDegrees(map.bounds.minlon), Math.toDegrees(map.bounds.maxlat), Math.toDegrees(map.bounds.maxlon),
     140                String.format("%08X", crc.getValue()), ""}));
    130141        record = S57dat.encRecord(String.valueOf(recs++), fields);
    131142        buf = Arrays.copyOf(buf, (buf.length + record.length));
     
    144155        out.close();
    145156
    146 //        String[] dir = (new File(args[2]).list());
    147 //        for (String item : dir) {
    148 //            System.err.println(item);
    149 //        }
    150        
     157        //        String[] dir = (new File(args[2]).list());
     158        //        for (String item : dir) {
     159        //            System.err.println(item);
     160        //        }
     161
    151162        System.err.println("Finished");
    152163    }
  • applications/editors/josm/plugins/seachart/jplotter/src/jplotter/Jplotter.java

    r32906 r32907  
     1// License: GPL. For details, see LICENSE file.
    12package jplotter;
    23
    3 import java.awt.*;
    4 import javax.swing.*;
     4import java.awt.BorderLayout;
     5import java.awt.Container;
    56
    6 public class Jplotter {
     7import javax.swing.BorderFactory;
     8import javax.swing.JFrame;
     9import javax.swing.JPanel;
     10
     11/**
     12 * @author Malcolm Herring
     13 */
     14public final class Jplotter {
     15    private Jplotter() {
     16        // Hide default constructor for utilities classes
     17    }
    718
    819    public static void main(String[] args) {
  • 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) {
  • applications/editors/josm/plugins/seachart/js57toosm/src/js57toosm/Js57toosm.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/>.
     1// License: GPL. For details, see LICENSE file.
     2package js57toosm;
     3
     4import java.io.FileInputStream;
     5import java.io.IOException;
     6import java.io.PrintStream;
     7import java.util.ArrayList;
     8import java.util.Map;
     9import java.util.Scanner;
     10
     11import org.apache.commons.lang3.StringEscapeUtils;
     12
     13import s57.S57att;
     14import s57.S57att.Att;
     15import s57.S57dec;
     16import s57.S57map;
     17import s57.S57map.AttMap;
     18import s57.S57map.Feature;
     19import s57.S57map.GeomIterator;
     20import s57.S57map.ObjTab;
     21import s57.S57map.Pflag;
     22import s57.S57map.Prim;
     23import s57.S57map.Rflag;
     24import s57.S57map.Snode;
     25import s57.S57obj;
     26import s57.S57obj.Obj;
     27import s57.S57val;
     28import s57.S57val.AttVal;
     29
     30/**
     31 * @author Malcolm Herring
    832 */
    9 
    10 package js57toosm;
    11 
    12 import java.io.*;
    13 import java.util.*;
    14 
    15 import org.apache.commons.lang3.StringEscapeUtils;
    16 
    17 import s57.S57obj;
    18 import s57.S57obj.*;
    19 import s57.S57att;
    20 import s57.S57att.*;
    21 import s57.S57val;
    22 import s57.S57val.*;
    23 import s57.S57map;
    24 import s57.S57map.*;
    25 import s57.S57dec;
    26 
    27 public class Js57toosm {
    28    
     33public final class Js57toosm {
     34    private Js57toosm() {
     35        // Hide default constructor for utilities classes
     36    }
     37
    2938    static FileInputStream in;
    3039    static PrintStream out;
     
    3443        typatts.add(Att.PEREND); typatts.add(Att.PERSTA); typatts.add(Att.CONDTN); typatts.add(Att.CONRAD); typatts.add(Att.CONVIS);
    3544    }
    36    
     45
    3746    public static void main(String[] args) throws IOException {
    3847
     
    7180            System.exit(-1);
    7281        }
    73        
     82
    7483        map = new S57map(true);
    7584        S57dec.decodeChart(in, map);
     
    7887        out.format("<osm version='0.6' upload='false' generator='js57toosm'>%n");
    7988        out.format("<bounds minlat='%.8f' minlon='%.8f' maxlat='%.8f' maxlon='%.8f'/>%n",
    80                 Math.toDegrees(map.bounds.minlat), Math.toDegrees(map.bounds.minlon), Math.toDegrees(map.bounds.maxlat), Math.toDegrees(map.bounds.maxlon));
     89                Math.toDegrees(map.bounds.minlat), Math.toDegrees(map.bounds.minlon),
     90                Math.toDegrees(map.bounds.maxlat), Math.toDegrees(map.bounds.maxlon));
    8191
    8292        for (long id : map.index.keySet()) {
     
    91101                            while ((node = map.nodes.get(ref)) != null) {
    92102                                if (!done.contains(ref)) {
    93                                     out.format("  <node id='%d' lat='%.8f' lon='%.8f' version='1'>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon));
     103                                    out.format("  <node id='%d' lat='%.8f' lon='%.8f' version='1'>%n",
     104                                            -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon));
    94105                                    out.format("    <tag k='seamark:type' v=\"%s\"/>%n", type);
    95106                                    if ((feature.type == Obj.SOUNDG) && (node.flg == S57map.Nflag.DPTH))
    96                                         out.format("    <tag k='seamark:sounding:depth' v='%.1f'/>%n", ((Snode) node).val);
     107                                        out.format("    <tag k='seamark:sounding:depth' v='%.1f'/>%n", node.val);
    97108                                    writeAtts(feature);
    98109                                    out.format("  </node>%n");
     
    111122            if (!type.isEmpty() && (types.isEmpty() || types.contains(feature.type))) {
    112123                if (feature.reln == Rflag.MASTER) {
    113                     if ((feature.geom.prim == Pflag.LINE) || ((feature.geom.prim == Pflag.AREA) && (feature.geom.outers == 1) && (feature.geom.inners == 0))) {
     124                    if ((feature.geom.prim == Pflag.LINE) ||
     125                       ((feature.geom.prim == Pflag.AREA) && (feature.geom.outers == 1) && (feature.geom.inners == 0))) {
    114126                        GeomIterator git = map.new GeomIterator(feature.geom);
    115127                        while (git.hasComp()) {
     
    121133                                    Snode node = map.nodes.get(ref);
    122134                                    if (!done.contains(ref)) {
    123                                         out.format("  <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon));
     135                                        out.format("  <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n",
     136                                                -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon));
    124137                                        done.add(ref);
    125138                                    }
     
    152165                                    Snode node = map.nodes.get(ref);
    153166                                    if (!done.contains(ref)) {
    154                                         out.format("  <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n", -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon));
     167                                        out.format("  <node id='%d' lat='%.8f' lon='%.8f' version='1'/>%n",
     168                                                -ref, Math.toDegrees(node.lat), Math.toDegrees(node.lon));
    155169                                        done.add(ref);
    156170                                    }
     
    194208        System.err.println("Finished");
    195209    }
    196    
     210
    197211    static void writeAtts(Feature feature) {
    198212        for (Map.Entry<Att, AttVal<?>> item : feature.atts.entrySet()) {
     
    203217                    out.format("    <tag k='seamark:%s' v='%s'/>%n", attstr, StringEscapeUtils.escapeXml10(valstr));
    204218                } else {
    205                     out.format("    <tag k='seamark:%s:%s' v='%s'/>%n", S57obj.stringType(feature.type), attstr, StringEscapeUtils.escapeXml10(valstr));
     219                    out.format("    <tag k='seamark:%s:%s' v='%s'/>%n",
     220                            S57obj.stringType(feature.type), attstr, StringEscapeUtils.escapeXml10(valstr));
    206221                }
    207222            }
     
    216231                    if (!attstr.isEmpty() && !valstr.isEmpty()) {
    217232                        if ((ix == 0) && (tab.size() == 1)) {
    218                             out.format("    <tag k='seamark:%s:%s' v='%s'/>%n", S57obj.stringType(obj), attstr, StringEscapeUtils.escapeXml10(valstr));
     233                            out.format("    <tag k='seamark:%s:%s' v='%s'/>%n",
     234                                    S57obj.stringType(obj), attstr, StringEscapeUtils.escapeXml10(valstr));
    219235                        } else {
    220                             out.format("    <tag k='seamark:%s:%d:%s' v='%s'/>%n", S57obj.stringType(obj), ix + 1, attstr, StringEscapeUtils.escapeXml10(valstr));
     236                            out.format("    <tag k='seamark:%s:%d:%s' v='%s'/>%n",
     237                                    S57obj.stringType(obj), ix + 1, attstr, StringEscapeUtils.escapeXml10(valstr));
    221238                        }
    222239                    }
  • applications/editors/josm/plugins/seachart/src/render/ChartContext.java

    r32394 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 render;
    113
     
    179import s57.S57map.Snode;
    1810
     11/**
     12 * @author Malcolm Herring
     13 */
    1914public interface ChartContext {
    2015    enum RuleSet { ALL, BASE, SEAMARK }
  • applications/editors/josm/plugins/seachart/src/render/Renderer.java

    r32394 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 render;
    113
     
    4941import symbols.Symbols.Symbol;
    5042
    51 public class Renderer {
    52 
    53     public static final double[] symbolScale = {256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007 };
     43/**
     44 * @author Malcolm Herring
     45 */
     46public final class Renderer {
     47    private Renderer() {
     48        // Hide default constructor for utilities classes
     49    }
     50
     51    public static final double[] symbolScale = {
     52            256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007};
    5453
    5554    public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, PCLR, HCLR }
     
    260259                                if (!gap) {
    261260                                    Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(col),
    262                                             new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90))));
     261                                            new Delta(Handle.BC, AffineTransform.getRotateInstance(
     262                                                    Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90))));
    263263                                }
    264264                                if (space > 0)
     
    462462            double po = sw / 2;
    463463            label.add(new Instr(Form.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    464             Path2D.Double p = new Path2D.Double(); p.moveTo(-height*0.2, -ly-po); p.lineTo(height*0.2, -ly-po); p.moveTo(0, -ly-po); p.lineTo(0, -ly-po-(height*0.15));
     464            Path2D.Double p = new Path2D.Double(); p.moveTo(-height*0.2, -ly-po);
     465            p.lineTo(height*0.2, -ly-po); p.moveTo(0, -ly-po); p.lineTo(0, -ly-po-(height*0.15));
    465466            p.moveTo(-height*0.2, ly+po); p.lineTo((height*0.2), ly+po); p.moveTo(0, ly+po); p.lineTo(0, ly+po+(height*0.15));
    466467            label.add(new Instr(Form.PLIN, p));
     
    481482            po = sw / 2;
    482483            label.add(new Instr(Form.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    483             p = new Path2D.Double(); p.moveTo(-height*0.2, -ly-po); p.lineTo(height*0.2, -ly-po); p.moveTo(0, -ly-po); p.lineTo(0, -ly-po-(height*0.15));
    484             p.moveTo(-height*0.2, ly+po); p.lineTo((height*0.2), ly+po); p.moveTo(0, ly+po); p.lineTo(0, ly+po+(height*0.15));
     484            p = new Path2D.Double();
     485            p.moveTo(-height*0.2, -ly-po);
     486            p.lineTo(height*0.2, -ly-po);
     487            p.moveTo(0, -ly-po);
     488            p.lineTo(0, -ly-po-(height*0.15));
     489            p.moveTo(-height*0.2, ly+po);
     490            p.lineTo((height*0.2), ly+po);
     491            p.moveTo(0, ly+po);
     492            p.lineTo(0, ly+po+(height*0.15));
    485493            label.add(new Instr(Form.PLIN, p));
    486             label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, -width/2, 0)))));
    487             label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null, new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, width/2, 0)))));
     494            label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null,
     495                    new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, -width/2, 0)))));
     496            label.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Areas.CableFlash, 1, 0, 0, null,
     497                    new Delta(Handle.CC, new AffineTransform(0, -1, 1, 0, width/2, 0)))));
    488498            break;
    489499        case HCLR:
     
    502512            double vo = height / 4;
    503513            label.add(new Instr(Form.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    504             p = new Path2D.Double(); p.moveTo(-width*0.4-sw, -ly-vo); p.lineTo(-width*0.4-sw, ly+vo); p.moveTo(-width*0.4-sw, 0); p.lineTo(-width*0.4+sw, 0);
    505             p.moveTo(width*0.4+sw, -ly-vo); p.lineTo(width*0.4+sw, ly+vo); p.moveTo(width*0.4-sw, 0); p.lineTo(width*0.4+sw, 0);
     514            p = new Path2D.Double();
     515            p.moveTo(-width*0.4-sw, -ly-vo);
     516            p.lineTo(-width*0.4-sw, ly+vo);
     517            p.moveTo(-width*0.4-sw, 0);
     518            p.lineTo(-width*0.4+sw, 0);
     519            p.moveTo(width*0.4+sw, -ly-vo);
     520            p.lineTo(width*0.4+sw, ly+vo);
     521            p.moveTo(width*0.4-sw, 0);
     522            p.lineTo(width*0.4+sw, 0);
    506523            label.add(new Instr(Form.PLIN, p));
    507524            break;
     
    589606        }
    590607        double mid = (((s1 + s2) / 2) + (s1 > s2 ? 180 : 0)) % 360;
    591         g2.setStroke(new BasicStroke((float) (3.0 * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1, new float[] {20 * (float) sScale, 20 * (float) sScale}, 0));
     608        g2.setStroke(new BasicStroke((float) (3.0 * sScale), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1,
     609                new float[] {20 * (float) sScale, 20 * (float) sScale}, 0));
    592610        g2.setPaint(Color.black);
    593611        Point2D.Double centre = (Point2D.Double) context.getPoint(Rules.feature.geom.centre);
    594612        double radial = radius * context.mile(Rules.feature);
    595613        if (dir != null) {
    596             g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(dir)), centre.y + radial * Math.cos(Math.toRadians(dir))));
     614            g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(dir)),
     615                    centre.y + radial * Math.cos(Math.toRadians(dir))));
    597616        } else {
    598617            if ((s1 != 0.0) || (s2 != 360.0)) {
    599                 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s1)), centre.y + radial * Math.cos(Math.toRadians(s1))));
    600                 g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s2)), centre.y + radial * Math.cos(Math.toRadians(s2))));
     618                g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s1)),
     619                        centre.y + radial * Math.cos(Math.toRadians(s1))));
     620                g2.draw(new Line2D.Double(centre.x, centre.y, centre.x - radial * Math.sin(Math.toRadians(s2)),
     621                        centre.y + radial * Math.cos(Math.toRadians(s2))));
    601622            }
    602623        }
     
    604625        g2.setStroke(new BasicStroke((float) arcWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1));
    605626        g2.setPaint(col1);
    606         g2.draw(new Arc2D.Double(centre.x - radial, centre.y - radial, 2 * radial, 2 * radial, -(s1 + 90), ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN));
     627        g2.draw(new Arc2D.Double(centre.x - radial, centre.y - radial, 2 * radial, 2 * radial, -(s1 + 90),
     628                ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN));
    607629        if (col2 != null) {
    608630            g2.setPaint(col2);
    609             g2.draw(new Arc2D.Double(centre.x - radial + arcWidth, centre.y - radial + arcWidth, 2 * (radial - arcWidth), 2 * (radial - arcWidth), -(s1 + 90), ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN));
     631            g2.draw(new Arc2D.Double(centre.x - radial + arcWidth, centre.y - radial + arcWidth, 2 * (radial - arcWidth),
     632                    2 * (radial - arcWidth), -(s1 + 90), ((s1 < s2) ? (s1 - s2) : (s1 - s2 - 360)), Arc2D.OPEN));
    610633        }
    611634        if ((str != null) && (!str.isEmpty())) {
  • applications/editors/josm/plugins/seachart/src/render/Rules.java

    r32394 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 render;
    113
     
    8173import symbols.Topmarks;
    8274
     75/**
     76 * @author Malcolm Herring
     77 */
    8378public class Rules {
    8479
     
    257252
    258253    public static void rules() {
     254        // CHECKSTYLE.OFF: NeedBraces
    259255        if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) {
    260256            if (testObject(Obj.LNDARE)) for (Feature f : objects) if (testFeature(f)) areas();
     
    351347            if (testObject(Obj.BCNSPP)) for (Feature f : objects) if (testFeature(f)) beacons();
    352348        }
     349        // CHECKSTYLE.ON: NeedBraces
    353350    }
    354351
     
    417414                    Renderer.symbol(Areas.MarineFarm);
    418415                }
    419                 if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) || ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) {
     416                if ((feature.geom.area > 0.2) || ((feature.geom.area > 0.05) && (Renderer.zoom >= 14)) ||
     417                   ((feature.geom.area > 0.005) && (Renderer.zoom >= 16))) {
    420418                    Renderer.lineVector(new LineStyle(Color.black, 4, new float[] {10, 10}));
    421419                }
     
    450448                        Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40);
    451449                    } else {
    452                         Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     450                        Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black,
     451                                new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
    453452                    }
    454453                break;
     
    458457                        Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40);
    459458                    } else {
    460                         Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     459                        Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black,
     460                                new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
    461461                    }
    462462                break;
     
    466466                        Renderer.lineVector(new LineStyle(new Color(0xc480ff), 4, new float[] {25, 25}));
    467467                        if (name != null) {
    468                             Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     468                            Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black,
     469                                    new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
    469470                            Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
    470471                        }
     
    476477                    } else {
    477478                        if (name != null) {
    478                             Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     479                            Renderer.labelText(name, new Font("Arial", Font.ITALIC, 75), Color.black,
     480                                    new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
    479481                            Renderer.labelText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
    480482                        }
     
    554556                    AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
    555557                    if (topmap.containsKey(Att.TOPSHP)) {
    556                         Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.BeaconDelta);
     558                        Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     559                                getScheme(Obj.TOPMAR), Topmarks.BeaconDelta);
    557560                    }
    558561                } else if (feature.objs.containsKey(Obj.DAYMAR)) {
    559562                    AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
    560563                    if (topmap.containsKey(Att.TOPSHP)) {
    561                         Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.BeaconDelta);
     564                        Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     565                                getScheme(Obj.DAYMAR), Topmarks.BeaconDelta);
    562566                    }
    563567                }
     
    580584                AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
    581585                if (topmap.containsKey(Att.TOPSHP)) {
    582                     Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
     586                    Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     587                            getScheme(Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
    583588                }
    584589            } else if (feature.objs.containsKey(Obj.DAYMAR)) {
    585590                AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
    586591                if (topmap.containsKey(Att.TOPSHP)) {
    587                     Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape));
     592                    Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     593                            getScheme(Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape));
    588594                }
    589595            }
     
    621627                }
    622628                if (hstr.isEmpty() && !vstr.isEmpty()) {
    623                     Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC));
     629                    Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white,
     630                            new Delta(Handle.CC));
    624631                } else if (!hstr.isEmpty() && !vstr.isEmpty()) {
    625                     Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC));
    626                     Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC));
     632                    Renderer.labelText(vstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.VCLR, Color.black, Color.white,
     633                            new Delta(Handle.BC));
     634                    Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white,
     635                            new Delta(Handle.TC));
    627636                } else if (!hstr.isEmpty() && vstr.isEmpty()) {
    628                     Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC));
     637                    Renderer.labelText(hstr, new Font("Arial", Font.PLAIN, 30), Color.black, LabelStyle.HCLR, Color.black, Color.white,
     638                            new Delta(Handle.CC));
    629639                }
    630640            }
     
    645655                if (atts != null) {
    646656                    if (atts.containsKey(Att.VERCLR)) {
    647                         Renderer.labelText(String.valueOf(atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
     657                        Renderer.labelText(String.valueOf(atts.get(Att.VERCLR).val), new Font("Arial", Font.PLAIN, 50),
     658                                Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
    648659                    } else if (atts.containsKey(Att.VERCSA)) {
    649                         Renderer.labelText(String.valueOf(atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
     660                        Renderer.labelText(String.valueOf(atts.get(Att.VERCSA).val), new Font("Arial", Font.PLAIN, 50),
     661                                Color.black, LabelStyle.PCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
    650662                    }
    651663                }
     
    668680            String chn;
    669681            if (!(chn = getAttStr(feature.type, Att.COMCHA)).isEmpty()) {
    670                 Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 50)));
     682                Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black,
     683                        new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 50)));
    671684            }
    672685        }
     
    692705                    dd = (tok.length == 2) ? tok[1] : "";
    693706                }
    694                 Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 15)));
    695                 Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 0)));
    696                 Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(15, 10)));
     707                Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black,
     708                        new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 15)));
     709                Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black,
     710                        new Delta(Handle.RC, AffineTransform.getTranslateInstance(10, 0)));
     711                Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black,
     712                        new Delta(Handle.LC, AffineTransform.getTranslateInstance(15, 10)));
    697713            }
    698714            break;
     
    741757                    }
    742758                    str += String.format("%1.0f", dist);
    743                     Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45)));
     759                    Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black,
     760                            new Delta(Handle.CC, AffineTransform.getTranslateInstance(0, 45)));
    744761                }
    745762            }
     
    749766    @SuppressWarnings("unchecked")
    750767    private static void floats() {
    751         if ((Renderer.zoom >= 12) || ((Renderer.zoom >= 11) && ((feature.type == Obj.LITVES) || (feature.type == Obj.BOYINB) || hasObject(Obj.RTPBCN)))) {
     768        if ((Renderer.zoom >= 12) || ((Renderer.zoom >= 11) && ((feature.type == Obj.LITVES) ||
     769                (feature.type == Obj.BOYINB) || hasObject(Obj.RTPBCN)))) {
    752770            switch (feature.type) {
    753771            case LITVES:
     
    766784                AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
    767785                if (topmap.containsKey(Att.TOPSHP)) {
    768                     Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.FloatDelta);
     786                    Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     787                            getScheme(Obj.TOPMAR), Topmarks.FloatDelta);
    769788                }
    770789            } else if (feature.objs.containsKey(Obj.DAYMAR)) {
    771790                AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
    772791                if (topmap.containsKey(Att.TOPSHP)) {
    773                     Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.FloatDelta);
     792                    Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     793                            getScheme(Obj.DAYMAR), Topmarks.FloatDelta);
    774794                }
    775795            }
     
    795815                Renderer.symbol(Harbours.Anchor, new Scheme(Symbols.Msymb));
    796816                if (Renderer.zoom >= 15) {
    797                     Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC));
     817                    Renderer.labelText(name == null ? "" : name,
     818                            new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC));
    798819                }
    799820            }
     
    820841                ArrayList<StsSTS> sts = (ArrayList<StsSTS>) getAttList(Obj.ACHARE, Att.STATUS);
    821842                if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) {
    822                     Renderer.labelText("Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
     843                    Renderer.labelText("Reserved",
     844                            new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
    823845                }
    824846                ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(Obj.ACHARE, Att.CATACH);
     
    827849                    switch (cat) {
    828850                    case ACH_DEEP:
    829                         Renderer.labelText("DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     851                        Renderer.labelText("DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb,
     852                                new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    830853                        dy += 60;
    831854                        break;
    832855                    case ACH_TANK:
    833                         Renderer.labelText("Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     856                        Renderer.labelText("Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb,
     857                                new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    834858                        dy += 60;
    835859                        break;
    836860                    case ACH_H24P:
    837                         Renderer.labelText("24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     861                        Renderer.labelText("24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb,
     862                                new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    838863                        dy += 60;
    839864                        break;
    840865                    case ACH_EXPL:
    841                         Renderer.symbol(Harbours.Explosives, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     866                        Renderer.symbol(Harbours.Explosives, new Scheme(Symbols.Msymb),
     867                                new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    842868                        dy += 60;
    843869                        break;
    844870                    case ACH_QUAR:
    845                         Renderer.symbol(Harbours.Hospital, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     871                        Renderer.symbol(Harbours.Hospital, new Scheme(Symbols.Msymb),
     872                                new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    846873                        dy += 60;
    847874                        break;
    848875                    case ACH_SEAP:
    849                         Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     876                        Renderer.symbol(Areas.Seaplane, new Scheme(Symbols.Msymb),
     877                                new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    850878                        dy += 60;
    851879                        break;
     
    858886            if (Renderer.zoom >= 14) {
    859887                Renderer.lineVector(new LineStyle(Symbols.Mline, 6, new float[] {20, 20}));
    860                 Renderer.labelText(name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white);
     888                Renderer.labelText(name == null ? " " : name,
     889                        new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white);
    861890            }
    862891            break;
     
    10341063                AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0);
    10351064                if (topmap.containsKey(Att.TOPSHP)) {
    1036                     Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.TOPMAR), Topmarks.LightDelta);
     1065                    Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     1066                            getScheme(Obj.TOPMAR), Topmarks.LightDelta);
    10371067                }
    10381068            } else if (feature.objs.containsKey(Obj.DAYMAR)) {
    10391069                AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0);
    10401070                if (topmap.containsKey(Att.TOPSHP)) {
    1041                     Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)), getScheme(Obj.DAYMAR), Topmarks.LightDelta);
     1071                    Renderer.symbol(Topmarks.Shapes.get(((ArrayList<TopSHP>) (topmap.get(Att.TOPSHP).val)).get(0)),
     1072                            getScheme(Obj.DAYMAR), Topmarks.LightDelta);
    10421073                }
    10431074            }
     
    12151246                    }
    12161247                    if (verclr > 0) {
    1217                         Renderer.labelText(String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR, Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
     1248                        Renderer.labelText(String.valueOf(verclr), new Font("Arial", Font.PLAIN, 50), Color.black, LabelStyle.VCLR,
     1249                                Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 25)));
    12181250                    }
    12191251                }
     
    14001432                Renderer.symbol(Harbours.SignalStation);
    14011433                Renderer.symbol(Beacons.RadarStation);
    1402                 Renderer.labelText("Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
     1434                Renderer.labelText("Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb,
     1435                        new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
    14031436                break;
    14041437            case PILBOP:
    14051438                Renderer.symbol(Harbours.Pilot);
    1406                 addName(15, new Font("Arial", Font.BOLD, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
     1439                addName(15, new Font("Arial", Font.BOLD, 40), Symbols.Msymb,
     1440                        new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
    14071441                CatPIL cat = (CatPIL) getAttEnum(feature.type, Att.CATPIL);
    14081442                if (cat == CatPIL.PIL_HELI) {
    1409                     Renderer.labelText("H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
     1443                    Renderer.labelText("H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb,
     1444                            new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
    14101445                }
    14111446                break;
     
    14131448                Renderer.symbol(Harbours.SignalStation);
    14141449                str = "CG";
    1415                 if (feature.objs.containsKey(Obj.RSCSTA)) Renderer.symbol(Harbours.Rescue, new Delta(Handle.CC, AffineTransform.getTranslateInstance(130, 0)));
     1450                if (feature.objs.containsKey(Obj.RSCSTA)) Renderer.symbol(Harbours.Rescue,
     1451                        new Delta(Handle.CC, AffineTransform.getTranslateInstance(130, 0)));
    14161452                break;
    14171453            case RSCSTA:
     
    14221458            }
    14231459            if ((Renderer.zoom >= 15) && !str.isEmpty()) {
    1424                 Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(40, 0)));
     1460                Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black,
     1461                        new Delta(Handle.LC, AffineTransform.getTranslateInstance(40, 0)));
    14251462            }
    14261463            Signals.addSignals();
  • applications/editors/josm/plugins/seachart/src/render/Signals.java

    r32394 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 render;
    113
     
    3527import symbols.Topmarks;
    3628
     29/**
     30 * @author Malcolm Herring
     31 */
    3732public class Signals extends Rules {
    3833
     
    194189                }
    195190                if (!str.isEmpty()) {
    196                     Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30)));
     191                    Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black,
     192                            new Delta(Handle.TR, AffineTransform.getTranslateInstance(-60, -30)));
    197193                }
    198194            }
     
    241237            }
    242238            if (!bstr.isEmpty()) {
    243                 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
     239                Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb,
     240                        new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
    244241            }
    245242        }
     
    358355        if (Renderer.zoom >= 15) {
    359356            if (vais) {
    360                 Renderer.labelText("V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));
     357                Renderer.labelText("V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb,
     358                        new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));
    361359            }
    362360            if (!bstr.isEmpty()) {
    363                 Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));
     361                Renderer.labelText(bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb,
     362                        new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));
    364363            }
    365364        }
     
    398397            }
    399398        }
    400         Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120))));
     399        Renderer.symbol(Beacons.LightFlare, new Scheme(LightColours.get(col)),
     400                new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.toRadians(120))));
    401401        if (Renderer.zoom >= 12) {
    402402            String str = "";
     
    438438                                    }
    439439                                    if (srad == radius) {
    440                                         ArrayList<CatLIT> scats = (satts.containsKey(Att.CATLIT)) ? (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<CatLIT>();
     440                                        ArrayList<CatLIT> scats = (satts.containsKey(Att.CATLIT)) ?
     441                                                (ArrayList<CatLIT>) satts.get(Att.CATLIT).val : new ArrayList<>();
    441442                                        if (scats.contains(CatLIT.LIT_DIR)) {
    442443                                            if (satts.containsKey(Att.ORIENT)) {
     
    504505                    }
    505506                    if ((s1 <= 360) && (s2 <= 360) && (s1 != s2))
    506                         Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir, (Renderer.zoom >= 15) ? str : "");
     507                        Renderer.lightSector(LightColours.get(col1), LightColours.get(col2), radius, s1, s2, dir,
     508                                (Renderer.zoom >= 15) ? str : "");
    507509                }
    508510                if (Renderer.zoom >= 15) {
     
    545547                        sect.rng = atts.containsKey(Att.VALNMR) ? (Double) atts.get(Att.VALNMR).val : 0.0;
    546548                        sect.hgt = atts.containsKey(Att.HEIGHT) ? (Double) atts.get(Att.HEIGHT).val : 0.0;
    547                         ArrayList<ColCOL> cols = (ArrayList<ColCOL>) (atts.containsKey(Att.COLOUR) ? atts.get(Att.COLOUR).val : new ArrayList<>());
     549                        ArrayList<ColCOL> cols = (ArrayList<ColCOL>)
     550                                (atts.containsKey(Att.COLOUR) ? atts.get(Att.COLOUR).val : new ArrayList<>());
    548551                        sect.col = cols.size() > 0 ? cols.get(0) : ColCOL.COL_UNK;
    549552                        if ((sect.chr != LitCHR.CHR_UNKN) && (sect.col != null))
     
    555558                        for (ArrayList<LitSect> group : groupings) {
    556559                            LitSect mem = group.get(0);
    557                             if ((lit.dir == mem.dir) && (lit.chr == mem.chr) && (lit.grp.equals(mem.grp)) && (lit.per == mem.per) && (lit.hgt == mem.hgt)) {
     560                            if ((lit.dir == mem.dir) && (lit.chr == mem.chr) && (lit.grp.equals(mem.grp)) &&
     561                                (lit.per == mem.per) && (lit.hgt == mem.hgt)) {
    558562                                group.add(lit);
    559563                                found = true;
     
    630634                            str += df.format(tmp.hgt) + "m";
    631635                        if (colrng.get(0).rng > 0)
    632                             str += df.format(colrng.get(0).rng) + ((colrng.size() > 1) ? ((colrng.size() > 2) ? ("-" + df.format(colrng.get(colrng.size() - 1).rng)) : ("/" + df.format(colrng.get(1).rng))) : "") + "M";
    633                         Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y)));
     636                            str += df.format(colrng.get(0).rng) + ((colrng.size() > 1) ? ((colrng.size() > 2) ?
     637                                    ("-" + df.format(colrng.get(colrng.size() - 1).rng)) : ("/" + df.format(colrng.get(1).rng))) : "") + "M";
     638                        Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black,
     639                                new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, y)));
    634640                        y += 40;
    635641                        str = "";
     
    680686                    str += (cats.contains(CatLIT.LIT_VERT)) ? "(vert)" : "";
    681687                    str += (cats.contains(CatLIT.LIT_HORI)) ? "(hor)" : "";
    682                     str += (!str.isEmpty() && (atts.containsKey(Att.SIGPER) || atts.containsKey(Att.HEIGHT) || atts.containsKey(Att.VALMXR)) && !str.endsWith(")")) ? "." : "";
     688                    str += (!str.isEmpty() && (atts.containsKey(Att.SIGPER) || atts.containsKey(Att.HEIGHT) || atts.containsKey(Att.VALMXR))
     689                            && !str.endsWith(")")) ? "." : "";
    683690                    str += (atts.containsKey(Att.SIGPER)) ? df.format(atts.get(Att.SIGPER).val) + "s" : "";
    684691                    str += (atts.containsKey(Att.HEIGHT)) ? df.format(atts.get(Att.HEIGHT).val) + "m" : "";
     
    688695                    str += (cats.contains(CatLIT.LIT_UPPR)) ? "(Upper)" : "";
    689696                    str += (cats.contains(CatLIT.LIT_LOWR)) ? "(Lower)" : "";
    690                     Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30)));
     697                    Renderer.labelText(str, new Font("Arial", Font.PLAIN, 40), Color.black,
     698                            new Delta(Handle.TL, AffineTransform.getTranslateInstance(60, -30)));
    691699                }
    692700            }
  • applications/editors/josm/plugins/seachart/src/s57/S57att.java

    r32394 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 s57;
    113
     
    157import s57.S57obj.Obj;
    168
    17 public class S57att { // S57 Attribute lookup tables & methods
     9/**
     10 * @author Malcolm Herring
     11 */
     12public final class S57att { // S57 Attribute lookup tables & methods
     13    private S57att() {
     14        // Hide default constructor for utilities classes
     15    }
    1816    // CHECKSTYLE.OFF: LineLength
    1917
  • applications/editors/josm/plugins/seachart/src/s57/S57box.java

    r32394 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 s57;
    113
     
    1911import s57.S57obj.Obj;
    2012
    21 public class S57box { //S57 bounding box truncation
     13/**
     14 * @author Malcolm Herring
     15 */
     16public final class S57box { //S57 bounding box truncation
     17    private S57box() {
     18        // Hide default constructor for utilities classes
     19    }
    2220    // CHECKSTYLE.OFF: LineLength
    2321
  • applications/editors/josm/plugins/seachart/src/s57/S57dat.java

    r32394 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 s57;
    113
     
    1911import s57.S57obj.Obj;
    2012
    21 public class S57dat { // S57 ENC file fields lookup tables & methods
     13/**
     14 * @author Malcolm Herring
     15 */
     16public final class S57dat { // S57 ENC file fields lookup tables & methods
     17    private S57dat() {
     18        // Hide default constructor for utilities classes
     19    }
    2220    // CHECKSTYLE.OFF: LineLength
    2321
  • applications/editors/josm/plugins/seachart/src/s57/S57dec.java

    r32394 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 s57;
    113
     
    179import s57.S57map.Nflag;
    1810
    19 public class S57dec { // S57 ENC file input & map conversion
     11/**
     12 * @author Malcolm Herring
     13 */
     14public final class S57dec { // S57 ENC file input & map conversion
     15    private S57dec() {
     16        // Hide default constructor for utilities classes
     17    }
    2018    // CHECKSTYLE.OFF: LineLength
    2119
  • applications/editors/josm/plugins/seachart/src/s57/S57enc.java

    r32394 r32907  
    1 /* Copyright 2015 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 s57;
    113
     
    3325import s57.S57val.AttVal;
    3426
    35 public class S57enc { // S57 ENC file generation
     27/**
     28 * @author Malcolm Herring
     29 */
     30public final class S57enc { // S57 ENC file generation
     31    private S57enc() {
     32        // Hide default constructor for utilities classes
     33    }
    3634    // CHECKSTYLE.OFF: LineLength
    3735
  • applications/editors/josm/plugins/seachart/src/s57/S57map.java

    r32394 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 s57;
    113
     
    2012import s57.S57val.AttVal;
    2113
     14/**
     15 * @author Malcolm Herring
     16 */
    2217public class S57map { // S57/OSM map generation methods
    2318    // CHECKSTYLE.OFF: LineLength
  • applications/editors/josm/plugins/seachart/src/s57/S57obj.java

    r32394 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 s57;
    113
     
    146import java.util.Map;
    157
    16 public class S57obj { // S57 Object lookup tables & methods
     8/**
     9 * @author Malcolm Herring
     10 */
     11public final class S57obj { // S57 Object lookup tables & methods
     12    private S57obj() {
     13        // Hide default constructor for utilities classes
     14    }
    1715    // CHECKSTYLE.OFF: LineLength
    1816
  • applications/editors/josm/plugins/seachart/src/s57/S57osm.java

    r32394 r32907  
    1 /* Copyright 2015 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 s57;
    113
     
    2012import s57.S57val.Conv;
    2113
    22 public class S57osm { // OSM to S57 Object/Attribute and Object/Primitive conversions
     14/**
     15 * @author Malcolm Herring
     16 */
     17public final class S57osm { // OSM to S57 Object/Attribute and Object/Primitive conversions
     18    private S57osm() {
     19        // Hide default constructor for utilities classes
     20    }
     21
    2322    // CHECKSTYLE.OFF: LineLength
    2423
  • applications/editors/josm/plugins/seachart/src/s57/S57val.java

    r32394 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 s57;
    113
     
    157import s57.S57att.Att;
    168
    17 public class S57val { // S57 Attribute values lookup tables & methods
     9/**
     10 * @author Malcolm Herring
     11 */
     12public final class S57val { // S57 Attribute values lookup tables & methods
     13    private S57val() {
     14        // Hide default constructor for utilities classes
     15    }
     16
    1817    // CHECKSTYLE.OFF: LineLength
    1918
  • applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java

    r32679 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 seachart;
    113
     
    3830import symbols.Symbols;
    3931
     32/**
     33 * @author Malcolm Herring
     34 */
    4035public class ChartImage extends ImageryLayer implements ZoomChangeListener, ChartContext {
    4136
  • applications/editors/josm/plugins/seachart/src/seachart/Seachart.java

    r32394 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 seachart;
    113
     
    157import org.openstreetmap.josm.plugins.PluginInformation;
    168
     9/**
     10 * @author Malcolm Herring
     11 */
    1712public class Seachart extends Plugin {
    1813
  • applications/editors/josm/plugins/seachart/src/seachart/SeachartAction.java

    r32394 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 seachart;
    113
     
    4537import s57.S57map;
    4638
     39/**
     40 * @author Malcolm Herring
     41 */
    4742public class SeachartAction extends JosmAction implements ActiveLayerChangeListener, LayerChangeListener {
    4843    private static String title = "SeaChart";
     
    117112    public void actionPerformed(ActionEvent arg0) {
    118113        SwingUtilities.invokeLater(new Runnable() {
     114            @Override
    119115            public void run() {
    120116                if (!isOpen)
  • applications/editors/josm/plugins/seachart/src/symbols/Areas.java

    r32394 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 symbols;
    113
     
    2618import symbols.Symbols.Symbol;
    2719
    28 public class Areas {
     20/**
     21 * @author Malcolm Herring
     22 */
     23public final class Areas {
     24    private Areas() {
     25        // Hide default constructor for utilities classes
     26    }
     27
    2928    // CHECKSTYLE.OFF: LineLength
    3029    public static final Symbol Plane = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Beacons.java

    r32394 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 symbols;
    113
     
    2517import symbols.Symbols.Symbol;
    2618
    27 public class Beacons {
     19/**
     20 * @author Malcolm Herring
     21 */
     22public final class Beacons {
     23    private Beacons() {
     24        // Hide default constructor for utilities classes
     25    }
     26
    2827    // CHECKSTYLE.OFF: LineLength
    2928    public static final Symbol Beacon = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Buoys.java

    r32394 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 symbols;
    113
     
    2315import symbols.Symbols.Symbol;
    2416
    25 public class Buoys {
     17/**
     18 * @author Malcolm Herring
     19 */
     20public final class Buoys {
     21    private Buoys() {
     22        // Hide default constructor for utilities classes
     23    }
     24
    2625    // CHECKSTYLE.OFF: LineLength
    2726    public static final Symbol Barrel = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Facilities.java

    r32394 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 symbols;
    113
     
    2618import symbols.Symbols.Symbol;
    2719
    28 public class Facilities {
     20/**
     21 * @author Malcolm Herring
     22 */
     23public final class Facilities {
     24    private Facilities() {
     25        // Hide default constructor for utilities classes
     26    }
     27
    2928    // CHECKSTYLE.OFF: LineLength
    3029    private static final Symbol Facility = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Harbours.java

    r32394 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 symbols;
    113
     
    2416import symbols.Symbols.Symbol;
    2517
    26 public class Harbours {
     18/**
     19 * @author Malcolm Herring
     20 */
     21public final class Harbours {
     22    private Harbours() {
     23        // Hide default constructor for utilities classes
     24    }
     25
    2726    // CHECKSTYLE.OFF: LineLength
    2827    public static final Symbol Anchor = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Landmarks.java

    r32394 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 symbols;
    113
     
    2416import symbols.Symbols.Symbol;
    2517
    26 public class Landmarks {
     18/**
     19 * @author Malcolm Herring
     20 */
     21public final class Landmarks {
     22    private Landmarks() {
     23        // Hide default constructor for utilities classes
     24    }
     25
    2726    // CHECKSTYLE.OFF: LineLength
    2827    private static final Symbol Base = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Notices.java

    r32394 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 symbols;
    113
     
    3527import symbols.Symbols.Symbol;
    3628
    37 public class Notices {
     29/**
     30 * @author Malcolm Herring
     31 */
     32public final class Notices {
     33    private Notices() {
     34        // Hide default constructor for utilities classes
     35    }
     36
    3837    // CHECKSTYLE.OFF: LineLength
    3938    private static final Symbol Bollard = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Symbols.java

    r32394 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 symbols;
    113
     
    2517import java.util.ArrayList;
    2618
    27 public class Symbols {
     19/**
     20 * @author Malcolm Herring
     21 */
     22public final class Symbols {
     23    private Symbols() {
     24        // Hide default constructor for utilities classes
     25    }
     26
    2827    // CHECKSTYLE.OFF: LineLength
    2928    public static final Color Yland = new Color(0xedbc0c);
  • applications/editors/josm/plugins/seachart/src/symbols/Topmarks.java

    r32394 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 symbols;
    113
     
    2820import symbols.Symbols.Symbol;
    2921
    30 public class Topmarks {
     22/**
     23 * @author Malcolm Herring
     24 */
     25public final class Topmarks {
     26
     27    private Topmarks() {
     28        // Hide default constructor for utilities classes
     29    }
     30
    3131    // CHECKSTYLE.OFF: LineLength
    3232    public static final Symbol RadarReflector = new Symbol();
Note: See TracChangeset for help on using the changeset viewer.