Hi Ede, Answers inline envoyé : 22 septembre 2020 à 22:43 de : edgar.sol...@web.de à : jump-pilot-devel@lists.sourceforge.net objet : Re: [JPP-Devel] SVN: [6517] core/trunk/src/com/vividsolutions/jump/workbench/imagery/ geotiff
hey Mike, questions inline
On 22.09.2020 16:56, jump-pilot-svn--- via Jump-pilot-devel wrote: Revision: 6517 http://sourceforge.net/p/jump-pilot/code/6517 Author: michaudm Date: 2020-09-22 14:56:54 +0000 (Tue, 22 Sep 2020) Log Message: ----------- Do not use RasterPainter, inherit from GeoImage and use superclass paint method instead (avoid redundant and error-prone code)
Modified Paths: -------------- core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/GeoReferencedRaster.java core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/GeoTIFFImage.java core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/RasterPainter.java
Modified: core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/GeoReferencedRaster.java
>SNIP @@ -217,9 +217,19 @@
void setEnvelope() { + //Coordinate coorRaster_imageLB = new Coordinate( + // coorRasterTiff_tiepointLT.x, src.getHeight(), 0); + //Coordinate coorRaster_imageRT = new Coordinate(src.getWidth(), 0, 0); + // Get the image coordinate of the bottom left corner of the bottom left pixel + // from the image coordinate of the center of the bottom left pixel Coordinate coorRaster_imageLB = new Coordinate( - coorRasterTiff_tiepointLT.x, src.getHeight(), 0); - Coordinate coorRaster_imageRT = new Coordinate(src.getWidth(), 0, 0); + coorRasterTiff_tiepointLT.x-0.5, + src.getHeight()-0.5); + // Get the image coordinate of the top right corner of the top right pixel + // from the image coordinate of the center of the top right pixel + Coordinate coorRaster_imageRT = new Coordinate( + src.getWidth()-0.5, + -0.5); Coordinate coorModel_imageLB = rasterToModelSpace(coorRaster_imageLB); Coordinate coorModel_imageRT = rasterToModelSpace(coorRaster_imageRT);
what does this change do? seems you didn't mention it in the commit message
Fixes the 0.5 pixel shift. I have considered that upper left and lower right tiepoints are tied with model coordinates representing the center of the pixel, hence the need to get image coordinate -0.5, -0.5 in order to compute model coordinates completely including image pixels. Modified: core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/GeoTIFFImage.java=================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/GeoTIFFImage.java 2020-09-22 12:06:16 UTC (rev 6516) +++ core/trunk/src/com/vividsolutions/jump/workbench/imagery/geotiff/GeoTIFFImage.java 2020-09-22 14:56:54 UTC (rev 6517) @@ -36,16 +36,18 @@ import com.vividsolutions.jump.feature.Feature; import com.vividsolutions.jump.workbench.imagery.ReferencedImage; import com.vividsolutions.jump.workbench.imagery.ReferencedImageException; +import com.vividsolutions.jump.workbench.imagery.geoimg.GeoImage; import com.vividsolutions.jump.workbench.ui.Viewport;
/** * legacy GeoTIFF reader */ -public class GeoTIFFImage implements ReferencedImage { +public class GeoTIFFImage extends GeoImage implements ReferencedImage { private GeoTIFFRaster gtr; - private RasterPainter rasterPainter; + //private RasterPainter rasterPainter;
public GeoTIFFImage(String location) throws JUMPException {
SNIP seems your doing a lot of work on the GeoTIFF Plus driver. does the XTIFF JAI reader work well for you? shouldn't we strive to move the readers strengths into the geoimg framework? actually i wrote geoimg using the geotiff driver as starting point, that's why they're so similar.
I spent some time trying to fix georeferencement (0.5 pixel shift) in GeoTiff, but as the code was redundant with the one of geoimg, and you told me that geoimg was more recent, I finally used inheritance, to be able to reuse geoimg paint method in GeoTiff driver. Maybe we can go further to merge geotiff driver into geoimg, but don't get me wrong, I brought GeoTiff driver closer to geoimg. Michaël ..ede
_______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
|