Changeset 30734 in osm for applications/editors/josm/plugins/geotools
- Timestamp:
- 2014-10-18T16:48:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/geotools
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geotools/.project
r28593 r30734 13 13 </buildSpec> 14 14 <natures> 15 <nature>org.sonar.ide.eclipse.core.sonarNature</nature> 15 16 <nature>org.eclipse.jdt.core.javanature</nature> 16 17 </natures> -
applications/editors/josm/plugins/geotools/build.xml
r30416 r30734 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 6 <property name="plugin.main.version" value="7001"/> 7 7 8 8 <property name="plugin.author" value="Don-vip"/> 9 9 <property name="plugin.class" value="org.openstreetmap.josm.plugins.geotools.GeoToolsPlugin"/> … … 17 17 <!-- ** include targets that all plugins have in common ** --> 18 18 <import file="../build-common.xml"/> 19 19 20 20 <!-- 21 21 ********************************************************** … … 24 24 --> 25 25 <target name="post-dist"> 26 27 26 <move file="${plugin.jar}" todir="${plugin.build.dir}" /> 27 <jar destfile="${plugin.jar}" filesetmanifest="merge"> 28 28 <fileset dir="jar"/> 29 29 <zipfileset src="${plugin.build.dir}/${ant.project.name}.jar"> 30 30 <exclude name="*.class"/> 31 31 <exclude name="*.html"/> 32 32 <exclude name="META-INF/**/*"/> 33 33 <exclude name="javax/*.txt"/> 34 35 36 37 38 39 40 34 </zipfileset> 35 <zipfileset src="${plugin.build.dir}/${ant.project.name}.jar"> 36 <include name="META-INF/MANIFEST.MF"/> 37 <include name="META-INF/*.jai"/> 38 </zipfileset> 39 </jar> 40 <delete file="${plugin.build.dir}/${ant.project.name}.jar" /> 41 41 </target> 42 42 </project> -
applications/editors/josm/plugins/geotools/src/org/openstreetmap/josm/plugins/geotools/GeoToolsPlugin.java
r30569 r30734 17 17 import com.sun.media.jai.imageioimpl.ImageReadWriteSpi; 18 18 19 /** 20 * GeoTools plugin, bringing this library to other JOSM plugins. 21 */ 19 22 public class GeoToolsPlugin extends Plugin { 23 24 /** 25 * Constructs a new {@code GeoToolsPlugin}. 26 * @param info plugin information 27 */ 20 28 public GeoToolsPlugin(PluginInformation info) { 21 29 super(info); … … 29 37 // See https://www.java.net/node/666373 30 38 System.setProperty("com.sun.media.jai.disableMediaLib", "true"); 31 39 32 40 // As the JAI jars are bundled in the geotools plugin, JAI initialization does not work, 33 41 // so we need to perform the tasks described here ("Initialization and automatic loading of registry objects"): … … 35 43 OperationRegistry registry = JAI.getDefaultInstance().getOperationRegistry(); 36 44 if (registry == null) { 37 System.err.println("geotools: error in JAI initialization. Cannot access default operation registry");45 Main.error("geotools: error in JAI initialization. Cannot access default operation registry"); 38 46 } else { 39 47 // Update registry with com.sun.media.jai.imageioimpl.ImageReadWriteSpi (only class listed javax.media.jai.OperationRegistrySpi) 40 // it would be safer to parse this file instead, but a JAI update is very unlikely as it has not been modified since 2005 48 // it would be safer to parse this file instead, but a JAI update is very unlikely as it has not been modified since 2005 41 49 new ImageReadWriteSpi().updateRegistry(registry); 42 50 43 // Update registry with GeoTools registry file 44 InputStream in = GeoToolsPlugin.class.getResourceAsStream("/META-INF/registryFile.jai"); 45 if (in == null) { 46 System.err.println("geotools: error in JAI initialization. Cannot access META-INF/registryFile.jai"); 47 } else { 48 try { 51 // Update registry with GeoTools registry file 52 try (InputStream in = GeoToolsPlugin.class.getResourceAsStream("/META-INF/registryFile.jai")) { 53 if (in == null) { 54 Main.error("geotools: error in JAI initialization. Cannot access META-INF/registryFile.jai"); 55 } else { 49 56 registry.updateFromStream(in); 50 } catch (IOException e) {51 System.err.println("geotools: error in JAI initialization. Cannot update default operation registry");52 57 } 53 try { 54 in.close(); 55 } catch (IOException e) { 56 System.err.println("geotools: error in JAI initialization. Cannot close input stream"); 57 } 58 } catch (IOException e) { 59 Main.error("geotools: error in JAI initialization: "+e.getMessage()); 58 60 } 59 60 // Print JAI registry contents61 //for (String mode : RegistryMode.getModeNames()) {62 // System.out.println("geotools: JAI mode "+mode+": "+Arrays.toString(registry.getDescriptorNames(mode)));63 //}64 61 } 65 62 } 66 63 67 64 private void initGeoTools() { 68 65 // Force Axis order. Fix #8248
Note:
See TracChangeset
for help on using the changeset viewer.