Ignore:
Timestamp:
2015-02-15T19:38:42+01:00 (10 years ago)
Author:
malcolmh
Message:

Rules debugs

Location:
applications/editors/josm/plugins/seachart/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/seachart/src/render/Rules.java

    r30932 r30992  
    1717import java.util.HashMap;
    1818
     19import s57.S57val;
    1920import s57.S57val.*;
    2021import s57.S57att.*;
     
    2728public class Rules {
    2829
    29         public static final Color Yland = new Color(0x50b0ff);
     30        public static final Color Yland = new Color(0xeca818);
     31        public static final Color Bwater = new Color(0x2ea8d8);
    3032        public static final Color Mline = new Color(0xc480ff);
    3133        public static final Color Msymb = new Color(0xa30075);
     
    113115        }
    114116       
     117        public static String getAttStr(Feature feature, Obj obj, int idx, Att att) {
     118                String str = (String)getAttVal(feature, obj, idx, att);
     119                if (str != null) {
     120                        return str;
     121                }
     122                return "";
     123        }
     124       
     125        public static Enum<?> getAttEnum(Feature feature, Obj obj, int idx, Att att) {
     126                ArrayList<?> list = (ArrayList<?>)getAttVal(feature, obj, idx, att);
     127                if (list != null) {
     128                        return ((ArrayList<Enum>)list).get(0);
     129                }
     130                return S57val.unknAtt(att);
     131        }
     132       
     133        public static ArrayList<?> getAttList(Feature feature, Obj obj, int idx, Att att) {
     134                ArrayList<Enum<?>> list = (ArrayList<Enum<?>>)getAttVal(feature, obj, idx, att);
     135                if (list != null) {
     136                        return list;
     137                }
     138                list = new ArrayList<>();
     139                list.add(S57val.unknAtt(att));
     140                return list;
     141        }
     142       
    115143        static Scheme getScheme(Feature feature, Obj obj) {
    116144                ArrayList<Color> colours = new ArrayList<Color>();
    117                 if (colours.size() > 0) {
    118                         for (ColCOL col : (ArrayList<ColCOL>) getAttVal(feature, obj, 0, Att.COLOUR)) {
    119                                 colours.add(bodyColours.get(col));
    120                         }
     145                for (ColCOL col : (ArrayList<ColCOL>) getAttList(feature, obj, 0, Att.COLOUR)) {
     146                        colours.add(bodyColours.get(col));
    121147                }
    122148                ArrayList<Patt> patterns = new ArrayList<Patt>();
    123                 if (patterns.size() > 0) {
    124                         for (ColPAT pat : (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT)) {
    125                                 patterns.add(pattMap.get(pat));
    126                         }
     149                for (ColPAT pat : (ArrayList<ColPAT>) getAttList(feature, obj, 0, Att.COLPAT)) {
     150                        patterns.add(pattMap.get(pat));
    127151                }
    128152                return new Scheme(patterns, colours);
     
    152176        public static void rules () {
    153177                ArrayList<Feature> objects;
     178                if ((objects = Renderer.map.features.get(Obj.COALNE)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) areas(feature);
    154179                if ((objects = Renderer.map.features.get(Obj.SLCONS)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) shoreline(feature);
    155180                if ((objects = Renderer.map.features.get(Obj.PIPSOL)) != null) for (Feature feature : objects) if (feature.reln == Rflag.MASTER) pipelines(feature);
     
    229254                String name = getName(feature);
    230255                switch (feature.type) {
     256                case COALNE:
     257                        Renderer.lineVector(feature, new LineStyle(Color.black, 8, Yland));
     258                        break;
    231259                case DRGARE:
    232260                        if (Renderer.zoom < 16)
     
    274302                        break;
    275303                case SEAARE:
    276                         CatSEA cat;
    277                         if ((cat = (CatSEA) getAttVal(feature, feature.type, 0, Att.CATSEA)) != null) {
    278                                 switch (cat) {
    279                                 case SEA_RECH:
    280                                         if ((Renderer.zoom >= 10) && (name != null))
    281                                                 if (feature.geom.prim == Pflag.LINE) {
    282                                                         Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
    283                                                 } else {
    284                                                         Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     304                        switch ((CatSEA) getAttEnum(feature, feature.type, 0, Att.CATSEA)) {
     305                        case SEA_RECH:
     306                                if ((Renderer.zoom >= 10) && (name != null))
     307                                        if (feature.geom.prim == Pflag.LINE) {
     308                                                Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
     309                                        } else {
     310                                                Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     311                                        }
     312                                break;
     313                        case SEA_BAY:
     314                                if ((Renderer.zoom >= 12) && (name != null))
     315                                        if (feature.geom.prim == Pflag.LINE) {
     316                                                Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
     317                                        } else {
     318                                                Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     319                                        }
     320                                break;
     321                        case SEA_SHOL:
     322                                if (Renderer.zoom >= 14) {
     323                                        if (feature.geom.prim == Pflag.AREA) {
     324                                                Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 }));
     325                                                if (name != null) {
     326                                                        Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     327                                                        Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
    285328                                                }
    286                                         break;
    287                                 case SEA_BAY:
    288                                         if ((Renderer.zoom >= 12) && (name != null))
    289                                                 if (feature.geom.prim == Pflag.LINE) {
    290                                                         Renderer.lineText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, 0.5, -40);
    291                                                 } else {
    292                                                         Renderer.labelText(feature, name, new Font("Arial", Font.PLAIN, 150), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     329                                        } else if (feature.geom.prim == Pflag.LINE) {
     330                                                if (name != null) {
     331                                                        Renderer.lineText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40);
     332                                                        Renderer.lineText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0);
    293333                                                }
    294                                         break;
    295                                 case SEA_SHOL:
    296                                         if (Renderer.zoom >= 14) {
    297                                                 if (feature.geom.prim == Pflag.AREA) {
    298                                                         Renderer.lineVector(feature, new LineStyle(new Color(0xc480ff), 4, new float[] { 25, 25 }));
    299                                                         if (name != null) {
    300                                                                 Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
    301                                                                 Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
    302                                                         }
    303                                                 } else if (feature.geom.prim == Pflag.LINE) {
    304                                                         if (name != null) {
    305                                                                 Renderer.lineText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, 0.5, -40);
    306                                                                 Renderer.lineText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, 0.5, 0);
    307                                                         }
    308                                                 } else {
    309                                                         if (name != null) {
    310                                                                 Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
    311                                                                 Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
    312                                                         }
     334                                        } else {
     335                                                if (name != null) {
     336                                                        Renderer.labelText(feature, name, new Font("Arial", Font.ITALIC, 75), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -40)));
     337                                                        Renderer.labelText(feature, "(Shoal)", new Font("Arial", Font.PLAIN, 60), Color.black, new Delta(Handle.BC));
    313338                                                }
    314339                                        }
    315                                         break;
    316                                 case SEA_GAT:
    317                                 case SEA_NRRW:
    318                                         addName(feature, 12, new Font("Arial", Font.PLAIN, 100));
    319                                         break;
    320                                 default:
    321                                         break;
    322                                 }
    323                                 break;
    324                         }
     340                                }
     341                                break;
     342                        case SEA_GAT:
     343                        case SEA_NRRW:
     344                                addName(feature, 12, new Font("Arial", Font.PLAIN, 100));
     345                                break;
     346                        default:
     347                                break;
     348                        }
     349                        break;
    325350                case SNDWAV:
    326351                        if (Renderer.zoom >= 12) Renderer.fillPattern(feature, Areas.Sandwaves);
     
    340365        private static void beacons(Feature feature) {
    341366                if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BCNLAT) || (feature.type == Obj.BCNCAR)))) {
    342                         CatLAM cat;
    343                         BcnSHP shape = (BcnSHP) getAttVal(feature, feature.type, 0, Att.BCNSHP);
    344                         if (shape == null)
     367                        BcnSHP shape = (BcnSHP)getAttEnum(feature, feature.type, 0, Att.BCNSHP);
     368                        if (shape == BcnSHP.BCN_UNKN)
    345369                                shape = BcnSHP.BCN_PILE;
    346370                        if ((shape == BcnSHP.BCN_WTHY) && (feature.type == Obj.BCNLAT)) {
    347                                 if ((cat = (CatLAM) getAttVal(feature, feature.type, 0, Att.CATLAM)) != null) {
    348                                         switch (cat) {
    349                                         case LAM_PORT:
    350                                                 Renderer.symbol(feature, Beacons.WithyPort);
    351                                                 break;
    352                                         case LAM_STBD:
    353                                                 Renderer.symbol(feature, Beacons.WithyStarboard);
    354                                                 break;
    355                                         default:
    356                                                 Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type));
    357                                         }
     371                                switch ((CatLAM) getAttEnum(feature, feature.type, 0, Att.CATLAM)) {
     372                                case LAM_PORT:
     373                                        Renderer.symbol(feature, Beacons.WithyPort);
     374                                        break;
     375                                case LAM_STBD:
     376                                        Renderer.symbol(feature, Beacons.WithyStarboard);
     377                                        break;
     378                                default:
     379                                        Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type));
    358380                                }
    359381                        } else if ((shape == BcnSHP.BCN_PRCH) && (feature.type == Obj.BCNLAT) && !(feature.objs.containsKey(Obj.TOPMAR))) {
    360                                 if ((cat = (CatLAM) getAttVal(feature, feature.type, 0, Att.CATLAM)) != null) {
    361                                         switch (cat) {
    362                                         case LAM_PORT:
    363                                                 Renderer.symbol(feature, Beacons.PerchPort);
    364                                                 break;
    365                                         case LAM_STBD:
    366                                                 Renderer.symbol(feature, Beacons.PerchStarboard);
    367                                                 break;
    368                                         default:
    369                                                 Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type));
    370                                         }
    371                                 } else {
    372                                         Renderer.symbol(feature, Beacons.Shapes.get(shape), getScheme(feature, feature.type));
    373                                         if (feature.objs.containsKey(Obj.TOPMAR)) {
    374                                                 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val);
    375                                                 if (topmark != null)
    376                                                         Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta);
    377                                         } else if (feature.objs.containsKey(Obj.DAYMAR)) {
    378                                                 Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val);
    379                                                 if (topmark != null)
    380                                                         Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta);
    381                                         }
    382                                 }
    383                                 Signals.addSignals(feature);
    384                         }
     382                                switch ((CatLAM) getAttEnum(feature, feature.type, 0, Att.CATLAM)) {
     383                                case LAM_PORT:
     384                                        Renderer.symbol(feature, Beacons.PerchPort);
     385                                        break;
     386                                case LAM_STBD:
     387                                        Renderer.symbol(feature, Beacons.PerchStarboard);
     388                                        break;
     389                                default:
     390                                        Renderer.symbol(feature, Beacons.Stake, getScheme(feature, feature.type));
     391                                }
     392                        } else {
     393                                Renderer.symbol(feature, Beacons.Shapes.get(shape), getScheme(feature, feature.type));
     394                                if (feature.objs.containsKey(Obj.TOPMAR)) {
     395                                        Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val);
     396                                        if (topmark != null)
     397                                                Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.TOPMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta);
     398                                } else if (feature.objs.containsKey(Obj.DAYMAR)) {
     399                                        Symbol topmark = Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val);
     400                                        if (topmark != null)
     401                                                Renderer.symbol(feature, Topmarks.Shapes.get(feature.objs.get(Obj.DAYMAR).get(0).get(Att.TOPSHP).val), getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta);
     402                                }
     403                        }
     404                        Signals.addSignals(feature);
    385405                }
    386406        }
     
    388408        private static void buoys(Feature feature) {
    389409                if ((Renderer.zoom >= 14) || ((Renderer.zoom >= 12) && ((feature.type == Obj.BOYLAT) || (feature.type == Obj.BOYCAR)))) {
    390                         BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
    391                         if (shape == null) shape = BoySHP.BOY_PILR;
     410                        BoySHP shape = (BoySHP) getAttEnum(feature, feature.type, 0, Att.BOYSHP);
     411                        if (shape == BoySHP.BOY_UNKN) shape = BoySHP.BOY_PILR;
    392412                        Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
    393413                        if (feature.objs.containsKey(Obj.TOPMAR)) {
     
    474494                if (Renderer.zoom >= 14) {
    475495                        Symbol symb = Harbours.CallPoint2;
    476                         TrfTRF trf;
    477                         if ((trf = (TrfTRF) getAttVal(feature, feature.type, 0, Att.TRAFIC)) != null) {
    478                                 if (trf != TrfTRF.TRF_TWOW) {
    479                                         symb = Harbours.CallPoint1;
    480                                 }
     496                        TrfTRF trf = (TrfTRF) getAttEnum(feature, feature.type, 0, Att.TRAFIC);
     497                        if (trf != TrfTRF.TRF_TWOW) {
     498                                symb = Harbours.CallPoint1;
    481499                        }
    482500                        Double orient = 0.0;
     
    486504                        Renderer.symbol(feature, symb, new Delta(Handle.CC, AffineTransform.getRotateInstance(Math.toRadians(orient))));
    487505                        String chn;
    488                         if ((chn = (String) getAttVal(feature, feature.type, 0, Att.COMCHA)) != null) {
     506                        if (!(chn = getAttStr(feature, feature.type, 0, Att.COMCHA)).isEmpty()) {
    489507                                Renderer.labelText(feature, ("Ch." + chn), new Font("Arial", Font.PLAIN, 50), Color.black, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0,50)));
    490508                        }
     
    571589                                }
    572590                        }
    573                         double radius = (Double)getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS);
    574                         if (radius != 0) {
    575                                 UniHLU units = (UniHLU)getAttVal(feature, Obj.ACHBRT, 0, Att.HUNITS);
    576                                 Renderer.lineCircle (feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units);
     591                        if (getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS) != null) {
     592                                double radius;
     593                                if ((radius = (Double) getAttVal(feature, Obj.ACHBRT, 0, Att.RADIUS)) != 0) {
     594                                        UniHLU units = (UniHLU) getAttEnum(feature, Obj.ACHBRT, 0, Att.HUNITS);
     595                                        if (units == UniHLU.HLU_UNKN) {
     596                                                units = UniHLU.HLU_METR;
     597                                        }
     598                                        Renderer.lineCircle(feature, new LineStyle(Mline, 4, new float[] { 10, 10 }, null), radius, units);
     599                                }
    577600                        }
    578601                        break;
     
    586609                                }
    587610                                addName(feature, 15, new Font("Arial", Font.BOLD, 60), Mline, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
    588                                 ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttVal(feature, Obj.ACHARE, 0, Att.STATUS);
    589                                 if ((Renderer.zoom >= 15) && (sts != null) && (sts.contains(StsSTS.STS_RESV))) {
     611                                ArrayList<StsSTS> sts = (ArrayList<StsSTS>)getAttList(feature, Obj.ACHARE, 0, Att.STATUS);
     612                                if ((Renderer.zoom >= 15) && (sts.contains(StsSTS.STS_RESV))) {
    590613                                        Renderer.labelText(feature, "Reserved", new Font("Arial", Font.PLAIN, 50), Mline, new Delta(Handle.TC, AffineTransform.getTranslateInstance(0, 60)));
    591614                                }
    592615                        }
    593                         ArrayList<CatACH> cats;
    594                         if ((cats = (ArrayList<CatACH>) getAttVal(feature, Obj.ACHARE, 0, Att.CATACH)) != null) {
    595                                 int dy = (cats.size() - 1) * -30;
    596                                 for (CatACH cat : cats) {
    597                                         switch (cat) {
    598                                         case ACH_DEEP:
    599                                                 Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    600                                                 dy += 60;
    601                                                 break;
    602                                         case ACH_TANK:
    603                                                 Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    604                                                 dy += 60;
    605                                                 break;
    606                                         case ACH_H24P:
    607                                                 Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    608                                                 dy += 60;
    609                                                 break;
    610                                         case ACH_EXPL:
    611                                                 Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    612                                                 dy += 60;
    613                                                 break;
    614                                         case ACH_QUAR:
    615                                                 Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    616                                                 dy += 60;
    617                                                 break;
    618                                         case ACH_SEAP:
    619                                                 Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
    620                                                 dy += 60;
    621                                                 break;
    622                                         default:
    623                                         }
     616                        ArrayList<CatACH> cats = (ArrayList<CatACH>) getAttList(feature, Obj.ACHARE, 0, Att.CATACH);
     617                        int dy = (cats.size() - 1) * -30;
     618                        for (CatACH cat : cats) {
     619                                switch (cat) {
     620                                case ACH_DEEP:
     621                                        Renderer.labelText(feature, "DW", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     622                                        dy += 60;
     623                                        break;
     624                                case ACH_TANK:
     625                                        Renderer.labelText(feature, "Tanker", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     626                                        dy += 60;
     627                                        break;
     628                                case ACH_H24P:
     629                                        Renderer.labelText(feature, "24h", new Font("Arial", Font.BOLD, 50), Msymb, new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     630                                        dy += 60;
     631                                        break;
     632                                case ACH_EXPL:
     633                                        Renderer.symbol(feature, Harbours.Explosives, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     634                                        dy += 60;
     635                                        break;
     636                                case ACH_QUAR:
     637                                        Renderer.symbol(feature, Harbours.Hospital, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     638                                        dy += 60;
     639                                        break;
     640                                case ACH_SEAP:
     641                                        Renderer.symbol(feature, Areas.Seaplane, new Scheme(Msymb), new Delta(Handle.RC, AffineTransform.getTranslateInstance(-60, dy)));
     642                                        dy += 60;
     643                                        break;
     644                                default:
    624645                                }
    625646                        }
     
    634655                        if (Renderer.zoom >= 16) {
    635656                                ArrayList<Symbol> symbols = new ArrayList<Symbol>();
    636                                 ArrayList<FncFNC> fncs;
    637                                 if ((fncs = (ArrayList<FncFNC>) getAttVal(feature, Obj.BUISGL, 0, Att.FUNCTN)) != null) {
    638                                         for (FncFNC fnc : fncs) {
    639                                                 symbols.add(Landmarks.Funcs.get(fnc));
    640                                         }
    641                                         if (feature.objs.containsKey(Obj.SMCFAC)) {
    642                                                 ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF);
    643                                                 for (CatSCF scf : scfs) {
    644                                                         symbols.add(Facilities.Cats.get(scf));
    645                                                 }
    646                                         }
    647                                         Renderer.cluster(feature, symbols);
    648                                 }
     657                                ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(feature, Obj.BUISGL, 0, Att.FUNCTN);
     658                                for (FncFNC fnc : fncs) {
     659                                        symbols.add(Landmarks.Funcs.get(fnc));
     660                                }
     661                                if (feature.objs.containsKey(Obj.SMCFAC)) {
     662                                        ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF);
     663                                        for (CatSCF scf : scfs) {
     664                                                symbols.add(Facilities.Cats.get(scf));
     665                                        }
     666                                }
     667                                Renderer.cluster(feature, symbols);
    649668                        }
    650669                        break;
    651670                case HRBFAC:
    652671                        if (Renderer.zoom >= 12) {
    653                                 ArrayList<CatHAF> cathaf;
    654                                 if ((cathaf = (ArrayList<CatHAF>) getAttVal(feature, Obj.HRBFAC, 0, Att.CATHAF)) != null) {
    655                                         if (cathaf.size() == 1) {
    656                                                 switch (cathaf.get(0)) {
    657                                                 case HAF_MRNA:
    658                                                         Renderer.symbol(feature, Harbours.Marina);
    659                                                         break;
    660                                                 case HAF_MANF:
    661                                                         Renderer.symbol(feature, Harbours.MarinaNF);
    662                                                         break;
    663                                                 case HAF_FISH:
    664                                                         Renderer.symbol(feature, Harbours.Fishing);
    665                                                         break;
    666                                                 default:
    667                                                         Renderer.symbol(feature, Harbours.Harbour);
    668                                                         break;
    669                                                 }
    670                                         } else {
     672                                ArrayList<CatHAF> cathaf = (ArrayList<CatHAF>) getAttList(feature, Obj.HRBFAC, 0, Att.CATHAF);
     673                                if (cathaf.size() == 1) {
     674                                        switch (cathaf.get(0)) {
     675                                        case HAF_MRNA:
     676                                                Renderer.symbol(feature, Harbours.Marina);
     677                                                break;
     678                                        case HAF_MANF:
     679                                                Renderer.symbol(feature, Harbours.MarinaNF);
     680                                                break;
     681                                        case HAF_FISH:
     682                                                Renderer.symbol(feature, Harbours.Fishing);
     683                                                break;
     684                                        default:
    671685                                                Renderer.symbol(feature, Harbours.Harbour);
    672                                         }
     686                                                break;
     687                                        }
     688                                } else {
     689                                        Renderer.symbol(feature, Harbours.Harbour);
    673690                                }
    674691                        }
     
    680697       
    681698        private static void landmarks(Feature feature) {
    682                 ArrayList<CatLMK> cats;
    683                 ArrayList<FncFNC> fncs;
    684                 Symbol catSym = new Symbol();
    685                 Symbol fncSym = new Symbol();
    686                 if ((cats = (ArrayList<CatLMK>) getAttVal(feature, feature.type, 0, Att.CATLMK)) != null) {
    687                         catSym = Landmarks.Shapes.get(cats.get(0));
    688                 }
    689                 if ((fncs = (ArrayList<FncFNC>) getAttVal(feature, feature.type, 0, Att.FUNCTN)) != null) {
    690                         fncSym = Landmarks.Funcs.get(fncs.get(0));
    691                 }
     699                ArrayList<CatLMK> cats = (ArrayList<CatLMK>) getAttList(feature, feature.type, 0, Att.CATLMK);
     700                Symbol catSym = Landmarks.Shapes.get(cats.get(0));
     701                ArrayList<FncFNC> fncs = (ArrayList<FncFNC>) getAttList(feature, feature.type, 0, Att.FUNCTN);
     702                Symbol fncSym = Landmarks.Funcs.get(fncs.get(0));
    692703                if ((fncs.get(0) == FncFNC.FNC_CHCH) && (cats.get(0) == CatLMK.LMK_TOWR))
    693704                        catSym = Landmarks.ChurchTower;
     
    738749                if (Renderer.zoom >= 16) {
    739750                        ArrayList<Symbol> symbols = new ArrayList<Symbol>();
    740                         ArrayList<CatSCF> scfs;
    741                         if ((scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF)) != null) {
    742                                 for (CatSCF scf : scfs) {
    743                                         symbols.add(Facilities.Cats.get(scf));
    744                                 }
    745                                 Renderer.cluster(feature, symbols);
    746                         }
     751                        ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF);
     752                        for (CatSCF scf : scfs) {
     753                                symbols.add(Facilities.Cats.get(scf));
     754                        }
     755                        Renderer.cluster(feature, symbols);
    747756                }
    748757        }
    749758       
    750759        private static void moorings(Feature feature) {
    751                 CatMOR cat;
    752                 if ((cat = (CatMOR) getAttVal(feature, feature.type, 0, Att.CATMOR)) != null) {
    753                         switch (cat) {
    754                         case MOR_DLPN:
    755                                 Renderer.symbol(feature, Harbours.Dolphin);
    756                                 break;
    757                         case MOR_DDPN:
    758                                 Renderer.symbol(feature, Harbours.DeviationDolphin);
    759                                 break;
    760                         case MOR_BLRD:
    761                         case MOR_POST:
    762                                 Renderer.symbol(feature, Harbours.Bollard);
    763                                 break;
    764                         case MOR_BUOY:
    765                                 BoySHP shape = (BoySHP) getAttVal(feature, feature.type, 0, Att.BOYSHP);
    766                                 if (shape == BoySHP.BOY_UNKN)
    767                                         shape = BoySHP.BOY_SPHR;
    768                                 Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
    769                                 Renderer.symbol(feature, Topmarks.TopMooring, Topmarks.BuoyDeltas.get(shape));
    770                                 break;
    771                         default:
    772                                 break;
    773                         }
    774                         Signals.addSignals(feature);
    775                 }
     760                switch ((CatMOR) getAttEnum(feature, feature.type, 0, Att.CATMOR)) {
     761                case MOR_DLPN:
     762                        Renderer.symbol(feature, Harbours.Dolphin);
     763                        break;
     764                case MOR_DDPN:
     765                        Renderer.symbol(feature, Harbours.DeviationDolphin);
     766                        break;
     767                case MOR_BLRD:
     768                case MOR_POST:
     769                        Renderer.symbol(feature, Harbours.Bollard);
     770                        break;
     771                case MOR_BUOY:
     772                        BoySHP shape = (BoySHP) getAttEnum(feature, feature.type, 0, Att.BOYSHP);
     773                        if (shape == BoySHP.BOY_UNKN) {
     774                                shape = BoySHP.BOY_SPHR;
     775                        }
     776                        Renderer.symbol(feature, Buoys.Shapes.get(shape), getScheme(feature, feature.type));
     777                        Renderer.symbol(feature, Topmarks.TopMooring, Topmarks.BuoyDeltas.get(shape));
     778                        break;
     779                default:
     780                        break;
     781                }
     782                Signals.addSignals(feature);
    776783        }
    777784
     
    845852        private static void obstructions(Feature feature) {
    846853                if ((Renderer.zoom >= 12) && (feature.type == Obj.OBSTRN)) {
    847                         CatOBS cat;
    848                         if ((cat = (CatOBS) getAttVal(feature, feature.type, 0, Att.CATOBS)) != null) {
    849                         switch (cat) {
     854                        switch ((CatOBS) getAttEnum(feature, feature.type, 0, Att.CATOBS)) {
    850855                        case OBS_BOOM:
    851856                                Renderer.lineVector(feature, new LineStyle(Color.black, 5, new float[] { 20, 20 }, null));
    852                                 if (Renderer.zoom >= 15) Renderer.lineText(feature, "Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     857                                if (Renderer.zoom >= 15) {
     858                                        Renderer.lineText(feature, "Boom", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     859                                }
    853860                        default:
    854861                                break;
    855               }
    856             }
     862                        }
    857863                }
    858864                if ((Renderer.zoom >= 14) && (feature.type == Obj.UWTROC)) {
    859                         WatLEV lvl;
    860                         if ((lvl = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV)) != null) {
    861                                 switch (lvl) {
    862                                 case LEV_CVRS:
    863                                         Renderer.symbol(feature, Areas.RockC);
    864                                         break;
    865                                 case LEV_AWSH:
    866                                         Renderer.symbol(feature, Areas.RockA);
    867                                         break;
    868                                 default:
    869                                         Renderer.symbol(feature, Areas.Rock);
    870                                 }
    871                         } else {
     865                        switch ((WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV)) {
     866                        case LEV_CVRS:
     867                                Renderer.symbol(feature, Areas.RockC);
     868                                break;
     869                        case LEV_AWSH:
     870                                Renderer.symbol(feature, Areas.RockA);
     871                                break;
     872                        default:
    872873                                Renderer.symbol(feature, Areas.Rock);
    873874                        }
     875                } else {
     876                        Renderer.symbol(feature, Areas.Rock);
    874877                }
    875878        }
     
    898901
    899902        private static void platforms(Feature feature) {
    900                 ArrayList<CatOFP> cats;
    901                 if ((cats = (ArrayList<CatOFP>) getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP)) != null) {
    902                         if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
    903                                 Renderer.symbol(feature, Buoys.Storage);
    904                         else
    905                                 Renderer.symbol(feature, Landmarks.Platform);
    906                         addName(feature, 15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
    907                         Signals.addSignals(feature);
    908                 }
     903                ArrayList<CatOFP> cats = (ArrayList<CatOFP>) getAttList(feature, Obj.OFSPLF, 0, Att.CATOFP);
     904                if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
     905                        Renderer.symbol(feature, Buoys.Storage);
     906                else
     907                        Renderer.symbol(feature, Landmarks.Platform);
     908                addName(feature, 15, new Font("Arial", Font.BOLD, 40), new Delta(Handle.BL, AffineTransform.getTranslateInstance(20, -50)));
     909                Signals.addSignals(feature);
    909910        }
    910911
     
    912913                if (Renderer.zoom >= 14) {
    913914                        if (feature.type == Obj.CRANES) {
    914                                 if ((CatCRN) getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
     915                                if ((CatCRN) getAttEnum(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
    915916                                        Renderer.symbol(feature, Harbours.ContainerCrane);
    916917                                else
     
    953954        private static void shoreline(Feature feature) {
    954955                if (Renderer.zoom >= 12) {
    955                         CatSLC cat;
    956                         if ((cat = (CatSLC) getAttVal(feature, feature.type, 0, Att.CATSLC)) != null) {
    957                                 switch (cat) {
    958                                 case SLC_TWAL:
    959                                         WatLEV lev;
    960                                         if ((lev = (WatLEV) getAttVal(feature, feature.type, 0, Att.WATLEV)) != null) {
    961                                                 if (lev == WatLEV.LEV_CVRS) {
    962                                                         Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
    963                                                         if (Renderer.zoom >= 15)
    964                                                                 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80);
    965                                                 } else {
    966                                                         Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
    967                                                 }
    968                                                 if (Renderer.zoom >= 15)
    969                                                         Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30);
    970                                                 break;
    971                                         }
    972                                 case SLC_SWAY:
    973                                         Renderer.lineVector(feature, new LineStyle(Color.black, 2, null, new Color(0xffe000)));
    974                                         if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) {
    975                                                 ArrayList<Symbol> symbols = new ArrayList<Symbol>();
    976                                                 ArrayList<CatSCF> scfs;
    977                                                 if ((scfs = (ArrayList<CatSCF>) getAttVal(feature, Obj.SMCFAC, 0, Att.CATSCF)) != null) {
    978                                                         for (CatSCF scf : scfs) {
    979                                                                 symbols.add(Facilities.Cats.get(scf));
    980                                                         }
    981                                                         Renderer.cluster(feature, symbols);
    982                                                 }
    983                                         }
    984                                         break;
    985                                 default:
    986                                         break;
    987                                 }
     956                        switch ((CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC)) {
     957                        case SLC_TWAL:
     958                                WatLEV lev = (WatLEV) getAttEnum(feature, feature.type, 0, Att.WATLEV);
     959                                if (lev == WatLEV.LEV_CVRS) {
     960                                        Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
     961                                        if (Renderer.zoom >= 15)
     962                                                Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80);
     963                                } else {
     964                                        Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
     965                                }
     966                                if (Renderer.zoom >= 15)
     967                                        Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30);
     968                                break;
     969                        case SLC_SWAY:
     970                                Renderer.lineVector(feature, new LineStyle(Color.black, 2, null, new Color(0xffe000)));
     971                                if ((Renderer.zoom >= 16) && feature.objs.containsKey(Obj.SMCFAC)) {
     972                                        ArrayList<Symbol> symbols = new ArrayList<Symbol>();
     973                                        ArrayList<CatSCF> scfs = (ArrayList<CatSCF>) getAttList(feature, Obj.SMCFAC, 0, Att.CATSCF);
     974                                        for (CatSCF scf : scfs) {
     975                                                symbols.add(Facilities.Cats.get(scf));
     976                                        }
     977                                        Renderer.cluster(feature, symbols);
     978                                }
     979                                break;
     980                        default:
     981                                break;
    988982                        }
    989983                }
     
    997991                                Renderer.symbol(feature, Harbours.SignalStation);
    998992                                str = "SS";
    999                                 ArrayList<CatSIT> tcats = (ArrayList<CatSIT>)getAttVal(feature, Obj.SISTAT, 0, Att.CATSIT);
    1000                                 if (tcats != null) {
    1001                                         switch (tcats.get(0)) {
    1002                                         case SIT_IPT:
    1003                                                 str += "(INT)";
    1004                                                 break;
    1005                                         case SIT_PRTE:
    1006                                                 str += "(Traffic)";
    1007                                                 break;
    1008                                         case SIT_PRTC:
    1009                                                 str += "(Port Control)";
    1010                                                 break;
    1011                                         case SIT_LOCK:
    1012                                                 str += "(Lock)";
    1013                                                 break;
    1014                                         case SIT_BRDG:
    1015                                                 str += "(Bridge)";
    1016                                                 break;
    1017                                         default:
    1018                                                 break;
    1019                                         }
     993                                ArrayList<CatSIT> tcats = (ArrayList<CatSIT>) getAttList(feature, Obj.SISTAT, 0, Att.CATSIT);
     994                                switch (tcats.get(0)) {
     995                                case SIT_IPT:
     996                                        str += "(INT)";
     997                                        break;
     998                                case SIT_PRTE:
     999                                        str += "(Traffic)";
     1000                                        break;
     1001                                case SIT_PRTC:
     1002                                        str += "(Port Control)";
     1003                                        break;
     1004                                case SIT_LOCK:
     1005                                        str += "(Lock)";
     1006                                        break;
     1007                                case SIT_BRDG:
     1008                                        str += "(Bridge)";
     1009                                        break;
     1010                                default:
     1011                                        break;
    10201012                                }
    10211013                                break;
     
    10241016                                str = "SS";
    10251017                                str = "SS";
    1026                                 ArrayList<CatSIW> wcats = (ArrayList<CatSIW>)getAttVal(feature, Obj.SISTAW, 0, Att.CATSIW);
    1027                                 if (wcats != null) {
    1028                                         switch (wcats.get(0)) {
    1029                                         case SIW_STRM:
    1030                                                 str += "(Storm)";
    1031                                                 break;
    1032                                         case SIW_WTHR:
    1033                                                 str += "(Weather)";
    1034                                                 break;
    1035                                         case SIW_ICE:
    1036                                                 str += "(Ice)";
    1037                                                 break;
    1038                                         case SIW_TIDG:
    1039                                                 str = "Tide gauge";
    1040                                                 break;
    1041                                         case SIW_TIDS:
    1042                                                 str = "Tide scale";
    1043                                                 break;
    1044                                         case SIW_TIDE:
    1045                                                 str += "(Tide)";
    1046                                                 break;
    1047                                         case SIW_TSTR:
    1048                                                 str += "(Stream)";
    1049                                                 break;
    1050                                         case SIW_DNGR:
    1051                                                 str += "(Danger)";
    1052                                                 break;
    1053                                         case SIW_MILY:
    1054                                                 str += "(Firing)";
    1055                                                 break;
    1056                                         case SIW_TIME:
    1057                                                 str += "(Time)";
    1058                                                 break;
    1059                                         default:
    1060                                                 break;
    1061                                         }
     1018                                ArrayList<CatSIW> wcats = (ArrayList<CatSIW>) getAttList(feature, Obj.SISTAW, 0, Att.CATSIW);
     1019                                switch (wcats.get(0)) {
     1020                                case SIW_STRM:
     1021                                        str += "(Storm)";
     1022                                        break;
     1023                                case SIW_WTHR:
     1024                                        str += "(Weather)";
     1025                                        break;
     1026                                case SIW_ICE:
     1027                                        str += "(Ice)";
     1028                                        break;
     1029                                case SIW_TIDG:
     1030                                        str = "Tide gauge";
     1031                                        break;
     1032                                case SIW_TIDS:
     1033                                        str = "Tide scale";
     1034                                        break;
     1035                                case SIW_TIDE:
     1036                                        str += "(Tide)";
     1037                                        break;
     1038                                case SIW_TSTR:
     1039                                        str += "(Stream)";
     1040                                        break;
     1041                                case SIW_DNGR:
     1042                                        str += "(Danger)";
     1043                                        break;
     1044                                case SIW_MILY:
     1045                                        str += "(Firing)";
     1046                                        break;
     1047                                case SIW_TIME:
     1048                                        str += "(Time)";
     1049                                        break;
     1050                                default:
     1051                                        break;
    10621052                                }
    10631053                                break;
     
    10751065                                Renderer.symbol(feature, Harbours.Pilot);
    10761066                                addName(feature, 15, new Font("Arial", Font.BOLD, 50), Msymb , new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, -40)));
    1077                                 CatPIL cat = (CatPIL) getAttVal(feature, feature.type, 0, Att.CATPIL);
    1078                                 if ((cat != null) && (cat == CatPIL.PIL_HELI))
     1067                                CatPIL cat = (CatPIL) getAttEnum(feature, feature.type, 0, Att.CATPIL);
     1068                                if (cat == CatPIL.PIL_HELI) {
    10791069                                        Renderer.labelText(feature, "H", new Font("Arial", Font.PLAIN, 40), Msymb, new Delta(Handle.LC, AffineTransform.getTranslateInstance(70, 0)));
     1070                                }
    10801071                                break;
    10811072                        case CGUSTA:
     
    11091100                        Double ort;
    11101101                        if ((ort = (Double) getAttVal(feature, feature.type, 0, Att.ORIENT)) != null) {
    1111                                 if (ort != null)
    1112                                         str += ort.toString() + "\u0152";
     1102                                str += ort.toString() + "\u0152";
    11131103                                if (!str.isEmpty())
    11141104                                        Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     
    11231113        private static void wrecks(Feature feature) {
    11241114                if (Renderer.zoom >= 14) {
    1125                         CatWRK cat;
    1126                         if ((cat = (CatWRK) getAttVal(feature, feature.type, 0, Att.CATWRK)) != null) {
    1127                                 switch (cat) {
    1128                                 case WRK_DNGR:
    1129                                 case WRK_MSTS:
    1130                                         Renderer.symbol(feature, Areas.WreckD);
    1131                                         break;
    1132                                 case WRK_HULS:
    1133                                         Renderer.symbol(feature, Areas.WreckS);
    1134                                         break;
    1135                                 default:
    1136                                         Renderer.symbol(feature, Areas.WreckND);
    1137                                 }
     1115                        switch ((CatWRK) getAttEnum(feature, feature.type, 0, Att.CATWRK)) {
     1116                        case WRK_DNGR:
     1117                        case WRK_MSTS:
     1118                                Renderer.symbol(feature, Areas.WreckD);
     1119                                break;
     1120                        case WRK_HULS:
     1121                                Renderer.symbol(feature, Areas.WreckS);
     1122                                break;
     1123                        default:
     1124                                Renderer.symbol(feature, Areas.WreckND);
    11381125                        }
    11391126                }
  • applications/editors/josm/plugins/seachart/src/render/Signals.java

    r30894 r30992  
    107107                String str = "";
    108108                if (atts.containsKey(Att.CATFOG)) {
    109                         str += fogSignals.get(atts.get(Att.CATFOG).val);
     109                        str += fogSignals.get(((ArrayList<?>)(atts.get(Att.CATFOG).val)).get(0));
    110110                }
    111111                if (atts.containsKey(Att.SIGGRP)) {
     
    128128                Renderer.symbol(feature, Beacons.RadarStation);
    129129                String bstr = "";
    130                 CatRTB cat = (CatRTB) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.CATRTB);
    131                 String wal = (String) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.RADWAL);
     130                CatRTB cat = (CatRTB) Rules.getAttEnum(feature, Obj.RTPBCN, 0, Att.CATRTB);
     131                String wal = Rules.getAttStr(feature, Obj.RTPBCN, 0, Att.RADWAL);
    132132                switch (cat) {
    133133                case RTB_RAMK:
     
    136136                case RTB_RACN:
    137137                        bstr += " Racon";
    138                         String astr = (String) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGGRP);
     138                        String astr = Rules.getAttStr(feature, Obj.RTPBCN, 0, Att.SIGGRP);
    139139                        if (!astr.isEmpty()) {
    140140                                bstr += "(" + astr + ")";
     
    142142                        Double per = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGPER);
    143143                        Double mxr = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.VALMXR);
    144                         if ((per != 0) || (mxr != 0)) {
     144                        if ((per != null) || (mxr != null)) {
    145145                                bstr += (astr.isEmpty() ? " " : "");
    146                                 bstr += (per != 0) ? per.toString() + "s" : "";
    147                                 bstr += (mxr != 0) ? mxr.toString() + "M" : "";
     146                                if (per != null) bstr += (per != 0) ? per.toString() + "s" : "";
     147                                if (mxr != null) bstr += (mxr != 0) ? mxr.toString() + "M" : "";
    148148                        }
    149149                        break;
     
    151151                        break;
    152152                }
    153                 if (wal!= null) {
     153                if (!wal.isEmpty()) {
    154154                        switch (wal) {
    155155                        case "0.03-X":
     
    168168        public static void radioStations(Feature feature) {
    169169                Renderer.symbol(feature, Beacons.RadarStation);
    170                 ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttVal(feature, Obj.RDOSTA, 0, Att.CATROS);
     170                ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttList(feature, Obj.RDOSTA, 0, Att.CATROS);
    171171                boolean vais = false;
    172172                String bstr = "";
  • applications/editors/josm/plugins/seachart/src/s57/S57att.java

    r30894 r30992  
    363363        }
    364364
    365         public static Att decodeAttribute(long attribute) {     // Convert S57 attribute code to OSeaM attribute enumeration
     365        public static Att decodeAttribute(long attribute) {     // Convert S57 attribute code to SCM attribute enumeration
    366366                Att att = S57Att.get((int)attribute);
    367367                return (att != null) ? att : Att.UNKATT;
    368368        }
    369369       
    370         public static Integer encodeAttribute(String attribute) {       // Convert OSeaM attribute enumeration to S57 attribute code
     370        public static Integer encodeAttribute(String attribute) {       // Convert SCM attribute enumeration to S57 attribute code
    371371                if (AttS57.containsKey(attribute))
    372372                        return AttS57.get(attribute);
     
    376376        }
    377377
    378         public static Integer encodeAttribute(Att attribute) {  // Convert OSeaM attribute enumeration to S57 attribute code
     378        public static Integer encodeAttribute(Att attribute) {  // Convert SCM attribute enumeration to S57 attribute code
    379379          return AttS57.get(attribute) != 0 ? AttS57.get(attribute) : AttIENC.get(attribute);
    380380        }
    381381
    382         public static String stringAttribute(Att attribute) {   // Convert OSeaM enumeration to OSeaM attribute string
     382        public static String stringAttribute(Att attribute) {   // Convert SCM enumeration to OSM attribute string
    383383                String str = AttStr.get(attribute);
    384384                return str != null ? str : "";
    385385        }
    386386       
    387         public static Att enumAttribute(String attribute, Obj obj) {    // Convert OSeaM attribute string to OSeaM enumeration
     387        public static Att enumAttribute(String attribute, Obj obj) {    // Convert OSM attribute string to SCM enumeration
    388388          if ((attribute != null) && !attribute.isEmpty()) {
    389389                        EnumMap<Obj, Att> map = StrAtt.get(attribute);
  • applications/editors/josm/plugins/seachart/src/s57/S57obj.java

    r30894 r30992  
    104104                ObjStr.put(Obj.BOYLAT, "buoy_lateral"); ObjStr.put(Obj.BOYSAW, "buoy_safe_water"); ObjStr.put(Obj.BOYSPP, "buoy_special_purpose");
    105105                ObjStr.put(Obj.CBLARE, "cable_area");   ObjStr.put(Obj.CBLOHD, "cable_overhead");       ObjStr.put(Obj.CBLSUB, "cable_submarine"); ObjStr.put(Obj.CANALS, "canal");
    106                 ObjStr.put(Obj.CANBNK, "canal_bank");   ObjStr.put(Obj.CTSARE, "cargo_area");   ObjStr.put(Obj.CAUSWY, "causeway");     ObjStr.put(Obj.CTNARE, "caution_area");
     106                ObjStr.put(Obj.CANBNK, "canalbank");    ObjStr.put(Obj.CTSARE, "cargo_area");   ObjStr.put(Obj.CAUSWY, "causeway");     ObjStr.put(Obj.CTNARE, "caution_area");
    107107                ObjStr.put(Obj.CHKPNT, "checkpoint");   ObjStr.put(Obj.CGUSTA, "coastguard_station");   ObjStr.put(Obj.COALNE, "coastline"); ObjStr.put(Obj.CONZNE, "contiguous_zone");
    108108                ObjStr.put(Obj.COSARE, "continental_shelf"); ObjStr.put(Obj.CTRPNT, "control_point");   ObjStr.put(Obj.CONVYR, "conveyor");     ObjStr.put(Obj.CRANES, "crane");
     
    127127                ObjStr.put(Obj.RAPIDS, "rapids");       ObjStr.put(Obj.RCRTCL, "recommended_route_centreline"); ObjStr.put(Obj.RECTRC, "recommended_track");
    128128                ObjStr.put(Obj.RCTLPT, "recommended_traffic_lane");     ObjStr.put(Obj.RSCSTA, "rescue_station");       ObjStr.put(Obj.RESARE, "restricted_area");
    129                 ObjStr.put(Obj.RETRFL, "retro_reflector"); ObjStr.put(Obj.RIVERS, "river");     ObjStr.put(Obj.RIVBNK, "river_bank");   ObjStr.put(Obj.ROADWY, "road");
     129                ObjStr.put(Obj.RETRFL, "retro_reflector"); ObjStr.put(Obj.RIVERS, "river");     ObjStr.put(Obj.RIVBNK, "riverbank");    ObjStr.put(Obj.ROADWY, "road");
    130130                ObjStr.put(Obj.RUNWAY, "runway");       ObjStr.put(Obj.SNDWAV, "sand_waves");   ObjStr.put(Obj.SEAARE, "sea_area");     ObjStr.put(Obj.SPLARE, "seaplane_landing_area");
    131131                ObjStr.put(Obj.SBDARE, "seabed_area"); ObjStr.put(Obj.SLCONS, "shoreline_construction"); ObjStr.put(Obj.SISTAT, "signal_station_traffic");
     
    155155        }
    156156       
    157         public static Obj decodeType(long objl) { // Convert S57 feature code to OSeaM object enumeration
     157        public static Obj decodeType(long objl) { // Convert S57 feature code to SCM object enumeration
    158158                Obj obj = S57Obj.get((int)objl);
    159159                return (obj != null) ? obj : Obj.UNKOBJ;
    160160        }
    161161
    162         public static long encodeType(Obj type) { // Convert OSM object enumeration to S57 feature code
     162        public static long encodeType(Obj type) { // Convert SCM object enumeration to S57 feature code
    163163                if (ObjS57.containsKey(type))
    164164                        return ObjS57.get(type);
     
    168168        }
    169169
    170         public static String stringType(Obj type) { // Convert OSeaM object enumeration to OSeaM object string
     170        public static String stringType(Obj type) { // Convert SCM object enumeration to OSM object string
    171171                String str = ObjStr.get(type);
    172172                        return str != null ? str : "";
    173173        }
    174174
    175         public static Obj enumType(String type) { // Convert OSeaM object string to OSeaM object enumeration
     175        public static Obj enumType(String type) { // Convert OSM object string to SCM object enumeration
    176176                if ((type != null) && !type.isEmpty() && (StrObj.containsKey(type)))
    177177                        return StrObj.get(type);
  • applications/editors/josm/plugins/seachart/src/s57/S57val.java

    r30894 r30992  
    11051105        }
    11061106       
    1107         public static Enum<?> s57Enum(String val, Att att) { // Convert S57 attribute value string to OSeaM enumeration
     1107        public static Enum<?> s57Enum(String val, Att att) {    // Convert S57 attribute value string to SCM enumeration
    11081108                EnumMap<?, ?> map = keys.get(att).map;
    11091109                Enum<?> unkn = null;
     
    11251125        }
    11261126
    1127         public static AttVal<?> decodeValue(String val, Att att) {          // Convert S57 attribute value string to OSeaM attribute value
     1127        public static AttVal<?> decodeValue(String val, Att att) {      // Convert S57 attribute value string to SCM attribute value
    11281128                Conv conv = keys.get(att).conv;
    11291129                switch (conv) {
     
    11321132                        return new AttVal<String>(att, conv, val);
    11331133                case E:
    1134                         return new AttVal<Enum<?>>(att, Conv.E, s57Enum(val, att));
     1134                        ArrayList<Enum<?>> list = new ArrayList<Enum<?>>();
     1135                        list.add(s57Enum(val, att));
     1136                        return new AttVal<ArrayList<?>>(att, Conv.E, list);
    11351137                case L:
    1136                         ArrayList<Enum<?>> list = new ArrayList<Enum<?>>();
     1138                        list = new ArrayList<Enum<?>>();
    11371139                        for (String item : val.split(",")) {
    11381140                                list.add(s57Enum(item, att));
     
    11551157        }
    11561158
    1157         public static Integer encodeValue(String val, Att att) {        // Convert OSeaM attribute value string to S57 attribute value
     1159        public static Integer encodeValue(String val, Att att) {        // Convert OSM attribute value string to S57 attribute value
    11581160                EnumMap<?, ?> map = keys.get(att).map;
    11591161                for (Object item : map.keySet()) {
     
    11651167
    11661168       
    1167         public static String stringValue(AttVal<?> attval) {                  // Convert OSeaM value object to OSeaM attribute value string
     1169        public static String stringValue(AttVal<?> attval) {    // Convert SCM value object to OSM attribute value string
    11681170                if (attval != null) {
    11691171                        switch (attval.conv) {
     
    11731175                        case E:
    11741176                                EnumMap<?, ?> map = keys.get(attval.att).map;
    1175                                 return ((S57enum) map.get(attval.val)).val;
     1177                                return ((S57enum) map.get(((ArrayList<?>) attval.val).get(0))).val;
    11761178                        case L:
    11771179                                String str = "";
     
    11921194        }
    11931195
    1194         public static Enum<?> osmEnum(String val, Att att) { // Convert OSeaM attribute value string to OSeaM enumeration
     1196        public static Enum<?> osmEnum(String val, Att att) {    // Convert OSM attribute value string to SCM enumeration
    11951197                EnumMap<?, ?> map = keys.get(att).map;
    11961198                Enum<?> unkn = null;
     
    12061208        }
    12071209
    1208         public static AttVal<?> convertValue(String val, Att att) {                             // Convert OSeaM attribute value string to OSeaM value object
     1210        public static AttVal<?> convertValue(String val, Att att) {     // Convert OSM attribute value string to SCM attribute value
    12091211                switch (keys.get(att).conv) {
    12101212                case A:
     
    12121214                        return new AttVal<String>(att, Conv.S, val);
    12131215                case E:
    1214                         return new AttVal<Enum<?>>(att, Conv.E, osmEnum(val, att));
     1216                        ArrayList<Enum<?>> list = new ArrayList<Enum<?>>();
     1217                        list.add(osmEnum(val, att));
     1218                        return new AttVal<ArrayList<?>>(att, Conv.E, list);
    12151219                case L:
    1216                         ArrayList<Enum<?>> list = new ArrayList<Enum<?>>();
     1220                        list = new ArrayList<Enum<?>>();
    12171221                        for (String item : val.split(";")) {
    12181222                                list.add(osmEnum(item, att));
     
    12341238                return new AttVal<Object>(att, keys.get(att).conv, null);
    12351239        }
     1240       
     1241        public static Enum<?> unknAtt(Att att) {
     1242                return (Enum<?>)(keys.get(att).map.keySet().toArray()[0]);
     1243        }
    12361244
    12371245}
  • applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java

    r30894 r30992  
    3030import render.ChartContext;
    3131import render.Renderer;
     32import render.Rules;
    3233import s57.S57map.*;
    3334
     
    6566        public void paint(Graphics2D g2, MapView mv, Bounds bb) {
    6667                Rectangle rect = Main.map.mapView.getBounds();
    67                 g2.setBackground(new Color(0xb5d0d0));
     68                g2.setBackground(Rules.Bwater);
    6869                g2.clearRect(rect.x, rect.y, rect.width, rect.height);
    6970                g2.setPaint(Color.black);
Note: See TracChangeset for help on using the changeset viewer.