Changeset 30027 in osm for applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
- Timestamp:
- 2013-10-18T17:29:48+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r30025 r30027 63 63 // 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 }; 64 64 65 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC } 65 public enum LabelStyle { NONE, RRCT, RECT, ELPS, CIRC, VCLR, HCLR } 66 66 67 67 static MapContext context; … … 342 342 double width = bounds.getWidth(); 343 343 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; 346 347 switch (delta.h) { 347 348 case CC: … … 349 350 dy += height / 2.0; 350 351 break; 351 case TL:352 dx += 0;353 dy += 0;354 break;355 352 case TR: 356 353 dx += width; 357 dy += 0;358 354 break; 359 355 case TC: 360 356 dx += width / 2.0; 361 dy += 0;362 357 break; 363 358 case LC: 364 dx += 0;365 359 dy += height / 2.0; 366 360 break; … … 370 364 break; 371 365 case BL: 372 dx += 0;373 366 dy += height; 374 367 break; … … 382 375 break; 383 376 } 377 width += (height * 0.8); 378 dx += (height * 0.4); 379 height *= 1.5; 380 dy += (height * 0.15); 384 381 Symbol label = new Symbol(); 385 382 switch (style) { 386 383 case RRCT: 387 if (width < height) width = height;388 width *= 1.5;389 height *= 1.5;390 384 label.add(new Instr(Prim.FILL, bg)); 391 385 label.add(new Instr(Prim.RSHP, new RoundRectangle2D.Double(-dx,-dy,width,height,height,height))); … … 393 387 label.add(new Instr(Prim.STRK, new BasicStroke(1 + (int)(height/10), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER))); 394 388 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)); 395 402 break; 396 403 }
Note:
See TracChangeset
for help on using the changeset viewer.