Revision 8656 trunk/libraries/libJCRS/src/org/gvsig/crs/proj/JNIBaseCrs.java

View differences:

JNIBaseCrs.java
9 9
	protected native long loadCrs(String crs);
10 10
	protected native void freeCrs(long crs);
11 11
	protected native int isLatlong(long crs);
12
	protected native int compareDatums(long datum1, long datum2);
12
	protected static native int compareDatums(long datum1, long datum2);
13 13
	protected native int getErrno();
14
	protected native String strErrno(int errno);
14
	protected static native String strErrno(int errno);
15 15
	
16
	
17
	protected static native int operation(double[] firstCoord,
18
		    double[] secondCoord,
19
		    double[] values,
20
		    long srcCodeString,
21
		    long destCodeString);
22

  
23
	protected static native int operationSimple(double firstcoord,
24
			double secondcoord,
25
			double values,
26
			long srcCodeString,
27
			long destCodeString);
28

  
29
	protected static native int operationArraySimple(double[] Coord,
30
			 long srcCodeString,
31
			 long destCodeString);
32
	
16 33
	static {
17 34
		System.loadLibrary("crsjniproj");
18 35
	}
......
53 70
		return getErrno();
54 71
	}
55 72
	
56
	protected String strErrNo(int errno){
73
	protected static String strErrNo(int errno){
57 74
		return strErrno(errno);
58 75
	}
76
	
77
	//OPERATIONS
78
	
79
	public static int operate(double[] firstCoord,
80
		     double[] secondCoord,
81
		     double[] thirdCoord,
82
		     CrsProj srcCrs,
83
		     CrsProj destCrs)
84
			 throws OperationCrsException,
85
					CrsProjException {
86
		
87
		int error=operation(firstCoord,secondCoord,thirdCoord,srcCrs.getPtr(),destCrs.getPtr());
88
		
89
		// error -38: el punto transformar est? fuera del ?mbito del nadgrid
90
		if(error!=0 && error !=-38) throw new OperationCrsException(srcCrs,destCrs, strErrNo(error));
91
		return error;
92
	}
93

  
94
	public static void operateSimple(double firstCoord,
95
				 double secondCoord,
96
				 double thirdCoord,
97
				 CrsProj srcCrs,
98
				 CrsProj destCrs) throws OperationCrsException, CrsProjException {
99

  
100
		int error = operationSimple(firstCoord, secondCoord, thirdCoord,srcCrs.getPtr(),destCrs.getPtr());
101
		if(error!=1) throw new OperationCrsException(srcCrs,destCrs, strErrNo(error));
102
	}
103

  
104
	public static void operateArraySimple(double[] Coord,
105
					  CrsProj srcCrs,
106
					  CrsProj destCrs)throws OperationCrsException,
107
	      				 CrsProjException {
108

  
109
		int error = operationArraySimple(Coord,srcCrs.getPtr(),destCrs.getPtr());
110
		if(error!=1) throw new OperationCrsException(srcCrs,destCrs, strErrNo(error));
111
	}
112
	
113
	public static int compareDatums(CrsProj crs1, CrsProj crs2){
114
		int compare = 0;
115
		try {
116
			compare = compareDatums(crs1.getPtr(),crs2.getPtr());
117
		} catch (CrsProjException e) {
118
			// TODO Auto-generated catch block
119
			e.printStackTrace();
120
		}	
121
		return compare;
122
	}
59 123
}

Also available in: Unified diff