Changeset 29176 in osm for applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
- Timestamp:
- 2013-01-06T19:35:09+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/symbols/Symbols.java
r29134 r29176 125 125 g2.translate(x, y); 126 126 g2.scale(scale, scale); 127 for (Instr item : symbol) { 128 switch (item.type) { 129 case BBOX: 130 Rectangle bbox = (Rectangle) item.params; 131 double dx = 0.0; 132 double dy = 0.0; 133 if (dd != null) { 134 g2.transform(dd.t); 135 switch (dd.h) { 136 case CC: 137 dx = bbox.x + (bbox.width / 2.0); 138 dy = bbox.y + (bbox.height / 2.0); 139 break; 140 case TL: 141 dx = bbox.x; 142 dy = bbox.y; 143 break; 144 case TR: 145 dx = bbox.x + bbox.width; 146 dy = bbox.y; 147 break; 148 case TC: 149 dx = bbox.x + (bbox.width / 2.0); 150 dy = bbox.y; 151 break; 152 case LC: 153 dx = bbox.x; 154 dy = bbox.y + (bbox.height / 2.0); 155 break; 156 case RC: 157 dx = bbox.x + bbox.width; 158 dy = bbox.y + (bbox.height / 2.0); 159 break; 160 case BL: 161 dx = bbox.x; 162 dy = bbox.y + bbox.height; 163 break; 164 case BR: 165 dx = bbox.x + bbox.width; 166 dy = bbox.y + bbox.height; 167 break; 168 case BC: 169 dx = bbox.x + (bbox.width / 2.0); 170 dy = bbox.y + bbox.height; 171 break; 127 if (symbol != null) { 128 for (Instr item : symbol) { 129 switch (item.type) { 130 case BBOX: 131 Rectangle bbox = (Rectangle) item.params; 132 double dx = 0.0; 133 double dy = 0.0; 134 if (dd != null) { 135 g2.transform(dd.t); 136 switch (dd.h) { 137 case CC: 138 dx = bbox.x + (bbox.width / 2.0); 139 dy = bbox.y + (bbox.height / 2.0); 140 break; 141 case TL: 142 dx = bbox.x; 143 dy = bbox.y; 144 break; 145 case TR: 146 dx = bbox.x + bbox.width; 147 dy = bbox.y; 148 break; 149 case TC: 150 dx = bbox.x + (bbox.width / 2.0); 151 dy = bbox.y; 152 break; 153 case LC: 154 dx = bbox.x; 155 dy = bbox.y + (bbox.height / 2.0); 156 break; 157 case RC: 158 dx = bbox.x + bbox.width; 159 dy = bbox.y + (bbox.height / 2.0); 160 break; 161 case BL: 162 dx = bbox.x; 163 dy = bbox.y + bbox.height; 164 break; 165 case BR: 166 dx = bbox.x + bbox.width; 167 dy = bbox.y + bbox.height; 168 break; 169 case BC: 170 dx = bbox.x + (bbox.width / 2.0); 171 dy = bbox.y + bbox.height; 172 break; 173 } 174 g2.translate(-dx, -dy); 172 175 } 173 g2.translate(-dx, -dy); 174 } 175 break; 176 case COLR: 177 if ((cs != null) && (cs.col != null)) { 178 for (Instr patch : (ArrayList<Instr>) item.params) { 179 switch (patch.type) { 180 case P1: 181 if (cn > 0) { 182 g2.setPaint(bodyColours.get(cs.col.get(0))); 183 g2.fill((Path2D.Double) patch.params); 176 break; 177 case COLR: 178 if ((cs != null) && (cs.col != null)) { 179 for (Instr patch : (ArrayList<Instr>) item.params) { 180 switch (patch.type) { 181 case P1: 182 if (cn > 0) { 183 g2.setPaint(bodyColours.get(cs.col.get(0))); 184 g2.fill((Path2D.Double) patch.params); 185 } 186 break; 187 case P2: 188 if (cn > 0) { 189 if (cn > 1) { 190 g2.setPaint(bodyColours.get(cs.col.get(1))); 191 } else { 192 g2.setPaint(bodyColours.get(cs.col.get(0))); 193 } 194 g2.fill((Path2D.Double) patch.params); 195 } 196 break; 197 case H2: 198 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 199 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn))); 200 g2.fill((Path2D.Double) patch.params); 201 } 202 break; 203 case H3: 204 if ((cn == 3) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 205 g2.setPaint(bodyColours.get(cs.col.get(1))); 206 g2.fill((Path2D.Double) patch.params); 207 } 208 break; 209 case H4: 210 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 211 g2.setPaint(bodyColours.get(cs.col.get(1))); 212 g2.fill((Path2D.Double) patch.params); 213 } 214 break; 215 case H5: 216 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) { 217 g2.setPaint(bodyColours.get(cs.col.get(2))); 218 g2.fill((Path2D.Double) patch.params); 219 } 220 break; 221 case V2: 222 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_VERT)) { 223 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn))); 224 g2.fill((Path2D.Double) patch.params); 225 } 226 break; 184 227 } 185 break;186 case P2:187 if (cn > 0) {188 if (cn > 1) {189 g2.setPaint(bodyColours.get(cs.col.get(1)));190 } else {191 g2.setPaint(bodyColours.get(cs.col.get(0)));192 }193 g2.fill((Path2D.Double) patch.params);194 }195 break;196 case H2:197 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {198 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn)));199 g2.fill((Path2D.Double) patch.params);200 }201 break;202 case H3:203 if ((cn == 3) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {204 g2.setPaint(bodyColours.get(cs.col.get(1)));205 g2.fill((Path2D.Double) patch.params);206 }207 break;208 case H4:209 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {210 g2.setPaint(bodyColours.get(cs.col.get(1)));211 g2.fill((Path2D.Double) patch.params);212 }213 break;214 case H5:215 if ((cn == 4) && (cs.pat.get(0) == ColPAT.PAT_HORI)) {216 g2.setPaint(bodyColours.get(cs.col.get(2)));217 g2.fill((Path2D.Double) patch.params);218 }219 break;220 case V2:221 if ((cn > 1) && (cs.pat.get(0) == ColPAT.PAT_VERT)) {222 g2.setPaint(bodyColours.get(cs.col.get(cs.col.size() - pn)));223 g2.fill((Path2D.Double) patch.params);224 }225 break;226 228 } 227 229 } 230 break; 231 case STRK: 232 g2.setStroke((BasicStroke) item.params); 233 break; 234 case FILL: 235 g2.setPaint((Color) item.params); 236 break; 237 case LINE: 238 g2.draw((Line2D.Double) item.params); 239 break; 240 case RECT: 241 g2.draw((Rectangle2D.Double) item.params); 242 break; 243 case RRCT: 244 g2.draw((RoundRectangle2D.Double) item.params); 245 break; 246 case ELPS: 247 g2.draw((Ellipse2D.Double) item.params); 248 break; 249 case EARC: 250 g2.draw((Arc2D.Double) item.params); 251 break; 252 case PLIN: 253 g2.draw((Path2D.Double) item.params); 254 break; 255 case PGON: 256 g2.fill((Path2D.Double) item.params); 257 break; 258 case RSHP: 259 g2.fill((RectangularShape) item.params); 260 break; 261 case SYMB: 262 Symbol s = (Symbol) item.params; 263 drawSymbol(g2, s.instr, s.scale, s.x, s.y, s.delta, s.scheme); 264 break; 265 case FONT: 266 g2.setFont((Font) item.params); 267 break; 268 case TEXT: 269 Caption c = (Caption) item.params; 270 g2.drawString(c.str, c.x, c.y); 271 break; 228 272 } 229 break;230 case STRK:231 g2.setStroke((BasicStroke) item.params);232 break;233 case FILL:234 g2.setPaint((Color) item.params);235 break;236 case LINE:237 g2.draw((Line2D.Double) item.params);238 break;239 case RECT:240 g2.draw((Rectangle2D.Double) item.params);241 break;242 case RRCT:243 g2.draw((RoundRectangle2D.Double) item.params);244 break;245 case ELPS:246 g2.draw((Ellipse2D.Double) item.params);247 break;248 case EARC:249 g2.draw((Arc2D.Double) item.params);250 break;251 case PLIN:252 g2.draw((Path2D.Double) item.params);253 break;254 case PGON:255 g2.fill((Path2D.Double) item.params);256 break;257 case RSHP:258 g2.fill((RectangularShape) item.params);259 break;260 case SYMB:261 Symbol s = (Symbol) item.params;262 drawSymbol(g2, s.instr, s.scale, s.x, s.y, s.delta, s.scheme);263 break;264 case FONT:265 g2.setFont((Font)item.params);266 break;267 case TEXT:268 Caption c = (Caption)item.params;269 g2.drawString(c.str, c.x, c.y);270 break;271 273 } 272 274 }
Note:
See TracChangeset
for help on using the changeset viewer.