Changeset 19066 in osm for applications/editors/josm


Ignore:
Timestamp:
2009-12-12T18:36:50+01:00 (15 years ago)
Author:
guggis
Message:

'Update to JOSM 2621'

Location:
applications/editors/josm/plugins/routing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routing/build.xml

    r18962 r19066  
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!--
     3** This is the build file for the routing plugin
     4**
     5** Maintaining versions
     6** ====================
     7** see README.template
     8**
     9** Usage
     10** =====
     11** To build it run
     12**
     13**    > ant  dist
     14**
     15** To install the generated plugin locally (in your default plugin directory) run
     16**
     17**    > ant  install
     18**
     19** To build against the core in ../../core, create a correct manifest and deploy to
     20** SVN,
     21**    set the properties commit.message and plugin.main.version
     22** and run
     23**    > ant  publish
     24**
     25**
     26-->
    127<project name="routing" default="dist" basedir=".">
     28
     29        <property name="commit.message" value="Update to JOSM 2621" />
     30        <property name="plugin.main.version" value="2621" />
     31
    232        <!-- Define some properties -->
    3     <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
    4     <property name="plugin.dist.dir"        value="../../dist"/>
    5     <property name="plugin.build.dir"       value="build"/>
    6     <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    7     <property name="jgrapht"                value="lib/jgrapht-jdk1.5.jar"/>
    8     <property name="log4j"                  value="lib/log4j-1.2.15.jar"/>
    9     <property name="ant.build.javac.target" value="1.5"/>
     33        <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
     34        <property name="plugin.dist.dir"        value="../../dist"/>
     35        <property name="plugin.build.dir"       value="build"/>
     36        <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
     37        <property name="jgrapht"                value="lib/jgrapht-jdk1.5.jar"/>
     38        <property name="log4j"                  value="lib/log4j-1.2.15.jar"/>
     39        <property name="ant.build.javac.target" value="1.5"/>
    1040        <!-- Some initializations for several other targets -->
    11     <target name="init">
    12         <mkdir dir="${plugin.build.dir}"/>
    13     </target>
     41        <target name="init">
     42                <mkdir dir="${plugin.build.dir}"/>
     43        </target>
    1444        <!-- Compile sources -->
    15     <target name="compile" depends="init" description="Compile sources">
    16         <echo message="creating ${plugin.jar}"/>
    17         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
    18             <compilerarg value="-Xlint:deprecation"/>
    19             <compilerarg value="-Xlint:unchecked"/>
    20             <classpath>
    21                 <pathelement location="${josm}"/>
    22                 <pathelement location="${jgrapht}"/>
    23                 <pathelement location="${log4j}"/>
    24             </classpath>
    25         </javac>
    26     </target>
     45        <target name="compile" depends="init" description="Compile sources">
     46                <echo message="creating ${plugin.jar}"/>
     47                <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
     48                        <compilerarg value="-Xlint:deprecation"/>
     49                        <compilerarg value="-Xlint:unchecked"/>
     50                        <classpath>
     51                                <pathelement location="${josm}"/>
     52                                <pathelement location="${jgrapht}"/>
     53                                <pathelement location="${log4j}"/>
     54                        </classpath>
     55                </javac>
     56        </target>
    2757        <!-- Generate distribution -->
    28     <target name="dist" depends="compile,revision" description="Generate distribution">
    29         <unjar dest="${plugin.build.dir}" src="${jgrapht}"/>
    30         <unjar dest="${plugin.build.dir}" src="${log4j}"/>
    31         <copy todir="${plugin.build.dir}/">
    32             <fileset dir="resources">
    33                 <include name="*.xml"/>
    34             </fileset>
    35         </copy>
    36         <copy todir="${plugin.build.dir}/images">
    37             <fileset dir="images"/>
    38         </copy>
    39         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    40             <manifest>
    41                 <attribute name="Author" value="Jose Vidal &lt;vidalfree@gmail.com&gt;, Juangui Jordán &lt;juangui@gmail.com&gt;"/>
    42                 <attribute name="Plugin-Class" value="com.innovant.josm.plugin.routing.RoutingPlugin"/>
    43                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    44                 <attribute name="Plugin-Description" value="Provides routing capabilities."/>
    45                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Routing"/>
    46                 <attribute name="Plugin-Mainversion" value="2578"/>
    47                 <attribute name="Plugin-Stage" value="50"/>
    48                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    49             </manifest>
    50         </jar>
    51     </target>
    52     <target name="revision">
    53         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    54             <env key="LANG" value="C"/>
    55             <arg value="info"/>
    56             <arg value="--xml"/>
    57             <arg value="."/>
    58         </exec>
    59         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    60         <delete file="REVISION"/>
    61     </target>
    62     <target name="clean">
    63         <delete dir="${plugin.build.dir}"/>
    64         <delete file="${plugin.jar}"/>
    65     </target>
    66     <target name="install" depends="dist">
    67         <property environment="env"/>
    68         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    69             <and>
    70                 <os family="windows"/>
    71             </and>
    72         </condition>
    73         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    74     </target>
     58        <target name="dist" depends="compile,revision" description="Generate distribution">
     59                <unjar dest="${plugin.build.dir}" src="${jgrapht}"/>
     60                <unjar dest="${plugin.build.dir}" src="${log4j}"/>
     61                <copy todir="${plugin.build.dir}/">
     62                        <fileset dir="resources">
     63                                <include name="*.xml"/>
     64                        </fileset>
     65                </copy>
     66                <copy todir="${plugin.build.dir}/images">
     67                        <fileset dir="images"/>
     68                </copy>
     69                <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
     70                        <manifest>
     71                                <attribute name="Author" value="Jose Vidal &lt;vidalfree@gmail.com&gt;, Juangui Jordán &lt;juangui@gmail.com&gt;"/>
     72                                <attribute name="Plugin-Class" value="com.innovant.josm.plugin.routing.RoutingPlugin"/>
     73                                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
     74                                <attribute name="Plugin-Description" value="Provides routing capabilities."/>
     75                                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Routing"/>
     76                                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
     77                                <attribute name="Plugin-Stage" value="50"/>
     78                                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
     79                        </manifest>
     80                </jar>
     81        </target>
     82        <target name="revision">
     83                <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
     84                        <env key="LANG" value="C"/>
     85                        <arg value="info"/>
     86                        <arg value="--xml"/>
     87                        <arg value="."/>
     88                </exec>
     89                <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
     90                <delete file="REVISION"/>
     91        </target>
     92        <target name="clean">
     93                <delete dir="${plugin.build.dir}"/>
     94                <delete file="${plugin.jar}"/>
     95        </target>
     96        <target name="install" depends="dist">
     97                <property environment="env"/>
     98                <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
     99                        <and>
     100                                <os family="windows"/>
     101                        </and>
     102                </condition>
     103                <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     104        </target>
     105
     106        <!--
     107                 ************************** Publishing the plugin ***********************************
     108                -->
     109        <!--
     110                ** extracts the JOSM release for the JOSM version in ../core and saves it in the
     111                ** property ${coreversion.info.entry.revision}
     112                **
     113                -->
     114        <target name="core-info">
     115                <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
     116                        <env key="LANG" value="C"/>
     117                        <arg value="info"/>
     118                        <arg value="--xml"/>
     119                        <arg value="../../core"/>
     120                </exec>
     121                <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
     122                <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
     123                <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
     124                <delete file="core.info.xml" />
     125        </target>
     126
     127        <!--
     128                ** commits the source tree for this plugin
     129                -->
     130        <target name="commit-current">
     131                <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
     132                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     133                        <env key="LANG" value="C"/>
     134                        <arg value="commit"/>
     135                        <arg value="-m '${commit.message}'"/>
     136                        <arg value="."/>
     137                </exec>
     138        </target>
     139
     140        <!--
     141                ** updates (svn up) the source tree for this plugin
     142                -->
     143        <target name="update-current">
     144                <echo>Updating plugin source ...</echo>
     145                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     146                        <env key="LANG" value="C"/>
     147                        <arg value="up"/>
     148                        <arg value="."/>
     149                </exec>
     150                <echo>Updating ${plugin.jar} ...</echo>
     151                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     152                        <env key="LANG" value="C"/>
     153                        <arg value="up"/>
     154                        <arg value="../dist/${plugin.jar}"/>
     155                </exec>
     156        </target>
     157
     158        <!--
     159                ** commits the plugin.jar
     160                -->
     161        <target name="commit-dist">
     162                <echo>
     163        ***** Properties of published ${plugin.jar} *****
     164        Commit message    : '${commit.message}'                                 
     165        Plugin-Mainversion: ${plugin.main.version}
     166        JOSM build version: ${coreversion.info.entry.revision}
     167        Plugin-Version    : ${version.entry.commit.revision}
     168        ***** / Properties of published ${plugin.jar} *****                                     
     169                                               
     170        Now commiting ${plugin.jar} ...
     171        </echo>
     172                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     173                        <env key="LANG" value="C"/>
     174                        <arg value="-m '${commit.message}'"/>
     175                        <arg value="commit"/>
     176                        <arg value="${plugin.jar}"/>
     177                </exec>
     178        </target>
     179
     180        <!-- ** make sure svn is present as a command line tool ** -->
     181        <target name="ensure-svn-present">
     182                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
     183                        <env key="LANG" value="C" />
     184                        <arg value="--version" />
     185                </exec>
     186                <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
     187                        <!-- return code not set at all? Most likely svn isn't installed -->
     188                        <condition>
     189                                <not>
     190                                        <isset property="svn.exit.code" />
     191                                </not>
     192                        </condition>
     193                </fail>
     194                <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
     195                        <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
     196                        <condition>
     197                                <isfailure code="${svn.exit.code}" />
     198                        </condition>
     199                </fail>
     200        </target>
     201
     202        <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
     203        </target>
    75204</project>
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java

    r18404 r19066  
    3838import org.openstreetmap.josm.gui.IconToggleButton;
    3939import org.openstreetmap.josm.gui.MapFrame;
     40import org.openstreetmap.josm.gui.MapView;
     41import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    4042import org.openstreetmap.josm.gui.layer.Layer;
    4143import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    42 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
    4344import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    4445import org.openstreetmap.josm.plugins.Plugin;
     
    139140        menu = new RoutingMenu();
    140141        // Register this class as LayerChangeListener
    141         Layer.listeners.add(this);
     142        MapView.addLayerChangeListener(this);
    142143        logger.debug("Finished loading plugin");
    143144    }
Note: See TracChangeset for help on using the changeset viewer.