Revision 1812 org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSProvider.java
WMTSProvider.java | ||
---|---|---|
30 | 30 |
import java.net.ConnectException; |
31 | 31 |
import java.net.MalformedURLException; |
32 | 32 |
import java.net.URL; |
33 |
import java.util.ArrayList;
|
|
33 |
import java.util.List; |
|
34 | 34 |
|
35 | 35 |
import org.gvsig.compat.net.ICancellable; |
36 | 36 |
import org.gvsig.fmap.dal.DALLocator; |
... | ... | |
81 | 81 |
import org.gvsig.raster.impl.store.properties.RemoteStoreHistogram; |
82 | 82 |
import org.gvsig.raster.util.DefaultProviderServices; |
83 | 83 |
import org.gvsig.raster.wmts.io.downloader.WMTSTileServer; |
84 |
import org.gvsig.remoteclient.exceptions.ServerErrorException; |
|
85 |
import org.gvsig.remoteclient.wmts.WMTSStatus; |
|
86 |
import org.gvsig.remoteclient.wmts.exception.DownloadException; |
|
87 |
import org.gvsig.remoteclient.wmts.exception.WMTSException; |
|
88 |
import org.gvsig.remoteclient.wmts.struct.WMTSBoundingBox; |
|
89 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
|
90 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix; |
|
91 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixLimits; |
|
92 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
93 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSetLink; |
|
94 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrix.Tile; |
|
84 |
import org.gvsig.raster.wmts.ogc.WMTSOGCLocator; |
|
85 |
import org.gvsig.raster.wmts.ogc.WMTSStatus; |
|
86 |
import org.gvsig.raster.wmts.ogc.exception.DownloadException; |
|
87 |
import org.gvsig.raster.wmts.ogc.exception.ServerErrorException; |
|
88 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException; |
|
89 |
import org.gvsig.raster.wmts.ogc.struct.WMTSBoundingBox; |
|
90 |
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer; |
|
91 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTile; |
|
92 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrix; |
|
93 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixLimits; |
|
94 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSet; |
|
95 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTileMatrixSetLink; |
|
95 | 96 |
import org.gvsig.tools.ToolsLocator; |
96 | 97 |
import org.gvsig.tools.task.TaskStatus; |
97 | 98 |
import org.slf4j.Logger; |
... | ... | |
140 | 141 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
141 | 142 |
*/ |
142 | 143 |
public class RequestThreadManager extends Thread { |
143 |
private TilePipe pipe = null; |
|
144 |
private ArrayList<Tile> tiles = null;
|
|
145 |
private WMTSStatus status = null; |
|
144 |
private TilePipe pipe = null;
|
|
145 |
private List<WMTSTile> tiles = null;
|
|
146 |
private WMTSStatus status = null;
|
|
146 | 147 |
|
147 |
public RequestThreadManager(TilePipe pipe, ArrayList<Tile> tiles, WMTSStatus status) {
|
|
148 |
public RequestThreadManager(TilePipe pipe, List<WMTSTile> tiles, WMTSStatus status) {
|
|
148 | 149 |
this.pipe = pipe; |
149 | 150 |
this.tiles = tiles; |
150 | 151 |
this.status = status; |
... | ... | |
152 | 153 |
|
153 | 154 |
public void run() { |
154 | 155 |
for (int i = 0; i < tiles.size(); i++) { |
155 |
Tile tile = tiles.get(i); |
|
156 |
WMTSTile tile = tiles.get(i);
|
|
156 | 157 |
WMTSStatus statusCopy = status.cloneStatus(); |
157 |
statusCopy.setTileRow(tile.row);
|
|
158 |
statusCopy.setTileCol(tile.col);
|
|
158 |
statusCopy.setTileRow(tile.getRow());
|
|
159 |
statusCopy.setTileCol(tile.getCol());
|
|
159 | 160 |
if (pipe.getSize() > TilePipe.NTHREADS_QUEUE) { |
160 | 161 |
try { |
161 | 162 |
synchronized (this) { |
... | ... | |
176 | 177 |
class RequestTileLauncher extends Thread { |
177 | 178 |
private TilePipe pipe = null; |
178 | 179 |
private WMTSStatus status = null; |
179 |
private Tile tile = null;
|
|
180 |
private WMTSTile tile = null;
|
|
180 | 181 |
|
181 |
public RequestTileLauncher(TilePipe pipe, WMTSStatus status, Tile tile) { |
|
182 |
public RequestTileLauncher(TilePipe pipe, WMTSStatus status, WMTSTile tile) {
|
|
182 | 183 |
this.pipe = pipe; |
183 | 184 |
this.status = status; |
184 | 185 |
this.tile = tile; |
... | ... | |
188 | 189 |
try { |
189 | 190 |
//File file = getConnector().getTile(status, null); |
190 | 191 |
URL url = getConnector().getTileURL(status); |
191 |
tile.file = getConnector().downloadFile(url, null);
|
|
192 |
tile.setFile(getConnector().downloadFile(url, null));
|
|
192 | 193 |
pipe.setTile(tile); |
193 | 194 |
} catch (DownloadException e) { |
194 | 195 |
logger.info("Error downloading files", e); |
... | ... | |
323 | 324 |
* @param p |
324 | 325 |
* @return |
325 | 326 |
*/ |
326 |
@SuppressWarnings("unchecked") |
|
327 | 327 |
private boolean hasGridSubsets(WMTSDataParameters p) { |
328 |
ArrayList tileMatrixSetLimits = null;
|
|
329 |
ArrayList<?> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
328 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = null;
|
|
329 |
List<WMTSTileMatrixSetLink> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
330 | 330 |
String srs = p.getSRSCode(); |
331 | 331 |
for (int i = 0; i < tileMatrixSetLinkList.size(); i++) { |
332 | 332 |
WMTSTileMatrixSetLink tileMatrixSetLink = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i); |
333 | 333 |
WMTSTileMatrixSet tms = tileMatrixSetLink.getTileMatrixSet(); |
334 |
ArrayList tmsl = tileMatrixSetLink.getTileMatrixLimits();
|
|
334 |
List<WMTSTileMatrixLimits> tmsl = tileMatrixSetLink.getTileMatrixLimits();
|
|
335 | 335 |
String srsTileSet = tms.getSupportedCRS(); |
336 | 336 |
if(srsTileSet.compareTo(srs) == 0) { |
337 | 337 |
tileMatrixSetLimits = tmsl; |
... | ... | |
487 | 487 |
|
488 | 488 |
double widthMtsTile = 0; |
489 | 489 |
double heightMtsTile = 0; |
490 |
ArrayList<?> tileMatrixList = tileMatrixSet.getTileMatrix();
|
|
490 |
List<WMTSTileMatrix> tileMatrixList = tileMatrixSet.getTileMatrix();
|
|
491 | 491 |
extentByLevel = new ExtentImpl[tileMatrixList.size()]; |
492 | 492 |
double minX = 0; |
493 | 493 |
double minY = 0; |
... | ... | |
703 | 703 |
* @param level |
704 | 704 |
* @return |
705 | 705 |
*/ |
706 |
@SuppressWarnings("unchecked") |
|
707 | 706 |
private WMTSTileMatrix getTileMatrixByLevel(int level) { |
708 | 707 |
level = adjustLevel(level); |
709 | 708 |
|
710 | 709 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
711 | 710 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
712 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
711 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
713 | 712 |
|
714 | 713 |
WMTSTileMatrixLimits tileMatrixLimits = null; |
715 | 714 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(level); |
... | ... | |
724 | 723 |
* Returns the number of levels |
725 | 724 |
* @return |
726 | 725 |
*/ |
727 |
@SuppressWarnings("unchecked") |
|
728 | 726 |
public int getZoomLevels() { |
729 | 727 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
730 | 728 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
731 | 729 |
if(hasGridSubsets()) { |
732 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
730 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
733 | 731 |
return Math.min(tileMatrixSet.getTileMatrix().size(), tileMatrixSetLimits.size()); |
734 | 732 |
} |
735 | 733 |
return tileMatrixSet.getTileMatrix().size(); |
... | ... | |
831 | 829 |
//1-Selecci?n de WMTSTileMatrixSet por srs |
832 | 830 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
833 | 831 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
834 |
ArrayList<?> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
832 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
835 | 833 |
|
836 | 834 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(q.getResolutionLevel()); |
837 | 835 |
if(gridSubsets) { |
... | ... | |
846 | 844 |
WMTSStatus status = buildWMTSStatus(r, bufWidth , bufHeight); |
847 | 845 |
|
848 | 846 |
int[] size = str.getTileSizeByLevel(q.getResolutionLevel()); |
849 |
Tile tile = tileMatrix.new Tile(size[0], size[1], |
|
850 |
q.getTileRow(), q.getTileCol(), |
|
851 |
q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), q.getBBox().getLRY()); |
|
847 |
WMTSTile tile = WMTSOGCLocator.getManager().createTile( |
|
848 |
size, |
|
849 |
new int[]{q.getTileRow(), q.getTileCol()}, |
|
850 |
new double[]{q.getBBox().getULX(), q.getBBox().getULY(), q.getBBox().getLRX(), q.getBBox().getLRY()}); |
|
852 | 851 |
|
853 | 852 |
File file = getConnector().getTile(status, null); |
854 |
tile.file = file;
|
|
853 |
tile.setFile(file);
|
|
855 | 854 |
//Creamos un BandList con todas las bandas del fichero |
856 | 855 |
BandList bandList = new BandListImpl(); |
857 | 856 |
for(int i = 0; i < getBandCount(); i++) { |
858 | 857 |
try { |
859 | 858 |
DatasetBand band = new DatasetBandImpl(getURIOfFirstProvider(), i, getDataType()[i], getBandCount()); |
860 |
bandList.addBand(band, i);
|
|
859 |
bandList.addBand(band); |
|
861 | 860 |
} catch(BandNotFoundInListException e) { |
862 | 861 |
//No a?adimos la banda |
863 | 862 |
} |
... | ... | |
971 | 970 |
* @return An array with two elements. The first is the row and the second the column |
972 | 971 |
* of the tile in the tile matrix |
973 | 972 |
*/ |
974 |
@SuppressWarnings({ "unchecked"}) |
|
975 | 973 |
private void getTileInfo(PointInfo pointInfo) { |
976 | 974 |
WMTSDataParameters p = (WMTSDataParameters)param; |
977 | 975 |
|
978 | 976 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
979 | 977 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
980 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
978 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
981 | 979 |
|
982 | 980 |
WMTSTileMatrixLimits tileMatrixLimits = null; |
983 | 981 |
WMTSTileMatrix tileMatrix = (WMTSTileMatrix)tileMatrixSet.getTileMatrix().get(pointInfo.level); |
... | ... | |
986 | 984 |
tileMatrix = tileMatrixLimits.getTileMatrix(); |
987 | 985 |
} |
988 | 986 |
|
989 |
ArrayList<Tile> tiles = null;
|
|
987 |
List<WMTSTile> tiles = null;
|
|
990 | 988 |
if(hasGridSubsets()) |
991 | 989 |
tiles = tileMatrix.contains(p.isProjected(), tileMatrixLimits, pointInfo.worldCoord, getExtent().toRectangle2D()); |
992 | 990 |
else |
993 | 991 |
tiles = tileMatrix.contains(p.isProjected(), pointInfo.worldCoord, getExtent().toRectangle2D()); |
994 | 992 |
|
995 | 993 |
//Tile row and column |
996 |
pointInfo.tile = new Point2D.Double(tiles.get(0).row, tiles.get(0).col);
|
|
994 |
pointInfo.tile = new Point2D.Double(tiles.get(0).getRow(), tiles.get(0).getCol());
|
|
997 | 995 |
|
998 | 996 |
//Desplazamiento en pixels dentro del tile |
999 | 997 |
Point2D rasterPoint = tiles.get(0).worldToRaster(pointInfo.worldCoord); |
... | ... | |
1007 | 1005 |
* @return |
1008 | 1006 |
* @throws RasterDriverException |
1009 | 1007 |
*/ |
1010 |
@SuppressWarnings("unchecked") |
|
1011 | 1008 |
public WMTSStatus buildWMTSStatus(Rectangle2D r, int bufWidth, int bufHeight) throws RasterDriverException { |
1012 | 1009 |
WMTSDataParameters p = (WMTSDataParameters)param; |
1013 | 1010 |
|
... | ... | |
1022 | 1019 |
//1-Selecci?n de WMTSTileMatrixSet por srs |
1023 | 1020 |
WMTSTileMatrixSetLink tileMatrixSetLink = getTileMatrixSetLink(); |
1024 | 1021 |
WMTSTileMatrixSet tileMatrixSet = tileMatrixSetLink.getTileMatrixSet(); |
1025 |
ArrayList tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
1022 |
List<WMTSTileMatrixLimits> tileMatrixSetLimits = tileMatrixSetLink.getTileMatrixLimits();
|
|
1026 | 1023 |
int initialLevel = p.getLayer().getInitialLevel(tileMatrixSet.getIdentifier()); |
1027 | 1024 |
|
1028 | 1025 |
//Esto hace lo mismo que getScale y getLevelFromScale |
... | ... | |
1055 | 1052 |
tileMatrixLimits = (WMTSTileMatrixLimits)tileMatrixSetLimits.get(level - initialLevel - dif); |
1056 | 1053 |
|
1057 | 1054 |
//5-Selecci?n de tiles que entran en esta bounding box |
1058 |
ArrayList<Tile> tiles = null;
|
|
1055 |
List<WMTSTile> tiles = null;
|
|
1059 | 1056 |
/*if(gridSubsets) |
1060 | 1057 |
tiles = tileMatrix.intersects(p.isProjected(), tileMatrixLimits, r, getExtent().toRectangle2D()); |
1061 | 1058 |
else*/ |
... | ... | |
1063 | 1060 |
tiles = tileMatrix.intersects(p.isProjected(), r, extList[level].toRectangle2D()); |
1064 | 1061 |
|
1065 | 1062 |
//6-Petici?n |
1066 |
WMTSStatus status = new WMTSStatus(); |
|
1063 |
WMTSStatus status = null; |
|
1064 |
try { |
|
1065 |
status = getConnector().createStatus(); |
|
1066 |
} catch (WMTSException e) { |
|
1067 |
throw new RasterDriverException("Error creating WMTSStatus", e); |
|
1068 |
} |
|
1067 | 1069 |
status.setTileList(tiles); |
1068 | 1070 |
status.setLayer(p.getLayer().getIdentifier());//.substring(p.getLayer().getIdentifier().indexOf("_") + 1)); |
1069 | 1071 |
status.setFormat(p.getImageFormat()); |
... | ... | |
1123 | 1125 |
*/ |
1124 | 1126 |
public WMTSTileMatrixSetLink getTileMatrixSetLink() { |
1125 | 1127 |
WMTSDataParameters p = (WMTSDataParameters)param; |
1126 |
ArrayList<?> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
1128 |
List<WMTSTileMatrixSetLink> tileMatrixSetLinkList = p.getLayer().getTileMatrixSetLink();
|
|
1127 | 1129 |
for (int i = 0; i < tileMatrixSetLinkList.size(); i++) { |
1128 | 1130 |
WMTSTileMatrixSetLink tileMatrixSetLink = (WMTSTileMatrixSetLink)tileMatrixSetLinkList.get(i); |
1129 | 1131 |
String srsTileSet = tileMatrixSetLink.getTileMatrixSet().getSupportedCRS(); |
... | ... | |
1160 | 1162 |
* @throws RasterDriverException |
1161 | 1163 |
* @throws ProcessInterruptedException |
1162 | 1164 |
*/ |
1163 |
@SuppressWarnings("unchecked") |
|
1164 | 1165 |
private synchronized org.gvsig.raster.cache.tile.Tile[] request( |
1165 | 1166 |
WMTSStatus status, BandList bandList, TileListener listener, int requestType) throws RasterDriverException, ProcessInterruptedException { |
1166 | 1167 |
//WMTSDataParameters p = (WMTSDataParameters)param; |
... | ... | |
1174 | 1175 |
if(connector == null) |
1175 | 1176 |
throw new RasterDriverException("Error getting the connector object"); |
1176 | 1177 |
|
1177 |
ArrayList<Tile> tiles = status.getTileList();
|
|
1178 |
List<WMTSTile> tiles = status.getTileList();
|
|
1178 | 1179 |
|
1179 | 1180 |
TilePipe pipe = new TilePipe(); |
1180 | 1181 |
//TilePipe2 pipe = new TilePipe2(); |
... | ... | |
1188 | 1189 |
//Caso 2: Lanza todos los threads |
1189 | 1190 |
} else if(requestType == UNLIMITED_THREADS) { |
1190 | 1191 |
for (int i = 0; i < tiles.size(); i++) { |
1191 |
Tile tile = tiles.get(i); |
|
1192 |
WMTSTile tile = tiles.get(i);
|
|
1192 | 1193 |
WMTSStatus statusCopy = status.cloneStatus(); |
1193 |
statusCopy.setTileRow(tile.row);
|
|
1194 |
statusCopy.setTileCol(tile.col);
|
|
1194 |
statusCopy.setTileRow(tile.getRow());
|
|
1195 |
statusCopy.setTileCol(tile.getCol());
|
|
1195 | 1196 |
new RequestTileLauncher(pipe, statusCopy, tile).start(); |
1196 | 1197 |
} |
1197 | 1198 |
} |
... | ... | |
1201 | 1202 |
if(requestType == LIMITED_THREADS || requestType == UNLIMITED_THREADS) { |
1202 | 1203 |
int nCollected = 0; |
1203 | 1204 |
while (nCollected < tiles.size()) { |
1204 |
Tile tile = pipe.getTile(); |
|
1205 |
WMTSTile tile = pipe.getTile();
|
|
1205 | 1206 |
tileList[nCollected] = drawTile(tile, listener, bandList); |
1206 | 1207 |
nCollected ++; |
1207 | 1208 |
} |
... | ... | |
1209 | 1210 |
|
1210 | 1211 |
if(requestType == SEQUENTIAL) { |
1211 | 1212 |
for (int i = 0; i < tiles.size(); i++) { |
1212 |
Tile tile = tiles.get(i); |
|
1213 |
status.setTileRow(tile.row);
|
|
1214 |
status.setTileCol(tile.col);
|
|
1213 |
WMTSTile tile = tiles.get(i);
|
|
1214 |
status.setTileRow(tile.getRow());
|
|
1215 |
status.setTileCol(tile.getCol());
|
|
1215 | 1216 |
//TODO:Cancelaci?n |
1216 | 1217 |
try { |
1217 | 1218 |
File file = connector.getTile(status, null); |
1218 |
tile.file = file;
|
|
1219 |
tile.setFile(file);
|
|
1219 | 1220 |
tileList[i] = drawTile(tile, listener, bandList); |
1220 | 1221 |
} catch (WMTSException e) { |
1221 | 1222 |
throw new RasterDriverException("Error getting tiles", e); |
... | ... | |
1238 | 1239 |
* @return |
1239 | 1240 |
* @throws RasterDriverException |
1240 | 1241 |
*/ |
1241 |
private synchronized org.gvsig.raster.cache.tile.Tile drawTile(Tile tile, TileListener listener, BandList bandList) throws RasterDriverException { |
|
1242 |
private synchronized org.gvsig.raster.cache.tile.Tile drawTile(WMTSTile tile, TileListener listener, BandList bandList) throws RasterDriverException {
|
|
1242 | 1243 |
WMTSDataParameters p = (WMTSDataParameters)param; |
1243 | 1244 |
try { |
1244 | 1245 |
String serverName = bandList.getBand(0).getFileName(); |
1245 | 1246 |
for (int j = 0; j < bandList.getBandCount(); j++) { |
1246 |
bandList.getBand(j).setFileName(tile.file.getPath());
|
|
1247 |
bandList.getBand(j).setFileName(tile.getFile().getPath());
|
|
1247 | 1248 |
} |
1248 | 1249 |
|
1249 |
DefaultRasterProvider driver = DefaultProviderServices.loadProvider(tile.file);
|
|
1250 |
DefaultRasterProvider driver = DefaultProviderServices.loadProvider(tile.getFile());
|
|
1250 | 1251 |
colorTable = driver.getColorTable(); |
1251 | 1252 |
bandCount = driver.getBandCount(); |
1252 | 1253 |
lastFileTransparency = (DataStoreTransparency)driver.getTransparency(); |
1253 |
Buffer rasterBuf = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], tile.wPx, tile.hPx, 3, true); |
|
1254 |
Buffer rasterBuf = DefaultRasterManager.getInstance().createBuffer( |
|
1255 |
getDataType()[0], |
|
1256 |
tile.getWidthPx(), |
|
1257 |
tile.getHeightPx(), |
|
1258 |
3, |
|
1259 |
true); |
|
1254 | 1260 |
|
1255 | 1261 |
DefaultRasterQuery q = (DefaultRasterQuery)RasterLocator.getManager().createQuery(); |
1256 |
q.setAreaOfInterest(0, 0, tile.wPx, tile.hPx);
|
|
1262 |
q.setAreaOfInterest(0, 0, tile.getWidthPx(), tile.getHeightPx());
|
|
1257 | 1263 |
q.setBandList(bandList); |
1258 | 1264 |
q.setBuffer(rasterBuf); |
1259 | 1265 |
Buffer buf = driver.getDataSet(q); |
1260 | 1266 |
|
1261 |
buf.setDataExtent(new Rectangle2D.Double(Math.min(tile.ulx, tile.lrx), Math.min(tile.uly, tile.lry), Math.abs(tile.ulx - tile.lrx), Math.abs(tile.uly - tile.lry))); |
|
1267 |
buf.setDataExtent(new Rectangle2D.Double( |
|
1268 |
Math.min(tile.getULX(), tile.getLRX()), |
|
1269 |
Math.min(tile.getULY(), tile.getLRY()), |
|
1270 |
Math.abs(tile.getULX() - tile.getLRX()), |
|
1271 |
Math.abs(tile.getULY() - tile.getLRY()))); |
|
1262 | 1272 |
|
1263 | 1273 |
Buffer alphaBand = null; |
1264 | 1274 |
if(p.getAlphaBand() != -1 && listener != null && p.getAlphaBand() < bandCount) { |
1265 |
alphaBand = DefaultRasterManager.getInstance().createBuffer(getDataType()[0], tile.wPx, tile.hPx, 1, true); |
|
1275 |
alphaBand = DefaultRasterManager.getInstance().createBuffer( |
|
1276 |
getDataType()[0], |
|
1277 |
tile.getWidthPx(), |
|
1278 |
tile.getHeightPx(), |
|
1279 |
1, |
|
1280 |
true); |
|
1266 | 1281 |
int[] oldDB = bandList.getDrawableBands(); |
1267 | 1282 |
bandList.setDrawableBands(new int[]{p.getAlphaBand()}); |
1268 | 1283 |
q.setBandList(bandList); |
... | ... | |
1279 | 1294 |
|
1280 | 1295 |
|
1281 | 1296 |
TileCacheManager m = TileCacheLocator.getManager(); |
1282 |
org.gvsig.raster.cache.tile.Tile t = m.createTile(-1, tile.row, tile.col);
|
|
1297 |
org.gvsig.raster.cache.tile.Tile t = m.createTile(-1, tile.getRow(), tile.getCol());
|
|
1283 | 1298 |
t.setData(new Object[]{buf, alphaBand}); |
1284 |
t.setUl(new Point2D.Double(tile.ulx, tile.uly));
|
|
1285 |
t.setLr(new Point2D.Double(tile.lrx, tile.lry));
|
|
1299 |
t.setUl(new Point2D.Double(tile.getULX(), tile.getULY()));
|
|
1300 |
t.setLr(new Point2D.Double(tile.getLRX(), tile.getLRY()));
|
|
1286 | 1301 |
t.setDownloaderParams("AffineTransform", getAffineTransform()); |
1287 | 1302 |
t.setDownloaderParams("Tiling", new Boolean(true)); |
1288 | 1303 |
if(listener != null) |
Also available in: Unified diff