Changeset 29789 in osm for applications/editors


Ignore:
Timestamp:
2013-07-30T10:04:34+02:00 (11 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed2/src
Files:
3 edited

Legend:

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

    r29275 r29789  
    228228        }
    229229       
    230         public static void lineText (Feature feature, String str, Font font, double offset, double dy) {
     230        public static void lineText (Feature feature, String str, Font font, Color colour, double offset, double dy) {
    231231               
    232232        }
  • applications/editors/josm/plugins/smed2/src/seamap/Rules.java

    r29787 r29789  
    293293                        break;
    294294                case BOYINB:
    295                         Renderer.symbol(feature, Buoys.Storage, feature.type, null);
     295                        Renderer.symbol(feature, Buoys.Super, feature.type, null);
    296296                        break;
    297297                }
     
    710710        }
    711711        private static void platforms(Feature feature) {
    712                 Renderer.symbol(feature, Landmarks.Platform, null, null);
     712                ArrayList<CatOFP> cats = (ArrayList<CatOFP>)Renderer.getAttVal(feature, Obj.OFSPLF, 0, Att.CATOFP);
     713                if ((CatOFP) cats.get(0) == CatOFP.OFP_FPSO)
     714                        Renderer.symbol(feature, Buoys.Storage, null, null);
     715                else
     716                        Renderer.symbol(feature, Landmarks.Platform, null, null);
     717                AttItem name = feature.atts.get(Att.OBJNAM);
     718                if ((zoom >= 15) && (name != null))
     719                        Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(60, -50)));
    713720/*object_rules(platforms) {
    714   if (has_attribute("category")) {
    715     attribute_switch("category")
    716     attribute_case("fpso") symbol("storage");
    717     attribute_default symbol("platform");
    718     end_switch
    719   } else {
    720     symbol("platform");
    721   }
    722   if ((zoom >= 15) && has_item_attribute("name"))
    723     text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:80; text-anchor:start", 60, -50);
    724721  if (has_object("fog_signal")) object(fogs);
    725722  if (has_object("radar_transponder")) object(rtbs);
     
    729726        }
    730727        private static void ports(Feature feature) {
    731 /*object_rules(ports) {
    732   if (zoom>=14) {
    733     if (is_type("crane")) {
    734       if (attribute_test("category", "container_crane")) symbol("container_crane");
    735       else symbol("port_crane");
    736     }
    737     if (is_type("hulk")) {
    738       area("fill:#ffe000;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-opacity:1");
    739       if ((zoom >= 15) && (has_item_attribute("name")))
    740         text(item_attribute("name"), "font-family:Arial; font-weight:bold; font-size:70; text-anchor:middle", 0, 0);
    741     }
    742   }
    743 }
    744 */
     728                if (zoom >= 14) {
     729                        if (feature.type == Obj.CRANES) {
     730                                if ((CatCRN) Renderer.getAttVal(feature, feature.type, 0, Att.CATCRN) == CatCRN.CRN_CONT)
     731                                        Renderer.symbol(feature, Harbours.ContainerCrane, null, null);
     732                                else
     733                                        Renderer.symbol(feature, Harbours.PortCrane, null, null);
     734                        } else if (feature.type == Obj.HULKES) {
     735                                Renderer.lineVector(feature, new LineStyle(Color.black, 4, null, new Color(0xffe000)));
     736                                AttItem name = feature.atts.get(Att.OBJNAM);
     737                                if ((zoom >= 15) && (name != null))
     738                                        Renderer.labelText(feature, (String) name.val, new Font("Arial", Font.BOLD, 80), Color.black, null);
     739                        }
     740                }
    745741        }
    746742        private static void separation(Feature feature) {
     
    779775                                        Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null));
    780776                                        if (zoom >= 15)
    781                                                 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), 0.5, 20);
     777                                                Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 20);
    782778                                } else {
    783779                                        Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null));
    784780                                }
    785781                                if (zoom >= 15)
    786                                         Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), 0.5, -20);
     782                                        Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
    787783                        }
    788784                }
     
    799795                                Renderer.symbol(feature, Beacons.RadarStation, null, null);
    800796                                ArrayList<CatROS> cats = (ArrayList<CatROS>)Renderer.getAttVal(feature, Obj.RDOSTA, 0, Att.CATROS);
     797                                String str = "";
    801798                                for (CatROS ros : cats) {
    802799                                        switch (ros) {
    803800                                        case ROS_OMNI:
    804                                                 Renderer.labelText(feature, " RC", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     801                                                str += " RC";
    805802                                                break;
    806803                                        case ROS_DIRL:
    807                                                 Renderer.labelText(feature, " RD", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     804                                                str += " RD";
    808805                                                break;
    809806                                        case ROS_ROTP:
    810                                                 Renderer.labelText(feature, " RW", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     807                                                str += " RW";
    811808                                                break;
    812809                                        case ROS_CNSL:
    813                                                 Renderer.labelText(feature, " Consol", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     810                                                str += " Consol";
    814811                                                break;
    815812                                        case ROS_RDF:
    816                                                 Renderer.labelText(feature, " RG", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     813                                                str += " RG";
    817814                                                break;
    818815                                        case ROS_QTA:
    819                                                 Renderer.labelText(feature, " R", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     816                                                str += " R";
    820817                                                break;
    821818                                        case ROS_AERO:
    822                                                 Renderer.labelText(feature, " AeroRC", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     819                                                str += " AeroRC";
    823820                                                break;
    824821                                        case ROS_DECA:
    825                                                 Renderer.labelText(feature, " Decca", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     822                                                str += " Decca";
    826823                                                break;
    827824                                        case ROS_LORN:
    828                                                 Renderer.labelText(feature, " Loran", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     825                                                str += " Loran";
    829826                                                break;
    830827                                        case ROS_DGPS:
    831                                                 Renderer.labelText(feature, " DGPS", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     828                                                str += " DGPS";
    832829                                                break;
    833830                                        case ROS_TORN:
    834                                                 Renderer.labelText(feature, " Toran", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     831                                                str += " Toran";
    835832                                                break;
    836833                                        case ROS_OMGA:
    837                                                 Renderer.labelText(feature, " Omega", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     834                                                str += " Omega";
    838835                                                break;
    839836                                        case ROS_SYLD:
    840                                                 Renderer.labelText(feature, " Syledis", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     837                                                str += " Syledis";
    841838                                                break;
    842839                                        case ROS_CHKA:
    843                                                 Renderer.labelText(feature, " Chiaka", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     840                                                str += " Chiaka";
    844841                                                break;
    845842                                        case ROS_PCOM:
     
    850847                                        case ROS_PAIS:
    851848                                        case ROS_SAIS:
    852                                                 Renderer.labelText(feature, " AIS", new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
     849                                                str += " AIS";
    853850                                                break;
    854851                                        case ROS_VAIS:
     
    897894                                        }
    898895                                }
     896                                if (!str.isEmpty()) Renderer.labelText(feature, str, new Font("Arial", Font.PLAIN, 70), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -180)));
    899897                                break;
    900898                        case RADSTA:
     
    920918        }
    921919        private static void transits(Feature feature) {
    922 /*object_rules(transits) {
    923   int ref;
    924   if (zoom >= 12) {
    925     if (is_type("recommended_track")) ref = line("stroke-width:8; stroke:#000000; stroke-linecap:butt; fill:none");
    926     else if (is_type("navigation_line")) ref = line("stroke-width:8; stroke-dasharray:20,20; stroke:#000000; stroke-linecap:butt; fill:none");
    927   }
    928   if (zoom >= 15) {
    929     make_string("");
    930     if (has_object("name")) {
    931       add_string(item_attribute("name"));
    932       add_string(" ");
    933     }
    934     if (has_attribute("orientation")) {
    935       add_string(attribute("orientation"));
    936       add_string("\u00A1");
    937     }
    938     if (has_attribute("category")) {
    939       add_string(" (");
    940       add_string(attribute("category"));
    941       add_string(")");
    942     }
    943     line_text(string, "font-family:Arial; font-weight:normal; font-size:80; text-anchor:middle", 0.5, -20, ref);
    944     free_string
    945   }
    946 }
    947 */
     920          if (zoom >= 12) {
     921                if (feature.type == Obj.RECTRC) Renderer.lineVector (feature, new LineStyle(Color.black, 10, null, null));
     922                else if (feature.type == Obj.NAVLNE) Renderer.lineVector (feature, new LineStyle(Color.black, 10, new float[] { 25, 25 }, null));
     923          }
     924          if (zoom >= 15) {
     925                String str = "";
     926                        AttItem name = feature.atts.get(Att.OBJNAM);
     927                        if (name != null) str += (String)name.val + " ";
     928                        Double ort = (Double) Renderer.getAttVal(feature, feature.type, 0, Att.ORIENT);
     929                        if (ort != null) str += ort.toString() + "¼";
     930                        if (!str.isEmpty()) Renderer.lineText(feature, str, new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -20);
     931          }
    948932        }
    949933        private static void waterways(Feature feature) {
    950                 if ((zoom >= 14) && (feature.atts.get(Att.OBJNAM) != null)) {
    951                         // lineText(item_attribute("name"), "font-family:Arial;font-weight:bold;font-size:80;text-anchor:middle", 0.5, 15, line("stroke:none;fill:none"));
    952                 }
    953934        }
    954935        private static void wrecks(Feature feature) {
     
    966947                                Renderer.symbol(feature, Areas.WreckND, null, null);
    967948                        }
    968                 } else {
    969                         Renderer.symbol(feature, Areas.WreckND, null, null);
    970949                }
    971950        }
  • applications/editors/josm/plugins/smed2/src/symbols/Harbours.java

    r29199 r29789  
    2828                p.lineTo(-31.0,22.0); p.quadTo(-21.0,29.0,-7.0,31.0); p.lineTo(-6.0,-30.0); p.lineTo(-23.0,-30.0); p.lineTo(-23.0,-40.0); p.closePath();
    2929                Anchor.add(new Instr(Prim.PGON, p));
    30         }
    31         public static final Symbol Yacht = new Symbol();
    32         static {
    33                 Yacht.add(new Instr(Prim.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    34                 Path2D.Double p = new Path2D.Double(); p.moveTo(-65.0,50.0); p.curveTo(-36.0,97.0,36.0,97.0,65.0,50.0); p.lineTo(3.0,50.0); p.lineTo(3.0,40.0); p.lineTo(55.0,30.0);
    35                 p.curveTo(32.0,4.0,25.0,-15.0,26.0,-52.0); p.lineTo(1.5,-40.0); p.lineTo(1.0,-64.0); p.lineTo(-2.0,-64.0); p.lineTo(-4.0,50.0); p.closePath();
    36                 p.moveTo(-50.0,45.0); p.curveTo(-55.0,3.0,-37.0,-28.5,-7.0,-46.0); p.curveTo(-28.0,-15.0,-26.0,11.0,-20.5,30.0); p.closePath();
    37                 Yacht.add(new Instr(Prim.PGON, p));
    3830        }
    3931        public static final Symbol Anchorage = new Symbol();
     
    193185                TideGauge.add(new Instr(Prim.LINE, new Line2D.Double(-15,-65,15,-65)));
    194186        }
     187        public static final Symbol Yacht = new Symbol();
     188        static {
     189                Yacht.add(new Instr(Prim.STRK, new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     190                Path2D.Double p = new Path2D.Double(); p.moveTo(-65.0,50.0); p.curveTo(-36.0,97.0,36.0,97.0,65.0,50.0); p.lineTo(3.0,50.0); p.lineTo(3.0,40.0); p.lineTo(55.0,30.0);
     191                p.curveTo(32.0,4.0,25.0,-15.0,26.0,-52.0); p.lineTo(1.5,-40.0); p.lineTo(1.0,-64.0); p.lineTo(-2.0,-64.0); p.lineTo(-4.0,50.0); p.closePath();
     192                p.moveTo(-50.0,45.0); p.curveTo(-55.0,3.0,-37.0,-28.5,-7.0,-46.0); p.curveTo(-28.0,-15.0,-26.0,11.0,-20.5,30.0); p.closePath();
     193                Yacht.add(new Instr(Prim.PGON, p));
     194        }
    195195}
Note: See TracChangeset for help on using the changeset viewer.