Changeset 36176 in osm for applications/editors/josm/plugins/ImportImagePlugin
- Timestamp:
- 2023-10-19T21:58:56+02:00 (15 months ago)
- Location:
- applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java
r36013 r36176 20 20 21 21 import org.geotools.coverage.grid.GridCoverage2D; 22 import org.geotools.geometry. Envelope2D;22 import org.geotools.geometry.jts.ReferencedEnvelope; 23 23 import org.geotools.image.ImageWorker; 24 24 import org.geotools.referencing.CRS; 25 import org. opengis.referencing.FactoryException;26 import org. opengis.referencing.crs.CoordinateReferenceSystem;25 import org.geotools.api.referencing.FactoryException; 26 import org.geotools.api.referencing.crs.CoordinateReferenceSystem; 27 27 import org.openstreetmap.josm.actions.RenameLayerAction; 28 28 import org.openstreetmap.josm.data.Bounds; … … 57 57 58 58 // current bbox 59 private Envelope2Dbbox;59 private ReferencedEnvelope bbox; 60 60 61 61 // Layer icon … … 144 144 Logging.debug("ImportImagePlugin ImageLayer: Coverage created: {0}", coverage); 145 145 146 upperLeft = new EastNorth(coverage.getEnvelope2D(). x,147 coverage.getEnvelope2D(). y + coverage.getEnvelope2D().height);146 upperLeft = new EastNorth(coverage.getEnvelope2D().getMinX(), 147 coverage.getEnvelope2D().getMaxY()); 148 148 angle = 0; 149 149 bbox = coverage.getEnvelope2D(); … … 230 230 } 231 231 232 public Envelope2DgetBbox() {232 public ReferencedEnvelope getBbox() { 233 233 return bbox; 234 234 } … … 301 301 this.image = ((PlanarImage) coverage.getRenderedImage()).getAsBufferedImage(); 302 302 303 upperLeft = new EastNorth(coverage.getEnvelope2D().x, coverage 304 .getEnvelope2D().y 305 + coverage.getEnvelope2D().height); 303 upperLeft = new EastNorth(coverage.getEnvelope2D().getMinX(), coverage.getEnvelope2D().getMaxY()); 306 304 angle = 0; 307 305 -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/LayerPropertiesDialog.java
r36013 r36176 31 31 32 32 import org.geotools.referencing.CRS; 33 import org. opengis.referencing.FactoryException;34 import org. opengis.referencing.crs.CoordinateReferenceSystem;33 import org.geotools.api.referencing.FactoryException; 34 import org.geotools.api.referencing.crs.CoordinateReferenceSystem; 35 35 import org.openstreetmap.josm.tools.Logging; 36 36 -
applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/PluginOperations.java
r36013 r36176 2 2 package org.openstreetmap.josm.plugins.ImportImagePlugin; 3 3 4 import java.awt.geom.Rectangle2D;5 4 import java.awt.image.BufferedImage; 6 5 import java.io.BufferedReader; … … 17 16 import javax.imageio.ImageIO; 18 17 18 import org.geotools.api.data.DataSourceException; 19 import org.geotools.api.parameter.ParameterValueGroup; 20 import org.geotools.api.referencing.FactoryException; 21 import org.geotools.api.referencing.crs.CRSAuthorityFactory; 22 import org.geotools.api.referencing.crs.CoordinateReferenceSystem; 23 import org.geotools.api.util.InternationalString; 19 24 import org.geotools.coverage.grid.GridCoverage2D; 20 25 import org.geotools.coverage.grid.GridCoverageFactory; 21 26 import org.geotools.coverage.processing.CoverageProcessor; 22 import org.geotools.data.DataSourceException;23 27 import org.geotools.data.WorldFileReader; 24 28 import org.geotools.gce.geotiff.GeoTiffReader; 25 import org.geotools.geometry. Envelope2D;29 import org.geotools.geometry.jts.ReferencedEnvelope; 26 30 import org.geotools.referencing.CRS; 27 31 import org.geotools.util.factory.Hints; 28 import org.opengis.parameter.ParameterValueGroup;29 import org.opengis.referencing.FactoryException;30 import org.opengis.referencing.crs.CRSAuthorityFactory;31 import org.opengis.referencing.crs.CoordinateReferenceSystem;32 import org.opengis.util.InternationalString;33 32 import org.openstreetmap.josm.tools.Logging; 34 33 … … 153 152 double lowerLeft_x = tfwReader.getXULC(); 154 153 double lowerLeft_y = tfwReader.getYULC() - height; 155 Env elope2D bbox = new Envelope2D(null, new Rectangle2D.Double(lowerLeft_x, lowerLeft_y, width, height));154 ReferencedEnvelope bbox = ReferencedEnvelope.rect(lowerLeft_x, lowerLeft_y, width, height, null); 156 155 coverage = createGridCoverage(img, bbox, refSys); 157 156 … … 185 184 double lowerLeft_x = tfwReader.getXULC(); 186 185 double lowerLeft_y = tfwReader.getYULC() - height; 187 Env elope2D bbox = new Envelope2D(null, new Rectangle2D.Double(lowerLeft_x, lowerLeft_y, width, height));186 ReferencedEnvelope bbox = ReferencedEnvelope.rect(lowerLeft_x, lowerLeft_y, width, height, null); 188 187 coverage = createGridCoverage(img, bbox, refSys); 189 188 … … 216 215 double lowerLeft_x = tfwReader.getXULC(); 217 216 double lowerLeft_y = tfwReader.getYULC() - height; 218 Env elope2D bbox = new Envelope2D(null, new Rectangle2D.Double(lowerLeft_x, lowerLeft_y, width, height));217 ReferencedEnvelope bbox = ReferencedEnvelope.rect(lowerLeft_x, lowerLeft_y, width, height, null); 219 218 coverage = createGridCoverage(img, bbox, refSys); 220 219 … … 248 247 double lowerLeft_x = tfwReader.getXULC(); 249 248 double lowerLeft_y = tfwReader.getYULC() - height; 250 Env elope2D bbox = new Envelope2D(null, new Rectangle2D.Double(lowerLeft_x, lowerLeft_y, width, height));249 ReferencedEnvelope bbox = ReferencedEnvelope.rect(lowerLeft_x, lowerLeft_y, width, height, null); 251 250 coverage = createGridCoverage(img, bbox, refSys); 252 251 … … 293 292 * Method for external use. 294 293 */ 295 public static GridCoverage2D createGridCoverage(BufferedImage img, Envelope2Dbbox, CoordinateReferenceSystem crs) {294 public static GridCoverage2D createGridCoverage(BufferedImage img, ReferencedEnvelope bbox, CoordinateReferenceSystem crs) { 296 295 bbox.setCoordinateReferenceSystem(crs); 297 296 return new GridCoverageFactory().create("", img, bbox);
Note:
See TracChangeset
for help on using the changeset viewer.