public class GLMapManager
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GLMapManager.StateListener |
static interface |
GLMapManager.TileDownloadProgress |
| Constructor and Description |
|---|
GLMapManager() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
AddMap(android.content.res.AssetManager mng,
java.lang.String assetFileName,
ProgressCallback progressCallback)
Adds vector map.
|
static void |
addStateListener(GLMapManager.StateListener listener)
Subscribes listener to events about map downloading progress.
|
static void |
CacheTiles(long[] tiles,
GLMapManager.TileDownloadProgress progress)
Check if tiles cached.
|
static GLMapDownloadTask |
createDownloadTask(GLMapInfo info,
android.content.Context context)
Create map downloading task
|
static GLMapDownloadTask |
createDownloadTask(GLMapInfo info,
java.io.File downloadDir)
Create map downloading task
|
static double |
DistanceToMap(GLMapInfo map,
MapPoint point)
Calculates distance from the map to the point
|
static GLMapInfo |
FindNearestMap(GLMapInfo[] maps,
MapPoint point)
Helper function that iterates over maps param and returns closest
GLMapInfo to the given point. |
static GLMapInfo[] |
getChildMaps()
Return array of maps including submaps
|
static GLMapDownloadTask |
getDownloadTask(GLMapInfo mapInfo)
Returns download task for map
|
static java.util.List<GLMapDownloadTask> |
getMapDownloadTasks() |
static GLMapInfo[] |
getMaps() |
static GLMapInfo |
getMapWithID(long mapID) |
static boolean |
GetTileDownloadingAllowed() |
static boolean |
initialize(android.content.Context context,
java.lang.String apiKey,
ProgressCallback progressCallback)
Initializes GLMapManager
|
static GLMapInfo |
MapAtPoint(MapPoint point)
Returns mapID of vector map that contains given point.
|
static long[] |
NotCachedVectorTilesAtBBox(GLMapBBox bbox)
Returns not cached vector tiles that bbox contains or intersects
|
static void |
RemoveMap(GLMapInfo map)
Delete map
|
static void |
RemoveMap(java.lang.String fileName)
Removes vector map from map manager.
|
static void |
removeStateListener(GLMapManager.StateListener val)
Removes listener added by
addStateListener |
static void |
setCachesDir(java.lang.String val)
Sets location of caches before initialization.
|
static void |
SetTileDownloadingAllowed(boolean val)
Allows
GLMapManager to download single tiles when downloaded vector maps does not contain data. |
static void |
SortMaps(GLMapInfo[] maps,
MapPoint point)
Sorts array of
GLMapInfo by distance from given point |
static void |
updateDownloadedMaps(android.content.Context context,
java.util.List<java.io.File> customDirs)
Updates location of downloaded maps from default locations and optionally given directories
|
static void |
updateMapList(android.content.Context context,
java.lang.Runnable complete)
Updates map list from server
|
static long[] |
VectorTilesAtBBox(GLMapBBox bbox)
Returns vector tiles that bbox contains or intersects
|
public static boolean initialize(android.content.Context context,
java.lang.String apiKey,
ProgressCallback progressCallback)
During first initialization it copies world map file from app resources to cache directory. Framework uses progressCallback to notify about initialization(copying) progress
context - Application contextapiKey - API key of this applicationprogressCallback - initialization progress callbackpublic static void setCachesDir(java.lang.String val)
val - location of caches dirpublic static void RemoveMap(GLMapInfo map)
map - map to deleteGLMapInfo.getMapID()public static void updateMapList(android.content.Context context,
java.lang.Runnable complete)
context - the Context where map list will be cachedcomplete - runnable, called when map update is completepublic static void updateDownloadedMaps(android.content.Context context,
java.util.List<java.io.File> customDirs)
context - the Context used to find default map locationscustomDirs - Array of custom paths of mapspublic static GLMapDownloadTask createDownloadTask(GLMapInfo info, android.content.Context context)
info - map info objectcontext - the Context used to find place where map will be savedpublic static GLMapDownloadTask createDownloadTask(GLMapInfo info, java.io.File downloadDir)
info - map info objectdownloadDir - directory where map will be savedpublic static void removeStateListener(GLMapManager.StateListener val)
addStateListenerval - Listener to removeaddStateListener(StateListener)public static void addStateListener(GLMapManager.StateListener listener)
Event name is sent via fieldName
finished 0 at start, 1 at end of task
progressDownload sent each time when download progress is changed.
task.addListener(new FieldListener(){
public void fieldValueChanged(Object obj, String fieldName, Object newValue){
((MapsAdapter)listView.getAdapter()).notifyDataSetChanged();
}
});
listener - that will receive eventsremoveStateListener(StateListener)public static java.util.List<GLMapDownloadTask> getMapDownloadTasks()
public static GLMapDownloadTask getDownloadTask(GLMapInfo mapInfo)
mapInfo - Info of mappublic static GLMapInfo[] getChildMaps()
public static GLMapInfo[] getMaps()
public static GLMapInfo getMapWithID(long mapID)
mapID - MapId of mappublic static boolean AddMap(android.content.res.AssetManager mng,
java.lang.String assetFileName,
ProgressCallback progressCallback)
mng - AssetManager where custom map is locatedassetFileName - name of custom mapprogressCallback - callback to track progress of custom map cachingpublic static void RemoveMap(java.lang.String fileName)
fileName - name of custom mappublic static GLMapInfo MapAtPoint(MapPoint point)
point - point that vector map must containpublic static GLMapInfo FindNearestMap(GLMapInfo[] maps, MapPoint point)
GLMapInfo to the given point.maps - array of map objectspoint - point that vector map must containpublic static double DistanceToMap(GLMapInfo map, MapPoint point)
map - map objectpoint - some pointpublic static void SortMaps(GLMapInfo[] maps, MapPoint point)
GLMapInfo by distance from given pointmaps - array of map objectspoint - center from where distance is calculatedpublic static void SetTileDownloadingAllowed(boolean val)
GLMapManager to download single tiles when downloaded vector maps does not contain data.val - true to enable tile downloadingpublic static boolean GetTileDownloadingAllowed()
public static long[] VectorTilesAtBBox(GLMapBBox bbox)
bbox - bbox of areapublic static long[] NotCachedVectorTilesAtBBox(GLMapBBox bbox)
bbox - bbox of areapublic static void CacheTiles(long[] tiles,
GLMapManager.TileDownloadProgress progress)
tiles - tiles to checkprogress - callbacks that will be called when one tile is checked.Copyright © 2017 GetYourMap. All Rights Reserved.