Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-gdal / src / ogrfeaturedefn_interfaz.cpp @ 945

History | View | Annotate | Download (3.28 KB)

1
 /**********************************************************************
2
 * $Id: ogrfeaturedefn_interfaz.cpp 945 2005-01-12 18:05:23Z igbrotru $
3
 *
4
 * Name:     ogrfeaturedefn_interfaz.c
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

    
28
#include <jni.h>
29
#include "es_gva_cit_jogr_OGRFeatureDefn.h"
30
#include "es_gva_cit_jogr_JNIBase.h"
31
#include "ogr_api.h"
32
#include "ogrsf_frmts.h"
33

    
34
/******************************************************************************/
35
//                                                                getName
36
/******************************************************************************/
37

    
38
JNIEXPORT jstring JNICALL Java_es_gva_cit_jogr_OGRFeatureDefn_getNameNat
39
  (JNIEnv *env, jobject obj, jlong cPtr){
40
          
41
          OGRFeatureDefn                         *fd = (OGRFeatureDefn *) 0 ;
42
          jstring                                        nom_fd;
43
          
44
          fd = *(OGRFeatureDefn **)&cPtr;
45
          const char *name = fd->GetName();
46
          
47
          if(name!=NULL)
48
                  nom_fd = env->NewStringUTF(name);
49
          else return NULL;
50
          
51
          return nom_fd;
52
          
53
  }
54
  
55
/******************************************************************************/
56
//                                                                getGeomType
57
/******************************************************************************/
58

    
59
JNIEXPORT jint JNICALL Java_es_gva_cit_jogr_OGRFeatureDefn_getGeomTypeNat
60
  (JNIEnv *env, jobject obj, jlong cPtr){
61
          
62
          OGRFeatureDefn                         *fd = (OGRFeatureDefn *) 0 ;
63
        
64
          fd = *(OGRFeatureDefn **)&cPtr;
65
          OGRwkbGeometryType tipo = fd->GetGeomType();  
66
          
67
          if(tipo==wkbUnknown)return 0;        
68
          if(tipo==wkbPoint)return 1;
69
          if(tipo==wkbLineString)return 2;
70
          if(tipo==wkbPolygon)return 3;
71
          if(tipo==wkbMultiPoint)return 4;
72
          if(tipo==wkbMultiLineString)return 5;
73
          if(tipo==wkbMultiPolygon)return 6;
74
          if(tipo==wkbGeometryCollection)return 7;
75
          if(tipo==wkbNone)return 8;
76
          if(tipo==wkbLinearRing)return 9;
77
          if(tipo==wkbPoint25D)return 10;
78
          if(tipo==wkbLineString25D)return 11;
79
          if(tipo==wkbPolygon25D)return 12;
80
          if(tipo==wkbMultiPoint25D)return 13;
81
          if(tipo==wkbMultiLineString25D)return 14;
82
          if(tipo==wkbMultiPolygon25D)return 15;
83
          if(tipo==wkbGeometryCollection25D)return 16;
84
          
85
          return -1;          
86
  }
87
  
88
/******************************************************************************/
89
//                                                                ~OGRFeatureDefn
90
/******************************************************************************/
91
 
92
  JNIEXPORT void JNICALL Java_es_gva_cit_jogr_OGRFeatureDefn_FreeOGRFeatureDefnNat
93
  (JNIEnv *env, jobject obj, jlong cPtr){
94
          
95
          OGRFeatureDefn *df = (OGRFeatureDefn *) 0 ;
96
          
97
          df = *(OGRFeatureDefn **)&cPtr;
98
          if(df!=NULL){
99
                  df->~OGRFeatureDefn();
100
          }
101
  }