Revision 6904
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.wms2/org.gvsig.raster.wms2.provider.legend/src/main/java/org/gvsig/raster/wms/provider/legend/WMSRasterGetLegend.java | ||
---|---|---|
26 | 26 |
import org.slf4j.LoggerFactory; |
27 | 27 |
|
28 | 28 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
29 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
|
30 |
import org.gvsig.raster.lib.legend.api.ColorTable; |
|
31 | 29 |
import org.gvsig.raster.lib.legend.api.RasterLegend; |
32 | 30 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
33 | 31 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
32 |
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation; |
|
33 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTable; |
|
34 | 34 |
import org.gvsig.raster.wms.provider.WMSRasterProvider; |
35 | 35 |
import org.gvsig.tools.ToolsLocator; |
36 | 36 |
import org.gvsig.tools.dynobject.DynClass; |
... | ... | |
86 | 86 |
invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME, null); |
87 | 87 |
|
88 | 88 |
legend= legendManager.createLegend(colorInterpretation); |
89 |
if ( !( colorInterpretation.isBGR() || colorInterpretation.isRGB() || colorInterpretation.isRGBA() ) ){ |
|
90 |
ColorTable colorTable=(ColorTable)provider. |
|
91 |
invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORTABLE_NAME, null); |
|
92 |
legend.setColorTable(colorTable); |
|
93 |
} |
|
94 | 89 |
|
95 | 90 |
return legend; |
96 | 91 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.wms2/org.gvsig.raster.wms2.provider.legend/src/main/java/org/gvsig/raster/wms/provider/legend/WMSRasterLegendLibrary.java | ||
---|---|---|
55 | 55 |
DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager() |
56 | 56 |
.getDefinition(WMSRasterProvider.METADATA_DEFINITION_NAME); |
57 | 57 |
WMSRasterGetLegend.register(metadataDefinition); |
58 |
WMSRasterGetColorTable.register(metadataDefinition); |
|
59 | 58 |
WMSRasterGetColorInterpretation.register(metadataDefinition); |
60 | 59 |
} |
61 | 60 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.wms2/org.gvsig.raster.wms2.provider.legend/src/main/java/org/gvsig/raster/wms/provider/legend/WMSRasterGetColorInterpretation.java | ||
---|---|---|
26 | 26 |
import org.slf4j.LoggerFactory; |
27 | 27 |
|
28 | 28 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
29 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
|
30 | 29 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
31 | 30 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
31 |
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation; |
|
32 | 32 |
import org.gvsig.tools.ToolsLocator; |
33 | 33 |
import org.gvsig.tools.dynobject.DynClass; |
34 | 34 |
import org.gvsig.tools.dynobject.DynMethod; |
... | ... | |
85 | 85 |
colorInterpretation = legendManager.createColorInterpretation(ColorInterpretation.ARGB); |
86 | 86 |
// } else { |
87 | 87 |
// colorInterpretation = legendManager.createColorInterpretation(ColorInterpretation.PALETTE); |
88 |
|
|
89 |
// //FIXME: |
|
90 |
// ColorTable colorTable; |
|
91 |
// |
|
92 |
// List<ColorTableClass> colorTableClasses=new ArrayList<ColorTableClass>(); |
|
93 |
// double[] minMax={0d,255d}; |
|
94 |
// |
|
95 |
// Double increment=1.0; |
|
96 |
// |
|
97 |
// for (int i=0;i<=255;i++){ |
|
98 |
// String className=i+""; |
|
99 |
// double value=((minMax[0]+(i*increment))); |
|
100 |
// double interpolation=50.0; |
|
101 |
// int intARGB = ((i & 0xFF) << 24) | // alpha |
|
102 |
// ((i & 0xFF) << 16) | // red |
|
103 |
// ((i & 0xFF) << 8) | // green |
|
104 |
// ((i & 0xFF) << 0); // blue |
|
105 |
// Color color=new Color(intARGB); |
|
106 |
// ColorTableClass colorTableClass = legendManager.createColorTableClass(className, value, interpolation, color); |
|
107 |
// colorTableClasses.add(colorTableClass); |
|
108 |
// } |
|
109 |
// colorTable = legendManager.createColorTable(OSMRasterProvider.NAME+"_color_table", |
|
110 |
// colorTableClasses, true); |
|
111 |
// colorInterpretation.setPalette(colorTable); |
|
112 |
// colorInterpretation.setPaletteBand(0); |
|
113 |
// |
|
114 |
|
|
88 | 115 |
// } |
89 | 116 |
|
90 | 117 |
return colorInterpretation; |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.wms2/org.gvsig.raster.wms2.provider.legend/src/main/java/org/gvsig/raster/wms/provider/legend/WMSRasterGetColorTable.java | ||
---|---|---|
30 | 30 |
import org.slf4j.LoggerFactory; |
31 | 31 |
|
32 | 32 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
33 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
|
34 |
import org.gvsig.raster.lib.legend.api.ColorTable; |
|
35 |
import org.gvsig.raster.lib.legend.api.ColorTableClass; |
|
36 | 33 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
37 | 34 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
35 |
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation; |
|
36 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTable; |
|
37 |
import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass; |
|
38 | 38 |
import org.gvsig.raster.wms.provider.WMSRasterProvider; |
39 | 39 |
import org.gvsig.tools.ToolsLocator; |
40 | 40 |
import org.gvsig.tools.dynobject.DynClass; |
... | ... | |
91 | 91 |
if ( !( colorInterpretation.isBGR() || colorInterpretation.isRGB() || colorInterpretation.isRGBA() ) ){ |
92 | 92 |
ColorTable colorTable; |
93 | 93 |
|
94 |
//FIXME: |
|
95 | 94 |
List<ColorTableClass> colorTableClasses=new ArrayList<ColorTableClass>(); |
96 |
double[] minMax={0d,255d}; //new double[2];
|
|
95 |
double[] minMax={0d,255d}; |
|
97 | 96 |
|
98 |
// gdalBand.ComputeRasterMinMax(minMax); |
|
99 |
Double increment=1.0; //(minMax[1]-minMax[0])/256; |
|
97 |
Double increment=1.0; |
|
100 | 98 |
|
101 |
|
|
102 |
// int i=0; |
|
103 |
// for(int r=0; r<=255; r+=32){ |
|
104 |
// for(int g=0; g<=255; g+=32){ |
|
105 |
// for(int b=0; b<=255; b+=64){ |
|
106 |
// String className=i+""; |
|
107 |
// double value=i; |
|
108 |
// double interpolation=50.0; |
|
109 |
// Color color=new Color(r,g,b); //intARGB); |
|
110 |
// ColorTableClass colorTableClass = rasterLegendManager.createColorTableClass(className, value, interpolation, color); |
|
111 |
// colorTableClasses.add(colorTableClass); |
|
112 |
// i++; |
|
113 |
// } |
|
114 |
// } |
|
115 |
// } |
|
116 |
|
|
117 | 99 |
for (int i=0;i<=255;i++){ |
118 | 100 |
String className=i+""; |
119 | 101 |
double value=((minMax[0]+(i*increment))); |
Also available in: Unified diff