Ignore:
Timestamp:
2012-12-26T14:12:40+01:00 (13 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/symbols/Symbols.java

    r29114 r29120  
    2323
    2424        public enum Prim {
    25                 BBOX, STRK, COLR, FILL, LINE, RECT, RRCT, ELPS, EARC, PLIN, PGON, SYMB, P1, P2, H2, H3, H4, H5, V2, D2, D3, D4, B2, S2, S3, S4, C2, X2
     25                BBOX, STRK, COLR, FILL, LINE, RECT, RRCT, ELPS, EARC, PLIN, PGON, RSHP, TEXT, SYMB, P1, P2, H2, H3, H4, H5, V2, D2, D3, D4, B2, S2, S3, S4, C2, X2
    2626        }
    2727
     
    3030        }
    3131
    32         public static final double symbolScale[] = { 1.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138,
     32        public static final double symbolScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 0.61, 0.372, 0.227, 0.138,
    3333                        0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007, 0.138 };
    3434
    35         public static final double textScale[] = { 1.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,
     35        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,
    3636                        0.0529, 0.0294, 0.0163, 0.0091, 0.0050, 0.0028, 0.0163 };
    3737
     
    8484        }
    8585
    86         public static void drawSymbol(Graphics2D g2, ArrayList<Instr> symbol, int zoom, double x, double y, Delta dd, Scheme cs) {
     86        public static class Symbol {
     87                ArrayList<Instr> instr;
     88                double scale;
     89                double x;
     90                double y;
     91                Delta delta;
     92                Scheme scheme;
     93
     94                public Symbol(ArrayList<Instr> iinstr, double iscale, double ix, double iy, Delta idelta, Scheme ischeme) {
     95                        instr = iinstr;
     96                        scale = iscale;
     97                        x = ix;
     98                        y = iy;
     99                        delta = idelta;
     100                        scheme = ischeme;
     101                }
     102        }
     103
     104        public static void drawSymbol(Graphics2D g2, ArrayList<Instr> symbol, double scale, double x, double y, Delta dd, Scheme cs) {
    87105                int pn = 0;
    88106                int cn = 0;
     
    93111                AffineTransform savetr = g2.getTransform();
    94112                g2.translate(x, y);
    95                 g2.scale(symbolScale[zoom], symbolScale[zoom]);
     113                g2.scale(scale, scale);
    96114                for (Instr item : symbol) {
    97115                        switch (item.type) {
     
    224242                                g2.fill((Path2D.Double) item.params);
    225243                                break;
     244                        case RSHP:
     245                                g2.fill((RectangularShape) item.params);
     246                                break;
    226247                        case SYMB:
    227                                 drawSymbol(g2, (ArrayList<Instr>) item.params, 0, 0.0, 0.0, null, null);
     248                                Symbol s = (Symbol) item.params;
     249                                drawSymbol(g2, s.instr, s.scale, s.x, s.y, s.delta, s.scheme);
     250                                break;
     251                        case TEXT:
    228252                                break;
    229253                        }
Note: See TracChangeset for help on using the changeset viewer.