Revision 21003

View differences:

trunk/libraries/libRaster/src/org/gvsig/raster/dataset/properties/DatasetStatistics.java
36 36
import org.gvsig.raster.process.RasterTask;
37 37
import org.gvsig.raster.process.RasterTaskQueue;
38 38
import org.gvsig.raster.util.RasterUtilities;
39

  
40

  
41 39
/**
42 40
 * Estadisticas asociadas a un fichero raster.
43 41
 *  
......
50 48
	 * tener unas estad?sticas calculadas a partir de una petici?n con subsampleo. Hay que tener en
51 49
	 * cuenta que el raster puede ser muy grande y este calculo muy costoso.
52 50
	 */
53
	protected boolean   		complete = false;
54
	protected double[] 			max = null;
55
	protected double[] 			min = null;
56
	protected double[] 			secondMax = null;
57
	protected double[] 			secondMin = null;
58
	
59
	protected double[] 			maxRGB = null;
60
	protected double[] 			minRGB = null;
61
	protected double[] 			secondMaxRGB = null;
62
	protected double[] 			secondMinRGB = null;
63
	
64
	protected double[] 			mean = null;
65
	protected double[] 			variance = null;
51
	protected boolean       complete       = false;
52
	protected double[]      max            = null;
53
	protected double[]      min            = null;
54
	protected double[]      secondMax      = null;
55
	protected double[]      secondMin      = null;
66 56

  
67
	protected String    		fName = null;
68
	protected RasterDataset		dataset = null;
69
	protected boolean   		calculated = false;
70
	protected Hashtable			tailTrim = new Hashtable();
71
	protected ArrayList			tailTrimValues = new ArrayList();
72
	private int 				bandCount = 0;
73
	private int 				percent = 0;
74
	private boolean             forceToRecalc = false;
57
	protected double[]      maxRGB         = null;
58
	protected double[]      minRGB         = null;
59
	protected double[]      secondMaxRGB   = null;
60
	protected double[]      secondMinRGB   = null;
61

  
62
	protected double[]      mean           = null;
63
	protected double[]      variance       = null;
64

  
65
	protected String        fName          = null;
66
	protected RasterDataset dataset        = null;
67
	protected boolean       calculated     = false;
68
	protected Hashtable     tailTrim       = new Hashtable();
69
	protected ArrayList     tailTrimValues = new ArrayList();
70
	private int             bandCount      = 0;
71
	private int             percent        = 0;
72
	private boolean         forceToRecalc  = false;
75 73
	
76 74
	/**
77 75
	 * Constructor. Asigna el fichero asociado.
......
230 228
	 *  (non-Javadoc)
231 229
	 * @see org.gvsig.fmap.driver.IStatistics#getMaximun()
232 230
	 */
233
	public double getMaximun(){
231
	public double getMaximun() {
234 232
		double m = Double.NEGATIVE_INFINITY;
235
		for(int i = 0; i < max.length; i++)
233
		for (int i = 0; i < max.length; i++)
236 234
			m = Math.max(m, max[i]);
237 235
		return m;
238 236
	}
......
241 239
	 *  (non-Javadoc)
242 240
	 * @see org.gvsig.fmap.driver.IStatistics#getMinimun()
243 241
	 */
244
	public double getMinimun(){
242
	public double getMinimun() {
245 243
		double m = Double.MAX_VALUE;
246
		for(int i = 0; i < min.length; i++)
244
		for (int i = 0; i < min.length; i++)
247 245
			m = Math.min(m, min[i]);
248 246
		return m;
249 247
	}
248
	
249
	/*
250
	 * (non-Javadoc)
251
	 * @see org.gvsig.raster.hierarchy.IStatistics#getMaximunRGB()
252
	 */
253
	public double getMaximunRGB() {
254
		double m = Double.NEGATIVE_INFINITY;
255
		for (int i = 0; i < maxRGB.length; i++)
256
			m = Math.max(m, maxRGB[i]);
257
		return m;
258
	}
250 259

  
251 260
	/*
261
	 * (non-Javadoc)
262
	 * @see org.gvsig.raster.hierarchy.IStatistics#getMinimunRGB()
263
	 */
264
	public double getMinimunRGB() {
265
		double m = Double.MAX_VALUE;
266
		for (int i = 0; i < minRGB.length; i++)
267
			m = Math.min(m, minRGB[i]);
268
		return m;
269
	}
270

  
271
	/*
252 272
	 *  (non-Javadoc)
253 273
	 * @see org.gvsig.fmap.driver.IStatistics#getMean()
254 274
	 */
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/bands/ColorTableFilter.java
140 140
	 * @return GridPalette
141 141
	 */
142 142
	public GridPalette getColorTable() {
143
		if ((colorTable == null) || (colorTable.getColorItems() == null))
144
			colorTable = ((GridPalette) params.get("colorTable"));
143 145
		return colorTable;
144 146
	}
145 147

  
......
150 152
	public int getInRasterDataType() {
151 153
		return 0;
152 154
	}
155

  
156
	/**
157
	 * Define la tabla de color
158
	 * @param colorTable the colorTable to set
159
	 */
160
	public void setColorTable(GridPalette colorTable) {
161
		this.colorTable = colorTable;
162
	}
153 163
}
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/ColorItem.java
85 85
	 * @param value
86 86
	 */
87 87
	public void setValue(double value) {
88
		if (Double.isNaN(value))
89
			return;
88 90
		this.value = value;
89 91
	}
90 92

  
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/ColorTable.java
127 127

  
128 128
		// Genera la paleta final para poder ser usada
129 129
		applyPalette(colorItems);
130

  
131
		// Borra valores duplicados
132
		removeDuplicatedValues();
130 133
	}
131 134

  
132 135
	private boolean isEqualColor(Color c1, Color c2, int error) {
trunk/libraries/libRaster/src/org/gvsig/raster/hierarchy/IStatistics.java
61 61
	public double getMinimun();
62 62

  
63 63
	/**
64
	 * Devuelve el m?ximo valor RGB de todos los m?ximos de las bandas
65
	 * @return M?ximo
66
	 */
67
	public double getMaximunRGB();
68
	
69
	/**
70
	 * Devuelve el m?nimo valor RGB de todos los m?nimos de las bandas
71
	 * @return M?ximo
72
	 */
73
	public double getMinimunRGB();
74

  
75
	/**
64 76
	 * Obtiene el valor m?dio
65 77
	 * @return Valor medio
66 78
	 */

Also available in: Unified diff