Changeset 6174 in josm
- Timestamp:
- 2013-08-22T01:23:38+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/org/openstreetmap/josm/gui/mappaint/MapImage.java ¶
r6148 r6174 150 150 return new MapImageBoxProvider(); 151 151 } 152 153 /** 154 * Returns the really displayed node icon for this {@code MapImage}. 155 * @param disabled {@code} true to request disabled version, {@code false} for the standard version 156 * @return The scaled down version to 16x16 pixels if the image size exceeds it and no size has been explicitely specified 157 * @since 6174 158 */ 159 public Image getDisplayedNodeIcon(boolean disabled) { 160 final int maxSize = 16; 161 final Image image = disabled ? getDisabled() : getImage(); 162 // Scale down large (.svg) images to 16x16 pixels if no size is explicitely specified 163 if ((width == -1 && image.getWidth(null) > maxSize) 164 || (height == -1 && image.getHeight(null) > maxSize)) { 165 return ImageProvider.createBoundedImage(image, maxSize); 166 } else { 167 return image; 168 } 169 } 152 170 153 171 @Override -
TabularUnified trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java ¶
r6148 r6174 140 140 if (mapImage != null) { 141 141 if (includeDeprecatedIcon || mapImage.name == null || !mapImage.name.equals("misc/deprecated.png")) { 142 return new ImageIcon(mapImage.get Image());142 return new ImageIcon(mapImage.getDisplayedNodeIcon(false)); 143 143 } else { 144 144 return null; // Deprecated icon found but not wanted -
TabularUnified trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java ¶
r6172 r6174 20 20 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 21 21 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 22 import org.openstreetmap.josm.tools.ImageProvider;23 22 import org.openstreetmap.josm.tools.Utils; 24 23 … … 235 234 } 236 235 237 private Image getRealNodeIcon(final Image image) {238 final int maxSize = 16;239 // Scale down large (.svg) images to 16x16 pixels if no size is explicitely specified240 if ((mapImage.width == -1 && image.getWidth(null) > maxSize)241 || (mapImage.height == -1 && image.getHeight(null) > maxSize)) {242 return ImageProvider.createBoundedImage(image, maxSize);243 } else {244 return image;245 }246 }247 248 236 @Override 249 237 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, StyledMapRenderer painter, boolean selected, boolean member) { … … 254 242 if (painter.isInactiveMode() || n.isDisabled()) { 255 243 if (disabledNodeIcon == null) { 256 disabledNodeIcon = getRealNodeIcon(mapImage.getDisabled());244 disabledNodeIcon = mapImage.getDisplayedNodeIcon(true); 257 245 } 258 246 nodeIcon = disabledNodeIcon; 259 247 } else { 260 248 if (enabledNodeIcon == null) { 261 enabledNodeIcon = getRealNodeIcon(mapImage.getImage());249 enabledNodeIcon = mapImage.getDisplayedNodeIcon(false); 262 250 } 263 251 nodeIcon = enabledNodeIcon;
Note:
See TracChangeset
for help on using the changeset viewer.