Changeset 29014 in osm for applications
- Timestamp:
- 2012-12-01T22:45:02+01:00 (12 years ago)
- 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 19 19 <classpathentry kind="lib" path="/JOSM/dist/jts.jar"/> 20 20 <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"/> 21 23 <classpathentry kind="output" path="bin"/> 22 24 </classpath> -
applications/editors/josm/plugins/opendata/README
r28000 r29014 5 5 6 6 * 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) 8 8 9 9 -------------------------------- DOCUMENTATION -------------------------------- … … 22 22 - commons/lang3: Apache Commons Lang 3.1 (stuff related to WordUtils, used by the plugin itself) 23 23 - 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) 30 25 -
applications/editors/josm/plugins/opendata/build.xml
r28891 r29014 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <!--3 ** This is the build file for the opendata plugin.4 **5 ** Usage6 ** =====7 ** To build it run8 **9 ** > ant dist10 **11 ** To install the generated plugin locally (in you default plugin directory) run12 **13 ** > ant install14 **15 ** The generated plugin jar is not automatically available in JOSMs plugin configuration16 ** 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 other19 ** JOSM users:20 ** set the properties commit.message and plugin.main.version21 ** and run22 ** > ant publish23 **24 **25 -->26 2 <project name="opendata" default="dist" basedir="."> 27 <!-- enter the SVN commit message -->28 <property name="commit.message" value="Commit message"/>29 3 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 30 4 <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 33 18 <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 51 21 <!-- 52 22 ********************************************************** … … 82 52 --> 83 53 <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" />86 54 <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> 106 60 </javac> 107 61 </target> … … 120 74 ********************************************************** 121 75 --> 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"> 123 77 <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"> 125 79 <classpath> 126 80 <pathelement path="${plugin.build.dir}"/> 127 81 <pathelement location="${josm}"/> 128 82 <pathelement location="${jts}"/> 83 <pathelement location="${geotools}"/> 129 84 </classpath> 130 85 <compilerarg value="-Xlint:deprecation"/> 131 86 <compilerarg value="-Xlint:unchecked"/> 132 87 </javac> 133 </target>134 <!--135 **********************************************************136 ** dist - creates the plugin jar137 **********************************************************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 plugins167 ** manifest file. Property values will also show up in the list available168 ** 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 the189 ** file build.number and stores it in the XML property190 ** 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 environment206 **********************************************************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 installation215 **********************************************************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 the231 ** 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">311 88 </target> 312 89 … … 316 93 </classpath> 317 94 </taskdef> 95 318 96 <target name="xjc_neptune"> 319 97 <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 143 143 * Resources 144 144 */ 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/"; 146 146 public static final String DICTIONARY_FR = RESOURCE_PATH+"dictionary.fr.csv"; 147 147 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchConstants.java
r28050 r29014 33 33 * NEPTUNE XML Schema 34 34 */ 35 public static final String NEPTUNE_XSD = "/ neptune/neptune.xsd";35 public static final String NEPTUNE_XSD = "/resources/neptune/neptune.xsd"; 36 36 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/TabReader.java
r28152 r29014 21 21 import java.io.InputStream; 22 22 import java.io.InputStreamReader; 23 import java.net.URL;24 23 import java.nio.charset.Charset; 25 24 import java.util.ArrayList; 26 25 import java.util.List; 27 26 28 import org.geotools.data.DataUtilities; 29 import org.geotools.data.shapefile.ShpFileType; 30 import org.geotools.data.shapefile.ShpFiles; 27 import org.geotools.data.shapefile.TabFiles; 31 28 import org.geotools.data.shapefile.dbf.DbaseFileReader; 32 29 import org.geotools.data.shapefile.dbf.DbaseFileReader.Row; … … 54 51 return new TabReader(handler).parse(in, file, instance, Charset.forName(ISO8859_15)); 55 52 } 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 }62 53 63 @Override64 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 76 54 private class TabOsmReader extends SpreadSheetReader { 77 55
Note:
See TracChangeset
for help on using the changeset viewer.