当前位置: 首页>>代码示例>>Java>>正文


Java AndroidUtil.createTileCache方法代码示例

本文整理汇总了Java中org.mapsforge.map.android.util.AndroidUtil.createTileCache方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidUtil.createTileCache方法的具体用法?Java AndroidUtil.createTileCache怎么用?Java AndroidUtil.createTileCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mapsforge.map.android.util.AndroidUtil的用法示例。


在下文中一共展示了AndroidUtil.createTileCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLayers

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@AfterPermissionGranted(PERMISSIONS_REQUEST_READ_STORAGE)
private void createLayers() {
    if (EasyPermissions.hasPermissions(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)) {
        TileCache tileCache = AndroidUtil.createTileCache(getContext(),
                "mapFragment",
                this.mapView.getModel().displayModel.getTileSize(),
                1.0f,
                this.mapView.getModel().frameBufferModel.getOverdrawFactor());

        final Layers layers = this.mapView.getLayerManager().getLayers();
        final MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;

        initializePosition(mapViewPosition);

        TileRendererLayer tileRendererLayer = createTileRendererLayer(tileCache, mapViewPosition,
                getMapFile(), getRenderTheme());
        layers.add(tileRendererLayer);

        LabelLayer labelLayer = new LabelLayer(AndroidGraphicFactory.INSTANCE, tileRendererLayer.getLabelStore());
        mapView.getLayerManager().getLayers().add(labelLayer);

        // overlay with a marker to show the goal position
        this.goalLocationOverlay = new Marker(null, null, 0, 0);
        layers.add(this.goalLocationOverlay);

        createLocationLayer();
    } else {
        EasyPermissions.requestPermissions(
                this,
                "",
                PERMISSIONS_REQUEST_READ_STORAGE,
                Manifest.permission.READ_EXTERNAL_STORAGE);
    }
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:35,代码来源:MapFragment.java

示例2: onCreate

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mapView = new MapView(this);
    mapView.setClickable(true);
    mapView.getMapScaleBar().setVisible(true);
    mapView.setBuiltInZoomControls(true);
    mapView.getMapZoomControls().setZoomLevelMin((byte) 5);
    mapView.getMapZoomControls().setZoomLevelMax((byte) 20);

    worldMap = new MapFile(new File(Constant.PATH_WORLDMAP));
    taiwanMap = new MapFile(new File(Constant.PATH_TAIWANMAP));
    multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);

    tileCache = AndroidUtil.createTileCache(this, "mapcache", mapView.getModel().displayModel.getTileSize(), 1f, this.mapView.getModel().frameBufferModel.getOverdrawFactor());
    setContentView(mapView);
}
 
开发者ID:lienching,项目名称:MapsforgeSample,代码行数:19,代码来源:SimpleMapView.java

示例3: onCreate

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
	AndroidGraphicFactory.createInstance(getActivity().getApplication());
	mapView = new MapView(getActivity());
	//
	mapView.setClickable(true);
	mapView.getMapScaleBar().setVisible(true);
	mapView.setBuiltInZoomControls(true);
	mapView.getMapZoomControls().setZoomLevelMin((byte)2);
	mapView.getMapZoomControls().setZoomLevelMax((byte)18);
	mapView.getMapZoomControls().setShowMapZoomControls(true);
	mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
		1f, mapView.getModel().frameBufferModel.getOverdrawFactor());

	polyline = new AlternatingLine(AndroidGraphicFactory.INSTANCE);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:19,代码来源:Map.java

示例4: onCreate

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
	AndroidGraphicFactory.createInstance(getActivity().getApplication());
	mapView = new MapView(getActivity());
	//
	mapView.setClickable(true);
	mapView.getMapScaleBar().setVisible(true);
	mapView.setBuiltInZoomControls(true);
	mapView.getMapZoomControls().setZoomLevelMin((byte)2);
	mapView.getMapZoomControls().setZoomLevelMax((byte)18);
	mapView.getMapZoomControls().setShowMapZoomControls(true);
	mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	for (int i=0;i<tileCaches.length;i++) {
		tileCaches[i]= AndroidUtil.createTileCache(getActivity(),
			"mapcache-" + i, mapView.getModel().displayModel.getTileSize(), 1f,
			mapView.getModel().frameBufferModel.getOverdrawFactor());
	}
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:20,代码来源:Map.java

示例5: onCreate

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
	AndroidGraphicFactory.createInstance(getActivity().getApplication());
	mapView = new MapView(getActivity());
	//
	mapView.setClickable(true);
	mapView.getMapScaleBar().setVisible(true);
	mapView.setBuiltInZoomControls(true);
	mapView.getMapZoomControls().setZoomLevelMin((byte)2);
	mapView.getMapZoomControls().setZoomLevelMax((byte)18);
	mapView.getMapZoomControls().setShowMapZoomControls(true);
	mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
		1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:17,代码来源:Map.java

