public static GridCoverage2D wrapCoverage( GridCoverage2D coverage, GridCoverage2D sourceCoverage, GridSampleDimension[] wrappedDimensions, Map properties, boolean forceWrapping) { if (coverage instanceof GridCoverageWrapper || forceWrapping) { return new GridCoverageWrapper( coverage.getName().toString(), coverage, wrappedDimensions == null ? coverage.getSampleDimensions() : wrappedDimensions, properties == null ? sourceCoverage.getProperties() : properties); } return coverage; }
return coverage; final Map<String, Object> properties = coverage.getProperties(); final SampleDimension[] dims = coverage.getSampleDimensions();
/** * The BandMerge operation takes indexed images and expands them, however in the context of * coverage view band merging we don't normally want that, e.g., raster mask bands are * represented as indexed but we really want to keep them in their binary, single band form. To * do so, the IndexColorModel is replaced by a ComponentColorModel * * @param coverage * @return */ private GridCoverage2D prepareForBandMerge(GridCoverage2D coverage) { RenderedImage ri = coverage.getRenderedImage(); SampleModel sampleModel = ri.getSampleModel(); if (sampleModel.getNumBands() == 1 && ri.getColorModel() instanceof IndexColorModel) { ImageWorker worker = new ImageWorker(ri); worker.removeIndexColorModel(); RenderedImage formatted = worker.getRenderedImage(); return new GridCoverageFactory() .create( coverage.getName(), formatted, coverage.getGridGeometry(), coverage.getSampleDimensions(), new GridCoverage[] {coverage}, coverage.getProperties()); } return coverage; }
protected Map getProperties( RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform toCRS, GridCoverage2D[] sources, BandMergeParams parameters) { // Merge the coverage properties Map properties = new HashMap(); for (GridCoverage2D cov : sources) { if (cov != null && cov.getProperties() != null) { properties.putAll(cov.getProperties()); } } // Setting ROI and NoData if present if (JAIExt.isJAIExtOperation("BandMerge")) { ParameterBlockJAI pb = parameters.parameters; CoverageUtilities.setROIProperty(properties, (ROI) pb.getObjectParameter(3)); CoverageUtilities.setNoDataProperty(properties, pb.getObjectParameter(1)); } return properties; }
/** * Constructs a new {@code BandSelect2D} grid coverage. This grid coverage will use the same * coordinate reference system and the same geometry than the source grid coverage. * * @param source The source coverage. * @param image The image to use. * @param bands The sample dimensions to use. * @param bandIndices The mapping to bands in {@code source}. Not used by this constructor, but * keept for futur reference. * @todo It would be nice if we could use always the "BandSelect" operation without the "Null" * one. But as of JAI-1.1.1, "BandSelect" do not detect by itself the case were no copy is * required. */ private BandSelector2D( final GridCoverage2D source, final PlanarImage image, final GridSampleDimension[] bands, final int[] bandIndices, final Hints hints) { super( source.getName(), // The grid source name image, // The underlying data source.getGridGeometry(), // The grid geometry (unchanged). bands, // The sample dimensions new GridCoverage2D[] {source}, // The source grid coverages. source.getProperties(), hints); // Properties this.bandIndices = bandIndices; assert bandIndices == null || bandIndices.length == bands.length; }
Params parameters) { Map properties; if (sources[0].getProperties() == null) { properties = new HashMap<>(); } else { properties = new HashMap<>(sources[0].getProperties());
GridCoverage2D[] sources, Parameters parameters) { Map props = sources[PRIMARY_SOURCE_INDEX].getProperties();
GridCoverage2D[] sources, Parameters parameters) { Map props = sources[PRIMARY_SOURCE_INDEX].getProperties();
GridCoverage2D[] sources, Parameters parameters) { Map props = sources[PRIMARY_SOURCE_INDEX].getProperties();
PlanarImage pi = PlanarImage.wrapRenderedImage(input); pi.setProperty("ROI", roi); final Map sourceProperties = coverage.getProperties(); Map properties = sourceProperties == null ? new HashMap() : new HashMap(sourceProperties);
null, new GridCoverage2D[] {coverage}, coverage.getProperties()); coverages.set(i, expandedCoverage);
static GridCoverage2D displace( GridCoverage2D coverage, double tx, double ty, GridCoverageFactory gridCoverageFactory) { // let's compute the new grid geometry GridGeometry2D originalGG = coverage.getGridGeometry(); GridEnvelope gridRange = originalGG.getGridRange(); Envelope2D envelope = originalGG.getEnvelope2D(); double minx = envelope.getMinX() + tx; double miny = envelope.getMinY() + ty; double maxx = envelope.getMaxX() + tx; double maxy = envelope.getMaxY() + ty; ReferencedEnvelope translatedEnvelope = new ReferencedEnvelope( minx, maxx, miny, maxy, envelope.getCoordinateReferenceSystem()); GridGeometry2D translatedGG = new GridGeometry2D(gridRange, translatedEnvelope); GridCoverage2D translatedCoverage = gridCoverageFactory.create( coverage.getName(), coverage.getRenderedImage(), translatedGG, coverage.getSampleDimensions(), new GridCoverage2D[] {coverage}, coverage.getProperties()); return translatedCoverage; }
final GridCoverageFactory factory = getCoverageFactory(); final HashMap<Object, Object> props = new HashMap<>(); if (source.getProperties() != null) { props.putAll(source.getProperties());
sd, new GridCoverage[] {source}, source.getProperties());
Map properties = input.getProperties(); if (properties == null) { properties = new HashMap<>();
final GridCoverageFactory factory = getCoverageFactory(); final HashMap<Object, Object> props = new HashMap<Object, Object>(); if (source.getProperties() != null) { props.putAll(source.getProperties());
Map properties = source.getProperties(); if (properties != null && CoverageUtilities.getNoDataProperty(source) != null) { NoDataContainer noDataC = CoverageUtilities.getNoDataProperty(source);
Map sourceProperties = sourceCoverage.getProperties(); Map properties = null; if (sourceProperties != null && !sourceProperties.isEmpty()) {
Map properties = sourceCoverage.getProperties(); if (properties == null) { properties = new HashMap<>();
Map properties = output.getProperties(); if (properties == null) { properties = new HashMap<>();