Changeset 30317 in osm for applications/editors/josm/plugins/smed2/src/render
- Timestamp:
- 2014-03-04T09:33:46+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/render
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/render/Renderer.java
r30316 r30317 252 252 } 253 253 if (!gap) { 254 Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(col), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90)))); 254 Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(col), 255 new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90)))); 255 256 } 256 257 if (space > 0) … … 494 495 if (!str.isEmpty()) { 495 496 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 497 g2.setPaint(colour); 496 498 FontRenderContext frc = g2.getFontRenderContext(); 497 GlyphVector gv = font.deriveFont((float)(font.getSize())).createGlyphVector(frc, (" " + str)); 499 GlyphVector gv = font.deriveFont((float)(font.getSize()*sScale)).createGlyphVector(frc, (" " + str)); 500 GeneralPath path = new GeneralPath(); 498 501 Point2D prev = new Point2D.Double(); 499 502 Point2D next = new Point2D.Double(); … … 503 506 double angle = 0; 504 507 int index = 0; 505 double gwidth = offset * (feature.geom.length * context.mile(feature) - (gv.getLogicalBounds().getWidth() * sScale));508 double gwidth = offset * (feature.geom.length * context.mile(feature) - gv.getLogicalBounds().getWidth()) + gv.getGlyphMetrics(0).getAdvance(); 506 509 GeomIterator git = map.new GeomIterator(feature.geom); 507 510 while (git.hasComp()) { … … 535 538 succ = new Point2D.Double(curr.getX() + (gwidth * Math.cos(angle)), curr.getY() + (gwidth * Math.sin(angle))); 536 539 } 537 Symbol symbol = new Symbol();538 540 Shape shape = gv.getGlyphOutline(index); 539 Rectangle2D bounds = shape.getBounds2D();540 symbol.add(new Instr(Form.BBOX, new Rectangle2D.Double(bounds.getX(), (bounds.getY() - dy), bounds.getWidth(), bounds.getHeight())));541 symbol.add(new Instr(Form.PGON, new Path2D.Double(shape)));542 Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(colour),543 new Delta((dy < 0) ? Handle.BL : Handle.TL, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())))));541 Point2D point = gv.getGlyphPosition(index); 542 AffineTransform at = AffineTransform.getTranslateInstance(curr.getX(), curr.getY()); 543 at.rotate(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX()))); 544 at.translate(-point.getX(), -point.getY() + (dy * sScale)); 545 path.append(at.createTransformedShape(shape), false); 544 546 curr = succ; 545 547 if (++index < gv.getNumGlyphs()) { 546 gwidth = gv.getGlyphMetrics(index).getAdvance() * sScale;548 gwidth = gv.getGlyphMetrics(index).getAdvance(); 547 549 } else { 550 g2.fill(path); 548 551 return; 549 552 } -
applications/editors/josm/plugins/smed2/src/render/Rules.java
r30315 r30317 985 985 Renderer.lineVector(feature, new LineStyle(Color.black, 10, new float[] { 40, 40 }, null)); 986 986 if (Renderer.zoom >= 15) 987 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 20);987 Renderer.lineText(feature, "(covers)", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, 80); 988 988 } else { 989 989 Renderer.lineVector(feature, new LineStyle(Color.black, 10, null, null)); 990 990 } 991 991 if (Renderer.zoom >= 15) 992 Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, - 20);992 Renderer.lineText(feature, "Training Wall", new Font("Arial", Font.PLAIN, 80), Color.black, 0.5, -30); 993 993 } 994 994 } -
applications/editors/josm/plugins/smed2/src/render/Signals.java
r30285 r30317 185 185 186 186 } 187 188 private static Point2D.Double radial(Snode centre, double radius, double angle) { 189 Point2D origin = Renderer.context.getPoint(centre); 190 double mile = Renderer.context.getPoint(Renderer.map.new Snode((centre.lat + Math.toRadians(1/60)), centre.lon)).getY() - origin.getY(); 191 return new Point2D.Double(origin.getX() - (radius * mile * Math.sin(angle)), origin.getY() - (radius * mile * Math.cos(angle))); 192 } 187 188 // private static Point2D.Double radial(Feature feature, Snode centre, double radius, double angle) { 189 // Point2D origin = Renderer.context.getPoint(centre); 190 // return new Point2D.Double(origin.getX() - (radius * Renderer.context.mile(feature) * Math.sin(angle)), origin.getY() - (radius * Renderer.context.mile(feature) * Math.cos(angle))); 191 // } 193 192 /* 194 193 void renderFlare(Item_t *item) {
Note:
See TracChangeset
for help on using the changeset viewer.