Ignore:
Timestamp:
2013-12-08T20:52:05+01:00 (12 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/seamap/Rules.java

    r30046 r30119  
    3333                AttItem name = feature.atts.get(Att.OBJNAM);
    3434                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;
     35                        AttMap atts = feature.objs.get(feature.type).get(0);
     36                        if (atts != null) {
     37                                name = atts.get(Att.OBJNAM);
     38                        }
     39                }
     40                return (name != null) ? (String)name.val: null;
    3941        }
    4042
     
    203205                        break;
    204206                case MARCUL:
    205                         if (zoom >= 14)
    206                                 Renderer.symbol(feature, Areas.MarineFarm);
    207                         if (zoom >= 16)
    208                                 Renderer.lineVector(feature, new LineStyle(Color.black, 4, new float[] { 10, 10 }));
     207                        if (zoom >= 12) {
     208                                if (zoom >= 14) {
     209                                        Renderer.symbol(feature, Areas.MarineFarm);
     210                                }
     211                                if ((feature.area > 0.2) || ((feature.area > 0.05) && (zoom >= 14)) || ((feature.area > 0.005) && (zoom >= 16))) {
     212                                        Renderer.lineVector(feature, new LineStyle(Color.black, 4, new float[] { 10, 10 }));
     213                                }
     214                        }
    209215                        break;
    210216                case OSPARE:
     
    219225                        if (zoom >= 12) {
    220226                                Renderer.lineSymbols(feature, Areas.Restricted, 1.0, null, null, 0, Renderer.Mline);
    221                                 if (testAttribute(feature, feature.type, Att.CATPRA, CatREA.REA_NWAK)) {
     227                                if (testAttribute(feature, feature.type, Att.CATREA, CatREA.REA_NWAK)) {
    222228                                        Renderer.symbol(feature, Areas.NoWake);
    223229                                }
     
    277283                case SPLARE:
    278284                        if (zoom >= 12) {
    279                                 Renderer.symbol(feature, Areas.Plane);
     285                                Renderer.symbol(feature, Areas.Plane, new Scheme(Renderer.Msymb));
    280286                                Renderer.lineSymbols(feature, Areas.Restricted, 0.5, Areas.LinePlane, null, 10, Renderer.Mline);
    281287                        }
     
    327333        private static void bridges(Feature feature) {
    328334                if (zoom >= 16) {
    329                         double verclr, verccl, vercop;
     335                        double verclr, verccl, vercop, horclr;
    330336                        AttMap atts = feature.objs.get(Obj.BRIDGE).get(0);
    331                         String str = "";
     337                        String vstr = "";
     338                        String hstr = "";
    332339                        if (atts != null) {
    333                                 if (atts.containsKey(Att.VERCLR)) {
    334                                         verclr = (Double) atts.get(Att.VERCLR).val;
     340                                if (atts.containsKey(Att.HORCLR)) {
     341                                        horclr = (Double) atts.get(Att.HORCLR).val;
     342                                        hstr = String.valueOf(horclr);
     343                                }
     344                                        if (atts.containsKey(Att.VERCLR)) {
     345                                                verclr = (Double) atts.get(Att.VERCLR).val;
    335346                                } else {
    336347                                        verclr = atts.containsKey(Att.VERCSA) ? (Double) atts.get(Att.VERCSA).val : 0;
     
    339350                                vercop = atts.containsKey(Att.VERCOP) ? (Double) atts.get(Att.VERCOP).val : 0;
    340351                                if (verclr > 0) {
    341                                         str += String.valueOf(verclr);
     352                                        vstr += String.valueOf(verclr);
    342353                                } else if (verccl > 0) {
    343354                                        if (vercop == 0) {
    344                                                 str += String.valueOf(verccl) + "/-";
     355                                                vstr += String.valueOf(verccl) + "/-";
    345356                                        } else {
    346                                                 str += String.valueOf(verccl) + "/" + String.valueOf(vercop);
     357                                                vstr += String.valueOf(verccl) + "/" + String.valueOf(vercop);
    347358                                        }
    348359                                }
    349                                 if (!str.isEmpty())
    350                                         Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC));
     360                                if (hstr.isEmpty() && !vstr.isEmpty()) {
     361                                        Renderer.labelText(feature, vstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.CC));
     362                                } else if (!hstr.isEmpty() && !vstr.isEmpty()) {
     363                                        Renderer.labelText(feature, vstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.VCLR, Color.black, Color.white, new Delta(Handle.BC));
     364                                        Renderer.labelText(feature, hstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.TC));
     365                                } else if (!hstr.isEmpty() && vstr.isEmpty()) {
     366                                        Renderer.labelText(feature, hstr, new Font("Arial", Font.PLAIN, 30), LabelStyle.HCLR, Color.black, Color.white, new Delta(Handle.CC));
     367                                }
    351368                        }
    352369                }
Note: See TracChangeset for help on using the changeset viewer.