Changeset 8097 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
- Timestamp:
- 2015-02-22T14:19:20+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r8085 r8097 102 102 } 103 103 104 public static ImageIcon getIcon(IconReference ref, int width, int height) { 104 /** 105 * Image provider for icon. Note that this is a provider only. A @link{ImageProvider#get()} call may still 106 * fail! 107 * 108 * @param ref reference to the requested icon 109 * @param test if <code>true</code> than the icon is request is tested 110 * @return image provider for icon (can be <code>null</code> when <code>test</code> is <code>true</code>). 111 * @since 8097 112 * @see #getIcon(IconReference, int,int) 113 */ 114 public static ImageProvider getIconProvider(IconReference ref, boolean test) { 105 115 final String namespace = ref.source.getPrefName(); 106 Image Iconi = new ImageProvider(ref.iconName)116 ImageProvider i = new ImageProvider(ref.iconName) 107 117 .setDirs(getIconSourceDirs(ref.source)) 108 118 .setId("mappaint."+namespace) 109 119 .setArchive(ref.source.zipIcons) 110 120 .setInArchiveDir(ref.source.getZipEntryDirName()) 111 .setWidth(width) 112 .setHeight(height) 113 .setOptional(true).get(); 121 .setOptional(true); 122 if (test && i.get() == null) { 123 Main.warn("Mappaint style \""+namespace+"\" ("+ref.source.getDisplayString()+") icon \"" + ref.iconName + "\" not found."); 124 return null; 125 } 126 return i; 127 } 128 129 /** 130 * Return scaled icon. 131 * 132 * @param ref reference to the requested icon 133 * @param width icon width or -1 for autoscale 134 * @param height icon height or -1 for autoscale 135 * @return image icon or <code>null</code>. 136 * @see #getIconProvider(IconReference, boolean) 137 */ 138 public static ImageIcon getIcon(IconReference ref, int width, int height) { 139 final String namespace = ref.source.getPrefName(); 140 ImageIcon i = getIconProvider(ref, false).setWidth(width).setHeight(height).get(); 114 141 if (i == null) { 115 142 Main.warn("Mappaint style \""+namespace+"\" ("+ref.source.getDisplayString()+") icon \"" + ref.iconName + "\" not found.");
Note:
See TracChangeset
for help on using the changeset viewer.
