Changeset 26917 in osm


Ignore:
Timestamp:
2011-10-21T19:34:23+02:00 (13 years ago)
Author:
donvip
Message:

Continued work on a new JOSM plugin: tag2link

Location:
applications/editors/josm/plugins/tag2link
Files:
21 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tag2link/README

    r26912 r26917  
    1010
    1111See http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Tag2Link
    12 
    13 The icon has been created by TODO
    1412 
  • applications/editors/josm/plugins/tag2link/build.xml

    r26912 r26917  
    2828**
    2929-->
    30 <project name="imagery-xml-bounds" default="dist" basedir=".">
     30<project name="tag2link" default="dist" basedir=".">
    3131    <!-- enter the SVN commit message -->
    3232    <property name="commit.message" value="Commit message"/>
     
    102102                <attribute name="fr_Plugin-Description" value="TODO"/>
    103103                <attribute name="Plugin-Early" value="false"/>
    104                 <attribute name="Plugin-Icon" value="images/tag2link_24.png"/>
     104                <attribute name="Plugin-Icon" value="images/tag2linkv2_24x24.png"/>
    105105                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Tag2Link"/>
    106106                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
  • applications/editors/josm/plugins/tag2link/resources/tag2link_sources.xml

    r26913 r26917  
    5151       <rule>
    5252           <condition k="admin_level" v="8"/>
    53            <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{3})"/>
    54            <link name="View {name} municipality sheet" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/fichecommunale.asp?codedep={v.1}&amp;codecom={v.2}" />
     53           <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{3})" id="ref"/>
     54           <link name="View {name} municipality sheet" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/fichecommunale.asp?codedep={ref.v.1}&amp;codecom={ref.v.2}" />
    5555       </rule>
    5656       <rule>
    5757           <condition k="political_division" v="FR:canton"/>
    58            <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{2})"/>
    59            <link name="View {name} map of municipalities" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_comcan.asp?codecan={v}" />
    60            <link name="View {name} list of municipalities" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/comcan.asp?codedep={v.1}&amp;codecan={v.2}" />
     58           <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{2})" id="ref"/>
     59           <link name="View {name} map of municipalities" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_comcan.asp?codecan={ref.v}" />
     60           <link name="View {name} list of municipalities" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/comcan.asp?codedep={ref.v.1}&amp;codecan={ref.v.2}" />
    6161       </rule>
    6262       <rule>
    6363           <condition k="admin_level" v="7"/>
    64            <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{1})"/>
    65            <link name="View {name} map of cantons" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_canarr.asp?codearr={v}" />
    66            <link name="View {name} list of cantons" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/canarr.asp?codedep={v.1}&amp;codearr={v.2}" />
     64           <condition k="ref:INSEE" v="(\p{Digit}{2})(\p{Digit}{1})" id="ref"/>
     65           <link name="View {name} map of cantons" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_canarr.asp?codearr={ref.v}" />
     66           <link name="View {name} list of cantons" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/canarr.asp?codedep={ref.v.1}&amp;codearr={ref.v.2}" />
    6767       </rule>
    6868       <rule>
    6969           <condition k="admin_level" v="6"/>
    70            <condition k="ref:INSEE" v="\p{Digit}{2}"/>
    71            <link name="View {name} map of arrondissements" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_arrdep.asp?codedep={v}" />
    72            <link name="View {name} list of arrondissements" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/arrdep.asp?codedep={v}" />
     70           <condition k="ref:INSEE" v="\p{Digit}{2}" id="ref"/>
     71           <link name="View {name} map of arrondissements" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_arrdep.asp?codedep={ref.v}" />
     72           <link name="View {name} list of arrondissements" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/arrdep.asp?codedep={ref.v}" />
    7373       </rule>
    7474       <rule>
    7575           <condition k="admin_level" v="4"/>
    76            <condition k="ref:INSEE" v="\p{Digit}{2}"/>
    77            <link name="View {name} map of departments" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_depreg.asp?codereg={v}" />
    78            <link name="View {name} list of departments" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/depreg.asp?codereg={v}" />
     76           <condition k="ref:INSEE" v="\p{Digit}{2}" id="ref"/>
     77           <link name="View {name} map of departments" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/carte_depreg.asp?codereg={ref.v}" />
     78           <link name="View {name} list of departments" href="http://www.insee.fr/fr/methodes/nomenclatures/cog/depreg.asp?codereg={ref.v}" />
    7979       </rule>
    8080       <rule>
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkConstants.java

    r26912 r26917  
    1616package org.openstreetmap.josm.plugins.tag2link;
    1717
    18 import javax.swing.ImageIcon;
    19 
    20 import org.openstreetmap.josm.tools.ImageProvider;
    21 
    2218/**
    23  * Main constants of JOSM Imagery XML Bounds plugin.
     19 * Main constants of JOSM tag2link plugin.
    2420 * @author Don-vip
    2521 *
     
    3026         * XML Schema
    3127         */
    32         public static final String XML_LOCATION = "resource://data/tag2link_sources.xml";
     28        public static final String XML_LOCATION = "/resources/tag2link_sources.xml";
    3329       
    34     /**
    35      * XML tags
    36      */
    37     // TODO
    38 
    3930        /**
    4031         * File encoding.
     
    4536         * Plugin icons.
    4637         */
    47         public static ImageIcon ICON_16 = ImageProvider.get("tag2link_16.png");
    48         public static ImageIcon ICON_24 = ImageProvider.get("tag2link_24.png");
    49     public static ImageIcon ICON_48 = ImageProvider.get("tag2link_48.png");
     38        public static String ICON_16 = "tag2linkv2_16x16.png";
     39        public static String ICON_24 = "tag2linkv2_24x24.png";
     40    public static String ICON_48 = "tag2linkv2_48x48.png";
    5041}
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java

    r26912 r26917  
    1616package org.openstreetmap.josm.plugins.tag2link;
    1717
     18import org.openstreetmap.josm.gui.MapFrame;
     19import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    1820import org.openstreetmap.josm.plugins.Plugin;
    1921import org.openstreetmap.josm.plugins.PluginInformation;
     22import org.openstreetmap.josm.plugins.tag2link.listeners.MembershipPopupListener;
     23import org.openstreetmap.josm.plugins.tag2link.listeners.PropertyPopupListener;
     24import org.openstreetmap.josm.plugins.tag2link.listeners.RelationPopupListener;
     25import org.openstreetmap.josm.plugins.tag2link.listeners.SelectionPopupListener;
    2026
    2127/**
     
    2834public class Tag2LinkPlugin extends Plugin {
    2935
     36    private Tag2LinkPreferenceSetting preferenceSetting;
     37   
    3038        /**
    3139         * Initializes the plugin.
     
    3442        public Tag2LinkPlugin(PluginInformation info) {
    3543                super(info);
     44                this.preferenceSetting = new Tag2LinkPreferenceSetting();
     45                Tag2LinkRuleChecker.init();
    3646        }
     47
     48    /* (non-Javadoc)
     49     * @see org.openstreetmap.josm.plugins.Plugin#getPreferenceSetting()
     50     */
     51    @Override
     52    public PreferenceSetting getPreferenceSetting() {
     53        return this.preferenceSetting;
     54    }
     55   
     56    /* (non-Javadoc)
     57     * @see org.openstreetmap.josm.plugins.Plugin#mapFrameInitialized(org.openstreetmap.josm.gui.MapFrame, org.openstreetmap.josm.gui.MapFrame)
     58     */
     59    @Override
     60    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
     61        if (newFrame != null) {
     62            // Initialize dialogs listeners only after the main frame is created
     63            newFrame.selectionListDialog.addPopupMenuListener(new SelectionPopupListener(newFrame));
     64            newFrame.propertiesDialog.addMembershipPopupMenuListener(new MembershipPopupListener(newFrame));
     65            newFrame.propertiesDialog.addPropertyPopupMenuListener(new PropertyPopupListener(newFrame));
     66            newFrame.relationListDialog.addPopupMenuListener(new RelationPopupListener(newFrame));
     67        }
     68    }
    3769}
Note: See TracChangeset for help on using the changeset viewer.