00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #define GLM_FORCE_RADIANS
00029
00030 #include <jni.h>
00031 #include <RTABMapApp.h>
00032 #include <scene.h>
00033
00034 static RTABMapApp app;
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00040 void GetJStringContent(JNIEnv *AEnv, jstring AStr, std::string &ARes) {
00041 if (!AStr) {
00042 ARes.clear();
00043 return;
00044 }
00045
00046 const char *s = AEnv->GetStringUTFChars(AStr,NULL);
00047 ARes=s;
00048 AEnv->ReleaseStringUTFChars(AStr,s);
00049 }
00050
00051 JNIEXPORT void JNICALL
00052 Java_com_introlab_rtabmap_RTABMapLib_onCreate(
00053 JNIEnv* env, jobject, jobject activity)
00054 {
00055 return app.onCreate(env, activity);
00056 }
00057
00058 JNIEXPORT void JNICALL
00059 Java_com_introlab_rtabmap_RTABMapLib_openDatabase(
00060 JNIEnv* env, jobject, jstring databasePath)
00061 {
00062 std::string databasePathC;
00063 GetJStringContent(env,databasePath,databasePathC);
00064 return app.openDatabase(databasePathC);
00065 }
00066
00067 JNIEXPORT bool JNICALL
00068 Java_com_introlab_rtabmap_RTABMapLib_onTangoServiceConnected(
00069 JNIEnv* env, jobject, jobject iBinder) {
00070 return app.onTangoServiceConnected(env, iBinder);
00071 }
00072
00073 JNIEXPORT void JNICALL
00074 Java_com_introlab_rtabmap_RTABMapLib_initGlContent(
00075 JNIEnv*, jobject) {
00076 app.InitializeGLContent();
00077 }
00078
00079 JNIEXPORT void JNICALL
00080 Java_com_introlab_rtabmap_RTABMapLib_setupGraphic(
00081 JNIEnv*, jobject, jint width, jint height) {
00082 app.SetViewPort(width, height);
00083 }
00084
00085 JNIEXPORT int JNICALL
00086 Java_com_introlab_rtabmap_RTABMapLib_render(
00087 JNIEnv*, jobject) {
00088 return app.Render();
00089 }
00090
00091 JNIEXPORT void JNICALL
00092 Java_com_introlab_rtabmap_RTABMapLib_onPause(
00093 JNIEnv*, jobject) {
00094 app.onPause();
00095 }
00096
00097 JNIEXPORT void JNICALL
00098 Java_com_introlab_rtabmap_RTABMapLib_setCamera(
00099 JNIEnv*, jobject, int camera_index) {
00100 using namespace tango_gl;
00101 GestureCamera::CameraType cam_type =
00102 static_cast<GestureCamera::CameraType>(camera_index);
00103 app.SetCameraType(cam_type);
00104 }
00105
00106 JNIEXPORT void JNICALL
00107 Java_com_introlab_rtabmap_RTABMapLib_onTouchEvent(
00108 JNIEnv*, jobject, int touch_count, int event, float x0, float y0, float x1,
00109 float y1) {
00110 using namespace tango_gl;
00111 GestureCamera::TouchEvent touch_event =
00112 static_cast<GestureCamera::TouchEvent>(event);
00113 app.OnTouchEvent(touch_count, touch_event, x0, y0, x1, y1);
00114 }
00115
00116 JNIEXPORT void JNICALL
00117 Java_com_introlab_rtabmap_RTABMapLib_setPausedMapping(
00118 JNIEnv*, jobject, bool paused)
00119 {
00120 return app.setPausedMapping(paused);
00121 }
00122 JNIEXPORT void JNICALL
00123 Java_com_introlab_rtabmap_RTABMapLib_setMapCloudShown(
00124 JNIEnv*, jobject, bool shown)
00125 {
00126 return app.setMapCloudShown(shown);
00127 }
00128 JNIEXPORT void JNICALL
00129 Java_com_introlab_rtabmap_RTABMapLib_setOdomCloudShown(
00130 JNIEnv*, jobject, bool shown)
00131 {
00132 return app.setOdomCloudShown(shown);
00133 }
00134 JNIEXPORT void JNICALL
00135 Java_com_introlab_rtabmap_RTABMapLib_setMeshRendering(
00136 JNIEnv*, jobject, bool enabled)
00137 {
00138 return app.setMeshRendering(enabled);
00139 }
00140 JNIEXPORT void JNICALL
00141 Java_com_introlab_rtabmap_RTABMapLib_setLocalizationMode(
00142 JNIEnv*, jobject, bool enabled)
00143 {
00144 return app.setLocalizationMode(enabled);
00145 }
00146 JNIEXPORT void JNICALL
00147 Java_com_introlab_rtabmap_RTABMapLib_setTrajectoryMode(
00148 JNIEnv*, jobject, bool enabled)
00149 {
00150 return app.setTrajectoryMode(enabled);
00151 }
00152 JNIEXPORT void JNICALL
00153 Java_com_introlab_rtabmap_RTABMapLib_setGraphOptimization(
00154 JNIEnv*, jobject, bool enabled)
00155 {
00156 return app.setGraphOptimization(enabled);
00157 }
00158 JNIEXPORT void JNICALL
00159 Java_com_introlab_rtabmap_RTABMapLib_setNodesFiltering(
00160 JNIEnv*, jobject, bool enabled)
00161 {
00162 return app.setNodesFiltering(enabled);
00163 }
00164 JNIEXPORT void JNICALL
00165 Java_com_introlab_rtabmap_RTABMapLib_setGraphVisible(
00166 JNIEnv*, jobject, bool visible)
00167 {
00168 return app.setGraphVisible(visible);
00169 }
00170 JNIEXPORT void JNICALL
00171 Java_com_introlab_rtabmap_RTABMapLib_setAutoExposure(
00172 JNIEnv*, jobject, bool enabled)
00173 {
00174 return app.setAutoExposure(enabled);
00175 }
00176 JNIEXPORT void JNICALL
00177 Java_com_introlab_rtabmap_RTABMapLib_setFullResolution(
00178 JNIEnv*, jobject, bool enabled)
00179 {
00180 return app.setFullResolution(enabled);
00181 }
00182 JNIEXPORT void JNICALL
00183 Java_com_introlab_rtabmap_RTABMapLib_setMaxCloudDepth(
00184 JNIEnv*, jobject, float value)
00185 {
00186 return app.setMaxCloudDepth(value);
00187 }
00188 JNIEXPORT void JNICALL
00189 Java_com_introlab_rtabmap_RTABMapLib_setMeshAngleTolerance(
00190 JNIEnv*, jobject, float value)
00191 {
00192 return app.setMeshAngleTolerance(value);
00193 }
00194 JNIEXPORT void JNICALL
00195 Java_com_introlab_rtabmap_RTABMapLib_setMeshTriangleSize(
00196 JNIEnv*, jobject, int value)
00197 {
00198 return app.setMeshTriangleSize(value);
00199 }
00200 JNIEXPORT jint JNICALL
00201 Java_com_introlab_rtabmap_RTABMapLib_setMappingParameter(
00202 JNIEnv* env, jobject, jstring key, jstring value)
00203 {
00204 std::string keyC, valueC;
00205 GetJStringContent(env,key,keyC);
00206 GetJStringContent(env,value,valueC);
00207 return app.setMappingParameter(keyC, valueC);
00208 }
00209
00210 JNIEXPORT void JNICALL
00211 Java_com_introlab_rtabmap_RTABMapLib_resetMapping(
00212 JNIEnv*, jobject)
00213 {
00214 return app.resetMapping();
00215 }
00216
00217 JNIEXPORT void JNICALL
00218 Java_com_introlab_rtabmap_RTABMapLib_save(
00219 JNIEnv* env, jobject)
00220 {
00221 return app.save();
00222 }
00223
00224 JNIEXPORT bool JNICALL
00225 Java_com_introlab_rtabmap_RTABMapLib_exportMesh(
00226 JNIEnv* env, jobject, jstring filePath)
00227 {
00228 std::string filePathC;
00229 GetJStringContent(env,filePath,filePathC);
00230 return app.exportMesh(filePathC);
00231 }
00232
00233 JNIEXPORT int JNICALL
00234 Java_com_introlab_rtabmap_RTABMapLib_postProcessing(
00235 JNIEnv* env, jobject, int approach)
00236 {
00237 return app.postProcessing(approach);
00238 }
00239
00240
00241
00242 #ifdef __cplusplus
00243 }
00244 #endif