/** * Returns {@code true} if at least one of the specified sample dimensions has a * {@linkplain SampleDimension#getSampleToGeophysics sample to geophysics} transform * which is not the identity transform. */ public static boolean hasTransform(final SampleDimension[] sampleDimensions) { for (int i=sampleDimensions.length; --i>=0;) { SampleDimension sd = sampleDimensions[i]; if (sd instanceof GridSampleDimension) { sd = ((GridSampleDimension) sd).geophysics(false); } MathTransform1D tr = sd.getSampleToGeophysics(); return tr!=null && !tr.isIdentity(); } return false; }
/** * Returns {@code true} if at least one of the specified sample dimensions has a * {@linkplain SampleDimension#getSampleToGeophysics sample to geophysics} transform * which is not the identity transform. */ public static boolean hasTransform(final SampleDimension[] sampleDimensions) { for (int i=sampleDimensions.length; --i>=0;) { SampleDimension sd = sampleDimensions[i]; if (sd instanceof GridSampleDimension) { sd = ((GridSampleDimension) sd).geophysics(false); } MathTransform1D tr = sd.getSampleToGeophysics(); if (tr!=null && !tr.isIdentity()) { return true; } } return false; }
if (sd.geophysics(true ) == sd) countGeophysics++; if (sd.geophysics(false) == sd) countIndexed++;
final GridSampleDimension packed = band.geophysics(false); if (band != packed) { for (final Category category : packed.getCategories()) {
if (sd.geophysics(true ) == sd) countGeophysics++; if (sd.geophysics(false) == sd) countIndexed++;
bandName = "Band" + (i + 1); bands[i] = new GridSampleDimension(bandName,categories,null).geophysics(true);
private GridCoverage2D prepareCoverage( RenderedImage image) throws IOException { // creating bands final SampleModel sm=image.getSampleModel(); final ColorModel cm=image.getColorModel(); final int numBands = sm.getNumBands(); final GridSampleDimension[] bands = new GridSampleDimension[numBands]; // setting bands names. for (int i = 0; i < numBands; i++) { final ColorInterpretation colorInterpretation=TypeMap.getColorInterpretation(cm, i); if(colorInterpretation==null) throw new IOException("Unrecognized sample dimension type"); bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true); } return coverageFactory.create(rasterManager.getCoverageIdentifier(), image,new GeneralEnvelope(bbox), bands, null, null); }
private GridSampleDimension[] getSampleDimensions(final RenderedImage coverageRaster) throws IOException { GridSampleDimension[] bands = rasterInfo.getGridSampleDimensions(); // may the image have been promoted? build the correct band info then final int imageBands = coverageRaster.getSampleModel().getNumBands(); if (bands.length == 1 && imageBands > 1) { LOGGER.fine(coverageName + " was promoted from 1 to " + coverageRaster.getSampleModel().getNumBands() + " bands, returning an appropriate set of GridSampleDimension"); // stolen from super.createCoverage: final ColorModel cm = coverageRaster.getColorModel(); bands = new GridSampleDimension[imageBands]; // setting bands names. for (int i = 0; i < imageBands; i++) { final ColorInterpretation colorInterpretation; colorInterpretation = TypeMap.getColorInterpretation(cm, i); if (colorInterpretation == null) { throw new IOException("Unrecognized sample dimension type"); } bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true); } } return bands; }
.getSampleDimension(0)).geophysics(true);
coverageName, new Category[] { nan }, uom).geophysics(true); final Map<String, Double> properties = new HashMap<String, Double>(); properties.put("GC_NODATA", new Double(inNoData));
final GridSampleDimension displayDimension = sampleDimension.geophysics(false); boolean changed = false; final Category categories[] = (Category[]) displayDimension.getCategories().toArray(); categories, displayDimension.getUnits()); if (sampleDimension != displayDimension) { result = result.geophysics(true);
.geophysics(true); final Map properties = new HashMap(); properties.put("GC_NODATA", new Double(inNoData));
if(colorInterpretation==null) throw new IOException("Unrecognized sample dimension type"); bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true);
if(colorInterpretation==null) throw new IOException("Unrecognized sample dimension type"); bands[i] = new GridSampleDimension(colorInterpretation.name()).geophysics(true);
"digital elevation", new Category[] { values, nan }, uom); return band.geophysics(true);
new Category[] { Category.NODATA }, null).geophysics(true); final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); final GridCoverage2D output = factory.create("reclassified", indexedClassification, coverage
new Category[] { values }, null).geophysics(true);