Changeset 29082 in osm for applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
- Timestamp:
- 2012-12-16T22:26:04+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
r29074 r29082 23 23 24 24 public enum Prim { 25 BBOX, STRK, COLR, FILL, LINE, RECT, RRCT, ELPS, EARC, PLIN, PGON, SYMB, 26 P1, 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, SYMB, P1, P2, H2, H3, H4, H5, V2, D2, D3, D4, B2, S2, S3, S4, C2, X2 27 26 } 28 27 … … 31 30 } 32 31 33 public static final double symbolScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 34 0.61, 0.372, 0.227, 0.138,0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007, 0.138 };35 36 public static final double textScale[] = { 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0, 1.0, 37 0.5556, 0.3086, 0.1714, 0.0953,0.0529, 0.0294, 0.0163, 0.0091, 0.0050, 0.0028, 0.0163 };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, 33 0.0843, 0.0514, 0.0313, 0.0191, 0.0117, 0.007, 0.138 }; 34 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, 36 0.0529, 0.0294, 0.0163, 0.0091, 0.0050, 0.0028, 0.0163 }; 38 37 39 38 private static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class); … … 86 85 87 86 public static void drawSymbol(Graphics2D g2, ArrayList<Instr> symbol, int zoom, double x, double y, Delta dd, Scheme cs) { 88 int pn = cs.pat.size(); 89 int cn = cs.col.size() - pn + 1; 87 int pn = 0; 88 int cn = 0; 89 if (cs != null) { 90 pn = cs.pat.size(); 91 cn = cs.col.size() - ((pn != 0) ? pn - 1 : 0); 92 } 90 93 AffineTransform savetr = g2.getTransform(); 91 94 g2.translate(x, y); … … 94 97 switch (item.type) { 95 98 case BBOX: 96 Rectangle bbox = (Rectangle) item.params;99 Rectangle bbox = (Rectangle) item.params; 97 100 double dx = 0.0; 98 101 double dy = 0.0; … … 100 103 switch (dd.h) { 101 104 case CC: 102 dx = bbox.x + (bbox.width /2.0);103 dy = bbox.y - (bbox.height /2.0);105 dx = bbox.x + (bbox.width / 2.0); 106 dy = bbox.y - (bbox.height / 2.0); 104 107 break; 105 108 case TL: … … 112 115 break; 113 116 case TC: 114 dx = bbox.x + (bbox.width /2.0);117 dx = bbox.x + (bbox.width / 2.0); 115 118 dy = bbox.y; 116 119 break; 117 120 case LC: 118 121 dx = bbox.x; 119 dy = bbox.y - (bbox.height /2.0);122 dy = bbox.y - (bbox.height / 2.0); 120 123 break; 121 124 case RC: 122 125 dx = bbox.x + bbox.width; 123 dy = bbox.y - (bbox.height /2.0);126 dy = bbox.y - (bbox.height / 2.0); 124 127 break; 125 128 case BL: … … 132 135 break; 133 136 case BC: 134 dx = bbox.x + (bbox.width /2.0);137 dx = bbox.x + (bbox.width / 2.0); 135 138 dy = bbox.y - bbox.height; 136 139 break; … … 150 153 } 151 154 break; 155 case P2: 156 if (cn > 0) { 157 if (cn > 1) { 158 g2.setPaint(bodyColours.get(cs.col.get(1))); 159 } else { 160 g2.setPaint(bodyColours.get(cs.col.get(0))); 161 } 162 g2.fill((Path2D.Double) patch.params); 163 } 164 break; 152 165 case H2: 153 166 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { … … 211 224 g2.fill((Path2D.Double) item.params); 212 225 break; 226 case SYMB: 227 drawSymbol(g2, (ArrayList<Instr>) item.params, zoom, 0.0, 0.0, null, null); 228 break; 213 229 } 214 230 }
Note:
See TracChangeset
for help on using the changeset viewer.