Changeset 16922 in josm
- Timestamp:
- 2020-08-23T23:43:20+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r16913 r16922 7 7 import java.awt.Component; 8 8 import java.awt.Composite; 9 import java.awt.Dimension;10 9 import java.awt.Font; 11 10 import java.awt.FontMetrics; … … 86 85 import org.openstreetmap.josm.tools.Geometry.AreaAndPerimeter; 87 86 import org.openstreetmap.josm.tools.HiDPISupport; 88 import org.openstreetmap.josm.tools.ImageProvider;89 87 import org.openstreetmap.josm.tools.JosmRuntimeException; 90 88 import org.openstreetmap.josm.tools.Logging; … … 797 795 } 798 796 799 drawIcon(p , img, disabled, selected, member, theta, (g, r) -> {797 drawIcon(p.getInViewX(), p.getInViewY(), img, disabled, selected, member, theta, (g, r) -> { 800 798 Color color = getSelectionHintColor(disabled, selected); 801 799 g.setColor(color); … … 825 823 } 826 824 MapViewPoint p = placement.getPoint(); 827 drawIcon(p , img, disabled, selected, member, theta + placement.getRotation(), (g, r) -> {825 drawIcon(p.getInViewX(), p.getInViewY(), img, disabled, selected, member, theta + placement.getRotation(), (g, r) -> { 828 826 if (useStrokes) { 829 827 g.setStroke(new BasicStroke(2)); … … 838 836 } 839 837 840 private void drawIcon( MapViewPoint p, MapImage img, boolean disabled, boolean selected, boolean member, double theta,838 private void drawIcon(final double x, final double y, MapImage img, boolean disabled, boolean selected, boolean member, double theta, 841 839 BiConsumer<Graphics2D, Rectangle2D> selectionDrawer) { 842 840 float alpha = img.getAlphaFloat(); … … 847 845 } 848 846 849 double x = Math.round(p.getInViewX()); 850 double y = Math.round(p.getInViewY()); 851 temporaryGraphics.translate(x, y); 847 temporaryGraphics.translate(Math.round(x), Math.round(y)); 852 848 temporaryGraphics.rotate(theta); 853 849 int drawX = -img.getWidth() / 2 + img.offsetX; … … 955 951 g.fill(new RoundRectangle2D.Double(p.getX()-r, p.getY()-r, s, s, r, r)); 956 952 s -= step; 957 }958 }959 960 /**961 * Draws a restriction.962 * @param img symbol image963 * @param pVia "via" node964 * @param vx X offset965 * @param vy Y offset966 * @param angle the rotated angle, in degree, clockwise967 * @param selected if true, draws a selection rectangle968 * @since 13676969 */970 public void drawRestriction(Image img, Point pVia, double vx, double vy, double angle, boolean selected) {971 // rotate image with direction last node in from to, and scale down image to 16*16 pixels972 Image smallImg = ImageProvider.createRotatedImage(img, angle, new Dimension(16, 16));973 int w = smallImg.getWidth(null), h = smallImg.getHeight(null);974 g.drawImage(smallImg, (int) (pVia.x+vx)-w/2, (int) (pVia.y+vy)-h/2, nc);975 976 if (selected) {977 g.setColor(isInactiveMode ? inactiveColor : relationSelectedColor);978 g.drawRect((int) (pVia.x+vx)-w/2-2, (int) (pVia.y+vy)-h/2-2, w+4, h+4);979 953 } 980 954 } … … 1150 1124 } 1151 1125 1152 drawRestriction(icon.getImage(disabled), 1153 pVia, vx+vx2, vy+vy2, iconAngle, r.isSelected()); 1126 drawIcon( 1127 pVia.x + vx + vx2, 1128 pVia.y + vy + vy2, 1129 icon, disabled, false, false, Math.toRadians(iconAngle), (graphics2D, rectangle2D) -> { 1130 }); 1154 1131 } 1155 1132
Note:
See TracChangeset
for help on using the changeset viewer.