Changeset 32380 in osm


Ignore:
Timestamp:
2016-06-23T14:17:55+02:00 (8 years ago)
Author:
malcolmh
Message:

updates

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

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/jicons/src/jicons/Jicons.java

    r32082 r32380  
    208208
    209209                public RuleSet ruleset() {
    210                         return RuleSet.SEAMARK;
     210                        return RuleSet.ALL;
    211211                }
    212212        }
  • applications/editors/josm/plugins/seachart/josmtos57/src/josmtos57/Josmtos57.java

    r32368 r32380  
    8686                        in = new BufferedReader(new FileReader(new File(args[0])));
    8787                        try {
    88                                 S57osm.OSMmap(in, map, true);
     88                                S57osm.OSMmap(in, map, false);
    8989                        } catch (Exception e) {
    9090                                System.err.println("Input data error");
  • applications/editors/josm/plugins/seachart/src/render/Renderer.java

    r32101 r32380  
    391391                if ((str == null) || (str.isEmpty())) str = " ";
    392392    FontRenderContext frc = g2.getFontRenderContext();
    393     GlyphVector gv = font.deriveFont((float)(font.getSize())).createGlyphVector(frc, str.equals(" ") ? "!" : str);
     393    GlyphVector gv = font.deriveFont((float)(font.getSize())).createGlyphVector(frc, str.equals(" ") ? "M" : str);
    394394    Rectangle2D bounds = gv.getVisualBounds();
    395395    double width = bounds.getWidth();
     
    485485        }
    486486
    487         public static void lineText(String str, Font font, Color colour, double offset, double dy) {
     487        public static void lineText(String str, Font font, Color colour, double dy) {
    488488                if (!str.isEmpty()) {
    489489                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    490             g2.setPaint(colour);
    491             FontRenderContext frc = g2.getFontRenderContext();
    492             GlyphVector gv = font.deriveFont(font.getSize2D() * (float)sScale).createGlyphVector(frc, (" " + str));
    493             GeneralPath path = new GeneralPath();
    494                         Point2D prev = new Point2D.Double();
    495                         Point2D next = new Point2D.Double();
    496                         Point2D curr = new Point2D.Double();
    497                         Point2D succ = new Point2D.Double();
    498                         boolean piv = false;
    499                         double angle = 0;
    500                         int index = 0;
    501                         double gwidth = offset * (Rules.feature.geom.length * context.mile(Rules.feature) - gv.getLogicalBounds().getWidth()) + gv.getGlyphMetrics(0).getAdvance();
    502                         GeomIterator git = map.new GeomIterator(Rules.feature.geom);
    503                         while (git.hasComp()) {
    504                                 git.nextComp();
    505                                 boolean first = true;
    506                                 while (git.hasEdge()) {
    507                                         git.nextEdge();
    508                                         while (git.hasNode()) {
    509                                                 Snode node = git.next();
    510                                                 if (node == null) continue;
    511                                                 prev = next;
    512                                                 next = context.getPoint(node);
    513                                                 angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX());
    514                                                 piv = true;
    515                                                 if (first) {
    516                                                         curr = succ = next;
    517                                                         first = false;
    518                                                 } else {
    519                                                         while (curr.distance(next) >= gwidth) {
    520                                                                 if (piv) {
    521                                                                         double rem = gwidth;
    522                                                                         double s = prev.distance(next);
    523                                                                         double p = curr.distance(prev);
    524                                                                         if ((s > 0) && (p > 0)) {
    525                                                                                 double n = curr.distance(next);
    526                                                                                 double theta = Math.acos((s * s + p * p - n * n) / 2 / s / p);
    527                                                                                 double phi = Math.asin(p / gwidth * Math.sin(theta));
    528                                                                                 rem = gwidth * Math.sin(Math.PI - theta - phi) / Math.sin(theta);
    529                                                                         }
    530                                                                         succ = new Point2D.Double(prev.getX() + (rem * Math.cos(angle)), prev.getY() + (rem * Math.sin(angle)));
    531                                                                         piv = false;
     490                        g2.setPaint(colour);
     491                        FontRenderContext frc = g2.getFontRenderContext();
     492                        GlyphVector gv = font.deriveFont(font.getSize2D() * (float) sScale).createGlyphVector(frc, str);
     493                        double width = gv.getVisualBounds().getWidth();
     494                        double height = gv.getVisualBounds().getHeight();
     495                        double offset = (Rules.feature.geom.length * context.mile(Rules.feature) - width) / 2;
     496                        if (offset > 0) {
     497                                Point2D before = null;
     498                                Point2D after = null;
     499                                ArrayList<Point2D> between = new ArrayList<>();
     500                                Point2D prev = null;
     501                                Point2D next = null;
     502                                double length = 0;
     503                                double lb = 0;
     504                                double la = 0;
     505                                GeomIterator git = map.new GeomIterator(Rules.feature.geom);
     506                                if (git.hasComp()) {
     507                                        git.nextComp();
     508                                        while (git.hasEdge()) {
     509                                                git.nextEdge();
     510                                                while (git.hasNode()) {
     511                                                        Snode node = git.next();
     512                                                        if (node == null)
     513                                                                continue;
     514                                                        prev = next;
     515                                                        next = context.getPoint(node);
     516                                                        if (prev != null)
     517                                                                length += Math.sqrt(Math.pow((next.getX() - prev.getX()), 2) + Math.pow((next.getY() - prev.getY()), 2));
     518                                                        if (length < offset) {
     519                                                                before = next;
     520                                                                lb = la = length;
     521                                                        } else if (after == null) {
     522                                                                if (length > (offset + width)) {
     523                                                                        after = next;
     524                                                                        la = length;
     525                                                                        break;
    532526                                                                } else {
    533                                                                         succ = new Point2D.Double(curr.getX() + (gwidth * Math.cos(angle)), curr.getY() + (gwidth * Math.sin(angle)));
    534                                                                 }
    535                                                                 Shape shape = gv.getGlyphOutline(index);
    536                                                                 Point2D point = gv.getGlyphPosition(index);
    537                                                                 AffineTransform at = AffineTransform.getTranslateInstance(curr.getX(), curr.getY());
    538                                                                 at.rotate(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())));
    539                                                                 at.translate(-point.getX(), -point.getY() + (dy * sScale));
    540                                                                 path.append(at.createTransformedShape(shape), false);
    541                                                                 curr = succ;
    542                                                                 if (++index < gv.getNumGlyphs()) {
    543                                                                         gwidth = gv.getGlyphMetrics(index).getAdvance();
    544                                                                 } else {
    545                                                                         g2.fill(path);
    546                                                                         return;
     527                                                                        between.add(next);
    547528                                                                }
    548529                                                        }
    549530                                                }
     531                                                if (after != null)
     532                                                        break;
    550533                                        }
     534                                }
     535                                if (after != null) {
     536                                        double angle = Math.atan2((after.getY() - before.getY()), (after.getX() - before.getX()));
     537                                        double rotate = Math.abs(angle) < (Math.PI / 2) ? angle : angle + Math.PI;
     538                                        Point2D mid = new Point2D.Double((before.getX() + after.getX()) / 2, (before.getY() + after.getY()) / 2);
     539                                        Point2D centre = context.getPoint(Rules.feature.geom.centre);
     540                                        AffineTransform pos = AffineTransform.getTranslateInstance(-dy * Math.sin(rotate), dy * Math.cos(rotate));
     541                                        pos.rotate(rotate);
     542                                        pos.translate((mid.getX() - centre.getX()), (mid.getY() - centre.getY()));
     543                                        Symbol label = new Symbol();
     544                                        label.add(new Instr(Form.BBOX, new Rectangle2D.Double((-width / 2), (-height), width, height)));
     545                                        label.add(new Instr(Form.TEXT, new Caption(str, font, colour, new Delta(Handle.BC))));
     546                                        Symbols.drawSymbol(g2, label, sScale, centre.getX(), centre.getY(), null, new Delta(Handle.BC, pos));
    551547                                }
    552548                        }
     
    580576                }
    581577                if ((str != null) && (!str.isEmpty())) {
    582                         FontRenderContext frc = g2.getFontRenderContext();
    583578                        Font font = new Font("Arial", Font.PLAIN, 40);
    584                         GlyphVector gv = font.deriveFont(font.getSize2D() * (float)sScale).createGlyphVector(frc, str);
    585579                        double arc = (s2 > s1) ? (s2 - s1) : (s2 - s1 + 360);
    586580                        double awidth = (Math.toRadians(arc) * radial);
     
    589583                        radial += 30 * sScale;
    590584                        AffineTransform at = AffineTransform.getTranslateInstance(-radial * Math.sin(phi) / sScale, radial * Math.cos(phi) / sScale);
    591                         if (gv.getLogicalBounds().getWidth() < awidth) {
     585                        if ((font.getSize() * sScale * str.length()) < awidth) {
    592586                                at.rotate(Math.toRadians(mid + (hand ? 0 : 180)));
    593                                 Renderer.labelText(str, font, Color.black, new Delta(Handle.CC, at));
    594                         } else if (gv.getLogicalBounds().getHeight() < awidth) {
     587                                labelText(str, font, Color.black, new Delta(Handle.CC, at));
     588                        } else if ((font.getSize() * sScale) < awidth) {
    595589                                hand = (mid < 180);
    596590                                at.rotate(Math.toRadians(mid + (hand ? -90 : 90)));
    597                                 Renderer.labelText(str, font, Color.black, hand ? new Delta(Handle.RC, at) : new Delta(Handle.LC, at));
     591                                labelText(str, font, Color.black, hand ? new Delta(Handle.RC, at) : new Delta(Handle.LC, at));
    598592                        }
    599593                        if (dir != null) {
     
    605599                                at = AffineTransform.getTranslateInstance(-radial * Math.sin(phi) / sScale, radial * Math.cos(phi) / sScale);
    606600                                at.rotate(Math.toRadians(dir + (hand ? 90 : -90)));
    607                                 Renderer.labelText(str, font, Color.black, hand ? new Delta(Handle.BR, at) : new Delta(Handle.BL, at));
     601                                labelText(str, font, Color.black, hand ? new Delta(Handle.BR, at) : new Delta(Handle.BL, at));
    608602                        }
    609603                }
  • applications/editors/josm/plugins/seachart/src/render/Rules.java

    r32105 r32380  
    215215                        if (testObject(Obj.ROADWY)) for (Feature f : objects) if (testFeature(f)) highways();
    216216                        if (testObject(Obj.RAILWY)) for (Feature f : objects) if (testFeature(f)) highways();
     217                }
     218                if (Renderer.context.ruleset() == RuleSet.ALL) {
     219                        if (testObject(Obj.SOUNDG)) for (Feature f : objects) if (testFeature(f)) depths();
     220                        if (testObject(Obj.DEPCNT)) for (Feature f : objects) if (testFeature(f)) depths();
    217221                }
    218222                if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline();
     
    388392                                if ((Renderer.zoom >= 10) && (name != null))
    389393                                        if (feature.geom.prim == Pflag.LINE) {
    390                                                 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
     394                                                Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40);
    391395                                        } else {
    392396                                                Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     
    396400                                if ((Renderer.zoom >= 12) && (name != null))
    397401                                        if (feature.geom.prim == Pflag.LINE) {
    398                                                 Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
     402                                                Renderer.lineText(name, new Font("Arial", Font.PLAIN, 150), Color.black, -40);
    399403                                        } else {
    400404                                                Renderer.labelText(name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     
    411415                                        } else if (feature.geom.prim == Pflag.LINE) {
    412416                                                if (name != null) {
    413                                                         Renderer.lineText(name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40);
    414                                                         Renderer.lineText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0);
     417                                                        Renderer.lineText(name, new Font("Arial", Font.ITALIC, 75), Color.black, -40);
     418                                                        Renderer.lineText("(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0);
    415419                                                }
    416420                                        } else {
     
    503507                                }
    504508                        }
     509                        if (hasObject(Obj.NOTMRK))
     510                                notices();
    505511                        addName(15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(60, -50)));
    506512                        Signals.addSignals();
     
    608614                                Renderer.labelText(("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,50)));
    609615                        }
     616                }
     617        }
     618       
     619        private static void depths() {
     620                switch (feature.type) {
     621                case SOUNDG:
     622                        if ((Renderer.zoom >= 14) && hasAttribute(Obj.SOUNDG, Att.VALSOU)) {
     623                                double depth = (double)getAttVal(Obj.SOUNDG, Att.VALSOU);
     624                                String dstr = df.format(depth);
     625                                String tok[] = dstr.split("[-.]");
     626                                String ul = "";
     627                                String id = tok[0];
     628                                String dd = "";
     629                                if (tok[0].equals("")) {
     630                                        for (int i = 0; i <  tok[1].length(); i++)
     631                                                ul += "_";
     632                                        id = tok[1];
     633                                        dd = (tok.length == 3) ? tok[2] : "";
     634                                } else {
     635                                        dd = (tok.length == 2) ? tok[1] : "";
     636                                }
     637                                Renderer.labelText(ul, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10,15)));
     638                                Renderer.labelText(id, new Font("Arial", Font.PLAIN, 30), Color.black, new Delta(Handle.RC, AffineTransform.getTranslateInstance(10,0)));
     639                                Renderer.labelText(dd, new Font("Arial", Font.PLAIN, 20), Color.black, new Delta(Handle.LC, AffineTransform.getTranslateInstance(15,10)));
     640                        }
     641                        break;
     642                case DEPCNT:
     643                        break;
     644                default:
     645                        break;
    610646                }
    611647        }
     
    700736                case ACHBRT:
    701737                        if (Renderer.zoom >= 14) {
    702                                 Renderer.symbol(Harbours.Anchorage, new Scheme(Symbols.Mline));
     738                                Renderer.symbol(Harbours.Anchor, new Scheme(Symbols.Msymb));
    703739                                if (Renderer.zoom >= 15) {
    704                                         Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Mline, Color.white, new Delta(Handle.BC));
     740                                        Renderer.labelText(name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), Symbols.Msymb, LabelStyle.RRCT, Symbols.Msymb, Color.white, new Delta(Handle.BC));
    705741                                }
    706742                        }
     
    9931029        }
    9941030
     1031        @SuppressWarnings("unchecked")
    9951032        private static void notices() {
    9961033                if (Renderer.zoom >= 14) {
     
    10021039                        case BCNSAW:
    10031040                        case BCNSPP:
    1004                                 dy = 45.0;
     1041                                if (testAttribute(Obj.TOPMAR, Att.TOPSHP, TopSHP.TOP_BORD) || testAttribute(Obj.DAYMAR, Att.TOPSHP, TopSHP.TOP_BORD)) {
     1042                                        dy = -100.0;
     1043                                } else {
     1044                                        dy = -45.0;
     1045                                }
    10051046                                break;
    10061047                        case NOTMRK:
     
    10231064                                int i = 0;
    10241065                                for (AttMap atts : objs.values()) {
    1025                                         if (atts.get(Att.MARSYS) != null) sys = (MarSYS)(getAttEnum(Obj.NOTMRK, Att.MARSYS));
    1026                                         if (atts.get(Att.BNKWTW) != null) bnk = (BnkWTW)(getAttEnum(Obj.NOTMRK, Att.BNKWTW));
     1066                                        if (atts.get(Att.MARSYS) != null) sys = ((ArrayList<MarSYS>)(atts.get(Att.MARSYS).val)).get(0);
     1067                                        if (atts.get(Att.BNKWTW) != null) bnk = ((ArrayList<BnkWTW>)(atts.get(Att.BNKWTW).val)).get(0);
    10271068                                        CatNMK cat = CatNMK.NMK_UNKN;
    1028                                         if (atts.get(Att.CATNMK) != null) cat = (CatNMK)(getAttEnum(Obj.NOTMRK, Att.CATNMK));
     1069                                        if (atts.get(Att.CATNMK) != null) cat = ((ArrayList<CatNMK>)(atts.get(Att.CATNMK).val)).get(0);
    10291070                                        Symbol sym = Notices.getNotice(cat, sys, bnk);
    10301071                                        Scheme sch = Notices.getScheme(sys, bnk);
     1072                                        ArrayList<AddMRK> add = new ArrayList<>();
     1073                                        if (atts.get(Att.ADDMRK) != null) add = (ArrayList<AddMRK>)(atts.get(Att.ADDMRK).val);
    10311074                                        Handle h = Handle.CC;
     1075                                        double ax = 0.0;
     1076                                        double ay = 0.0;
    10321077                                        switch (i) {
    10331078                                        case 0:
     
    10351080                                                break;
    10361081                                        case 1:
    1037                                                 if (n <= 3)
     1082                                                if (n <= 3) {
    10381083                                                        h = Handle.RC;
    1039                                                 else
     1084                                                        ax = -30;
     1085                                                        ay = dy;
     1086                                                }
     1087                                                else {
    10401088                                                        h = Handle.BR;
     1089                                                }
    10411090                                                break;
    10421091                                        case 2:
     
    10561105                                                break;
    10571106                                        }
    1058                                         if (h != null) Renderer.symbol(sym, sch, new Delta(h, AffineTransform.getTranslateInstance(dx, dy)));
     1107                                        if (h != null) {
     1108                                                Renderer.symbol(sym, sch, new Delta(h, AffineTransform.getTranslateInstance(dx, dy)));
     1109                                                if (!add.isEmpty()) Renderer.symbol(Notices.NoticeBoard, new Delta(Handle.BC, AffineTransform.getTranslateInstance(ax, ay - 30)));
     1110                                        }
    10591111                                        i++;
    10601112                                }
     
    10691121                                Renderer.lineVector(new LineStyle(Color.black, 5, new float[] { 20, 20 }, null));
    10701122                                if (Renderer.zoom >= 15) {
    1071                                         Renderer.lineText("Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     1123                                        Renderer.lineText("Boom", new Font("Arial", Font.PLAIN, 80), Color.black, -20);
    10721124                                }
    10731125                        default:
     
    11861238                                                Renderer.lineVector(new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
    11871239                                                if (Renderer.zoom >= 15)
    1188                                                         Renderer.lineText("(covers)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 80);
     1240                                                        Renderer.lineText("(covers)", new Font("Arial", Font.PLAIN, 60), Color.black, 80);
    11891241                                        } else {
    11901242                                                Renderer.lineVector(new LineStyle(Color.black, 10, null, null));
    11911243                                        }
    11921244                                        if (Renderer.zoom >= 15)
    1193                                                 Renderer.lineText("Training Wall", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, -30);
     1245                                                Renderer.lineText("Training Wall", new Font("Arial", Font.PLAIN, 60), Color.black, -30);
    11941246                                        break;
    11951247                                case SLC_SWAY:
     
    13331385                                str += df.format(ort) + "º";
    13341386                                if (!str.isEmpty())
    1335                                         Renderer.lineText(str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     1387                                        Renderer.lineText(str, new Font("Arial", Font.PLAIN, 80), Color.black, -20);
    13361388                        }
    13371389                }
  • applications/editors/josm/plugins/seachart/src/s57/S57dat.java

    r31846 r32380  
    224224                } else {
    225225                        int f = Math.abs(conv.bin);
    226                         if (f < 8) {
     226                        if (f < 5) {
    227227                                long val = buffer[offset + --f];
    228228                                if (conv.bin > 0)
     
    253253                                return val;
    254254                        } else {
    255                                 f /= 8;
    256                                 long val = 0;
    257                                 for (int i = 0; i < f; i++) {
     255                                if (f == 5) {
     256                                        long val = buffer[offset++] & 0xff;
     257                                        f--;
     258                                        while (f > 0) {
     259                                                val = (val << 8) + (buffer[offset + --f] & 0xff);
     260                                        }
     261                                        offset += 4;
     262                                        return val;
     263                                } else {
     264                                        long val = buffer[offset++] & 0xff;
    258265                                        val = (val << 8) + (buffer[offset++] & 0xff);
    259                                 }
    260                                 return val;
     266                                        f = 4;
     267                                        while (f > 0) {
     268                                                val = (val << 8) + (buffer[offset + --f] & 0xff);
     269                                        }
     270                                        offset += 4;
     271                                        f = 2;
     272                                        while (f > 0) {
     273                                                val = (val << 8) + (buffer[offset + --f] & 0xff);
     274                                        }
     275                                        offset += 2;
     276                                        return val;
     277                                }
    261278                        }
    262279                }
  • applications/editors/josm/plugins/seachart/src/s57/S57dec.java

    r31722 r32380  
    2121                S57dat.rnum = 0;
    2222                byte[] leader = new byte[24];
     23                byte[] record = new byte[0];
    2324                boolean ddr = false;
    2425                int length = 0;
     
    4041                        try {
    4142                        length = Integer.parseInt(new String(leader, 0, 5)) - 24;
     43                        record = new byte[length];
    4244                        ddr = (leader[6] == 'L');
    4345                        fields = Integer.parseInt(new String(leader, 12, 5)) - 24;
     
    5052                        mapts = leader[23] - '0';
    5153                        entry = mapfl + mapfp + mapts;
    52                         byte[] record = new byte[length];
    5354                        if (in.read(record) != length)
    5455                                break;
     
    6162                                        case "0001":
    6263                                                int i8rn = ((Long) S57dat.decSubf(record, fields + pos, S57field.I8RI, S57subf.I8RN)).intValue();
    63                                                 if (i8rn != ++S57dat.rnum) {
    64                                                         System.err.println("Out of order record ID");
    65                                                         in.close();
    66                                                         System.exit(-1);
    67                                                 }
     64//                                              if (i8rn != ++S57dat.rnum) {
     65//                                                      System.err.println("Out of order record ID");
     66//                                                      in.close();
     67//                                                      System.exit(-1);
     68//                                              }
    6869                                                break;
    6970                                        case "DSSI":
     
    9394                                                break;
    9495                                        case "FOID":
    95                                                 name = (Long) S57dat.decSubf(record, fields + pos, S57field.LNAM, S57subf.LNAM);
     96                                                name = (long) S57dat.decSubf(record, fields + pos, S57field.LNAM, S57subf.LNAM);
    9697                                                map.newFeature(name, pflag, objl);
    9798                                                break;
     
    109110                                                S57dat.setField(record, fields + pos, S57field.FFPT, len);
    110111                                                do {
    111                                                         name = (Long) S57dat.decSubf(S57subf.LNAM);
     112                                                        name = (long) S57dat.decSubf(S57subf.LNAM);
    112113                                                        int rind = ((Long) S57dat.decSubf(S57subf.RIND)).intValue();
    113114                                                        S57dat.decSubf(S57subf.COMT);
    114                                                         map.newObj(name, rind);
     115                                                        map.refObj(name, rind);
    115116                                                } while (S57dat.more());
    116117                                                break;
     
    118119                                                S57dat.setField(record, fields + pos, S57field.FSPT, len);
    119120                                                do {
    120                                                         name = (Long) S57dat.decSubf(S57subf.NAME) << 16;
     121                                                        name = (long) S57dat.decSubf(S57subf.NAME) << 16;
    121122                                                        map.newPrim(name, (Long) S57dat.decSubf(S57subf.ORNT), (Long) S57dat.decSubf(S57subf.USAG));
    122123                                                        S57dat.decSubf(S57subf.MASK);
     
    138139                                                }
    139140                                                name <<= 32;
    140                                                 name += (Long) S57dat.decSubf(S57subf.RCID);
     141                                                name += (long) S57dat.decSubf(S57subf.RCID);
    141142                                                name <<= 16;
    142143                                                if (nflag == Nflag.ANON) {
  • applications/editors/josm/plugins/seachart/src/s57/S57map.java

    r32090 r32380  
    273273        }
    274274       
    275         public void newObj(long id, int rind) {
     275        public void refObj(long id, int rind) {
    276276                Rflag r = Rflag.UNKN;
    277277                switch (rind) {
  • applications/editors/josm/plugins/seachart/src/s57/S57val.java

    r32101 r32380  
    812812  Catnmk.put(CatNMK.NMK_WEIR, new S57enum(52, "weir")); Catnmk.put(CatNMK.NMK_FERN, new S57enum(53, "ferry_non_independent"));  Catnmk.put(CatNMK.NMK_FERI, new S57enum(54, "ferry_independent"));
    813813  Catnmk.put(CatNMK.NMK_BRTP, new S57enum(55, "berthing_permitted")); Catnmk.put(CatNMK.NMK_BTLL, new S57enum(56, "berthing_lateral_limit")); Catnmk.put(CatNMK.NMK_BTLS, new S57enum(57, "berthing_lateral_limits"));
    814    Catnmk.put(CatNMK.NMK_BTRL, new S57enum(58, "berthing_rafting_limit"));  Catnmk.put(CatNMK.NMK_BTUP, new S57enum(59, "berthing_unmarked_pushing"));
     814   Catnmk.put(CatNMK.NMK_BTRL, new S57enum(58, "berth_rafting_limit"));  Catnmk.put(CatNMK.NMK_BTUP, new S57enum(59, "berthing_unmarked_pushing"));
    815815   Catnmk.put(CatNMK.NMK_BTP1, new S57enum(60, "berthing_marked_pushing_1")); Catnmk.put(CatNMK.NMK_BTP2, new S57enum(61, "berthing_marked_pushing_2"));
    816816   Catnmk.put(CatNMK.NMK_BTP3, new S57enum(62, "berthing_marked_pushing_3")); Catnmk.put(CatNMK.NMK_BTUN, new S57enum(63, "berthing_unmarked_non-pushing"));
  • applications/editors/josm/plugins/seachart/src/symbols/Notices.java

    r32101 r32380  
    10371037                NoticeE24.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Notices.NoticeE, 1.0, 0, 0, null, null)));
    10381038                NoticeE24.add(new Instr(Form.SYMB, new Symbols.SubSymbol(Notices.Waterbike, 1.0, 0, 0, new Scheme(Color.white), null)));
     1039        }
     1040
     1041        public static final Symbol NoticeBoard = new Symbol();
     1042        static {
     1043                NoticeBoard.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30,-30,60,30)));
     1044                NoticeBoard.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     1045                Path2D.Double p = new Path2D.Double(); p.moveTo(-20,0); p.lineTo(20,0); p.lineTo(20,-15); p.lineTo(-20,-15); p.closePath();
     1046                NoticeBoard.add(new Instr(Form.FILL, Color.white));
     1047                NoticeBoard.add(new Instr(Form.PGON, p));
     1048                NoticeBoard.add(new Instr(Form.FILL, Color.black));
     1049                NoticeBoard.add(new Instr(Form.PLIN, p));
     1050        }
     1051        public static final Symbol NoticeTriangle = new Symbol();
     1052        static {
     1053                NoticeTriangle.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30,-30,60,30)));
     1054                NoticeTriangle.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     1055                Path2D.Double p = new Path2D.Double(); p.moveTo(-20,0); p.lineTo(20,0); p.lineTo(0,-15); p.closePath();
     1056                NoticeTriangle.add(new Instr(Form.FILL, Color.white));
     1057                NoticeTriangle.add(new Instr(Form.PGON, p));
     1058                NoticeTriangle.add(new Instr(Form.FILL, Color.black));
     1059                NoticeTriangle.add(new Instr(Form.PLIN, p));
    10391060        }
    10401061
  • applications/editors/josm/plugins/seachart/src/symbols/Symbols.java

    r32101 r32380  
    2121
    2222        public static final Color Yland = new Color(0xedbc0c);
    23         public static final Color Bwater = new Color(0x78acd2);
     23//      public static final Color Bwater = new Color(0x78acd2);
     24        public static final Color Bwater = new Color(0x9bc5e3);
    2425        public static final Color Gdries = new Color(0x689868);
    2526        public static final Color Mline = new Color(0x9a6078);
  • applications/editors/josm/plugins/seachart/src/symbols/Topmarks.java

    r32101 r32380  
    4747        public static final Symbol TopBoard = new Symbol();
    4848        static {
    49                 TopBoard.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
    50                 Symbol colours = new Symbol();
    51                 Path2D.Double p = new Path2D.Double(); p.moveTo(-19.0,-2.0); p.lineTo(-19.0,-39.0); p.lineTo(19.0,-39.0); p.lineTo(19.0,-2.0); p.closePath();
    52                 colours.add(new Instr(Form.P1, p));
     49                TopBoard.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30,-60,60,60)));
     50                Symbol colours = new Symbol();
     51                Path2D.Double p = new Path2D.Double(); p.moveTo(-29,-1); p.lineTo(-29,-59); p.lineTo(29,-59); p.lineTo(29,-1); p.closePath();
     52                colours.add(new Instr(Form.P1, p));
     53                p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_EVEN_ODD);
     54                p.moveTo(-29,-1); p.lineTo(-29,-59); p.lineTo(29,-59); p.lineTo(29,-1); p.closePath();
     55                p.moveTo(-19,-10); p.lineTo(-19,-49); p.lineTo(19,-49); p.lineTo(19,-10); p.closePath();
     56                colours.add(new Instr(Form.B1, p));
     57                p = new Path2D.Double(); p.setWindingRule(GeneralPath.WIND_EVEN_ODD);
     58                p.moveTo(-29,-1); p.lineTo(-29,-30); p.lineTo(29,-30); p.lineTo(29,-59); p.lineTo(0,-59); p.lineTo(0,-1); p.closePath();
     59                colours.add(new Instr(Form.S2, p));
     60                p = new Path2D.Double(); p.moveTo(-29,-1); p.lineTo(-29,-30); p.lineTo(0,-30); p.lineTo(0,-1); p.closePath();
     61                colours.add(new Instr(Form.S3, p));
     62                p = new Path2D.Double(); p.moveTo(0,-1); p.lineTo(0,-30); p.lineTo(29,-30); p.lineTo(29,-1); p.closePath();
     63                colours.add(new Instr(Form.S4, p));
    5364                TopBoard.add(new Instr(Form.COLR, colours));
    5465                TopBoard.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    5566                TopBoard.add(new Instr(Form.FILL, Color.black));
    56                 p = new Path2D.Double(); p.moveTo(-19.0,-2.0); p.lineTo(-19.0,-39.0); p.lineTo(19.0,-39.0); p.lineTo(19.0,-2.0); p.closePath();
     67                p = new Path2D.Double(); p.moveTo(-29,-1); p.lineTo(-29,-59); p.lineTo(29,-59); p.lineTo(29.0,-1); p.closePath();
    5768                TopBoard.add(new Instr(Form.PLIN, p));
    5869        }
     
    7081                TopCan.add(new Instr(Form.PLIN, p));
    7182        }
     83        public static final Symbol TopCanSphere = new Symbol();
     84        public static final Symbol TopCircle = new Symbol();
     85        public static final Symbol TopCircleTriangle = new Symbol();
    7286        public static final Symbol TopCone = new Symbol();
    7387        static {
     
    8296                p = new Path2D.Double(); p.moveTo(-15.0,-15.0); p.lineTo(0.0,-45.0); p.lineTo(15.0,-15.0); p.closePath();
    8397                TopCone.add(new Instr(Form.PLIN, p));
     98        }
     99        public static final Symbol TopConeSphere = new Symbol();
     100        static {
     101                TopConeSphere.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
     102                Symbol colours = new Symbol();
     103                Path2D.Double p = new Path2D.Double(); p.moveTo(-15.0,-47.0); p.lineTo(0.0,-77.0); p.lineTo(15.0,-47.0); p.closePath();
     104                p.moveTo(-14.0,-28.0); p.curveTo(-14.0,-46.7,14.0,-46.7,14.0,-28.0); p.curveTo(14.0,-9.3,-14.0,-9.3,-14.0,-28.0); p.closePath();
     105                colours.add(new Instr(Form.P1, p));
     106                TopConeSphere.add(new Instr(Form.COLR, colours));
     107                TopConeSphere.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     108                TopConeSphere.add(new Instr(Form.FILL, Color.black));
     109                TopConeSphere.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-15)));
     110                TopConeSphere.add(new Instr(Form.LINE, new Line2D.Double(0,-42,0,-47)));
     111                p = new Path2D.Double(); p.moveTo(-15.0,-47.0); p.lineTo(0.0,-77.0); p.lineTo(15.0,-47.0); p.closePath();
     112                TopConeSphere.add(new Instr(Form.ELPS, new Ellipse2D.Double(-14,-42,28,28)));
     113                TopConeSphere.add(new Instr(Form.PLIN, p));
    84114        }
    85115        public static final Symbol TopCross = new Symbol();
     
    98128                p.lineTo(5.0,-60.0); p.lineTo(5.0,-42.5); p.lineTo(22.5,-42.5); p.lineTo(22.5,-32.5); p.lineTo(5.0,-32.5); p.lineTo(5.0,-15.0); p.closePath();
    99129                TopCross.add(new Instr(Form.PLIN, p));
     130        }
     131        public static final Symbol TopCrosses = new Symbol();
     132        static {
     133               
     134        }
     135        public static final Symbol TopCrossCircle = new Symbol();
     136        static {
     137               
     138        }
     139        public static final Symbol TopCube = new Symbol();
     140        static {
     141                TopCube.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
     142                Symbol colours = new Symbol();
     143                Path2D.Double p = new Path2D.Double(); p.moveTo(0,-48); p.lineTo(-15,-37); p.lineTo(-15,-20); p.lineTo(0,-9); p.lineTo(15,-20); p.lineTo(15,-37); p.closePath();
     144                colours.add(new Instr(Form.P1, p));
     145                TopCube.add(new Instr(Form.COLR, colours));
     146                TopCube.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     147                TopCube.add(new Instr(Form.FILL, Color.black));
     148                TopCube.add(new Instr(Form.LINE, new Line2D.Double(0,0,0,-15)));
     149                p = new Path2D.Double(); p.moveTo(0,-48); p.lineTo(-14,-37); p.lineTo(0,-26); p.lineTo(14,-37); p.closePath(); p.moveTo(0,-26); p.lineTo(0,0);
     150                p.moveTo(-15,-37); p.lineTo(-15,-20); p.lineTo(0,-9); p.lineTo(15,-20); p.lineTo(15,-37);
     151                TopCube.add(new Instr(Form.PLIN, p));
    100152        }
    101153        public static final Symbol TopEast = new Symbol();
     
    256308                TopSquare.add(new Instr(Form.PLIN, p));
    257309        }
     310        public static final Symbol TopRectangleH = new Symbol();
     311        static {
     312                TopRectangleH.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
     313                Symbol colours = new Symbol();
     314                Path2D.Double p = new Path2D.Double(); p.moveTo(-20.0,-1.0); p.lineTo(-20.0,-27.0); p.lineTo(20.0,-27.0); p.lineTo(20.0,-1.0); p.closePath();
     315                colours.add(new Instr(Form.P1, p));
     316                TopRectangleH.add(new Instr(Form.COLR, colours));
     317                TopRectangleH.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     318                TopRectangleH.add(new Instr(Form.FILL, Color.black));
     319                p = new Path2D.Double(); p.moveTo(-20.0,-1.0); p.lineTo(-20.0,-27.0); p.lineTo(20.0,-27.0); p.lineTo(20.0,-1.0); p.closePath();
     320                TopRectangleH.add(new Instr(Form.PLIN, p));
     321        }
     322        public static final Symbol TopRectangleV = new Symbol();
     323        static {
     324                TopRectangleV.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
     325                Symbol colours = new Symbol();
     326                Path2D.Double p = new Path2D.Double(); p.moveTo(-13.0,-1.0); p.lineTo(-13.0,-41.0); p.lineTo(13.0,-41.0); p.lineTo(13.0,-1.0); p.closePath();
     327                colours.add(new Instr(Form.P1, p));
     328                TopRectangleV.add(new Instr(Form.COLR, colours));
     329                TopRectangleV.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     330                TopRectangleV.add(new Instr(Form.FILL, Color.black));
     331                p = new Path2D.Double(); p.moveTo(-13.0,-1.0); p.lineTo(-13.0,-41.0); p.lineTo(13.0,-41.0); p.lineTo(13.0,-1.0); p.closePath();
     332                TopRectangleV.add(new Instr(Form.PLIN, p));
     333        }
    258334        public static final Symbol TopRhombus = new Symbol();
    259335        static {
     
    280356                TopRhombus.add(new Instr(Form.PLIN, p));
    281357        }
     358        public static final Symbol TopRhombusCircle = new Symbol();
     359        static {
     360               
     361        }
     362        public static final Symbol TopSphereRhombus = new Symbol();
     363        static {
     364                TopSphereRhombus.add(new Instr(Form.BBOX, new Rectangle2D.Double(-30,-80,60,80)));
     365                TopSphereRhombus.add(new Instr(Form.SYMB, new Symbols.SubSymbol(TopRhombus, 1.0, 0, 0, null, null)));
     366                Symbol colours = new Symbol();
     367                Path2D.Double p = new Path2D.Double(); p.moveTo(-14.0,-44.0); p.curveTo(-14.0,-62.7,14.0,-62.7,14.0,-44.0); p.curveTo(14.0,-25.3,-14.0,-25.3,-14.0,-44.0); p.closePath();
     368                colours.add(new Instr(Form.P1, p));
     369                TopSphereRhombus.add(new Instr(Form.COLR, colours));
     370                TopSphereRhombus.add(new Instr(Form.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     371                TopSphereRhombus.add(new Instr(Form.FILL, Color.black));
     372                TopSphereRhombus.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     373                TopSphereRhombus.add(new Instr(Form.ELPS, new Ellipse2D.Double(-14,-58,28,28)));
     374        }
     375        public static final Symbol TopT = new Symbol();
     376        static {
     377               
     378        }
     379        public static final Symbol TopTrapeziumU = new Symbol();
     380        static {
     381                TopTrapeziumU.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
     382                Symbol colours = new Symbol();
     383                Path2D.Double p = new Path2D.Double(); p.moveTo(-20.0,-1.0); p.lineTo(-13.0,-27.0); p.lineTo(13.0,-27.0); p.lineTo(20.0,-1.0); p.closePath();
     384                colours.add(new Instr(Form.P1, p));
     385                TopTrapeziumU.add(new Instr(Form.COLR, colours));
     386                TopTrapeziumU.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     387                TopTrapeziumU.add(new Instr(Form.FILL, Color.black));
     388                p = new Path2D.Double(); p.moveTo(-20.0,-1.0); p.lineTo(-13.0,-27.0); p.lineTo(13.0,-27.0); p.lineTo(20.0,-1.0); p.closePath();
     389                TopTrapeziumU.add(new Instr(Form.PLIN, p));
     390        }
     391        public static final Symbol TopTrapeziumD = new Symbol();
     392        static {
     393                TopTrapeziumD.add(new Instr(Form.BBOX, new Rectangle2D.Double(-20,-80,40,80)));
     394                Symbol colours = new Symbol();
     395                Path2D.Double p = new Path2D.Double(); p.moveTo(-13.0,-1.0); p.lineTo(-20.0,-27.0); p.lineTo(20.0,-27.0); p.lineTo(13.0,-1.0); p.closePath();
     396                colours.add(new Instr(Form.P1, p));
     397                TopTrapeziumD.add(new Instr(Form.COLR, colours));
     398                TopTrapeziumD.add(new Instr(Form.STRK, new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     399                TopTrapeziumD.add(new Instr(Form.FILL, Color.black));
     400                p = new Path2D.Double(); p.moveTo(-13.0,-1.0); p.lineTo(-20.0,-27.0); p.lineTo(20.0,-27.0); p.lineTo(13.0,-1.0); p.closePath();
     401                TopTrapeziumD.add(new Instr(Form.PLIN, p));
     402        }
    282403        public static final Symbol TopTriangle = new Symbol();
    283404        static {
     
    311432                p = new Path2D.Double(); p.moveTo(-15.0,-29.0); p.lineTo(0.0,-1.0); p.lineTo(15.0,-29.0); p.closePath();
    312433                TopItriangle.add(new Instr(Form.PLIN, p));
     434        }
     435        public static final Symbol TopTriangleCircle = new Symbol();
     436        static {
     437               
    313438        }
    314439        public static final Symbol TopWest = new Symbol();
     
    345470                TopX.add(new Instr(Form.PLIN, p));
    346471        }
     472        public static final Symbol TopOther = new Symbol();
     473        static {
     474               
     475        }
    347476       
    348477        public static final EnumMap<TopSHP, Symbol> Shapes = new EnumMap<TopSHP, Symbol>(TopSHP.class);
     
    352481                Shapes.put(TopSHP.TOP_ISD, TopIsol); Shapes.put(TopSHP.TOP_NORTH, TopNorth); Shapes.put(TopSHP.TOP_SOUTH, TopSouth); Shapes.put(TopSHP.TOP_SPHR, TopSphere);
    353482                Shapes.put(TopSHP.TOP_SQUR, TopSquare); Shapes.put(TopSHP.TOP_TRI, TopTriangle); Shapes.put(TopSHP.TOP_ITRI, TopItriangle); Shapes.put(TopSHP.TOP_WEST, TopWest);
    354                 Shapes.put(TopSHP.TOP_SALT, TopX); Shapes.put(TopSHP.TOP_RHOM, TopRhombus); Shapes.put(TopSHP.TOP_FLAG, TopFlag);
    355         }
    356         /*
    357          TOP_CUBE, TOP_SPRH, TOP_HRECT, TOP_VRECT, TOP_TRAP, TOP_ITRAP, TOP_CIRC, TOP_CRSS, TOP_T, TOP_TRCL, TOP_CRCL, TOP_RHCL, TOP_CLTR, TOP_OTHR, TOP_CYSP, TOP_COSP
    358          */
     483                Shapes.put(TopSHP.TOP_SALT, TopX); Shapes.put(TopSHP.TOP_RHOM, TopRhombus); Shapes.put(TopSHP.TOP_FLAG, TopFlag); Shapes.put(TopSHP.TOP_CUBE, TopCube);
     484                Shapes.put(TopSHP.TOP_SPRH, TopSphereRhombus); Shapes.put(TopSHP.TOP_HRECT, TopRectangleH); Shapes.put(TopSHP.TOP_VRECT, TopRectangleV);
     485                Shapes.put(TopSHP.TOP_TRAP, TopTrapeziumU); Shapes.put(TopSHP.TOP_ITRAP, TopTrapeziumD); Shapes.put(TopSHP.TOP_COSP, TopConeSphere);
     486                Shapes.put(TopSHP.TOP_CIRC, TopCircle); Shapes.put(TopSHP.TOP_CRSS, TopCrosses); Shapes.put(TopSHP.TOP_T, TopT); Shapes.put(TopSHP.TOP_TRCL, TopTriangleCircle);
     487                Shapes.put(TopSHP.TOP_CRCL, TopCrossCircle); Shapes.put(TopSHP.TOP_RHCL, TopRhombusCircle); Shapes.put(TopSHP.TOP_CLTR, TopCircleTriangle);
     488                Shapes.put(TopSHP.TOP_CYSP, TopCanSphere); Shapes.put(TopSHP.TOP_OTHR, TopOther);
     489        }
     490
    359491        public static final EnumMap<BoySHP, Delta> BuoyDeltas = new EnumMap<BoySHP, Delta>(BoySHP.class);
    360492        static {
Note: See TracChangeset for help on using the changeset viewer.