Changeset 29657 in osm for applications/editors/josm/plugins/opendata/src/org
- Timestamp:
- 2013-06-13T02:20:32+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java
r29107 r29657 19 19 import static org.openstreetmap.josm.tools.I18n.marktr; 20 20 21 import java.awt.Image; 21 22 import java.awt.Toolkit; 22 23 import java.awt.event.KeyEvent; … … 28 29 import java.util.Map; 29 30 31 import javax.swing.ImageIcon; 30 32 import javax.swing.JMenu; 31 33 import javax.swing.JMenuItem; … … 129 131 if ((endMenu = catMenus.get(cat)) == null) { 130 132 catMenus.put(cat, endMenu = new JMenu(cat.getName())); 133 setMenuItemIcon(cat.getIcon(), endMenu); 131 134 moduleMenu.add(endMenu); 132 135 } … … 139 142 handlerName = handler.getClass().getName(); 140 143 } 144 JMenuItem handlerItem = null; 141 145 if (handler.getDataURL() != null) { 142 146 handlerItem = endMenu.add(new DownloadDataAction(handlerName, handler.getDataURL())); 143 147 } else if (handler.getDataURLs() != null) { 144 148 JMenu handlerMenu = new JMenu(handlerName); … … 151 155 if (item != null) { 152 156 MenuScroller.setScrollerFor(handlerMenu, (screenHeight / item.getPreferredSize().height)-3); 153 endMenu.add(handlerMenu); 157 handlerItem = endMenu.add(handlerMenu); 154 158 } 159 } 160 if (handlerItem != null) { 161 setMenuItemIcon(handler.getMenuIcon(), handlerItem); 155 162 } 156 163 } … … 164 171 /*JMenuItem itemIcon =*/ MainMenu.add(menu, new OpenPreferencesActions()); 165 172 //MenuScroller.setScrollerFor(menu, screenHeight / itemIcon.getPreferredSize().height); 173 } 174 175 private void setMenuItemIcon(ImageIcon icon, JMenuItem menuItem) { 176 if (icon != null) { 177 if (icon.getIconHeight() != 16 || icon.getIconWidth() != 16) { 178 icon = new ImageIcon(icon.getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT)); 179 } 180 menuItem.setIcon(icon); 181 } 166 182 } 167 183 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/AbstractDataSetHandler.java
r28696 r29657 23 23 import java.util.List; 24 24 import java.util.regex.Pattern; 25 26 import javax.swing.ImageIcon; 25 27 26 28 import org.openstreetmap.josm.actions.JosmAction; … … 44 46 import org.openstreetmap.josm.plugins.opendata.core.licenses.License; 45 47 import org.openstreetmap.josm.plugins.opendata.core.util.NamesFrUtils; 48 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 46 49 import org.openstreetmap.josm.tools.Pair; 47 50 … … 85 88 private String sourceDate; 86 89 private File associatedFile; 90 private ImageIcon menuIcon; 87 91 88 92 public AbstractDataSetHandler() { … … 397 401 fileNameWithoutExtension+"."+MAPCSS_EXT); 398 402 } 399 403 404 public final ImageIcon getMenuIcon() { 405 return menuIcon; 406 } 407 408 public final void setMenuIcon(ImageIcon icon) { 409 this.menuIcon = icon; 410 } 411 412 public final void setMenuIcon(String iconName) { 413 setMenuIcon(OdUtils.getImageIcon(iconName)); 414 } 415 400 416 public final void setAssociatedFile(File associatedFile) { 401 417 this.associatedFile = associatedFile; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/SimpleDataSetHandler.java
r28113 r29657 16 16 package org.openstreetmap.josm.plugins.opendata.core.datasets; 17 17 18 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.NODE; 19 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.RELATION; 20 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.WAY; 21 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.NODE_RELATION; 22 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.RELATION_WAY; 23 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.WAY_NODE; 24 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.WAY_RELATION; 25 18 26 import java.util.ArrayList; 19 27 import java.util.Collection; … … 24 32 import org.openstreetmap.josm.data.osm.Tag; 25 33 import org.openstreetmap.josm.data.projection.Projection; 34 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 26 35 import org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi; 27 28 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.*;29 import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.*;30 36 31 37 public abstract class SimpleDataSetHandler extends AbstractDataSetHandler { … … 45 51 addRelevantTag(relevantTag); 46 52 this.relevantUnion = false; 53 Tag tag; 54 String[] kv = relevantTag.split("="); 55 if (kv != null && kv.length == 2) { 56 tag = new Tag(kv[0], kv[1]); 57 } else { 58 tag = new Tag(relevantTag); 59 } 60 setMenuIcon(MapPaintStyles.getNodeIcon(tag)); 47 61 } 48 62
Note:
See TracChangeset
for help on using the changeset viewer.