Revision 2310

View differences:

org.gvsig.raster/branches/org.gvsig.raster_dataaccess_refactoring/org.gvsig.raster.lib/org.gvsig.raster.lib.api/src/main/java/org/gvsig/fmap/dal/coverage/store/props/ColorInterpretation.java
150 150
	public void addColorInterpretation(ColorInterpretation ci);
151 151
	
152 152
	/**
153
	 * Returns an array with bands to render reading values of this color
154
	 * interpretation object. Each element in the array represents band in the destination buffer
155
	 * . The value in this position represents the source band which will be write 
156
	 * in the destination buffer 
157
	 * @return
158
	 */
159
	public int[] getRenderBandsFromColorInterpretation();
160
	
161
	/**
153 162
	 * Clones this object
154 163
	 * @return
155 164
	 */
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/store/properties/DataStoreColorInterpretation.java
317 317
		return true;
318 318
	}
319 319
	
320
	public int[] getRenderBandsFromColorInterpretation() {
321
		if(colorInterpretation == null)
322
			return null;
323
		int[] renderBands = new int[]{-1, -1, -1, -1};
324
		for (int i = 0; i < colorInterpretation.length; i++) {
325
			if(colorInterpretation[i].equals(RED_BAND))
326
				renderBands[0] = i;
327
			if(colorInterpretation[i].equals(GREEN_BAND))
328
				renderBands[1] = i;
329
			if(colorInterpretation[i].equals(BLUE_BAND))
330
				renderBands[2] = i;
331
			if(colorInterpretation[i].equals(GRAY_BAND))
332
				renderBands[0] = renderBands[1] = renderBands[2] = i;
333
		}
334
		
335
		//Ojo! esto no puede hacerse en el bucle anterior pq no detectaria bien casos 
336
		//como ALPHA_BAND, GRAY_BAND
337
		for (int i = 0; i < colorInterpretation.length; i++) {
338
			if(colorInterpretation[i].equals(ALPHA_BAND))
339
				renderBands[3] = i;
340
		}
341
		return renderBands;
342
	}
343
	
320 344
	public ColorInterpretation cloneColorInterpretation() {
321 345
		DataStoreColorInterpretation ci = new DataStoreColorInterpretation();
322 346
		String[] l = new String[colorInterpretation.length];

Also available in: Unified diff