Ticket #6122: mapcss-concat.patch
| File mapcss-concat.patch, 3.1 KB (added by , 15 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategy.java
108 108 public String compose(OsmPrimitive primitive) { 109 109 if (defaultLabelTag == null) return null; 110 110 if (primitive == null) return null; 111 return primitive.get(defaultLabelTag); 111 112 String res = new String(""); 113 if (defaultLabelTag.indexOf(' ') >= 0) { 114 String tags[] = defaultLabelTag.split(" "); 115 for (String tag : tags) { 116 res += (primitive.get(tag)==null) ? tag : primitive.get(tag); 117 res += ' '; 118 } 119 } else { 120 res = primitive.get(defaultLabelTag); 121 } 122 return res; 112 123 } 113 124 114 125 public String getDefaultLabelTag() { -
src/org/openstreetmap/josm/gui/mappaint/mapcss/Expression.java
72 72 public Float minus(float... args) { 73 73 if (args.length == 0) 74 74 return 0f; 75 if (args.length == 1) { // unary minus75 if (args.length == 1) 76 76 return -args[0]; 77 }78 77 float res = args[0]; 79 78 for (int i=1; i<args.length; ++i) { 80 79 res -= args[i]; … … 167 166 return env.osm.hasKey(key); 168 167 } 169 168 169 public String concat(Object... args) { 170 String res = new String(""); 171 for (Object f : args) { 172 res += f.toString(); 173 } 174 return res; 175 } 176 170 177 public boolean not(boolean b) { 171 178 return !b; 172 179 } … … 285 292 throw new RuntimeException(ex); 286 293 } 287 294 for (Method m : allMethods) { 288 if (!m.getName().equals(name)) 295 if (!m.getName().equals(name)) { 289 296 continue; 297 } 290 298 Class<?>[] expectedParameterTypes = m.getParameterTypes(); 291 299 Object[] convertedArgs = new Object[expectedParameterTypes.length]; 292 300 … … 303 311 } 304 312 convertedArgs[0] = arrayArg; 305 313 } else { 306 if (args.size() != expectedParameterTypes.length) 314 if (args.size() != expectedParameterTypes.length) { 307 315 continue; 316 } 308 317 for (int i=0; i<args.size(); ++i) { 309 318 convertedArgs[i] = Cascade.convertTo(args.get(i).evaluate(env), expectedParameterTypes[i]); 310 319 if (convertedArgs[i] == null)
