Ticket #1586: regionalNames.patch
File regionalNames.patch, 2.0 KB (added by , 17 years ago) |
---|
-
src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
48 48 protected Font orderFont; 49 49 protected ElemStyles styles; 50 50 protected double circum; 51 protected String regionalNameOrder[]; 51 52 52 53 protected boolean isZoomOk(ElemStyle e) { 53 54 if (!zoomLevelDisplay) /* show everything if the user wishes so */ … … 230 231 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 231 232 int w = icon.getIconWidth(), h=icon.getIconHeight(); 232 233 icon.paintIcon ( Main.map.mapView, g, p.x-w/2, p.y-h/2 ); 233 String name = (n.keys==null) ? null : n.keys.get("name");234 String name = getNodeName(n); 234 235 if (name!=null && annotate) 235 236 { 236 237 g.setColor(textColor); … … 246 247 } 247 248 } 248 249 250 protected String getNodeName(Node n) { 251 String name = null; 252 if (n.keys != null) { 253 for (int i = 0; i < regionalNameOrder.length; i++) { 254 name = n.keys.get(regionalNameOrder[i]); 255 if (name != null) break; 256 } 257 } 258 return name; 259 } 260 249 261 private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, boolean dashed) { 250 262 if (col != currentColor || width != currentWidth || dashed != currentDashed) { 251 263 displaySegments(col, width, dashed); … … 326 338 circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter 327 339 styles = MapPaintStyles.getStyles(); 328 340 orderFont = new Font(Main.pref.get("mappaint.font","Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8)); 341 regionalNameOrder = (Main.pref.get("mappaint.nameOrder", "name:en name:de int_name")+" name").split("\\s"); 329 342 330 343 if(styles.hasAreas()) 331 344 {