Changeset 3865 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2011-02-07T11:42:34+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java
r3862 r3865 2 2 package org.openstreetmap.josm.data.osm.visitor.paint; 3 3 4 import java.awt.AlphaComposite; 4 5 import java.awt.BasicStroke; 5 6 import java.awt.Color; … … 31 32 import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.PolyData; 32 33 import org.openstreetmap.josm.gui.NavigatableComponent; 34 import org.openstreetmap.josm.gui.mappaint.ElemStyle; 33 35 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle; 36 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.Symbol; 34 37 import org.openstreetmap.josm.tools.ImageProvider; 35 38 import org.openstreetmap.josm.tools.LanguageInfo; … … 54 57 55 58 private final Font orderFont; 56 private final int fillAlpha;57 59 private final int virtualNodeSize; 58 60 private final int virtualNodeSpace; … … 89 91 90 92 this.orderFont = new Font(Main.pref.get("mappaint.font", "Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8)); 91 this.fillAlpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fillalpha", 50))));92 93 this.virtualNodeSize = virtual ? Main.pref.getInteger("mappaint.node.virtual-size", 8) / 2 : 0; 93 94 this.virtualNodeSpace = Main.pref.getInteger("mappaint.node.virtual-space", 70); … … 187 188 } 188 189 189 public void drawNodeIcon(Node n, ImageIcon icon, boolean selected, boolean member, String name) {190 public void drawNodeIcon(Node n, ImageIcon icon, float iconAlpha, boolean selected, boolean member, String name) { 190 191 Point p = nc.getPoint(n); 191 192 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 192 193 193 194 int w = icon.getIconWidth(), h=icon.getIconHeight(); 195 if (iconAlpha != 1f) { 196 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, iconAlpha)); 197 } 194 198 icon.paintIcon ( nc, g, p.x-w/2, p.y-h/2 ); 199 g.setPaintMode(); 195 200 if(name != null) { 196 201 if (inactive || n.isDisabled()) { … … 208 213 g.setColor(selected? selectedColor : relationSelectedColor); 209 214 g.drawRect(p.x-w/2-2, p.y-h/2-2, w+4, h+4); 215 } 216 } 217 218 public void drawNodeSymbol(Node n, Symbol s, boolean selected, boolean member, String name) { 219 Point p = nc.getPoint(n); 220 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 221 int radius = (int) (s.size / 2); 222 223 if (s.fillColor != null) { 224 g.setColor(s.fillColor); 225 switch (s.symbol) { 226 case CIRCLE: 227 g.fillOval(p.x - radius, p.y - radius, (int) s.size, (int) s.size); 228 break; 229 case SQUARE: 230 g.fillRect(p.x - radius, p.y - radius, (int) s.size, (int) s.size); 231 break; 232 } 233 } 234 if (s.stroke != null) { 235 g.setStroke(s.stroke); 236 g.setColor(s.strokeColor); 237 switch (s.symbol) { 238 case CIRCLE: 239 g.drawOval(p.x - radius, p.y - radius, (int) s.size - 1, (int) s.size - 1); 240 break; 241 case SQUARE: 242 g.drawRect(p.x - radius, p.y - radius, (int) s.size - 1, (int) s.size - 1); 243 break; 244 } 245 g.setStroke(new BasicStroke()); 210 246 } 211 247 } … … 271 307 TexturePaint texture = new TexturePaint(fillImage, 272 308 new Rectangle(polygon.xpoints[0], polygon.ypoints[0], fillImage.getWidth(), fillImage.getHeight())); 273 274 309 g.setPaint(texture); 310 if (color.getAlpha() != 255) { 311 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ElemStyle.color_int2float(color.getAlpha()))); 312 } 275 313 g.fill(polygon); 314 g.setPaintMode(); 276 315 } 277 316
Note:
See TracChangeset
for help on using the changeset viewer.