Ticket #1586: MapPaintVisitor.java.patch
| File MapPaintVisitor.java.patch, 2.1 KB (added by , 18 years ago) |
|---|
-
src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
13 13 import java.awt.geom.GeneralPath; 14 14 import java.util.Collection; 15 15 import java.util.LinkedList; 16 import java.util.Locale; 16 17 17 18 import javax.swing.ImageIcon; 18 19 … … 43 44 protected Font orderFont; 44 45 protected ElemStyles styles; 45 46 protected double circum; 47 protected String regionalNameOrder[]; 46 48 47 49 protected boolean isZoomOk(ElemStyle e) { 48 50 if (!zoomLevelDisplay) /* show everything if the user wishes so */ … … 225 227 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 226 228 int w = icon.getIconWidth(), h=icon.getIconHeight(); 227 229 icon.paintIcon ( Main.map.mapView, g, p.x-w/2, p.y-h/2 ); 228 String name = (n.keys==null) ? null : n.keys.get("name");230 String name = getNodeName(n); 229 231 if (name!=null && annotate) 230 232 { 231 233 g.setColor(textColor); … … 241 243 } 242 244 } 243 245 246 protected String getNodeName(Node n) { 247 String name = null; 248 if (n.keys != null) { 249 for (int i = 0; i < regionalNameOrder.length; i++) { 250 name = n.keys.get(regionalNameOrder[i]); 251 if (name != null) break; 252 } 253 } 254 return name; 255 } 256 244 257 private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, boolean dashed) { 245 258 if (col != currentColor || width != currentWidth || dashed != currentDashed) { 246 259 displaySegments(col, width, dashed); … … 321 334 circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter 322 335 styles = MapPaintStyles.getStyles(); 323 336 orderFont = new Font(Main.pref.get("mappaint.font","Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8)); 337 String currentLocale = Locale.getDefault().getLanguage(); 338 regionalNameOrder = (Main.pref.get("mappaint.nameOrder", "name:"+currentLocale+" int_name")+" name").split("\\s"); 324 339 325 340 if(styles.hasAreas()) 326 341 {
