Revision 6420 org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.tilecache/org.gvsig.raster.tilecache.provider.legend/src/main/java/org/gvsig/raster/tilecache/provider/legend/TileCacheGetColorInterpretation.java
TileCacheGetColorInterpretation.java | ||
---|---|---|
1 | 1 |
package org.gvsig.raster.tilecache.provider.legend; |
2 | 2 |
|
3 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
4 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
5 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
3 |
import org.slf4j.LoggerFactory; |
|
4 |
|
|
6 | 5 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
7 |
import org.gvsig.raster.lib.buffer.api.Band; |
|
8 | 6 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
9 |
import org.gvsig.raster.lib.legend.api.RasterLegend; |
|
10 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
|
11 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
|
12 | 7 |
import org.gvsig.raster.tilecache.provider.TileCacheStoreProvider; |
13 | 8 |
import org.gvsig.raster.tilecache.provider.TileStructImage; |
14 | 9 |
import org.gvsig.tools.ToolsLocator; |
... | ... | |
18 | 13 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
19 | 14 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
20 | 15 |
|
21 |
import org.slf4j.LoggerFactory; |
|
22 |
|
|
23 | 16 |
/** |
24 | 17 |
* @author dmartinezizquierdo |
25 | 18 |
* |
... | ... | |
62 | 55 |
TileCacheStoreProvider tileCacheStoreProvider = |
63 | 56 |
(TileCacheStoreProvider) self; |
64 | 57 |
|
65 |
RasterLegendManager legendManager = |
|
66 |
RasterLegendLocator.getRasterLegendManager(); |
|
67 |
|
|
68 |
// colorInterpretation = |
|
69 |
// legendManager.createColorInterpretation(ColorInterpretation.ARGB); |
|
70 |
|
|
71 | 58 |
TileStructImage tileStructImage = tileCacheStoreProvider.getTileStructImage(); |
72 | 59 |
|
73 |
RasterStore tileStore = null; |
|
74 |
try { |
|
75 |
tileStore = tileStructImage.getDelegatedRasterStore(); |
|
76 |
colorInterpretation = (ColorInterpretation) tileStore |
|
77 |
.invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME, null); |
|
78 |
} catch (DynMethodNotSupportedException e) { |
|
79 |
logger.debug("This store {} does not provide a color interpretation.", |
|
80 |
tileStore.getName()); |
|
81 |
} catch (DynMethodException e) { |
|
82 |
logger.error( |
|
83 |
"Can't load the specific color interpretation provided for the store {}.", |
|
84 |
tileStore.getName(), e); |
|
85 |
} catch (ValidateDataParametersException | InitializeException | ProviderNotRegisteredException e) { |
|
86 |
logger.error( |
|
87 |
"Can't get delegated store {}.", |
|
88 |
tileStructImage.getProviderName(), e); |
|
89 |
} finally { |
|
90 |
if(tileStore!=null){ |
|
91 |
tileStore.dispose(); |
|
92 |
} |
|
93 |
} |
|
60 |
colorInterpretation = (ColorInterpretation)tileStructImage.getColorInterpretation(); |
|
94 | 61 |
|
95 |
|
|
96 | 62 |
return colorInterpretation; |
97 | 63 |
} |
98 | 64 |
|
Also available in: Unified diff