Revision 2300 org.gvsig.raster.mosaic/trunk/org.gvsig.raster.mosaic/org.gvsig.raster.mosaic.io/src/main/java/org/gvsig/raster/mosaic/io/downloader/MosaicTileServer.java
MosaicTileServer.java | ||
---|---|---|
33 | 33 |
import org.gvsig.raster.cache.tile.provider.CacheStruct; |
34 | 34 |
import org.gvsig.raster.cache.tile.provider.Downloader; |
35 | 35 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
36 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
|
37 | 36 |
import org.gvsig.raster.impl.provider.RasterProvider; |
37 |
import org.gvsig.raster.impl.store.DefaultRasterStore; |
|
38 | 38 |
import org.gvsig.raster.mosaic.io.MosaicDataParameters; |
39 | 39 |
|
40 | 40 |
/** |
... | ... | |
44 | 44 |
public class MosaicTileServer implements TileServer { |
45 | 45 |
private CacheStruct struct = null; |
46 | 46 |
private Downloader downloader = null; |
47 |
private DefaultRasterProvider provider = null;
|
|
47 |
private DefaultRasterStore store = null;
|
|
48 | 48 |
private String suffix = "tif"; |
49 | 49 |
private String layerName = null; |
50 | 50 |
private List<RasterProvider> provList = null; |
... | ... | |
52 | 52 |
private int colorCorrectionMethod = MosaicDataParameters.NONE; |
53 | 53 |
private NoData noData = null; |
54 | 54 |
|
55 |
public MosaicTileServer(DefaultRasterProvider prov,
|
|
55 |
public MosaicTileServer(DefaultRasterStore store,
|
|
56 | 56 |
List<RasterProvider> provList, |
57 | 57 |
String layerName, |
58 | 58 |
int overlapMethod, |
59 | 59 |
int colorCorrectionMethod, |
60 | 60 |
NoData noData) { |
61 |
this.provider = prov;
|
|
61 |
this.store = store;
|
|
62 | 62 |
this.layerName = layerName; |
63 | 63 |
this.provList = provList; |
64 | 64 |
this.overlapMethod = overlapMethod; |
... | ... | |
74 | 74 |
if(downloader == null || |
75 | 75 |
((TileDownloaderForMosaics)downloader).getTileSize()[0] != TileCacheLibrary.DEFAULT_TILEWIDTH || |
76 | 76 |
((TileDownloaderForMosaics)downloader).getTileSize()[1] != TileCacheLibrary.DEFAULT_TILEHEIGHT) { |
77 |
downloader = new TileDownloaderForMosaics(provider,
|
|
77 |
downloader = new TileDownloaderForMosaics(store,
|
|
78 | 78 |
provList, |
79 | 79 |
getStruct(), |
80 | 80 |
TileCacheLibrary.DEFAULT_TILEWIDTH, |
... | ... | |
92 | 92 |
TileCacheManager manager = TileCacheLocator.getManager(); |
93 | 93 |
|
94 | 94 |
int coordinates = CacheStruct.FLAT; |
95 |
if(provider.getProjection() != null)
|
|
96 |
coordinates = (provider.getProjection() != null && provider.getProjection().isProjected()) ? CacheStruct.FLAT : CacheStruct.GEOGRAFIC;
|
|
95 |
if(store.getProjection() != null)
|
|
96 |
coordinates = (store.getProjection() != null && store.getProjection().isProjected()) ? CacheStruct.FLAT : CacheStruct.GEOGRAFIC;
|
|
97 | 97 |
else { |
98 |
Extent e = provider.getExtent();
|
|
98 |
Extent e = store.getExtent();
|
|
99 | 99 |
if(e.getULX() >= -180 && e.getULX() <= 180 && e.getLRX() >= -180 && e.getLRX() <= 180 && |
100 | 100 |
e.getULY() >= -90 && e.getULY() <= 90 && e.getLRY() >= -90 && e.getLRY() <= 90) { |
101 | 101 |
coordinates = CacheStruct.GEOGRAFIC; |
... | ... | |
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
String epsg = null; |
106 |
IProjection proj = provider.getProjection();
|
|
106 |
IProjection proj = store.getProjection();
|
|
107 | 107 |
if(proj != null) |
108 | 108 |
epsg = proj.getAbrev(); |
109 | 109 |
|
110 | 110 |
struct = manager.createCacheStructure(coordinates, |
111 | 111 |
TileCacheLibrary.DEFAULT_LEVELS, |
112 |
provider.getExtent().toRectangle2D(),
|
|
113 |
provider.getCellSize(),
|
|
112 |
store.getExtent().toRectangle2D(),
|
|
113 |
store.getCellSize(),
|
|
114 | 114 |
TileCacheLibrary.DEFAULT_TILEWIDTH, |
115 | 115 |
TileCacheLibrary.DEFAULT_TILEHEIGHT, |
116 | 116 |
layerName, |
... | ... | |
118 | 118 |
RasterLibrary.pathTileCache, |
119 | 119 |
getFileSuffix(), |
120 | 120 |
epsg, |
121 |
provider.getFileSize());
|
|
121 |
store.getFileSize());
|
|
122 | 122 |
} |
123 | 123 |
return struct; |
124 | 124 |
} |
... | ... | |
131 | 131 |
if(struct != null) { |
132 | 132 |
this.struct = struct; |
133 | 133 |
if(struct.getTileSizeByLevel(0) != null) { |
134 |
downloader = new TileDownloaderForMosaics(provider,
|
|
134 |
downloader = new TileDownloaderForMosaics(store,
|
|
135 | 135 |
provList, |
136 | 136 |
getStruct(), |
137 | 137 |
struct.getTileSizeByLevel(0)[0], |
Also available in: Unified diff