001: /*
002: * Geotools2 - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: */
017: package org.geotools.arcsde.gce.imageio;
018:
019: import java.awt.Rectangle;
020: import java.awt.image.BufferedImage;
021: import java.util.HashMap;
022:
023: import javax.imageio.ImageReadParam;
024:
025: import org.geotools.arcsde.gce.band.ArcSDERasterBandCopier;
026: import org.geotools.arcsde.pool.ArcSDEPooledConnection;
027:
028: import com.esri.sde.sdk.client.SeConnection;
029: import com.esri.sde.sdk.client.SeQuery;
030: import com.esri.sde.sdk.client.SeRasterBand;
031: import com.esri.sde.sdk.client.SeRow;
032:
033: /**
034: * This class represents the parameters passed to an ArcSDERasterReader each
035: * time an image is read.
036: *
037: * Some parameters from the parent class are interpreted strictly in this class.
038: *
039: * <i>Required parameters during a read:</i>
040: * <ul>
041: * <li>An open and connected {@link SeConnection} used to suck out data from
042: * ArcSDE for this image read operation.(setConnection())</li>
043: * <li>A {@link HashMap} with {@link Integer} keys equal to the
044: * SeObjectId.longValue() of each {@link SeRasterBand} which is to be read.
045: * Values for each key should be the integer value of the band in the output
046: * image to which the given SeRasterBand should be copied.<br/><br/>For
047: * example, if your ArcSDE Raster contains four bands with
048: * SeRasterBand.getId().longValue()s of 234,235,236 and 237, and you wish to map
049: * those bands to the R,G,B and A bands in your ARGB image, you should create a
050: * map as follows:<br/> Map m = new HashMap();<br/> m.put(new Integer(234),
051: * new Integer(1));<br/> m.put(new Integer(234), new Integer(2));<br/>
052: * m.put(new Integer(234), new Integer(3));<br/> m.put(new Integer(234), new
053: * Integer(0));<br/> <br/> Note that the band indexes you choose will depend on
054: * the type of BufferedImage you're writing to. A BufferedImage of type
055: * BufferedImage.TYPE_INT_ARGB has its bands in the order "Alpha (0), Red (1),
056: * Green (2), Blue (3)". A BufferedImage of type BufferedImage.TYPE_3BYTE_BGR
057: * has its bands in the order "Blue (0), Green (1), Red (2)".<br/> </li>
058: * <li>A (possibly null) {@link BufferedImage}, passed in via the
059: * 'setDestination()' method. Make sure your bandmapper and this image contain
060: * the same number of bands, and that you've mapped your output appropriately.<br/>
061: * <i><b>If you leave this parameter null, a BufferedImage.TYPE_INT_ARGB will
062: * be created, of exactly the size to cover your requested source region</b></i></li>
063: * <li>An int[] of requested source bands from ArcSDE, set via
064: * setSourceBands(). ArcSDE expects the int[] to have the same size as the
065: * number of bands you're requesting. The first band should be numbered '1', the
066: * second '2', etc. So, to request the second, third and fourth bands in a
067: * raster, use a setSourceBands() call like the following:<br/>
068: * param.setSourceBands(new int[] { 2, 3, 4 });<br/> <b>A source band with the
069: * value of zero won't work! start with 1!</b> </li>
070: * <li>A {@link Rectangle} defining the source area of the raster level you
071: * wish to render. This is expressed as though the entire raster level was one
072: * big seamless image of size wxh, with the origin in the upper left corner. So,
073: * to request a tiny bit of the raster level, simply set your sourceRegion
074: * accordingly and only the proper bit of the raster will be loaded.</li>
075: * </ul>
076: *
077: * @author sfarber
078: *
079: */
080: public class ArcSDERasterImageReadParam extends ImageReadParam {
081:
082: protected ArcSDEPooledConnection connection;
083:
084: protected HashMap bandMapper;
085:
086: public HashMap getBandMapper() {
087: return bandMapper;
088: }
089:
090: public void setBandMapper(HashMap bandMapper) {
091: this .bandMapper = bandMapper;
092: }
093:
094: public ArcSDEPooledConnection getConnection() {
095: return connection;
096: }
097:
098: public void setConnection(ArcSDEPooledConnection connection) {
099: this.connection = connection;
100: }
101: }
|