Revision: 6455 http://sourceforge.net/p/jump-pilot/code/6455 Author: ma15569 Date: 2020-09-13 10:59:20 +0000 (Sun, 13 Sep 2020) Log Message: ----------- Removed bug that was throwing a null exception if the RasterPropertiesplugin was activated on a raster layer outside the view.
Modified Paths: -------------- core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java Modified: core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java 2020-09-12 22:02:47 UTC (rev 6454) +++ core/trunk/src/org/openjump/core/ui/plugin/raster/RasterImageLayerPropertiesPlugIn.java 2020-09-13 10:59:20 UTC (rev 6455) @@ -17,6 +17,7 @@ import java.util.Hashtable; import java.util.Locale; +import javax.media.jai.PlanarImage; //import javax.media.jai.PlanarImage; import javax.swing.BorderFactory; import javax.swing.Box; @@ -443,10 +444,10 @@ raster_bands = df.format(rLayer.getNumBands());// Get raster number of // bands Raster raster = rLayer.getRasterData(null); - BufferedImage bImage = rLayer.getImage(); + // BufferedImage bImage = rLayer.createImage(JUMPWorkbench.getInstance().getContext().getLayerViewPanel()); raster_datatype = getDataType(raster); // Get raster data type - raster_colordepth = getColorDepth(bImage); // Get raster color depth - raster_dpi = getDPI(bImage); // Get raster DPI + raster_colordepth = getColorDepth(raster); // Get raster color depth + raster_dpi = getDPI(raster); // Get raster DPI extent = rLayer.getWholeImageEnvelope(); // Get Envelope extent_cellSizeX = df.format(cellSizeX(raster, extent));// Get X Cell // size @@ -615,35 +616,25 @@ return type; } + /* * Gets color depth */ - /* public String getColorDepth(Raster r) throws IOException { + public String getColorDepth(Raster r) throws IOException { SampleModel sm = r.getSampleModel(); ColorModel cm = PlanarImage.createColorModel(sm); int colordepth = cm.getNumComponents(); return String.valueOf(colordepth) + " bpp"; - }*/ - public String getColorDepth(BufferedImage r) throws IOException { - - ColorModel cm = r.getColorModel(); - int colordepth = cm.getNumComponents(); - return String.valueOf(colordepth) + " bpp"; - } - - /* - * Gets Dots per Inch (DPI) - */ - /* public String getDPI(Raster r) throws IOException { - SampleModel sm = r.getSampleModel(); - ColorModel cm = PlanarImage.createColorModel(sm); - return String.valueOf(cm.getPixelSize()); - }*/ - public String getDPI(BufferedImage r) throws IOException { - - ColorModel cm = r.getColorModel(); + } + + /* + * Gets DPI + */ + public String getDPI(Raster r) throws IOException { + SampleModel sm = r.getSampleModel(); + ColorModel cm = PlanarImage.createColorModel(sm); return String.valueOf(cm.getPixelSize()); - } + } /* * Gets cell size _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel