svn-gvsig-desktop / trunk / libraries / libJCRS / src / org / gvsig / crs / ogr / JNIBase.java @ 8405
History | View | Annotate | Download (685 Bytes)
1 |
package org.gvsig.crs.ogr; |
---|---|
2 |
|
3 |
public class JNIBase { |
4 |
|
5 |
|
6 |
protected long cPtr; |
7 |
|
8 |
protected native long OGRSpatialReferenceNat() throws crsgdalException; |
9 |
protected native void OGRDestroySpatialReferenceNat(long crs); |
10 |
|
11 |
protected long createOGRSpatialReference() throws crsgdalException |
12 |
{ |
13 |
cPtr = OGRSpatialReferenceNat(); |
14 |
if(cPtr<=0) throw new crsgdalException(); |
15 |
return cPtr;
|
16 |
} |
17 |
|
18 |
protected void deleteOGRSpatialReference() throws crsgdalException |
19 |
{ |
20 |
if(cPtr>0) OGRDestroySpatialReferenceNat(cPtr); |
21 |
} |
22 |
|
23 |
protected long getPtr() throws crsgdalException { |
24 |
if (cPtr>0) return cPtr; |
25 |
else throw new crsgdalException(); |
26 |
} |
27 |
|
28 |
static {
|
29 |
System.loadLibrary("jgdal"); |
30 |
} |
31 |
|
32 |
} |