Revision: 6433
          http://sourceforge.net/p/jump-pilot/code/6433
Author:   ma15569
Date:     2020-09-07 11:08:48 +0000 (Mon, 07 Sep 2020)
Log Message:
-----------
reverted changes for DEM files otherwise, if a style is applied, pixel 
inspection gives back Red value instead of real z value

Modified Paths:
--------------
    core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java

Modified: core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java
===================================================================
--- core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java  
2020-09-07 07:44:45 UTC (rev 6432)
+++ core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java  
2020-09-07 11:08:48 UTC (rev 6433)
@@ -413,13 +413,16 @@
                        //[Giuseppe Aruta 2020-09-04] small patch to solve
                        //bug 498 "Most GeoTIFF drivers fail with a simple 
GeoTIFF image"
                        // at least for RasterImageLayer
-                       try {
-                                               
setImage(stretchImageValuesForDisplay());}
-                       catch (ArrayIndexOutOfBoundsException e){
-                               //[Giuseppe Aruta 2020-09-04]
-                               //setImage(image); removed as getCellValue 
seems not working
-                                setImage(getImageForDisplay());
-                       }
+                       //DEM
+                       if (stats.getBandCount()<3) {
+                        setImage(stretchImageValuesForDisplay());
+                        } else {//Other images
+                                try {
+                                               
setImage(stretchImageValuesForDisplay());}
+                       catch (ArrayIndexOutOfBoundsException e){
+                               setImage(getImageForDisplay());
+                               }
+                        }
                        //setImage(stretchImageValuesForDisplay());
                     wasScaledForDisplay = true;
 
@@ -1680,13 +1683,17 @@
         int pos = row * origImageWidth + col;
         
         double value;
-        try {
-               value =  imageProcessingStep3.getData().getSampleFloat(col, 
row, band);
-                               
-                       //      
imageProcessingStep2.getData().getSampleFloat(col, row, 
band);//actualRasterData.getSampleDouble(col, row, band);
-        } catch (ArrayIndexOutOfBoundsException e) {
-               value = RasterImageIO.readCellValue(imageFileName, col, row, 
band);
-        }
+        if (stats.getBandCount()<3) {
+            value = RasterImageIO.readCellValue(imageFileName, col, row, band);
+            } else {
+               try {
+                       value =  
imageProcessingStep3.getData().getSampleFloat(col, row, band);
+                                       
+                               //      
imageProcessingStep2.getData().getSampleFloat(col, row, 
band);//actualRasterData.getSampleDouble(col, row, band);
+                } catch (ArrayIndexOutOfBoundsException e) {
+                       value = RasterImageIO.readCellValue(imageFileName, col, 
row, band);
+                }
+            }
         return  value;
         
     }   



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

Reply via email to