Changeset 4822 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 19.01.2012 19:58:08 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java
r4724 r4822 46 46 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.HorizontalTextAlignment; 47 47 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.VerticalTextAlignment; 48 import org.openstreetmap.josm.gui.mappaint.MapImage; 48 49 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle; 49 50 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.Symbol; … … 505 506 } 506 507 507 public void drawLinePattern(Way way, Image Iconpattern) {508 final int width = pattern.get IconWidth();509 final int height = pattern.get IconHeight();508 public void drawLinePattern(Way way, Image pattern) { 509 final int width = pattern.getWidth(null); 510 final int height = pattern.getHeight(null); 510 511 511 512 Point lastP = null; … … 530 531 531 532 if (dist > 0) { 532 g.drawImage(pattern .getImage(), 0, 0, (int) dist, height,533 g.drawImage(pattern, 0, 0, (int) dist, height, 533 534 width - (int) dist, 0, width, height, null); 534 535 } 535 536 while (dist < segmentLength) { 536 537 if (dist + width > segmentLength) { 537 g.drawImage(pattern .getImage(), (int) dist, 0, (int) segmentLength, height,538 g.drawImage(pattern, (int) dist, 0, (int) segmentLength, height, 538 539 0, 0, (int) segmentLength - (int) dist, height, null); 539 540 } else { 540 pattern.paintIcon(nc, g, (int) dist, 0);541 g.drawImage(pattern, (int) dist, 0, nc); 541 542 } 542 543 dist += width; … … 550 551 } 551 552 552 public void drawNodeIcon(Node n, Image Icon icon, float iconAlpha, boolean selected, boolean member) {553 public void drawNodeIcon(Node n, Image img, float alpha, boolean selected, boolean member) { 553 554 Point p = nc.getPoint(n); 554 555 555 final int w = i con.getIconWidth(), h=icon.getIconHeight();556 final int w = img.getWidth(null), h=img.getHeight(null); 556 557 if(n.isHighlighted()) { 557 558 drawPointHighlight(p, Math.max(w, h)); 558 559 } 559 560 560 if ( iconAlpha != 1f) {561 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, iconAlpha));562 } 563 icon.paintIcon ( nc, g, p.x-w/2, p.y-h/2);561 if (alpha != 1f) { 562 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 563 } 564 g.drawImage(img, p.x-w/2, p.y-h/2, nc); 564 565 g.setPaintMode(); 565 566 if (selected || member) … … 802 803 } 803 804 804 public void drawArea(Way w, Color color, BufferedImage fillImage, float fillImageAlpha, TextElement text) {805 drawArea(w, getPath(w), color, fillImage, fillImageAlpha,text);806 } 807 808 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, BufferedImage fillImage, float fillImageAlpha, TextElement text) {805 public void drawArea(Way w, Color color, MapImage<BufferedImage> fillImage, TextElement text) { 806 drawArea(w, getPath(w), color, fillImage, text); 807 } 808 809 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage<BufferedImage> fillImage, TextElement text) { 809 810 810 811 Shape area = path.createTransformedShape(nc.getAffineTransform()); … … 815 816 g.fill(area); 816 817 } else { 817 TexturePaint texture = new TexturePaint(fillImage ,818 TexturePaint texture = new TexturePaint(fillImage.img, 818 819 // new Rectangle(polygon.xpoints[0], polygon.ypoints[0], fillImage.getWidth(), fillImage.getHeight())); 819 new Rectangle(0, 0, fillImage. getWidth(), fillImage.getHeight()));820 new Rectangle(0, 0, fillImage.img.getWidth(null), fillImage.img.getHeight(null))); 820 821 g.setPaint(texture); 821 if (fillImage Alpha != 1f) {822 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, fillImage Alpha));822 if (fillImage.alpha != 1f) { 823 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, fillImage.alpha)); 823 824 } 824 825 g.fill(area); … … 871 872 } 872 873 873 public void drawArea(Relation r, Color color, BufferedImage fillImage, float fillImageAlpha, TextElement text) {874 public void drawArea(Relation r, Color color, MapImage<BufferedImage> fillImage, TextElement text) { 874 875 Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r); 875 876 if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) { … … 881 882 drawArea(r, p, 882 883 pd.selected ? settings.getRelationSelectedColor(color.getAlpha()) : color, 883 fillImage, fillImageAlpha,text);884 fillImage, text); 884 885 } 885 886 } … … 898 899 } 899 900 900 public void drawRestriction(Image Icon icon, Point pVia, double vx, double vx2, double vy, double vy2, double iconAngle, boolean selected) {901 /* rotate i conwith direction last node in from to */902 Image Icon rotatedIcon = ImageProvider.createRotatedImage(null /*icon2*/, icon, iconAngle);903 904 /* scale down i conto 16*16 pixels */905 Image Icon smallIcon = new ImageIcon(rotatedIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH));906 int w = smallI con.getIconWidth(), h=smallIcon.getIconHeight();907 smallIcon.paintIcon (nc, g, (int)(pVia.x+vx+vx2)-w/2, (int)(pVia.y+vy+vy2)-h/2);901 public void drawRestriction(Image img, Point pVia, double vx, double vx2, double vy, double vy2, double angle, boolean selected) { 902 /* rotate image with direction last node in from to */ 903 Image rotatedImg = ImageProvider.createRotatedImage(null , img, angle); 904 905 /* scale down image to 16*16 pixels */ 906 Image smallImg = new ImageIcon(rotatedImg.getScaledInstance(16 , 16, Image.SCALE_SMOOTH)).getImage(); 907 int w = smallImg.getWidth(null), h=smallImg.getHeight(null); 908 g.drawImage(smallImg, (int)(pVia.x+vx+vx2)-w/2, (int)(pVia.y+vy+vy2)-h/2, nc); 908 909 909 910 if (selected) { … … 913 914 } 914 915 915 public void drawRestriction(Relation r, NodeElemStyleicon) {916 public void drawRestriction(Relation r, MapImage<Image> icon) { 916 917 Way fromWay = null; 917 918 Way toWay = null; … … 1084 1085 } 1085 1086 1086 drawRestriction(inactive || r.isDisabled() ? icon.getDisabled Icon() : icon.icon,1087 drawRestriction(inactive || r.isDisabled() ? icon.getDisabled() : icon.img, 1087 1088 pVia, vx, vx2, vy, vy2, iconAngle, r.isSelected()); 1088 1089 }
Note: See TracChangeset
for help on using the changeset viewer.
