Revision 19498

View differences:

trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchEnhancementByteFilter.java
48 48
			}
49 49

  
50 50
			processValue(p, stretchs.gray, col, line, iBand);
51
			switch (iBand) {
52
			case 0:	processValue(p, scaleOffsetList[0], col, line, iBand);
53
					break;
54
			case 1:	processValue(p, scaleOffsetList[1], col, line, iBand);
55
					break;
56
			case 2:	processValue(p, scaleOffsetList[2], col, line, iBand);
57
					break;
58
			}
51
			processValue(p, scaleOffsetList[renderBands[iBand]], col, line, iBand);
59 52
		}
60 53
	}
61 54
	
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchEnhancementFloatFilter.java
43 43
			}
44 44
			
45 45
			processValue(p, stretchs.gray, col, line, iBand);
46
			switch (iBand) {
47
			case 0:	processValue(p, scaleOffsetList[0], col, line, iBand);
48
					break;
49
			case 1:	processValue(p, scaleOffsetList[1], col, line, iBand);
50
					break;
51
			case 2:	processValue(p, scaleOffsetList[2], col, line, iBand);
52
					break;
53
			}
46
			processValue(p, scaleOffsetList[renderBands[iBand]], col, line, iBand);
54 47
		}
55 48
	}
56 49

  
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchEnhancementDoubleFilter.java
43 43
			}
44 44

  
45 45
			processValue(p, stretchs.gray, col, line, iBand);
46
			switch (iBand) {
47
			case 0:	processValue(p, scaleOffsetList[0], col, line, iBand);
48
					break;
49
			case 1:	processValue(p, scaleOffsetList[1], col, line, iBand);
50
					break;
51
			case 2:	processValue(p, scaleOffsetList[2], col, line, iBand);
52
					break;
53
			}
46
			processValue(p, scaleOffsetList[renderBands[iBand]], col, line, iBand);
54 47
		}
55 48
	}
56 49

  
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchParams.java
110 110
		 */
111 111
		public void calcLinearScaleAndOffset() {
112 112
			if(stretchIn != null && stretchOut != null) {
113
				simplifyStretch();
113 114
				scale = new double[stretchIn.length - 1];
114 115
				offset = new double[stretchIn.length - 1];
115 116
				for (int i = 0; i < scale.length; i++) {
......
121 122
		}
122 123
		
123 124
		/**
125
		 * Elimina puntos redundantes en stretchIn y stretchOut
126
		 */
127
		private void simplifyStretch() {
128
			boolean simplified = false;
129
			for (int i = 0; i < (stretchIn.length - 1); i++) {
130
				if(stretchIn[i] == stretchIn[i + 1]) {
131
					double[] auxIn = new double[stretchIn.length -1];
132
					int[] auxOut = new int[stretchIn.length -1];
133
					for (int j = 0; j < auxIn.length; j++) {
134
						if(j <= i) {
135
							auxIn[j] = stretchIn[j];
136
							auxOut[j] = stretchOut[j];
137
						} else {
138
							auxIn[j] = stretchIn[j + 1];
139
							auxOut[j] = stretchOut[j + 1];
140
						}
141
							
142
					}
143
					stretchIn = auxIn;
144
					stretchOut = auxOut;
145
					simplified = true;
146
				}
147
			}
148
			if(simplified)
149
				simplifyStretch();
150
		}
151
		
152
		/**
124 153
		 * Asigna el m?ximo y el m?nimo
125 154
		 * @param stats
126 155
		 * @param type
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchEnhancementFilter.java
99 99
			exec = false;
100 100
		}
101 101

  
102
		if(raster.getDataType() != IBuffer.TYPE_BYTE)
103
			stretchs.rgb = false;
104
		
102 105
		stretchs.setMaxMin(stats);
103 106
		
104 107
		if(removeEnds)
......
127 130
	 */
128 131
	private void loadStretchList() {
129 132
		scaleOffsetList = new Stretch[3];
130
		switch (renderBands[0]) {
131
		case 0: scaleOffsetList[0] = stretchs.red;
132
				break;
133
		case 1: scaleOffsetList[0] = stretchs.green;
134
				break;
135
		case 2: scaleOffsetList[0] = stretchs.blue;
136
				break;
137
		default: scaleOffsetList[0] = stretchs.red;
138
		}
139
		switch (renderBands[1]) {
140
		case 0: scaleOffsetList[1] = stretchs.red;
141
				break;
142
		case 1: scaleOffsetList[1] = stretchs.green;
143
				break;
144
		case 2: scaleOffsetList[1] = stretchs.blue;
145
				break;
146
		default: scaleOffsetList[1] = stretchs.red;
147
		}
148
		switch (renderBands[2]) {
149
		case 0: scaleOffsetList[2] = stretchs.red;
150
				break;
151
		case 1: scaleOffsetList[2] = stretchs.green;
152
				break;
153
		case 2: scaleOffsetList[2] = stretchs.blue;
154
				break;
155
		default: scaleOffsetList[2] = stretchs.red;
156
		}		
133
		scaleOffsetList[0] = stretchs.red;
134
		scaleOffsetList[1] = stretchs.green;
135
		scaleOffsetList[2] = stretchs.blue;
157 136
	}
158 137

  
159 138
	/**
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchEnhancementIntFilter.java
43 43
			}
44 44

  
45 45
			processValue(p, stretchs.gray, col, line, iBand);
46
			switch (iBand) {
47
			case 0:	processValue(p, scaleOffsetList[0], col, line, iBand);
48
					break;
49
			case 1:	processValue(p, scaleOffsetList[1], col, line, iBand);
50
					break;
51
			case 2:	processValue(p, scaleOffsetList[2], col, line, iBand);
52
					break;
53
			}
46
			processValue(p, scaleOffsetList[renderBands[iBand]], col, line, iBand);
54 47
		}
55 48
	}
56 49
	
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/enhancement/LinearStretchEnhancementShortFilter.java
43 43
			}
44 44

  
45 45
			processValue(p, stretchs.gray, col, line, iBand);
46
			if(iBand == renderBands[0])
47
				processValue(p, scaleOffsetList[0], col, line, iBand);
48
			if(iBand == renderBands[1])
49
				processValue(p, scaleOffsetList[1], col, line, iBand);
50
			if(iBand == renderBands[2])
51
				processValue(p, scaleOffsetList[2], col, line, iBand);
52

  
46
			processValue(p, scaleOffsetList[renderBands[iBand]], col, line, iBand);
53 47
		}
54 48

  
55 49
	}

Also available in: Unified diff