Ignore:
Timestamp:
2013-06-13T02:20:32+02:00 (11 years ago)
Author:
donvip
Message:

[josm_opendata] update Toulouse module + menu icons

Location:
applications/editors/josm/plugins/opendata
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseConstants.java

    r29653 r29657  
    5151   
    5252    /**
    53      * Categories: TODO: icons
     53     * Categories
    5454     */
    55     public static final DataSetCategory CAT_ASSOCIATIONS = new DataSetCategory("Associations", "");
    56     public static final DataSetCategory CAT_CITOYENNETE = new DataSetCategory("Citoyenneté", "");
    57     public static final DataSetCategory CAT_CULTURE = new DataSetCategory("Culture", "");
    58     public static final DataSetCategory CAT_ENFANCE = new DataSetCategory("Enfance", "");
    59     public static final DataSetCategory CAT_ENVIRONNEMENT = new DataSetCategory("Environnement", "");
    60     public static final DataSetCategory CAT_PATRIMOINE = new DataSetCategory("Patrimoine", "");
    61     public static final DataSetCategory CAT_SERVICES = new DataSetCategory("Services", "");
    62     public static final DataSetCategory CAT_SPORT = new DataSetCategory("Sport", "");
    63     public static final DataSetCategory CAT_TOPOGRAPHIE = new DataSetCategory("Topographie", "");
    64     public static final DataSetCategory CAT_TRANSPORT = new DataSetCategory("Transport", "");
    65     public static final DataSetCategory CAT_URBANISME = new DataSetCategory("Urbanisme", "");
     55    public static final DataSetCategory CAT_ASSOCIATIONS = new DataSetCategory("Associations", "styles/standard/people.png");
     56    public static final DataSetCategory CAT_CITOYENNETE = new DataSetCategory("Citoyenneté", "presets/townhall.png");
     57    public static final DataSetCategory CAT_CULTURE = new DataSetCategory("Culture", "presets/arts_centre.png");
     58    public static final DataSetCategory CAT_ENFANCE = new DataSetCategory("Enfance", "presets/kindergarten.png");
     59    public static final DataSetCategory CAT_ENVIRONNEMENT = new DataSetCategory("Environnement", "presets/recycling.png");
     60    public static final DataSetCategory CAT_PATRIMOINE = new DataSetCategory("Patrimoine", "presets/ruins.png");
     61    public static final DataSetCategory CAT_SERVICES = new DataSetCategory("Services", "styles/standard/vehicle/services.png");
     62    public static final DataSetCategory CAT_SPORT = new DataSetCategory("Sport", "presets/soccer.png");
     63    public static final DataSetCategory CAT_TOPOGRAPHIE = new DataSetCategory("Topographie", "presets/peak.png");
     64    public static final DataSetCategory CAT_TRANSPORT = new DataSetCategory("Transport", "presets/bus.png");
     65    public static final DataSetCategory CAT_URBANISME = new DataSetCategory("Urbanisme", "presets/places.png");
    6666}
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java

    r29653 r29657  
    5555import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.sport.InstallationSportiveToulouseHandler;
    5656import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.topographie.AltimetrieVoieHandler;
     57import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.AiresPietonnesHandler;
    5758import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.ChantiersLineairesHandler;
    5859import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.ChantiersPonctuelsHandler;
     
    116117        handlers.add(StationsAutoPartageHandler.class);
    117118        handlers.add(MarchesPleinVentHandler.class);
     119        handlers.add(AiresPietonnesHandler.class);
    118120    }
    119121   
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/QuartiersHandler.java

    r28554 r29657  
    2626        setWikiPage("Quartiers de proximité");
    2727        setCategory(CAT_CITOYENNETE);
     28        setMenuIcon("presets/boundaries.png");
    2829    }
    2930
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/SecteursHandler.java

    r28554 r29657  
    2626        setWikiPage("Secteurs de proximité");
    2727        setCategory(CAT_CITOYENNETE);
     28        setMenuIcon("presets/boundaries.png");
    2829    }
    2930
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/HorodateurHandler.java

    r28554 r29657  
    3030        setWikiPage("Horodateurs");
    3131        setCategory(CAT_TRANSPORT);
     32        setMenuIcon("presets/vending_machine.png");
    3233    }
    3334
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/MetroStationHandler.java

    r28554 r29657  
    2626        setName("Stations de métro");
    2727        setCategory(CAT_TRANSPORT);
     28        setMenuIcon("styles/standard/transport/railway_station.png");
    2829    }
    2930
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/PMRHandler.java

    r29493 r29657  
    2626        setWikiPage("PMR");
    2727        setCategory(CAT_TRANSPORT);
     28        setMenuIcon("styles/standard/vehicle/parking/handicapped.png");
    2829    }
    2930
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/TramwayStationHandler.java

    r28554 r29657  
    2626        setName("Stations de tramway");
    2727        setCategory(CAT_TRANSPORT);
     28        setMenuIcon("styles/standard/transport/railway_station.png");
    2829    }
    2930
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/CommuneHandler.java

    r28554 r29657  
    2626        setName("Communes");
    2727        setCategory(CAT_URBANISME);
     28        setMenuIcon("presets/boundaries.png");
    2829    }
    2930
  • applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/VoirieHandler.java

    r28554 r29657  
    3939        setName("Filaire de voirie");
    4040        setCategory(CAT_URBANISME);
     41        setMenuIcon("presets/way_secondary.png");
    4142    }
    4243   
    43     protected VoirieHandler(int portalId, String streetField, String relevantKey) {
    44         super(portalId, relevantKey);
     44    protected VoirieHandler(int portalId, String streetField, String relevantTag) {
     45        super(portalId, relevantTag);
    4546        this.streetField = streetField;
    4647        map.put("motorway", Arrays.asList(new String[] {"A6", "AUTOROUTE "}));
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java

    r29107 r29657  
    1919import static org.openstreetmap.josm.tools.I18n.marktr;
    2020
     21import java.awt.Image;
    2122import java.awt.Toolkit;
    2223import java.awt.event.KeyEvent;
     
    2829import java.util.Map;
    2930
     31import javax.swing.ImageIcon;
    3032import javax.swing.JMenu;
    3133import javax.swing.JMenuItem;
     
    129131                                        if ((endMenu = catMenus.get(cat)) == null) {
    130132                                                catMenus.put(cat, endMenu = new JMenu(cat.getName()));
     133                                                setMenuItemIcon(cat.getIcon(), endMenu);
    131134                                                moduleMenu.add(endMenu);
    132135                                        }
     
    139142                                        handlerName = handler.getClass().getName();
    140143                                }
     144                                JMenuItem handlerItem = null;
    141145                                if (handler.getDataURL() != null) {
    142                                         endMenu.add(new DownloadDataAction(handlerName, handler.getDataURL()));
     146                                    handlerItem = endMenu.add(new DownloadDataAction(handlerName, handler.getDataURL()));
    143147                                } else if (handler.getDataURLs() != null) {
    144148                                        JMenu handlerMenu = new JMenu(handlerName);
     
    151155                                        if (item != null) {
    152156                                                MenuScroller.setScrollerFor(handlerMenu, (screenHeight / item.getPreferredSize().height)-3);
    153                                                 endMenu.add(handlerMenu);
     157                                                handlerItem = endMenu.add(handlerMenu);
    154158                                        }
     159                                }
     160                                if (handlerItem != null) {
     161                                    setMenuItemIcon(handler.getMenuIcon(), handlerItem);
    155162                                }
    156163                        }
     
    164171        /*JMenuItem itemIcon =*/ MainMenu.add(menu, new OpenPreferencesActions());
    165172        //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        }
    166182        }
    167183
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/AbstractDataSetHandler.java

    r28696 r29657  
    2323import java.util.List;
    2424import java.util.regex.Pattern;
     25
     26import javax.swing.ImageIcon;
    2527
    2628import org.openstreetmap.josm.actions.JosmAction;
     
    4446import org.openstreetmap.josm.plugins.opendata.core.licenses.License;
    4547import org.openstreetmap.josm.plugins.opendata.core.util.NamesFrUtils;
     48import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils;
    4649import org.openstreetmap.josm.tools.Pair;
    4750
     
    8588        private String sourceDate;
    8689        private File associatedFile;
     90        private ImageIcon menuIcon;
    8791
    8892        public AbstractDataSetHandler() {
     
    397401                                fileNameWithoutExtension+"."+MAPCSS_EXT);
    398402        }
    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
    400416        public final void setAssociatedFile(File associatedFile) {
    401417                this.associatedFile = associatedFile;
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/SimpleDataSetHandler.java

    r28113 r29657  
    1616package org.openstreetmap.josm.plugins.opendata.core.datasets;
    1717
     18import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.NODE;
     19import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.RELATION;
     20import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaQueryType.WAY;
     21import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.NODE_RELATION;
     22import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.RELATION_WAY;
     23import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.WAY_NODE;
     24import static org.openstreetmap.josm.plugins.opendata.core.io.OverpassApi.OaRecurseType.WAY_RELATION;
     25
    1826import java.util.ArrayList;
    1927import java.util.Collection;
     
    2432import org.openstreetmap.josm.data.osm.Tag;
    2533import org.openstreetmap.josm.data.projection.Projection;
     34import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    2635import 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.*;
    3036
    3137public abstract class SimpleDataSetHandler extends AbstractDataSetHandler {
     
    4551                addRelevantTag(relevantTag);
    4652                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));
    4761        }
    4862       
Note: See TracChangeset for help on using the changeset viewer.