gvsig-raster / 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 / TileCacheGetColorTable.java @ 6899
History | View | Annotate | Download (2.29 KB)
1 |
package org.gvsig.raster.tilecache.provider.legend; |
---|---|
2 |
|
3 |
import org.slf4j.LoggerFactory; |
4 |
|
5 |
import org.gvsig.fmap.dal.exception.DataException; |
6 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
7 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
8 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
9 |
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException; |
10 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTable; |
11 |
import org.gvsig.raster.tilecache.provider.TileCacheStoreProvider; |
12 |
import org.gvsig.raster.tilecache.provider.TileStructImage; |
13 |
import org.gvsig.tools.ToolsLocator; |
14 |
import org.gvsig.tools.dynobject.DynClass; |
15 |
import org.gvsig.tools.dynobject.DynMethod; |
16 |
import org.gvsig.tools.dynobject.DynObject; |
17 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
18 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
19 |
|
20 |
/**
|
21 |
* Dynamic method to add a get Color Table funcionality
|
22 |
* @author dmartinezizquierdo
|
23 |
*
|
24 |
*/
|
25 |
public class TileCacheGetColorTable implements DynMethod { |
26 |
|
27 |
final static private org.slf4j.Logger logger = LoggerFactory.getLogger(TileCacheGetColorInterpretation.class); |
28 |
|
29 |
private static Integer code = null; |
30 |
|
31 |
static void register(DynClass storeClass) { |
32 |
if (code != null) { |
33 |
return;
|
34 |
} |
35 |
code = ToolsLocator.getDynObjectManager() |
36 |
.registerDynMethod(storeClass, new TileCacheGetColorTable());
|
37 |
|
38 |
} |
39 |
|
40 |
@Override
|
41 |
public int getCode() throws DynMethodNotSupportedException { |
42 |
return code;
|
43 |
} |
44 |
|
45 |
@Override
|
46 |
public String getDescription() { |
47 |
return "Raster GDAL Color Table"; |
48 |
} |
49 |
|
50 |
@Override
|
51 |
public String getName() { |
52 |
return RasterStore.DYNMETHOD_GETCOLORTABLE_NAME;
|
53 |
} |
54 |
|
55 |
@Override
|
56 |
public Object invoke(DynObject self, Object[] args) |
57 |
throws DynMethodException {
|
58 |
ColorTable colorTable = null;
|
59 |
|
60 |
TileCacheStoreProvider tileCacheStoreProvider = |
61 |
(TileCacheStoreProvider) self; |
62 |
TileStructImage tileStructImage = tileCacheStoreProvider.getTileStructImage(); |
63 |
|
64 |
colorTable = (ColorTable)tileStructImage.getColorTable(); |
65 |
|
66 |
return colorTable;
|
67 |
|
68 |
} |
69 |
|
70 |
@Override
|
71 |
public TileCacheGetColorTable clone() throws CloneNotSupportedException { |
72 |
return (TileCacheGetColorTable) super.clone(); |
73 |
} |
74 |
} |