Statistics
| Revision:

gvsig-raster / org.gvsig.raster.gdal / trunk / org.gvsig.raster.gdal / org.gvsig.raster.gdal.jni / src / main / java / org / gvsig / jogr / OGRFieldDefn.java @ 2453

History | View | Annotate | Download (4.96 KB)

1
/**********************************************************************
2
 * $Id: OGRFieldDefn.java 7765 2006-10-03 07:05:18Z nacho $
3
 *
4
 * Name:     OGRFieldDefn.java
5
 * Project:  JGDAL. Interface java to gdal (Frank Warmerdam).
6
 * Purpose:   
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/*Copyright (C) 2004  Nacho Brodin <brodin_ign@gva.es>
11

12
 This program is free software; you can redistribute it and/or
13
 modify it under the terms of the GNU General Public License
14
 as published by the Free Software Foundation; either version 2
15
 of the License, or (at your option) any later version.
16

17
 This program is distributed in the hope that it will be useful,
18
 but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 GNU General Public License for more details.
21

22
 You should have received a copy of the GNU General Public License
23
 along with this program; if not, write to the Free Software
24
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25
 */
26

    
27
package org.gvsig.jogr;
28

    
29

    
30
/** 
31
 * 
32
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
33
 * @version 0.0
34
 * @link http://www.gvsig.gva.es
35
 */
36

    
37
public class OGRFieldDefn extends JNIBase{
38
        
39
        private native void FreeOGRFieldDefnNat(long cPtr);
40
        private native int getTypeNat(long cPtr);
41
        private native String getNameRefNat(long cPtr);
42
        private native String getFieldTypeNameNat(long cPtr, int tipo);
43
        
44
        private native void setName( long cPtr,  String name );
45
        private native void setType( long cPtr,  OGRFieldType eTypeIn );
46
        private native int getJustify( long cPtr ); //return OGRJustification
47
        private native void setJustify( long cPtr,  String justification );
48
        private native void setWidth( long cPtr,  int nWidthIn );
49
        private native void setPrecision( long cPtr,  int nPrecisionIn );
50
        private native void set( long cPtr,  String s, OGRFieldType ftipe, int i, int j,String justification );
51
        private native void setDefault( long cPtr,  OGRField field );
52
        private native long getDefaultRef( long cPtr );
53

    
54
        
55
        /**
56
        * Constructor
57
        * @param cPtr        direcci?n de memoria al objeto OGRFieldDefn de C. 
58
        */
59
        
60
        public OGRFieldDefn(long cPtr){
61
                this.cPtr=cPtr;
62
        }
63
        
64
        /**
65
         * 
66
         */
67
        
68
        public OGRFieldType getType()throws OGRException{
69
                
70
                OGRFieldType ftipo ;
71
                if(cPtr == 0)
72
                        throw new OGRException("Error en getType(). El constructor ha fallado.");
73
                
74
                int tipo = getTypeNat(cPtr);
75
                if(tipo >= 0){
76
                        ftipo = new OGRFieldType();
77
                        ftipo.setType(tipo);
78
                }
79
                else 
80
                        throw new OGRException("Error en getType(). No se ha podido obtener un tipo valido.");
81
                
82
                return ftipo;
83
        }
84
        
85
        /**
86
         * 
87
         */
88
        
89
        public String getNameRef()throws OGRException{
90
                
91
                if(cPtr == 0)
92
                        throw new OGRException("Error en getNameRef(). El constructor ha fallado.");
93
                
94
                String ref = getNameRefNat(cPtr);
95
                if(ref == null)
96
                        throw new OGRException("Error en getNameRef(). No se ha podido obtener un nombre de referencia valido.");
97
                
98
                else return ref;        
99
                
100
        }
101
        
102
        /**
103
         * 
104
         */
105
        
106
        public String getFieldTypeName(OGRFieldType tipo)throws OGRException{
107
                
108
                if(cPtr == 0)
109
                        throw new OGRException("Error en getFieldTypeName(). El constructor ha fallado.");
110
                
111
                String ref = getFieldTypeNameNat(cPtr,tipo.getType());
112
                
113
                if(ref == null)
114
                        throw new OGRException("Error en getFieldTypeName(). No se ha podido obtener un nombre de tipo de campo valido.");
115
                
116
                else return ref;
117
        
118
        }
119
        
120
        /**
121
         * 
122
         */
123
        
124
        public int getWidth()throws OGRException{
125
                
126
                String msg1="Error en getWidth. El constructor ha fallado.";
127
                String msg2="Error obteniendo el ancho";
128
                return baseSimpleFunctions(4,msg1,msg2);
129
        }
130
        
131
        /**
132
         * 
133
         */
134
        
135
        public int getPrecision()throws OGRException{
136
                
137
                String msg1="Error en getPrecision. El constructor ha fallado.";
138
                String msg2="Error obteniendo la precisi?n";
139
                return baseSimpleFunctions(5,msg1,msg2);
140
        }
141
        
142
        /**
143
         * Destructor 
144
         */
145
        
146
        protected void finalize() throws OGRFailureException{
147
                if(cPtr == 0)
148
                        throw new OGRFailureException("Fallo al acceder al dato.");
149
                
150
                FreeOGRFieldDefnNat(cPtr);
151
        }
152
        
153
        
154
    /**
155
     * 
156
     */
157
        
158
        public void setName( String name )throws OGRException{
159
                
160
        }
161
        
162
        /**
163
     * 
164
     */
165
        
166
        public void setType( OGRFieldType eTypeIn )throws OGRException{
167
                
168
        }
169
        
170
        /**
171
     * 
172
     */
173
        
174
        public int getJustify()throws OGRException{        //return justification
175
                return 0;
176
        }
177
        
178
        /**
179
     * 
180
     */
181
        
182
        public void setJustify( String justification )throws OGRException{
183
                
184
        }
185
        
186
        /**
187
     * 
188
     */
189
        
190
        public void setWidth( int nWidthIn )throws OGRException{
191
                
192
        }
193
        
194
        /**
195
     * 
196
     */
197
        
198
        public void setPrecision( int nPrecisionIn )throws OGRException{
199
                
200
        }
201
        
202
        /**
203
     * 
204
     */
205
        
206
        public void set( String s, OGRFieldType ftipe, int i, int j,String justification )throws OGRException{
207
                
208
        }
209
        
210
        /**
211
     * 
212
     */
213
        
214
        public void setDefault( OGRField field )throws OGRException{
215
                
216
        }
217
        
218
        /**
219
     * 
220
     */
221
        
222
        public OGRField getDefaultRef()throws OGRException{
223
                return null;
224
        }
225
        
226
        
227

    
228

    
229
}