[JPP-Devel] SVN: [6564] core/trunk/src/com/vividsolutions/jump/workbench/imagery/ graphic

2020-10-02 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6564
  http://sourceforge.net/p/jump-pilot/code/6564
Author:   edso
Date: 2020-10-02 12:23:18 + (Fri, 02 Oct 2020)
Log Message:
---
implement Elevation floating point data rendering according to commons-imaging 
examples from
http://commons.apache.org/proper/commons-imaging/xref-test/org/apache/commons/imaging/examples/tiff/
and
https://issues.apache.org/jira/browse/IMAGING-267

Modified Paths:
--

core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/AbstractGraphicImage.java

core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsImageFactory.java

Added Paths:
---

core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsTIFFImage.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/AbstractGraphicImage.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/AbstractGraphicImage.java
  2020-10-02 04:48:19 UTC (rev 6563)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/AbstractGraphicImage.java
  2020-10-02 12:23:18 UTC (rev 6564)
@@ -244,7 +244,7 @@
   image_h += (topOffset + botOffset);
 
   RenderingHints rh = new RenderingHints(RenderingHints.KEY_INTERPOLATION,
-  RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+  RenderingHints.VALUE_INTERPOLATION_BICUBIC);
   g.setRenderingHints(rh);
 
   // parameters: destination corners then source corners

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsImageFactory.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsImageFactory.java
   2020-10-02 04:48:19 UTC (rev 6563)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsImageFactory.java
   2020-10-02 12:23:18 UTC (rev 6564)
@@ -33,6 +33,7 @@
  */
 import org.apache.commons.imaging.ImageFormat;
 import org.apache.commons.imaging.ImageFormats;
+import org.apache.commons.io.FilenameUtils;
 
 import com.vividsolutions.jump.workbench.WorkbenchContext;
 import com.vividsolutions.jump.workbench.imagery.ReferencedImage;
@@ -43,6 +44,10 @@
   }
 
   public ReferencedImage createImage(String location) {
+String ext = FilenameUtils.getExtension(location).toLowerCase();
+if (ext.matches("tiff?"))
+  return new CommonsTIFFImage(location, null);
+
 return new CommonsImage(location, null);
   }
 

Added: 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsTIFFImage.java
===
--- 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsTIFFImage.java
  (rev 0)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/imagery/graphic/CommonsTIFFImage.java
  2020-10-02 12:23:18 UTC (rev 6564)
