Ignore:
Timestamp:
2013-10-18T17:29:48+02:00 (11 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

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

    r30025 r30027  
    6363//      public static final double textScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.5556, 0.3086, 0.1714, 0.0953, 0.0529, 0.0294, 0.0163, 0.0091, 0.0050, 0.0028, 0.0163 };
    6464       
    65         public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC }
     65        public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, HCLR }
    6666
    6767        static MapContext context;
     
    342342    double width = bounds.getWidth();
    343343    double height = bounds.getHeight();
    344     double dx = 0.25 * width;
    345     double dy = 0.25 * height;
     344                if (width < height) width = height;
     345    double dx = 0;
     346    double dy = 0;
    346347                switch (delta.h) {
    347348                case CC:
     
    349350                        dy += height / 2.0;
    350351                        break;
    351                 case TL:
    352                         dx += 0;
    353                         dy += 0;
    354                         break;
    355352                case TR:
    356353                        dx += width;
    357                         dy += 0;
    358354                        break;
    359355                case TC:
    360356                        dx += width / 2.0;
    361                         dy += 0;
    362357                        break;
    363358                case LC:
    364                         dx += 0;
    365359                        dy += height / 2.0;
    366360                        break;
     
    370364                        break;
    371365                case BL:
    372                         dx += 0;
    373366                        dy += height;
    374367                        break;
     
    382375                        break;
    383376                }
     377                width += (height * 0.8);
     378                dx += (height * 0.4);
     379                height *= 1.5;
     380                dy += (height * 0.15);
    384381                Symbol label = new Symbol();
    385382                switch (style) {
    386383                case RRCT:
    387                         if (width < height) width = height;
    388                         width *= 1.5;
    389                         height *= 1.5;
    390384                        label.add(new Instr(Prim.FILL, bg));
    391385                        label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height)));
     
    393387                        label.add(new Instr(Prim.STRK, new BasicStroke(1 + (int)(height/10), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
    394388                        label.add(new Instr(Prim.RRCT, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height)));
     389                        break;
     390                case VCLR:
     391                        height += 20;
     392                        dy += 10;
     393                        label.add(new Instr(Prim.FILL, bg));
     394                        label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height)));
     395                        label.add(new Instr(Prim.FILL, fg));
     396                        int sw = 1 + (int)(height/10);
     397                        double po = dy - (sw / 2);
     398                        label.add(new Instr(Prim.STRK, new BasicStroke(sw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)));
     399                        Path2D.Double p = new Path2D.Double(); p.moveTo(-(height*0.2),po); p.lineTo((height*0.2),po); p.moveTo(0,po); p.lineTo(0,po-10);
     400                        p.moveTo(-(height*0.2),-po); p.lineTo((height*0.2),-po); p.moveTo(0,-po); p.lineTo(0,-po+10);
     401                        label.add(new Instr(Prim.PLIN, p));
    395402                        break;
    396403                }
Note: See TracChangeset for help on using the changeset viewer.