root / trunk / libraries / libjni-gdal / src / es / gva / cit / jgdal / OGRSFDriverRegistrar.java @ 879
History | View | Annotate | Download (1.98 KB)
1 |
/**********************************************************************
|
---|---|
2 |
* $Id: OGRSFDriverRegistrar.java 879 2005-01-11 15:23:01Z igbrotru $
|
3 |
*
|
4 |
* Name: OGRSFDriverRegistrar.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.jgdal; |
28 |
|
29 |
|
30 |
/**
|
31 |
* Gestor de drivers
|
32 |
*
|
33 |
* @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
|
34 |
* @version 0.0
|
35 |
* @link http://www.gvsig.gva.es
|
36 |
*/
|
37 |
|
38 |
public class OGRSFDriverRegistrar extends JNIBase{ |
39 |
|
40 |
private long driver; |
41 |
public native long openNat(String fte, int bUpdate); |
42 |
|
43 |
/**
|
44 |
* Abre un fichero de im?gen
|
45 |
* @throws GdalException
|
46 |
* @param fte fichero fuente
|
47 |
* @param bUpdate
|
48 |
* @param pdriver
|
49 |
* @return OGRDataSource
|
50 |
*/
|
51 |
|
52 |
public OGRDataSource open(String fte, boolean bUpdate, OGRSFDriver pdriver)throws GdalException{ |
53 |
|
54 |
OGRDataSource ds; |
55 |
OGRSFDriver drv; |
56 |
driver=-1;
|
57 |
int bU=0; |
58 |
|
59 |
if(bUpdate)bU=1; |
60 |
|
61 |
long res = openNat(fte, bU);
|
62 |
|
63 |
if(res<=0 || driver<=0) |
64 |
throw new GdalException("Error en open(). No se ha podido abrir la im?gen."); |
65 |
else{
|
66 |
ds = new OGRDataSource(res);
|
67 |
drv = new OGRSFDriver(driver);
|
68 |
} |
69 |
|
70 |
pdriver=drv; |
71 |
return ds;
|
72 |
} |
73 |
|
74 |
} |