Changeset 5342 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
- Timestamp:
- 2012-07-15T14:59:10+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r5144 r5342 23 23 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 24 24 import org.openstreetmap.josm.gui.mappaint.Range; 25 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 25 26 import org.openstreetmap.josm.gui.mappaint.StyleSource; 26 27 import org.openstreetmap.josm.gui.preferences.SourceEntry; … … 31 32 import org.xml.sax.SAXParseException; 32 33 33 public class XmlStyleSource extends StyleSource { 34 public class XmlStyleSource extends StyleSource implements StyleKeys { 34 35 35 36 protected final HashMap<String, IconPrototype> icons = new HashMap<String, IconPrototype>(); … … 286 287 IconPrototype icon = getNode(osm, (useMinMaxScale ? scale : null), mc); 287 288 if (icon != null) { 288 def.put( "icon-image", icon.icon);289 def.put(ICON_IMAGE, icon.icon); 289 290 if (osm instanceof Node) { 290 291 if (icon.annotate != null) { 291 292 if (icon.annotate) { 292 def.put( "text", Keyword.AUTO);293 def.put(TEXT, Keyword.AUTO); 293 294 } else { 294 def.remove( "text");295 def.remove(TEXT); 295 296 } 296 297 } … … 301 302 get(osm, pretendWayIsClosed || !(osm instanceof Way) || ((Way) osm).isClosed(), p, (useMinMaxScale ? scale : null), mc); 302 303 if (p.line != null) { 303 def.put( "width", new Float(p.line.getWidth()));304 def.putOrClear( "real-width", p.line.realWidth != null ? new Float(p.line.realWidth) : null);305 def.putOrClear( "color", p.line.color);304 def.put(WIDTH, new Float(p.line.getWidth())); 305 def.putOrClear(REAL_WIDTH, p.line.realWidth != null ? new Float(p.line.realWidth) : null); 306 def.putOrClear(COLOR, p.line.color); 306 307 if (p.line.color != null) { 307 308 int alpha = p.line.color.getAlpha(); 308 309 if (alpha != 255) { 309 def.put( "opacity", Utils.color_int2float(alpha));310 def.put(OPACITY, Utils.color_int2float(alpha)); 310 311 } 311 312 } 312 def.putOrClear( "dashes", p.line.getDashed());313 def.putOrClear( "dashes-background-color", p.line.dashedColor);314 } 315 Float refWidth = def.get( "width", null, Float.class);313 def.putOrClear(DASHES, p.line.getDashed()); 314 def.putOrClear(DASHES_BACKGROUND_COLOR, p.line.dashedColor); 315 } 316 Float refWidth = def.get(WIDTH, null, Float.class); 316 317 if (refWidth != null && p.linemods != null) { 317 318 int numOver = 0, numUnder = 0; … … 325 326 String layer = String.format("over_%d", numOver); 326 327 c = mc.getOrCreateCascade(layer); 327 c.put( "object-z-index", new Float(numOver));328 c.put(OBJECT_Z_INDEX, new Float(numOver)); 328 329 ++numOver; 329 330 } else { 330 331 String layer = String.format("under_%d", numUnder); 331 332 c = mc.getOrCreateCascade(layer); 332 c.put( "object-z-index", new Float(-numUnder));333 c.put(OBJECT_Z_INDEX, new Float(-numUnder)); 333 334 ++numUnder; 334 335 } 335 c.put( "width", new Float(mod.getWidth(refWidth)));336 c.putOrClear( "color", mod.color);336 c.put(WIDTH, new Float(mod.getWidth(refWidth))); 337 c.putOrClear(COLOR, mod.color); 337 338 if (mod.color != null) { 338 339 int alpha = mod.color.getAlpha(); 339 340 if (alpha != 255) { 340 c.put( "opacity", Utils.color_int2float(alpha));341 c.put(OPACITY, Utils.color_int2float(alpha)); 341 342 } 342 343 } 343 c.putOrClear( "dashes", mod.getDashed());344 c.putOrClear( "dashes-background-color", mod.dashedColor);344 c.putOrClear(DASHES, mod.getDashed()); 345 c.putOrClear(DASHES_BACKGROUND_COLOR, mod.dashedColor); 345 346 } 346 347 } … … 353 354 } 354 355 if (p.area != null) { 355 def.putOrClear( "fill-color", p.area.color);356 def.putOrClear( "text-position", Keyword.CENTER);357 def.putOrClear( "text", Keyword.AUTO);358 def.remove( "fill-image");356 def.putOrClear(FILL_COLOR, p.area.color); 357 def.putOrClear(TEXT_POSITION, Keyword.CENTER); 358 def.putOrClear(TEXT, Keyword.AUTO); 359 def.remove(FILL_IMAGE); 359 360 } 360 361 }
Note:
See TracChangeset
for help on using the changeset viewer.
