Statistics
| Revision:

gvsig-raster / org.gvsig.raster.gdal / tags / pre-remove-jgdal / org.gvsig.raster.gdal / org.gvsig.raster.gdal.io / src / main / java / org / gvsig / jogr / OGRFieldDefn.java @ 3497

History | View | Annotate | Download (4.89 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
import org.gdal.ogr.FieldDefn;
30

    
31

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

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

    
56
        
57
        /**
58
        * Constructor
59
        * @param cPtr        direcci?n de memoria al objeto OGRFieldDefn de C. 
60
        */
61
        
62
        public OGRFieldDefn(long cPtr){
63
                super(cPtr, true);
64
        }
65
        
66
        /**
67
         * 
68
         */
69
        
70
        public OGRFieldType getType()throws OGRException{
71
                
72
                OGRFieldType ftipo ;
73
//                if(cPtr == 0)
74
//                        throw new OGRException("Error en getType(). El constructor ha fallado.");
75
                
76
                int tipo = this.GetFieldType();
77
                if(tipo >= 0){
78
                        ftipo = new OGRFieldType();
79
                        ftipo.setType(tipo);
80
                }
81
                else 
82
                        throw new OGRException("Error en getType(). No se ha podido obtener un tipo valido.");
83
                
84
                return ftipo;
85
        }
86
        
87
        /**
88
         * 
89
         */
90
        
91
        public String getNameRef()throws OGRException{
92
                
93
//                if(cPtr == 0)
94
//                        throw new OGRException("Error en getNameRef(). El constructor ha fallado.");
95
                
96
                String ref = this.GetNameRef();
97
                if(ref == null)
98
                        throw new OGRException("Error en getNameRef(). No se ha podido obtener un nombre de referencia valido.");
99
                
100
                else return ref;        
101
                
102
        }
103
        
104
        /**
105
         * 
106
         */
107
        
108
        public String getFieldTypeName(OGRFieldType tipo)throws OGRException{
109
                
110
//                if(cPtr == 0)
111
//                        throw new OGRException("Error en getFieldTypeName(). El constructor ha fallado.");
112
                
113
                String ref = this.GetFieldTypeName(tipo.getType());
114
                
115
                if(ref == null)
116
                        throw new OGRException("Error en getFieldTypeName(). No se ha podido obtener un nombre de tipo de campo valido.");
117
                
118
                else return ref;
119
        
120
        }
121
        
122
        /**
123
         * 
124
         */
125
        
126
        public int getWidth()throws OGRException{
127
                
128
//                String msg1="Error en getWidth. El constructor ha fallado.";
129
//                String msg2="Error obteniendo el ancho";
130
                return this.GetWidth();
131
        }
132
        
133
        /**
134
         * 
135
         */
136
        
137
        public int getPrecision()throws OGRException{
138
                return this.GetPrecision();
139
        }
140
        
141
        /**
142
         * Destructor 
143
         */
144
        
145
        protected void finalize(){
146
//                if(cPtr == 0)
147
//                        throw new OGRFailureException("Fallo al acceder al dato.");
148
                
149
//                FreeOGRFieldDefnNat(cPtr);
150
                this.delete();
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
}