Revision 6903 org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.googlemaps/org.gvsig.raster.googlemaps.provider.legend/src/main/java/org/gvsig/raster/googlemaps/provider/legend/GoogleMapsRasterGetColorInterpretation.java
GoogleMapsRasterGetColorInterpretation.java | ||
---|---|---|
24 | 24 |
package org.gvsig.raster.googlemaps.provider.legend; |
25 | 25 |
|
26 | 26 |
|
27 |
import java.awt.Color; |
|
28 |
import java.util.ArrayList; |
|
29 |
import java.util.List; |
|
30 |
|
|
27 | 31 |
import org.slf4j.LoggerFactory; |
28 | 32 |
|
29 | 33 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
30 | 34 |
import org.gvsig.raster.googlemaps.provider.GoogleMapsRasterProvider; |
31 | 35 |
import org.gvsig.raster.googlemaps.provider.GoogleMapsRasterProviderParameters; |
32 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
|
33 | 36 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
34 | 37 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
38 |
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation; |
|
39 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTable; |
|
40 |
import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass; |
|
35 | 41 |
import org.gvsig.tools.ToolsLocator; |
36 | 42 |
import org.gvsig.tools.dynobject.DynClass; |
37 | 43 |
import org.gvsig.tools.dynobject.DynMethod; |
... | ... | |
74 | 80 |
} |
75 | 81 |
|
76 | 82 |
@Override |
77 |
public Object invoke(DynObject self, Object[] args) |
|
78 |
throws DynMethodException { |
|
83 |
public Object invoke(DynObject self, Object[] args) throws DynMethodException { |
|
79 | 84 |
ColorInterpretation colorInterpretation = null; |
80 | 85 |
|
81 | 86 |
RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager(); |
... | ... | |
86 | 91 |
colorInterpretation = legendManager.createColorInterpretation(ColorInterpretation.ARGB); |
87 | 92 |
} else { |
88 | 93 |
colorInterpretation = legendManager.createColorInterpretation(ColorInterpretation.PALETTE); |
94 |
|
|
95 |
//FIXME: |
|
96 |
List<ColorTableClass> colorTableClasses=new ArrayList<ColorTableClass>(); |
|
97 |
double[] minMax={0d,255d}; //new double[2]; |
|
98 |
|
|
99 |
Double increment=1.0; |
|
100 |
|
|
101 |
for (int i=0;i<=255;i++){ |
|
102 |
String className=i+""; |
|
103 |
double value=((minMax[0]+(i*increment))); |
|
104 |
double interpolation=50.0; |
|
105 |
int intARGB = ((i & 0xFF) << 24) | // alpha |
|
106 |
((i & 0xFF) << 16) | // red |
|
107 |
((i & 0xFF) << 8) | // green |
|
108 |
((i & 0xFF) << 0); // blue |
|
109 |
Color color=new Color(intARGB); |
|
110 |
ColorTableClass colorTableClass = legendManager.createColorTableClass(className, value, interpolation, color); |
|
111 |
colorTableClasses.add(colorTableClass); |
|
112 |
} |
|
113 |
ColorTable colorTable = legendManager.createColorTable(GoogleMapsRasterProvider.NAME+"_color_table", |
|
114 |
colorTableClasses, true); |
|
115 |
|
|
116 |
colorInterpretation.setPalette(colorTable); |
|
117 |
colorInterpretation.setPaletteBand(0); |
|
89 | 118 |
} |
90 | 119 |
|
91 | 120 |
return colorInterpretation; |
Also available in: Unified diff