Changeset 3987 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2011-03-13T20:44:57+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java
r3979 r3987 39 39 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle; 40 40 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.HorizontalTextAlignment; 41 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.NodeTextElement; 41 42 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.Symbol; 42 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.NodeTextElement;43 43 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.VerticalTextAlignment; 44 44 import org.openstreetmap.josm.gui.mappaint.TextElement; 45 45 import org.openstreetmap.josm.tools.ImageProvider; 46 import org.openstreetmap.josm.tools.LanguageInfo;47 46 import org.openstreetmap.josm.tools.Pair; 48 47 … … 73 72 74 73 private final boolean leftHandTraffic; 75 76 private final Collection<String> regionalNameOrder;77 74 78 75 private static final double PHI = Math.toRadians(20); … … 104 101 this.segmentNumberSpace = Main.pref.getInteger("mappaint.segmentnumber.space", 40); 105 102 106 String[] names = {"name:" + LanguageInfo.getJOSMLocaleCode(), "name", "int_name", "ref", "operator", "brand", "addr:housenumber"};107 this.regionalNameOrder = Main.pref.getCollection("mappaint.nameOrder", Arrays.asList(names));108 103 this.circum = circum; 109 104 this.leftHandTraffic = leftHandTraffic; … … 118 113 * @param onewayReversed for oneway=-1 and similar 119 114 */ 120 public void drawWay(Way way, Color color, BasicStroke line, BasicStroke dashes, Color dashedColor, 115 public void drawWay(Way way, Color color, BasicStroke line, BasicStroke dashes, Color dashedColor, 121 116 TextElement text, boolean showOrientation, boolean showHeadArrowOnly, 122 117 boolean showOneway, boolean onewayReversed) { … … 253 248 if (text == null) 254 249 return; 255 String name = text.getString(way , this);250 String name = text.getString(way); 256 251 if (name == null || name.equals("")) 257 252 return; … … 292 287 293 288 if (p1[0] < p2[0] && 294 p1[2] < Math.PI/2 &&295 p1[2] > -Math.PI/2) {289 p1[2] < Math.PI/2 && 290 p1[2] > -Math.PI/2) { 296 291 angleOffset = 0; 297 292 offsetSign = 1; … … 347 342 } 348 343 return new double[] {poly.xpoints[i-1]+(totalLen - curLen)/segLen*dx, 349 350 344 poly.ypoints[i-1]+(totalLen - curLen)/segLen*dy, 345 Math.atan2(dy, dx)}; 351 346 } 352 347 return null; … … 495 490 return; 496 491 497 String s = text.textKey == null ? getNodeName(n) : n.get(text.textKey); 498 if (s == null) 499 return; 492 /* 493 * abort if we can't compose the label to be rendered 494 */ 495 if (text.labelCompositionStrategy == null) return; 496 String s = text.labelCompositionStrategy.compose(n); 497 if (s == null) return; 500 498 501 499 Font defaultFont = g.getFont(); … … 598 596 599 597 if (text != null && isShowNames()) { 600 String name = text.textKey == null ? getAreaName(osm) : osm.get(text.textKey); 601 if (name == null) 602 return; 598 /* 599 * abort if we can't compose the label to be rendered 600 */ 601 if (text.labelCompositionStrategy == null) return; 602 String name = text.labelCompositionStrategy.compose(osm); 603 if (name == null) return; 603 604 604 605 Rectangle pb = polygon.getBounds(); … … 931 932 } 932 933 933 //TODO Not a good place for this method934 public String getNodeName(Node n) {935 String name = null;936 if (n.hasKeys()) {937 for (String rn : regionalNameOrder) {938 name = n.get(rn);939 if (name != null) {940 break;941 }942 }943 }944 return name;945 }946 947 //TODO Not a good place for this method948 public String getAreaName(OsmPrimitive w) {949 String name = null;950 if (w.hasKeys()) {951 for (String rn : regionalNameOrder) {952 name = w.get(rn);953 if (name != null) {954 break;955 }956 }957 }958 return name;959 }960 961 934 public boolean isInactive() { 962 935 return inactive;
Note:
See TracChangeset
for help on using the changeset viewer.