Revision 13571
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/colortable/ColorTableListener.java | ||
---|---|---|
88 | 88 |
g.translate(0.0, (-(extent2.maxY() - y1) * zoom) * 2.0); |
89 | 89 |
} |
90 | 90 |
|
91 |
applyColorTable(rendering); |
|
91 |
applyColorTable(rendering, true);
|
|
92 | 92 |
try { |
93 | 93 |
rendering.draw(g, vp2); |
94 | 94 |
} catch (ArrayIndexOutOfBoundsException e) { |
... | ... | |
110 | 110 |
* @param rendering |
111 | 111 |
* @return |
112 | 112 |
*/ |
113 |
public void applyColorTable(Rendering rendering) { |
|
113 |
public void applyColorTable(Rendering rendering, boolean isPreview) {
|
|
114 | 114 |
RasterFilterList filterList = rendering.getFilterList(); |
115 | 115 |
RasterFilterListManager manager = new RasterFilterListManager(filterList); |
116 | 116 |
ColorTableListManager cManager = (ColorTableListManager) manager.getManagerByClass(ColorTableListManager.class); |
117 | 117 |
|
118 | 118 |
filterList.remove(ColorTableFilter.class); |
119 |
if (!isPreview) |
|
120 |
((FLyrRasterSE) getColorTablePanel().getLayer()).setLastLegend(null); |
|
119 | 121 |
|
120 | 122 |
if (getColorTablePanel().getCheckBoxEnabled().isSelected()) { |
121 | 123 |
filterList.remove(LinearEnhancementFilter.class); |
122 | 124 |
filterList.remove(TailTrimFilter.class); |
123 | 125 |
GridPalette gridPalette = colorTablePanel.getGridPalette(); |
124 | 126 |
cManager.addColorTableFilter(gridPalette); |
127 |
if (!isPreview) |
|
128 |
((FLyrRasterSE) getColorTablePanel().getLayer()).setLastLegend(gridPalette); |
|
125 | 129 |
} |
126 | 130 |
} |
127 | 131 |
|
... | ... | |
136 | 140 |
* ((IView)windows[i]).getTOC().refresh(); } |
137 | 141 |
*/ |
138 | 142 |
|
143 |
|
|
139 | 144 |
Rendering rendering = ((FLyrRasterSE) getColorTablePanel().getLayer()).getRender(); |
140 | 145 |
|
141 |
applyColorTable(rendering); |
|
142 |
|
|
146 |
applyColorTable(rendering, false);
|
|
147 |
//System.out.println("Terminada la carga"); |
|
143 | 148 |
getColorTablePanel().getLayer().getMapContext().invalidate(); |
149 |
//getColorTablePanel().getLayer().getMapContext().invalidate(); |
|
150 |
/* try { |
|
151 |
Thread.sleep(1000); |
|
152 |
} catch (InterruptedException e) { |
|
153 |
// TODO Auto-generated catch block |
|
154 |
e.printStackTrace(); |
|
155 |
}*/ |
|
156 |
//getColorTablePanel().getLayer().getMapContext().invalidate(); |
|
144 | 157 |
} |
145 | 158 |
|
146 | 159 |
/** |
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/legend/ColorTableLegend.java | ||
---|---|---|
46 | 46 |
* @return ColorTableLegend |
47 | 47 |
*/ |
48 | 48 |
public static ColorTableLegend createLegend(ColorTable colorTable) { |
49 |
if (colorTable == null) |
|
50 |
return null; |
|
51 |
|
|
49 | 52 |
SimpleLineSymbol line = new SimpleLineSymbol(); |
50 | 53 |
line.setLineColor(Color.BLACK); |
51 | 54 |
ISymbol[] symbol = new ISymbol[colorTable.getColorItems().size()]; |
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/layers/FLyrRasterSE.java | ||
---|---|---|
57 | 57 |
import org.gvsig.raster.grid.GridTransparency; |
58 | 58 |
import org.gvsig.raster.grid.filter.RasterFilterList; |
59 | 59 |
import org.gvsig.raster.grid.filter.RasterFilterListManager; |
60 |
import org.gvsig.raster.grid.filter.bands.ColorTableFilter; |
|
60 | 61 |
import org.gvsig.raster.grid.filter.bands.ColorTableListManager; |
61 | 62 |
import org.gvsig.raster.grid.filter.enhancement.EnhancementListManager; |
62 | 63 |
import org.gvsig.raster.grid.render.Rendering; |
... | ... | |
276 | 277 |
elm.addEnhancedFilter(false, stats, 0.0, getRender().getRenderBands()); |
277 | 278 |
} |
278 | 279 |
} |
279 |
|
|
280 |
System.out.println("initFilters....."); |
|
280 | 281 |
getRender().setFilterList(filterList); |
281 | 282 |
} |
282 | 283 |
|
... | ... | |
1107 | 1108 |
return this.getRender().existColorTable(); |
1108 | 1109 |
} |
1109 | 1110 |
|
1111 |
ILegend lastLegend = null; |
|
1110 | 1112 |
/** |
1113 |
* Define la ultima leyenda valida de la capa o se pone a null para que la |
|
1114 |
* capa busque una leyenda valida. |
|
1115 |
* @param ct |
|
1116 |
*/ |
|
1117 |
public void setLastLegend(ColorTable ct) { |
|
1118 |
lastLegend = ColorTableLegend.createLegend(ct); |
|
1119 |
} |
|
1120 |
|
|
1121 |
/** |
|
1111 | 1122 |
* Devuelve la Leyenda de la capa. |
1112 | 1123 |
* @return Leyenda. |
1113 | 1124 |
*/ |
1114 | 1125 |
public ILegend getLegend() { |
1126 |
if (lastLegend != null) |
|
1127 |
return lastLegend; |
|
1128 |
|
|
1115 | 1129 |
ColorTable ct = null; |
1116 |
|
|
1117 |
/*ColorTableFilter colorTableFilter = (ColorTableFilter) this.getRenderFilterList().getByName(ColorTableFilter.names[0]); |
|
1130 |
ColorTableFilter colorTableFilter = (ColorTableFilter) getRenderFilterList().getByName(ColorTableFilter.names[0]); |
|
1118 | 1131 |
if (colorTableFilter != null) { |
1119 | 1132 |
ColorTable ct2 = new GridPalette((ColorTable) colorTableFilter.getColorTable()); |
1120 |
if (ct2.getColorItems() != null) {
|
|
1133 |
if (ct2.getColorItems() != null) |
|
1121 | 1134 |
ct = ct2; |
1122 |
} |
|
1123 | 1135 |
} |
1124 | 1136 |
if (ct == null) |
1125 |
ct = this.getMultiRasterDataset().getColorTable(0);*/
|
|
1137 |
ct = this.getDataSource().getColorTables()[0];
|
|
1126 | 1138 |
|
1127 |
if (ct != null) |
|
1128 |
return ColorTableLegend.createLegend(ct); |
|
1129 |
return null; |
|
1139 |
return ColorTableLegend.createLegend(ct); |
|
1130 | 1140 |
} |
1131 | 1141 |
|
1132 | 1142 |
/* |
Also available in: Unified diff