Revision 2093 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/io/GdalFile.java

View differences:

GdalFile.java
227 227
  		int white = Color.BLUE.getRGB(), i2=0, i=0;
228 228
  		float j =0F;
229 229
  		
230
  		if (dataType == GDT_CInt16 || dataType == GDT_Int16  || dataType == GDT_UInt16)
231
  			if (g == null) // Sibgle Band (Typical DEM)
230
  		if (dataType == GDT_CInt16 || dataType == GDT_Int16  || dataType == GDT_UInt16){
231
  			if (g == null){ // Sibgle Band (Typical DEM)
232 232
	      		/*for (i=0, j=0F, i2 = 1; i<currentViewWidth && i2<r.length;
233 233
	      			i++, j+=step, i2 = (((int) j)*2)+1) {
234 234
	      			line[i] = a + ((r[i2-1]) << 8) + r[i2];
235 235
	      		}*/
236
  				for (int k=0; k<3; k++)
236
  				for (int k=0; k<4; k++){
237 237
  					for (i=0, j=0F; i<currentViewWidth && j<r.getSize(); i++, j+=step) {
238
  						line[i][k] = (r.buffShort[(int) j] & 0xffff);
238
  						if(k<3)
239
  							line[i][k] = (r.buffShort[(int) j] & 0xffff);
240
  						else
241
  							line[i][3] = 0xff;
242
  					}
239 243
	      		}
240
  			else { // Multiband
244
  				
245
  			}else { // Multiband
241 246
  				short px;
242 247
  				//System.err.println("readLine(): Raster 16bits multibanda");
243 248
  				GdalBuffer [] bands = {r,g,b};
244
  				for (int k=0; k<3; k++)
245
		      		for (i=0, j=0F; i<currentViewWidth && j<r.getSize(); i++, j+=step)
246
		      			line[i][k] = (bands[k].buffShort[(int) j] & 0xffff);
249
  				for (int k=0; k<4; k++){
250
		      		for (i=0, j=0F; i<currentViewWidth && j<r.getSize(); i++, j+=step){
251
		      			if(k<3)
252
		      				line[i][k] = (bands[k].buffShort[(int) j] & 0xffff);
253
		      			else
254
		      				line[i][3] = 0xff;
255
		      		}
256
  				}
247 257
  			}
258
  		}
248 259
		return;
249 260
	}
250 261
	
......
530 541
		file.setView(v.minX(), v.maxY(), v.maxX(), v.minY(),
531 542
			width, height);
532 543
		
533
		raster = new RasterBuf(DataBuffer.TYPE_INT, width, height, 3, new Point(0,0));
544
		raster = new RasterBuf(DataBuffer.TYPE_INT, width, height, 4, new Point(0,0));
534 545
		try {
535 546
			//int nLin = height % BAND_HEIGHT;
536 547
			file.setAlpha(getAlpha());

Also available in: Unified diff