Revision 19491 trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/EcualizationManager.java

View differences:

EcualizationManager.java
58 58
	 * @param IStatistics
59 59
	 * @throws FilterTypeException 
60 60
	 */
61
	public void addEcualizationFilter(IStatistics stats, int[] renderBands, Histogram hist) throws FilterTypeException {
61
	public void addEcualizationFilter(IStatistics stats, int[] renderBands, Histogram hist, int[] ecualizedBands) throws FilterTypeException {
62 62
		try {
63 63
			if (!stats.isCalculated()) {
64 64
				try {
......
72 72
				}
73 73
			}
74 74

  
75
			RasterFilter filter = createEnhancedFilter(stats, renderBands, hist);
75
			RasterFilter filter = createEnhancedFilter(stats, renderBands, hist, ecualizedBands);
76 76
			if (filter != null)
77 77
				filterList.add(filter);
78 78
		} catch (InterruptedException e) {
......
86 86
	 * @param renderBands
87 87
	 * @return
88 88
	 */
89
	public static RasterFilter createEnhancedFilter(IStatistics stats, int[] renderBands, Histogram hist) {
89
	public static RasterFilter createEnhancedFilter(IStatistics stats, int[] renderBands, Histogram hist, int[] ecualizedBands) {
90 90
		RasterFilter filter = new EcualizationByteFilter();
91 91
		if (filter != null) {
92 92
			filter.addParam("stats", stats);
93 93
			filter.addParam("renderBands", renderBands);
94 94
			filter.addParam("histogram", hist);
95
			filter.addParam("ecualizedBands", ecualizedBands);
95 96
		}
96 97
		return filter;
97 98
	}
......
129 130
	public void addFilter(Class classFilter, Params params) throws FilterTypeException {
130 131
		if (classFilter.equals(EcualizationFilter.class)) {
131 132
			int[] renderBands = { 0, 1, 2 };
133
			int[] ecualizedBands = { 0, 1, 2 };
132 134
			Histogram hist = null;
133 135
			for (int i = 0; i < params.getNumParams(); i++) {
134 136
				if (params.getParam(i).id.equals("RenderBands") && 
......
143 145
					params.getParam(i).defaultValue instanceof Histogram) {
144 146
					hist = (Histogram)params.getParam(i).defaultValue;
145 147
				}
148
				if (params.getParam(i).id.equals("EcualizedBands") &&
149
					params.getParam(i).defaultValue instanceof int[]) {
150
					ecualizedBands = (int[])params.getParam(i).defaultValue;
151
				}
146 152
			}
147 153

  
148
			addEcualizationFilter((IStatistics) filterList.getEnvParam("IStatistics"), renderBands, hist);
154
			addEcualizationFilter((IStatistics) filterList.getEnvParam("IStatistics"), renderBands, hist, ecualizedBands);
149 155
		}
150 156
	}
151 157
}

Also available in: Unified diff