svn-gvsig-desktop / trunk / libraries / libJCRS / src / org / gvsig / crs / proj / JNIBaseCrs.java @ 8405
History | View | Annotate | Download (1.2 KB)
1 |
package org.gvsig.crs.proj; |
---|---|
2 |
|
3 |
|
4 |
public class JNIBaseCrs |
5 |
{ |
6 |
protected long cPtr; |
7 |
protected int latLong; |
8 |
protected String _strCrs; |
9 |
protected native long loadCrs(String crs); |
10 |
protected native void freeCrs(long crs); |
11 |
protected native int isLatlong(long crs); |
12 |
protected native int compareDatums(long datum1, long datum2); |
13 |
protected native int getErrno(); |
14 |
protected native String strErrno(int errno); |
15 |
|
16 |
static {
|
17 |
System.loadLibrary("crsjniproj"); |
18 |
} |
19 |
|
20 |
protected void createCrs(String strCrs) throws CrsProjException { |
21 |
cPtr=loadCrs(strCrs); |
22 |
|
23 |
int errNo = getErrNo();
|
24 |
if (errNo<0) throw new CrsProjException("Error creating CRS: "+strErrNo(errNo)); |
25 |
_strCrs=strCrs; |
26 |
} |
27 |
|
28 |
protected void deleteCrs() { |
29 |
if(cPtr>0) freeCrs(cPtr); |
30 |
} |
31 |
|
32 |
public boolean isLatlong() { |
33 |
latLong = isLatlong(cPtr); |
34 |
if(latLong == 0) |
35 |
return false; |
36 |
return true; |
37 |
} |
38 |
|
39 |
protected long getPtr() throws CrsProjException { |
40 |
if (cPtr>0) return cPtr; |
41 |
else throw new CrsProjException(_strCrs); |
42 |
} |
43 |
|
44 |
public String getStr() { |
45 |
return _strCrs;
|
46 |
} |
47 |
|
48 |
public void changeStrCrs(String code) { |
49 |
_strCrs += code; |
50 |
} |
51 |
|
52 |
protected int getErrNo(){ |
53 |
return getErrno();
|
54 |
} |
55 |
|
56 |
protected String strErrNo(int errno){ |
57 |
return strErrno(errno);
|
58 |
} |
59 |
} |