forked from organicmaps/organicmaps
[android] Added missing jni method to framework, refactored a bit.
This commit is contained in:
parent
51d302dd67
commit
5ea1f69c62
2 changed files with 64 additions and 56 deletions
|
@ -1164,6 +1164,9 @@ extern "C"
|
|||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeGetActiveMapObject(JNIEnv * env, jclass thiz)
|
||||
{
|
||||
return usermark_helper::CreateMapObject(g_framework->GetActiveUserMark());
|
||||
UserMark const * mark = g_framework->GetActiveUserMark();
|
||||
if (!mark)
|
||||
return nullptr;
|
||||
return usermark_helper::CreateMapObject(mark);
|
||||
}
|
||||
} // extern "C"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.mapswithme.maps;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.mapswithme.maps.MapStorage.Index;
|
||||
import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut;
|
||||
import com.mapswithme.maps.bookmarks.data.MapObject;
|
||||
|
@ -55,74 +57,74 @@ public class Framework
|
|||
|
||||
public static native void nativeShowTrackRect(int category, int track);
|
||||
|
||||
public native static int getDrawScale();
|
||||
public static native int getDrawScale();
|
||||
|
||||
public native static double[] getScreenRectCenter();
|
||||
public static native double[] getScreenRectCenter();
|
||||
|
||||
public native static DistanceAndAzimut nativeGetDistanceAndAzimut(double dstMerX, double dstMerY, double srcLat, double srcLon, double north);
|
||||
public static native DistanceAndAzimut nativeGetDistanceAndAzimut(double dstMerX, double dstMerY, double srcLat, double srcLon, double north);
|
||||
|
||||
public native static DistanceAndAzimut nativeGetDistanceAndAzimutFromLatLon(double dstLat, double dstLon, double srcLat, double srcLon, double north);
|
||||
public static native DistanceAndAzimut nativeGetDistanceAndAzimutFromLatLon(double dstLat, double dstLon, double srcLat, double srcLon, double north);
|
||||
|
||||
public native static String nativeFormatLatLon(double lat, double lon, boolean useDMSFormat);
|
||||
public static native String nativeFormatLatLon(double lat, double lon, boolean useDMSFormat);
|
||||
|
||||
public native static String[] nativeFormatLatLonToArr(double lat, double lon, boolean useDMSFormat);
|
||||
public static native String[] nativeFormatLatLonToArr(double lat, double lon, boolean useDMSFormat);
|
||||
|
||||
public native static String nativeFormatAltitude(double alt);
|
||||
public static native String nativeFormatAltitude(double alt);
|
||||
|
||||
public native static String nativeFormatSpeed(double speed);
|
||||
public static native String nativeFormatSpeed(double speed);
|
||||
|
||||
public native static String nativeGetGe0Url(double lat, double lon, double zoomLevel, String name);
|
||||
public static native String nativeGetGe0Url(double lat, double lon, double zoomLevel, String name);
|
||||
|
||||
public native static String nativeGetNameAndAddress4Point(double lat, double lon);
|
||||
public static native String nativeGetNameAndAddress4Point(double lat, double lon);
|
||||
|
||||
public native static MapObject nativeGetMapObjectForPoint(double lat, double lon);
|
||||
public static native MapObject nativeGetMapObjectForPoint(double lat, double lon);
|
||||
|
||||
public native static void nativeSetMapObjectListener(MapObjectListener listener);
|
||||
public static native void nativeSetMapObjectListener(MapObjectListener listener);
|
||||
|
||||
public native static void nativeRemoveMapObjectListener();
|
||||
public static native void nativeRemoveMapObjectListener();
|
||||
|
||||
public native static String nativeGetOutdatedCountriesString();
|
||||
public static native String nativeGetOutdatedCountriesString();
|
||||
|
||||
public native static boolean nativeIsDataVersionChanged();
|
||||
public static native boolean nativeIsDataVersionChanged();
|
||||
|
||||
public native static void nativeUpdateSavedDataVersion();
|
||||
public static native void nativeUpdateSavedDataVersion();
|
||||
|
||||
public native static long nativeGetDataVersion();
|
||||
public static native long nativeGetDataVersion();
|
||||
|
||||
public native static void nativeClearApiPoints();
|
||||
public static native void nativeClearApiPoints();
|
||||
|
||||
public native static void deactivatePopup();
|
||||
public static native void deactivatePopup();
|
||||
|
||||
public native static String[] nativeGetMovableFilesExts();
|
||||
public static native String[] nativeGetMovableFilesExts();
|
||||
|
||||
public native static String nativeGetBookmarksExt();
|
||||
public static native String nativeGetBookmarksExt();
|
||||
|
||||
public native static String nativeGetBookmarkDir();
|
||||
public static native String nativeGetBookmarkDir();
|
||||
|
||||
public native static String nativeGetSettingsDir();
|
||||
public static native String nativeGetSettingsDir();
|
||||
|
||||
public native static String nativeGetWritableDir();
|
||||
public static native String nativeGetWritableDir();
|
||||
|
||||
public native static void nativeSetWritableDir(String newPath);
|
||||
public static native void nativeSetWritableDir(String newPath);
|
||||
|
||||
public native static void nativeLoadBookmarks();
|
||||
public static native void nativeLoadBookmarks();
|
||||
|
||||
// Routing.
|
||||
public native static boolean nativeIsRoutingActive();
|
||||
public static native boolean nativeIsRoutingActive();
|
||||
|
||||
public native static boolean nativeIsRouteBuilt();
|
||||
public static native boolean nativeIsRouteBuilt();
|
||||
|
||||
public native static boolean nativeIsRouteBuilding();
|
||||
public static native boolean nativeIsRouteBuilding();
|
||||
|
||||
public native static void nativeCloseRouting();
|
||||
public static native void nativeCloseRouting();
|
||||
|
||||
public native static void nativeBuildRoute(double startLat, double startLon, double finishLat, double finishLon);
|
||||
public static native void nativeBuildRoute(double startLat, double startLon, double finishLat, double finishLon);
|
||||
|
||||
public native static void nativeFollowRoute();
|
||||
public static native void nativeFollowRoute();
|
||||
|
||||
public native static void nativeDisableFollowing();
|
||||
public static native void nativeDisableFollowing();
|
||||
|
||||
public native static RoutingInfo nativeGetRouteFollowingInfo();
|
||||
public static native RoutingInfo nativeGetRouteFollowingInfo();
|
||||
|
||||
// When an end user is going to a turn he gets sound turn instructions.
|
||||
// If C++ part wants the client to pronounce an instruction nativeGenerateTurnNotifications returns
|
||||
|
@ -130,55 +132,55 @@ public class Framework
|
|||
// For example if C++ part wants the client to pronounce "Make a right turn." this method returns
|
||||
// an array with one string "Make a right turn.". The next call of the method returns nothing.
|
||||
// nativeGenerateTurnNotifications shall be called by the client when a new position is available.
|
||||
public native static String[] nativeGenerateTurnNotifications();
|
||||
public static native String[] nativeGenerateTurnNotifications();
|
||||
|
||||
public native static void nativeSetRoutingListener(RoutingListener listener);
|
||||
public static native void nativeSetRoutingListener(RoutingListener listener);
|
||||
|
||||
public native static void nativeSetRouteProgressListener(RoutingProgressListener listener);
|
||||
public static native void nativeSetRouteProgressListener(RoutingProgressListener listener);
|
||||
|
||||
public native static String nativeGetCountryNameIfAbsent(double lat, double lon);
|
||||
public static native String nativeGetCountryNameIfAbsent(double lat, double lon);
|
||||
|
||||
public native static Index nativeGetCountryIndex(double lat, double lon);
|
||||
public static native Index nativeGetCountryIndex(double lat, double lon);
|
||||
|
||||
public native static String nativeGetViewportCountryNameIfAbsent();
|
||||
public static native String nativeGetViewportCountryNameIfAbsent();
|
||||
|
||||
public native static void nativeShowCountry(Index idx, boolean zoomToDownloadButton);
|
||||
public static native void nativeShowCountry(Index idx, boolean zoomToDownloadButton);
|
||||
|
||||
// TODO consider removal of that methods
|
||||
public native static void downloadCountry(Index idx);
|
||||
public static native void downloadCountry(Index idx);
|
||||
|
||||
public native static double[] predictLocation(double lat, double lon, double accuracy, double bearing, double speed, double elapsedSeconds);
|
||||
public static native double[] predictLocation(double lat, double lon, double accuracy, double bearing, double speed, double elapsedSeconds);
|
||||
|
||||
public native static void nativeSetMapStyle(int mapStyle);
|
||||
public static native void nativeSetMapStyle(int mapStyle);
|
||||
|
||||
/**
|
||||
* This method allows to set new map style without immediate applying. It can be used before
|
||||
* engine recreation instead of nativeSetMapStyle to avoid huge flow of OpenGL invocations.
|
||||
* @param mapStyle style index
|
||||
*/
|
||||
public native static void nativeMarkMapStyle(int mapStyle);
|
||||
public static native void nativeMarkMapStyle(int mapStyle);
|
||||
|
||||
public native static void nativeSetRouter(int routerType);
|
||||
public static native void nativeSetRouter(int routerType);
|
||||
|
||||
public native static int nativeGetRouter();
|
||||
public static native int nativeGetRouter();
|
||||
|
||||
public native static int nativeGetLastUsedRouter();
|
||||
public static native int nativeGetLastUsedRouter();
|
||||
|
||||
/**
|
||||
* @return {@link Framework#ROUTER_TYPE_VEHICLE} or {@link Framework#ROUTER_TYPE_PEDESTRIAN}
|
||||
*/
|
||||
public native static int nativeGetBestRouter(double srcLat, double srcLon, double dstLat, double dstLon);
|
||||
public static native int nativeGetBestRouter(double srcLat, double srcLon, double dstLat, double dstLon);
|
||||
|
||||
public native static void nativeSetRouteStartPoint(double lat, double lon, boolean valid);
|
||||
public static native void nativeSetRouteStartPoint(double lat, double lon, boolean valid);
|
||||
|
||||
public native static void nativeSetRouteEndPoint(double lat, double lon, boolean valid);
|
||||
public static native void nativeSetRouteEndPoint(double lat, double lon, boolean valid);
|
||||
|
||||
/**
|
||||
* Registers all maps(.mwms). Adds them to the models, generates indexes and does all necessary stuff.
|
||||
*/
|
||||
public native static void nativeRegisterMaps();
|
||||
public static native void nativeRegisterMaps();
|
||||
|
||||
public native static void nativeDeregisterMaps();
|
||||
public static native void nativeDeregisterMaps();
|
||||
|
||||
/**
|
||||
* Determines if currently is day or night at the given location. Used to switch day/night styles.
|
||||
|
@ -189,7 +191,10 @@ public class Framework
|
|||
*/
|
||||
public static native boolean nativeIsDayTime(long utcTimeSeconds, double lat, double lon);
|
||||
|
||||
public native static void nativeGet3dMode(Params3dMode result);
|
||||
public static native void nativeGet3dMode(Params3dMode result);
|
||||
|
||||
public native static void nativeSet3dMode(boolean allow3d, boolean allow3dBuildings);
|
||||
public static native void nativeSet3dMode(boolean allow3d, boolean allow3dBuildings);
|
||||
|
||||
@Nullable
|
||||
public static native MapObject nativeGetActiveMapObject();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue