Revision 970 trunk/libraries/libjni-gdal/src/ogrfielddefn_interfaz.cpp

View differences:

ogrfielddefn_interfaz.cpp
38 38
  JNIEXPORT void JNICALL Java_es_gva_cit_jogr_OGRFieldDefn_FreeOGRFieldDefnNat
39 39
  (JNIEnv *env, jobject obj, jlong cPtr){
40 40
  	
41
  	OGRFieldDefn *df = (OGRFieldDefn *) 0 ;
41
  	OGRFieldDefn 	*fd = (OGRFieldDefn *) 0 ;
42 42
  	
43
  	df = *(OGRFieldDefn **)&cPtr;
44
  	if(df!=NULL){
45
  		df->~OGRFieldDefn();
43
  	fd = *(OGRFieldDefn **)&cPtr;
44
  	if(fd!=NULL){
45
  		fd->~OGRFieldDefn();
46 46
  	}
47 47
  }
48
  
49
  
48
 
49
/******************************************************************************/
50
//								getType
51
/******************************************************************************/
52
 
53
 JNIEXPORT jint JNICALL Java_es_gva_cit_jogr_OGRFieldDefn_getTypeNat
54
  (JNIEnv *env, jobject obj, jlong cPtr){
55
  	
56
  	OGRFieldDefn 	*fd = (OGRFieldDefn *) 0 ;
57
  	OGRFieldType	ft;
58
  	
59
  	fd = *(OGRFieldDefn **)&cPtr;
60
  	if(fd!=NULL)
61
  		ft = fd->GetType();
62
  	
63
  	return (int)ft;
64
  }
65

  
66
/******************************************************************************/
67
//								getNameRef
68
/******************************************************************************/
69

  
70
JNIEXPORT jstring JNICALL Java_es_gva_cit_jogr_OGRFieldDefn_getNameRefNat
71
  (JNIEnv *env, jobject obj, jlong cPtr){
72
  	
73
  	OGRFieldDefn 	*fd = (OGRFieldDefn *) 0 ;
74
  	jstring			jstipo;
75
  	
76
  	fd = *(OGRFieldDefn **)&cPtr;
77
  	if(fd!=NULL){
78
  	  const char *tipo = fd->GetNameRef();
79
  	  jstipo = env->NewStringUTF(tipo); 
80
  	}
81
  	return jstipo;
82
  }
83

  
84
/******************************************************************************/
85
//								getFieldTypeName
86
/******************************************************************************/
87

  
88
JNIEXPORT jstring JNICALL Java_es_gva_cit_jogr_OGRFieldDefn_getFieldTypeNameNat
89
  (JNIEnv *env, jobject obj, jlong cPtr, jint tipo){
90
  	
91
  	OGRFieldDefn	*fd = (OGRFieldDefn *) 0 ;
92
  	jstring			jsnombretipo;
93
  	
94
  	fd = *(OGRFieldDefn **)&cPtr;
95
  	if(fd!=NULL){
96
  		OGRFieldType ft;
97
  		switch(tipo){
98
  			case 0:ft=OFTInteger;break;
99
			case 1:ft=OFTIntegerList;break;
100
			case 2:ft=OFTReal;break;
101
			case 3:ft=OFTRealList;break;
102
			case 4:ft=OFTString;break;
103
			case 5:ft=OFTStringList;break;
104
			case 6:ft=OFTWideString;break;
105
			case 7:ft=OFTWideStringList;break;
106
			case 8:ft=OFTBinary;break;
107
  		}
108
  		const char  *nombretipo = fd->GetFieldTypeName(ft);
109
  		jsnombretipo = env->NewStringUTF(nombretipo);
110
  	}
111
  	return jsnombretipo;
112
  }
113

  
114
/******************************************************************************/
115
//								getWidth
116
/******************************************************************************/
117

  
118
JNIEXPORT jint JNICALL Java_es_gva_cit_jogr_JNIBase_getWidthNat
119
 (JNIEnv *env, jobject obj, jlong cPtr){
120
  	
121
  	OGRFieldDefn 	*fd = (OGRFieldDefn *) 0 ;
122
  	int 			width = -1;
123
  	
124
  	fd = *(OGRFieldDefn **)&cPtr;
125
  	if(fd!=NULL){
126
  		width = fd->GetWidth();
127
  	}
128
  	return width;
129
  }
130

  
131
/******************************************************************************/
132
//								getPrecision
133
/******************************************************************************/
134

  
135
JNIEXPORT jint JNICALL Java_es_gva_cit_jogr_JNIBase_getPrecisionNat
136
  (JNIEnv *env, jobject obj, jlong cPtr){
137
  	
138
  	OGRFieldDefn 	*fd = (OGRFieldDefn *) 0 ;
139
  	int 			precision = -1;
140
  	
141
  	fd = *(OGRFieldDefn **)&cPtr;
142
  	if(fd!=NULL){
143
  		precision = fd->GetPrecision();
144
  	}
145
  	return precision;
146
  }

Also available in: Unified diff