Ignore:
Timestamp:
2013-11-08T23:08:11+01:00 (11 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed2/src
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/s57/S57att.java

    r30024 r30046  
    139139                AttStr.put(Att.NPLDST, "national_pilot_district"); AttStr.put(Att.NTXTDS, "national_description"); AttStr.put(Att.HORDAT, "horizontal_datum");
    140140                AttStr.put(Att.POSACC, "positional_accuracy"); AttStr.put(Att.QUAPOS, "position_quality"); AttStr.put(Att.ADDMRK, "addition"); AttStr.put(Att.BNKWTW, "bank");
    141                 AttStr.put(Att.CATBNK, "category");     AttStr.put(Att.CATNMK, "category"); AttStr.put(Att.CLSDNG, "class"); AttStr.put(Att.DIRIMP, "impact");
     141                AttStr.put(Att.CATBNK, "category");     AttStr.put(Att.CATNMK, "category"); AttStr.put(Att.CLSDNG, "danger_class"); AttStr.put(Att.DIRIMP, "impact");
    142142                AttStr.put(Att.DISBK1, "distance_start");       AttStr.put(Att.DISBK2, "distance_end");AttStr.put(Att.DISIPU, "distance_up"); AttStr.put(Att.DISIPD, "distance_down");
    143143                AttStr.put(Att.ELEVA1, "minimum_elevation"); AttStr.put(Att.ELEVA2, "maximum_elevation"); AttStr.put(Att.FNCTNM, "function"); AttStr.put(Att.WTWDIS, "distance");
    144                 AttStr.put(Att.BUNVES, "availibility"); AttStr.put(Att.CATBRT, "category"); AttStr.put(Att.CATBUN, "category"); AttStr.put(Att.CATCCL, "category");
     144                AttStr.put(Att.BUNVES, "availability"); AttStr.put(Att.CATBRT, "category"); AttStr.put(Att.CATBUN, "category"); AttStr.put(Att.CATCCL, "category");
    145145                AttStr.put(Att.CATHBR, "category");     AttStr.put(Att.CATRFD, "category"); AttStr.put(Att.CATTML, "category"); AttStr.put(Att.COMCTN, "communication");
    146146                AttStr.put(Att.HORCLL, "clearance_length");     AttStr.put(Att.HORCLW, "clearance_width"); AttStr.put(Att.TRSHGD, "goods"); AttStr.put(Att.UNLOCD, "locode");
     
    150150                AttStr.put(Att.CATVTR, "category");     AttStr.put(Att.CATTAB, "operation"); AttStr.put(Att.SCHREF, "schedule"); AttStr.put(Att.USESHP, "use"); AttStr.put(Att.CURVHW, "high_velocity");
    151151                AttStr.put(Att.CURVLW, "low_velocity"); AttStr.put(Att.CURVMW, "mean_velocity"); AttStr.put(Att.CURVOW, "other_velocity"); AttStr.put(Att.APTREF, "passing_time");
     152                AttStr.put(Att.CATCOM, "category");
    152153                AttStr.put(Att.CATEXS, "category"); AttStr.put(Att.CATWWM, "category"); AttStr.put(Att.SHPTYP, "ship"); AttStr.put(Att.UPDMSG, "message"); AttStr.put(Att.LITRAD, "radius");
    153154        }
     
    203204          objatt.add(new ObjAtt(Obj.WEDKLP, Att.CATWED)); objatt.add(new ObjAtt(Obj.WRECKS, Att.CATWRK)); objatt.add(new ObjAtt(Obj.TS_FEB, Att.CAT_TS));
    204205          objatt.add(new ObjAtt(Obj.DEPCNT, Att.VALDCO)); objatt.add(new ObjAtt(Obj.SOUNDG, Att.VALSOU)); objatt.add(new ObjAtt(Obj.NOTMRK, Att.BNKWTW));
     206          objatt.add(new ObjAtt(Obj.WTWAXS, Att.CATCCL)); objatt.add(new ObjAtt(Obj.WTWARE, Att.CATCCL)); objatt.add(new ObjAtt(Obj.COMARE, Att.CATCOM));
     207          objatt.add(new ObjAtt(Obj.RDOCAL, Att.CATCOM)); objatt.add(new ObjAtt(Obj.WTWGAG, Att.CATGAG));
    205208          objatt.add(new ObjAtt(Obj.ACHBRT, Att.RADIUS)); objatt.add(new ObjAtt(Obj.LIGHTS, Att.LITRAD));
    206209        }
  • applications/editors/josm/plugins/smed2/src/s57/S57val.java

    r30040 r30046  
    9696        public enum CatCHP { CHP_UNKN, CHP_CSTM, CHP_BRDR }
    9797        private static final EnumMap<CatCHP, S57enum> Catchp = new EnumMap<CatCHP, S57enum>(CatCHP.class); static { Catchp.put(CatCHP.CHP_UNKN, new S57enum(0, ""));
    98                 Catchp.put(CatCHP.CHP_CSTM, new S57enum(1, "custom")); Catchp.put(CatCHP.CHP_BRDR, new S57enum(2, "border"));
     98                Catchp.put(CatCHP.CHP_CSTM, new S57enum(1, "customs")); Catchp.put(CatCHP.CHP_BRDR, new S57enum(2, "border"));
    9999        }
    100100        public enum CatCOA { COA_UNKN, COA_STEP, COA_FLAT, COA_SAND, COA_STON, COA_SHNG, COA_GLCR, COA_MNGV, COA_MRSH, COA_CRRF, COA_ICE, COA_SHEL }
     
    855855        private static final EnumMap<CatCOM, S57enum> Catcom = new EnumMap<CatCOM, S57enum>(CatCOM.class); static { Catcom.put(CatCOM.COM_UNKN, new S57enum(0, ""));
    856856                Catcom.put(CatCOM.COM_VTSC, new S57enum(1, "vts_centre")); Catcom.put(CatCOM.COM_VTSS, new S57enum(2, "vts_sector")); Catcom.put(CatCOM.COM_IVSP, new S57enum(3, "ivs_point"));
    857                 Catcom.put(CatCOM.COM_MID, new S57enum(4, "mid")); Catcom.put(CatCOM.COM_LOCK, new S57enum(5, "lock")); Catcom.put(CatCOM.COM_BRDG, new S57enum(6, "bridge"));
    858                 Catcom.put(CatCOM.COM_CSTM, new S57enum(7, "custom")); Catcom.put(CatCOM.COM_HRBR, new S57enum(8, "harbour"));
     857                Catcom.put(CatCOM.COM_MID, new S57enum(4, "mib")); Catcom.put(CatCOM.COM_LOCK, new S57enum(5, "lock")); Catcom.put(CatCOM.COM_BRDG, new S57enum(6, "bridge"));
     858                Catcom.put(CatCOM.COM_CSTM, new S57enum(7, "customs")); Catcom.put(CatCOM.COM_HRBR, new S57enum(8, "harbour"));
    859859        }
    860860        public enum CatHBR { HBR_UNKN, HBR_CSTM, HBR_REFG, HBR_MRNA, HBR_FISH, HBR_PRIV, HBR_ }
    861861        private static final EnumMap<CatHBR, S57enum> Cathbr = new EnumMap<CatHBR, S57enum>(CatHBR.class); static { Cathbr.put(CatHBR.HBR_UNKN, new S57enum(0, ""));
    862                 Cathbr.put(CatHBR.HBR_CSTM, new S57enum(1, "custom")); Cathbr.put(CatHBR.HBR_REFG, new S57enum(2, "refuge")); Cathbr.put(CatHBR.HBR_MRNA, new S57enum(3, "marina"));
     862                Cathbr.put(CatHBR.HBR_CSTM, new S57enum(1, "customs")); Cathbr.put(CatHBR.HBR_REFG, new S57enum(2, "refuge")); Cathbr.put(CatHBR.HBR_MRNA, new S57enum(3, "marina"));
    863863                Cathbr.put(CatHBR.HBR_FISH, new S57enum(4, "fishing")); Cathbr.put(CatHBR.HBR_PRIV, new S57enum(5, "private"));
    864864        }
  • applications/editors/josm/plugins/smed2/src/seamap/Renderer.java

    r30037 r30046  
    1616import java.util.*;
    1717
    18 import s57.S57att.*;
    19 import s57.S57obj.*;
    2018import s57.S57val.*;
    21 import s57.S57val;
    2219import seamap.SeaMap;
    2320import seamap.SeaMap.*;
     
    3027        public static final double symbolScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138, 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007, 0.138 };
    3128
     29        public static final Color Yland = new Color(0x50b0ff);
     30        public static final Color Mline = new Color(0x80c480);
     31        public static final Color Msymb = new Color(0xa30075);
     32       
     33        static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class);
     34        static {
     35                bodyColours.put(ColCOL.COL_UNK, new Color(0, true));
     36                bodyColours.put(ColCOL.COL_WHT, new Color(0xffffff));
     37                bodyColours.put(ColCOL.COL_BLK, new Color(0x000000));
     38                bodyColours.put(ColCOL.COL_RED, new Color(0xd40000));
     39                bodyColours.put(ColCOL.COL_GRN, new Color(0x00d400));
     40                bodyColours.put(ColCOL.COL_BLU, Color.blue);
     41                bodyColours.put(ColCOL.COL_YEL, new Color(0xffd400));
     42                bodyColours.put(ColCOL.COL_GRY, Color.gray);
     43                bodyColours.put(ColCOL.COL_BRN, new Color(0x8b4513));
     44                bodyColours.put(ColCOL.COL_AMB, new Color(0xfbf00f));
     45                bodyColours.put(ColCOL.COL_VIO, new Color(0xee82ee));
     46                bodyColours.put(ColCOL.COL_ORG, Color.orange);
     47                bodyColours.put(ColCOL.COL_MAG, new Color(0xf000f0));
     48                bodyColours.put(ColCOL.COL_PNK, Color.pink);
     49        }
     50
     51        static final EnumMap<ColPAT, Patt> pattMap = new EnumMap<ColPAT, Patt>(ColPAT.class);
     52        static {
     53                pattMap.put(ColPAT.PAT_UNKN, Patt.Z);
     54                pattMap.put(ColPAT.PAT_HORI, Patt.H);
     55                pattMap.put(ColPAT.PAT_VERT, Patt.V);
     56                pattMap.put(ColPAT.PAT_DIAG, Patt.D);
     57                pattMap.put(ColPAT.PAT_BRDR, Patt.B);
     58                pattMap.put(ColPAT.PAT_SQUR, Patt.S);
     59                pattMap.put(ColPAT.PAT_CROS, Patt.C);
     60                pattMap.put(ColPAT.PAT_SALT, Patt.X);
     61                pattMap.put(ColPAT.PAT_STRP, Patt.H);
     62        }
     63       
    3264        public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, HCLR }
    3365
  • applications/editors/josm/plugins/smed2/src/seamap/Rules.java

    r30040 r30046  
    1414import java.awt.geom.AffineTransform;
    1515import java.util.ArrayList;
    16 
     16import java.util.HashMap;
     17
     18import s57.S57val;
    1719import s57.S57val.*;
    1820import s57.S57att.*;
     
    2830        static int zoom;
    2931       
    30         public static final Color Yland = new Color(0x50b0ff);
    31         public static final Color Mline = new Color(0x80c480);
    32         public static final Color Msymb = new Color(0xa30075);
     32        static String getName(Feature feature) {
     33                AttItem name = feature.atts.get(Att.OBJNAM);
     34                if (name == null) {
     35                        name = feature.objs.get(feature.type).get(0).get(Att.OBJNAM);
     36                }
     37                if (name != null) return (String)name.val;
     38                return null;
     39        }
     40
     41        static AttMap getAtts(Feature feature, Obj obj, int idx) {
     42                HashMap<Integer, AttMap> objs = feature.objs.get(obj);
     43                if (objs == null)
     44                        return null;
     45                else
     46                        return objs.get(idx);
     47        }
     48
     49        public static Object getAttVal(Feature feature, Obj obj, int idx, Att att) {
     50                AttMap atts = null;
     51                HashMap<Integer, AttMap> objs = feature.objs.get(obj);
     52                if (objs != null)
     53                        atts = objs.get(idx);
     54                if (atts == null)
     55                        return S57val.nullVal(att);
     56                else {
     57                        AttItem item = atts.get(att);
     58                        if (item == null)
     59                                return S57val.nullVal(att);
     60                        return item.val;
     61                }
     62        }
     63       
     64        static Scheme getScheme(Feature feature, Obj obj) {
     65                ArrayList<Color> colours = new ArrayList<Color>();
     66                for (ColCOL col : (ArrayList<ColCOL>)getAttVal(feature, obj, 0, Att.COLOUR)) {
     67                        colours.add(Renderer.bodyColours.get(col));
     68                }
     69                ArrayList<Patt> patterns = new ArrayList<Patt>();
     70                for(ColPAT pat: (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT)) {
     71                        patterns.add(Renderer.pattMap.get(pat));
     72                }
     73                return new Scheme(patterns, colours);
     74        }
     75       
     76        static boolean hasObject(Feature feature, Obj obj) {
     77                return (feature.objs.containsKey(obj));
     78        }
     79       
     80        static boolean hasAttribute(Feature feature, Obj obj, Att att) {
     81                AttMap atts = getAtts(feature, obj, 0);
     82                return ((atts != null) && (atts.containsKey(att)));
     83        }
     84       
     85        static boolean testAttribute(Feature feature, Obj obj, Att att, Object val) {
     86                AttMap atts = getAtts(feature, obj, 0);
     87                if (atts != null) {
     88                        AttItem item = atts.get(att);
     89                        if (item != null) {
     90                                switch (item.conv) {
     91                                case S:
     92                                case A:
     93                                        return ((String)item.val).equals(val);
     94                                case L:
     95                                        return ((ArrayList<?>)item.val).contains(val);
     96                                case E:
     97                                case F:
     98                                case I:
     99                                        return item.val.equals(val);
     100                                }
     101                        }
     102                }
     103                return false;
     104        }
    33105       
    34106        public static void rules (SeaMap m, int z) {
     
    77149                if ((objects = map.features.get(Obj.SMCFAC)) != null) for (Feature feature : objects) marinas(feature);
    78150                if ((objects = map.features.get(Obj.BRIDGE)) != null) for (Feature feature : objects) bridges(feature);
     151                if ((objects = map.features.get(Obj.PILPNT)) != null) for (Feature feature : objects) lights(feature);
     152                if ((objects = map.features.get(Obj.LITMIN)) != null) for (Feature feature : objects) lights(feature);
    79153                if ((objects = map.features.get(Obj.LITMAJ)) != null) for (Feature feature : objects) lights(feature);
    80                 if ((objects = map.features.get(Obj.LITMIN)) != null) for (Feature feature : objects) lights(feature);
    81154                if ((objects = map.features.get(Obj.LIGHTS)) != null) for (Feature feature : objects) lights(feature);
    82155                if ((objects = map.features.get(Obj.SISTAT)) != null) for (Feature feature : objects) stations(feature);
     
    108181       
    109182        private static void areas(Feature feature) {
    110                 String name = Util.getName(feature);
     183                String name = getName(feature);
    111184                switch (feature.type) {
    112185                case DRGARE:
     
    121194                        if (feature.area > 2.0) {
    122195                                if (zoom < 16)
    123                                         Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
     196                                        Renderer.lineVector(feature, new LineStyle(Renderer.Mline, 8, new float[] { 50, 50 }, new Color(0x40ffffff, true)));
    124197                                else
    125                                         Renderer.lineVector(feature, new LineStyle(Mline, 8, new float[] { 50, 50 }));
     198                                        Renderer.lineVector(feature, new LineStyle(Renderer.Mline, 8, new float[] { 50, 50 }));
    126199                        } else {
    127200                                if (zoom >= 14)
     
    136209                        break;
    137210                case OSPARE:
    138                         if (Util.testAttribute(feature, feature.type, Att.CATPRA, CatPRA.PRA_WFRM)) {
     211                        if (testAttribute(feature, feature.type, Att.CATPRA, CatPRA.PRA_WFRM)) {
    139212                                Renderer.symbol(feature, Areas.WindFarm);
    140213                                Renderer.lineVector(feature, new LineStyle(Color.black, 20, new float[] { 40, 40 }));
     
    145218                case RESARE:
    146219                        if (zoom >= 12) {
    147                                 Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Mline);
    148                                 if (Util.testAttribute(feature, feature.type, Att.CATPRA, CatREA.REA_NWAK)) {
     220                                Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Renderer.Mline);
     221                                if (testAttribute(feature, feature.type, Att.CATPRA, CatREA.REA_NWAK)) {
    149222                                        Renderer.symbol(feature, Areas.NoWake);
    150223                                }
     
    152225                        break;
    153226                case SEAARE:
    154                         switch ((CatSEA) Util.getAttVal(feature, feature.type, 0, Att.CATSEA)) {
     227                        switch ((CatSEA) getAttVal(feature, feature.type, 0, Att.CATSEA)) {
    155228                        case SEA_RECH:
    156229                                if ((zoom >= 10) && (name != null))
     
    205278                        if (zoom >= 12) {
    206279                                Renderer.symbol(feature, Areas.Plane);
    207                                 Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Mline);
     280                                Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Renderer.Mline);
    208281                        }
    209282                        if ((zoom >= 15) && (name != null))
     
    216289       
    217290        private static void beacons(Feature feature) {
    218                 BcnSHP shape = (BcnSHP) Util.getAttVal(feature, feature.type, 0, Att.BCNSHP);
     291                BcnSHP shape = (BcnSHP) getAttVal(feature, feature.type, 0, Att.BCNSHP);
    219292                if (((shape == BcnSHP.BCN_PRCH) || (shape == BcnSHP.BCN_WTHY)) && (feature.type == Obj.BCNLAT)) {
    220                         CatLAM cat = (CatLAM) Util.getAttVal(feature, feature.type, 0, Att.CATLAM);
     293                        CatLAM cat = (CatLAM) getAttVal(feature, feature.type, 0, Att.CATLAM);
    221294                        switch (cat) {
    222295                        case LAM_PORT:
     
    233306                                break;
    234307                        default:
    235                                 Renderer.symbol(feature, Beacons.Stake, Util.getScheme(feature, feature.type));
     308                                Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type));
    236309                        }
    237310                } else {
    238                         Renderer.symbol(feature, Beacons.Shapes.get(shape), Util.getScheme(feature, feature.type));
     311                        Renderer.symbol(feature, Beacons.Shapes.get(shape), getScheme(feature, feature.type));
    239312                        if (feature.objs.get(Obj.TOPMAR) != null)
    240                                 Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Util.getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta);
     313                                Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta);
    241314                }
    242315                Signals.addSignals(feature);
     
    244317       
    245318        private static void buoys(Feature feature) {
    246                 BoySHP shape = (BoySHP) Util.getAttVal(feature, feature.type, 0, Att.BOYSHP);
    247                 Renderer.symbol(feature, Buoys.Shapes.get(shape), Util.getScheme(feature, feature.type));
    248                 if (Util.hasObject(feature, Obj.TOPMAR)) {
    249                         Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Util.getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
     319                BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
     320                Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
     321                if (hasObject(feature, Obj.TOPMAR)) {
     322                        Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape));
    250323                }
    251324                Signals.addSignals(feature);
     
    283356                if ((zoom >= 16) && (feature.length < 2)) {
    284357                        if (feature.type == Obj.CBLSUB) {
    285                                 Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Mline);
     358                                Renderer.lineSymbols(feature, Areas.Cable, 0.0, null, null, 0, Renderer.Mline);
    286359                        } else if (feature.type == Obj.CBLOHD) {
    287360                                AttMap atts = feature.objs.get(Obj.CBLOHD).get(0);
     
    297370        private static void distances(Feature feature) {
    298371                if (zoom >= 14) {
    299                         if (!Util.testAttribute(feature, Obj.DISMAR, Att.CATDIS, CatDIS.DIS_NONI)) {
     372                        if (!testAttribute(feature, Obj.DISMAR, Att.CATDIS, CatDIS.DIS_NONI)) {
    300373                                Renderer.symbol(feature, Harbours.DistanceI);
    301374                        } else {
    302375                                Renderer.symbol(feature, Harbours.DistanceU);
    303376                        }
    304                         if ((zoom >=15) && Util.hasAttribute(feature, Obj.DISMAR, Att.WTWDIS)) {
     377                        if ((zoom >=15) && hasAttribute(feature, Obj.DISMAR, Att.WTWDIS)) {
    305378                                AttMap atts = feature.objs.get(Obj.DISMAR).get(0);
    306379                                Double dist = (Double) atts.get(Att.WTWDIS).val;
     
    339412                switch (feature.type) {
    340413                case LITVES:
    341                         Renderer.symbol(feature, Buoys.Super, Util.getScheme(feature, feature.type));
     414                        Renderer.symbol(feature, Buoys.Super, getScheme(feature, feature.type));
    342415                        break;
    343416                case LITFLT:
    344                         Renderer.symbol(feature, Buoys.Float, Util.getScheme(feature, feature.type));
     417                        Renderer.symbol(feature, Buoys.Float, getScheme(feature, feature.type));
    345418                        break;
    346419                case BOYINB:
    347                         Renderer.symbol(feature, Buoys.Super, Util.getScheme(feature, feature.type));
     420                        Renderer.symbol(feature, Buoys.Super, getScheme(feature, feature.type));
    348421                        break;
    349422                default:
     
    351424                }
    352425                if (feature.objs.get(Obj.TOPMAR) != null)
    353                         Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), Util.getScheme(feature, Obj.TOPMAR), Topmarks.FloatDelta);
     426                        Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.FloatDelta);
    354427                Signals.addSignals(feature);
    355428        }
     
    363436       
    364437        private static void harbours(Feature feature) {
    365                 String name = Util.getName(feature);
     438                String name = getName(feature);
    366439                switch (feature.type) {
    367440                case ACHBRT:
    368441                        if (zoom >= 14) {
    369                                 Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline));
    370                         Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), LabelStyle.RRCT, Mline, Color.white, new Delta(Handle.BC));
    371                         }
    372                         double radius = (Double)Util.getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS);
     442                                Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Renderer.Mline));
     443                        Renderer.labelText(feature, name == null ? "" : name, new Font("Arial", Font.PLAIN, 30), LabelStyle.RRCT, Renderer.Mline, Color.white, new Delta(Handle.BC));
     444                        }
     445                        double radius = (Double)getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS);
    373446                        if (radius != 0) {
    374                                 UniHLU units = (UniHLU)Util.getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS);
    375                                 Renderer.lineCircle (feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units);
     447                                UniHLU units = (UniHLU)getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS);
     448                                Renderer.lineCircle (feature, new LineStyle(Renderer.Mline, 4, new float[] { 10, 10 }, null), radius, units);
    376449                        }
    377450                        break;
     
    381454                                        Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Color.black));
    382455                                } else {
    383                                         Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Mline));
    384                                         Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Mline);
     456                                        Renderer.symbol(feature, Harbours.Anchorage, new Scheme(Renderer.Mline));
     457                                        Renderer.lineSymbols(feature, Areas.Restricted, 1.0, Areas.LineAnchor, null, 10, Renderer.Mline);
    385458                                }
    386459                                if ((zoom >= 15) && ((name) != null)) {
    387                                         Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 60), LabelStyle.NONE, Mline, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
    388                                 }
    389                                 ArrayList<StsSTS> sts = (ArrayList<StsSTS>)Util.getAttVal(feature, Obj.ACHARE, 0, Att.STATUS);
     460                                        Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 60), LabelStyle.NONE, Renderer.Mline, null, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
     461                                }
     462                                ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttVal(feature, Obj.ACHARE, 0, Att.STATUS);
    390463                                if ((zoom >= 15) && (sts != null) && (sts.contains(StsSTS.STS_RESV))) {
    391                                         Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), LabelStyle.NONE, Mline, null, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
    392                                 }
    393                         }
    394                         ArrayList<CatACH> cats = (ArrayList<CatACH>)Util.getAttVal(feature, Obj.ACHARE, 0, Att.CATACH);
     464                                        Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), LabelStyle.NONE, Renderer.Mline, null, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
     465                                }
     466                        }
     467                        ArrayList<CatACH> cats = (ArrayList<CatACH>)getAttVal(feature, Obj.ACHARE, 0, Att.CATACH);
    395468                        int dy = (cats.size() - 1) * -30;
    396469                        for (CatACH cat : cats) {
    397470                                switch (cat) {
    398471                                case ACH_DEEP:
    399                                         Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), LabelStyle.NONE, Mline, null, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     472                                        Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), LabelStyle.NONE, Renderer.Mline, null, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    400473                                        dy += 60;
    401474                                        break;
    402475                                case ACH_TANK:
    403                                         Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), LabelStyle.NONE, Mline, null, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     476                                        Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), LabelStyle.NONE, Renderer.Mline, null, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    404477                                        dy += 60;
    405478                                        break;
    406479                                case ACH_H24P:
    407                                         Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), LabelStyle.NONE, Mline, null, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     480                                        Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), LabelStyle.NONE, Renderer.Mline, null, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    408481                                        dy += 60;
    409482                                        break;
    410483                                case ACH_EXPL:
    411                                         Renderer.symbol(feature, Harbours.Explosives, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     484                                        Renderer.symbol(feature, Harbours.Explosives, new Scheme(Renderer.Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    412485                                        dy += 60;
    413486                                        break;
    414487                                case ACH_QUAR:
    415                                         Renderer.symbol(feature, Harbours.Hospital, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     488                                        Renderer.symbol(feature, Harbours.Hospital, new Scheme(Renderer.Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    416489                                        dy += 60;
    417490                                        break;
    418491                                case ACH_SEAP:
    419                                         Renderer.symbol(feature, Areas.Seaplane, new Scheme(Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     492                                        Renderer.symbol(feature, Areas.Seaplane, new Scheme(Renderer.Mline), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    420493                                        dy += 60;
    421494                                        break;
     
    425498                case BERTHS:
    426499                        if (zoom >= 14) {
    427                                 Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), LabelStyle.RRCT, Mline, Color.white, null);
     500                                Renderer.labelText(feature, name == null ? " " : name, new Font("Arial", Font.PLAIN, 40), LabelStyle.RRCT, Renderer.Mline, Color.white, null);
    428501                        }
    429502                        break;
     
    431504                  if (zoom >= 16) {
    432505                        ArrayList<Symbol> symbols = new ArrayList<Symbol>();
    433                         ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Util.getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN);
     506                        ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN);
    434507                        for (FncFNC fnc : fncs) {
    435508                                symbols.add(Landmarks.Funcs.get(fnc));
    436509                        }
    437510                          if (feature.objs.containsKey(Obj.SMCFAC))  {
    438                                 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) Util.getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF);
     511                                ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF);
    439512                                for (CatSCF scf : scfs) {
    440513                                        symbols.add(Facilities.Cats.get(scf));
     
    446519                case HRBFAC:
    447520                        if (zoom >= 12) {
    448                                 switch ((CatHAF) Util.getAttVal(feature, feature.type, 0, Att.CATHAF)) {
     521                                switch ((CatHAF) getAttVal(feature, feature.type, 0, Att.CATHAF)) {
    449522                                case HAF_MRNA:
    450523                                        Renderer.symbol(feature, Harbours.Marina);
     
    464537       
    465538        private static void landmarks(Feature feature) {
    466                 ArrayList<CatLMK> cats = (ArrayList<CatLMK>) Util.getAttVal(feature, feature.type, 0, Att.CATLMK);
     539                ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttVal(feature, feature.type, 0, Att.CATLMK);
    467540                Symbol catSym = Landmarks.Shapes.get(cats.get(0));
    468                 ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) Util.getAttVal(feature, feature.type, 0, Att.FUNCTN);
     541                ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttVal(feature, feature.type, 0, Att.FUNCTN);
    469542                Symbol fncSym = Landmarks.Funcs.get(fncs.get(0));
    470543                if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR))
     
    501574                        Renderer.symbol(feature, Beacons.LightMinor);
    502575                        break;
     576                case PILPNT:
     577                        if (hasObject(feature, Obj.LIGHTS))
     578                                Renderer.symbol(feature, Beacons.LightMinor);
     579                        else
     580                                Renderer.symbol(feature, Harbours.Post);
     581                        break;
    503582                }
    504583                Signals.addSignals(feature);
    505584        }
    506        
     585
    507586        private static void locks(Feature feature) {
    508587        }
     588
    509589        private static void marinas(Feature feature) {
    510590                if (zoom >= 16) {
     
    512592                }
    513593        }
    514        
    515594        private static void moorings(Feature feature) {
    516                 switch ((CatMOR) Util.getAttVal(feature, feature.type, 0, Att.CATMOR)) {
     595                switch ((CatMOR) getAttVal(feature, feature.type, 0, Att.CATMOR)) {
    517596                case MOR_DLPN:
    518597                        Renderer.symbol(feature, Harbours.Dolphin);
     
    526605                        break;
    527606                case MOR_BUOY:
    528                         BoySHP shape = (BoySHP) Util.getAttVal(feature, feature.type, 0, Att.BOYSHP);
     607                        BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
    529608                        if (shape == BoySHP.BOY_UNKN)
    530609                                shape = BoySHP.BOY_SPHR;
    531                         Renderer.symbol(feature, Buoys.Shapes.get(shape), Util.getScheme(feature, feature.type));
     610                        Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
    532611                        break;
    533612                }
     
    751830                }
    752831        }
     832
    753833        private static void obstructions(Feature feature) {
    754834                if ((zoom >= 14) && (feature.type == Obj.UWTROC)) {
    755                         WatLEV lvl = (WatLEV) Util.getAttVal(feature, feature.type, 0, Att.WATLEV);
     835                        WatLEV lvl = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV);
    756836                        switch (lvl) {
    757837                        case LEV_CVRS:
     
    768848                }
    769849        }
     850
    770851        private static void pipelines(Feature feature) {
    771852                if (zoom >= 14) {
    772853                        if (feature.type == Obj.PIPSOL) {
    773                                 Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Mline);
     854                                Renderer.lineSymbols(feature, Areas.Pipeline, 1.0, null, null, 0, Renderer.Mline);
    774855                        } else if (feature.type == Obj.PIPOHD) {
    775856
     
    777858                }
    778859        }
     860
    779861        private static void platforms(Feature feature) {
    780                 ArrayList<CatOFP> cats = (ArrayList<CatOFP>)Util.getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP);
     862                ArrayList<CatOFP> cats = (ArrayList<CatOFP>)getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP);
    781863                if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
    782864                        Renderer.symbol(feature, Buoys.Storage);
    783865                else
    784866                        Renderer.symbol(feature, Landmarks.Platform);
    785                 String name = Util.getName(feature);
     867                String name = getName(feature);
    786868                if ((zoom >= 15) && (name != null))
    787869                        Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 40), LabelStyle.NONE, Color.black, null, new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
    788 /*object_rules(platforms) {
    789   if (has_object("fog_signal")) object(fogs);
    790   if (has_object("radar_transponder")) object(rtbs);
    791   if (has_object("light")) object(lights);
    792 }
    793 */
    794         }
     870                Signals.addSignals(feature);
     871        }
     872
    795873        private static void ports(Feature feature) {
    796874                if (zoom >= 14) {
    797875                        if (feature.type == Obj.CRANES) {
    798                                 if ((CatCRN) Util.getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
     876                                if ((CatCRN) getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
    799877                                        Renderer.symbol(feature, Harbours.ContainerCrane);
    800878                                else
     
    802880                        } else if (feature.type == Obj.HULKES) {
    803881                                Renderer.lineVector(feature, new LineStyle(Color.black, 4, null, new Color(0xffe000)));
    804                                 String name = Util.getName(feature);
     882                                String name = getName(feature);
    805883                                if ((zoom >= 15) && (name != null))
    806884                                        Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 80), LabelStyle.NONE, Color.black, null, null);
     
    808886                }
    809887        }
     888
    810889        private static void separation(Feature feature) {
    811890                switch (feature.type) {
     
    817896                        else
    818897                                Renderer.lineVector(feature, new LineStyle(new Color(0x80c48080, true), 20, null, null));
    819                         String name = Util.getName(feature);
     898                        String name = getName(feature);
    820899                        if ((zoom >= 10) && (name != null))
    821900                                Renderer.labelText(feature, name, new Font("Arial", Font.BOLD, 150), LabelStyle.NONE, new Color(0x80c48080, true), null, null);
     
    835914                }
    836915        }
     916
    837917        private static void shoreline(Feature feature) {
    838918                if (zoom >= 12) {
    839                         switch ((CatSLC) Util.getAttVal(feature, feature.type, 0, Att.CATSLC)) {
     919                        switch ((CatSLC) getAttVal(feature, feature.type, 0, Att.CATSLC)) {
    840920                        case SLC_TWAL:
    841                                 WatLEV lev = (WatLEV) Util.getAttVal(feature, feature.type, 0, Att.WATLEV);
     921                                WatLEV lev = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV);
    842922                                if (lev == WatLEV.LEV_CVRS) {
    843923                                        Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
     
    852932                }
    853933        }
    854        
     934
    855935        private static void stations(Feature feature) {
    856936                if (zoom >= 14) {
     
    885965                Signals.addSignals(feature);
    886966        }
    887        
     967
    888968        private static void transits(Feature feature) {
    889969          if (zoom >= 12) {
     
    893973          if (zoom >= 15) {
    894974                String str = "";
    895                         String name = Util.getName(feature);
     975                        String name = getName(feature);
    896976                        if (name != null) str += name + " ";
    897                         Double ort = (Double) Util.getAttVal(feature, feature.type, 0, Att.ORIENT);
     977                        Double ort = (Double) getAttVal(feature, feature.type, 0, Att.ORIENT);
    898978                        if (ort != null) str += ort.toString() + "\u0152";
    899979                        if (!str.isEmpty()) Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
    900980          }
    901981        }
     982
    902983        private static void waterways(Feature feature) {
    903984               
    904985        }
    905        
     986
    906987        private static void wrecks(Feature feature) {
    907988                if (zoom >= 14) {
    908                         CatWRK cat = (CatWRK) Util.getAttVal(feature, feature.type, 0, Att.CATWRK);
     989                        CatWRK cat = (CatWRK) getAttVal(feature, feature.type, 0, Att.CATWRK);
    909990                        switch (cat) {
    910991                        case WRK_DNGR:
  • applications/editors/josm/plugins/smed2/src/seamap/Signals.java

    r30036 r30046  
    4141        public static void radarStations(Feature feature) {
    4242                Renderer.symbol(feature, Beacons.RadarStation);
    43                 ArrayList<CatROS> cats = (ArrayList<CatROS>)Util.getAttVal(feature, Obj.RDOSTA, 0, Att.CATROS);
     43                ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttVal(feature, Obj.RDOSTA, 0, Att.CATROS);
    4444                String str = "";
    4545                for (CatROS ros : cats) {
Note: See TracChangeset for help on using the changeset viewer.