Revision 2315 org.gvsig.raster.tilecache/branches/org.gvsig.raster.tilecache_dataaccess_refactoring/org.gvsig.raster.tilecache.io/src/main/java/org/gvsig/raster/tilecache/io/TileProvider.java

View differences:

TileProvider.java
562 562
		return null;
563 563
	}
564 564

  
565
	/**
566
	 * Reads a complete block of data and returns an tridimensional array of the right type. This function is useful
567
	 * to read a file very fast without setting a view. 
568
	 * 
569
	 * @param pos Posici?n donde se empieza  a leer
570
	 * @param blockHeight Altura m?xima del bloque leido
571
	 * @return Object que es un array tridimendional del tipo de datos del raster. (Bandas X Filas X Columnas)
572
	 * @throws InvalidSetViewException
573
	 * @throws FileNotOpenException
574
	 * @throws RasterDriverException
575
	 */
576 565
	public Object readBlock(int pos, int blockHeight, double scale) 
577 566
	throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException {
567
		//TODO: temporal hasta que haya un generador de estad?sticas parciales para realce.
568
		//Pongo este m?todo deprecated porque el objetivo es eliminarlo de los proveedores.
569
		if(provider.getBandCount() < getBandCount()) {
570
			switch (getDataType()[0]) {
571
			case Buffer.TYPE_BYTE:
572
				byte[][][] buf1 = (byte[][][])provider.readBlock(pos, blockHeight, scale);
573
				byte[][][] b1 = new byte[buf1.length + 1][][];
574
				for (int i = 0; i < buf1.length; i++) {
575
					b1[i] = buf1[i];
576
				}
577
				b1[b1.length - 1] = new byte[buf1[0].length][buf1[0][0].length];
578
				return b1;
579
			case Buffer.TYPE_SHORT:
580
				short[][][] buf2 = (short[][][])provider.readBlock(pos, blockHeight, scale);
581
				short[][][] b2 = new short[buf2.length + 1][][];
582
				for (int i = 0; i < buf2.length; i++) {
583
					b2[i] = buf2[i];
584
				}
585
				b2[b2.length - 1] = new short[buf2[0].length][buf2[0][0].length];
586
				return b2;
587
			case Buffer.TYPE_FLOAT:
588
				float[][][] buf3 = (float[][][])provider.readBlock(pos, blockHeight, scale);
589
				float[][][] b3 = new float[buf3.length + 1][][];
590
				for (int i = 0; i < buf3.length; i++) {
591
					b3[i] = buf3[i];
592
				}
593
				b3[b3.length - 1] = new float[buf3[0].length][buf3[0][0].length];
594
				return b3;
595
			case Buffer.TYPE_DOUBLE: 
596
				double[][][] buf4 = (double[][][])provider.readBlock(pos, blockHeight, scale);
597
				double[][][] b4 = new double[buf4.length + 1][][];
598
				for (int i = 0; i < buf4.length; i++) {
599
					b4[i] = buf4[i];
600
				}
601
				b4[b4.length - 1] = new double[buf4[0].length][buf4[0][0].length];
602
				return b4;
603
			case Buffer.TYPE_INT:
604
				int[][][] buf5 = (int[][][])provider.readBlock(pos, blockHeight, scale);
605
				int[][][] b5 = new int[buf5.length + 1][][];
606
				for (int i = 0; i < buf5.length; i++) {
607
					b5[i] = buf5[i];
608
				}
609
				b5[b5.length - 1] = new int[buf5[0].length][buf5[0][0].length];
610
				return b5;
611
			}
612
			
613
		}
578 614
		return provider.readBlock(pos, blockHeight, scale);
579 615
	}
580 616

  

Also available in: Unified diff