Ignore:
Timestamp:
2015-03-03T17:08:26+01:00 (10 years ago)
Author:
malcolmh
Message:

[seachart]update & tidy directories

Location:
applications/editors/josm/plugins/seachart
Files:
4 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/build.xml

    r30894 r31044  
    22<project name="SeaChart" default="dist" basedir=".">
    33    <!-- enter the SVN commit message -->
    4     <property name="commit.message" value="New release"/>
     4    <property name="commit.message" value="[Seachart] Publish new release"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    66    <property name="plugin.main.version" value="7001"/>
  • applications/editors/josm/plugins/seachart/jicons/src/jicons/Jicons.java

    r30894 r31044  
    1919import java.awt.Dimension;
    2020import java.awt.Graphics2D;
     21import java.awt.Rectangle;
    2122import java.awt.geom.Point2D;
    2223import java.awt.image.BufferedImage;
     
    3132
    3233import s57.S57map;
    33 import s57.S57map.Feature;
    34 import s57.S57map.Snode;
     34import s57.S57map.*;
    3535import render.*;
     36import render.Rules.RuleSet;
    3637
    3738public class Jicons {
     
    7879                                                        img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    7980                                                        g2 = img.createGraphics();
    80                                                         Renderer.reRender(g2, 16, s / Renderer.symbolScale[16], map, context);
     81                                                        Renderer.reRender(g2, RuleSet.SEAMARK, new Rectangle(x, y, w, h), 16, s / Renderer.symbolScale[16], map, context);
    8182                                                        try {
    8283                                                                ImageIO.write(img, "png", new File(args[1] + file + ".png"));
     
    9293                                                        SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
    9394                                                        svgGenerator.setSVGCanvasSize(new Dimension(w, h));
    94                                                         Renderer.reRender(svgGenerator, 16, s / Renderer.symbolScale[16], map, context);
     95                                                        Renderer.reRender(svgGenerator, RuleSet.SEAMARK, new Rectangle(x, y, w, h), 16, s / Renderer.symbolScale[16], map, context);
    9596                                                        boolean useCSS = true;
    9697                                                        Writer out = null;
  • applications/editors/josm/plugins/seachart/jrender/src/jrender/Jrender.java

    r31031 r31044  
    1010package jrender;
    1111
    12 import java.awt.Dimension;
    1312import java.awt.Graphics2D;
    1413import java.awt.Rectangle;
     
    3231import org.w3c.dom.Document;
    3332
    34 import render.ChartContext;
    35 import render.Renderer;
    36 import render.Rules;
    3733import s57.S57map;
    3834import s57.S57map.Feature;
    3935import s57.S57map.Snode;
     36import symbols.*;
     37import render.*;
     38import render.Rules.RuleSet;
    4039
    4140public class Jrender {
     
    214213                Rectangle rect = new Rectangle(size, size);
    215214                img = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_ARGB);
    216                 Renderer.reRender(img.createGraphics(), rect, zoom, 0.05, map, context);
     215                Renderer.reRender(img.createGraphics(), RuleSet.BASE, rect, zoom, 0.05, map, context);
    217216                ByteArrayOutputStream bos = new ByteArrayOutputStream();
    218217                ImageIO.write(img, "png", bos);
     
    227226                        Document document = domImpl.createDocument("http://www.w3.org/2000/svg", "svg", null);
    228227                        SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
    229                         svgGenerator.setBackground(Rules.Bwater);
     228                        svgGenerator.setBackground(Symbols.Bwater);
    230229                        svgGenerator.clearRect(rect.x, rect.y, rect.width, rect.height);
    231230                        svgGenerator.setSVGCanvasSize(rect.getSize());
    232231                        svgGenerator.setClip(rect.x, rect.y, rect.width, rect.height);
    233232//                      svgGenerator.translate(-256, -256);
    234                         Renderer.reRender(svgGenerator, rect, zoom, 0.05, map, context);
     233                        Renderer.reRender(svgGenerator, RuleSet.BASE, rect, zoom, 0.05, map, context);
    235234                        svgGenerator.stream(dstdir + "tst_" + zoom + "-" + xtile + "-" + ytile + ".svg");
    236235//              }
     
    245244                g2.scale(s, s);
    246245                g2.translate(-(256 + (xn * 256 / s)), -(256 + (yn * 256 / s)));
    247                 Renderer.reRender(g2, new Rectangle(256, 256), zoom, 1, map, context);
     246                Renderer.reRender(g2, RuleSet.BASE, new Rectangle(256, 256), zoom, 1, map, context);
    248247                ByteArrayOutputStream bos = new ByteArrayOutputStream();
    249248                ImageIO.write(img, "png", bos);
  • applications/editors/josm/plugins/seachart/js57toosm/src/js57toosm/Js57toosm.java

    r30894 r31044  
    146146                                                        out.format("  </way>%n");
    147147                                                }
    148                                                 out.format("  <relation id='%d' version='1'>%n", -map.ref++);
     148                                                out.format("  <relation id='%d' version='1'>%n", -map.xref++);
    149149                                                out.format("    <tag k='type' v='multipolygon'/>%n");
    150150                                                git = map.new GeomIterator(feature.geom);
  • applications/editors/josm/plugins/seachart/src/render/Renderer.java

    r31031 r31044  
    3636        static int zoom;
    3737
    38         public static void reRender(Graphics2D g, Rectangle rect, int z, double factor, S57map m, ChartContext c) {
     38        public static void reRender(Graphics2D g, RuleSet set, Rectangle rect, int z, double factor, S57map m, ChartContext c) {
    3939                g2 = g;
    4040                zoom = z;
     
    4343                sScale = symbolScale[zoom] * factor;
    4444                if (map != null) {
    45                         g2.setBackground(Rules.Bwater);
     45                        g2.setBackground(Symbols.Bwater);
    4646                        g2.clearRect(rect.x, rect.y, rect.width, rect.height);
    4747                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    4848                        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    4949                        g2.setStroke(new BasicStroke(0, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
    50                         Rules.rules(RuleSet.BASE);
     50                        Rules.rules(set);
    5151                }
    5252        }
     
    327327        }
    328328
    329        
    330329        public static void fillPattern(Feature feature, BufferedImage image) {
    331330                Path2D.Double p = new Path2D.Double();
  • applications/editors/josm/plugins/seachart/src/render/Rules.java

    r31028 r31044  
    3030        public enum RuleSet { ALL, BASE, SEAMARK }
    3131
    32         public static final Color Yland = new Color(0xdcb820);
    33         public static final Color Bwater = new Color(0x3ea8c8);
    34         public static final Color Gdries = new Color(0x50b050);
    35         public static final Color Mline = new Color(0xc480ff);
    36         public static final Color Msymb = new Color(0xa30075);
    37        
    3832        static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class);
    3933        static {
     
    129123                ArrayList<?> list = (ArrayList<?>)getAttVal(feature, obj, idx, att);
    130124                if (list != null) {
    131                         return ((ArrayList<Enum>)list).get(0);
     125                        return ((ArrayList<Enum<?>>)list).get(0);
    132126                }
    133127                return S57val.unknAtt(att);
     
    179173        static Feature feature;
    180174        static ArrayList<Feature> objects;
    181         static RuleSet ruleset;
     175        static RuleSet ruleset;
     176       
    182177        static boolean testObject(Obj obj) {
    183178                return ((objects = Renderer.map.features.get(obj)) != null);
     
    290285                        Double depmax = 0.0;
    291286                        if (((depmax = (Double) getAttVal(feature, Obj.DEPARE, 0, Att.DRVAL2)) != null) && (depmax <= 0.0)) {
    292                                 Renderer.lineVector(feature, new LineStyle(Gdries));
     287                                Renderer.lineVector(feature, new LineStyle(Symbols.Gdries));
    293288                        }
    294289                        break;
    295290                case LAKARE:
    296291                case RIVBNK:
    297                         Renderer.lineVector(feature, new LineStyle(Bwater, 10, Bwater));
     292                        Renderer.lineVector(feature, new LineStyle(Symbols.Bwater, 10, Symbols.Bwater));
    298293                        break;
    299294                case DRGARE:
     
    307302                        if (feature.geom.area > 2.0) {
    308303                                if (Renderer.zoom < 16)
    309                                         Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
     304                                        Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
    310305                                else
    311                                         Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }));
     306                                        Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 8, new float[] { 50, 50 }));
    312307                        } else {
    313308                                if (Renderer.zoom >= 14)
     
    318313                case LOKBSN:
    319314                case HRBBSN:
    320                         Renderer.lineVector(feature, new LineStyle(Color.black, 10, Bwater));
     315                        Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Bwater));
    321316                        break;
    322317                case HRBFAC:
    323318                        if (feature.objs.get(Obj.HRBBSN) != null) {
    324                                 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Bwater));
     319                                Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Bwater));
    325320                        }
    326321                        break;
    327322                case LNDARE:
    328                         Renderer.lineVector(feature, new LineStyle(Yland));
     323                        Renderer.lineVector(feature, new LineStyle(Symbols.Yland));
    329324                        break;
    330325                case MARCUL:
     
    348343                case MIPARE:
    349344                        if (Renderer.zoom >= 12) {
    350                                 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Mline);
     345                                Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Symbols.Mline);
    351346                                if (testAttribute(feature, feature.type, 0, Att.CATREA, CatREA.REA_NWAK)) {
    352347                                        Renderer.symbol(feature, Areas.NoWake);
     
    406401                case SPLARE:
    407402                        if (Renderer.zoom >= 12) {
    408                                 Renderer.symbol(feature, Areas.Plane, new Scheme(Msymb));
    409                                 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Mline);
     403                                Renderer.symbol(feature, Areas.Plane, new Scheme(Symbols.Msymb));
     404                                Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Symbols.Mline);
    410405                        }
    411406                        addName(feature, 15, new Font("Arial", Font.BOLD, 80), new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -90)));
     
    525520                if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
    526521                        if (feature.type == Obj.CBLSUB) {
    527                                 Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Mline);
     522                                Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Symbols.Mline);
    528523                        } else if (feature.type == Obj.CBLOHD) {
    529524                                AttMap atts = feature.objs.get(Obj.CBLOHD).get(0);
     
    637632                case ACHBRT:
    638633                        if (Renderer.zoom >= 14) {
    639                                 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline));
     634                                Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Symbols.Mline));
    640635                                if (Renderer.zoom >= 15) {
    641                                         Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Msymb, LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC));
     636                                        Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white, new Delta(Handle.BC));
    642637                                }
    643638                        }
     
    649644                                                units = UniHLU.HLU_METR;
    650645                                        }
    651                                         Renderer.lineCircle(feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units);
     646                                        Renderer.lineCircle(feature, new LineStyle(Symbols.Mline, 4, new float[] { 10, 10 }, null), radius, units);
    652647                                }
    653648                        }
     
    658653                                        Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Color.black));
    659654                                } else {
    660                                         Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline));
    661                                         Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Mline);
    662                                 }
    663                                 addName(feature, 15, new Font("Arial", Font.BOLD, 60), Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
     655                                        Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Symbols.Mline));
     656                                        Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Symbols.Mline);
     657                                }
     658                                addName(feature, 15, new Font("Arial", Font.BOLD, 60), Symbols.Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
    664659                                ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttList(feature, Obj.ACHARE, 0, Att.STATUS);
    665660                                if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) {
    666                                         Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
     661                                        Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Symbols.Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
    667662                                }
    668663                        }
     
    672667                                switch (cat) {
    673668                                case ACH_DEEP:
    674                                         Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     669                                        Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    675670                                        dy += 60;
    676671                                        break;
    677672                                case ACH_TANK:
    678                                         Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     673                                        Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    679674                                        dy += 60;
    680675                                        break;
    681676                                case ACH_H24P:
    682                                         Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     677                                        Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Symbols.Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    683678                                        dy += 60;
    684679                                        break;
    685680                                case ACH_EXPL:
    686                                         Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     681                                        Renderer.symbol(feature, Harbours.Explosives, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    687682                                        dy += 60;
    688683                                        break;
    689684                                case ACH_QUAR:
    690                                         Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     685                                        Renderer.symbol(feature, Harbours.Hospital, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    691686                                        dy += 60;
    692687                                        break;
    693688                                case ACH_SEAP:
    694                                         Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     689                                        Renderer.symbol(feature, Areas.Seaplane, new Scheme(Symbols.Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    695690                                        dy += 60;
    696691                                        break;
     
    701696                case BERTHS:
    702697                        if (Renderer.zoom >= 14) {
    703                                 Renderer.lineVector(feature, new LineStyle(Mline, 6, new float[] { 20, 20 }));
    704                                 Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Msymb, LabelStyle.RRCT, Mline, Color.white);
     698                                Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 6, new float[] { 20, 20 }));
     699                                Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white);
    705700                        }
    706701                        break;
     
    961956                if ((Renderer.zoom >= 16) && (feature.geom.length < 2)) {
    962957                        if (feature.type == Obj.PIPSOL) {
    963                                 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Mline);
     958                                Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Symbols.Mline);
    964959                        } else if (feature.type == Obj.PIPOHD) {
    965960                                Renderer.lineVector(feature, new LineStyle(Color.black, 8));
     
    10101005                case TSSRON:
    10111006                        if (Renderer.zoom <= 15)
    1012                                 Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true)));
     1007                                Renderer.lineVector(feature, new LineStyle(Symbols.Mline));
    10131008                        else
    1014                                 Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
    1015                         addName(feature, 10, new Font("Arial", Font.BOLD, 150), new Color(0x80c48080, true));
     1009                                Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 20, null, null));
     1010                        addName(feature, 10, new Font("Arial", Font.BOLD, 150), Symbols.Mline);
    10161011                        break;
    10171012                case TSELNE:
    1018                         Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
     1013                        Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 20, null, null));
    10191014                        break;
    10201015                case TSSLPT:
    1021                         Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, null, 0, new Color(0x80c48080, true));
     1016                        Renderer.lineSymbols(feature, Areas.LaneArrow, 0.5, null, null, 0, Symbols.Mline);
    10221017                        break;
    10231018                case TSSBND:
    1024                         Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, new float[] { 40, 40 }, null));
     1019                        Renderer.lineVector(feature, new LineStyle(Symbols.Mline, 20, new float[] { 40, 40 }, null));
    10251020                        break;
    10261021                case ISTZNE:
    1027                         Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, new Color(0x80c48080, true));
     1022                        Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Symbols.Mline);
    10281023                        break;
    10291024                default:
     
    10331028
    10341029        private static void shoreline() {
     1030                CatSLC cat = (CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC);
    10351031                if ((ruleset == RuleSet.ALL) || (ruleset == RuleSet.BASE)) {
    1036                         Renderer.lineVector(feature, new LineStyle(Color.black, 10, Yland));
     1032                        if ((cat != CatSLC.SLC_SWAY) && (cat != CatSLC.SLC_TWAL)) {
     1033                                Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Yland));
     1034                        }
    10371035                }
    10381036                if ((ruleset == RuleSet.ALL) || (ruleset == RuleSet.SEAMARK)) {
    10391037                        if (Renderer.zoom >= 12) {
    1040                                 switch ((CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC)) {
     1038                                switch (cat) {
    10411039                                case SLC_TWAL:
    10421040                                        WatLEV lev = (WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV);
     
    11451143                                Renderer.symbol(feature, Harbours.SignalStation);
    11461144                                Renderer.symbol(feature, Beacons.RadarStation);
    1147                                 Renderer.labelText(feature, "Ra", new Font("Arial", Font.PLAIN, 40), Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
     1145                                Renderer.labelText(feature, "Ra", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
    11481146                                break;
    11491147                        case PILBOP:
    11501148                                Renderer.symbol(feature, Harbours.Pilot);
    1151                                 addName(feature, 15, new Font("Arial", Font.BOLD, 50), Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
     1149                                addName(feature, 15, new Font("Arial", Font.BOLD, 50), Symbols.Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
    11521150                                CatPIL cat = (CatPIL) getAttEnum(feature, feature.type, 0, Att.CATPIL);
    11531151                                if (cat == CatPIL.PIL_HELI) {
    1154                                         Renderer.labelText(feature, "H", new Font("Arial", Font.PLAIN, 40), Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
     1152                                        Renderer.labelText(feature, "H", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
    11551153                                }
    11561154                                break;
     
    11931191
    11941192        private static void waterways() {
    1195                 Renderer.lineVector(feature, new LineStyle(Bwater, 20));
     1193                Renderer.lineVector(feature, new LineStyle(Symbols.Bwater, 20));
    11961194        }
    11971195
  • applications/editors/josm/plugins/seachart/src/render/Signals.java

    r30992 r31044  
    2121import s57.S57map.*;
    2222import symbols.Beacons;
     23import symbols.Symbols;
    2324import symbols.Topmarks;
    2425import symbols.Symbols.*;
     
    162163                }
    163164                if ((Renderer.zoom >= 15) && !bstr.isEmpty()) {
    164                         Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Rules.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
     165                        Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -70)));
    165166                }
    166167        }
     
    273274                if (Renderer.zoom >= 15) {
    274275                        if (vais) {
    275                                 Renderer.labelText(feature, "V-AIS", new Font("Arial", Font.PLAIN, 40), Rules.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));
     276                                Renderer.labelText(feature, "V-AIS", new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));
    276277                        }
    277278                        if (!bstr.isEmpty()) {
    278                                 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Rules.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));
     279                                Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Symbols.Msymb, new Delta(Handle.TR, AffineTransform.getTranslateInstance(-30, -110)));
    279280                        }
    280281                }
  • applications/editors/josm/plugins/seachart/src/s57/S57map.java

    r31031 r31044  
    191191                public int outers;                                              // Number of outers
    192192                public int inners;                                              // Number of inners
    193                 public ArrayList<Comp> refs;    // Ordered list of compounds
     193                public ArrayList<Comp> comps;   // Ordered list of compounds
    194194                public double area;                                             // Area of feature
    195195                public double length;                                   // Length of feature
     
    199199                        elems = new ArrayList<Prim>();
    200200                        outers = inners = 0;
    201                         refs = new ArrayList<Comp>();
     201                        comps = new ArrayList<Comp>();
    202202                        area = 0;
    203203                        length = 0;
     
    245245        private Feature feature;
    246246        private Edge edge;
     247        private KeyVal<?> osm = S57osm.OSMtag("", "");
    247248
    248249        public S57map() {
     
    388389                feature.geom.elems.add(new Prim(id));
    389390                edge = null;
     391                osm = S57osm.OSMtag("", "");
    390392        }
    391393
     
    396398                feature.geom.elems.add(new Prim(id));
    397399                edge = new Edge();
     400                osm = S57osm.OSMtag("", "");
    398401        }
    399402
     
    415418                feature.geom.prim = Pflag.AREA;
    416419                edge = null;
     420                osm = S57osm.OSMtag("", "");
    417421        }
    418422
     
    474478                        }
    475479                } else {
    476                         KeyVal kv = S57osm.OSMtag(key, val);
     480                        KeyVal<?> kv = S57osm.OSMtag(key, val);
    477481                        if (kv.obj != Obj.UNKOBJ) {
    478                                 if (feature.type == Obj.UNKOBJ) {
    479                                         feature.type = kv.obj;
    480                                 }
    481                                 ObjTab objs = feature.objs.get(kv.obj);
    482                                 if (objs == null) {
    483                                         objs = new ObjTab();
    484                                         feature.objs.put(kv.obj, objs);
    485                                 }
    486                                 AttMap atts = objs.get(0);
    487                                 if (atts == null) {
    488                                         atts = new AttMap();
    489                                         objs.put(0, atts);
    490                                 }
     482                                osm.obj = kv.obj;
    491483                                if (kv.att != Att.UNKATT) {
    492                                         atts.put(kv.att, new AttVal(kv.att, kv.conv, kv.val));
     484                                        osm = kv;
    493485                                }
    494486                        }
     
    517509                        break;
    518510                }
    519                 if ((sortGeom(feature)) && (feature.type != Obj.UNKOBJ) && !((edge != null) && (edge.last == 0))) {
    520                         index.put(id, feature);
    521                         if (features.get(feature.type) == null) {
    522                                 features.put(feature.type, new ArrayList<Feature>());
    523                         }
    524                         features.get(feature.type).add(feature);
    525                         feature.geom.centre = findCentroid(feature);
    526                 }
    527         }
    528        
     511                if (sortGeom(feature) && !((edge != null) && (edge.last == 0))) {
     512                        if (osm.obj != Obj.UNKOBJ) {
     513                                if (feature.type == Obj.UNKOBJ) {
     514                                        feature.type = osm.obj;
     515                                        ObjTab objs = feature.objs.get(osm.obj);
     516                                        if (objs == null) {
     517                                                objs = new ObjTab();
     518                                                feature.objs.put(osm.obj, objs);
     519                                        }
     520                                        AttMap atts = objs.get(0);
     521                                        if (atts == null) {
     522                                                atts = new AttMap();
     523                                                objs.put(0, atts);
     524                                        }
     525                                        if (osm.att != Att.UNKATT) {
     526                                                atts.put(osm.att, new AttVal<>(osm.att, osm.conv, osm.val));
     527                                        }
     528                                } else {
     529                                        Feature base = new Feature();
     530                                        base.reln = Rflag.MASTER;
     531                                        base.geom = feature.geom;
     532                                        base.type = osm.obj;
     533                                        ObjTab objs = new ObjTab();
     534                                        base.objs.put(osm.obj, objs);
     535                                        AttMap atts = new AttMap();
     536                                        objs.put(0, atts);
     537                                        if (osm.att != Att.UNKATT) {
     538                                                atts.put(osm.att, new AttVal<>(osm.att, osm.conv, osm.val));
     539                                        }
     540                                        index.put(++xref, base);
     541                                        if (features.get(osm.obj) == null) {
     542                                                features.put(osm.obj, new ArrayList<Feature>());
     543                                        }
     544                                        features.get(osm.obj).add(base);
     545                                }
     546                        }
     547                        if (feature.type != Obj.UNKOBJ) {
     548                                index.put(id, feature);
     549                                if (features.get(feature.type) == null) {
     550                                        features.put(feature.type, new ArrayList<Feature>());
     551                                }
     552                                features.get(feature.type).add(feature);
     553                        }
     554                }
     555        }
     556       
     557        enum Ext {I, N, W, S, E }
    529558        public void mapDone() {
    530                 ArrayList<Feature> coasts = new ArrayList<Feature>();
    531                 ArrayList<Feature> lands = new ArrayList<Feature>();
    532                 if (features.get(Obj.LNDARE) == null) {
    533                         features.put(Obj.LNDARE, new ArrayList<Feature>());
    534                 }
    535                 for (Feature feature : features.get(Obj.COALNE)) {
    536                         Feature land = new Feature();
    537                         land.type = Obj.LNDARE;
    538                         land.reln = Rflag.MASTER;
    539                         land.objs.put(Obj.LNDARE, new ObjTab());
    540                         if (feature.geom.prim == Pflag.AREA) {
    541                                 land.geom = feature.geom;
    542                                 features.get(Obj.LNDARE).add(land);
    543                         } else if (feature.geom.prim == Pflag.LINE) {
    544                                 land.geom.prim = Pflag.LINE;
    545                                 for (int i = 0; i < feature.geom.elems.size(); i++) {
    546                                         land.geom.elems.add(feature.geom.elems.get(i));
    547                                 }
    548                                 coasts.add(land);
    549                         }
    550                 }
    551                 while (coasts.size() > 0) {
    552                         Feature land = coasts.remove(0);
    553                         Edge fedge = edges.get(land.geom.elems.get(0).id);
    554                         long first = fedge.first;
    555                         long last = edges.get(land.geom.elems.get(land.geom.elems.size() - 1).id).last;
    556                         if (coasts.size() > 0) {
    557                                 boolean added = true;
    558                                 while (added) {
    559                                         added = false;
    560                                         for (int i = 0; i < coasts.size(); i++) {
    561                                                 Feature coast = coasts.get(i);
    562                                                 Edge edge = edges.get(coast.geom.elems.get(0).id);
    563                                                 if (edge.first == last) {
    564                                                         land.geom.elems.add(coast.geom.elems.get(0));
    565                                                         last = edge.last;
    566                                                         coasts.remove(i--);
    567                                                         added = true;
    568                                                 } else if (edge.last == first) {
    569                                                         land.geom.elems.add(0, coast.geom.elems.get(0));
    570                                                         first = edge.first;
    571                                                         coasts.remove(i--);
    572                                                         added = true;
    573                                                 }
    574                                         }
    575                                 }
    576                         }
    577                         lands.add(land);
    578                 }
    579                 for (Feature land : lands) {
    580                         long first = edges.get(land.geom.elems.get(0).id).first;
    581                         long last = edges.get(land.geom.elems.get(land.geom.elems.size()-1).id).last;
    582                         Ext fext = outsideBounds(first);
    583                         Ext lext = outsideBounds(last);
    584                         Edge nedge = new Edge();
    585                         nedge.first = last;
    586                         nedge.last = first;
    587                         switch (lext) {
    588                         case N:
    589                                 if ((lext == fext) || (fext != Ext.N)) {
    590                                         nedge.nodes.add(1L);
    591                                         if ((fext != Ext.W)) {
    592                                                 nedge.nodes.add(2L);
    593                                                 if ((fext != Ext.S)) {
    594                                                         nedge.nodes.add(3L);
    595                                                         if ((fext != Ext.W)) {
    596                                                                 nedge.nodes.add(4L);
     559                class Land {
     560                        long first;
     561                        Snode start;
     562                        Ext sbound;
     563                        long last;
     564                        Snode end;
     565                        Ext ebound;
     566                        Feature land;
     567                        Land (Feature l) {
     568                                land = l;
     569                                first = last = 0;
     570                                start = end = null;
     571                                sbound = ebound = Ext.I;
     572                        }
     573                }
     574                if (features.get(Obj.COALNE) != null) {
     575                        ArrayList<Feature> coasts = new ArrayList<Feature>();
     576                        ArrayList<Land> lands = new ArrayList<Land>();
     577                        if (features.get(Obj.LNDARE) == null) {
     578                                features.put(Obj.LNDARE, new ArrayList<Feature>());
     579                        }
     580                        for (Feature feature : features.get(Obj.COALNE)) {
     581                                Feature land = new Feature();
     582                                land.type = Obj.LNDARE;
     583                                land.reln = Rflag.MASTER;
     584                                land.objs.put(Obj.LNDARE, new ObjTab());
     585                                if (feature.geom.prim == Pflag.AREA) {
     586                                        land.geom = feature.geom;
     587                                        features.get(Obj.LNDARE).add(land);
     588                                } else if (feature.geom.prim == Pflag.LINE) {
     589                                        land.geom.prim = Pflag.LINE;
     590                                        for (int i = 0; i < feature.geom.elems.size(); i++) {
     591                                                land.geom.elems.add(feature.geom.elems.get(i));
     592                                        }
     593                                        coasts.add(land);
     594                                }
     595                        }
     596                        while (coasts.size() > 0) {
     597                                Feature land = coasts.remove(0);
     598                                Edge fedge = edges.get(land.geom.elems.get(0).id);
     599                                long first = fedge.first;
     600                                long last = edges.get(land.geom.elems.get(land.geom.elems.size() - 1).id).last;
     601                                if (coasts.size() > 0) {
     602                                        boolean added = true;
     603                                        while (added) {
     604                                                added = false;
     605                                                for (int i = 0; i < coasts.size(); i++) {
     606                                                        Feature coast = coasts.get(i);
     607                                                        Edge edge = edges.get(coast.geom.elems.get(0).id);
     608                                                        if (edge.first == last) {
     609                                                                land.geom.elems.add(coast.geom.elems.get(0));
     610                                                                last = edge.last;
     611                                                                coasts.remove(i--);
     612                                                                added = true;
     613                                                        } else if (edge.last == first) {
     614                                                                land.geom.elems.add(0, coast.geom.elems.get(0));
     615                                                                first = edge.first;
     616                                                                coasts.remove(i--);
     617                                                                added = true;
    597618                                                        }
    598619                                                }
    599620                                        }
    600621                                }
    601                                 break;
    602                         case W:
    603                                 if ((lext == fext) || (fext != Ext.W)) {
    604                                         nedge.nodes.add(2L);
    605                                         if ((fext != Ext.S)) {
    606                                                 nedge.nodes.add(3L);
    607                                                 if ((fext != Ext.E)) {
    608                                                         nedge.nodes.add(4L);
    609                                                         if ( (fext != Ext.N)) {
    610                                                                 nedge.nodes.add(1L);
     622                                lands.add(new Land(land));
     623                        }
     624                        ArrayList<Land> islands = new ArrayList<Land>();
     625                        for (Land land : lands) {
     626                                sortGeom(land.land);
     627                                if (land.land.geom.prim == Pflag.AREA) {
     628                                        islands.add(land);
     629                                        features.get(Obj.LNDARE).add(land.land);
     630                                }
     631                        }
     632                        for (Land island : islands) {
     633                                lands.remove(island);
     634                        }
     635                        for (Land land : lands) {
     636                                GeomIterator git = new GeomIterator(land.land.geom);
     637                                Snode prev = null;
     638                                Ext bprev = Ext.I;
     639                                Ext ext;
     640                                land.ebound = land.sbound = Ext.I;
     641                                while (git.hasComp()) {
     642                                        git.nextComp();
     643                                        while (git.hasEdge()) {
     644                                                git.nextEdge();
     645                                                while (git.hasNode()) {
     646                                                        long ref = git.nextRef(false);
     647                                                        Snode node = nodes.get(ref);
     648                                                        if (node == null) continue;
     649                                                        if (land.first == 0) {
     650                                                                land.first = ref;
     651                                                        }
     652                                                        if (prev == null) {
     653                                                                prev = node;
     654                                                        }
     655                                                        if ((node.lat >= bounds.maxlat) && (node.lon < bounds.maxlon)) {
     656                                                                ext = Ext.N;
     657                                                        } else if (node.lon <= bounds.minlon) {
     658                                                                ext = Ext.W;
     659                                                        } else if (node.lat <= bounds.minlat) {
     660                                                                ext = Ext.S;
     661                                                        } else if (node.lon >= bounds.maxlon) {
     662                                                                ext = Ext.E;
     663                                                        } else {
     664                                                                ext = Ext.I;
     665                                                        }
     666                                                        if (ext == Ext.I) {
     667                                                                if (land.start == null) {
     668                                                                        land.start = prev;
     669                                                                        land.sbound = bprev;
     670                                                                }
     671                                                                land.end = null;
     672                                                                land.ebound = Ext.I;
     673                                                        } else {
     674                                                                if ((land.start != null) && (land.end == null)) {
     675                                                                        land.end = node;
     676                                                                        land.ebound = ext;
     677                                                                }
     678                                                        }
     679                                                        prev = node;
     680                                                        bprev = ext;
     681                                                        land.last = ref;
     682                                                }
     683                                        }
     684                                }
     685                        }
     686                        islands = new ArrayList<Land>();
     687                        for (Land land : lands) {
     688                                if ((land.sbound == Ext.I) || (land.ebound == Ext.I)) {
     689                                        islands.add(land);
     690                                }
     691                        }
     692                        for (Land island : islands) {
     693                                lands.remove(island);
     694                        }
     695                        while (lands.size() > 0) {
     696                                Land land = lands.get(0);
     697                                Edge nedge = new Edge();
     698                                nedge.first = land.last;
     699                                Ext bound = land.ebound;
     700                                Snode last = land.end;
     701                                double delta = Math.PI;
     702                                int idx = -1;
     703                                Land next = null;
     704                                while (idx < 0) {
     705                                        for (int i = 0; i < lands.size(); i++) {
     706                                                next = lands.get(i);
     707                                                if (next.sbound == bound) {
     708                                                        double diff = -Math.PI;
     709                                                        switch (bound) {
     710                                                        case N:
     711                                                                diff = last.lon - next.start.lon;
     712                                                                break;
     713                                                        case W:
     714                                                                diff = last.lat - next.start.lat;
     715                                                                break;
     716                                                        case S:
     717                                                                diff = next.start.lon - last.lon;
     718                                                                break;
     719                                                        case E:
     720                                                                diff = next.start.lat - last.lat;
     721                                                                break;
     722                                                        default:
     723                                                                continue;
     724                                                        }
     725                                                        if ((diff >= 0.0) && (diff < delta)) {
     726                                                                delta = diff;
     727                                                                idx = i;
    611728                                                        }
    612729                                                }
    613730                                        }
    614                                 }
    615                                 break;
    616                         case S:
    617                                 if ((lext == fext) || (fext != Ext.S)) {
    618                                         nedge.nodes.add(3L);
    619                                         if ((fext != Ext.E)) {
    620                                                 nedge.nodes.add(4L);
    621                                                 if ((fext != Ext.N)) {
    622                                                         nedge.nodes.add(1L);
    623                                                         if ((fext != Ext.W)) {
    624                                                                 nedge.nodes.add(2L);
     731                                        if (idx < 0) {
     732                                                long ref = (long)bound.ordinal();
     733                                                last = nodes.get(ref);
     734                                                nedge.nodes.add(ref);
     735                                                ref = ref < 4 ? ++ref : 1;
     736                                                for (Ext e : Ext.values()) {
     737                                                        if (ref == e.ordinal()) {
     738                                                                bound = e;
     739                                                                break;
    625740                                                        }
    626741                                                }
    627742                                        }
    628743                                }
    629                                 break;
    630                         case E:
    631                                 if ((lext == fext) || (fext != Ext.E)) {
    632                                         nedge.nodes.add(4L);
    633                                         if ((fext != Ext.N)) {
    634                                                 nedge.nodes.add(1L);
    635                                                 if ((fext != Ext.W)) {
    636                                                         nedge.nodes.add(2L);
    637                                                         if ((fext != Ext.S)) {
    638                                                                 nedge.nodes.add(3L);
    639                                                         }
    640                                                 }
    641                                         }
    642                                 }
    643                                 break;
    644                         default:
    645                         }
    646                         edges.put(++xref, nedge);
    647                         land.geom.elems.add(new Prim(xref));
    648                         sortGeom(land);
    649                         features.get(Obj.LNDARE).add(land);
     744                                next = lands.get(idx);
     745                                nedge.last = next.first;
     746                                edges.put(++xref, nedge);
     747                                land.land.geom.elems.add(new Prim(xref));
     748                                if (next != land) {
     749                                        land.land.geom.elems.addAll(next.land.geom.elems);
     750                                        land.ebound = next.ebound;
     751                                        land.end = next.end;
     752                                        land.last = next.last;
     753                                        lands.remove(idx);
     754                                }
     755                                sortGeom(land.land);
     756                                if (land.land.geom.prim == Pflag.AREA) {
     757                                        features.get(Obj.LNDARE).add(land.land);
     758                                        lands.remove(land);
     759                                }
     760                        }
    650761                }
    651762                return;
     
    653764
    654765        // Utility methods
    655        
    656         enum Ext {I, N, W, S, E }
    657         class Xnode {
    658                 double lat;
    659                 double lon;
    660                 Ext ext;
    661         }
    662         Ext outsideBounds(long ref) {
    663                 Snode node = nodes.get(ref);
    664                 if (node.lat >= bounds.maxlat) {
    665                         return Ext.N;
    666                 }
    667                 if (node.lat <= bounds.minlat) {
    668                         return Ext.S;
    669                 }
    670                 if (node.lon >= bounds.maxlon) {
    671                         return Ext.E;
    672                 }
    673                 if (node.lon <= bounds.minlon) {
    674                         return Ext.W;
    675                 }
    676                 return Ext.I;
    677         }
    678766       
    679767        public boolean sortGeom(Feature feature) {
     
    686774                feature.geom.area = 0;
    687775                if (feature.geom.prim == Pflag.POINT) {
     776                        feature.geom.centre = findCentroid(feature);
    688777                        return true;
    689778                }       else {
     
    697786                                if (next == true) {
    698787                                        next = false;
    699                                         if (prim.forward) {
    700                                                 first = edge.first;
    701                                                 last = edge.last;
    702                                         } else {
    703                                                 first = edge.last;
    704                                                 last = edge.first;
    705                                         }
     788                                        first = edge.first;
     789                                        last = edge.last;
     790                                        prim.forward = true;
    706791                                        sort.elems.add(prim);
    707792                                        if (prim.outer) {
     
    711796                                        }
    712797                                        comp = new Comp(cref++, 1);
    713                                         sort.refs.add(comp);
     798                                        sort.comps.add(comp);
    714799                                } else {
    715                                         if (prim.forward) {
    716                                                 if (edge.first == last) {
    717                                                         sort.elems.add(prim);
    718                                                         last = edge.last;
    719                                                         comp.size++;
    720                                                 } else if (edge.last == first) {
    721                                                         sort.elems.add(0, prim);
    722                                                         first = edge.first;
    723                                                         comp.size++;
    724                                                 } else {
    725                                                         feature.geom.elems.add(prim);
    726                                                 }
     800                                        if (edge.first == last) {
     801                                                sort.elems.add(prim);
     802                                                last = edge.last;
     803                                                prim.forward = true;
     804                                                comp.size++;
     805                                        } else if (edge.last == first) {
     806                                                sort.elems.add(0, prim);
     807                                                first = edge.first;
     808                                                prim.forward = true;
     809                                                comp.size++;
     810                                        } else if (edge.last == last) {
     811                                                sort.elems.add(prim);
     812                                                last = edge.first;
     813                                                prim.forward = false;
     814                                                comp.size++;
     815                                        } else if (edge.first == first) {
     816                                                sort.elems.add(0, prim);
     817                                                first = edge.last;
     818                                                prim.forward = false;
     819                                                comp.size++;
    727820                                        } else {
    728                                                 if (edge.last == last) {
    729                                                         sort.elems.add(prim);
    730                                                         last = edge.first;
    731                                                         comp.size++;
    732                                                 } else if (edge.first == first) {
    733                                                         sort.elems.add(0, prim);
    734                                                         first = edge.last;
    735                                                         comp.size++;
    736                                                 } else {
    737                                                         feature.geom.elems.add(prim);
    738                                                 }
     821                                                feature.geom.elems.add(prim);
    739822                                        }
    740823                                }
     
    750833                }
    751834                if (feature.geom.prim == Pflag.AREA) {
    752                         ArrayList<Prim> outers = new ArrayList<Prim>();
    753                         ArrayList<Prim> inners = new ArrayList<Prim>();
    754                         for (Prim prim : feature.geom.elems) {
    755                                 if (prim.outer) {
    756                                         outers.add(prim);
    757                                 } else {
    758                                         inners.add(prim);
    759                                 }
    760                         }
    761                         ArrayList<Prim> sorting = outers.size() > 0 ? outers : inners;
    762                         ArrayList<Prim> closed = null;
    763                         sort = new Geom(feature.geom.prim);
    764                         sort.outers = feature.geom.outers;
    765                         sort.inners = feature.geom.inners;
    766                         sort.refs = feature.geom.refs;
    767                         next = true;
    768                         while (!sorting.isEmpty()) {
    769                                 Prim prim = sorting.remove(0);
    770                                 Edge edge = edges.get(prim.id);
    771                                 if (next == true) {
    772                                         next = false;
    773                                         closed = new ArrayList<Prim>();
    774                                         closed.add(prim);
    775                                         if (prim.forward) {
    776                                                 first = edge.first;
    777                                                 last = edge.last;
    778                                         } else {
    779                                                 first = edge.last;
    780                                                 last = edge.first;
    781                                         }
    782                                 } else {
    783                                         if (prim.forward) {
    784                                                 if (edge.first == last) {
    785                                                         last = edge.last;
    786                                                         closed.add(prim);
    787                                                 } else {
    788                                                         sorting.add(0, prim);
    789                                                         next = true;
    790                                                 }
    791                                         } else {
    792                                                 if (edge.last == last) {
    793                                                         last = edge.first;
    794                                                         closed.add(prim);
    795                                                 } else {
    796                                                         sorting.add(0, prim);
    797                                                         next = true;
    798                                                 }
    799                                         }
    800                                 }
    801                                 if (first == last) {
    802                                         sort.elems.addAll(closed);
    803                                         next = true;
    804                                 }
    805                                 if (sorting.isEmpty() && sorting == outers) {
    806                                         sorting = inners;
    807                                         next = true;
    808                                 }
    809                         }
    810                         feature.geom = sort;
     835                        if (signedArea(feature.geom) < 0.0) {
     836                               
     837                        };
     838                        feature.geom.area = calcArea(feature.geom);
    811839                }
    812840                feature.geom.length = calcLength(feature.geom);
    813                 feature.geom.area = calcArea(feature.geom);
     841                feature.geom.centre = findCentroid(feature);
    814842                return true;
    815843        }
     
    883911                        lastref = 0;
    884912                        ite = geom.elems.listIterator();
    885                         itc = geom.refs.listIterator();
     913                        itc = geom.comps.listIterator();
    886914                }
    887915               
  • applications/editors/josm/plugins/seachart/src/s57/S57osm.java

    r31028 r31044  
    3838                OSMtags.put("waterway=canal", new KeyVal<>(Obj.CANALS, Att.UNKATT, null, null)); OSMtags.put("waterway=dock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null));
    3939                OSMtags.put("waterway=lock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null));
    40                 OSMtags.put("wetland=tidalflat", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (double)0)); OSMtags.put("tidal=yes", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (Double)0.0));
     40                OSMtags.put("wetland=tidalflat", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (Double)0.0)); OSMtags.put("tidal=yes", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (Double)0.0));
    4141                OSMtags.put("natural=mud", new KeyVal<>(Obj.DEPARE, Att.UNKATT, null, null)); OSMtags.put("natural=sand", new KeyVal<>(Obj.DEPARE, Att.UNKATT, null, null));
    4242                OSMtags.put("highway=motorway", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MWAY)); OSMtags.put("highway=trunk", new KeyVal<>(Obj.ROADWY, Att.CATROD, Conv.E, CatROD.ROD_MAJR));
  • applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java

    r31028 r31044  
    3030import render.ChartContext;
    3131import render.Renderer;
    32 import render.Rules;
     32import render.Rules.RuleSet;
    3333import s57.S57map.*;
    3434
     
    6666        public void paint(Graphics2D g2, MapView mv, Bounds bb) {
    6767                Rectangle rect = Main.map.mapView.getBounds();
    68                 Renderer.reRender(g2, rect, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this);
     68                Renderer.reRender(g2, RuleSet.ALL, rect, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this);
    6969                g2.setPaint(Color.black);
    7070                g2.setFont(new Font("Arial", Font.BOLD, 20));
  • applications/editors/josm/plugins/seachart/src/symbols/Areas.java

    r30894 r31044  
    5353                LaneArrow.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-240,40,240)));
    5454                LaneArrow.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
    55                 LaneArrow.add(new Instr(Form.FILL, new Color(0x80c480ff, true)));
     55                LaneArrow.add(new Instr(Form.FILL, Symbols.Mline));
    5656                Path2D.Double p = new Path2D.Double(); p.moveTo(15,0); p.lineTo(15,-195); p.lineTo(40,-195);
    5757                p.lineTo(0,-240); p.lineTo(-40,-195); p.lineTo(-15,-195); p.lineTo(-15,0); p.closePath();
  • applications/editors/josm/plugins/seachart/src/symbols/Harbours.java

    r30899 r31044  
    1414import java.awt.geom.*;
    1515
    16 import render.Rules;
    1716import symbols.Symbols.*;
    1817
     
    3938        public static final Symbol Anchorage = new Symbol();
    4039        static {
    41                 Anchorage.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 1.0, 0, 0, new Scheme(Rules.Msymb), null)));
     40                Anchorage.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 1.0, 0, 0, new Scheme(Symbols.Msymb), null)));
    4241        }
    4342        public static final Symbol Bollard = new Symbol();
     
    5453                CallPoint1.add(new Instr(Form.BBOX, new Rectangle2D.Double(-50,-50,100,100)));
    5554                CallPoint1.add(new Instr(Form.STRK, new BasicStroke(5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)));
    56                 CallPoint1.add(new Instr(Form.FILL, Rules.Msymb));
     55                CallPoint1.add(new Instr(Form.FILL, Symbols.Msymb));
    5756                CallPoint1.add(new Instr(Form.ELPS, new Ellipse2D.Double(-25,-25,50,50)));
    5857                Path2D.Double p = new Path2D.Double(); p.moveTo(-16.0,-20.0); p.lineTo(0.0,-50.0); p.lineTo(16.0,-20.0);
     
    9594        static {
    9695                DistanceU.add(new Instr(Form.STRK, new BasicStroke(3, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    97                 DistanceU.add(new Instr(Form.FILL, Rules.Msymb));
     96                DistanceU.add(new Instr(Form.FILL, Symbols.Msymb));
    9897                DistanceU.add(new Instr(Form.ELPS, new Ellipse2D.Double(-11,-11,22,22)));
    9998        }
     
    121120        static {
    122121                Fishing.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    123                 Fishing.add(new Instr(Form.FILL, Rules.Msymb));
     122                Fishing.add(new Instr(Form.FILL, Symbols.Msymb));
    124123                Fishing.add(new Instr(Form.EARC, new Arc2D.Double(-50,-50,100,100,15,140,Arc2D.OPEN)));
    125124                Fishing.add(new Instr(Form.EARC, new Arc2D.Double(-50,-50,100,100,-15,-140,Arc2D.OPEN)));
     
    133132        static {
    134133                Harbour.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    135                 Harbour.add(new Instr(Form.FILL, Rules.Msymb));
     134                Harbour.add(new Instr(Form.FILL, Symbols.Msymb));
    136135                Harbour.add(new Instr(Form.ELPS, new Ellipse2D.Double(-50,-50,100,100)));
    137                 Harbour.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 0.6, 0, 0, new Scheme(Rules.Msymb), null)));
     136                Harbour.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Anchor, 0.6, 0, 0, new Scheme(Symbols.Msymb), null)));
    138137        }
    139138        public static final Symbol HarbourMaster = new Symbol();
     
    155154        public static final Symbol LandingSteps = new Symbol();
    156155        static {
    157                 LandingSteps.add(new Instr(Form.FILL, Rules.Msymb));
     156                LandingSteps.add(new Instr(Form.FILL, Symbols.Msymb));
    158157                Path2D.Double p = new Path2D.Double(); p.moveTo(-20,-10); p.lineTo(10,20); p.lineTo(20,20); p.lineTo(20,10);
    159158                p.lineTo(10,10); p.lineTo(10,0); p.lineTo(0,0); p.lineTo(0,-10); p.lineTo(-10,-10); p.lineTo(-10,-20); p.lineTo(-20,-20); p.closePath();
     
    165164        static {
    166165                Marina.add(new Instr(Form.STRK, new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    167                 Marina.add(new Instr(Form.FILL, Rules.Msymb));
     166                Marina.add(new Instr(Form.FILL, Symbols.Msymb));
    168167                Marina.add(new Instr(Form.EARC, new Arc2D.Double(-50.0,-50.0,100.0,100.0,215.0,-250.0,Arc2D.OPEN)));
    169                 Marina.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 0.6, 0, 0, new Scheme(Rules.Msymb), null)));
     168                Marina.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 0.6, 0, 0, new Scheme(Symbols.Msymb), null)));
    170169        }
    171170        public static final Symbol MarinaNF = new Symbol();
    172171        static {
    173                 MarinaNF.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 0.6, 0, 0, new Scheme(Rules.Msymb), null)));
     172                MarinaNF.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Harbours.Yacht, 0.6, 0, 0, new Scheme(Symbols.Msymb), null)));
    174173        }
    175174        public static final Symbol Pilot = new Symbol();
  • applications/editors/josm/plugins/seachart/src/symbols/Symbols.java

    r31014 r31044  
    2020public class Symbols {
    2121
     22        public static final Color Yland = new Color(0xf1c010);
     23        public static final Color Bwater = new Color(0x78acd2);
     24        public static final Color Gdries = new Color(0x689868);
     25        public static final Color Mline = new Color(0x9a6078);
     26        public static final Color Msymb = new Color(0xa30075);
     27       
    2228        public enum Form {
    2329                BBOX, STRK, COLR, FILL, LINE, RECT, RRCT, ELPS, EARC, PLIN, PGON, RSHP, TEXT, SYMB, P1, P2, H2, H3, H4, H5, V2, V3, D2, D3, D4, B1, S2, S3, S4, C2, X2
Note: See TracChangeset for help on using the changeset viewer.