@@ -0,0 +1,113 @@
+package com.vividsolutions.jump.workbench.imagery.graphic;
+
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.imaging.FormatCompliance;
+import org.apache.commons.imaging.common.bytesource.ByteSource;
+import org.apache.commons.imaging.common.bytesource.ByteSourceInputStream;
+import org.apache.commons.imaging.formats.tiff.TiffContents;
+import org.apache.commons.imaging.formats.tiff.TiffDirectory;
+import org.apache.commons.imaging.formats.tiff.TiffField;
+import org.apache.commons.imaging.formats.tiff.TiffRasterData;
+import org.apache.commons.imaging.formats.tiff.TiffRasterStatistics;
+import org.apache.commons.imaging.formats.tiff.TiffReader;
+import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
+import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
+import 
org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PaletteEntry;
+import 
org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PaletteEntryForRange;
+import 
org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PaletteEntryForValue;
+import 
org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PhotometricInterpreterFloat;
+import org.openjump.util.UriUtil;
+
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jump.io.CompressedFile;
+import com.vividsolutions.jump.workbench.imagery.ReferencedImageException;
+
+public class CommonsTIFFImage extends CommonsImage {
+
+  public CommonsTIFFImage(String location, WorldFile wf) {
+super(location, wf);
+  }
+
+  @Override
+  protected void initImage() throws ReferencedImageException {
+BufferedImage image = getImage();
+if (image != null)
+  return;
+
+String uri = getUri();
+
+try {
+  ByteSource byteSource = new 
ByteSourceInputStream(Com

Re: [JPP-Devel] 6506 loading raster test

2020-10-02 Thread edgar . soldin
no problemo Rob, got a day job still ;)

please try the latest snapshot r6563+ with Peppe's change.

additionally please try your routine with r6564 but instead of Sextante image 
use the "Open->File->(Select your tifs, click Next)->(keep Use same settings 
for *.tif enabled, Select *Buffered Image (Commons Imaging)*, Click Finished). 
this merely is a rendering test, raster tools will not work on it. please 
comment on speed, memory usage and overall performance incl. bugs.

thanks.. ede

On 10/2/2020 0:28, Roberto Rossi wrote:
> Hi Ede,
> sorry for the late answer.
> I tested the release 6562, and I continue to have the visualization problems 
> in the continuous file (just after having used 500-600 Mb of Memory, for 
> example loading the big SHP and some rasters).
> The continuos raster are all the ones called DTMxx and Depitxx, Aspect, Slope
> What I see is something like this:
>
> While I should see something like this:
>
> I noticed that the discrete raster (like CN, rasterizza, UsoSuolo), when this 
> problem arises, become white instead than something like this:
>
>
>
> Roberto
>
> Il 30/09/2020 13:10, edgar.sol...@web.de ha scritto:
>> On 9/29/2020 16:41, Roberto Rossi wrote:
>>> Il 29/09/2020 15:00, edgar.sol...@web.de ha scritto:
 Rob,

 does that happen with all files or can you pinpoint a specific layer/image?
>>> Ede,
>>> I noticed it for the continuos raster ad Digital terrain models (DTM), 
>>> slope, hillshade.
>> Rob,
>>
>> can you point out which files in your RasterRefrontolo test set are DTM or 
>> the other kinds files? i am actually not GIS-guy at all ;)
>>
>> also. please try snapshot r6562 wrt. the "discrete rendering look" issue.
>>
>> thx ..ede
>
>
>



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


[JPP-Devel] SVN: [6565] core/trunk/src/org/openjump/core/rasterimage/algorithms/ RasterizeAlgorithm.java

2020-10-02 Thread jump-pilot-svn--- via Jump-pilot-devel
Revision: 6565
  http://sourceforge.net/p/jump-pilot/code/6565
Author:   ma15569
Date: 2020-10-02 14:29:59 + (Fri, 02 Oct 2020)
Log Message:
---
Correct method to rasterize that derives from AdbToolbox

Modified Paths:
--

core/trunk/src/org/openjump/core/rasterimage/algorithms/RasterizeAlgorithm.java

Modified: 
core/trunk/src/org/openjump/core/rasterimage/algorithms/RasterizeAlgorithm.java
===
--- 
core/trunk/src/org/openjump/core/rasterimage/algorithms/RasterizeAlgorithm.java 
2020-10-02 12:23:18 UTC (rev 6564)
+++ 
core/trunk/src/org/openjump/core/rasterimage/algorithms/RasterizeAlgorithm.java 
2020-10-02 14:29:59 UTC (rev 6565)
@@ -209,14 +209,26 @@
}
}
 }
+for (int x=0;  x < m_iNX; x++ ) {
+ for (int y=0;  y < m_iNY; y++ ) {
+ if(bimage.getRGB(x, y) != 0 && 
bimage.getRGB(x, y) != -1){
+valori[x][y]=1;
+   }
+ }
+ }
 }
- for (int x=0;  x < m_iNX; x++ ) {
- for (int y=0;  y < m_iNY; y++ ) {
- if(bimage.getRGB(x, y) != 0 && bimage.getRGB(x, y) != 
-1){
- raster.setSample(x, y, 0, dValue);
+ for (Iterator it = inputFC.iterator() ; it.hasNext() ; ) 
{
+   Feature f = it.next();
+   dValue = 
Double.parseDouble(f.getAttribute(attributeName).toString());
+ raster = GridRasterWrapper.matrixToRaster(valori);
+for (int x=0;  x < m_iNX; x++ ) {
+for (int y=0;  y < m_iNY; y++ ) {
+   if( valori[x][y]==1){
+   raster.setSample(x, y, 0, dValue);
}
- }
- }
+ }
+ }
+   }

   
   RasterImageIO rasterImageIO = new RasterImageIO();



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