Revision 5911

View differences:

trunk/libraries/libjni-gdal/include/es_gva_cit_jgdal_GdalRasterBand.h
63 63
JNIEXPORT jobjectArray JNICALL Java_es_gva_cit_jgdal_GdalRasterBand_getMetadataNat
64 64
  (JNIEnv *, jobject, jlong, jstring);
65 65

  
66
/*
67
 * Class:     es_gva_cit_jgdal_GdalRasterBand
68
 * Method:    getRasterColorInterpretationNat
69
 * Signature: (JI)I
70
 */
71
JNIEXPORT jint JNICALL Java_es_gva_cit_jgdal_GdalRasterBand_getRasterColorInterpretationNat
72
  (JNIEnv *, jobject, jlong, jint);
73

  
66 74
#ifdef __cplusplus
67 75
}
68 76
#endif
trunk/libraries/libjni-gdal/include/es_gva_cit_jgdal_Gdal.h
110 110
JNIEXPORT jlong JNICALL Java_es_gva_cit_jgdal_Gdal_getDriverByNameNat
111 111
  (JNIEnv *, jclass, jstring);
112 112

  
113
/*
114
 * Class:     es_gva_cit_jgdal_Gdal
115
 * Method:    getColorInterpretationNameNat
116
 * Signature: (JI)Ljava/lang/String;
117
 */
118
JNIEXPORT jstring JNICALL Java_es_gva_cit_jgdal_Gdal_getColorInterpretationNameNat
119
  (JNIEnv *, jobject, jlong, jint);
120

  
113 121
#ifdef __cplusplus
114 122
}
115 123
#endif
trunk/libraries/libjni-gdal/src/gdal_interfaz.c
477 477
  	return res;
478 478
  }
479 479
 
480
 
480
 /******************************************************************************/ 
481
//							GetColorInterpretationName
482
/******************************************************************************/
483

  
484
JNIEXPORT jstring JNICALL Java_es_gva_cit_jgdal_Gdal_getColorInterpretationNameNat
485
  (JNIEnv *env, jobject obj, jlong cPtr, jint ci){
486
  	 GDALDatasetH 		*dt  = (GDALDatasetH *) 0 ;
487
   	 char 				*name = NULL;
488
   	 jstring 			typeName = NULL;
489
	 
490
	 dt = *(GDALDatasetH **)&cPtr;
491
	 name = GDALGetColorInterpretationName(ci);  	 
492
	 typeName = (*env)->NewStringUTF(env, name); 
493
	 return typeName;
494
  }
495
  
481 496
 
trunk/libraries/libjni-gdal/src/es/gva/cit/jgdal/Gdal.java
91 91
	public static int GDT_CFloat64 = 11;	//Buffer double (64)
92 92
	public static int GDT_TypeCount = 12;
93 93
	
94
	
95 94
	private String pszFilename = "";
96 95
				
97

  
98 96
	private native long openNat(String pszFilename, int access);
99 97
	private native long openArrayNat(byte[] pszFilename, int access);
100 98
	private native int getGeoTransformNat(long cPtr,GeoTransform adfgeotransform);
......
108 106
	
109 107
	//private static native long getGDALDriverManagerNat(); 
110 108
	private static native long getDriverByNameNat(String name);
109
	private native String getColorInterpretationNameNat(long cPtr, int colorInterp);
111 110
	
112
	
113
	
114 111
	/**
115 112
	 *Constructor a partir de la direcci?n de memoria 
116 113
	 */
......
398 395
			throw new GdalException("Error en setProjection(). No se ha podido asignar la proyecci?n.");
399 396
	}
400 397
	
398
	/**
399
	 * Obtiene la cadena que representa el tipo de banda de color. 
400
	 * @return	Cadena con el nombre del tipo de banda de color
401
	 * @throws GdalException
402
	 */
403
	
404
	public String getColorInterpretationName(int colorInterp)throws GdalException{
405
		
406
		if(cPtr <= 0)
407
			throw new GdalException("Error en getColorInterpretationName(). La llamada Open no tuvo exito");
408
		String bandTypeName = getColorInterpretationNameNat(cPtr, colorInterp);
409
		
410
		if(bandTypeName == null)
411
			throw new GdalException("Error en getColorInterpretationName(). No ha podido obtenerse el tipo de banda de color");
412
		else 
413
			return bandTypeName;
414
		
415
	}
416
	
401 417
}
trunk/libraries/libjni-gdal/src/es/gva/cit/jgdal/GdalRasterBand.java
77 77
										int eBufType);
78 78
	private native double getRasterNoDataValueNat(long cPtr);
79 79
	private native String[] getMetadataNat(long cPtr,String pszDomain);
80
	private native int getRasterColorInterpretationNat(long cPtr, int band);
80 81
	
81 82
	
82 83
	/**
......
364 365
		 else return res;
365 366
		 
366 367
	 }
368
	 
369
	 /**
370
	 * Obtiene identificador que representa el tipo de banda de color. 
371
	 * @return	identificador del tipo de banda de color
372
	 * @throws GdalException
373
	 */
374
		
375
	 public int getRasterColorInterpretation(int band)throws GdalException{
376
		if(cPtr <= 0)
377
			throw new GdalException("Error en getColorInterpretationName(). La llamada Open no tuvo exito");
378
		int bandType = getRasterColorInterpretationNat(cPtr, band);
379
		return bandType;		
380
	 }
367 381
}
trunk/libraries/libjni-gdal/src/rasterband_interfaz.c
664 664
     
665 665
  	 return NULL;
666 666
  }
667
  
668
/******************************************************************************/ 
669
//							GetRasterColorInterpretation
670
/******************************************************************************/
671

  
672
JNIEXPORT jint JNICALL Java_es_gva_cit_jgdal_GdalRasterBand_getRasterColorInterpretationNat
673
  (JNIEnv *env, jobject obj, jlong cPtr, jint band){
674
  	 GDALRasterBandH *rb  = (GDALRasterBandH *) 0 ;
675
   	 rb = *(GDALRasterBandH **)&cPtr;
676

  
677
	 GDALColorInterp interp = GDALGetRasterColorInterpretation(rb);  	 
678
	 
679
	 return (jint)interp;
680
  }
667 681
  

Also available in: Unified diff