Revision 2341 org.gvsig.raster/branches/org.gvsig.raster_dataaccess_refactoring/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/grid/filter/enhancement/EnhancementStretchListManager.java
EnhancementStretchListManager.java | ||
---|---|---|
34 | 34 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilter; |
35 | 35 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilterList; |
36 | 36 |
import org.gvsig.fmap.dal.coverage.store.props.Statistics; |
37 |
import org.gvsig.raster.impl.datastruct.DefaultStretch; |
|
38 | 37 |
import org.gvsig.raster.impl.grid.filter.RasterFilterListManagerImpl; |
39 | 38 |
import org.gvsig.raster.impl.grid.filter.statistics.StatisticsListManager; |
40 | 39 |
import org.gvsig.raster.impl.store.ParamImpl; |
... | ... | |
46 | 45 |
public class EnhancementStretchListManager extends AbstractRasterFilterManager { |
47 | 46 |
private static String ID = "EnhancementStretch"; |
48 | 47 |
private RasterFilterListManagerImpl filterListManager = null; |
49 |
private Statistics stats = null; |
|
48 |
//private Statistics stats = null;
|
|
50 | 49 |
|
51 | 50 |
/** |
52 | 51 |
* Default constructor. Sets the filter list. |
... | ... | |
54 | 53 |
*/ |
55 | 54 |
public EnhancementStretchListManager(RasterFilterList filterList) { |
56 | 55 |
super(filterList); |
57 |
stats = (Statistics)filterList.getEnvParam("SrcStatistics"); |
|
56 |
//stats = (Statistics)filterList.getEnvParam("SrcStatistics");
|
|
58 | 57 |
} |
59 | 58 |
|
60 | 59 |
public String getManagerID() { |
... | ... | |
72 | 71 |
public EnhancementStretchListManager(RasterFilterListManagerImpl filterListManager) { |
73 | 72 |
super(filterListManager.getFilterList()); |
74 | 73 |
this.filterListManager = filterListManager; |
75 |
stats = (Statistics)getFilterList().getEnvParam("SrcStatistics"); |
|
74 |
//stats = (Statistics)getFilterList().getEnvParam("SrcStatistics");
|
|
76 | 75 |
} |
77 | 76 |
|
78 | 77 |
public Class<?> getFilterClassByID(String id) { |
... | ... | |
81 | 80 |
return null; |
82 | 81 |
} |
83 | 82 |
|
84 |
/** |
|
85 |
* Asigna el objeto con las estadisticas. |
|
86 |
* @param stats |
|
87 |
*/ |
|
88 |
public void setStatistics(Statistics stats) { |
|
89 |
this.stats = stats; |
|
90 |
} |
|
91 |
|
|
92 | 83 |
public boolean isDataTypeSupported(int dataType) { |
93 | 84 |
return true; |
94 | 85 |
} |
... | ... | |
125 | 116 |
} else { |
126 | 117 |
StatisticsListManager slm = null; |
127 | 118 |
if(filterListManager != null) |
128 |
slm = new StatisticsListManager(filterListManager, stats);
|
|
119 |
slm = new StatisticsListManager(filterListManager/*, stats*/);
|
|
129 | 120 |
else |
130 | 121 |
slm = new StatisticsListManager(getFilterList()); |
131 | 122 |
slm.addTailFilter(leParams.getTailTrimList(), 0D, removeEnds, stats); |
... | ... | |
195 | 186 |
* @param values |
196 | 187 |
* @return |
197 | 188 |
*/ |
198 |
private String convertArrayToString(double[] values) { |
|
189 |
/*private String convertArrayToString(double[] values) {
|
|
199 | 190 |
StringBuffer buffer = new StringBuffer(); |
200 | 191 |
for (int i = 0; i < values.length; i++) { |
201 | 192 |
buffer.append(values[i]); |
... | ... | |
203 | 194 |
buffer.append(","); |
204 | 195 |
} |
205 | 196 |
return buffer.toString(); |
206 |
} |
|
197 |
}*/
|
|
207 | 198 |
|
208 | 199 |
/** |
209 | 200 |
* Convierte una array de enteros a una cadena |
210 | 201 |
* @param values |
211 | 202 |
* @return |
212 | 203 |
*/ |
213 |
private String convertArrayToString(int[] values) { |
|
204 |
/*private String convertArrayToString(int[] values) {
|
|
214 | 205 |
StringBuffer buffer = new StringBuffer(); |
215 | 206 |
for (int i = 0; i < values.length; i++) { |
216 | 207 |
buffer.append(values[i]); |
... | ... | |
218 | 209 |
buffer.append(","); |
219 | 210 |
} |
220 | 211 |
return buffer.toString(); |
221 |
} |
|
212 |
}*/
|
|
222 | 213 |
|
223 | 214 |
/** |
224 | 215 |
* Convierte una cadena a un array de enteros |
225 | 216 |
* @param from |
226 | 217 |
* @return |
227 | 218 |
*/ |
228 |
private int[] StringToIntegerArray(String from) { |
|
219 |
/*private int[] StringToIntegerArray(String from) {
|
|
229 | 220 |
String[] valueList = from.split(","); |
230 | 221 |
int[] values = new int[valueList.length]; |
231 | 222 |
for (int i = 0; i < values.length; i++) |
... | ... | |
234 | 225 |
} catch (NumberFormatException e) { |
235 | 226 |
} |
236 | 227 |
return values; |
237 |
} |
|
228 |
}*/
|
|
238 | 229 |
|
239 | 230 |
/** |
240 | 231 |
* Convierte una cadena a un array de dobles |
241 | 232 |
* @param from |
242 | 233 |
* @return |
243 | 234 |
*/ |
244 |
private double[] StringToDoubleArray(String from) { |
|
235 |
/*private double[] StringToDoubleArray(String from) {
|
|
245 | 236 |
String[] valueList = from.split(","); |
246 | 237 |
double[] values = new double[valueList.length]; |
247 | 238 |
for (int i = 0; i < values.length; i++) |
... | ... | |
250 | 241 |
} catch (NumberFormatException e) { |
251 | 242 |
} |
252 | 243 |
return values; |
253 |
} |
|
244 |
}*/
|
|
254 | 245 |
|
255 | 246 |
/** |
256 | 247 |
* Guarda en el array de valores, todos los valores del objeto Strech para ser |
... | ... | |
259 | 250 |
* @param band |
260 | 251 |
* @param stretch |
261 | 252 |
*/ |
262 |
private void putStretchBand(List<String> filterList, String band, DefaultStretch stretch) { |
|
253 |
/*private void putStretchBand(List<String> filterList, String band, DefaultStretch stretch) {
|
|
263 | 254 |
filterList.add("filter.linearstretchenhancement." + band + ".maxValue=" + stretch.maxValue); |
264 | 255 |
filterList.add("filter.linearstretchenhancement." + band + ".minValue=" + stretch.minValue); |
265 | 256 |
if (stretch.offset != null) |
... | ... | |
276 | 267 |
filterList.add("filter.linearstretchenhancement." + band + ".tailTrimValueMin=" + stretch.tailTrimValueMin); |
277 | 268 |
filterList.add("filter.linearstretchenhancement." + band + ".functionType=" + stretch.functionType); |
278 | 269 |
filterList.add("filter.linearstretchenhancement." + band + ".valueFunction=" + stretch.valueFunction); |
279 |
} |
|
270 |
}*/
|
|
280 | 271 |
|
281 | 272 |
/** |
282 | 273 |
* Obtiene un Array de Strings a partir de una pila de filtros. Cada elemento |
283 | 274 |
* del array tendr� la forma de elemento=valor. |
284 | 275 |
*/ |
285 |
public List<String> getStringsFromFilterList(List<String> filterList, RasterFilter rf) { |
|
276 |
/*public List<String> getStringsFromFilterList(List<String> filterList, RasterFilter rf) {
|
|
286 | 277 |
if (rf instanceof LinearStretchEnhancementFilter) { |
287 | 278 |
LinearStretchEnhancementFilter filter = (LinearStretchEnhancementFilter) rf; |
288 | 279 |
DefaultLinearStretchParams stretchs = (DefaultLinearStretchParams) filter.getParam("stretchs"); |
... | ... | |
298 | 289 |
} |
299 | 290 |
|
300 | 291 |
return filterList; |
301 |
} |
|
292 |
}*/
|
|
302 | 293 |
|
303 | 294 |
/** |
304 | 295 |
* Configura algun parametro del objeto Stretch, respecto a una banda, su |
... | ... | |
311 | 302 |
* @param stretch |
312 | 303 |
* @return |
313 | 304 |
*/ |
314 |
public boolean getStretchBand(String band, String property, String value, DefaultStretch stretch) {
|
|
305 |
/*private boolean getStretchBand(String band, String property, String value, DefaultStretch stretch) {
|
|
315 | 306 |
if (property.startsWith("filter.linearstretchenhancement." + band)) { |
316 | 307 |
if (property.startsWith("filter.linearstretchenhancement." + band + ".maxValue")) { |
317 | 308 |
stretch.maxValue = Double.parseDouble(value); |
... | ... | |
412 | 403 |
lsef.setExec(exec); |
413 | 404 |
} |
414 | 405 |
return filteri; |
415 |
} |
|
406 |
}*/
|
|
416 | 407 |
|
408 |
/** |
|
409 |
* Asigna el objeto con las estadisticas. |
|
410 |
* @param stats |
|
411 |
*/ |
|
412 |
/*public void setStatistics(Statistics stats) { |
|
413 |
this.stats = stats; |
|
414 |
}*/ |
|
415 |
|
|
417 | 416 |
public List<Class<?>> getRasterFilterList() { |
418 | 417 |
List<Class<?>> filters = new ArrayList<Class<?>>(); |
419 | 418 |
filters.add(LinearStretchEnhancementFilter.class); |
Also available in: Unified diff