增加离线地图下载流程
This commit is contained in:
@@ -5,6 +5,7 @@ import android.util.Log
|
||||
import com.navinfo.collect.library.map.handler.*
|
||||
import com.navinfo.collect.library.map.maphandler.MeasureLayerHandler
|
||||
import com.navinfo.collect.library.map.handler.ViewportHandler
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
|
||||
/**
|
||||
* 地图控制器
|
||||
@@ -22,7 +23,8 @@ class NIMapController {
|
||||
lateinit var measureLayerHandler: MeasureLayerHandler
|
||||
|
||||
|
||||
fun init(context: Context, mapView: NIMapView, options: NIMapOptions? = null) {
|
||||
fun init(context: Context, mapView: NIMapView, options: NIMapOptions? = null, mapPath: String) {
|
||||
Constant.MAP_PATH = mapPath
|
||||
layerManagerHandler = LayerManagerHandler(context, mapView)
|
||||
locationLayerHandler = LocationLayerHandler(context, mapView)
|
||||
animationHandler = AnimationHandler(context, mapView)
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.Environment
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.NIMapView.LAYER_GROUPS
|
||||
import com.navinfo.collect.library.map.source.NavinfoMapRastorTileSource
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import okhttp3.Cache
|
||||
import okhttp3.OkHttpClient
|
||||
import org.oscim.layers.Layer
|
||||
@@ -18,7 +19,6 @@ import java.io.File
|
||||
*/
|
||||
class LayerManagerHandler(context: Context, mapView: NIMapView) :
|
||||
BaseHandler(context, mapView) {
|
||||
lateinit var mLocationLayer: LocationLayer
|
||||
private var baseRasterLayer: Layer? = null
|
||||
|
||||
init {
|
||||
@@ -62,7 +62,7 @@ class LayerManagerHandler(context: Context, mapView: NIMapView) :
|
||||
// 如果使用缓存
|
||||
if (useCache) {
|
||||
val cacheDirectory: File =
|
||||
File(Environment.getExternalStorageState() + "/" + "lalalal", "tiles-raster")
|
||||
File(Constant.MAP_PATH, "tiles-raster")
|
||||
val cacheSize = 300 * 1024 * 1024 // 300 MB
|
||||
val cache = Cache(cacheDirectory, cacheSize.toLong())
|
||||
builder.cache(cache)
|
||||
|
||||
@@ -11,14 +11,7 @@ import java.util.Map;
|
||||
|
||||
public class Constant {
|
||||
|
||||
public static String SD_PATH = Environment.getExternalStorageDirectory() + "";
|
||||
public static String ROOT_PATH = SD_PATH + "/NavinfoCollect";
|
||||
|
||||
public static String PHOTO_PATH = ROOT_PATH + "/image";
|
||||
|
||||
|
||||
public static double CONVERSION_FACTOR = 1000000d;
|
||||
|
||||
public static String MAP_PATH = Environment.getExternalStorageDirectory() + "/map/";
|
||||
|
||||
public static void setVisibleTypeMap(Map<String, Boolean> visibleTypeMap) {
|
||||
Map<String, Boolean> HD_LAYER_VISIABLE_MAP= new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user