- Timestamp:
- 2011-01-28T18:58:56+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r3825 r3827 23 23 import org.openstreetmap.josm.tools.ImageProvider; 24 24 import org.openstreetmap.josm.tools.XmlObjectParser; 25 import org.openstreetmap.josm.tools.Utils; 25 26 import org.xml.sax.SAXException; 26 27 import org.xml.sax.SAXParseException; … … 30 31 private static ElemStyles styles = new ElemStyles(); 31 32 private static Collection<String> iconDirs; 32 private static File zipIcons;33 33 34 34 public static ElemStyles getStyles() … … 36 36 return styles; 37 37 } 38 39 public static class IconReference { 38 40 39 public static ImageIcon getIcon(String name, String styleName) 41 public String iconName; 42 public XmlStyleSource source; 43 44 public IconReference(String iconName, XmlStyleSource source) { 45 this.iconName = iconName; 46 this.source = source; 47 } 48 } 49 50 public static ImageIcon getIcon(IconReference ref) 40 51 { 52 String styleName = ref.source.getPrefName(); 41 53 List<String> dirs = new LinkedList<String>(); 42 54 for(String fileset : iconDirs) … … 54 66 } 55 67 } 56 ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name,zipIcons);68 ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, ref.iconName, ref.source.zipIcons); 57 69 if(i == null) 58 70 { 59 System.out.println("Mappaint style \""+styleName+"\" icon \"" + name + "\" not found.");71 System.out.println("Mappaint style \""+styleName+"\" icon \"" + ref.iconName + "\" not found."); 60 72 i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, "misc/no_icon.png"); 61 73 } … … 86 98 if(zip != null) 87 99 { 88 zipIcons = in.getFile();100 style.zipIcons = in.getFile(); 89 101 ins = new InputStreamReader(zip); 90 102 } else { … … 110 122 styles.add(style); 111 123 } 112 iconDirs = null;113 zipIcons = null;114 124 } 115 125 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/IconPrototype.java
r3824 r3827 2 2 package org.openstreetmap.josm.gui.mappaint.xml; 3 3 4 import javax.swing.ImageIcon;5 6 4 import org.openstreetmap.josm.gui.mappaint.IconElemStyle; 5 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 6 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 7 7 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle; 8 8 import org.openstreetmap.josm.gui.mappaint.SimpleNodeElemStyle; … … 10 10 public class IconPrototype extends Prototype { 11 11 12 public I mageIconicon;12 public IconReference icon; 13 13 public boolean annotate; 14 14 … … 33 33 return SimpleNodeElemStyle.INSTANCE; 34 34 } else { 35 IconElemStyle i = new IconElemStyle(minScale, maxScale, icon);35 IconElemStyle i = new IconElemStyle(minScale, maxScale, MapPaintStyles.getIcon(icon)); 36 36 i.annotate = annotate; 37 37 return i; -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r3825 r3827 2 2 package org.openstreetmap.josm.gui.mappaint.xml; 3 3 4 import java.io.File; 4 5 import java.util.Collection; 5 6 import java.util.Collections; … … 28 29 29 30 public boolean hasError = false; 31 public File zipIcons; 30 32 31 33 public XmlStyleSource(String url, String name, String shortdescription) { … … 200 202 } 201 203 } 202 203 /**204 * the name / identifier that should be used to save custom color values205 * and similar stuff to the preference file206 * @return the identifier; never null. Usually the result is "standard"207 */208 public String getPrefName() {209 return name == null ? "standard" : name;210 }211 204 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java
r3825 r3827 6 6 import java.util.LinkedList; 7 7 8 import javax.swing.ImageIcon;9 10 8 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles ;9 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 12 10 import org.openstreetmap.josm.tools.ColorHelper; 13 11 import org.xml.sax.Attributes; … … 211 209 { 212 210 if (atts.getQName(count).equals("src")) { 213 I mageIcon icon = MapPaintStyles.getIcon(atts.getValue(count), style.getPrefName());211 IconReference icon = new IconReference(atts.getValue(count), style); 214 212 hadIcon = (icon != null); 215 213 rule.icon.icon = icon; -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
r3825 r3827 96 96 } 97 97 98 /** 99 * the name / identifier that should be used to save custom color values 100 * and similar stuff to the preference file 101 * @return the identifier; never null. Usually the result is "standard" 102 */ 103 public String getPrefName() { 104 return name == null ? "standard" : name; 105 } 98 106 }
Note:
See TracChangeset
for help on using the changeset viewer.