示例6: onCreateView

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View rootView = inflater.inflate(R.layout.fragment_item_detail,
			container, false);

	if (this.dummyItem != null) {
		this.mapView = (MapView) rootView.findViewById(R.id.mapView);
		this.mapView.setClickable(true);
		this.mapView.getFpsCounter().setVisible(true);
		this.mapView.getMapScaleBar().setVisible(true);

		LayerManager layerManager = this.mapView.getLayerManager();
		Layers layers = layerManager.getLayers();

		MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
		mapViewPosition.setZoomLevel((byte) 16);
		this.tileCache = AndroidUtil.createTileCache(this.getActivity(),
				"fragments",
				this.mapView.getModel().displayModel.getTileSize(), 1.0f,
				1.5);

		mapViewPosition.setCenter(this.dummyItem.location);
		layers.add(AndroidUtil.createTileRendererLayer(this.tileCache,
				mapViewPosition, getMapFile(),
				InternalRenderTheme.OSMARENDER, false, true));

	}

	return rootView;
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:32,代码来源:ItemDetailFragment.java

示例7: onCreate

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if (DEBUG) Log.d(TAG, "onCreate");
	Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
		@Override
		public void uncaughtException(Thread thread, Throwable e) {
			Log.e(TAG, "error e=" + e, e);
			finish();
		}
	});
	AndroidGraphicFactory.createInstance(getApplication());
	mapView = new MapView(this);
	setContentView(mapView);
	mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	mapView.setClickable(true);
	mapView.getMapScaleBar().setVisible(true);
	mapView.setBuiltInZoomControls(true);
	mapView.getMapZoomControls().setZoomLevelMin((byte)2);
	mapView.getMapZoomControls().setZoomLevelMax((byte)18);
	mapView.getMapZoomControls().setShowMapZoomControls(true);
	// create a tile cache of suitable size
	tileCache = AndroidUtil.createTileCache(this, "mapcache",
		mapView.getModel().displayModel.getTileSize(), 1f,
		mapView.getModel().frameBufferModel.getOverdrawFactor());
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:26,代码来源:Sample.java

示例8: onCreate

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
	super.onCreate(bundle);
	if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
	AndroidGraphicFactory.createInstance(getActivity().getApplication());
	mapView = new MapView(getActivity());
	//
	mapView.setClickable(true);
	AndroidUtil.setMapScaleBar(mapView, MetricUnitAdapter.INSTANCE, null);
	mapView.getMapScaleBar().setVisible(true);
	mapView.setBuiltInZoomControls(true);
	mapView.getMapZoomControls().setZoomLevelMin((byte)2);
	mapView.getMapZoomControls().setZoomLevelMax((byte)18);
	mapView.getMapZoomControls().setShowMapZoomControls(true);
	mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
	DisplayModel displayModel = mapView.getModel().displayModel;
	displayModel.setBackgroundColor(0xffff0000); // red background, defaults to 0xffeeeeee
	displayModel.setFixedTileSize(512); // change the tile size, defaults to 256
	// displayModel.setMaxTextWidthFactor(0.3f); // defaults to .7f
	// displayModel.setTileSizeMultiple(100); // defaults to 64
	displayModel.setUserScaleFactor(1.5f); // scaled map, defaults to 1.0f
	tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
		1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:24,代码来源:Map.java

示例9: onCreateView

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rvalue = inflater.inflate(R.layout.fragment_map, container, false);
    tileCache = AndroidUtil.createTileCache(getActivity(), MapsConfig.TILE_CACHE_ID, MapsConfig.TILE_SIZE, MapsConfig.SCREEN_RATION, MapsConfig.OVERDRAW);
    final File mapFile = AbstractMap.instance().getMapsforgeFile(getActivity());
    mMapView = new MapsforgeMapView(getActivity(), tileCache, mapFile.getAbsolutePath());
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    RelativeLayout forMap = (RelativeLayout) rvalue.findViewById(R.id.layout_map);
    forMap.addView(mMapView, 0, params);
    buildGoogleApiClient();
    return rvalue;
}
 
开发者ID:yuviii,项目名称:OfflineMap,代码行数:13,代码来源:MapFragment.java

示例10: onCreateView

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rvalue = inflater.inflate(R.layout.fragment_map, container, false);

    tileCache = AndroidUtil.createTileCache(getActivity(), MapsConfig.TILE_CACHE_ID, MapsConfig.TILE_SIZE, MapsConfig.SCREEN_RATION, MapsConfig.OVERDRAW);
    final File mapFile = AbstractMap.instance().getMapsforgeFile(getActivity());
    mMapView = new MapsforgeMapView(getActivity(), tileCache, mapFile.getAbsolutePath());
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    RelativeLayout forMap = (RelativeLayout) rvalue.findViewById(R.id.layout_map);
    forMap.addView(mMapView, 0, params);

    return rvalue;
}
 
开发者ID:lassana,项目名称:offline-routing-sample,代码行数:14,代码来源:MapFragment.java

示例11: init

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
public void init(Activity activity, MapView mapView, String currentArea, File mapsFolder) {
    this.activity = activity;
    this.mapView = mapView;
    this.currentArea = currentArea;
    this.mapsFolder = mapsFolder;
    //        this.prepareInProgress = prepareInProgress;
    tileCache = AndroidUtil
            .createTileCache(activity, getClass().getSimpleName(), mapView.getModel().displayModel.getTileSize(),
                    1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
 
开发者ID:junjunguo,项目名称:PocketMaps,代码行数:11,代码来源:MapHandler.java

示例12: initialize

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
public static boolean initialize(String locationOfMapFile,String renderThemeAddr, Context _context) {
		Log.i(TAG, "Initilizing started");
		mapFilePath = locationOfMapFile;
		androidGraphicFactory = AndroidGraphicFactory.INSTANCE;
		
		mapFile = new File(mapFilePath);
		
		displayModel = new DisplayModel();

		
		mapViewPosition = new MapViewPosition(displayModel);
		
		mapDataStore = new MapFile(mapFile);

		displayModel.setFixedTileSize(256);
		
		TileCache tileCache = AndroidUtil.createTileCache(context, "111", 256, 1.0f, 1d);
//		TileCache tileCache = null;

		databaseRenderer = new DatabaseRenderer(mapDataStore, androidGraphicFactory, tileCache);
		context = _context;
		
		try {
			xmlRenderTheme = new ExternalRenderTheme(new File(renderThemeAddr	));
			Log.i(TAG, "xmlRenderTheme initialized successfully");
		}
		catch(Throwable e)
		{
			Log.i(TAG, "xmlRenderTheme error initializing ");
			e.printStackTrace();
		}

		renderThemeFuture = new RenderThemeFuture(AndroidGraphicFactory.INSTANCE, xmlRenderTheme, displayModel);
		new Thread(renderThemeFuture).run();

		Log.i(TAG, "Mapsforge Initializing Ended");
		
		return true;
	}
 
开发者ID:Arman92,项目名称:Mapsforge-OsmDroid-GraphHopper,代码行数:40,代码来源:MFTileSource.java

示例13: LayerBase

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
LayerBase(Tabulae activity, MapView mapView, boolean persistant) {
	this.mapView = mapView;
	if (persistant) {
		int size = AndroidUtil.getMinimumCacheSize(activity, mapView.getModel().displayModel.getTileSize(), mapView.getModel().frameBufferModel.getOverdrawFactor(), 1f);
		//if (DEBUG) Log.d(TAG, "LayerBase.LayerBase minmal cache size=" + size);
		memCache = new InMemoryTileCache(size);
		tileCache = new TwoLevelTileCache(
				memCache,
				new FileSystemTileCache(99999, new File(activity.getTilesDir(), getId()), AndroidGraphicFactory.INSTANCE, true)
		);
	} else {
		tileCache = AndroidUtil.createTileCache(activity, getId(), mapView.getModel().displayModel.getTileSize(),
				1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
	}
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:16,代码来源:LayerBase.java

示例14: createTileCache

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
/**
 * Creates a tile cache for the baselayer
 *
 * @return
 */
protected final TileCache createTileCache() {
    if (mMapView == null) {
        return null;
    }
    return AndroidUtil.createTileCache(
            getActivity().getApplicationContext(),
            "mapcache",
            mMapView.getModel().displayModel.getTileSize(),
            1f,
            mMapView.getModel().frameBufferModel.getOverdrawFactor());
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:17,代码来源:MapViewActivity.java

示例15: createTileCache2

import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
protected TileCache createTileCache2() {
	int tileSize = this.mapView2.getModel().displayModel
			.getTileSize();
	return AndroidUtil.createTileCache(this, getPersistableId2(), tileSize,
			getScreenRatio2(),
			this.mapView2.getModel().frameBufferModel
					.getOverdrawFactor());
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:9,代码来源:DualMapnikMapViewer.java


注:本文中的org.mapsforge.map.android.util.AndroidUtil.createTileCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。