00001 00002 package com.introlab.rtabmap; 00003 import android.os.IBinder; 00004 import android.view.KeyEvent; 00005 import android.util.Log; 00006 00007 00008 // Wrapper for native library 00009 00010 public class RTABMapLib 00011 { 00012 00013 static { 00014 // This project depends on tango_client_api, so we need to make sure we load 00015 // the correct library first. 00016 if (TangoInitializationHelper.loadTangoSharedLibrary() == 00017 TangoInitializationHelper.ARCH_ERROR) { 00018 Log.e(RTABMapActivity.class.getSimpleName(), "ERROR! Unable to load libtango_client_api.so!"); 00019 } 00020 System.loadLibrary("NativeRTABMap"); 00021 } 00022 00023 // Initialize the Tango Service, this function starts the communication 00024 // between the application and Tango Service. 00025 // The activity object is used for checking if the API version is outdated. 00026 public static native void onCreate(RTABMapActivity activity); 00027 00028 public static native void openDatabase(String databasePath); 00029 00030 /* 00031 * Called when the Tango service is connected. 00032 * 00033 * @param binder The native binder object. 00034 */ 00035 public static native boolean onTangoServiceConnected(IBinder binder); 00036 00037 // Release all non OpenGl resources that are allocated from the program. 00038 public static native void onPause(); 00039 00040 // Allocate OpenGL resources for rendering. 00041 public static native void initGlContent(); 00042 00043 // Setup the view port width and height. 00044 public static native void setupGraphic(int width, int height); 00045 00046 // Main render loop. 00047 public static native int render(); 00048 00049 // Set the render camera's viewing angle: 00050 // first person, third person, or top down. 00051 public static native void setCamera(int cameraIndex); 00052 00053 // Pass touch events to the native layer. 00054 public static native void onTouchEvent(int touchCount, int event0, 00055 float x0, float y0, float x1, float y1); 00056 00057 00058 public static native void setPausedMapping(boolean paused); 00059 public static native void setMapCloudShown(boolean shown); 00060 public static native void setOdomCloudShown(boolean shown); 00061 public static native void setMeshRendering(boolean enabled); 00062 public static native void setLocalizationMode(boolean enabled); 00063 public static native void setTrajectoryMode(boolean enabled); 00064 public static native void setGraphOptimization(boolean enabled); 00065 public static native void setNodesFiltering(boolean enabled); 00066 public static native void setGraphVisible(boolean visible); 00067 public static native void setAutoExposure(boolean enabled); 00068 public static native void setFullResolution(boolean enabled); 00069 public static native void setMaxCloudDepth(float value); 00070 public static native void setMeshAngleTolerance(float value); 00071 public static native void setMeshTriangleSize(int value); 00072 public static native int setMappingParameter(String key, String value); 00073 00074 public static native void resetMapping(); 00075 public static native void save(); 00076 public static native boolean exportMesh(String filePath); 00077 public static native int postProcessing(int approach); 00078 00079 public static native String getStatus(); 00080 public static native int getTotalNodes(); 00081 public static native int getTotalWords(); 00082 public static native int getTotalPoints(); 00083 public static native float getUpdateTime(); 00084 public static native int getLoopClosureId(); 00085 00086 }