Changeset 29014 in osm for applications


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

[josm_opendata] Use GeoTools plugin + simplify build.xml + change resources location

Location:
applications/editors/josm/plugins/opendata
Files:
4 added
8 deleted
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/.classpath

    r28696 r29014  
    1919        <classpathentry kind="lib" path="/JOSM/dist/jts.jar"/>
    2020        <classpathentry combineaccessrules="false" kind="src" path="/josm-utilsplugin2"/>
     21        <classpathentry combineaccessrules="false" kind="src" path="/JOSM-GeoTools"/>
     22        <classpathentry combineaccessrules="false" kind="src" path="/JOSM-jts"/>
    2123        <classpathentry kind="output" path="bin"/>
    2224</classpath>
  • applications/editors/josm/plugins/opendata/README

    r28000 r29014  
    55
    66    * Author: Don-vip
    7     * License: GPL v3 (see gpl-3.0.txt) and others (see below for details)
     7    * License: GPL v3 (see GPL-3.0.txt) and others (see below for details)
    88
    99-------------------------------- DOCUMENTATION --------------------------------
     
    2222        - commons/lang3: Apache Commons Lang 3.1 (stuff related to WordUtils, used by the plugin itself)
    2323        - poi: Apache POI 3.7 (Excel format support without styles, formulas and writing capabilities, used by the plugin itself)
    24     - org/jopendocument: jOpenDocument 1.2 (ODS support without styles and writing capabilities, used by the plugin itself) (GPL v3, see gpl-3.0.txt)
    25     - org/jdom: JDOM 1.1.2-hotfix1 (used by jOpenDocument & GeoTools) (custom license, see JDOM_LICENSE.txt)
    26     - org/geotools, org/opengis: GeoTools 2.7.4 (ESRI Shapefile support, used by the plugin itself) (LGPL v2.1, see lgpl-2.1.txt)
    27     - com/vividsolutions/jts: JTS 1.12 (used by GeoTools, http://sourceforge.net/projects/jts-topo-suite/) (LGPL v2.1, see lgpl-2.1.txt)
    28     - javax/measure: JSR-275 1.0-beta2 (used by GeoTools)
    29     - javax/vecmath: Vecmath 1.5.2 (used by GeoTools, http://java.net/projects/vecmath) (GPL v2, see gpl-2.0.txt)
     24    - org/jopendocument: jOpenDocument 1.2 (ODS support without styles and writing capabilities, used by the plugin itself) (GPL v3, see GPL-3.0.txt)
    3025   
  • applications/editors/josm/plugins/opendata/build.xml

    r28891 r29014  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <!--
    3 ** This is the build file for the opendata plugin.
    4 **
    5 ** Usage
    6 ** =====
    7 ** To build it run
    8 **
    9 **    > ant  dist
    10 **
    11 ** To install the generated plugin locally (in you default plugin directory) run
    12 **
    13 **    > ant  install
    14 **
    15 ** The generated plugin jar is not automatically available in JOSMs plugin configuration
    16 ** dialog. You have to check it in first.
    17 **
    18 ** Use the ant target 'publish' to check in the plugin and make it available to other
    19 ** JOSM users:
    20 **    set the properties commit.message and plugin.main.version
    21 ** and run
    22 **    > ant  publish
    23 **
    24 **
    25 -->
    262<project name="opendata" default="dist" basedir=".">
    27     <!-- enter the SVN commit message -->
    28     <property name="commit.message" value="Commit message"/>
    293    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    304    <property name="plugin.main.version" value="5554"/>
    31     <!-- should not be necessary to change the following properties -->
    32     <property name="josm" location="../../core/dist/josm-custom.jar"/>
     5
     6    <property name="plugin.author" value="Don-vip"/>
     7    <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
     8    <property name="plugin.description" value="Convert data from Open Data portals to OSM layer"/>
     9    <property name="plugin.icon" value="images/dialogs/o24.png"/>
     10    <property name="plugin.link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData"/>
     11    <!--<property name="plugin.early" value="..."/>-->
     12    <property name="plugin.requires" value="geotools;utilsplugin2"/>
     13    <!--<property name="plugin.stage" value="..."/>-->
     14
     15    <!-- ** include targets that all plugins have in common ** -->
     16    <import file="../build-common.xml"/>
     17       
    3318    <property name="jts" location="../../dist/jts.jar"/>
    34     <property name="plugin.build.dir" value="build"/>
    35     <property name="plugin.src.dir" value="src"/>
    36     <!-- this is the directory where the plugin jar is copied to -->
    37     <property name="plugin.dist.dir" value="../../dist"/>
    38     <property name="ant.build.javac.source" value="1.6"/>
    39     <property name="ant.build.javac.target" value="1.6"/>
    40     <property name="plugin.dist.dir" value="../../dist"/>
    41     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    42     <!--
    43     **********************************************************
    44     ** init - initializes the build
    45     **********************************************************
    46     -->
    47     <target name="init">
    48         <mkdir dir="${plugin.build.dir}"/>
    49         <mkdir dir="${plugin.build.dir}/META-INF"/>
    50     </target>
     19    <property name="geotools" location="../../dist/geotools.jar"/>
     20       
    5121    <!--
    5222    **********************************************************
     
    8252    -->
    8353    <target name="compile_jopendoc" depends="init, compile_collections">
    84         <echo message="compiling JDOM ... "/>
    85         <javac srcdir="includes/org/jdom" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
    8654        <echo message="compiling JOpenDocument ... "/>
    87         <javac srcdir="includes/org/jopendocument" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
    88     </target>
    89     <!--
    90     **********************************************************
    91     ** compile_geotools - compiles GeoTools needed classes
    92     **********************************************************
    93     -->
    94     <target name="compile_geotools" depends="init">
    95         <echo message="compiling JSR-275 ... "/>
    96         <javac srcdir="includes/javax/measure" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8" />
    97         <echo message="compiling Vecmath ... "/>
    98         <javac srcdir="includes/javax/vecmath" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" />
    99         <echo message="compiling GeoTools ... "/>
    100         <javac debug="false" sourcepath="" srcdir="includes" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1">
    101             <include name="org/geotools/**/*.java"/>
    102                 <include name="org/opengis/**/*.java"/>
    103             <classpath>
    104                 <pathelement location="${jts}"/>
    105             </classpath>
     55        <javac srcdir="includes/org/jopendocument" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" >
     56                <classpath>
     57                        <!-- JDOM is required and embededd in geotools jar -->
     58                        <pathelement location="${geotools}"/>
     59                </classpath>
    10660        </javac>
    10761    </target>
     
    12074    **********************************************************
    12175    -->
    122     <target name="compile" depends="init, compile_lang3, compile_poi, compile_jopendoc, compile_geotools, compile_neptune">
     76    <target name="compile" depends="init, compile_lang3, compile_poi, compile_jopendoc, compile_neptune">
    12377        <echo message="compiling sources for  ${plugin.jar} ... "/>
    124         <javac srcdir="src/org/openstreetmap" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false">
     78        <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false">
    12579            <classpath>
    12680                    <pathelement path="${plugin.build.dir}"/>
    12781                <pathelement location="${josm}"/>
    12882                <pathelement location="${jts}"/>
     83                <pathelement location="${geotools}"/>
    12984            </classpath>
    13085            <compilerarg value="-Xlint:deprecation"/>
    13186            <compilerarg value="-Xlint:unchecked"/>
    13287        </javac>
    133     </target>
    134     <!--
    135     **********************************************************
    136     ** dist - creates the plugin jar
    137     **********************************************************
    138     -->
    139     <target name="dist" depends="compile,revision">
    140         <echo message="creating ${ant.project.name}.jar ... "/>
    141         <copy todir="${plugin.build.dir}">
    142             <fileset dir="resources">
    143                 <exclude name="org/geotools/referencing/**/*_original.properties"/>
    144                 <exclude name="org/geotools/referencing/factory/epsg/*.sql"/>
    145                 <exclude name="org/geotools/referencing/factory/epsg/PrepareForHSQL.xml"/>
    146                 <exclude name="org/geotools/referencing/factory/epsg/UpdateEPSGDatabase.txt"/>
    147             </fileset>
    148         </copy>
    149         <copy todir="${plugin.build.dir}/images">
    150             <fileset dir="images"/>
    151         </copy>
    152         <copy todir="${plugin.build.dir}/data">
    153             <fileset dir="data"/>
    154         </copy>
    155         <copy todir="${plugin.build.dir}">
    156             <fileset dir=".">
    157                 <include name="README"/>
    158             </fileset>
    159             <fileset dir="licenses">
    160                 <include name="*.txt"/>
    161             </fileset>
    162         </copy>
    163         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    164             <!--
    165             ************************************************
    166             ** configure these properties. Most of them will be copied to the plugins
    167             ** manifest file. Property values will also show up in the list available
    168             ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
    169             **
    170             ************************************************
    171             -->
    172             <manifest>
    173                 <attribute name="Author" value="Don-vip"/>
    174                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
    175                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    176                 <attribute name="Plugin-Description" value="Convert data from Open Data portals to OSM layer"/>
    177                 <attribute name="Plugin-Early" value="false"/>
    178                 <attribute name="Plugin-Icon" value="images/dialogs/o24.png"/>
    179                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData"/>
    180                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    181                 <attribute name="Plugin-Requires" value="jts;utilsplugin2"/>
    182                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    183             </manifest>
    184         </jar>
    185     </target>
    186     <!--
    187     **********************************************************
    188     ** revision - extracts the current revision number for the
    189     **    file build.number and stores it in the XML property
    190     **    version.*
    191     **********************************************************
    192     -->
    193     <target name="revision">
    194         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    195             <env key="LANG" value="C"/>
    196             <arg value="info"/>
    197             <arg value="--xml"/>
    198             <arg value="."/>
    199         </exec>
    200         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    201         <delete file="REVISION"/>
    202     </target>
    203     <!--
    204     **********************************************************
    205     ** clean - clean up the build environment
    206     **********************************************************
    207     -->
    208     <target name="clean">
    209         <delete dir="${plugin.build.dir}"/>
    210         <delete file="${plugin.jar}"/>
    211     </target>
    212     <!--
    213     **********************************************************
    214     ** install - install the plugin in your local JOSM installation
    215     **********************************************************
    216     -->
    217     <target name="install" depends="dist">
    218         <property environment="env"/>
    219         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    220             <and>
    221                 <os family="windows"/>
    222             </and>
    223         </condition>
    224         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    225     </target>
    226     <!--
    227     ************************** Publishing the plugin ***********************************
    228     -->
    229     <!--
    230     ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    231     ** property ${coreversion.info.entry.revision}
    232     -->
    233     <target name="core-info">
    234         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    235             <env key="LANG" value="C"/>
    236             <arg value="info"/>
    237             <arg value="--xml"/>
    238             <arg value="../../core"/>
    239         </exec>
    240         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    241         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    242         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    243         <delete file="core.info.xml"/>
    244     </target>
    245     <!-- commits the source tree for this plugin -->
    246     <target name="commit-current">
    247         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    248         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    249             <env key="LANG" value="C"/>
    250             <arg value="commit"/>
    251             <arg value="-m '${commit.message}'"/>
    252             <arg value="."/>
    253         </exec>
    254     </target>
    255     <!-- updates (svn up) the source tree for this plugin -->
    256     <target name="update-current">
    257         <echo>Updating plugin source ...</echo>
    258         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    259             <env key="LANG" value="C"/>
    260             <arg value="up"/>
    261             <arg value="."/>
    262         </exec>
    263         <echo>Updating ${plugin.jar} ...</echo>
    264         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    265             <env key="LANG" value="C"/>
    266             <arg value="up"/>
    267             <arg value="../dist/${plugin.jar}"/>
    268         </exec>
    269     </target>
    270     <!-- commits the plugin.jar -->
    271     <target name="commit-dist">
    272         <echo>
    273     ***** Properties of published ${plugin.jar} *****
    274     Commit message    : '${commit.message}'                   
    275     Plugin-Mainversion: ${plugin.main.version}
    276     JOSM build version: ${coreversion.info.entry.revision}
    277     Plugin-Version    : ${version.entry.commit.revision}
    278     ***** / Properties of published ${plugin.jar} *****                   
    279                        
    280     Now commiting ${plugin.jar} ...
    281     </echo>
    282         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    283             <env key="LANG" value="C"/>
    284             <arg value="-m '${commit.message}'"/>
    285             <arg value="commit"/>
    286             <arg value="${plugin.jar}"/>
    287         </exec>
    288     </target>
    289     <!-- make sure svn is present as a command line tool -->
    290     <target name="ensure-svn-present">
    291         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    292             <env key="LANG" value="C"/>
    293             <arg value="--version"/>
    294         </exec>
    295         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    296             <!-- return code not set at all? Most likely svn isn't installed -->
    297             <condition>
    298                 <not>
    299                     <isset property="svn.exit.code"/>
    300                 </not>
    301             </condition>
    302         </fail>
    303         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    304             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    305             <condition>
    306                 <isfailure code="${svn.exit.code}"/>
    307             </condition>
    308         </fail>
    309     </target>
    310     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    31188    </target>
    31289   
     
    31693          </classpath>
    31794    </taskdef>
     95       
    31896    <target name="xjc_neptune">
    31997        <xjc schema="resources/neptune/neptune.xsd" destdir="includes" package="neptune" target="2.1" />
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/OdConstants.java

    r28891 r29014  
    143143     * Resources
    144144     */
    145     public static final String RESOURCE_PATH = "/org/openstreetmap/josm/plugins/opendata/core/resources/";
     145    public static final String RESOURCE_PATH = "/resources/org/openstreetmap/josm/plugins/opendata/core/resources/";
    146146    public static final String DICTIONARY_FR = RESOURCE_PATH+"dictionary.fr.csv";
    147147}
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchConstants.java

    r28050 r29014  
    3333         * NEPTUNE XML Schema
    3434         */
    35         public static final String NEPTUNE_XSD = "/neptune/neptune.xsd";
     35        public static final String NEPTUNE_XSD = "/resources/neptune/neptune.xsd";
    3636}
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/TabReader.java

    r28152 r29014  
    2121import java.io.InputStream;
    2222import java.io.InputStreamReader;
    23 import java.net.URL;
    2423import java.nio.charset.Charset;
    2524import java.util.ArrayList;
    2625import java.util.List;
    2726
    28 import org.geotools.data.DataUtilities;
    29 import org.geotools.data.shapefile.ShpFileType;
    30 import org.geotools.data.shapefile.ShpFiles;
     27import org.geotools.data.shapefile.TabFiles;
    3128import org.geotools.data.shapefile.dbf.DbaseFileReader;
    3229import org.geotools.data.shapefile.dbf.DbaseFileReader.Row;
     
    5451                return new TabReader(handler).parse(in, file, instance, Charset.forName(ISO8859_15));
    5552        }
    56        
    57         private class TabFiles extends ShpFiles {
    58                 public TabFiles(File headerFile, File dataFile) throws IllegalArgumentException {
    59                         super(DataUtilities.fileToURL(headerFile));
    60                         urls.put(ShpFileType.DBF, DataUtilities.fileToURL(dataFile));
    61                 }
    6253               
    63                 @Override
    64             protected String baseName(Object obj) {
    65             if (obj instanceof URL) {
    66                 return toBase(((URL) obj).toExternalForm());
    67             }
    68             return null;
    69             }
    70            
    71             private String toBase(String path) {
    72                 return path.substring(0, path.toLowerCase().lastIndexOf(".tab"));
    73             }
    74         }
    75        
    7654        private class TabOsmReader extends SpreadSheetReader {
    7755
Note: See TracChangeset for help on using the changeset viewer.