Statistics
| Revision:

root / branches / v10 / libraries / libjni-gdal / src / es / gva / cit / jogr / OGRFieldDefn.java @ 7847

History | View | Annotate | Download (4.8 KB)

1
/**********************************************************************
2
 * $Id: OGRFieldDefn.java 7847 2006-10-04 06:55:46Z 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 es.gva.cit.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
                else return ref;        
98
                
99
        }
100
        
101
        /**
102
         * 
103
         */
104
        
105
        public String getFieldTypeName(OGRFieldType tipo)throws OGRException{
106
                
107
                if(cPtr <= 0)
108
                        throw new OGRException("Error en getFieldTypeName(). El constructor ha fallado.");
109
                
110
                String ref = getFieldTypeNameNat(cPtr,tipo.getType());
111
                if(ref==null)
112
                        throw new OGRException("Error en getFieldTypeName(). No se ha podido obtener un nombre de tipo de campo valido.");
113
                else return ref;
114
        
115
        }
116
        
117
        /**
118
         * 
119
         */
120
        
121
        public int getWidth()throws OGRException{
122
                
123
                String msg1="Error en getWidth. El constructor ha fallado.";
124
                String msg2="Error obteniendo el ancho";
125
                return baseSimpleFunctions(4,msg1,msg2);
126
        }
127
        
128
        /**
129
         * 
130
         */
131
        
132
        public int getPrecision()throws OGRException{
133
                
134
                String msg1="Error en getPrecision. El constructor ha fallado.";
135
                String msg2="Error obteniendo la precisi?n";
136
                return baseSimpleFunctions(5,msg1,msg2);
137
        }
138
        
139
        /**
140
         * Destructor 
141
         */
142
        
143
        protected void finalize(){
144
                if(cPtr > 0)
145
                        FreeOGRFieldDefnNat(cPtr);
146
        }
147
        
148
        
149
    /**
150
     * 
151
     */
152
        
153
        public void setName( String name )throws OGRException{
154
                
155
        }
156
        
157
        /**
158
     * 
159
     */
160
        
161
        public void setType( OGRFieldType eTypeIn )throws OGRException{
162
                
163
        }
164
        
165
        /**
166
     * 
167
     */
168
        
169
        public int getJustify()throws OGRException{        //return justification
170
                return 0;
171
        }
172
        
173
        /**
174
     * 
175
     */
176
        
177
        public void setJustify( String justification )throws OGRException{
178
                
179
        }
180
        
181
        /**
182
     * 
183
     */
184
        
185
        public void setWidth( int nWidthIn )throws OGRException{
186
                
187
        }
188
        
189
        /**
190
     * 
191
     */
192
        
193
        public void setPrecision( int nPrecisionIn )throws OGRException{
194
                
195
        }
196
        
197
        /**
198
     * 
199
     */
200
        
201
        public void set( String s, OGRFieldType ftipe, int i, int j,String justification )throws OGRException{
202
                
203
        }
204
        
205
        /**
206
     * 
207
     */
208
        
209
        public void setDefault( OGRField field )throws OGRException{
210
                
211
        }
212
        
213
        /**
214
     * 
215
     */
216
        
217
        public OGRField getDefaultRef()throws OGRException{
218
                return null;
219
        }
220
        
221
        
222

    
223

    
224
}