Revision 7847 branches/v10/libraries/libjni-gdal/src-test/example.java

View differences:

example.java
66 66

  
67 67
import es.gva.cit.jgdal.Gdal;
68 68
import es.gva.cit.jgdal.GdalBuffer;
69
import es.gva.cit.jgdal.GdalColorEntry;
70
import es.gva.cit.jgdal.GdalColorTable;
69 71
import es.gva.cit.jgdal.GdalException;
70 72
import es.gva.cit.jgdal.GdalRasterBand;
71 73
import es.gva.cit.jgdal.GeoTransform;
......
153 155
	  	int tipo=0;
154 156
	  	try{
155 157
	  		mirasterband = migdal.getRasterBand(iBand+1);
156
	  		System.out.println("SIZE BANDA=("+mirasterband.getRasterBandXSize()+","+mirasterband.getRasterBandYSize()+")");
157
	  		System.out.println("SIZE BLOQUE BANDA=("+mirasterband.getBlockXSize()+","+mirasterband.getBlockYSize()+")");
158
	  		System.out.println("Band Size: ("+mirasterband.getRasterBandXSize()+","+mirasterband.getRasterBandYSize()+")");
159
	  		System.out.println("Block Size: ("+mirasterband.getBlockXSize()+","+mirasterband.getBlockYSize()+")");
158 160
	  		noverviews = mirasterband.getOverviewCount();
159
	  		System.out.println("N? OVERVIEWS="+noverviews);
161
	  		System.out.println("Number of Overview: "+noverviews);
160 162
	  		tipo = mirasterband.getRasterDataType();
161
	  		System.out.println("TIPO DE DATOS BANDA="+tipo);
163
	  		System.out.println("Band data type: "+tipo);
162 164
	  		double noData = mirasterband.getRasterNoDataValue();
163 165
	  		if(noData >= 0)
164
	  			System.out.println("NODATA="+noData);
166
	  			System.out.println("NoData="+noData);
165 167
	  		String[] metadata = mirasterband.getMetadata();
166 168
		    if(metadata.length > 0){
167 169
		    	System.out.println("-METADATA-");
168 170
		    	for(int i=0;i<metadata.length;i++)
169 171
		    		System.out.println(metadata[i]);
170 172
		    }
173
		    
174
		    //Palette
175
		    String colorInt = migdal.getColorInterpretationName(mirasterband.getRasterColorInterpretation());
176
		    System.out.println("ColorInterpretation: "+colorInt);
177
		    if(colorInt.equals("Palette")){
178
		    	GdalColorTable table = mirasterband.getRasterColorTable();
179
		    	System.out.println("Number of entries: "+table.getColorEntryCount());
180
		    	for(int nEntry = 0; nEntry < table.getColorEntryCount(); nEntry++ ){
181
		                GdalColorEntry	sEntry;
182
		                sEntry = table.getColorEntryAsRGB(nEntry);
183
		                System.out.println( 
184
		                		nEntry + " (" +
185
		                        sEntry.c1 + ", " +
186
		                        sEntry.c2 + ", " +
187
		                        sEntry.c3 + ", " +
188
		                        sEntry.c4  + ")");
189
		        }
190

  
191
		    }
192
		    
171 193
	  	}catch(GdalException e){
172 194
	  		e.printStackTrace();
173 195
	  		System.exit(1);
174 196
	  	}
175 197
	  	
176 198
//Fetching a Raster Band ----------------------------
177
	  	
178
	  	
199

  
179 200
	  	System.out.println("BANDA->"+iBand);
180 201
	  	
181 202
	  	//Informaci?n de overview

Also available in: Unified diff