Changeset 29028 in osm for applications


Ignore:
Timestamp:
2012-12-03T22:58:01+01:00 (12 years ago)
Author:
donvip
Message:

[josm_importimage] Simplify build.xml, code cleanup, add jts in requirements as an immediate workaround to #josm8246

Location:
applications/editors/josm/plugins/ImportImagePlugin
Files:
2 deleted
2 edited

Legend:

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

    r28969 r29028  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!--
    3 ** This is a template build file for a JOSM  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 you default plugin directory) run
    16 **
    17 **    > ant  install
    18 **
    19 ** The generated plugin jar is not automatically available in JOSMs plugin configuration
    20 ** dialog. You have to check it in first.
    21 **
    22 ** Use the ant target 'publish' to check in the plugin and make it available to other
    23 ** JOSM users:
    24 **    set the properties commit.message and plugin.main.version
    25 ** and run
    26 **    > ant  publish
    27 **
    28 **
    29 -->
    302<project name="ImportImagePlugin" default="dist" basedir=".">
    313
     
    357        <property name="plugin.main.version" value="4549" />
    368
    37 
    38         <!--
    39       ************************************************
    40       ** should not be necessary to change the following properties
    41      -->
    42         <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
    43         <property name="plugin.build.dir"       value="build"/>
    44         <property name="plugin.src.dir"         value="src"/>
    45         <!-- this is the directory where the plugin jar is copied to -->
    46         <property name="plugin.dist.dir"        value="../../dist"/>
    47         <property name="ant.build.javac.target" value="1.6"/>
    48         <property name="plugin.dist.dir"        value="../../dist"/>
    49         <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    50 
    51         <!--
    52     **********************************************************
    53     ** init - initializes the build
    54     **********************************************************
    55     -->
    56         <target name="init">
    57                 <mkdir dir="${plugin.build.dir}"/>
    58         </target>
     9    <property name="plugin.author" value="Christoph Beekmans, Fabian Kowitz, Anna Robaszkiewicz, Oliver Kuhn, Martin Ulitzny"/>
     10    <property name="plugin.class" value="org.openstreetmap.josm.plugins.ImportImagePlugin.ImportImagePlugin"/>
     11    <property name="plugin.description" value="Plugin for importing spatial referenced images"/>
     12    <property name="plugin.icon" value="images/layericon.png"/>
     13    <property name="plugin.link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImportImagePlugin"/>
     14    <property name="plugin.requires" value="log4j;jts;geotools"/>
     15       
     16    <!-- ** include targets that all plugins have in common ** -->
     17    <import file="../build-common.xml"/>
    5918
    6019        <!--
     
    8241                </javac>
    8342        </target>
    84 
    85         <!--
    86     **********************************************************
    87     ** dist - creates the plugin jar
    88     **********************************************************
    89     -->
    90         <target name="dist" depends="compile,revision">
    91                 <echo message="creating ${ant.project.name}.jar ... "/>
    92                
    93                 <copy todir="${plugin.build.dir}/images">
    94                         <fileset dir="images"/>
    95                 </copy>
    96                 <copy todir="${plugin.build.dir}/resources">
    97                         <fileset dir="resources"/>
    98                 </copy>
    99                 <copy todir="${plugin.build.dir}">
    100                         <fileset dir=".">
    101                                 <include name="README" />
    102                                 <include name="LICENSE" />
    103                         </fileset>
    104                 </copy>
    105                
    106                 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    107                         <!--
    108         ************************************************
    109         ** configure these properties. Most of them will be copied to the plugins
    110         ** manifest file. Property values will also show up in the list available
    111         ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
    112         **
    113         ************************************************
    114     -->
    115 
    116                         <manifest>
    117                 <attribute name="Author" value="Christoph Beekmans, Fabian Kowitz, Anna Robaszkiewicz, Oliver Kuhn, Martin Ulitzny"/>
    118                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.ImportImagePlugin.ImportImagePlugin"/>
    119                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    120                 <attribute name="Plugin-Description" value="Plugin for importing spatial referenced images"/>
    121                 <attribute name="Plugin-Icon" value="images/layericon.png"/>
    122                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImportImagePlugin"/>
    123                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    124                 <attribute name="Plugin-Requires" value="log4j; geotools"/>
    125                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    126                         </manifest>
    127                 </jar>
    128         </target>
    129 
    130         <!--
    131     **********************************************************
    132     ** revision - extracts the current revision number for the
    133     **    file build.number and stores it in the XML property
    134     **    version.*
    135     **********************************************************
    136     -->
    137         <target name="revision">
    138 
    139                 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    140                         <env key="LANG" value="C"/>
    141                         <arg value="info"/>
    142                         <arg value="--xml"/>
    143                         <arg value="."/>
    144                 </exec>
    145                 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    146                 <delete file="REVISION"/>
    147         </target>
    148 
    149         <!--
    150     **********************************************************
    151     ** clean - clean up the build environment
    152     **********************************************************
    153     -->
    154         <target name="clean">
    155                 <delete dir="${plugin.build.dir}"/>
    156                 <delete file="${plugin.jar}"/>
    157         </target>
    158 
    159         <!--
    160     **********************************************************
    161     ** install - install the plugin in your local JOSM installation
    162     **********************************************************
    163     -->
    164         <target name="install" depends="dist">
    165                 <property environment="env"/>
    166                 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    167                         <and>
    168                                 <os family="windows"/>
    169                         </and>
    170                 </condition>
    171                 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    172         </target>
    173 
    174 
    175         <!--
    176         ************************** Publishing the plugin ***********************************
    177         -->
    178         <!--
    179                 ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    180                 ** property ${coreversion.info.entry.revision}
    181                 **
    182                 -->
    183         <target name="core-info">
    184                 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    185                         <env key="LANG" value="C"/>
    186                         <arg value="info"/>
    187                         <arg value="--xml"/>
    188                         <arg value="../../core"/>
    189                 </exec>
    190                 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    191                 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    192                 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    193                 <delete file="core.info.xml" />
    194         </target>
    195 
    196         <!--
    197                 ** commits the source tree for this plugin
    198                 -->
    199         <target name="commit-current">
    200                 <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    201                 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    202                         <env key="LANG" value="C"/>
    203                         <arg value="commit"/>
    204                         <arg value="-m '${commit.message}'"/>
    205                         <arg value="."/>
    206                 </exec>
    207         </target>
    208 
    209         <!--
    210                 ** updates (svn up) the source tree for this plugin
    211                 -->
    212         <target name="update-current">
    213                 <echo>Updating plugin source ...</echo>
    214                 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    215                         <env key="LANG" value="C"/>
    216                         <arg value="up"/>
    217                         <arg value="."/>
    218                 </exec>
    219                 <echo>Updating ${plugin.jar} ...</echo>
    220                 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    221                         <env key="LANG" value="C"/>
    222                         <arg value="up"/>
    223                         <arg value="../dist/${plugin.jar}"/>
    224                 </exec>
    225         </target>
    226 
    227         <!--
    228                 ** commits the plugin.jar
    229                 -->
    230         <target name="commit-dist">
    231                 <echo>
    232         ***** Properties of published ${plugin.jar} *****
    233         Commit message    : '${commit.message}'                                 
    234         Plugin-Mainversion: ${plugin.main.version}
    235         JOSM build version: ${coreversion.info.entry.revision}
    236         Plugin-Version    : ${version.entry.commit.revision}
    237         ***** / Properties of published ${plugin.jar} *****                                     
    238                                                
    239         Now commiting ${plugin.jar} ...
    240         </echo>
    241                 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    242                         <env key="LANG" value="C"/>
    243                         <arg value="-m '${commit.message}'"/>
    244                         <arg value="commit"/>
    245                         <arg value="${plugin.jar}"/>
    246                 </exec>
    247         </target>
    248 
    249         <!-- ** make sure svn is present as a command line tool ** -->
    250         <target name="ensure-svn-present">
    251                 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    252                         <env key="LANG" value="C" />
    253                         <arg value="--version" />
    254                 </exec>
    255                 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    256                         <!-- return code not set at all? Most likely svn isn't installed -->
    257                         <condition>
    258                                 <not>
    259                                         <isset property="svn.exit.code" />
    260                                 </not>
    261                         </condition>
    262                 </fail>
    263                 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    264                         <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    265                         <condition>
    266                                 <isfailure code="${svn.exit.code}" />
    267                         </condition>
    268                 </fail>
    269         </target>
    270 
    271         <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    272         </target>
    27343       
    27444</project>
  • applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java

    r28954 r29028  
    11package org.openstreetmap.josm.plugins.ImportImagePlugin;
    22
    3 import java.io.BufferedInputStream;
    43import java.io.File;
    5 import java.io.FileNotFoundException;
    6 import java.io.FileOutputStream;
    74import java.io.FileWriter;
    85import java.io.IOException;
    9 import java.lang.reflect.Method;
    106import java.net.MalformedURLException;
    117import java.net.URL;
Note: See TracChangeset for help on using the changeset viewer.