Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-gdal / src / ogrdatasource_interfaz.cpp @ 915

History | View | Annotate | Download (2.73 KB)

1
 /**********************************************************************
2
 * $Id: ogrdatasource_interfaz.cpp 915 2005-01-12 08:21:15Z igbrotru $
3
 *
4
 * Name:     ogrdatasource_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_jgdal_OGRDataSource.h"
30
#include "es_gva_cit_jgdal_JNIBase.h"
31
#include "ogr_api.h"
32
#include "ogrsf_frmts.h"
33

    
34

    
35

    
36
/******************************************************************************/
37
//                                                                getName
38
/******************************************************************************/
39

    
40
JNIEXPORT jstring JNICALL Java_es_gva_cit_jgdal_OGRDataSource_getNameNat
41
  (JNIEnv *env, jobject obj, jlong cPtr){
42
          
43
          OGRDataSource                         *ds = (OGRDataSource *) 0 ;
44
          jstring                                        nom_ds;
45
          
46
          ds = *(OGRDataSource **)&cPtr;
47
          const char *name = ds->GetName();
48
          
49
          if(name!=NULL)
50
                  nom_ds = env->NewStringUTF(name);
51
          else return NULL;
52
          
53
          return nom_ds;
54
          
55
  }
56
  
57
/******************************************************************************/
58
//                                                                getLayerCount
59
/******************************************************************************/
60
 
61
 JNIEXPORT jint JNICALL Java_es_gva_cit_jgdal_JNIBase_getLayerCountNat
62
  (JNIEnv *env, jobject obj, jlong cPtr){
63
          
64
          int res=-1;
65
          OGRDataSource *ds  = (OGRDataSource *) 0 ;
66
  
67
          ds = *(OGRDataSource **)&cPtr;
68
          if(ds!=NULL)
69
                  res = ds->GetLayerCount();
70
                    
71
          return res;
72
  }
73
  
74
/******************************************************************************/
75
//                                                                        getLayer
76
/******************************************************************************/
77

    
78
JNIEXPORT jlong JNICALL Java_es_gva_cit_jgdal_OGRDataSource_getLayerNat
79
  (JNIEnv *env, jobject obj, jlong cPtr, jint iLayer){
80
          
81
          OGRDataSource                         *ds  = (OGRDataSource *) 0 ;
82
          OGRLayer                                 *capa;
83
          long                                        layer=0;
84
          
85
          ds = *(OGRDataSource **)&cPtr;
86
          capa = ds->GetLayer(iLayer);
87
          layer = (long)&(*capa);
88
          
89
          return (jlong)layer;
90
          
91
  }