4
#include "ThrowException.h"
8
JNIEXPORT jlong JNICALL Java_geotrans_jni_JNISource_JNISourceCount(JNIEnv *env, jobject obj)
18
JNIEXPORT jlong JNICALL Java_geotrans_jni_JNISource_JNISourceIndex(JNIEnv *env, jobject obj, jstring name)
21
const char *sourceName;
23
sourceName = (*env)->GetStringUTFChars(env, name, NULL);
24
if (sourceName == NULL)
26
throwException(env, "geotrans/jni/JNIException", "JNI Exception: Out of memory.");
30
if (Source_Index(sourceName, &index))
31
throwException(env, "geotrans/jni/GeotransError", "Error getting source index.");
33
(*env)->ReleaseStringUTFChars(env, name, sourceName);
39
JNIEXPORT jstring JNICALL Java_geotrans_jni_JNISource_JNISourceName(JNIEnv *env, jobject obj, jlong index)
44
if (Source_Name((long)index, sourceName))
46
throwException(env, "geotrans/jni/GeotransError", "Error getting source name.");
50
jStr = (*env)->NewStringUTF(env, sourceName);
52
throwException(env, "geotrans/jni/JNIException", "JNI Exception: Out of memory.");
58
JNIEXPORT jobject JNICALL Java_geotrans_jni_JNISource_JNISourceAccuracy(JNIEnv *env, jobject obj, jlong index)
61
double ce90, le90, se90;
66
if(Source_Accuracy((long)index, &ce90, &le90, &se90))
68
throwException(env, "geotrans/jni/GeotransError", "Error getting source accuracy");
72
cls = (*env)->FindClass(env, "geotrans/gui/Accuracy");
75
throwException(env, "geotrans/jni/JNIException", "JNI Exception: Accuracy class not found.");
79
cid = (*env)->GetMethodID(env, cls, "<init>", "(DDD)V");
82
throwException(env, "geotrans/jni/JNIException", "JNI Exception: Accuracy method id not found.");
86
obj = (*env)->NewObject(env, cls, cid, ce90, le90, se90);
88
throwException(env, "geotrans/jni/JNIException", "JNI Exception: Accuracy object could not be created.");