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