Revision: 6478
          http://sourceforge.net/p/jump-pilot/code/6478
Author:   michaudm
Date:     2020-09-14 21:13:44 +0000 (Mon, 14 Sep 2020)
Log Message:
-----------
fix #503 : 0.5 pixel shift on raster display

Modified Paths:
--------------
    core/trunk/ChangeLog
    
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2020-09-14 11:49:35 UTC (rev 6477)
+++ core/trunk/ChangeLog        2020-09-14 21:13:44 UTC (rev 6478)
@@ -4,6 +4,9 @@
 # 3. be concise but convey the change in a way that ordinary users understand
 #<-------------------------------- 80 chars 
---------------------------------->#
 
+2020-09-14 mmichaud <m.michael.mich...@orange.fr>
+  * fix #503 : 0.5 pixel shift on raster display
+
 2020-09-12 mmichaud <m.michael.mich...@orange.fr>
   * Add an interiorBorder option to BasicStyle
 

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java
===================================================================
--- 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java
    2020-09-14 11:49:35 UTC (rev 6477)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java
    2020-09-14 21:13:44 UTC (rev 6478)
@@ -348,8 +348,8 @@
   }
 
   private void setEnvelope(double[] tags) {
-    setCoorRasterTiff_tiepointLT(new Coordinate(-0.5, -0.5));
-    setCoorModel_tiepointLT(new Coordinate(0, 0));
+    //setCoorRasterTiff_tiepointLT(new Coordinate(-0.5, -0.5));
+    //setCoorModel_tiepointLT(new Coordinate(0, 0));
     AffineTransform transform = new AffineTransform(tags);
 
     double scaleX = Math.abs(transform.getScaleX());
@@ -370,9 +370,18 @@
   }
 
   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-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);
+    // Transform the bottom left and the top right corner to model coordinate
+    // to get the envelope of the image
     Coordinate coorModel_imageLB = rasterToModelSpace(coorRaster_imageLB);
     Coordinate coorModel_imageRT = rasterToModelSpace(coorRaster_imageRT);
 



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to