Changeset 28954 in osm
- Timestamp:
- 2012-11-18T22:21:44+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/ImportImagePlugin
- Files:
-
- 3 added
- 24 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ImportImagePlugin
- Property svn:ignore
-
old new 1 1 build 2 bin
-
- Property svn:ignore
-
applications/editors/josm/plugins/ImportImagePlugin/.classpath
r25934 r28954 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="lib" path="lib/commons-beanutils-1.7.0.jar"/> 5 <classpathentry kind="lib" path="lib/commons-pool-1.5.3.jar"/> 6 <classpathentry kind="lib" path="lib/geoapi-2.3-M1.jar"/> 7 <classpathentry kind="lib" path="lib/geoapi-pending-2.3-M1.jar"/> 8 <classpathentry kind="lib" path="lib/geoapi.jar"/> 9 <classpathentry kind="lib" path="lib/gt-api-2.6.0.jar"/> 10 <classpathentry kind="lib" path="lib/gt-coverage-2.6.0.jar"/> 11 <classpathentry kind="lib" path="lib/gt-epsg-extension-2.6.0.jar"/> 12 <classpathentry kind="lib" path="lib/gt-epsg-hsql-2.6.0.jar"/> 13 <classpathentry kind="lib" path="lib/gt-geotiff-2.6.0.jar"/> 14 <classpathentry kind="lib" path="lib/gt-main-2.6.0.jar"/> 15 <classpathentry kind="lib" path="lib/gt-metadata-2.6.0.jar"/> 16 <classpathentry kind="lib" path="lib/gt-referencing-2.6.0.jar"/> 17 <classpathentry kind="lib" path="lib/hsqldb-1.8.0.7.jar"/> 18 <classpathentry kind="lib" path="lib/imageio-ext-tiff-1.0.4.jar"/> 19 <classpathentry kind="lib" path="lib/imageio-ext-utilities-1.0.4.jar"/> 20 <classpathentry kind="lib" path="lib/jai_codec-1.1.3.jar"/> 21 <classpathentry kind="lib" path="lib/jai_core.jar"/> 22 <classpathentry kind="lib" path="lib/jai_imageio-1.1.jar"/> 23 <classpathentry kind="lib" path="lib/jdom-1.0.jar"/> 24 <classpathentry kind="lib" path="lib/jsr-275-1.0-beta-2.jar"/> 25 <classpathentry kind="lib" path="lib/jts-1.10.jar"/> 26 <classpathentry kind="lib" path="lib/log4j-1.2.12.jar"/> 27 <classpathentry kind="lib" path="lib/vecmath-1.3.2.jar"/> 4 <classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/> 28 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 29 6 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> 7 <classpathentry combineaccessrules="false" kind="src" path="/JOSM-GeoTools"/> 8 <classpathentry combineaccessrules="false" kind="src" path="/JOSM-jts"/> 9 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/commons-beanutils-1.7.0.jar"/> 10 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/commons-pool-1.5.4.jar"/> 11 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/hsqldb-1.8.0.7.jar"/> 12 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/jai_codec-1.1.3.jar"/> 13 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/jai_core-1.1.3.jar"/> 14 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/jai_imageio-1.1.jar"/> 15 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/jdom-1.0.jar"/> 16 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/jsr-275-1.0-beta-2.jar"/> 17 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/vecmath-1.3.2.jar"/> 18 <classpathentry kind="lib" path="/JOSM-jts/lib/jts-1.12.jar"/> 19 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-api-8.3.jar"/> 20 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-coverage-8.3.jar"/> 21 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-epsg-extension-8.3.jar"/> 22 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-epsg-hsql-8.3.jar"/> 23 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-geotiff-8.3.jar"/> 24 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-main-8.3.jar"/> 25 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-metadata-8.3.jar"/> 26 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-referencing-8.3.jar"/> 27 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/imageio-ext-tiff-1.1.5.jar"/> 28 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/imageio-ext-utilities-1.1.5.jar"/> 29 <classpathentry kind="lib" path="/JOSM-GeoTools/lib/gt-opengis-8.3.jar"/> 30 30 <classpathentry kind="output" path="bin"/> 31 31 </classpath> -
applications/editors/josm/plugins/ImportImagePlugin/.project
r25934 r28954 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <projectDescription> 3 <name> ImportImagePlugin</name>3 <name>JOSM-ImportImage</name> 4 4 <comment></comment> 5 5 <projects> -
applications/editors/josm/plugins/ImportImagePlugin/build.xml
r27354 r28954 45 45 <!-- this is the directory where the plugin jar is copied to --> 46 46 <property name="plugin.dist.dir" value="../../dist"/> 47 <property name="ant.build.javac.target" value="1. 5"/>47 <property name="ant.build.javac.target" value="1.6"/> 48 48 <property name="plugin.dist.dir" value="../../dist"/> 49 49 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/> … … 65 65 <target name="compile" depends="init"> 66 66 <echo message="compiling sources for ${plugin.jar} ... "/> 67 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" >67 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" includeantruntime="false"> 68 68 <classpath> 69 69 <pathelement location="${josm}"/> 70 70 <fileset dir="lib"> 71 <include name="**/*.jar"/> 72 </fileset> 73 <fileset dir="../jts/lib"> 74 <include name="**/*.jar"/> 75 </fileset> 76 <fileset dir="../geotools/lib"> 71 77 <include name="**/*.jar"/> 72 78 </fileset> … … 85 91 <echo message="creating ${ant.project.name}.jar ... "/> 86 92 87 <copy todir="${plugin.build.dir}/lib"> 88 <fileset dir="lib"> 89 <not> 90 <filename name="log4j-1.2.12.jar"/> 91 </not> 92 </fileset> 93 </copy> 94 <unjar src="lib/log4j-1.2.12.jar" dest="${plugin.build.dir}"/> 93 <unjar src="lib/log4j-1.2.17.jar" dest="${plugin.build.dir}"/> 95 94 <copy todir="${plugin.build.dir}/images"> 96 95 <fileset dir="images"/> … … 124 123 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImportImagePlugin"/> 125 124 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/> 125 <attribute name="Plugin-Requires" value="geotools"/> 126 126 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 127 127 </manifest> … … 273 273 </target> 274 274 275 <target name="unjar-test" >276 <!--unjar dest="C:/Workspace_2/geotoolstest/lib/unjartest">277 <fileset dir="lib"/>278 </unjar-->279 280 <jar destfile="C:/Workspace_2/geotoolstest/lib/unjartest/${ant.project.name}.jar" basedir="C:/Workspace_2/geotoolstest/lib/unjartest">281 282 <manifest>283 <attribute name="Author" value="Christoph Beekmans, Fabian Kowitz, Anna Robaszkiewicz, Oliver Kuhn, Martin Ulitzny"/>284 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.CoveragePlugin.CoveragePlugin"/>285 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>286 <attribute name="Plugin-Description" value="Plugin for importing spatial referenced images"/>287 <attribute name="Plugin-Link" value="..."/>288 <attribute name="Plugin-Mainversion" value=".."/>289 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>290 <attribute name="Class-path" value=" . CoveragePlugin/lib/commons-beanutils-1.7.0.jar CoveragePlugin/lib/commons-pool-1.5.3.jar CoveragePlugin/lib/geoapi-2.3-M1.jar CoveragePlugin/lib/geoapi-pending-2.3-M1.jar CoveragePlugin/lib/geoapi.jar CoveragePlugin/lib/gt-api-2.6.0.jar CoveragePlugin/lib/gt-coverage-2.6.0.jar CoveragePlugin/lib/gt-epsg-extension-2.6.0.jar CoveragePlugin/lib/gt-epsg-hsql-2.6.0.jar CoveragePlugin/lib/gt-geotiff-2.6.0.jar CoveragePlugin/lib/gt-main-2.6.0.jar CoveragePlugin/lib/gt-metadata-2.6.0.jar CoveragePlugin/lib/gt-referencing-2.6.0.jar CoveragePlugin/lib/hsqldb-1.8.0.7.jar CoveragePlugin/lib/imageio-ext-tiff-1.0.4.jar CoveragePlugin/lib/imageio-ext-utilities-1.0.4.jar CoveragePlugin/lib/jai_codec-1.1.3.jar CoveragePlugin/lib/jai_core.jar CoveragePlugin/lib/jai_imageio-1.1.jar CoveragePlugin/lib/jdom-1.0.jar CoveragePlugin/lib/jsr-275-1.0-beta-2.jar CoveragePlugin/lib/jts-1.10.jar CoveragePlugin/lib/log4j-1.2.12.jar CoveragePlugin/lib/vecmath-1.3.2.jar" />291 </manifest>292 </jar>293 </target>294 295 275 </project> -
applications/editors/josm/plugins/ImportImagePlugin/resources/pluginProperties.properties
r23145 r28954 1 1 default_crs_srid=EPSG\:31467 2 2 default_crs_eastingfirst=true 3 libraries=commons-beanutils-1.7.0.jar,commons-pool-1.5.3.jar,geoapi-2.3-M1.jar,geoapi-pending-2.3-M1.jar,gt-api-2.6.0.jar,gt-coverage-2.6.0.jar,gt-epsg-hsql-2.6.0.jar,gt-geotiff-2.6.0.jar,gt-main-2.6.0.jar,gt-metadata-2.6.0.jar,gt-referencing-2.6.0.jar,hsqldb-1.8.0.7.jar,imageio-ext-tiff-1.0.4.jar,imageio-ext-utilities-1.0.4.jar,jai_codec-1.1.3.jar,jai_core.jar,jai_imageio-1.1.jar,jdom-1.0.jar,jsr-275-1.0-beta-2.jar,jts-1.10.jar,vecmath-1.3.2.jar -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java
r26517 r28954 11 11 12 12 import javax.media.jai.PlanarImage; 13 import javax.swing.AbstractAction; 13 14 import javax.swing.Action; 14 import javax.swing.AbstractAction;15 15 import javax.swing.Icon; 16 16 import javax.swing.ImageIcon; … … 29 29 import org.openstreetmap.josm.data.ProjectionBounds; 30 30 import org.openstreetmap.josm.data.coor.EastNorth; 31 import org.openstreetmap.josm.data.coor.LatLon;32 31 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 33 32 import org.openstreetmap.josm.gui.ExtendedDialog; … … 208 207 209 208 // Draw picture 210 g.drawImage(image, 0, 0, null); 209 try { 210 g.drawImage(image, 0, 0, null); 211 } catch (ArrayIndexOutOfBoundsException e) { 212 // TODO: prevents this to happen when displaying GeoTIFF images (see #7902) 213 e.printStackTrace(); 214 } 211 215 212 216 } else { -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java
r26452 r28954 87 87 } 88 88 89 /* Change class path:90 * Use java reflection methods to add URLs to the class-path.91 * Changes take effect when calling methods of other plugin classes92 * (new threads)93 * */94 URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();95 String[] libraryNames = pluginProps.getProperty("libraries").split(",");96 Class<URLClassLoader> sysclass = URLClassLoader.class;97 Method method = sysclass.getDeclaredMethod("addURL", new Class[]{URL.class});98 method.setAccessible(true);99 for (int i = 0; i < libraryNames.length; i++) {100 File library = new File(PLUGINLIBRARIES_DIR + "/" + libraryNames[i]);101 method.invoke(sysLoader, new Object[]{library.toURI().toURL()});102 }103 104 105 89 // load information about supported reference systems 106 90 PluginOperations.loadCRSData(pluginProps); … … 113 97 Main.main.menu.fileMenu.insert(loadFileAction, 8); 114 98 Main.main.menu.fileMenu.insertSeparator(9); 115 116 99 117 100 } catch (Exception e) { … … 125 108 126 109 logger.info("Plugin successfully loaded."); 127 128 110 } 129 111 … … 136 118 private void checkInstallation() throws IOException 137 119 { 138 139 120 // check plugin resource state 140 121 boolean isInstalled = true; … … 186 167 } 187 168 188 189 // Copy all needed JAR files to $PLUGIN_DIR$/lib/190 String[] libStrings = pluginProps.getProperty("libraries").split(",");191 192 for (int i = 0; i < libStrings.length; i++) {193 194 URL url = pluginClassLoader.getResource("lib/" + libStrings[i]);195 196 FileOutputStream out = null;197 198 try{199 out = new FileOutputStream(new File(libDir, libStrings[i]));200 } catch (FileNotFoundException e) {201 break;202 }203 204 BufferedInputStream in = null;205 try206 {207 in = new BufferedInputStream(url.openStream());208 209 byte[] buffer = new byte[1024];210 while (true)211 {212 int count = in.read(buffer);213 if (count == -1)214 break;215 out.write(buffer, 0, count);216 }217 }218 finally219 {220 if (in != null)221 in.close();222 }223 }224 169 logger.debug("Plugin successfully installed"); 225 170 } -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/PluginOperations.java
r26452 r28954 19 19 import org.geotools.coverage.grid.GridCoverage2D; 20 20 import org.geotools.coverage.grid.GridCoverageFactory; 21 import org.geotools.coverage.processing. DefaultProcessor;21 import org.geotools.coverage.processing.CoverageProcessor; 22 22 import org.geotools.data.DataSourceException; 23 23 import org.geotools.data.WorldFileReader; … … 25 25 import org.geotools.gce.geotiff.GeoTiffReader; 26 26 import org.geotools.geometry.Envelope2D; 27 import org.geotools.image.jai.Registry;28 27 import org.geotools.referencing.CRS; 29 import org.geotools.referencing.crs.DefaultGeographicCRS;30 import org.opengis.metadata.content.ImageDescription;31 28 import org.opengis.parameter.ParameterValueGroup; 32 29 import org.opengis.referencing.FactoryException; … … 34 31 import org.opengis.referencing.crs.CRSAuthorityFactory; 35 32 import org.opengis.referencing.crs.CoordinateReferenceSystem; 36 import org.opengis.referencing.cs.CoordinateSystemAxis;37 33 import org.opengis.util.InternationalString; 38 39 40 34 41 35 /** … … 84 78 GridCoverage2D destination = null; 85 79 86 DefaultProcessor processor = new DefaultProcessor(null); 87 ParameterValueGroup resampleParams = processor.getOperation("Resample") 88 .getParameters(); 80 CoverageProcessor processor = new CoverageProcessor(); 81 ParameterValueGroup resampleParams = processor.getOperation("Resample").getParameters(); 89 82 90 83 // set parameters 91 84 resampleParams.parameter("Source").setValue(coverage); 92 resampleParams.parameter("CoordinateReferenceSystem").setValue( 93 targetCrs); 85 resampleParams.parameter("CoordinateReferenceSystem").setValue(targetCrs); 94 86 95 87 // resample coverage with given parameters … … 380 372 CRSAuthorityFactory fac = CRS.getAuthorityFactory(false); 381 373 382 for (Iterator iterator = supportedCodes.iterator(); iterator.hasNext();) {374 for (Iterator<String> iterator = supportedCodes.iterator(); iterator.hasNext();) { 383 375 String string = (String) iterator.next(); 384 376 try { … … 387 379 } 388 380 InternationalString desc = fac.getDescriptionText("EPSG:" + string); 389 390 381 String description = desc.toString() + " [-EPSG:" + string + "-]"; 391 392 382 crsDescriptions.add(description); 393 394 383 if(defaultcrsString != null && defaultcrsString.equalsIgnoreCase("EPSG:" + string)){ 395 384 boolean isEastingFirst = Boolean.valueOf(pluginProps.getProperty("default_crs_eastingfirst")); … … 397 386 defaultSourceCRSDescription = description; 398 387 } 399 } catch (NoSuchAuthorityCodeException e) { 400 logger.error("Error while loading EPSG data: " + e.getMessage()); 388 401 389 } catch (FactoryException e) { 402 390 logger.error("Error while loading EPSG data: " + e.getMessage()); … … 404 392 } 405 393 } 406 407 394 }
Note:
See TracChangeset
for help on using the changeset viewer.